Skip to content

Commit 0bb49b1

Browse files
authored
fix: resolve type definition error in svelte/compiler (#11283)
* fix generated type * add changeset
1 parent dcfa503 commit 0bb49b1

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

.changeset/lucky-colts-remember.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte": patch
3+
---
4+
5+
fix: resolve type definition error in `svelte/compiler`

packages/svelte/src/compiler/index.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getLocator } from 'locate-character';
2-
import { walk } from 'zimmerframe';
2+
import { walk as zimmerframe_walk } from 'zimmerframe';
33
import { CompileError } from './errors.js';
44
import { convert } from './legacy.js';
55
import { parse as parse_acorn } from './phases/1-parse/acorn.js';
@@ -133,7 +133,7 @@ export function parse(source, options = {}) {
133133
function to_public_ast(source, ast, modern) {
134134
if (modern) {
135135
// remove things that we don't want to treat as public API
136-
return walk(ast, null, {
136+
return zimmerframe_walk(ast, null, {
137137
_(node, { next }) {
138138
// @ts-ignore
139139
delete node.parent;
@@ -151,14 +151,12 @@ function to_public_ast(source, ast, modern) {
151151
* @deprecated Replace this with `import { walk } from 'estree-walker'`
152152
* @returns {never}
153153
*/
154-
function _walk() {
154+
export function walk() {
155155
throw new Error(
156156
`'svelte/compiler' no longer exports a \`walk\` utility — please import it directly from 'estree-walker' instead`
157157
);
158158
}
159159

160-
export { _walk as walk };
161-
162160
export { CompileError } from './errors.js';
163161

164162
export { VERSION } from '../version.js';

packages/svelte/types/index.d.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ declare module 'svelte/compiler' {
507507
/**
508508
* @deprecated Replace this with `import { walk } from 'estree-walker'`
509509
* */
510-
function walk(): never;
510+
export function walk(): never;
511511
/** The return value of `compile` from `svelte/compiler` */
512512
interface CompileResult {
513513
/** The compiled JavaScript */
@@ -1763,8 +1763,6 @@ declare module 'svelte/compiler' {
17631763
style?: Preprocessor;
17641764
script?: Preprocessor;
17651765
}
1766-
1767-
export { walk };
17681766
}
17691767

17701768
declare module 'svelte/easing' {

0 commit comments

Comments
 (0)