Skip to content

Commit 10992fa

Browse files
authored
chore: update deps and some fixes (#562)
1 parent d9e16ed commit 10992fa

14 files changed

+111
-203
lines changed

explorer-v2/package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@
1212
"preview": "vite preview"
1313
},
1414
"dependencies": {
15-
"@fontsource/fira-mono": "^5.0.13",
16-
"@typescript-eslint/parser": "^7.13.1",
15+
"@fontsource/fira-mono": "^5.1.0",
16+
"@typescript-eslint/parser": "^7.18.0",
1717
"eslint": "^8.57.0",
1818
"eslint-scope": "^7.2.2",
19-
"esquery": "^1.5.0",
19+
"esquery": "^1.6.0",
2020
"pako": "^2.1.0",
21-
"svelte": "^5.0.0-next.160",
21+
"svelte": "^5.0.0-next.245",
2222
"svelte-eslint-parser": "link:..",
23-
"tslib": "^2.6.3"
23+
"tslib": "^2.7.0"
2424
},
2525
"devDependencies": {
26-
"@sveltejs/adapter-static": "^3.0.2",
27-
"@sveltejs/kit": "^2.5.17",
28-
"@sveltejs/vite-plugin-svelte": "^3.1.1",
26+
"@sveltejs/adapter-static": "^3.0.4",
27+
"@sveltejs/kit": "^2.5.26",
28+
"@sveltejs/vite-plugin-svelte": "^3.1.2",
2929
"monaco-editor": "^0.50.0",
30-
"prettier": "^3.3.2",
31-
"prettier-plugin-svelte": "^3.2.4",
30+
"prettier": "^3.3.3",
31+
"prettier-plugin-svelte": "^3.2.6",
3232
"string-replace-loader": "^3.1.0",
33-
"typescript": "^5.4.5",
34-
"vite": "^5.3.1",
35-
"webpack": "^5.92.1",
33+
"typescript": "^5.6.2",
34+
"vite": "^5.4.4",
35+
"webpack": "^5.94.0",
3636
"webpack-cli": "^5.1.4",
3737
"wrapper-webpack-plugin": "^2.2.2"
3838
}

explorer-v2/src/lib/MonacoEditor.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<script context="module">
1+
<script module>
22
const appStarting = new Promise((resolve) => setTimeout(resolve, 300));
33
</script>
44

package.json

+18-18
Original file line numberDiff line numberDiff line change
@@ -63,51 +63,51 @@
6363
},
6464
"devDependencies": {
6565
"@changesets/changelog-github": "^0.5.0",
66-
"@changesets/cli": "^2.27.7",
67-
"@changesets/get-release-plan": "^4.0.3",
66+
"@changesets/cli": "^2.27.8",
67+
"@changesets/get-release-plan": "^4.0.4",
6868
"@ota-meshi/eslint-plugin": "^0.15.3",
6969
"@types/benchmark": "^2.1.5",
70-
"@types/chai": "^4.3.16",
71-
"@types/eslint": "^9.0.0",
70+
"@types/chai": "^4.3.19",
71+
"@types/eslint": "^9.6.1",
7272
"@types/eslint-scope": "^3.7.7",
7373
"@types/eslint-visitor-keys": "^3.3.0",
7474
"@types/estree": "^1.0.5",
75-
"@types/mocha": "^10.0.7",
76-
"@types/node": "^20.14.11",
75+
"@types/mocha": "^10.0.8",
76+
"@types/node": "^20.16.5",
7777
"@types/semver": "^7.5.8",
78-
"@typescript-eslint/eslint-plugin": "^7.16.1",
78+
"@typescript-eslint/eslint-plugin": "^7.18.0",
7979
"@typescript-eslint/parser": "~7.18.0",
8080
"@typescript-eslint/types": "~7.18.0",
8181
"benchmark": "^2.1.4",
82-
"chai": "^4.4.1",
82+
"chai": "^4.5.0",
8383
"env-cmd": "^10.1.0",
84-
"esbuild": "^0.23.0",
85-
"esbuild-register": "^3.5.0",
84+
"esbuild": "^0.23.1",
85+
"esbuild-register": "^3.6.0",
8686
"eslint": "^8.57.0",
8787
"eslint-config-prettier": "^9.1.0",
8888
"eslint-plugin-eslint-comments": "^3.2.0",
8989
"eslint-plugin-json-schema-validator": "^5.1.2",
9090
"eslint-plugin-jsonc": "^2.16.0",
91-
"eslint-plugin-n": "^17.9.0",
91+
"eslint-plugin-n": "^17.10.2",
9292
"eslint-plugin-node-dependencies": "^0.12.0",
9393
"eslint-plugin-prettier": "^5.2.1",
9494
"eslint-plugin-regexp": "^2.6.0",
95-
"eslint-plugin-svelte": "^2.42.0",
95+
"eslint-plugin-svelte": "^2.43.0",
9696
"eslint-plugin-yml": "^1.14.0",
9797
"estree-walker": "^3.0.3",
9898
"locate-character": "^3.0.0",
99-
"magic-string": "^0.30.10",
100-
"mocha": "^10.6.0",
101-
"mocha-chai-jest-snapshot": "^1.1.4",
99+
"magic-string": "^0.30.11",
100+
"mocha": "^10.7.3",
101+
"mocha-chai-jest-snapshot": "^1.1.6",
102102
"nyc": "^17.0.0",
103103
"prettier": "~3.3.3",
104104
"prettier-plugin-pkg": "^0.18.1",
105105
"prettier-plugin-svelte": "^3.2.6",
106106
"rimraf": "^6.0.1",
107107
"semver": "^7.6.3",
108-
"svelte": "^5.0.0-next.191",
109-
"svelte2tsx": "^0.7.13",
110-
"typescript": "~5.5.3",
108+
"svelte": "^5.0.0-next.245",
109+
"svelte2tsx": "^0.7.19",
110+
"typescript": "~5.6.2",
111111
"typescript-eslint-parser-for-extra-files": "^0.7.0"
112112
},
113113
"publishConfig": {

src/parser/compat.ts

-2
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ export function getOptionsFromRoot(
4040
fragment: {
4141
type: "Fragment",
4242
nodes: [],
43-
transparent: true,
4443
},
4544
start: root.options.start,
4645
end: root.options.end,
47-
parent: null as any,
4846
};
4947
}
5048
return null;

