svelte-effect-runtime 3.1.0 → 3.2.0

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.
@@ -0,0 +1,181 @@
1
+ //#region src/grammars/textmate.ts
2
+ const punctuation_begin = { name: "punctuation.section.embedded.begin.svelte" };
3
+ const punctuation_end = { name: "punctuation.section.embedded.end.svelte" };
4
+ const directive_punctuation = { name: "punctuation.definition.tag.ser.svelte" };
5
+ const expression_patterns = [{ include: "#ser-yield-star" }, { include: "source.ts" }];
6
+ /**
7
+ * Shiki-ready TextMate injection grammar that adds SER syntax to the stock
8
+ * Svelte grammar without replacing Svelte's own grammar.
9
+ *
10
+ * @since 3.2.0
11
+ */
12
+ const textmate_language = {
13
+ name: "svelte-effect-runtime",
14
+ displayName: "Svelte Effect Runtime",
15
+ scopeName: "source.svelte.ser.injection",
16
+ injectionSelector: "L:source.svelte -comment -string",
17
+ injectTo: ["source.svelte"],
18
+ embeddedLangs: ["typescript"],
19
+ patterns: [
20
+ { include: "#ser-script-effect-attribute" },
21
+ { include: "#ser-declaration-tag" },
22
+ { include: "#ser-const-directive" },
23
+ { include: "#ser-block-directive" },
24
+ { include: "#ser-else-if-directive" },
25
+ { include: "#ser-expression-directive" },
26
+ { include: "#ser-event-attribute" },
27
+ { include: "#ser-yield-expression" },
28
+ { include: "#ser-yield-star" }
29
+ ],
30
+ repository: {
31
+ "ser-script-effect-attribute": {
32
+ match: "(<script\\b(?=[^>]*\\s+effect(?:\\s*=|\\s|>|$))[^>]*?)(\\s+)(effect)(?=(?:\\s*=|\\s|>|$))",
33
+ captures: { "3": { name: "storage.modifier.effect.ser.svelte" } }
34
+ },
35
+ "ser-yield-star": {
36
+ match: "\\byield\\s*(\\*)",
37
+ name: "keyword.control.yield.ser.svelte",
38
+ captures: { "1": { name: "keyword.operator.yield.star.ser.svelte" } }
39
+ },
40
+ "ser-yield-expression": {
41
+ begin: "(\\{)(?=\\s*yield\\s*\\*)",
42
+ beginCaptures: { "1": punctuation_begin },
43
+ end: "(\\})",
44
+ endCaptures: { "1": punctuation_end },
45
+ name: "meta.embedded.expression.yield.ser.svelte",
46
+ patterns: expression_patterns
47
+ },
48
+ "ser-declaration-tag": {
49
+ begin: "(\\{)(\\s*)(?=(?:const|let)\\b)",
50
+ beginCaptures: { "1": punctuation_begin },
51
+ end: "(\\})",
52
+ endCaptures: { "1": punctuation_end },
53
+ name: "meta.embedded.declaration.ser.svelte",
54
+ patterns: [{
55
+ match: "\\b(?:const|let)\\b",
56
+ name: "storage.type.declaration.ser.svelte"
57
+ }, ...expression_patterns]
58
+ },
59
+ "ser-const-directive": {
60
+ begin: "(\\{)(\\s*)(@)(const)\\b",
61
+ beginCaptures: {
62
+ "1": punctuation_begin,
63
+ "3": directive_punctuation,
64
+ "4": { name: "storage.type.declaration.ser.svelte" }
65
+ },
66
+ end: "(\\})",
67
+ endCaptures: { "1": punctuation_end },
68
+ name: "meta.embedded.directive.const.ser.svelte",
69
+ patterns: expression_patterns
70
+ },
71
+ "ser-block-directive": {
72
+ begin: "(\\{)(\\s*)(#)(each|await|if|key)\\b",
73
+ beginCaptures: {
74
+ "1": punctuation_begin,
75
+ "3": directive_punctuation,
76
+ "4": { name: "keyword.control.block.ser.svelte" }
77
+ },
78
+ end: "(\\})",
79
+ endCaptures: { "1": punctuation_end },
80
+ name: "meta.embedded.directive.block.ser.svelte",
81
+ patterns: expression_patterns
82
+ },
83
+ "ser-else-if-directive": {
84
+ begin: "(\\{)(\\s*)(:)(else\\s+if)\\b",
85
+ beginCaptures: {
86
+ "1": punctuation_begin,
87
+ "3": directive_punctuation,
88
+ "4": { name: "keyword.control.conditional.ser.svelte" }
89
+ },
90
+ end: "(\\})",
91
+ endCaptures: { "1": punctuation_end },
92
+ name: "meta.embedded.directive.else-if.ser.svelte",
93
+ patterns: expression_patterns
94
+ },
95
+ "ser-expression-directive": {
96
+ begin: "(\\{)(\\s*)(@)(render|html|debug)\\b",
97
+ beginCaptures: {
98
+ "1": punctuation_begin,
99
+ "3": directive_punctuation,
100
+ "4": { name: "keyword.control.directive.ser.svelte" }
101
+ },
102
+ end: "(\\})",
103
+ endCaptures: { "1": punctuation_end },
104
+ name: "meta.embedded.directive.expression.ser.svelte",
105
+ patterns: expression_patterns
106
+ },
107
+ "ser-event-attribute": {
108
+ begin: "(\\b(?:on:[A-Za-z_$][\\w$-]*|on[A-Za-z_$][\\w$-]*)\\b)(\\s*=\\s*)(\\{)(?=\\s*yield\\s*\\*)",
109
+ beginCaptures: {
110
+ "1": { name: "entity.other.attribute-name.event.ser.svelte" },
111
+ "3": punctuation_begin
112
+ },
113
+ end: "(\\})",
114
+ endCaptures: { "1": punctuation_end },
115
+ name: "meta.embedded.attribute.event.ser.svelte",
116
+ patterns: expression_patterns
117
+ }
118
+ }
119
+ };
120
+ /**
121
+ * TextMate grammar bundle exported by `svelte-effect-runtime/grammars`.
122
+ *
123
+ * @since 3.2.0
124
+ */
125
+ const textmate = {
126
+ language: textmate_language,
127
+ scope_name: textmate_language.scopeName,
128
+ target_scope_name: "source.svelte",
129
+ injection_selector: textmate_language.injectionSelector
130
+ };
131
+ //#endregion
132
+ //#region src/grammars/tree-sitter.ts
133
+ /**
134
+ * Query strings that describe SER's extensions for tree-sitter-svelte clients.
135
+ *
136
+ * @since 3.2.0
137
+ */
138
+ const tree_sitter = {
139
+ name: "svelte-effect-runtime",
140
+ highlights_query: String.raw`
141
+ ; Highlight the SER-only effect marker on <script effect>.
142
+ ((script_element
143
+ (start_tag
144
+ (attribute
145
+ (attribute_name) @storage.modifier.effect.ser)))
146
+ (#eq? @storage.modifier.effect.ser "effect"))
147
+
148
+ ; Highlight yielded Effect expressions after TypeScript has been injected.
149
+ (yield_expression
150
+ "*" @keyword.operator.yield.star.ser) @keyword.control.yield.ser
151
+
152
+ ; Highlight bare SER declaration tags such as {const value = yield* load()}.
153
+ ((expression) @meta.embedded.declaration.ser
154
+ (#match? @meta.embedded.declaration.ser "^\\s*(const|let)\\s"))
155
+ `,
156
+ injections_query: String.raw`
157
+ ; Treat <script lang="ts" effect> as TypeScript just like stock Svelte script tags.
158
+ ((script_element
159
+ (start_tag
160
+ (attribute
161
+ (attribute_name) @_lang_name
162
+ (quoted_attribute_value
163
+ (attribute_value) @_lang_value))
164
+ (attribute
165
+ (attribute_name) @_effect_name))
166
+ (raw_text) @injection.content)
167
+ (#eq? @_lang_name "lang")
168
+ (#any-of? @_lang_value "ts" "typescript")
169
+ (#eq? @_effect_name "effect")
170
+ (#set! injection.language "typescript"))
171
+
172
+ ; Inject TypeScript into SER markup expressions that stock queries may not see.
173
+ ((expression) @injection.content
174
+ (#match? @injection.content "^\\s*(yield\\s*\\*|(const|let)\\s|[#@:](each|await|if|key|else\\s+if|render|html|debug|const)\\b)")
175
+ (#set! injection.language "typescript"))
176
+ `
177
+ };
178
+ //#endregion
179
+ export { textmate as n, textmate_language as r, tree_sitter as t };
180
+
181
+ //# sourceMappingURL=grammars-DwahpmJS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grammars-DwahpmJS.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/grammars/textmate.ts","../../../modules/svelte-effect-runtime/src/grammars/tree-sitter.ts"],"sourcesContent":["/**\n * JSON-compatible TextMate capture map used by raw grammar rules.\n *\n * @example\n * ```ts\n * const captures: TextMateCaptureMap = {\n * \"1\": { name: \"keyword.control.ser.svelte\" },\n * };\n * ```\n *\n * @since 3.2.0\n */\nexport interface TextMateCaptureMap {\n readonly [capture_id: string]: TextMateRawRule;\n}\n\n/**\n * JSON-compatible TextMate repository map used by raw grammar rules.\n *\n * @example\n * ```ts\n * const repository: TextMateRepository = {\n * \"ser-yield-star\": { match: \"\\\\byield\\\\s*\\\\*\" },\n * };\n * ```\n *\n * @since 3.2.0\n */\nexport interface TextMateRepository {\n readonly [rule_name: string]: TextMateRawRule;\n}\n\n/**\n * JSON-compatible subset of a TextMate grammar rule.\n *\n * @example\n * ```ts\n * const rule: TextMateRawRule = {\n * match: \"\\\\byield\\\\s*(\\\\*)\",\n * name: \"keyword.control.yield.ser.svelte\",\n * };\n * ```\n *\n * @since 3.2.0\n */\nexport interface TextMateRawRule {\n readonly include?: string;\n readonly name?: string;\n readonly contentName?: string;\n readonly match?: string;\n readonly captures?: TextMateCaptureMap;\n readonly begin?: string;\n readonly beginCaptures?: TextMateCaptureMap;\n readonly end?: string;\n readonly endCaptures?: TextMateCaptureMap;\n readonly patterns?: readonly TextMateRawRule[];\n readonly repository?: TextMateRepository;\n}\n\n/**\n * Shiki-compatible TextMate language registration for a raw grammar.\n *\n * @example\n * ```ts\n * const language: TextMateLanguageRegistration = textmate.language;\n * ```\n *\n * @since 3.2.0\n */\nexport interface TextMateLanguageRegistration {\n readonly name: string;\n readonly displayName: string;\n readonly scopeName: string;\n readonly injectionSelector: string;\n readonly injectTo: readonly string[];\n readonly embeddedLangs: readonly string[];\n readonly patterns: readonly TextMateRawRule[];\n readonly repository: TextMateRepository;\n}\n\n/**\n * Public TextMate grammar bundle for SER-aware Svelte highlighting.\n *\n * @example\n * ```ts\n * await highlighter.loadLanguage(textmate.language);\n * ```\n *\n * @since 3.2.0\n */\nexport interface TextMateGrammarBundle {\n readonly language: TextMateLanguageRegistration;\n readonly scope_name: string;\n readonly target_scope_name: string;\n readonly injection_selector: string;\n}\n\nconst punctuation_begin: TextMateRawRule = {\n name: \"punctuation.section.embedded.begin.svelte\",\n};\n\nconst punctuation_end: TextMateRawRule = {\n name: \"punctuation.section.embedded.end.svelte\",\n};\n\nconst directive_punctuation: TextMateRawRule = {\n name: \"punctuation.definition.tag.ser.svelte\",\n};\n\nconst expression_patterns: readonly TextMateRawRule[] = [\n { include: \"#ser-yield-star\" },\n { include: \"source.ts\" },\n];\n\n/**\n * Shiki-ready TextMate injection grammar that adds SER syntax to the stock\n * Svelte grammar without replacing Svelte's own grammar.\n *\n * @since 3.2.0\n */\nexport const textmate_language: TextMateLanguageRegistration = {\n name: \"svelte-effect-runtime\",\n displayName: \"Svelte Effect Runtime\",\n scopeName: \"source.svelte.ser.injection\",\n injectionSelector: \"L:source.svelte -comment -string\",\n injectTo: [\"source.svelte\"],\n embeddedLangs: [\"typescript\"],\n patterns: [\n { include: \"#ser-script-effect-attribute\" },\n { include: \"#ser-declaration-tag\" },\n { include: \"#ser-const-directive\" },\n { include: \"#ser-block-directive\" },\n { include: \"#ser-else-if-directive\" },\n { include: \"#ser-expression-directive\" },\n { include: \"#ser-event-attribute\" },\n { include: \"#ser-yield-expression\" },\n { include: \"#ser-yield-star\" },\n ],\n repository: {\n \"ser-script-effect-attribute\": {\n match:\n \"(<script\\\\b(?=[^>]*\\\\s+effect(?:\\\\s*=|\\\\s|>|$))[^>]*?)(\\\\s+)(effect)(?=(?:\\\\s*=|\\\\s|>|$))\",\n captures: {\n \"3\": { name: \"storage.modifier.effect.ser.svelte\" },\n },\n },\n\n \"ser-yield-star\": {\n match: \"\\\\byield\\\\s*(\\\\*)\",\n name: \"keyword.control.yield.ser.svelte\",\n captures: {\n \"1\": { name: \"keyword.operator.yield.star.ser.svelte\" },\n },\n },\n\n \"ser-yield-expression\": {\n begin: \"(\\\\{)(?=\\\\s*yield\\\\s*\\\\*)\",\n beginCaptures: {\n \"1\": punctuation_begin,\n },\n end: \"(\\\\})\",\n endCaptures: {\n \"1\": punctuation_end,\n },\n name: \"meta.embedded.expression.yield.ser.svelte\",\n patterns: expression_patterns,\n },\n\n \"ser-declaration-tag\": {\n begin: \"(\\\\{)(\\\\s*)(?=(?:const|let)\\\\b)\",\n beginCaptures: {\n \"1\": punctuation_begin,\n },\n end: \"(\\\\})\",\n endCaptures: {\n \"1\": punctuation_end,\n },\n name: \"meta.embedded.declaration.ser.svelte\",\n patterns: [\n {\n match: \"\\\\b(?:const|let)\\\\b\",\n name: \"storage.type.declaration.ser.svelte\",\n },\n ...expression_patterns,\n ],\n },\n\n \"ser-const-directive\": {\n begin: \"(\\\\{)(\\\\s*)(@)(const)\\\\b\",\n beginCaptures: {\n \"1\": punctuation_begin,\n \"3\": directive_punctuation,\n \"4\": { name: \"storage.type.declaration.ser.svelte\" },\n },\n end: \"(\\\\})\",\n endCaptures: {\n \"1\": punctuation_end,\n },\n name: \"meta.embedded.directive.const.ser.svelte\",\n patterns: expression_patterns,\n },\n\n \"ser-block-directive\": {\n begin: \"(\\\\{)(\\\\s*)(#)(each|await|if|key)\\\\b\",\n beginCaptures: {\n \"1\": punctuation_begin,\n \"3\": directive_punctuation,\n \"4\": { name: \"keyword.control.block.ser.svelte\" },\n },\n end: \"(\\\\})\",\n endCaptures: {\n \"1\": punctuation_end,\n },\n name: \"meta.embedded.directive.block.ser.svelte\",\n patterns: expression_patterns,\n },\n\n \"ser-else-if-directive\": {\n begin: \"(\\\\{)(\\\\s*)(:)(else\\\\s+if)\\\\b\",\n beginCaptures: {\n \"1\": punctuation_begin,\n \"3\": directive_punctuation,\n \"4\": { name: \"keyword.control.conditional.ser.svelte\" },\n },\n end: \"(\\\\})\",\n endCaptures: {\n \"1\": punctuation_end,\n },\n name: \"meta.embedded.directive.else-if.ser.svelte\",\n patterns: expression_patterns,\n },\n\n \"ser-expression-directive\": {\n begin: \"(\\\\{)(\\\\s*)(@)(render|html|debug)\\\\b\",\n beginCaptures: {\n \"1\": punctuation_begin,\n \"3\": directive_punctuation,\n \"4\": { name: \"keyword.control.directive.ser.svelte\" },\n },\n end: \"(\\\\})\",\n endCaptures: {\n \"1\": punctuation_end,\n },\n name: \"meta.embedded.directive.expression.ser.svelte\",\n patterns: expression_patterns,\n },\n\n \"ser-event-attribute\": {\n begin:\n \"(\\\\b(?:on:[A-Za-z_$][\\\\w$-]*|on[A-Za-z_$][\\\\w$-]*)\\\\b)(\\\\s*=\\\\s*)(\\\\{)(?=\\\\s*yield\\\\s*\\\\*)\",\n beginCaptures: {\n \"1\": { name: \"entity.other.attribute-name.event.ser.svelte\" },\n \"3\": punctuation_begin,\n },\n end: \"(\\\\})\",\n endCaptures: {\n \"1\": punctuation_end,\n },\n name: \"meta.embedded.attribute.event.ser.svelte\",\n patterns: expression_patterns,\n },\n },\n};\n\n/**\n * TextMate grammar bundle exported by `svelte-effect-runtime/grammars`.\n *\n * @since 3.2.0\n */\nexport const textmate: TextMateGrammarBundle = {\n language: textmate_language,\n scope_name: textmate_language.scopeName,\n target_scope_name: \"source.svelte\",\n injection_selector: textmate_language.injectionSelector,\n};\n","/**\n * Tree-sitter query strings for SER-aware Svelte tooling.\n *\n * @example\n * ```ts\n * const highlights = tree_sitter.highlights_query;\n * const injections = tree_sitter.injections_query;\n * ```\n *\n * @since 3.2.0\n */\nexport interface TreeSitterQueryBundle {\n readonly name: string;\n readonly highlights_query: string;\n readonly injections_query: string;\n}\n\n/**\n * Query strings that describe SER's extensions for tree-sitter-svelte clients.\n *\n * @since 3.2.0\n */\nexport const tree_sitter: TreeSitterQueryBundle = {\n name: \"svelte-effect-runtime\",\n highlights_query: String.raw`\n; Highlight the SER-only effect marker on <script effect>.\n((script_element\n (start_tag\n (attribute\n (attribute_name) @storage.modifier.effect.ser)))\n (#eq? @storage.modifier.effect.ser \"effect\"))\n\n; Highlight yielded Effect expressions after TypeScript has been injected.\n(yield_expression\n \"*\" @keyword.operator.yield.star.ser) @keyword.control.yield.ser\n\n; Highlight bare SER declaration tags such as {const value = yield* load()}.\n((expression) @meta.embedded.declaration.ser\n (#match? @meta.embedded.declaration.ser \"^\\\\s*(const|let)\\\\s\"))\n`,\n injections_query: String.raw`\n; Treat <script lang=\"ts\" effect> as TypeScript just like stock Svelte script tags.\n((script_element\n (start_tag\n (attribute\n (attribute_name) @_lang_name\n (quoted_attribute_value\n (attribute_value) @_lang_value))\n (attribute\n (attribute_name) @_effect_name))\n (raw_text) @injection.content)\n (#eq? @_lang_name \"lang\")\n (#any-of? @_lang_value \"ts\" \"typescript\")\n (#eq? @_effect_name \"effect\")\n (#set! injection.language \"typescript\"))\n\n; Inject TypeScript into SER markup expressions that stock queries may not see.\n((expression) @injection.content\n (#match? @injection.content \"^\\\\s*(yield\\\\s*\\\\*|(const|let)\\\\s|[#@:](each|await|if|key|else\\\\s+if|render|html|debug|const)\\\\b)\")\n (#set! injection.language \"typescript\"))\n`,\n};\n"],"mappings":";AAiGA,MAAM,oBAAqC,EACzC,MAAM,4CACR;AAEA,MAAM,kBAAmC,EACvC,MAAM,0CACR;AAEA,MAAM,wBAAyC,EAC7C,MAAM,wCACR;AAEA,MAAM,sBAAkD,CACtD,EAAE,SAAS,kBAAkB,GAC7B,EAAE,SAAS,YAAY,CACzB;;;;;;;AAQA,MAAa,oBAAkD;CAC7D,MAAM;CACN,aAAa;CACb,WAAW;CACX,mBAAmB;CACnB,UAAU,CAAC,eAAe;CAC1B,eAAe,CAAC,YAAY;CAC5B,UAAU;EACR,EAAE,SAAS,+BAA+B;EAC1C,EAAE,SAAS,uBAAuB;EAClC,EAAE,SAAS,uBAAuB;EAClC,EAAE,SAAS,uBAAuB;EAClC,EAAE,SAAS,yBAAyB;EACpC,EAAE,SAAS,4BAA4B;EACvC,EAAE,SAAS,uBAAuB;EAClC,EAAE,SAAS,wBAAwB;EACnC,EAAE,SAAS,kBAAkB;CAC/B;CACA,YAAY;EACV,+BAA+B;GAC7B,OACE;GACF,UAAU,EACR,KAAK,EAAE,MAAM,qCAAqC,EACpD;EACF;EAEA,kBAAkB;GAChB,OAAO;GACP,MAAM;GACN,UAAU,EACR,KAAK,EAAE,MAAM,yCAAyC,EACxD;EACF;EAEA,wBAAwB;GACtB,OAAO;GACP,eAAe,EACb,KAAK,kBACP;GACA,KAAK;GACL,aAAa,EACX,KAAK,gBACP;GACA,MAAM;GACN,UAAU;EACZ;EAEA,uBAAuB;GACrB,OAAO;GACP,eAAe,EACb,KAAK,kBACP;GACA,KAAK;GACL,aAAa,EACX,KAAK,gBACP;GACA,MAAM;GACN,UAAU,CACR;IACE,OAAO;IACP,MAAM;GACR,GACA,GAAG,mBACL;EACF;EAEA,uBAAuB;GACrB,OAAO;GACP,eAAe;IACb,KAAK;IACL,KAAK;IACL,KAAK,EAAE,MAAM,sCAAsC;GACrD;GACA,KAAK;GACL,aAAa,EACX,KAAK,gBACP;GACA,MAAM;GACN,UAAU;EACZ;EAEA,uBAAuB;GACrB,OAAO;GACP,eAAe;IACb,KAAK;IACL,KAAK;IACL,KAAK,EAAE,MAAM,mCAAmC;GAClD;GACA,KAAK;GACL,aAAa,EACX,KAAK,gBACP;GACA,MAAM;GACN,UAAU;EACZ;EAEA,yBAAyB;GACvB,OAAO;GACP,eAAe;IACb,KAAK;IACL,KAAK;IACL,KAAK,EAAE,MAAM,yCAAyC;GACxD;GACA,KAAK;GACL,aAAa,EACX,KAAK,gBACP;GACA,MAAM;GACN,UAAU;EACZ;EAEA,4BAA4B;GAC1B,OAAO;GACP,eAAe;IACb,KAAK;IACL,KAAK;IACL,KAAK,EAAE,MAAM,uCAAuC;GACtD;GACA,KAAK;GACL,aAAa,EACX,KAAK,gBACP;GACA,MAAM;GACN,UAAU;EACZ;EAEA,uBAAuB;GACrB,OACE;GACF,eAAe;IACb,KAAK,EAAE,MAAM,+CAA+C;IAC5D,KAAK;GACP;GACA,KAAK;GACL,aAAa,EACX,KAAK,gBACP;GACA,MAAM;GACN,UAAU;EACZ;CACF;AACF;;;;;;AAOA,MAAa,WAAkC;CAC7C,UAAU;CACV,YAAY,kBAAkB;CAC9B,mBAAmB;CACnB,oBAAoB,kBAAkB;AACxC;;;;;;;;AC5PA,MAAa,cAAqC;CAChD,MAAM;CACN,kBAAkB,OAAO,GAAG;;;;;;;;;;;;;;;;CAgB5B,kBAAkB,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;AAqB9B"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * JSON-compatible TextMate capture map used by raw grammar rules.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * const captures: TextMateCaptureMap = {
7
+ * "1": { name: "keyword.control.ser.svelte" },
8
+ * };
9
+ * ```
10
+ *
11
+ * @since 3.2.0
12
+ */
13
+ export interface TextMateCaptureMap {
14
+ readonly [capture_id: string]: TextMateRawRule;
15
+ }
16
+ /**
17
+ * JSON-compatible TextMate repository map used by raw grammar rules.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const repository: TextMateRepository = {
22
+ * "ser-yield-star": { match: "\\byield\\s*\\*" },
23
+ * };
24
+ * ```
25
+ *
26
+ * @since 3.2.0
27
+ */
28
+ export interface TextMateRepository {
29
+ readonly [rule_name: string]: TextMateRawRule;
30
+ }
31
+ /**
32
+ * JSON-compatible subset of a TextMate grammar rule.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const rule: TextMateRawRule = {
37
+ * match: "\\byield\\s*(\\*)",
38
+ * name: "keyword.control.yield.ser.svelte",
39
+ * };
40
+ * ```
41
+ *
42
+ * @since 3.2.0
43
+ */
44
+ export interface TextMateRawRule {
45
+ readonly include?: string;
46
+ readonly name?: string;
47
+ readonly contentName?: string;
48
+ readonly match?: string;
49
+ readonly captures?: TextMateCaptureMap;
50
+ readonly begin?: string;
51
+ readonly beginCaptures?: TextMateCaptureMap;
52
+ readonly end?: string;
53
+ readonly endCaptures?: TextMateCaptureMap;
54
+ readonly patterns?: readonly TextMateRawRule[];
55
+ readonly repository?: TextMateRepository;
56
+ }
57
+ /**
58
+ * Shiki-compatible TextMate language registration for a raw grammar.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const language: TextMateLanguageRegistration = textmate.language;
63
+ * ```
64
+ *
65
+ * @since 3.2.0
66
+ */
67
+ export interface TextMateLanguageRegistration {
68
+ readonly name: string;
69
+ readonly displayName: string;
70
+ readonly scopeName: string;
71
+ readonly injectionSelector: string;
72
+ readonly injectTo: readonly string[];
73
+ readonly embeddedLangs: readonly string[];
74
+ readonly patterns: readonly TextMateRawRule[];
75
+ readonly repository: TextMateRepository;
76
+ }
77
+ /**
78
+ * Public TextMate grammar bundle for SER-aware Svelte highlighting.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * await highlighter.loadLanguage(textmate.language);
83
+ * ```
84
+ *
85
+ * @since 3.2.0
86
+ */
87
+ export interface TextMateGrammarBundle {
88
+ readonly language: TextMateLanguageRegistration;
89
+ readonly scope_name: string;
90
+ readonly target_scope_name: string;
91
+ readonly injection_selector: string;
92
+ }
93
+ /**
94
+ * Shiki-ready TextMate injection grammar that adds SER syntax to the stock
95
+ * Svelte grammar without replacing Svelte's own grammar.
96
+ *
97
+ * @since 3.2.0
98
+ */
99
+ export declare const textmate_language: TextMateLanguageRegistration;
100
+ /**
101
+ * TextMate grammar bundle exported by `svelte-effect-runtime/grammars`.
102
+ *
103
+ * @since 3.2.0
104
+ */
105
+ export declare const textmate: TextMateGrammarBundle;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Tree-sitter query strings for SER-aware Svelte tooling.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * const highlights = tree_sitter.highlights_query;
7
+ * const injections = tree_sitter.injections_query;
8
+ * ```
9
+ *
10
+ * @since 3.2.0
11
+ */
12
+ export interface TreeSitterQueryBundle {
13
+ readonly name: string;
14
+ readonly highlights_query: string;
15
+ readonly injections_query: string;
16
+ }
17
+ /**
18
+ * Query strings that describe SER's extensions for tree-sitter-svelte clients.
19
+ *
20
+ * @since 3.2.0
21
+ */
22
+ export declare const tree_sitter: TreeSitterQueryBundle;
@@ -0,0 +1,2 @@
1
+ export { textmate, textmate as TextMate, textmate_language, type TextMateCaptureMap, type TextMateGrammarBundle, type TextMateLanguageRegistration, type TextMateRawRule, type TextMateRepository, } from "./grammars/textmate.js";
2
+ export { tree_sitter, tree_sitter as TreesitterQuery, type TreeSitterQueryBundle, } from "./grammars/tree-sitter.js";
@@ -0,0 +1,2 @@
1
+ import { n as textmate, r as textmate_language, t as tree_sitter } from "./chunks/grammars-DwahpmJS.js";
2
+ export { textmate as TextMate, textmate, tree_sitter as TreesitterQuery, tree_sitter, textmate_language };
package/.dist/mod.d.ts CHANGED
@@ -171,6 +171,7 @@ export declare const RequestEvent: Context.Reference<RequestEventShape>;
171
171
  export declare const get_server_runtime_or_throw: () => ManagedRuntime.ManagedRuntime<unknown, never>;
172
172
  /** Re-export error types users need for typed catch handlers. */
173
173
  export type { FormError, FormIssue, RemoteFailure, RemoteHttpError, RemoteTransportError, RemoteValidationError, } from "./remote/shared.js";
174
+ export { TextMate, textmate, textmate_language, type TextMateCaptureMap, type TextMateGrammarBundle, type TextMateLanguageRegistration, type TextMateRawRule, type TextMateRepository, tree_sitter, TreesitterQuery, type TreeSitterQueryBundle, } from "./grammars.js";
174
175
  export { AsyncEffectInEventCallbackError, AsyncEffectInSyncRuneError, AwaitInEffectWorkError, BatchQueryHandlerMissingError, DispatcherDisposedError, InvalidCommandFactoryError, InvalidLiveQueryFactoryError, InvalidLiveQueryReturnError, InvalidQueryFactoryError, InvalidRemoteFormResponseError, PreprocessError, RemoteErrorDecodeError, RemoteFormEndpointMissingError, RemoteHelperContextError, RemoteHelperError, RequestEventUnavailableError, RuntimeError, ServerOnlyImportError, SvelteKitServerExportUnavailableError, UncheckedCommandHandlerMissingError, UncheckedFormHandlerMissingError, UncheckedLiveQueryHandlerMissingError, UncheckedPrerenderHandlerMissingError, UncheckedQueryHandlerMissingError, UnknownRuntimeError, UnsupportedMarkupEffectPositionError, UnsupportedRemoteFormResponseError, YieldStarInEventCallbackError, } from "./errors.js";
175
176
  export { is_form_error, is_remote_http_error, is_remote_transport_error, is_remote_validation_error, } from "./remote/shared.js";
176
177
  /** Re-export app setup helpers so users can import them from root. */
package/.dist/mod.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { C as UncheckedPrerenderHandlerMissingError, D as UnsupportedRemoteFormResponseError, E as UnsupportedMarkupEffectPositionError, O as YieldStarInEventCallbackError, S as UncheckedLiveQueryHandlerMissingError, T as UnknownRuntimeError, _ as RuntimeError, a as DispatcherDisposedError, b as UncheckedCommandHandlerMissingError, c as InvalidLiveQueryReturnError, d as PreprocessError, f as RemoteErrorDecodeError, g as RequestEventUnavailableError, h as RemoteHelperError, i as BatchQueryHandlerMissingError, l as InvalidQueryFactoryError, m as RemoteHelperContextError, n as AsyncEffectInSyncRuneError, o as InvalidCommandFactoryError, p as RemoteFormEndpointMissingError, r as AwaitInEffectWorkError, s as InvalidLiveQueryFactoryError, t as AsyncEffectInEventCallbackError, u as InvalidRemoteFormResponseError, v as ServerOnlyImportError, w as UncheckedQueryHandlerMissingError, x as UncheckedFormHandlerMissingError, y as SvelteKitServerExportUnavailableError } from "./chunks/errors-DppSJ83S.js";
2
2
  import { t as Dispatcher } from "./chunks/dispatcher-CZvLODNK.js";
3
+ import { n as textmate, r as textmate_language, t as tree_sitter } from "./chunks/grammars-DwahpmJS.js";
3
4
  import { is_form_error, is_remote_http_error, is_remote_transport_error, is_remote_validation_error } from "./remote/shared.js";
4
5
  import { effect } from "./vite.js";
5
6
  //#region src/mod.ts
@@ -191,6 +192,6 @@ function make_server_only_error(name) {
191
192
  return new ServerOnlyImportError(name);
192
193
  }
193
194
  //#endregion
194
- export { AsyncEffectInEventCallbackError, AsyncEffectInSyncRuneError, AwaitInEffectWorkError, BatchQueryHandlerMissingError, ClientRuntime, Command, DispatcherDisposedError, Error, Form, InvalidCommandFactoryError, InvalidLiveQueryFactoryError, InvalidLiveQueryReturnError, InvalidQueryFactoryError, InvalidRemoteFormResponseError, PreprocessError, Prerender, Query, Redirect, RemoteErrorDecodeError, RemoteFormEndpointMissingError, RemoteHelperContextError, RemoteHelperError, RequestEvent, RequestEventUnavailableError, RuntimeError, ServerOnlyImportError, ServerRuntime, SvelteKitServerExportUnavailableError, UncheckedCommandHandlerMissingError, UncheckedFormHandlerMissingError, UncheckedLiveQueryHandlerMissingError, UncheckedPrerenderHandlerMissingError, UncheckedQueryHandlerMissingError, UnknownRuntimeError, UnsupportedMarkupEffectPositionError, UnsupportedRemoteFormResponseError, YieldStarInEventCallbackError, effect, get_server_runtime_or_throw, is_form_error, is_remote_http_error, is_remote_transport_error, is_remote_validation_error };
195
+ export { AsyncEffectInEventCallbackError, AsyncEffectInSyncRuneError, AwaitInEffectWorkError, BatchQueryHandlerMissingError, ClientRuntime, Command, DispatcherDisposedError, Error, Form, InvalidCommandFactoryError, InvalidLiveQueryFactoryError, InvalidLiveQueryReturnError, InvalidQueryFactoryError, InvalidRemoteFormResponseError, PreprocessError, Prerender, Query, Redirect, RemoteErrorDecodeError, RemoteFormEndpointMissingError, RemoteHelperContextError, RemoteHelperError, RequestEvent, RequestEventUnavailableError, RuntimeError, ServerOnlyImportError, ServerRuntime, SvelteKitServerExportUnavailableError, textmate as TextMate, textmate, tree_sitter as TreesitterQuery, tree_sitter, UncheckedCommandHandlerMissingError, UncheckedFormHandlerMissingError, UncheckedLiveQueryHandlerMissingError, UncheckedPrerenderHandlerMissingError, UncheckedQueryHandlerMissingError, UnknownRuntimeError, UnsupportedMarkupEffectPositionError, UnsupportedRemoteFormResponseError, YieldStarInEventCallbackError, effect, get_server_runtime_or_throw, is_form_error, is_remote_http_error, is_remote_transport_error, is_remote_validation_error, textmate_language };
195
196
 
196
197
  //# sourceMappingURL=mod.js.map
package/.dist/mod.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.js","names":[],"sources":["../../modules/svelte-effect-runtime/src/mod.ts"],"sourcesContent":["import { Dispatcher as InternalDispatcher } from \"$/dispatcher.ts\";\nimport { ServerOnlyImportError } from \"$/errors.ts\";\nimport type {\n ErrorEffectFactory,\n RedirectEffectFactory,\n} from \"$/server/control-flow.ts\";\nimport type { RequestEvent as RequestEventShape } from \"$/server/runtime.ts\";\nimport type {\n CommandFactory,\n FormFactory,\n PrerenderFactory,\n QueryFactory,\n ServerRuntimeFactory,\n} from \"$/server/types.ts\";\nimport type { Context, Layer, ManagedRuntime } from \"effect\";\n\n/**\n * Public API surface for `svelte-effect-runtime`.\n *\n * Call {@link ClientRuntime.make} in `hooks.client.ts`, call\n * {@link ServerRuntime.make} in `hooks.server.ts`, and let the Vite plugin\n * route server-only helpers to the server entrypoint automatically.\n *\n * @module\n */\n\n/**\n * Client-side runtime singleton. Call `ClientRuntime.make(layer?)` once\n * in `hooks.client.ts` to provide services to every component's effect\n * blocks.\n *\n * If never called, a default empty-layer runtime is created lazily on\n * the first `yield*` expression.\n *\n * @example\n * ```ts\n * import { ClientRuntime } from \"svelte-effect-runtime\";\n * import { Db } from \"./db.ts\";\n *\n * ClientRuntime.make(Db.Live);\n * ```\n *\n * @since 2.0.0\n */\nexport class ClientRuntime {\n /**\n * Build and cache the client-side dispatcher runtime.\n *\n * @since 2.0.0\n * @param layer - Optional Effect layer to provide to the runtime.\n */\n static make<R = never>(layer?: Layer.Layer<R>): void {\n InternalDispatcher.make(layer);\n }\n}\n\n/**\n * Server-side runtime singleton export. In SvelteKit server files the Vite\n * plugin rewrites root imports to `svelte-effect-runtime/server`, so this\n * name resolves to the real server implementation before it is evaluated.\n *\n * @example\n * ```ts\n * import { ServerRuntime } from \"svelte-effect-runtime\";\n *\n * ServerRuntime.make();\n * ```\n *\n * @since 2.0.0\n */\nexport const ServerRuntime: ServerRuntimeFactory = make_server_only_class(\n \"ServerRuntime\",\n) as never;\n\n/**\n * Remote query factory export for `.remote.ts` files imported from the root\n * entrypoint. The Vite plugin rewrites it to the real server implementation.\n *\n * @example\n * ```ts\n * import { Query } from \"svelte-effect-runtime\";\n *\n * export const GetPosts = Query(Effect.succeed([]));\n * ```\n *\n * @since 2.0.0\n */\nexport const Query: QueryFactory = Object.assign(\n make_server_only_function(\"Query\"),\n {\n batch: make_server_only_function(\"Query.batch\"),\n live: make_server_only_function(\"Query.live\"),\n },\n) as never;\n\n/**\n * Remote command factory export for `.remote.ts` files imported from the root\n * entrypoint. The Vite plugin rewrites it to the real server implementation.\n *\n * @example\n * ```ts\n * import { Command } from \"svelte-effect-runtime\";\n *\n * export const SavePost = Command(Schema.String, (id) => Effect.succeed(id));\n * ```\n *\n * @since 2.0.0\n */\nexport const Command: CommandFactory = make_server_only_function(\n \"Command\",\n) as never;\n\n/**\n * SvelteKit HTTP error control-flow export for `.remote.ts` files imported\n * from the root entrypoint. The Vite plugin rewrites it to the real server\n * implementation.\n *\n * @example\n * ```ts\n * import { Error } from \"svelte-effect-runtime\";\n *\n * return yield* Error(\"NotFound\", \"Post not found\");\n * ```\n *\n * @since 2.3.0\n */\nexport const Error: ErrorEffectFactory = make_server_only_function(\n \"Error\",\n) as never;\n\n/**\n * Remote form factory export for `.remote.ts` files imported from the root\n * entrypoint. The Vite plugin rewrites it to the real server implementation.\n *\n * @example\n * ```ts\n * import { Form } from \"svelte-effect-runtime\";\n *\n * export const CreatePost = Form(PostInput, ({ data }) => Effect.succeed(data));\n * ```\n *\n * @since 2.0.0\n */\nexport const Form: FormFactory = make_server_only_function(\n \"Form\",\n) as never;\n\n/**\n * Remote prerender factory export for `.remote.ts` files imported from the\n * root entrypoint. The Vite plugin rewrites it to the real server\n * implementation.\n *\n * @example\n * ```ts\n * import { Prerender } from \"svelte-effect-runtime\";\n *\n * export const GetBuildInfo = Prerender(() => Effect.succeed(\"ready\"));\n * ```\n *\n * @since 2.0.0\n */\nexport const Prerender: PrerenderFactory = make_server_only_function(\n \"Prerender\",\n) as never;\n\n/**\n * SvelteKit redirect control-flow export for `.remote.ts` files imported from\n * the root entrypoint. The Vite plugin rewrites it to the real server\n * implementation.\n *\n * @example\n * ```ts\n * import { Redirect } from \"svelte-effect-runtime\";\n *\n * return yield* Redirect(\"SeeOther\", \"/posts\");\n * ```\n *\n * @since 2.3.0\n */\nexport const Redirect: RedirectEffectFactory = make_server_only_function(\n \"Redirect\",\n) as never;\n\n/**\n * Current SvelteKit request event service export for `.remote.ts` files\n * imported from the root entrypoint. The Vite plugin rewrites it to the real\n * server implementation.\n *\n * @example\n * ```ts\n * import { RequestEvent } from \"svelte-effect-runtime\";\n *\n * const event = yield* RequestEvent;\n * ```\n *\n * @since 2.0.0\n */\nexport const RequestEvent: Context.Reference<RequestEventShape> =\n make_server_only_function(\"RequestEvent\") as never;\n\n/**\n * Returns the active server runtime when imported from a server file. The Vite\n * plugin rewrites root imports to the real server implementation.\n *\n * @example\n * ```ts\n * import { get_server_runtime_or_throw } from \"svelte-effect-runtime\";\n *\n * const runtime = get_server_runtime_or_throw();\n * ```\n *\n * @since 2.0.0\n */\nexport const get_server_runtime_or_throw: () => ManagedRuntime.ManagedRuntime<\n unknown,\n never\n> = make_server_only_function(\"get_server_runtime_or_throw\") as never;\n\n/** Re-export error types users need for typed catch handlers. */\nexport type {\n FormError,\n FormIssue,\n RemoteFailure,\n RemoteHttpError,\n RemoteTransportError,\n RemoteValidationError,\n} from \"$/remote/shared.ts\";\n\nexport {\n AsyncEffectInEventCallbackError,\n AsyncEffectInSyncRuneError,\n AwaitInEffectWorkError,\n BatchQueryHandlerMissingError,\n DispatcherDisposedError,\n InvalidCommandFactoryError,\n InvalidLiveQueryFactoryError,\n InvalidLiveQueryReturnError,\n InvalidQueryFactoryError,\n InvalidRemoteFormResponseError,\n PreprocessError,\n RemoteErrorDecodeError,\n RemoteFormEndpointMissingError,\n RemoteHelperContextError,\n RemoteHelperError,\n RequestEventUnavailableError,\n RuntimeError,\n ServerOnlyImportError,\n SvelteKitServerExportUnavailableError,\n UncheckedCommandHandlerMissingError,\n UncheckedFormHandlerMissingError,\n UncheckedLiveQueryHandlerMissingError,\n UncheckedPrerenderHandlerMissingError,\n UncheckedQueryHandlerMissingError,\n UnknownRuntimeError,\n UnsupportedMarkupEffectPositionError,\n UnsupportedRemoteFormResponseError,\n YieldStarInEventCallbackError,\n} from \"$/errors.ts\";\n\nexport {\n is_form_error,\n is_remote_http_error,\n is_remote_transport_error,\n is_remote_validation_error,\n} from \"$/remote/shared.ts\";\n\n/** Re-export app setup helpers so users can import them from root. */\nexport { effect, type EffectOptions } from \"$/vite.ts\";\n\n/** Re-export server helper types from the root entrypoint. */\nexport type {\n ErrorEffectFactory,\n ErrorStatus,\n ErrorStatusName,\n RedirectEffectFactory,\n RedirectStatus,\n RedirectStatusName,\n} from \"$/server/control-flow.ts\";\n\n/** Re-export server helper types from the root entrypoint. */\nexport type {\n CommandFactory,\n EffectLike,\n EffectRemoteBatchHandler,\n EffectRemoteCommand,\n EffectRemoteForm,\n EffectRemoteFunction,\n EffectRemoteLiveQuery,\n EffectRemoteLiveQueryFunction,\n EffectRemoteLiveQueryResource,\n EffectRemoteLiveSource,\n EffectRemoteQuery,\n EffectRemoteQueryFunction,\n FormFactory,\n FormInvalid,\n PrerenderFactory,\n PrerenderOptions,\n QueryBatchFactory,\n QueryFactory,\n QueryLiveFactory,\n RemoteFormHandler,\n RemoteHandler,\n RemoteLiveHandler,\n SchemaEncodedInput,\n SchemaInput,\n ServerRuntimeFactory,\n StandardSchema,\n StandardSchemaInput,\n StandardSchemaOutput,\n} from \"$/server/types.ts\";\n\nfunction make_server_only_class(name: string): unknown {\n return class ServerOnlyRuntime {\n static make(): never {\n throw make_server_only_error(name);\n }\n };\n}\n\nfunction make_server_only_function(\n name: string,\n): (...args: unknown[]) => never {\n return (..._args: unknown[]): never => {\n throw make_server_only_error(name);\n };\n}\n\nfunction make_server_only_error(name: string): globalThis.Error {\n return new ServerOnlyImportError(name);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,gBAAb,MAA2B;;;;;;;CAOzB,OAAO,KAAgB,OAA8B;EACnD,WAAmB,KAAK,KAAK;CAC/B;AACF;;;;;;;;;;;;;;;AAgBA,MAAa,gBAAsC,uBACjD,eACF;;;;;;;;;;;;;;AAeA,MAAa,QAAsB,OAAO,OACxC,0BAA0B,OAAO,GACjC;CACE,OAAO,0BAA0B,aAAa;CAC9C,MAAM,0BAA0B,YAAY;AAC9C,CACF;;;;;;;;;;;;;;AAeA,MAAa,UAA0B,0BACrC,SACF;;;;;;;;;;;;;;;AAgBA,MAAa,QAA4B,0BACvC,OACF;;;;;;;;;;;;;;AAeA,MAAa,OAAoB,0BAC/B,MACF;;;;;;;;;;;;;;;AAgBA,MAAa,YAA8B,0BACzC,WACF;;;;;;;;;;;;;;;AAgBA,MAAa,WAAkC,0BAC7C,UACF;;;;;;;;;;;;;;;AAgBA,MAAa,eACX,0BAA0B,cAAc;;;;;;;;;;;;;;AAe1C,MAAa,8BAGT,0BAA0B,6BAA6B;AA+F3D,SAAS,uBAAuB,MAAuB;CACrD,OAAO,MAAM,kBAAkB;EAC7B,OAAO,OAAc;GACnB,MAAM,uBAAuB,IAAI;EACnC;CACF;AACF;AAEA,SAAS,0BACP,MAC+B;CAC/B,QAAQ,GAAG,UAA4B;EACrC,MAAM,uBAAuB,IAAI;CACnC;AACF;AAEA,SAAS,uBAAuB,MAAgC;CAC9D,OAAO,IAAI,sBAAsB,IAAI;AACvC"}
1
+ {"version":3,"file":"mod.js","names":[],"sources":["../../modules/svelte-effect-runtime/src/mod.ts"],"sourcesContent":["import { Dispatcher as InternalDispatcher } from \"$/dispatcher.ts\";\nimport { ServerOnlyImportError } from \"$/errors.ts\";\nimport type {\n ErrorEffectFactory,\n RedirectEffectFactory,\n} from \"$/server/control-flow.ts\";\nimport type { RequestEvent as RequestEventShape } from \"$/server/runtime.ts\";\nimport type {\n CommandFactory,\n FormFactory,\n PrerenderFactory,\n QueryFactory,\n ServerRuntimeFactory,\n} from \"$/server/types.ts\";\nimport type { Context, Layer, ManagedRuntime } from \"effect\";\n\n/**\n * Public API surface for `svelte-effect-runtime`.\n *\n * Call {@link ClientRuntime.make} in `hooks.client.ts`, call\n * {@link ServerRuntime.make} in `hooks.server.ts`, and let the Vite plugin\n * route server-only helpers to the server entrypoint automatically.\n *\n * @module\n */\n\n/**\n * Client-side runtime singleton. Call `ClientRuntime.make(layer?)` once\n * in `hooks.client.ts` to provide services to every component's effect\n * blocks.\n *\n * If never called, a default empty-layer runtime is created lazily on\n * the first `yield*` expression.\n *\n * @example\n * ```ts\n * import { ClientRuntime } from \"svelte-effect-runtime\";\n * import { Db } from \"./db.ts\";\n *\n * ClientRuntime.make(Db.Live);\n * ```\n *\n * @since 2.0.0\n */\nexport class ClientRuntime {\n /**\n * Build and cache the client-side dispatcher runtime.\n *\n * @since 2.0.0\n * @param layer - Optional Effect layer to provide to the runtime.\n */\n static make<R = never>(layer?: Layer.Layer<R>): void {\n InternalDispatcher.make(layer);\n }\n}\n\n/**\n * Server-side runtime singleton export. In SvelteKit server files the Vite\n * plugin rewrites root imports to `svelte-effect-runtime/server`, so this\n * name resolves to the real server implementation before it is evaluated.\n *\n * @example\n * ```ts\n * import { ServerRuntime } from \"svelte-effect-runtime\";\n *\n * ServerRuntime.make();\n * ```\n *\n * @since 2.0.0\n */\nexport const ServerRuntime: ServerRuntimeFactory = make_server_only_class(\n \"ServerRuntime\",\n) as never;\n\n/**\n * Remote query factory export for `.remote.ts` files imported from the root\n * entrypoint. The Vite plugin rewrites it to the real server implementation.\n *\n * @example\n * ```ts\n * import { Query } from \"svelte-effect-runtime\";\n *\n * export const GetPosts = Query(Effect.succeed([]));\n * ```\n *\n * @since 2.0.0\n */\nexport const Query: QueryFactory = Object.assign(\n make_server_only_function(\"Query\"),\n {\n batch: make_server_only_function(\"Query.batch\"),\n live: make_server_only_function(\"Query.live\"),\n },\n) as never;\n\n/**\n * Remote command factory export for `.remote.ts` files imported from the root\n * entrypoint. The Vite plugin rewrites it to the real server implementation.\n *\n * @example\n * ```ts\n * import { Command } from \"svelte-effect-runtime\";\n *\n * export const SavePost = Command(Schema.String, (id) => Effect.succeed(id));\n * ```\n *\n * @since 2.0.0\n */\nexport const Command: CommandFactory = make_server_only_function(\n \"Command\",\n) as never;\n\n/**\n * SvelteKit HTTP error control-flow export for `.remote.ts` files imported\n * from the root entrypoint. The Vite plugin rewrites it to the real server\n * implementation.\n *\n * @example\n * ```ts\n * import { Error } from \"svelte-effect-runtime\";\n *\n * return yield* Error(\"NotFound\", \"Post not found\");\n * ```\n *\n * @since 2.3.0\n */\nexport const Error: ErrorEffectFactory = make_server_only_function(\n \"Error\",\n) as never;\n\n/**\n * Remote form factory export for `.remote.ts` files imported from the root\n * entrypoint. The Vite plugin rewrites it to the real server implementation.\n *\n * @example\n * ```ts\n * import { Form } from \"svelte-effect-runtime\";\n *\n * export const CreatePost = Form(PostInput, ({ data }) => Effect.succeed(data));\n * ```\n *\n * @since 2.0.0\n */\nexport const Form: FormFactory = make_server_only_function(\n \"Form\",\n) as never;\n\n/**\n * Remote prerender factory export for `.remote.ts` files imported from the\n * root entrypoint. The Vite plugin rewrites it to the real server\n * implementation.\n *\n * @example\n * ```ts\n * import { Prerender } from \"svelte-effect-runtime\";\n *\n * export const GetBuildInfo = Prerender(() => Effect.succeed(\"ready\"));\n * ```\n *\n * @since 2.0.0\n */\nexport const Prerender: PrerenderFactory = make_server_only_function(\n \"Prerender\",\n) as never;\n\n/**\n * SvelteKit redirect control-flow export for `.remote.ts` files imported from\n * the root entrypoint. The Vite plugin rewrites it to the real server\n * implementation.\n *\n * @example\n * ```ts\n * import { Redirect } from \"svelte-effect-runtime\";\n *\n * return yield* Redirect(\"SeeOther\", \"/posts\");\n * ```\n *\n * @since 2.3.0\n */\nexport const Redirect: RedirectEffectFactory = make_server_only_function(\n \"Redirect\",\n) as never;\n\n/**\n * Current SvelteKit request event service export for `.remote.ts` files\n * imported from the root entrypoint. The Vite plugin rewrites it to the real\n * server implementation.\n *\n * @example\n * ```ts\n * import { RequestEvent } from \"svelte-effect-runtime\";\n *\n * const event = yield* RequestEvent;\n * ```\n *\n * @since 2.0.0\n */\nexport const RequestEvent: Context.Reference<RequestEventShape> =\n make_server_only_function(\"RequestEvent\") as never;\n\n/**\n * Returns the active server runtime when imported from a server file. The Vite\n * plugin rewrites root imports to the real server implementation.\n *\n * @example\n * ```ts\n * import { get_server_runtime_or_throw } from \"svelte-effect-runtime\";\n *\n * const runtime = get_server_runtime_or_throw();\n * ```\n *\n * @since 2.0.0\n */\nexport const get_server_runtime_or_throw: () => ManagedRuntime.ManagedRuntime<\n unknown,\n never\n> = make_server_only_function(\"get_server_runtime_or_throw\") as never;\n\n/** Re-export error types users need for typed catch handlers. */\nexport type {\n FormError,\n FormIssue,\n RemoteFailure,\n RemoteHttpError,\n RemoteTransportError,\n RemoteValidationError,\n} from \"$/remote/shared.ts\";\n\nexport {\n TextMate,\n textmate,\n textmate_language,\n type TextMateCaptureMap,\n type TextMateGrammarBundle,\n type TextMateLanguageRegistration,\n type TextMateRawRule,\n type TextMateRepository,\n tree_sitter,\n TreesitterQuery,\n type TreeSitterQueryBundle,\n} from \"./grammars.ts\";\n\nexport {\n AsyncEffectInEventCallbackError,\n AsyncEffectInSyncRuneError,\n AwaitInEffectWorkError,\n BatchQueryHandlerMissingError,\n DispatcherDisposedError,\n InvalidCommandFactoryError,\n InvalidLiveQueryFactoryError,\n InvalidLiveQueryReturnError,\n InvalidQueryFactoryError,\n InvalidRemoteFormResponseError,\n PreprocessError,\n RemoteErrorDecodeError,\n RemoteFormEndpointMissingError,\n RemoteHelperContextError,\n RemoteHelperError,\n RequestEventUnavailableError,\n RuntimeError,\n ServerOnlyImportError,\n SvelteKitServerExportUnavailableError,\n UncheckedCommandHandlerMissingError,\n UncheckedFormHandlerMissingError,\n UncheckedLiveQueryHandlerMissingError,\n UncheckedPrerenderHandlerMissingError,\n UncheckedQueryHandlerMissingError,\n UnknownRuntimeError,\n UnsupportedMarkupEffectPositionError,\n UnsupportedRemoteFormResponseError,\n YieldStarInEventCallbackError,\n} from \"$/errors.ts\";\n\nexport {\n is_form_error,\n is_remote_http_error,\n is_remote_transport_error,\n is_remote_validation_error,\n} from \"$/remote/shared.ts\";\n\n/** Re-export app setup helpers so users can import them from root. */\nexport { effect, type EffectOptions } from \"$/vite.ts\";\n\n/** Re-export server helper types from the root entrypoint. */\nexport type {\n ErrorEffectFactory,\n ErrorStatus,\n ErrorStatusName,\n RedirectEffectFactory,\n RedirectStatus,\n RedirectStatusName,\n} from \"$/server/control-flow.ts\";\n\n/** Re-export server helper types from the root entrypoint. */\nexport type {\n CommandFactory,\n EffectLike,\n EffectRemoteBatchHandler,\n EffectRemoteCommand,\n EffectRemoteForm,\n EffectRemoteFunction,\n EffectRemoteLiveQuery,\n EffectRemoteLiveQueryFunction,\n EffectRemoteLiveQueryResource,\n EffectRemoteLiveSource,\n EffectRemoteQuery,\n EffectRemoteQueryFunction,\n FormFactory,\n FormInvalid,\n PrerenderFactory,\n PrerenderOptions,\n QueryBatchFactory,\n QueryFactory,\n QueryLiveFactory,\n RemoteFormHandler,\n RemoteHandler,\n RemoteLiveHandler,\n SchemaEncodedInput,\n SchemaInput,\n ServerRuntimeFactory,\n StandardSchema,\n StandardSchemaInput,\n StandardSchemaOutput,\n} from \"$/server/types.ts\";\n\nfunction make_server_only_class(name: string): unknown {\n return class ServerOnlyRuntime {\n static make(): never {\n throw make_server_only_error(name);\n }\n };\n}\n\nfunction make_server_only_function(\n name: string,\n): (...args: unknown[]) => never {\n return (..._args: unknown[]): never => {\n throw make_server_only_error(name);\n };\n}\n\nfunction make_server_only_error(name: string): globalThis.Error {\n return new ServerOnlyImportError(name);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,gBAAb,MAA2B;;;;;;;CAOzB,OAAO,KAAgB,OAA8B;EACnD,WAAmB,KAAK,KAAK;CAC/B;AACF;;;;;;;;;;;;;;;AAgBA,MAAa,gBAAsC,uBACjD,eACF;;;;;;;;;;;;;;AAeA,MAAa,QAAsB,OAAO,OACxC,0BAA0B,OAAO,GACjC;CACE,OAAO,0BAA0B,aAAa;CAC9C,MAAM,0BAA0B,YAAY;AAC9C,CACF;;;;;;;;;;;;;;AAeA,MAAa,UAA0B,0BACrC,SACF;;;;;;;;;;;;;;;AAgBA,MAAa,QAA4B,0BACvC,OACF;;;;;;;;;;;;;;AAeA,MAAa,OAAoB,0BAC/B,MACF;;;;;;;;;;;;;;;AAgBA,MAAa,YAA8B,0BACzC,WACF;;;;;;;;;;;;;;;AAgBA,MAAa,WAAkC,0BAC7C,UACF;;;;;;;;;;;;;;;AAgBA,MAAa,eACX,0BAA0B,cAAc;;;;;;;;;;;;;;AAe1C,MAAa,8BAGT,0BAA0B,6BAA6B;AA6G3D,SAAS,uBAAuB,MAAuB;CACrD,OAAO,MAAM,kBAAkB;EAC7B,OAAO,OAAc;GACnB,MAAM,uBAAuB,IAAI;EACnC;CACF;AACF;AAEA,SAAS,0BACP,MAC+B;CAC/B,QAAQ,GAAG,UAA4B;EACrC,MAAM,uBAAuB,IAAI;CACnC;AACF;AAEA,SAAS,uBAAuB,MAAgC;CAC9D,OAAO,IAAI,sBAAsB,IAAI;AACvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-effect-runtime",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Core module that houses the Vite plugin to enable effectful execution.",
5
5
  "license": "BSD-3-Clause",
6
6
  "type": "module",
@@ -23,6 +23,10 @@
23
23
  "types": "./.dist/mod.d.ts",
24
24
  "default": "./.dist/mod.js"
25
25
  },
26
+ "./grammars": {
27
+ "types": "./.dist/grammars.d.ts",
28
+ "default": "./.dist/grammars.js"
29
+ },
26
30
  "./server": {
27
31
  "types": "./.dist/server.d.ts",
28
32
  "default": "./.dist/server.js"