svelte-effect-runtime 1.6.1 → 1.6.2
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-zCli5qgO.js → effect-Crj3S8Cg.js} +3 -3
- package/dist/chunks/{effect-zCli5qgO.js.map → effect-Crj3S8Cg.js.map} +1 -1
- package/dist/chunks/{markup-D4zJP7U1.js → markup-CkPUZIJt.js} +16 -9
- package/dist/chunks/{markup-D4zJP7U1.js.map → markup-CkPUZIJt.js.map} +1 -1
- package/dist/chunks/{preprocess-DIC5iR0_.js → preprocess-BFePqOC6.js} +2 -2
- package/dist/chunks/{preprocess-DIC5iR0_.js.map → preprocess-BFePqOC6.js.map} +1 -1
- package/dist/chunks/{vite-Bm2RdiT3.js → vite-BlUTKv2u.js} +2 -2
- package/dist/chunks/{vite-Bm2RdiT3.js.map → vite-BlUTKv2u.js.map} +1 -1
- package/dist/effect.js +1 -1
- package/dist/internal/markup.js +1 -1
- package/dist/language-server.js +1 -1
- package/dist/preprocess.js +1 -1
- package/dist/root-node.js +1 -1
- package/dist/v4/effect.js +1 -1
- package/dist/v4/preprocess.js +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-BFePqOC6.js";
|
|
2
|
+
import { n as sveltekit_effect_runtime } from "./vite-BlUTKv2u.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-Crj3S8Cg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effect-
|
|
1
|
+
{"version":3,"file":"effect-Crj3S8Cg.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"}
|
|
@@ -12555,15 +12555,9 @@ const DEFAULT_EFFECT_MODULE_ID = "effect";
|
|
|
12555
12555
|
const DEFAULT_SVELTE_MODULE_ID = "svelte";
|
|
12556
12556
|
const MARKUP_HELPER_PREFIX = "__svelteEffectRuntimeMarkup";
|
|
12557
12557
|
function transformEffectMarkup(content, options) {
|
|
12558
|
+
if (!containsAnyYieldStarText(content)) return identityMarkupResult(content, options.filename);
|
|
12558
12559
|
const sanitized = sanitizeEffectMarkup(content, options.filename);
|
|
12559
|
-
if (sanitized.candidates.length === 0) return
|
|
12560
|
-
code: content,
|
|
12561
|
-
map: new MagicString(content).generateMap({
|
|
12562
|
-
hires: true,
|
|
12563
|
-
includeContent: true,
|
|
12564
|
-
source: options.filename
|
|
12565
|
-
})
|
|
12566
|
-
};
|
|
12560
|
+
if (sanitized.candidates.length === 0) return identityMarkupResult(content, options.filename);
|
|
12567
12561
|
const replacements = collectMarkupReplacements(createParseSafeMarkupSource(sanitized.code), sanitized.candidates, options.filename);
|
|
12568
12562
|
const magicString = new MagicString(content);
|
|
12569
12563
|
for (const replacement of replacements) magicString.overwrite(replacement.start, replacement.end, replacement.text);
|
|
@@ -12577,6 +12571,19 @@ function transformEffectMarkup(content, options) {
|
|
|
12577
12571
|
})
|
|
12578
12572
|
};
|
|
12579
12573
|
}
|
|
12574
|
+
function containsAnyYieldStarText(content) {
|
|
12575
|
+
return /\byield\s*\*/.test(content);
|
|
12576
|
+
}
|
|
12577
|
+
function identityMarkupResult(content, filename) {
|
|
12578
|
+
return {
|
|
12579
|
+
code: content,
|
|
12580
|
+
map: new MagicString(content).generateMap({
|
|
12581
|
+
hires: true,
|
|
12582
|
+
includeContent: true,
|
|
12583
|
+
source: filename
|
|
12584
|
+
})
|
|
12585
|
+
};
|
|
12586
|
+
}
|
|
12580
12587
|
function createParseSafeMarkupSource(content) {
|
|
12581
12588
|
const excludedRanges = findParseSafeMaskRanges(content);
|
|
12582
12589
|
if (excludedRanges.length === 0) return content;
|
|
@@ -13380,4 +13387,4 @@ function indentBlock(text, indent) {
|
|
|
13380
13387
|
//#endregion
|
|
13381
13388
|
export { transformEffectMarkup as t };
|
|
13382
13389
|
|
|
13383
|
-
//# sourceMappingURL=markup-
|
|
13390
|
+
//# sourceMappingURL=markup-CkPUZIJt.js.map
|