src/parser/html.ts

-11
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ function parseAttribute(state: State): Compiler.Attribute {
8686
value: true,
8787
start,
8888
end: keyEnd,
89-
metadata: null as any,
90-
parent: null,
9189
};
9290
}
9391
state.skipSpaces();
@@ -98,8 +96,6 @@ function parseAttribute(state: State): Compiler.Attribute {
9896
value: true,
9997
start,
10098
end: keyEnd,
101-
metadata: null as any,
102-
parent: null,
10399
};
104100
}
105101
// parse value
@@ -110,8 +106,6 @@ function parseAttribute(state: State): Compiler.Attribute {
110106
value: [value],
111107
start,
112108
end: state.index,
113-
metadata: null as any,
114-
parent: null,
115109
};
116110
}
117111

@@ -149,8 +143,6 @@ function parseAttributeValue(
149143
expression,
150144
start,
151145
end,
152-
metadata: null as any,
153-
parent: null,
154146
};
155147
}
156148
}
@@ -164,7 +156,6 @@ function parseAttributeValue(
164156
raw: quote,
165157
start,
166158
end: state.index,
167-
parent: null,
168159
};
169160
}
170161
let c: string | undefined;
@@ -179,7 +170,6 @@ function parseAttributeValue(
179170
raw: data,
180171
start: start + 1,
181172
end: end - 1,
182-
parent: null,
183173
};
184174
}
185175
}
@@ -198,7 +188,6 @@ function parseAttributeValue(
198188
raw: data,
199189
start,
200190
end,
201-
parent: null,
202191
};
203192
}
204193

src/parser/svelte-ast-types-for-v5.ts

+40-83
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,49 @@
1-
// FIXME Since the node type is not provided by "svelte/compiler",
2-
// we work around this by extracting the type from the parse function.
3-
// See also https://github.com/sveltejs/svelte/issues/12292
1+
import type { AST } from "svelte/compiler";
42

5-
import type { parse } from "svelte/compiler";
3+
export type Root = AST.Root;
4+
export type Fragment = AST.Fragment;
5+
export type SvelteOptions = AST.SvelteOptions;
6+
export type Script = AST.Script;
67

7-
export type Root = ModernParseReturnType<typeof parse>;
8-
export type Fragment = Root["fragment"];
9-
export type SvelteOptions = Root["options"];
10-
export type Script = Root["instance"];
11-
type FragmentChild = Fragment["nodes"][number];
8+
export type Text = AST.Text;
129

13-
export type Text = Extract<FragmentChild, { type: "Text" }>;
10+
export type ExpressionTag = AST.ExpressionTag;
11+
export type HtmlTag = AST.HtmlTag;
12+
export type ConstTag = AST.ConstTag;
13+
export type DebugTag = AST.DebugTag;
14+
export type RenderTag = AST.RenderTag;
1415

