@stacksjs/stx 0.2.140 → 0.2.141
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/cli.js +685 -685
- package/dist/client-script-bundler.d.ts +1 -0
- package/dist/client-script-bundler.js +16 -8
- package/dist/client-script.js +2 -2
- package/dist/craft.js +313 -313
- package/dist/lazy-module.d.ts +1 -0
- package/dist/lazy-module.js +18 -0
- package/dist/process.js +24 -23
- package/dist/pwa.js +289 -289
- package/dist/signal-processing.js +3 -4
- package/dist/ssg.js +366 -366
- package/dist/utils.js +6 -5
- package/package.json +5 -5
|
@@ -5,6 +5,7 @@ import { transformStoreImports } from "./store-imports.js";
|
|
|
5
5
|
import { shouldTranspileTypeScript, transpileTypeScript } from "./utils.js";
|
|
6
6
|
import { injectSignalsRuntime, injectBrowserRuntime } from "./runtime-injection.js";
|
|
7
7
|
import { matchScriptElement, scanAtElementPosition } from "./html-masking.js";
|
|
8
|
+
import { importOnce } from "./lazy-module.js";
|
|
8
9
|
let signalSetupCounter = 0;
|
|
9
10
|
const TAG_ATTR_RUN = `(?:"[^"]*"|'[^']*'|[^>"'])*`, SINGLE_ELEMENT_RE = /^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;
|
|
10
11
|
export function scanScriptTags(html, opts = {}) {
|
|
@@ -668,16 +669,14 @@ export async function processScriptSetup(template, filePath, serverData) {
|
|
|
668
669
|
}
|
|
669
670
|
if (signalScripts.length === 0)
|
|
670
671
|
return { output: template, setupCode: null };
|
|
671
|
-
const setupFnName = `__stx_setup_${Date.now()}_${signalSetupCounter++}`, { hasUserImports, bundleClientScript } = await import("./client-script-bundler.js"), resolvedParts = [];
|
|
672
|
+
const setupFnName = `__stx_setup_${Date.now()}_${signalSetupCounter++}`, { hasUserImports, bundleClientScript } = await importOnce("stx/client-script-bundler", () => import("./client-script-bundler.js")), resolvedParts = [];
|
|
672
673
|
for (let i = 0;i < signalScripts.length; i++) {
|
|
673
674
|
let scriptContent = signalScripts[i].content;
|
|
674
675
|
scriptContent = injectBrowserCoreAutoImports(scriptContent).code;
|
|
675
|
-
if (hasUserImports(scriptContent))
|
|
676
|
-
console.log("[stx:bundler] bundling signal script imports");
|
|
676
|
+
if (hasUserImports(scriptContent))
|
|
677
677
|
scriptContent = await bundleClientScript(scriptContent, filePath || "", {
|
|
678
678
|
projectRoot: process.cwd()
|
|
679
679
|
});
|
|
680
|
-
}
|
|
681
680
|
scriptContent = scriptContent.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm, (_match, specifiers) => rewriteStxImportSpecifiers(specifiers));
|
|
682
681
|
const resolved = transformStoreImports(scriptContent);
|
|
683
682
|
resolvedParts.push(`// \u2500\u2500 merged signal script #${i + 1} \u2500\u2500
|