svelte-effect-runtime 1.5.0 → 1.6.1
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/dist/chunks/{effect-Cx8OzrcW.js → effect-zCli5qgO.js} +3 -3
- package/dist/chunks/{effect-Cx8OzrcW.js.map → effect-zCli5qgO.js.map} +1 -1
- package/dist/chunks/{markup-BMn2sQOB.js → markup-D4zJP7U1.js} +30 -3
- package/dist/chunks/{markup-BMn2sQOB.js.map → markup-D4zJP7U1.js.map} +1 -1
- package/dist/chunks/{preprocess-CGKEA3Py.js → preprocess-DIC5iR0_.js} +2 -2
- package/dist/chunks/{preprocess-CGKEA3Py.js.map → preprocess-DIC5iR0_.js.map} +1 -1
- package/dist/chunks/server-Dea1CJuY.js.map +1 -1
- package/dist/chunks/{vite-C8ujN78r.js → vite-Bm2RdiT3.js} +2 -2
- package/dist/chunks/{vite-C8ujN78r.js.map → vite-Bm2RdiT3.js.map} +1 -1
- package/dist/effect.js +1 -1
- package/dist/internal/markup.js +1 -1
- package/dist/internal/remote-client.js +32 -2
- package/dist/internal/remote-client.js.map +1 -1
- package/dist/language-server.js +1 -1
- package/dist/preprocess.js +1 -1
- package/dist/root-node.js +1 -1
- package/dist/v3/server.d.ts +29 -5
- package/dist/v4/effect.js +1 -1
- package/dist/v4/preprocess.js +1 -1
- package/dist/v4/server.d.ts +24 -4
- package/dist/v4/server.js.map +1 -1
- package/dist/v4/vite.js +1 -1
- package/dist/vite.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as effect_preprocess } from "./preprocess-
|
|
2
|
-
import { n as sveltekit_effect_runtime } from "./vite-
|
|
1
|
+
import { t as effect_preprocess } from "./preprocess-DIC5iR0_.js";
|
|
2
|
+
import { n as sveltekit_effect_runtime } from "./vite-Bm2RdiT3.js";
|
|
3
3
|
import { preprocess } from "svelte/compiler";
|
|
4
4
|
//#region v3/effect.ts
|
|
5
5
|
/**
|
|
@@ -48,4 +48,4 @@ function effect(options = {}) {
|
|
|
48
48
|
//#endregion
|
|
49
49
|
export { effect as t };
|
|
50
50
|
|
|
51
|
-
//# sourceMappingURL=effect-
|
|
51
|
+
//# sourceMappingURL=effect-zCli5qgO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effect-
|
|
1
|
+
{"version":3,"file":"effect-zCli5qgO.js","names":[],"sources":["../../../modules/svelte-effect-runtime/v3/effect.ts"],"sourcesContent":["/**\n * High-level Vite integration for `svelte-effect-runtime`.\n *\n * @example\n * ```ts\n * import { effect } from \"svelte-effect-runtime\";\n *\n * export default {\n * plugins: [effect()],\n * };\n * ```\n *\n * @module\n */\nimport { preprocess } from \"svelte/compiler\";\nimport type { Plugin, PluginOption } from \"vite\";\nimport {\n effect_preprocess,\n type EffectPreprocessOptions,\n} from \"$/v3/preprocess.ts\";\nimport { sveltekit_effect_runtime } from \"$/v3/vite.ts\";\n\n/** Options for the high-level {@link effect} Vite plugin. */\nexport interface EffectPluginOptions {\n effect?: EffectPreprocessOptions;\n remoteModuleId?: string;\n}\n\nfunction create_effect_svelte_transform(\n options: EffectPreprocessOptions = {},\n): Plugin {\n const preprocessor = effect_preprocess(options);\n\n return {\n name: \"svelte-effect-runtime-transform\",\n enforce: \"pre\",\n async transform(code, id, _options) {\n const filename = id.split(\"?\", 1)[0];\n if (!filename.endsWith(\".svelte\")) {\n return null;\n }\n\n const transformed = await preprocess(code, preprocessor, { filename });\n if (transformed.code === code) {\n return null;\n }\n\n return {\n code: transformed.code,\n ...(transformed.map ? { map: transformed.map as never } : {}),\n };\n },\n };\n}\n\n/**\n * Convenience Vite plugin that enables `<script effect>` transforms and wires\n * SvelteKit remote functions to the Effect-aware client adapters.\n *\n * Use this in `vite.config.ts` instead of composing lower-level runtime\n * plugins yourself.\n *\n * @see https://ser.barekey.dev/\n */\nexport function effect(\n options: EffectPluginOptions = {},\n): PluginOption[] {\n const transform_plugin = create_effect_svelte_transform(options.effect);\n\n return [\n transform_plugin,\n sveltekit_effect_runtime({\n remoteModuleId: options.remoteModuleId,\n }),\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,SAAS,+BACP,UAAmC,EAAE,EAC7B;CACR,MAAM,eAAe,kBAAkB,QAAQ;AAE/C,QAAO;EACL,MAAM;EACN,SAAS;EACT,MAAM,UAAU,MAAM,IAAI,UAAU;GAClC,MAAM,WAAW,GAAG,MAAM,KAAK,EAAE,CAAC;AAClC,OAAI,CAAC,SAAS,SAAS,UAAU,CAC/B,QAAO;GAGT,MAAM,cAAc,MAAM,WAAW,MAAM,cAAc,EAAE,UAAU,CAAC;AACtE,OAAI,YAAY,SAAS,KACvB,QAAO;AAGT,UAAO;IACL,MAAM,YAAY;IAClB,GAAI,YAAY,MAAM,EAAE,KAAK,YAAY,KAAc,GAAG,EAAE;IAC7D;;EAEJ;;;;;;;;;;;AAYH,SAAgB,OACd,UAA+B,EAAE,EACjB;AAGhB,QAAO,CAFkB,+BAA+B,QAAQ,OAAO,EAIrE,yBAAyB,EACvB,gBAAgB,QAAQ,gBACzB,CAAC,CACH"}
|
|
@@ -12643,7 +12643,7 @@ function getCandidateForBraceTag(openBraceIndex, closeBraceIndex, inner, filenam
|
|
|
12643
12643
|
const leadingWhitespaceLength = inner.length - trimmed.length;
|
|
12644
12644
|
const tag = getBraceTagInfo(trimmed);
|
|
12645
12645
|
if (trimmed.includes(MARKUP_HELPER_PREFIX)) return;
|
|
12646
|
-
if (!containsYieldStarText(trimmed)) return;
|
|
12646
|
+
if (!containsYieldStarText(trimmed.slice(tag.prefixLength))) return;
|
|
12647
12647
|
if (tag.kind === "const") {
|
|
12648
12648
|
const initializerRange = findConstInitializerRange(trimmed.slice(tag.prefixLength), filename);
|
|
12649
12649
|
return initializerRange ? makeMarkupCandidate(openBraceIndex + 1 + leadingWhitespaceLength + tag.prefixLength + initializerRange.start, openBraceIndex + 1 + leadingWhitespaceLength + tag.prefixLength + initializerRange.end, trimmed.slice(tag.prefixLength + initializerRange.start, tag.prefixLength + initializerRange.end), helperIndex) : void 0;
|
|
@@ -12930,7 +12930,34 @@ function shouldSkipIdentifier(node) {
|
|
|
12930
12930
|
return ts.isPropertyAccessExpression(parent) && parent.name === node || ts.isPropertyAssignment(parent) && parent.name === node || ts.isShorthandPropertyAssignment(parent) && parent.objectAssignmentInitializer === node || ts.isBindingElement(parent) && parent.propertyName === node || ts.isImportSpecifier(parent) || ts.isExportSpecifier(parent) || ts.isLabeledStatement(parent) && parent.label === node;
|
|
12931
12931
|
}
|
|
12932
12932
|
function containsYieldStarText(text) {
|
|
12933
|
-
|
|
12933
|
+
if (!/\byield\s*\*/.test(text)) return false;
|
|
12934
|
+
try {
|
|
12935
|
+
return topLevelYieldStarPresent(text);
|
|
12936
|
+
} catch {
|
|
12937
|
+
return true;
|
|
12938
|
+
}
|
|
12939
|
+
}
|
|
12940
|
+
function topLevelYieldStarPresent(text) {
|
|
12941
|
+
return hasTopLevelYieldStar((0, import_lib.parseExpression)(text, {
|
|
12942
|
+
sourceType: "module",
|
|
12943
|
+
allowAwaitOutsideFunction: true,
|
|
12944
|
+
allowYieldOutsideFunction: true
|
|
12945
|
+
}));
|
|
12946
|
+
}
|
|
12947
|
+
function hasTopLevelYieldStar(node) {
|
|
12948
|
+
if (!node || typeof node !== "object" || typeof node.type !== "string") return false;
|
|
12949
|
+
if (node.type === "YieldExpression" && node.delegate === true) return true;
|
|
12950
|
+
if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" || node.type === "ObjectMethod" || node.type === "ClassMethod" || node.type === "ClassPrivateMethod") return false;
|
|
12951
|
+
for (const key of Object.keys(node)) {
|
|
12952
|
+
if (key === "type" || key === "loc" || key === "start" || key === "end") continue;
|
|
12953
|
+
const value = node[key];
|
|
12954
|
+
if (Array.isArray(value)) {
|
|
12955
|
+
for (const item of value) if (hasTopLevelYieldStar(item)) return true;
|
|
12956
|
+
} else if (value && typeof value === "object") {
|
|
12957
|
+
if (hasTopLevelYieldStar(value)) return true;
|
|
12958
|
+
}
|
|
12959
|
+
}
|
|
12960
|
+
return false;
|
|
12934
12961
|
}
|
|
12935
12962
|
function findMarkupBraceClose(content, openBraceIndex, filename) {
|
|
12936
12963
|
const expressionClose = findExpressionBraceCloseWithBabel(content, openBraceIndex, filename);
|
|
@@ -13353,4 +13380,4 @@ function indentBlock(text, indent) {
|
|
|
13353
13380
|
//#endregion
|
|
13354
13381
|
export { transformEffectMarkup as t };
|
|
13355
13382
|
|
|
13356
|
-
//# sourceMappingURL=markup-
|
|
13383
|
+
//# sourceMappingURL=markup-D4zJP7U1.js.map
|