15-
export type ExpressionTag = Extract<FragmentChild, { type: "ExpressionTag" }>;
16-
export type HtmlTag = Extract<FragmentChild, { type: "HtmlTag" }>;
17-
export type ConstTag = Extract<FragmentChild, { type: "ConstTag" }>;
18-
export type DebugTag = Extract<FragmentChild, { type: "DebugTag" }>;
19-
export type RenderTag = Extract<FragmentChild, { type: "RenderTag" }>;
16+
export type Component = AST.Component;
17+
export type TitleElement = AST.TitleElement;
18+
export type SlotElement = AST.SlotElement;
19+
export type RegularElement = AST.RegularElement;
20+
export type SvelteBody = AST.SvelteBody;
21+
export type SvelteComponent = AST.SvelteComponent;
22+
export type SvelteDocument = AST.SvelteDocument;
23+
export type SvelteElement = AST.SvelteElement;
24+
export type SvelteFragment = AST.SvelteFragment;
25+
export type SvelteHead = AST.SvelteHead;
26+
export type SvelteOptionsRaw = AST.SvelteOptionsRaw;
27+
export type SvelteSelf = AST.SvelteSelf;
28+
export type SvelteWindow = AST.SvelteWindow;
2029

21-
export type Component = Extract<FragmentChild, { type: "Component" }>;
22-
export type TitleElement = Extract<FragmentChild, { type: "TitleElement" }>;
23-
export type SlotElement = Extract<FragmentChild, { type: "SlotElement" }>;
24-
export type RegularElement = Extract<FragmentChild, { type: "RegularElement" }>;
25-
export type SvelteBody = Extract<FragmentChild, { type: "SvelteBody" }>;
26-
export type SvelteComponent = Extract<
27-
FragmentChild,
28-
{ type: "SvelteComponent" }
29-
>;
30-
export type SvelteDocument = Extract<FragmentChild, { type: "SvelteDocument" }>;
31-
export type SvelteElement = Extract<FragmentChild, { type: "SvelteElement" }>;
32-
export type SvelteFragment = Extract<FragmentChild, { type: "SvelteFragment" }>;
33-
export type SvelteHead = Extract<FragmentChild, { type: "SvelteHead" }>;
34-
export type SvelteOptionsRaw = Extract<
35-
FragmentChild,
36-
{ type: "SvelteOptions" }
37-
>;
38-
export type SvelteSelf = Extract<FragmentChild, { type: "SvelteSelf" }>;
39-
export type SvelteWindow = Extract<FragmentChild, { type: "SvelteWindow" }>;
30+
export type IfBlock = AST.IfBlock;
31+
export type EachBlock = AST.EachBlock;
32+
export type AwaitBlock = AST.AwaitBlock;
33+
export type KeyBlock = AST.KeyBlock;
34+
export type SnippetBlock = AST.SnippetBlock;
4035

41-
export type IfBlock = Extract<FragmentChild, { type: "IfBlock" }>;
42-
export type EachBlock = Extract<FragmentChild, { type: "EachBlock" }>;
43-
export type AwaitBlock = Extract<FragmentChild, { type: "AwaitBlock" }>;
44-
export type KeyBlock = Extract<FragmentChild, { type: "KeyBlock" }>;
45-
export type SnippetBlock = Extract<FragmentChild, { type: "SnippetBlock" }>;
46-
47-
export type Comment = Extract<FragmentChild, { type: "Comment" }>;
48-
type ComponentAttribute = Component["attributes"][number];
49-
export type Attribute = Extract<ComponentAttribute, { type: "Attribute" }>;
50-
export type SpreadAttribute = Extract<
51-
ComponentAttribute,
52-
{ type: "SpreadAttribute" }
53-
>;
54-
export type AnimateDirective = Extract<
55-
ComponentAttribute,
56-
{ type: "AnimateDirective" }
57-
>;
58-
export type BindDirective = Extract<
59-
ComponentAttribute,
60-
{ type: "BindDirective" }
61-
>;
62-
export type ClassDirective = Extract<
63-
ComponentAttribute,
64-
{ type: "ClassDirective" }
65-
>;
66-
export type LetDirective = Extract<
67-
ComponentAttribute,
68-
{ type: "LetDirective" }
69-
>;
70-
export type OnDirective = Extract<ComponentAttribute, { type: "OnDirective" }>;
71-
export type StyleDirective = Extract<
72-
ComponentAttribute,
73-
{ type: "StyleDirective" }
74-
>;
75-
export type TransitionDirective = Extract<
76-
ComponentAttribute,
77-
{ type: "TransitionDirective" }
78-
>;
79-
export type UseDirective = Extract<
80-
ComponentAttribute,
81-
{ type: "UseDirective" }
82-
>;
36+
export type Comment = AST.Comment;
37+
export type Attribute = AST.Attribute;
38+
export type SpreadAttribute = AST.SpreadAttribute;
39+
export type AnimateDirective = AST.AnimateDirective;
40+
export type BindDirective = AST.BindDirective;
41+
export type ClassDirective = AST.ClassDirective;
42+
export type LetDirective = AST.LetDirective;
43+
export type OnDirective = AST.OnDirective;
44+
export type StyleDirective = AST.StyleDirective;
45+
export type TransitionDirective = AST.TransitionDirective;
46+
export type UseDirective = AST.UseDirective;
8347

