@stacksjs/stx 0.2.113 → 0.2.115
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/app-shell.d.ts +1 -1
- package/dist/app-shell.js +7 -1
- package/dist/caching.js +2 -1
- package/dist/cli.js +1437 -956
- package/dist/client-script-bundler.js +33 -16
- package/dist/client-script.js +50 -5
- package/dist/component-renderer.js +56 -13
- package/dist/composable-loader.d.ts +15 -0
- package/dist/composable-loader.js +117 -0
- package/dist/desktop.d.ts +15 -0
- package/dist/desktop.js +1 -0
- package/dist/dev-server/serve-app.js +1 -1
- package/dist/expressions.js +9 -2
- package/dist/includes.js +6 -4
- package/dist/menubar.d.ts +63 -0
- package/dist/menubar.js +103 -0
- package/dist/plugin.js +4 -3
- package/dist/process.js +83 -23
- package/dist/pwa.js +7359 -6878
- package/dist/render.js +4 -24
- package/dist/runtime-globals.d.ts +59 -0
- package/dist/runtime-globals.js +65 -0
- package/dist/runtime-injection.js +2 -2
- package/dist/serve.js +4 -21
- package/dist/sfc-template.d.ts +17 -0
- package/dist/sfc-template.js +32 -0
- package/dist/signal-processing.js +27 -12
- package/dist/signals.js +558 -128
- package/dist/slots.js +105 -20
- package/dist/ssg.js +7381 -6900
- package/dist/stx.d.ts +8 -0
- package/dist/testing.js +8 -1
- package/dist/types/config-types.d.ts +2 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.js +66 -19
- package/dist/variable-extractor.js +3 -3
- package/package.json +5 -7
- package/stx.d.ts +8 -0
package/dist/app-shell.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export declare function stripDocumentWrapper(html: string, options?: { preserveH
|
|
|
49
49
|
export declare function isSpaNavigation(request: Request): boolean;
|
|
50
50
|
/**
|
|
51
51
|
* Extract the inner content of the router container element from a full HTML
|
|
52
|
-
* document, preserving
|
|
52
|
+
* document, preserving page styles and route state found in `<head>`.
|
|
53
53
|
*
|
|
54
54
|
* This is what fragment files should contain — NOT the whole body. The SPA
|
|
55
55
|
* router injects fragments directly into the container element via innerHTML,
|
package/dist/app-shell.js
CHANGED
|
@@ -161,12 +161,15 @@ export function isSpaNavigation(request) {
|
|
|
161
161
|
return request.headers.get("X-STX-Router") === "true";
|
|
162
162
|
}
|
|
163
163
|
export function extractContainerContent(html, containerSelector = "main") {
|
|
164
|
-
const trimmed = html.trim(), headStyles = [], headMatch = trimmed.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);
|
|
164
|
+
const trimmed = html.trim(), headStyles = [], headScripts = [], headMatch = trimmed.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);
|
|
165
165
|
if (headMatch) {
|
|
166
166
|
const headContent = headMatch[1], styleRegex = /<style\b[^>]*>[\s\S]*?<\/style>/gi;
|
|
167
167
|
let m;
|
|
168
168
|
while ((m = styleRegex.exec(headContent)) !== null)
|
|
169
169
|
headStyles.push(m[0]);
|
|
170
|
+
const routeParamsRegex = /<script\b[^>]*data-stx-route-params[^>]*>[\s\S]*?<\/script>/gi;
|
|
171
|
+
while ((m = routeParamsRegex.exec(headContent)) !== null)
|
|
172
|
+
headScripts.push(m[0]);
|
|
170
173
|
}
|
|
171
174
|
const tag = containerSelector.replace(/^[.#]/, "").toLowerCase(), openRe = new RegExp(`<${tag}\\b[^>]*>`, "i"), openMatch = trimmed.match(openRe);
|
|
172
175
|
if (!openMatch || openMatch.index === void 0)
|
|
@@ -210,6 +213,9 @@ export function extractContainerContent(html, containerSelector = "main") {
|
|
|
210
213
|
const parts = [];
|
|
211
214
|
if (headStyles.length > 0)
|
|
212
215
|
parts.push(headStyles.join(`
|
|
216
|
+
`));
|
|
217
|
+
if (headScripts.length > 0)
|
|
218
|
+
parts.push(headScripts.join(`
|
|
213
219
|
`));
|
|
214
220
|
if (bodyScripts.length > 0)
|
|
215
221
|
parts.push(bodyScripts.join(`
|
package/dist/caching.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { fileExists } from "./utils.js";
|
|
3
|
+
import { clearComponentCache, fileExists } from "./utils.js";
|
|
4
4
|
export const templateCache = new Map;
|
|
5
5
|
const fileContentCache = new Map;
|
|
6
6
|
export async function readFileCached(filePath) {
|
|
@@ -53,6 +53,7 @@ export async function getCachedRouterScript() {
|
|
|
53
53
|
}
|
|
54
54
|
export function clearDevCaches() {
|
|
55
55
|
fileContentCache.clear();
|
|
56
|
+
clearComponentCache();
|
|
56
57
|
_cachedSignalsRuntime = null;
|
|
57
58
|
_cachedSignalsRuntimeDev = null;
|
|
58
59
|
_cachedRouterScript = null;
|