@vigla/svelte 0.0.0-stage → 5.57.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/action.d.ts +2 -0
- package/animate.d.ts +2 -0
- package/compiler/index.js +43266 -0
- package/compiler/index.js.map +1 -0
- package/compiler/package.json +3 -0
- package/compiler.d.ts +2 -0
- package/dist/compiler/diagnostics.d.ts +70 -0
- package/dist/compiler/diagnostics.d.ts.map +1 -0
- package/dist/compiler/diagnostics.js +166 -0
- package/dist/compiler/diagnostics.js.map +1 -0
- package/dist/compiler/index.d.ts +72 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +178 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/options.d.ts +7 -0
- package/dist/compiler/options.d.ts.map +1 -0
- package/dist/compiler/options.js +126 -0
- package/dist/compiler/options.js.map +1 -0
- package/dist/compiler/preprocess/decode.d.ts +3 -0
- package/dist/compiler/preprocess/decode.d.ts.map +1 -0
- package/dist/compiler/preprocess/decode.js +60 -0
- package/dist/compiler/preprocess/decode.js.map +1 -0
- package/dist/compiler/preprocess/index.d.ts +27 -0
- package/dist/compiler/preprocess/index.d.ts.map +1 -0
- package/dist/compiler/preprocess/index.js +208 -0
- package/dist/compiler/preprocess/index.js.map +1 -0
- package/dist/compiler/preprocess/mapped.d.ts +25 -0
- package/dist/compiler/preprocess/mapped.d.ts.map +1 -0
- package/dist/compiler/preprocess/mapped.js +129 -0
- package/dist/compiler/preprocess/mapped.js.map +1 -0
- package/dist/compiler/proxy.d.ts +3 -0
- package/dist/compiler/proxy.d.ts.map +1 -0
- package/dist/compiler/proxy.js +133 -0
- package/dist/compiler/proxy.js.map +1 -0
- package/dist/entries/action.d.ts +2 -0
- package/dist/entries/action.d.ts.map +1 -0
- package/dist/entries/action.js +1 -0
- package/dist/entries/action.js.map +1 -0
- package/dist/entries/animate.d.ts +2 -0
- package/dist/entries/animate.d.ts.map +1 -0
- package/dist/entries/animate.js +2 -0
- package/dist/entries/animate.js.map +1 -0
- package/dist/entries/attachments.d.ts +2 -0
- package/dist/entries/attachments.d.ts.map +1 -0
- package/dist/entries/attachments.js +2 -0
- package/dist/entries/attachments.js.map +1 -0
- package/dist/entries/context.d.ts +15 -0
- package/dist/entries/context.d.ts.map +1 -0
- package/dist/entries/context.js +32 -0
- package/dist/entries/context.js.map +1 -0
- package/dist/entries/easing.d.ts +2 -0
- package/dist/entries/easing.d.ts.map +1 -0
- package/dist/entries/easing.js +2 -0
- package/dist/entries/easing.js.map +1 -0
- package/dist/entries/events.d.ts +2 -0
- package/dist/entries/events.d.ts.map +1 -0
- package/dist/entries/events.js +2 -0
- package/dist/entries/events.js.map +1 -0
- package/dist/entries/index-server.d.ts +4 -0
- package/dist/entries/index-server.d.ts.map +1 -0
- package/dist/entries/index-server.js +11 -0
- package/dist/entries/index-server.js.map +1 -0
- package/dist/entries/index.d.ts +10 -0
- package/dist/entries/index.d.ts.map +1 -0
- package/dist/entries/index.js +24 -0
- package/dist/entries/index.js.map +1 -0
- package/dist/entries/internal/client.d.ts +4 -0
- package/dist/entries/internal/client.d.ts.map +1 -0
- package/dist/entries/internal/client.js +9 -0
- package/dist/entries/internal/client.js.map +1 -0
- package/dist/entries/internal/disclose-version.d.ts +2 -0
- package/dist/entries/internal/disclose-version.d.ts.map +1 -0
- package/dist/entries/internal/disclose-version.js +4 -0
- package/dist/entries/internal/disclose-version.js.map +1 -0
- package/dist/entries/internal/index.d.ts +2 -0
- package/dist/entries/internal/index.d.ts.map +1 -0
- package/dist/entries/internal/index.js +2 -0
- package/dist/entries/internal/index.js.map +1 -0
- package/dist/entries/internal/server.d.ts +2 -0
- package/dist/entries/internal/server.d.ts.map +1 -0
- package/dist/entries/internal/server.js +7 -0
- package/dist/entries/internal/server.js.map +1 -0
- package/dist/entries/internal/tracing.d.ts +2 -0
- package/dist/entries/internal/tracing.d.ts.map +1 -0
- package/dist/entries/internal/tracing.js +2 -0
- package/dist/entries/internal/tracing.js.map +1 -0
- package/dist/entries/motion-server.d.ts +2 -0
- package/dist/entries/motion-server.d.ts.map +1 -0
- package/dist/entries/motion-server.js +2 -0
- package/dist/entries/motion-server.js.map +1 -0
- package/dist/entries/motion.d.ts +2 -0
- package/dist/entries/motion.d.ts.map +1 -0
- package/dist/entries/motion.js +2 -0
- package/dist/entries/motion.js.map +1 -0
- package/dist/entries/proxy.d.ts +6 -0
- package/dist/entries/proxy.d.ts.map +1 -0
- package/dist/entries/proxy.js +77 -0
- package/dist/entries/proxy.js.map +1 -0
- package/dist/entries/reactivity-server.d.ts +2 -0
- package/dist/entries/reactivity-server.d.ts.map +1 -0
- package/dist/entries/reactivity-server.js +2 -0
- package/dist/entries/reactivity-server.js.map +1 -0
- package/dist/entries/reactivity.d.ts +2 -0
- package/dist/entries/reactivity.d.ts.map +1 -0
- package/dist/entries/reactivity.js +2 -0
- package/dist/entries/reactivity.js.map +1 -0
- package/dist/entries/report.d.ts +3 -0
- package/dist/entries/report.d.ts.map +1 -0
- package/dist/entries/report.js +66 -0
- package/dist/entries/report.js.map +1 -0
- package/dist/entries/server.d.ts +8 -0
- package/dist/entries/server.d.ts.map +1 -0
- package/dist/entries/server.js +48 -0
- package/dist/entries/server.js.map +1 -0
- package/dist/entries/store-client.d.ts +12 -0
- package/dist/entries/store-client.d.ts.map +1 -0
- package/dist/entries/store-client.js +63 -0
- package/dist/entries/store-client.js.map +1 -0
- package/dist/entries/store-server.d.ts +12 -0
- package/dist/entries/store-server.d.ts.map +1 -0
- package/dist/entries/store-server.js +30 -0
- package/dist/entries/store-server.js.map +1 -0
- package/dist/entries/store.d.ts +25 -0
- package/dist/entries/store.d.ts.map +1 -0
- package/dist/entries/store.js +139 -0
- package/dist/entries/store.js.map +1 -0
- package/dist/entries/transition.d.ts +2 -0
- package/dist/entries/transition.d.ts.map +1 -0
- package/dist/entries/transition.js +2 -0
- package/dist/entries/transition.js.map +1 -0
- package/dist/entries/window-server.d.ts +2 -0
- package/dist/entries/window-server.d.ts.map +1 -0
- package/dist/entries/window-server.js +2 -0
- package/dist/entries/window-server.js.map +1 -0
- package/dist/entries/window.d.ts +2 -0
- package/dist/entries/window.d.ts.map +1 -0
- package/dist/entries/window.js +2 -0
- package/dist/entries/window.js.map +1 -0
- package/dist/front/ast.d.ts +290 -0
- package/dist/front/ast.d.ts.map +1 -0
- package/dist/front/ast.js +1 -0
- package/dist/front/ast.js.map +1 -0
- package/dist/front/diagnostics.d.ts +13 -0
- package/dist/front/diagnostics.d.ts.map +1 -0
- package/dist/front/diagnostics.js +38 -0
- package/dist/front/diagnostics.js.map +1 -0
- package/dist/front/ignores.d.ts +12 -0
- package/dist/front/ignores.d.ts.map +1 -0
- package/dist/front/ignores.js +75 -0
- package/dist/front/ignores.js.map +1 -0
- package/dist/front/index.d.ts +17 -0
- package/dist/front/index.d.ts.map +1 -0
- package/dist/front/index.js +65 -0
- package/dist/front/index.js.map +1 -0
- package/dist/front/legacy.d.ts +5 -0
- package/dist/front/legacy.d.ts.map +1 -0
- package/dist/front/legacy.js +408 -0
- package/dist/front/legacy.js.map +1 -0
- package/dist/front/locate.d.ts +4 -0
- package/dist/front/locate.d.ts.map +1 -0
- package/dist/front/locate.js +19 -0
- package/dist/front/locate.js.map +1 -0
- package/dist/front/lower.d.ts +39 -0
- package/dist/front/lower.d.ts.map +1 -0
- package/dist/front/lower.js +470 -0
- package/dist/front/lower.js.map +1 -0
- package/dist/front/parse/attribute.d.ts +12 -0
- package/dist/front/parse/attribute.d.ts.map +1 -0
- package/dist/front/parse/attribute.js +288 -0
- package/dist/front/parse/attribute.js.map +1 -0
- package/dist/front/parse/bracket.d.ts +3 -0
- package/dist/front/parse/bracket.d.ts.map +1 -0
- package/dist/front/parse/bracket.js +102 -0
- package/dist/front/parse/bracket.js.map +1 -0
- package/dist/front/parse/characters.d.ts +4 -0
- package/dist/front/parse/characters.d.ts.map +1 -0
- package/dist/front/parse/characters.js +6 -0
- package/dist/front/parse/characters.js.map +1 -0
- package/dist/front/parse/decode.d.ts +2 -0
- package/dist/front/parse/decode.d.ts.map +1 -0
- package/dist/front/parse/decode.js +89 -0
- package/dist/front/parse/decode.js.map +1 -0
- package/dist/front/parse/element.d.ts +3 -0
- package/dist/front/parse/element.d.ts.map +1 -0
- package/dist/front/parse/element.js +311 -0
- package/dist/front/parse/element.js.map +1 -0
- package/dist/front/parse/entities.d.ts +2 -0
- package/dist/front/parse/entities.d.ts.map +1 -0
- package/dist/front/parse/entities.js +2234 -0
- package/dist/front/parse/entities.js.map +1 -0
- package/dist/front/parse/expression.d.ts +5 -0
- package/dist/front/parse/expression.d.ts.map +1 -0
- package/dist/front/parse/expression.js +86 -0
- package/dist/front/parse/expression.js.map +1 -0
- package/dist/front/parse/html.d.ts +8 -0
- package/dist/front/parse/html.d.ts.map +1 -0
- package/dist/front/parse/html.js +146 -0
- package/dist/front/parse/html.js.map +1 -0
- package/dist/front/parse/identifier.d.ts +4 -0
- package/dist/front/parse/identifier.d.ts.map +1 -0
- package/dist/front/parse/identifier.js +24 -0
- package/dist/front/parse/identifier.js.map +1 -0
- package/dist/front/parse/index.d.ts +13 -0
- package/dist/front/parse/index.d.ts.map +1 -0
- package/dist/front/parse/index.js +74 -0
- package/dist/front/parse/index.js.map +1 -0
- package/dist/front/parse/js.d.ts +27 -0
- package/dist/front/parse/js.d.ts.map +1 -0
- package/dist/front/parse/js.js +241 -0
- package/dist/front/parse/js.js.map +1 -0
- package/dist/front/parse/options.d.ts +3 -0
- package/dist/front/parse/options.d.ts.map +1 -0
- package/dist/front/parse/options.js +198 -0
- package/dist/front/parse/options.js.map +1 -0
- package/dist/front/parse/parser.d.ts +50 -0
- package/dist/front/parse/parser.d.ts.map +1 -0
- package/dist/front/parse/parser.js +157 -0
- package/dist/front/parse/parser.js.map +1 -0
- package/dist/front/parse/pattern.d.ts +4 -0
- package/dist/front/parse/pattern.d.ts.map +1 -0
- package/dist/front/parse/pattern.js +53 -0
- package/dist/front/parse/pattern.js.map +1 -0
- package/dist/front/parse/script.d.ts +4 -0
- package/dist/front/parse/script.d.ts.map +1 -0
- package/dist/front/parse/script.js +60 -0
- package/dist/front/parse/script.js.map +1 -0
- package/dist/front/parse/style.d.ts +7 -0
- package/dist/front/parse/style.d.ts.map +1 -0
- package/dist/front/parse/style.js +397 -0
- package/dist/front/parse/style.js.map +1 -0
- package/dist/front/parse/tag.d.ts +3 -0
- package/dist/front/parse/tag.d.ts.map +1 -0
- package/dist/front/parse/tag.js +591 -0
- package/dist/front/parse/tag.js.map +1 -0
- package/dist/front/print/css.d.ts +5 -0
- package/dist/front/print/css.d.ts.map +1 -0
- package/dist/front/print/css.js +234 -0
- package/dist/front/print/css.js.map +1 -0
- package/dist/front/print/index.d.ts +18 -0
- package/dist/front/print/index.d.ts.map +1 -0
- package/dist/front/print/index.js +24 -0
- package/dist/front/print/index.js.map +1 -0
- package/dist/front/print/layout.d.ts +11 -0
- package/dist/front/print/layout.d.ts.map +1 -0
- package/dist/front/print/layout.js +73 -0
- package/dist/front/print/layout.js.map +1 -0
- package/dist/front/print/template.d.ts +5 -0
- package/dist/front/print/template.d.ts.map +1 -0
- package/dist/front/print/template.js +455 -0
- package/dist/front/print/template.js.map +1 -0
- package/dist/front/runes.d.ts +13 -0
- package/dist/front/runes.d.ts.map +1 -0
- package/dist/front/runes.js +253 -0
- package/dist/front/runes.js.map +1 -0
- package/dist/front/stores.d.ts +5 -0
- package/dist/front/stores.d.ts.map +1 -0
- package/dist/front/stores.js +84 -0
- package/dist/front/stores.js.map +1 -0
- package/dist/front/typescript.d.ts +2 -0
- package/dist/front/typescript.d.ts.map +1 -0
- package/dist/front/typescript.js +182 -0
- package/dist/front/typescript.js.map +1 -0
- package/dist/front/validate/anchors.d.ts +15 -0
- package/dist/front/validate/anchors.d.ts.map +1 -0
- package/dist/front/validate/anchors.js +43 -0
- package/dist/front/validate/anchors.js.map +1 -0
- package/dist/front/validate/index.d.ts +16 -0
- package/dist/front/validate/index.d.ts.map +1 -0
- package/dist/front/validate/index.js +139 -0
- package/dist/front/validate/index.js.map +1 -0
- package/dist/front/validate/legacy.d.ts +9 -0
- package/dist/front/validate/legacy.d.ts.map +1 -0
- package/dist/front/validate/legacy.js +102 -0
- package/dist/front/validate/legacy.js.map +1 -0
- package/dist/front/validate/report.d.ts +14 -0
- package/dist/front/validate/report.d.ts.map +1 -0
- package/dist/front/validate/report.js +29 -0
- package/dist/front/validate/report.js.map +1 -0
- package/dist/front/validate/template.d.ts +31 -0
- package/dist/front/validate/template.d.ts.map +1 -0
- package/dist/front/validate/template.js +507 -0
- package/dist/front/validate/template.js.map +1 -0
- package/dist/front/wording.d.ts +4 -0
- package/dist/front/wording.d.ts.map +1 -0
- package/dist/front/wording.js +110 -0
- package/dist/front/wording.js.map +1 -0
- package/dist/shared/format.d.ts +3 -0
- package/dist/shared/format.d.ts.map +1 -0
- package/dist/shared/format.js +7 -0
- package/dist/shared/format.js.map +1 -0
- package/easing.d.ts +2 -0
- package/elements.d.ts +1220 -0
- package/index.d.ts +2 -0
- package/motion.d.ts +2 -0
- package/package.json +123 -5
- package/src/compiler/diagnostics.ts +233 -0
- package/src/compiler/index.ts +292 -0
- package/src/compiler/options.ts +140 -0
- package/src/compiler/preprocess/decode.ts +85 -0
- package/src/compiler/preprocess/index.ts +299 -0
- package/src/compiler/preprocess/mapped.ts +146 -0
- package/src/compiler/proxy.ts +154 -0
- package/src/entries/action.ts +1 -0
- package/src/entries/animate.ts +1 -0
- package/src/entries/attachments.ts +1 -0
- package/src/entries/context.ts +50 -0
- package/src/entries/easing.ts +1 -0
- package/src/entries/events.ts +1 -0
- package/src/entries/index-server.ts +17 -0
- package/src/entries/index.ts +41 -0
- package/src/entries/internal/client.ts +15 -0
- package/src/entries/internal/disclose-version.ts +4 -0
- package/src/entries/internal/index.ts +3 -0
- package/src/entries/internal/server.ts +8 -0
- package/src/entries/internal/tracing.ts +1 -0
- package/src/entries/motion-server.ts +1 -0
- package/src/entries/motion.ts +1 -0
- package/src/entries/proxy.ts +86 -0
- package/src/entries/reactivity-server.ts +9 -0
- package/src/entries/reactivity.ts +9 -0
- package/src/entries/report.ts +81 -0
- package/src/entries/server.ts +76 -0
- package/src/entries/store-client.ts +80 -0
- package/src/entries/store-server.ts +44 -0
- package/src/entries/store.ts +201 -0
- package/src/entries/transition.ts +1 -0
- package/src/entries/window-server.ts +1 -0
- package/src/entries/window.ts +1 -0
- package/src/front/ast.ts +369 -0
- package/src/front/diagnostics.ts +53 -0
- package/src/front/ignores.ts +84 -0
- package/src/front/index.ts +86 -0
- package/src/front/legacy.ts +414 -0
- package/src/front/locate.ts +20 -0
- package/src/front/lower.ts +509 -0
- package/src/front/parse/attribute.ts +319 -0
- package/src/front/parse/bracket.ts +99 -0
- package/src/front/parse/characters.ts +19 -0
- package/src/front/parse/decode.ts +87 -0
- package/src/front/parse/element.ts +354 -0
- package/src/front/parse/entities.ts +2233 -0
- package/src/front/parse/expression.ts +85 -0
- package/src/front/parse/html.ts +158 -0
- package/src/front/parse/identifier.ts +29 -0
- package/src/front/parse/index.ts +88 -0
- package/src/front/parse/js.ts +284 -0
- package/src/front/parse/options.ts +194 -0
- package/src/front/parse/parser.ts +189 -0
- package/src/front/parse/pattern.ts +57 -0
- package/src/front/parse/script.ts +74 -0
- package/src/front/parse/style.ts +399 -0
- package/src/front/parse/tag.ts +601 -0
- package/src/front/print/css.ts +239 -0
- package/src/front/print/index.ts +40 -0
- package/src/front/print/layout.ts +87 -0
- package/src/front/print/template.ts +448 -0
- package/src/front/runes.ts +267 -0
- package/src/front/stores.ts +98 -0
- package/src/front/typescript.ts +178 -0
- package/src/front/validate/anchors.ts +54 -0
- package/src/front/validate/index.ts +174 -0
- package/src/front/validate/legacy.ts +119 -0
- package/src/front/validate/report.ts +38 -0
- package/src/front/validate/template.ts +549 -0
- package/src/front/wording.ts +112 -0
- package/src/shared/format.ts +8 -0
- package/store.d.ts +2 -0
- package/svelte-html.d.ts +53 -0
- package/transition.d.ts +2 -0
- package/types/compiler/interfaces.d.ts +2 -0
- package/types/compiler/preprocess.d.ts +2 -0
- package/types/index.d.ts +1453 -0
- package/README.md +0 -3
package/index.d.ts
ADDED
package/motion.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,124 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@vigla/svelte",
|
|
3
|
+
"version": "5.57.3",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"types": "./types/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"src",
|
|
9
|
+
"compiler",
|
|
10
|
+
"types",
|
|
11
|
+
"elements.d.ts",
|
|
12
|
+
"svelte-html.d.ts",
|
|
13
|
+
"index.d.ts",
|
|
14
|
+
"compiler.d.ts",
|
|
15
|
+
"action.d.ts",
|
|
16
|
+
"animate.d.ts",
|
|
17
|
+
"easing.d.ts",
|
|
18
|
+
"motion.d.ts",
|
|
19
|
+
"store.d.ts",
|
|
20
|
+
"transition.d.ts"
|
|
21
|
+
],
|
|
22
|
+
"vigla": {
|
|
23
|
+
"frontEnd": {
|
|
24
|
+
"compiler": "./compiler",
|
|
25
|
+
"components": [
|
|
26
|
+
".svelte"
|
|
27
|
+
],
|
|
28
|
+
"modules": {
|
|
29
|
+
"infixes": [
|
|
30
|
+
".svelte."
|
|
31
|
+
],
|
|
32
|
+
"extensions": [
|
|
33
|
+
".js",
|
|
34
|
+
".ts"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"condition": "svelte",
|
|
38
|
+
"config": "svelte.config"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"types": "./types/index.d.ts",
|
|
44
|
+
"worker": "./dist/entries/index-server.js",
|
|
45
|
+
"browser": "./dist/entries/index.js",
|
|
46
|
+
"default": "./dist/entries/index-server.js"
|
|
47
|
+
},
|
|
48
|
+
"./package.json": "./package.json",
|
|
49
|
+
"./action": {
|
|
50
|
+
"types": "./types/index.d.ts",
|
|
51
|
+
"default": "./dist/entries/action.js"
|
|
52
|
+
},
|
|
53
|
+
"./animate": {
|
|
54
|
+
"types": "./types/index.d.ts",
|
|
55
|
+
"default": "./dist/entries/animate.js"
|
|
56
|
+
},
|
|
57
|
+
"./attachments": {
|
|
58
|
+
"types": "./types/index.d.ts",
|
|
59
|
+
"default": "./dist/entries/attachments.js"
|
|
60
|
+
},
|
|
61
|
+
"./easing": {
|
|
62
|
+
"types": "./types/index.d.ts",
|
|
63
|
+
"default": "./dist/entries/easing.js"
|
|
64
|
+
},
|
|
65
|
+
"./compiler": {
|
|
66
|
+
"types": "./types/index.d.ts",
|
|
67
|
+
"require": "./compiler/index.js",
|
|
68
|
+
"default": "./dist/compiler/index.js"
|
|
69
|
+
},
|
|
70
|
+
"./elements": {
|
|
71
|
+
"types": "./elements.d.ts"
|
|
72
|
+
},
|
|
73
|
+
"./events": {
|
|
74
|
+
"types": "./types/index.d.ts",
|
|
75
|
+
"default": "./dist/entries/events.js"
|
|
76
|
+
},
|
|
77
|
+
"./internal": "./dist/entries/internal/index.js",
|
|
78
|
+
"./internal/client": "./dist/entries/internal/client.js",
|
|
79
|
+
"./internal/disclose-version": "./dist/entries/internal/disclose-version.js",
|
|
80
|
+
"./internal/flags/tracing": "./dist/entries/internal/tracing.js",
|
|
81
|
+
"./internal/server": "./dist/entries/internal/server.js",
|
|
82
|
+
"./motion": {
|
|
83
|
+
"types": "./types/index.d.ts",
|
|
84
|
+
"worker": "./dist/entries/motion-server.js",
|
|
85
|
+
"browser": "./dist/entries/motion.js",
|
|
86
|
+
"default": "./dist/entries/motion-server.js"
|
|
87
|
+
},
|
|
88
|
+
"./reactivity": {
|
|
89
|
+
"types": "./types/index.d.ts",
|
|
90
|
+
"worker": "./dist/entries/reactivity-server.js",
|
|
91
|
+
"browser": "./dist/entries/reactivity.js",
|
|
92
|
+
"default": "./dist/entries/reactivity-server.js"
|
|
93
|
+
},
|
|
94
|
+
"./reactivity/window": {
|
|
95
|
+
"types": "./types/index.d.ts",
|
|
96
|
+
"worker": "./dist/entries/window-server.js",
|
|
97
|
+
"browser": "./dist/entries/window.js",
|
|
98
|
+
"default": "./dist/entries/window-server.js"
|
|
99
|
+
},
|
|
100
|
+
"./server": {
|
|
101
|
+
"types": "./types/index.d.ts",
|
|
102
|
+
"default": "./dist/entries/server.js"
|
|
103
|
+
},
|
|
104
|
+
"./store": {
|
|
105
|
+
"types": "./types/index.d.ts",
|
|
106
|
+
"worker": "./dist/entries/store-server.js",
|
|
107
|
+
"browser": "./dist/entries/store-client.js",
|
|
108
|
+
"default": "./dist/entries/store-server.js"
|
|
109
|
+
},
|
|
110
|
+
"./transition": {
|
|
111
|
+
"types": "./types/index.d.ts",
|
|
112
|
+
"default": "./dist/entries/transition.js"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"dependencies": {
|
|
116
|
+
"@jridgewell/remapping": "^2.3.5",
|
|
117
|
+
"@jridgewell/sourcemap-codec": "^1.6.0",
|
|
118
|
+
"@sveltejs/acorn-typescript": "^1.0.13",
|
|
119
|
+
"@types/estree": "^1.0.9",
|
|
120
|
+
"acorn": "^8.18.0",
|
|
121
|
+
"vigla": "0.1.0",
|
|
122
|
+
"esrap": "^2.3.6"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { CompileError as Fault, type Diagnostic } from 'vigla/compiler';
|
|
2
|
+
import { locator, type Locator } from '../front/index.ts';
|
|
3
|
+
|
|
4
|
+
export interface Location {
|
|
5
|
+
line: number;
|
|
6
|
+
column: number;
|
|
7
|
+
character: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Warning {
|
|
11
|
+
code: string;
|
|
12
|
+
message: string;
|
|
13
|
+
filename?: string;
|
|
14
|
+
start?: Location;
|
|
15
|
+
end?: Location;
|
|
16
|
+
position?: [number, number];
|
|
17
|
+
frame?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const unknownFilename = '(unknown)';
|
|
21
|
+
const leadingTabs = /^\t+/;
|
|
22
|
+
|
|
23
|
+
function tabsToSpaces(line: string): string {
|
|
24
|
+
return line.replace(leadingTabs, (tabs) => ' '.repeat(tabs.length));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function codeFrame(lines: readonly string[], line: number, column: number): string {
|
|
28
|
+
const first = Math.max(0, line - 2);
|
|
29
|
+
const last = Math.min(line + 3, lines.length);
|
|
30
|
+
const digits = String(last + 1).length;
|
|
31
|
+
const out: string[] = [];
|
|
32
|
+
for (let index = first; index < last; index++) {
|
|
33
|
+
const text = lines[index] as string;
|
|
34
|
+
const number = String(index + 1).padStart(digits, ' ');
|
|
35
|
+
out.push(`${number}: ${tabsToSpaces(text)}`);
|
|
36
|
+
if (index === line) {
|
|
37
|
+
const indent = digits + 2 + tabsToSpaces(text.slice(0, column)).length;
|
|
38
|
+
out.push(`${' '.repeat(indent)}^`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return out.join('\n');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function link(diagnostic: { code: string; message: string }): string {
|
|
45
|
+
return `${diagnostic.message}\nhttps://svelte.dev/e/${diagnostic.code}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface Located {
|
|
49
|
+
readonly filename?: string;
|
|
50
|
+
readonly position?: [number, number];
|
|
51
|
+
readonly start?: Location;
|
|
52
|
+
readonly end?: Location;
|
|
53
|
+
readonly frame?: () => string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function place(target: object, at: Located): void {
|
|
57
|
+
const { frame, ...rest } = at;
|
|
58
|
+
Object.assign(target, rest);
|
|
59
|
+
if (frame === undefined) return;
|
|
60
|
+
let text: string | undefined;
|
|
61
|
+
Object.defineProperty(target, 'frame', {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
configurable: true,
|
|
64
|
+
get: () => (text ??= frame()),
|
|
65
|
+
set: (value: string) => {
|
|
66
|
+
text = value;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function described(code: string, message: string, at: Warning): string {
|
|
72
|
+
let out = `${code}: ${message}`;
|
|
73
|
+
if (at.filename !== undefined) {
|
|
74
|
+
out += `\n${at.filename}`;
|
|
75
|
+
if (at.start !== undefined) out += `:${at.start.line}:${at.start.column}`;
|
|
76
|
+
}
|
|
77
|
+
if (at.frame !== undefined) out += `\n${at.frame}`;
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export class CompileWarning implements Warning {
|
|
82
|
+
readonly name = 'CompileWarning';
|
|
83
|
+
code: string;
|
|
84
|
+
message: string;
|
|
85
|
+
declare filename?: string;
|
|
86
|
+
declare position?: [number, number];
|
|
87
|
+
declare start?: Location;
|
|
88
|
+
declare end?: Location;
|
|
89
|
+
declare frame?: string;
|
|
90
|
+
|
|
91
|
+
constructor(code: string, message: string, at: Located) {
|
|
92
|
+
this.code = code;
|
|
93
|
+
this.message = message;
|
|
94
|
+
place(this, at);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
toString(): string {
|
|
98
|
+
return described(this.code, this.message, this);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
toJSON(): Warning {
|
|
102
|
+
const { code, message, filename, start, end, position, frame } = this;
|
|
103
|
+
return { code, message, filename, start, end, position, frame };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export class CompileError extends Error {
|
|
108
|
+
override message = '';
|
|
109
|
+
code: string;
|
|
110
|
+
declare filename?: string;
|
|
111
|
+
declare position?: [number, number];
|
|
112
|
+
declare start?: Location;
|
|
113
|
+
declare end?: Location;
|
|
114
|
+
declare frame?: string;
|
|
115
|
+
|
|
116
|
+
constructor(code: string, message: string, at: Located) {
|
|
117
|
+
super(message);
|
|
118
|
+
this.stack = '';
|
|
119
|
+
this.message = message;
|
|
120
|
+
this.code = code;
|
|
121
|
+
place(this, at);
|
|
122
|
+
this.name = 'CompileError';
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
override toString(): string {
|
|
126
|
+
return described(this.code, this.message, this);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
toJSON(): Warning {
|
|
130
|
+
const { code, message, filename, start, end, position, frame } = this;
|
|
131
|
+
return { code, message, filename, start, end, position, frame };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface Notice {
|
|
136
|
+
readonly code: string;
|
|
137
|
+
readonly message: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface Place {
|
|
141
|
+
readonly filename?: string;
|
|
142
|
+
readonly rootDir?: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function normalized(filename: string | undefined): string {
|
|
146
|
+
return (filename ?? unknownFilename).replace(/\\/g, '/');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function relativeFilename(place: Place): string {
|
|
150
|
+
const filename = normalized(place.filename);
|
|
151
|
+
const root = place.rootDir?.replace(/\\/g, '/');
|
|
152
|
+
if (root === undefined || !filename.startsWith(root)) return filename;
|
|
153
|
+
return filename.replace(root, '').replace(/^[/\\]/, '');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export class Diagnostics {
|
|
157
|
+
readonly source: string;
|
|
158
|
+
readonly #place: Place;
|
|
159
|
+
readonly #filter: (warning: Warning) => boolean;
|
|
160
|
+
#filename: string;
|
|
161
|
+
#locate: Locator | undefined;
|
|
162
|
+
#lines: string[] | undefined;
|
|
163
|
+
|
|
164
|
+
constructor(source: string, place: Place, filter?: (warning: Warning) => boolean) {
|
|
165
|
+
this.source = source;
|
|
166
|
+
this.#place = place;
|
|
167
|
+
this.#filter = filter ?? (() => true);
|
|
168
|
+
this.#filename = normalized(place.filename);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
analysing(): void {
|
|
172
|
+
this.#filename = relativeFilename(this.#place);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
get locate(): Locator {
|
|
176
|
+
this.#locate ??= locator(this.source);
|
|
177
|
+
return this.#locate;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
located(start: number | undefined, end: number | undefined): Located {
|
|
181
|
+
const filename = this.#filename === unknownFilename ? undefined : this.#filename;
|
|
182
|
+
if (start === undefined) return filename === undefined ? {} : { filename };
|
|
183
|
+
const finish = end ?? start;
|
|
184
|
+
const from = this.locate(start);
|
|
185
|
+
const to = this.locate(finish);
|
|
186
|
+
this.#lines ??= this.source.split('\n');
|
|
187
|
+
const lines = this.#lines;
|
|
188
|
+
const frame = (): string => codeFrame(lines, from.line - 1, to.column);
|
|
189
|
+
return {
|
|
190
|
+
...(filename === undefined ? {} : { filename }),
|
|
191
|
+
position: [start, finish],
|
|
192
|
+
start: from,
|
|
193
|
+
end: to,
|
|
194
|
+
frame
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
notices(notices: readonly Notice[]): Warning[] {
|
|
199
|
+
return notices
|
|
200
|
+
.map(
|
|
201
|
+
(notice) =>
|
|
202
|
+
new CompileWarning(notice.code, link(notice), this.located(undefined, undefined))
|
|
203
|
+
)
|
|
204
|
+
.filter(this.#filter);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
warnings(diagnostics: readonly Diagnostic[]): Warning[] {
|
|
208
|
+
const reshaped: Warning[] = [];
|
|
209
|
+
for (const diagnostic of diagnostics) {
|
|
210
|
+
const warning = new CompileWarning(
|
|
211
|
+
diagnostic.code,
|
|
212
|
+
link(diagnostic),
|
|
213
|
+
this.located(diagnostic.start, diagnostic.end)
|
|
214
|
+
);
|
|
215
|
+
if (this.#filter(warning)) reshaped.push(warning);
|
|
216
|
+
}
|
|
217
|
+
return reshaped;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
guard<T>(run: () => T): T {
|
|
221
|
+
try {
|
|
222
|
+
return run();
|
|
223
|
+
} catch (error) {
|
|
224
|
+
if (error instanceof Fault) {
|
|
225
|
+
const { code, start, end } = error.diagnostic;
|
|
226
|
+
const unplaced = code.startsWith('options_');
|
|
227
|
+
const at = unplaced ? this.located(undefined, undefined) : this.located(start, end);
|
|
228
|
+
throw new CompileError(code, link(error.diagnostic), at);
|
|
229
|
+
}
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeStyle,
|
|
3
|
+
compile as compileUnit,
|
|
4
|
+
hash,
|
|
5
|
+
compileModule as compileModuleUnit,
|
|
6
|
+
validateComponent as validateUnit,
|
|
7
|
+
validateModule as validateModuleUnit,
|
|
8
|
+
type Code,
|
|
9
|
+
type Diagnostic,
|
|
10
|
+
type InputMap,
|
|
11
|
+
type Runtime,
|
|
12
|
+
type ValidateOptions
|
|
13
|
+
} from 'vigla/compiler';
|
|
14
|
+
import {
|
|
15
|
+
front,
|
|
16
|
+
legacy,
|
|
17
|
+
lowerComponent,
|
|
18
|
+
parseComponent,
|
|
19
|
+
parseStylesheet,
|
|
20
|
+
validateComponent,
|
|
21
|
+
validateModuleSyntax,
|
|
22
|
+
wording,
|
|
23
|
+
type AST,
|
|
24
|
+
type Parsed
|
|
25
|
+
} from '../front/index.ts';
|
|
26
|
+
import { Diagnostics, relativeFilename, type Warning } from './diagnostics.ts';
|
|
27
|
+
import { validate } from './options.ts';
|
|
28
|
+
import { format } from '../shared/format.ts';
|
|
29
|
+
import { proxyDiagnostics } from './proxy.ts';
|
|
30
|
+
|
|
31
|
+
export { CompileError, CompileWarning, type Location, type Warning } from './diagnostics.ts';
|
|
32
|
+
export { format } from '../shared/format.ts';
|
|
33
|
+
export { print, type PrintOptions, type Printed } from '../front/index.ts';
|
|
34
|
+
export {
|
|
35
|
+
preprocess,
|
|
36
|
+
type MarkupPreprocessor,
|
|
37
|
+
type Preprocessor,
|
|
38
|
+
type PreprocessorGroup,
|
|
39
|
+
type Processed
|
|
40
|
+
} from './preprocess/index.ts';
|
|
41
|
+
export type { AST };
|
|
42
|
+
|
|
43
|
+
export const VERSION = '5.57.3';
|
|
44
|
+
|
|
45
|
+
export interface Experimental {
|
|
46
|
+
async?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ModuleCompileOptions {
|
|
50
|
+
filename?: string;
|
|
51
|
+
rootDir?: string;
|
|
52
|
+
dev?: boolean;
|
|
53
|
+
generate?: 'client' | 'server' | false;
|
|
54
|
+
warningFilter?: (warning: Warning) => boolean;
|
|
55
|
+
experimental?: Experimental;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface CssHashInput {
|
|
59
|
+
name: string;
|
|
60
|
+
filename: string;
|
|
61
|
+
css: string;
|
|
62
|
+
hash: (input: string) => string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface CompileOptions extends ModuleCompileOptions {
|
|
66
|
+
name?: string;
|
|
67
|
+
runes?: boolean;
|
|
68
|
+
css?: 'injected' | 'external';
|
|
69
|
+
cssHash?: (input: CssHashInput) => string;
|
|
70
|
+
cssOutputFilename?: string;
|
|
71
|
+
outputFilename?: string;
|
|
72
|
+
customElement?: boolean;
|
|
73
|
+
discloseVersion?: boolean;
|
|
74
|
+
namespace?: 'html' | 'svg' | 'mathml';
|
|
75
|
+
modernAst?: boolean;
|
|
76
|
+
preserveComments?: boolean;
|
|
77
|
+
preserveWhitespace?: boolean;
|
|
78
|
+
fragments?: 'html' | 'tree';
|
|
79
|
+
hmr?: boolean;
|
|
80
|
+
sourcemap?: InputMap;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface Metadata {
|
|
84
|
+
runes: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface CssResult {
|
|
88
|
+
code: string;
|
|
89
|
+
map: unknown;
|
|
90
|
+
hasGlobal: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface CompileResult {
|
|
94
|
+
js: Code | null;
|
|
95
|
+
css: CssResult | null;
|
|
96
|
+
warnings: Warning[];
|
|
97
|
+
metadata: Metadata;
|
|
98
|
+
ast?: AST.Root | Record<string, any>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface ParseOptions {
|
|
102
|
+
filename?: string;
|
|
103
|
+
rootDir?: string;
|
|
104
|
+
modern?: boolean;
|
|
105
|
+
loose?: boolean;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const stores = ['svelte/store'];
|
|
109
|
+
|
|
110
|
+
const runtime: Runtime = {
|
|
111
|
+
client: 'svelte/internal/client',
|
|
112
|
+
server: 'svelte/internal/server',
|
|
113
|
+
names: { pre: 'user_pre_effect', userEffect: 'user_effect' }
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
function generated(options: ModuleCompileOptions): 'client' | 'server' {
|
|
117
|
+
return options.generate === 'server' ? 'server' : 'client';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function sourceName(filename: string | undefined): string {
|
|
121
|
+
const parts = (filename ?? '(unknown)').split(/[/\\]/);
|
|
122
|
+
const base = parts.pop() as string;
|
|
123
|
+
const directory = parts.at(-1);
|
|
124
|
+
let name = base.replace('.svelte', '');
|
|
125
|
+
if (name === 'index' && directory && directory !== 'src') name = directory;
|
|
126
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function functionName(preferred: string): string {
|
|
130
|
+
return preferred.replace(/[^a-zA-Z0-9_$]/g, '_').replace(/^[0-9]/, '_');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function styleHash(root: AST.Root, options: CompileOptions, name: string): string {
|
|
134
|
+
if (root.css === null) return '';
|
|
135
|
+
const css = root.css.content.styles;
|
|
136
|
+
const filename = relativeFilename(options);
|
|
137
|
+
if (options.cssHash) return options.cssHash({ name, filename, css, hash });
|
|
138
|
+
return `svelte-${hash(filename === '(unknown)' ? css : filename)}`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function publicAst(
|
|
142
|
+
source: string,
|
|
143
|
+
parsed: Parsed,
|
|
144
|
+
modern: boolean | undefined
|
|
145
|
+
): AST.Root | Record<string, any> {
|
|
146
|
+
return modern ? parsed.root : legacy(source, parsed.root, parsed.options);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function withoutBom(source: string): string {
|
|
150
|
+
return source.charCodeAt(0) === 0xfeff ? source.slice(1) : source;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function parse(source: string, options: ParseOptions & { modern: true }): AST.Root;
|
|
154
|
+
export function parse(source: string, options?: ParseOptions): Record<string, any>;
|
|
155
|
+
export function parse(
|
|
156
|
+
input: string,
|
|
157
|
+
{ modern, loose }: ParseOptions = {}
|
|
158
|
+
): AST.Root | Record<string, any> {
|
|
159
|
+
if (typeof input !== 'string') throw new TypeError('Template must be a string');
|
|
160
|
+
const source = withoutBom(input);
|
|
161
|
+
return new Diagnostics(source, {}).guard(() => {
|
|
162
|
+
const parsed = parseComponent(source, loose);
|
|
163
|
+
return modern ? parsed.root : legacy(source, parsed.root, parsed.options);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function parseCss(input: string): AST.Css.StyleSheetFile {
|
|
168
|
+
const source = withoutBom(input);
|
|
169
|
+
return new Diagnostics(source, {}).guard(() => parseStylesheet(source));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function compile(input: string, options: CompileOptions = {}): CompileResult {
|
|
173
|
+
const source = withoutBom(input);
|
|
174
|
+
const diagnostics = new Diagnostics(source, options, options.warningFilter);
|
|
175
|
+
return diagnostics.guard(() => {
|
|
176
|
+
const notices = diagnostics.notices(validate(options, 'component'));
|
|
177
|
+
const parsed = parseComponent(source);
|
|
178
|
+
diagnostics.analysing();
|
|
179
|
+
const reading = lowerComponent(parsed, source, options.filename ?? null);
|
|
180
|
+
const syntax = validateComponent(parsed, source, {
|
|
181
|
+
customElement: options.customElement === true,
|
|
182
|
+
filename: options.filename
|
|
183
|
+
});
|
|
184
|
+
const validation: ValidateOptions = {
|
|
185
|
+
customElement: options.customElement === true,
|
|
186
|
+
namespace: options.namespace,
|
|
187
|
+
stores,
|
|
188
|
+
wording,
|
|
189
|
+
front: {
|
|
190
|
+
before: syntax.before,
|
|
191
|
+
at: syntax.anchors.translated(reading.lowered, reading.anchored)
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const reported = (core: readonly Diagnostic[]): Warning[] => [
|
|
195
|
+
...notices,
|
|
196
|
+
...diagnostics.warnings([...syntax.parse, ...core])
|
|
197
|
+
];
|
|
198
|
+
const named = sourceName(options.filename);
|
|
199
|
+
const name = functionName(options.name ?? named);
|
|
200
|
+
const css = {
|
|
201
|
+
hash: styleHash(parsed.root, options, named),
|
|
202
|
+
id:
|
|
203
|
+
options.cssHash === undefined && relativeFilename(options) === '(unknown)'
|
|
204
|
+
? `svelte-${hash(source)}`
|
|
205
|
+
: undefined,
|
|
206
|
+
inject: options.css === 'injected',
|
|
207
|
+
outputFilename: options.cssOutputFilename
|
|
208
|
+
};
|
|
209
|
+
if (options.generate === false) {
|
|
210
|
+
const core = validateUnit(reading.unit, validation);
|
|
211
|
+
const style = analyzeStyle(reading.unit, { hash: css.hash });
|
|
212
|
+
return {
|
|
213
|
+
js: null,
|
|
214
|
+
css: null,
|
|
215
|
+
warnings: reported([...core, ...style.warnings]),
|
|
216
|
+
metadata: { runes: true },
|
|
217
|
+
ast: publicAst(source, parsed, options.modernAst)
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
const output = compileUnit(reading.unit, {
|
|
221
|
+
generate: generated(options),
|
|
222
|
+
runtime,
|
|
223
|
+
clientExpression:
|
|
224
|
+
options.dev && generated(options) === 'client'
|
|
225
|
+
? proxyDiagnostics(reading.unit, relativeFilename(options))
|
|
226
|
+
: undefined,
|
|
227
|
+
format,
|
|
228
|
+
devFilename: relativeFilename(options),
|
|
229
|
+
discloseVersion: options.discloseVersion === false ? false : '5',
|
|
230
|
+
name,
|
|
231
|
+
customElement: options.customElement ?? false,
|
|
232
|
+
css,
|
|
233
|
+
dev: options.dev,
|
|
234
|
+
namespace: options.namespace,
|
|
235
|
+
preserveWhitespace: options.preserveWhitespace,
|
|
236
|
+
preserveComments: options.preserveComments,
|
|
237
|
+
fragments: options.fragments,
|
|
238
|
+
validation,
|
|
239
|
+
outputFilename: options.outputFilename,
|
|
240
|
+
inputMap: options.sourcemap,
|
|
241
|
+
hmr: options.hmr
|
|
242
|
+
});
|
|
243
|
+
return {
|
|
244
|
+
js: output.js,
|
|
245
|
+
css: output.css,
|
|
246
|
+
warnings: reported(output.warnings),
|
|
247
|
+
metadata: { runes: true },
|
|
248
|
+
ast: publicAst(source, parsed, options.modernAst)
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export function compileModule(input: string, options: ModuleCompileOptions = {}): CompileResult {
|
|
254
|
+
const source = withoutBom(input);
|
|
255
|
+
const diagnostics = new Diagnostics(source, options, options.warningFilter);
|
|
256
|
+
return diagnostics.guard(() => {
|
|
257
|
+
const notices = diagnostics.notices(validate(options, 'module'));
|
|
258
|
+
diagnostics.analysing();
|
|
259
|
+
const reading = front.module({ source, filename: options.filename ?? null });
|
|
260
|
+
const program = reading.unit.program;
|
|
261
|
+
const validation: ValidateOptions = {
|
|
262
|
+
stores,
|
|
263
|
+
wording,
|
|
264
|
+
front: { at: validateModuleSyntax(program).translated(new Map(), new Map()) }
|
|
265
|
+
};
|
|
266
|
+
if (options.generate === false) {
|
|
267
|
+
const core = validateModuleUnit(reading.unit, validation);
|
|
268
|
+
return {
|
|
269
|
+
js: null,
|
|
270
|
+
css: null,
|
|
271
|
+
warnings: [...notices, ...diagnostics.warnings(core)],
|
|
272
|
+
metadata: { runes: true }
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
const output = compileModuleUnit(reading.unit, {
|
|
276
|
+
generate: generated(options),
|
|
277
|
+
runtime,
|
|
278
|
+
clientExpression:
|
|
279
|
+
options.dev && generated(options) === 'client'
|
|
280
|
+
? proxyDiagnostics(reading.unit, relativeFilename(options))
|
|
281
|
+
: undefined,
|
|
282
|
+
dev: options.dev,
|
|
283
|
+
validation
|
|
284
|
+
});
|
|
285
|
+
return {
|
|
286
|
+
js: output.js,
|
|
287
|
+
css: null,
|
|
288
|
+
warnings: [...notices, ...diagnostics.warnings(output.warnings)],
|
|
289
|
+
metadata: { runes: true }
|
|
290
|
+
};
|
|
291
|
+
});
|
|
292
|
+
}
|