8448
export type Tag = ExpressionTag | HtmlTag | ConstTag | DebugTag | RenderTag;
8549
export type ElementLike =
@@ -107,10 +71,3 @@ export type Directive =
10771
| StyleDirective
10872
| TransitionDirective
10973
| UseDirective;
110-
111-
type ModernParseReturnType<T> = T extends {
112-
(source: string, options: { filename?: string; modern: true }): infer R;
113-
(...args: any[]): any;
114-
}
115-
? R
116-
: any;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"parse": {
3+
"svelte": "^4 || ^3"
4+
}
5+
}

tests/fixtures/parser/ast/svelte5/docs/snippets/10-typing-snippets-type-output.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
<table>
1212
{#if children} <!-- children: Snippet<[]> -->
1313
<thead>
14-
<tr>{@render children()}</tr> <!-- children(): unique symbol & { _: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\""; } -->
14+
<tr>{@render children()}</tr> <!-- children(): { '{@render ...} must be called with a Snippet': "import type { Snippet } from 'svelte'"; } & unique symbol -->
1515
</thead>
1616
{/if}
1717
<tbody>
1818
{#each data as d} <!-- data: any[], d: any -->
19-
<tr>{@render row(d)}</tr> <!-- row(d): unique symbol & { _: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\""; } -->
19+
<tr>{@render row(d)}</tr> <!-- row(d): { '{@render ...} must be called with a Snippet': "import type { Snippet } from 'svelte'"; } & unique symbol -->
2020
{/each}
2121
</tbody>
2222
</table>

tests/fixtures/parser/ast/svelte5/docs/snippets/11-typing-snippets-type-output.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
<table>
1212
{#if children} <!-- children: Snippet<[]> -->
1313
<thead>
14-
<tr>{@render children()}</tr> <!-- children(): unique symbol & { _: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\""; } -->
14+
<tr>{@render children()}</tr> <!-- children(): { '{@render ...} must be called with a Snippet': "import type { Snippet } from 'svelte'"; } & unique symbol -->
1515
</thead>
1616
{/if}
1717
<tbody>
1818
{#each data as d} <!-- data: unknown[], d: unknown -->
19-
<tr>{@render row(d)}</tr> <!-- row(d): unique symbol & { _: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\""; } -->
19+
<tr>{@render row(d)}</tr> <!-- row(d): { '{@render ...} must be called with a Snippet': "import type { Snippet } from 'svelte'"; } & unique symbol -->
2020
{/each}
2121
</tbody>
2222
</table>

tests/fixtures/parser/ast/svelte5/generics01-snippets-type-output.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
<table>
1313
{#if children} <!-- children: Snippet<[]> -->
1414
<thead>
15-
<tr>{@render children()}</tr> <!-- children(): unique symbol & { _: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\""; } -->
15+
<tr>{@render children()}</tr> <!-- children(): { '{@render ...} must be called with a Snippet': "import type { Snippet } from 'svelte'"; } & unique symbol -->
1616
</thead>
1717
{/if}
1818
<tbody>
1919
{#each data as d} <!-- data: unknown[], d: unknown -->
20-
<tr>{@render row(d)}</tr> <!-- row(d): unique symbol & { _: "functions passed to {@render ...} tags must use the `Snippet` type imported from \"svelte\""; } -->
20+
<tr>{@render row(d)}</tr> <!-- row(d): { '{@render ...} must be called with a Snippet': "import type { Snippet } from 'svelte'"; } & unique symbol -->
2121
{/each}
2222
</tbody>
2323
</table>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"parse": {
3+
"svelte": "^4 || ^3"
4+
}
5+
}

0 commit comments

Comments
 (0)