@stacksjs/stx 0.2.838 → 0.2.840
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/builtins/image-delivery.js +7 -3
- package/dist/chunk-02cntwd8.js +2 -0
- package/dist/chunk-03v59965.js +2 -0
- package/dist/chunk-07hvjvj1.js +2 -0
- package/dist/{chunk-gh62p9mx.js → chunk-11y84h2d.js} +2 -2
- package/dist/{chunk-3bjnrmha.js → chunk-1b1ntgt7.js} +2 -2
- package/dist/{chunk-z25w7kmr.js → chunk-1m16mvt4.js} +4 -4
- package/dist/{chunk-4ntm3dtk.js → chunk-23r3rby6.js} +2 -2
- package/dist/{chunk-ya6bp08c.js → chunk-2fj5zev7.js} +1 -1
- package/dist/{chunk-29f6vmyz.js → chunk-2j5yane9.js} +4 -4
- package/dist/chunk-2knr61g3.js +2 -0
- package/dist/chunk-2pgc087j.js +2 -0
- package/dist/chunk-2vprq4x0.js +54 -0
- package/dist/{chunk-ac9ncbfw.js → chunk-321e41ck.js} +3 -3
- package/dist/chunk-3gzhh69y.js +2 -0
- package/dist/chunk-40bkdswh.js +2 -0
- package/dist/chunk-41sh9y5w.js +2 -0
- package/dist/chunk-4654xm1h.js +2 -0
- package/dist/{chunk-amg6kr1p.js → chunk-4657mnht.js} +4 -4
- package/dist/{chunk-s33andzg.js → chunk-4dxq7ft1.js} +2 -2
- package/dist/chunk-4eagsz5d.js +2 -0
- package/dist/{chunk-f7jgda7x.js → chunk-4j08cbjd.js} +5 -5
- package/dist/chunk-4rswqcfc.js +2 -0
- package/dist/{chunk-tx8wk6h7.js → chunk-4y6hes3h.js} +2 -2
- package/dist/{chunk-6s3hgq9z.js → chunk-57x8wxdf.js} +32 -32
- package/dist/chunk-5khpy4na.js +2 -0
- package/dist/{chunk-5w0cf32p.js → chunk-5pbxjx8s.js} +1 -1
- package/dist/chunk-5t93dqft.js +2 -0
- package/dist/chunk-66eba1h4.js +2 -0
- package/dist/chunk-6efz68j8.js +2 -0
- package/dist/chunk-6n5kew7a.js +3 -0
- package/dist/chunk-6nb07mdj.js +2 -0
- package/dist/{chunk-2x9zhezb.js → chunk-6wrf6302.js} +2 -2
- package/dist/{chunk-1zxahmnh.js → chunk-7cg2f588.js} +1 -1
- package/dist/{chunk-nm26vnzd.js → chunk-7dnp8evg.js} +6 -6
- package/dist/chunk-7m0r7mq9.js +2 -0
- package/dist/{chunk-jstrmqna.js → chunk-7m53tpxn.js} +2 -2
- package/dist/{chunk-ckg6q98b.js → chunk-7t57cnz9.js} +5 -5
- package/dist/{chunk-jr0r5pzw.js → chunk-7vhm0jj5.js} +2 -2
- package/dist/{chunk-mvehmtap.js → chunk-7y5gz0cs.js} +14 -14
- package/dist/{chunk-vfj9wp11.js → chunk-8370x30n.js} +2 -2
- package/dist/{chunk-65tptp4x.js → chunk-88rwr1w2.js} +2 -2
- package/dist/{chunk-txd2js5v.js → chunk-89d3h8mp.js} +14 -14
- package/dist/chunk-8c363c2r.js +2 -0
- package/dist/{chunk-wfsa28e7.js → chunk-8d4br2j5.js} +9 -9
- package/dist/chunk-8gdtys3s.js +2 -0
- package/dist/{chunk-em8tv6nz.js → chunk-8pj4v1eh.js} +2 -2
- package/dist/{chunk-z0ynyz62.js → chunk-8qbp5skx.js} +7 -7
- package/dist/chunk-8w0n2rae.js +2 -0
- package/dist/{chunk-c3dg8qdn.js → chunk-97k72dfh.js} +2 -2
- package/dist/{chunk-d689fbv1.js → chunk-9razzga7.js} +6 -6
- package/dist/{chunk-s53wjw7y.js → chunk-9xps62ek.js} +2 -2
- package/dist/{chunk-52g026sc.js → chunk-a1s5wqw4.js} +2 -2
- package/dist/chunk-a2p42cxf.js +2 -0
- package/dist/{chunk-myje6fhm.js → chunk-a9tzjqny.js} +5 -5
- package/dist/{chunk-ax624h16.js → chunk-azderqyk.js} +7 -7
- package/dist/chunk-b0fkvrat.js +2 -0
- package/dist/chunk-b3fx75th.js +2 -0
- package/dist/{chunk-20mmryy5.js → chunk-b685aqy4.js} +3 -3
- package/dist/chunk-b6w3457c.js +2 -0
- package/dist/{chunk-j59js1nh.js → chunk-b90xw7v4.js} +3 -3
- package/dist/{chunk-fvgk1w9s.js → chunk-bp918end.js} +2 -2
- package/dist/chunk-bq7qcndg.js +3 -0
- package/dist/chunk-c18pafmf.js +3 -0
- package/dist/chunk-c87zgwzn.js +2 -0
- package/dist/{chunk-c9vxm8yq.js → chunk-ca3c5qx2.js} +31 -31
- package/dist/{chunk-3yggtch5.js → chunk-chjdnmqv.js} +10 -10
- package/dist/{chunk-bky02g7k.js → chunk-d0dzzpfx.js} +2 -2
- package/dist/chunk-d44g9sek.js +2 -0
- package/dist/chunk-d5vr9g4b.js +2 -0
- package/dist/{chunk-yw1s8kyj.js → chunk-dgn87554.js} +4 -4
- package/dist/{chunk-fzdgevxr.js → chunk-ebxz30e5.js} +56 -56
- package/dist/{chunk-11fn3hgv.js → chunk-ecjx9z8a.js} +2 -2
- package/dist/{chunk-33czswpt.js → chunk-f1hkagxk.js} +3 -3
- package/dist/chunk-fpn5txnm.js +2 -0
- package/dist/chunk-g6r2313a.js +2 -0
- package/dist/{chunk-55e46spy.js → chunk-g7rsd8st.js} +5 -5
- package/dist/chunk-g957a2m3.js +2 -0
- package/dist/chunk-ga8waz0a.js +2 -0
- package/dist/chunk-gaxx0z19.js +2 -0
- package/dist/chunk-gbcwna5q.js +2 -0
- package/dist/chunk-gft9pg9n.js +2 -0
- package/dist/chunk-h8h79939.js +2 -0
- package/dist/{chunk-q5pwvr98.js → chunk-jc5y35b7.js} +1 -1
- package/dist/chunk-jgx0ex9p.js +3 -0
- package/dist/{chunk-vfxkn1pe.js → chunk-kd6r7z27.js} +3 -3
- package/dist/chunk-ksc83y9t.js +2 -0
- package/dist/{chunk-gw83680k.js → chunk-kvpzxnww.js} +5 -5
- package/dist/{chunk-rnm8ejpz.js → chunk-m5bj2jnb.js} +2 -2
- package/dist/{chunk-ckasfph2.js → chunk-m7acbayx.js} +5 -5
- package/dist/chunk-mh4kpnjr.js +2 -0
- package/dist/{chunk-b7tb00nz.js → chunk-mhyd24bg.js} +2 -2
- package/dist/chunk-n7pvz99f.js +2 -0
- package/dist/chunk-ndah5rvs.js +2 -0
- package/dist/{chunk-n4qznmkm.js → chunk-ngnr831a.js} +5 -5
- package/dist/chunk-nhk0aat9.js +2 -0
- package/dist/{chunk-t2vmk8tf.js → chunk-ns0171xk.js} +3 -3
- package/dist/chunk-p2e02hh7.js +2 -0
- package/dist/{chunk-cwfavkk0.js → chunk-p65ax8s0.js} +2 -2
- package/dist/{chunk-dv11h4f0.js → chunk-p9d2txcg.js} +1 -1
- package/dist/chunk-pjkdn8zf.js +2 -0
- package/dist/{chunk-pft65534.js → chunk-pqn7r8fw.js} +1 -1
- package/dist/{chunk-29bt1fbn.js → chunk-px5kda00.js} +5 -5
- package/dist/{chunk-xtqapjz3.js → chunk-q0s0kc66.js} +2 -2
- package/dist/{chunk-b1m41fwr.js → chunk-q1nj47gn.js} +3 -3
- package/dist/chunk-q88w2rv9.js +2 -0
- package/dist/chunk-qb3c05qq.js +2 -0
- package/dist/chunk-qcars8ar.js +2 -0
- package/dist/{chunk-v3xyb3ws.js → chunk-qfvddpcg.js} +2 -2
- package/dist/{chunk-e75dntfb.js → chunk-qk079ca7.js} +2 -2
- package/dist/{chunk-zj4s3rnw.js → chunk-qzms4d8s.js} +5 -5
- package/dist/chunk-r5bhgyes.js +2 -0
- package/dist/{chunk-64eeb5p5.js → chunk-rb17ssxh.js} +2 -2
- package/dist/{chunk-7bvvv74e.js → chunk-rk2ex6qx.js} +3 -3
- package/dist/chunk-rmc6dfj4.js +2 -0
- package/dist/chunk-rzfbffnv.js +2 -0
- package/dist/{chunk-r32q8mjw.js → chunk-s2k1x2rn.js} +3 -3
- package/dist/chunk-spdh99jy.js +2 -0
- package/dist/chunk-st75663x.js +2 -0
- package/dist/chunk-sv2d6nfe.js +2 -0
- package/dist/{chunk-7k9yahng.js → chunk-t0jed809.js} +6 -6
- package/dist/{chunk-s5dhvnnd.js → chunk-t3p0jy0s.js} +6 -6
- package/dist/{chunk-f49x34sr.js → chunk-v3q126ys.js} +2 -2
- package/dist/{chunk-kw5gra2z.js → chunk-v4ybemgb.js} +2 -2
- package/dist/{chunk-trwe0mfa.js → chunk-vbw9jhz2.js} +103 -103
- package/dist/chunk-vcx6dy59.js +2 -0
- package/dist/chunk-vv7b8p5z.js +2 -0
- package/dist/{chunk-wzjdq7d6.js → chunk-vwddsdk5.js} +9 -9
- package/dist/{chunk-vyv76w55.js → chunk-wbgc2n04.js} +2 -2
- package/dist/chunk-x0ygwk9x.js +2 -0
- package/dist/{chunk-nyg0nbjj.js → chunk-x110ssw2.js} +3 -3
- package/dist/chunk-x42tsdbx.js +2 -0
- package/dist/{chunk-sfsek961.js → chunk-x4f7efgp.js} +3 -3
- package/dist/chunk-x5wkbcsf.js +2 -0
- package/dist/{chunk-w0a6yz73.js → chunk-xbcnnk8x.js} +5 -5
- package/dist/{chunk-38ncpvww.js → chunk-xdzy4pm0.js} +2 -2
- package/dist/{chunk-84nw3921.js → chunk-xmsf1bnx.js} +3 -3
- package/dist/{chunk-4sv740a5.js → chunk-xqtt5t6d.js} +6 -6
- package/dist/{chunk-nmvhktsg.js → chunk-xz2569ra.js} +6 -6
- package/dist/chunk-y64qhgv1.js +2 -0
- package/dist/{chunk-52t0qpx6.js → chunk-y68xstqy.js} +1 -1
- package/dist/{chunk-evgghnjc.js → chunk-y8zzvzww.js} +4 -4
- package/dist/chunk-yg5a54pj.js +2 -0
- package/dist/chunk-yjskeqaj.js +2 -0
- package/dist/chunk-ywpan1k5.js +2 -0
- package/dist/chunk-yxqzarzh.js +2 -0
- package/dist/chunk-z4g64re8.js +3 -0
- package/dist/chunk-z9xjhc5m.js +42 -0
- package/dist/{chunk-ms3v5nat.js → chunk-zg44cf8a.js} +7 -7
- package/dist/{chunk-s6r54dyf.js → chunk-zjqvbcwa.js} +2 -2
- package/dist/chunk-znwc8gta.js +2 -0
- package/dist/{chunk-917v0bar.js → chunk-zrp4159x.js} +12 -12
- package/dist/{chunk-0rvntfhj.js → chunk-zvy88beh.js} +3 -3
- package/dist/cli.js +20 -20
- package/dist/compression.js +3 -3
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/port-utils.js +2 -1
- package/dist/expressions.js +1 -1
- package/dist/html-masking.d.ts +2 -0
- package/dist/html-masking.js +23 -0
- package/dist/image-optimization/processor.js +2 -2
- package/dist/includes.js +5 -4
- package/dist/misc-directives.js +2 -2
- package/dist/native/runtime/craft-bridge.js +2 -10
- package/dist/native/runtime/craft.d.ts +11 -0
- package/dist/native/runtime/navigation-chrome.d.ts +2 -0
- package/dist/native/runtime/navigation-chrome.js +25 -3
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +8 -11
- package/dist/utils.js +16 -13
- package/package.json +5 -5
- package/dist/chunk-0a36jnq4.js +0 -2
- package/dist/chunk-0c02182b.js +0 -42
- package/dist/chunk-0rnfywsx.js +0 -2
- package/dist/chunk-1bpx9b0m.js +0 -2
- package/dist/chunk-1g6xxftp.js +0 -2
- package/dist/chunk-2fcg7aws.js +0 -2
- package/dist/chunk-2nxxhcyy.js +0 -2
- package/dist/chunk-4wgfqa56.js +0 -2
- package/dist/chunk-5p6x0ztt.js +0 -2
- package/dist/chunk-6aak0b7c.js +0 -2
- package/dist/chunk-6c6m6p9t.js +0 -3
- package/dist/chunk-6g8byhwn.js +0 -2
- package/dist/chunk-70akxpk5.js +0 -2
- package/dist/chunk-72gq0ywg.js +0 -2
- package/dist/chunk-72n804gy.js +0 -2
- package/dist/chunk-7efkc3gk.js +0 -2
- package/dist/chunk-88zc5chj.js +0 -2
- package/dist/chunk-8gg8gn87.js +0 -2
- package/dist/chunk-8wv2p899.js +0 -2
- package/dist/chunk-9w3r1ch2.js +0 -3
- package/dist/chunk-a1hxz8q4.js +0 -2
- package/dist/chunk-a579jdwb.js +0 -2
- package/dist/chunk-ahd8jdzx.js +0 -2
- package/dist/chunk-aqrx322x.js +0 -2
- package/dist/chunk-ay7ggc4k.js +0 -2
- package/dist/chunk-bc4x45vx.js +0 -2
- package/dist/chunk-c77vxvp3.js +0 -2
- package/dist/chunk-c7hw37ww.js +0 -2
- package/dist/chunk-cfrgrnej.js +0 -2
- package/dist/chunk-cw8vpk41.js +0 -2
- package/dist/chunk-d96b9qgj.js +0 -2
- package/dist/chunk-db1c0c3c.js +0 -2
- package/dist/chunk-f6vzn90z.js +0 -2
- package/dist/chunk-fd3815fe.js +0 -2
- package/dist/chunk-gtj8wy95.js +0 -2
- package/dist/chunk-h4tbpr7p.js +0 -2
- package/dist/chunk-h5aaq0j8.js +0 -2
- package/dist/chunk-j0j4p9t1.js +0 -2
- package/dist/chunk-j0w048sj.js +0 -2
- package/dist/chunk-jvg9e6t6.js +0 -2
- package/dist/chunk-k761q7s7.js +0 -2
- package/dist/chunk-m3tnxk01.js +0 -2
- package/dist/chunk-mdtysd2d.js +0 -2
- package/dist/chunk-nmtya57z.js +0 -3
- package/dist/chunk-nxfyjw59.js +0 -2
- package/dist/chunk-pe5qqem0.js +0 -2
- package/dist/chunk-pwv77cyb.js +0 -2
- package/dist/chunk-qs0vtav5.js +0 -2
- package/dist/chunk-qv21bsa1.js +0 -2
- package/dist/chunk-rrba4t7k.js +0 -2
- package/dist/chunk-s3j5vxy9.js +0 -3
- package/dist/chunk-ssrxqj55.js +0 -2
- package/dist/chunk-t612xpa4.js +0 -2
- package/dist/chunk-tesbhpbp.js +0 -2
- package/dist/chunk-tkgkdf93.js +0 -2
- package/dist/chunk-tvw571ab.js +0 -2
- package/dist/chunk-txzap6yn.js +0 -2
- package/dist/chunk-vhrq4xjf.js +0 -2
- package/dist/chunk-vqpypnys.js +0 -2
- package/dist/chunk-vv3w8z4v.js +0 -2
- package/dist/chunk-vypnjn9g.js +0 -3
- package/dist/chunk-w39cfxa6.js +0 -2
- package/dist/chunk-wj937ceq.js +0 -2
- package/dist/chunk-xbavxkm5.js +0 -2
- package/dist/chunk-xrspzeqx.js +0 -2
- package/dist/chunk-y41hhypj.js +0 -2
- package/dist/chunk-yv9589qr.js +0 -54
- package/dist/chunk-z0yq548d.js +0 -2
- package/dist/chunk-zfjbwp54.js +0 -2
package/dist/html-masking.js
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
const LEADING_WHITESPACE = /\s*/y, MASKED_HTML_COMMENT = /\x00STX_HTML_COMMENT_\d+\x00/y;
|
|
2
|
+
export function skipLeadingHtmlTrivia(html) {
|
|
3
|
+
let cursor = 0;
|
|
4
|
+
while (cursor < html.length) {
|
|
5
|
+
LEADING_WHITESPACE.lastIndex = cursor;
|
|
6
|
+
LEADING_WHITESPACE.exec(html);
|
|
7
|
+
cursor = LEADING_WHITESPACE.lastIndex;
|
|
8
|
+
if (html.startsWith("<!--", cursor)) {
|
|
9
|
+
const end = html.indexOf("-->", cursor + 4);
|
|
10
|
+
if (end === -1)
|
|
11
|
+
return cursor;
|
|
12
|
+
cursor = end + 3;
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
MASKED_HTML_COMMENT.lastIndex = cursor;
|
|
16
|
+
if (MASKED_HTML_COMMENT.test(html)) {
|
|
17
|
+
cursor = MASKED_HTML_COMMENT.lastIndex;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
return cursor;
|
|
21
|
+
}
|
|
22
|
+
return cursor;
|
|
23
|
+
}
|
|
1
24
|
const HTML_TAG_NAME = /<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y, RAW_TEXT_CLOSE = new Map(["textarea", "title", "xmp", "iframe", "noembed", "noframes"].map((name) => [name, new RegExp(`</${name}\\s*>`, "ig")]));
|
|
2
25
|
export function scanHtmlTags(html) {
|
|
3
26
|
const tags = [];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import crypto from "node:crypto";
|
|
4
|
-
import { generatePlaceholder as tsGeneratePlaceholder, processImage as tsProcessImage } from "ts-images";
|
|
5
4
|
import { createTempDir, removeTempDir, withTempDir } from "../temp-dir.js";
|
|
6
5
|
export const DEFAULT_WIDTHS = [320, 640, 768, 1024, 1280, 1536, 1920], DEFAULT_FORMATS = ["webp", "jpeg"], DEFAULT_QUALITY = 80;
|
|
7
6
|
const IMAGE_EXTENSIONS = [".jpg", ".jpeg", ".png", ".webp", ".avif", ".gif", ".svg"], MIME_TYPES = {
|
|
@@ -158,6 +157,7 @@ export async function resizeAndConvert(buffer, options) {
|
|
|
158
157
|
}
|
|
159
158
|
return instance.toBuffer();
|
|
160
159
|
}
|
|
160
|
+
const { processImage: tsProcessImage } = await import("ts-images");
|
|
161
161
|
return await withTempDir("img", async (dir) => {
|
|
162
162
|
const tempOut = path.join(dir, `out.${options.format}`);
|
|
163
163
|
await tsProcessImage({
|
|
@@ -187,7 +187,7 @@ async function generatePlaceholder(buffer, type) {
|
|
|
187
187
|
}).catch(() => ({ dominant: { r: 128, g: 128, b: 128 } }));
|
|
188
188
|
return `rgb(${dominant.r}, ${dominant.g}, ${dominant.b})`;
|
|
189
189
|
}
|
|
190
|
-
const meta = await getImageMetadata(buffer), scratch = createTempDir("ph"), tempIn = path.join(scratch, `in.${meta.format === "unknown" ? "bin" : meta.format}`);
|
|
190
|
+
const { generatePlaceholder: tsGeneratePlaceholder } = await import("ts-images"), meta = await getImageMetadata(buffer), scratch = createTempDir("ph"), tempIn = path.join(scratch, `in.${meta.format === "unknown" ? "bin" : meta.format}`);
|
|
191
191
|
try {
|
|
192
192
|
await Bun.write(tempIn, buffer);
|
|
193
193
|
const tsStrategy = type === "blur" ? "blur" : type === "thumbhash" ? "thumbhash" : "dominant-color", ph = await tsGeneratePlaceholder(tempIn, {
|
package/dist/includes.js
CHANGED
|
@@ -7,6 +7,7 @@ import { existsSync } from "node:fs";
|
|
|
7
7
|
import { processConditionals } from "./conditionals.js";
|
|
8
8
|
import { isProduction, isTest } from "./env.js";
|
|
9
9
|
import { findBodyOpenTag, replaceBodyOpenTag } from "./find-body-tag.js";
|
|
10
|
+
import { skipLeadingHtmlTrivia } from "./html-masking.js";
|
|
10
11
|
import { processExpressions, usesSignalsInScript } from "./expressions.js";
|
|
11
12
|
import { buildRuntimeGlobalsDestructure } from "./runtime-globals.js";
|
|
12
13
|
import { rendersAsElement } from "./component-renderer.js";
|
|
@@ -260,14 +261,14 @@ function addScopeToRootElement(html, scopeId) {
|
|
|
260
261
|
root: "body"
|
|
261
262
|
};
|
|
262
263
|
}
|
|
263
|
-
const elementMatch = html.match(/^(
|
|
264
|
+
const leadingLen = skipLeadingHtmlTrivia(html), elementMatch = html.slice(leadingLen).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);
|
|
264
265
|
if (elementMatch) {
|
|
265
|
-
const rootTag = elementMatch[
|
|
266
|
+
const rootTag = elementMatch[1] + elementMatch[2], root = elementMatch[1].slice(1), existingScope = rootTag.match(/data-stx-scope="([^"]*)"/);
|
|
266
267
|
if (existingScope)
|
|
267
268
|
return { html, mergedIntoExisting: existingScope[1], stamped: !0, root };
|
|
268
|
-
const before =
|
|
269
|
+
const before = html.slice(0, leadingLen), tagStart = elementMatch[1], afterTag = elementMatch[2];
|
|
269
270
|
return {
|
|
270
|
-
html: `${before}${tagStart} data-stx-scope="${scopeId}"${afterTag}${html.slice(elementMatch[0].length)}`,
|
|
271
|
+
html: `${before}${tagStart} data-stx-scope="${scopeId}"${afterTag}${html.slice(leadingLen + elementMatch[0].length)}`,
|
|
271
272
|
mergedIntoExisting: null,
|
|
272
273
|
stamped: !0,
|
|
273
274
|
root
|
package/dist/misc-directives.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { errorLogger } from "./error-handling.js";
|
|
2
|
-
import { mightContainOwnTextMustache, scanAtElementPosition } from "./html-masking.js";
|
|
2
|
+
import { mightContainOwnTextMustache, scanAtElementPosition, skipLeadingHtmlTrivia } from "./html-masking.js";
|
|
3
3
|
import { createSafeFunction, isExpressionSafe } from "./safe-evaluator.js";
|
|
4
4
|
import { contentKey, renderMemo } from "./render-memo.js";
|
|
5
5
|
export function processJsonDirective(template, context) {
|
|
@@ -119,7 +119,7 @@ export function processMemoDirective(template) {
|
|
|
119
119
|
const depsExpr = output.slice(exprStart, i - 1).trim(), afterOpen = i, tail = output.slice(afterOpen), endIdx = tail.indexOf("@endmemo");
|
|
120
120
|
if (endIdx === -1)
|
|
121
121
|
continue;
|
|
122
|
-
const blockInner = tail.slice(0, endIdx), blockEnd = afterOpen + endIdx + 8,
|
|
122
|
+
const blockInner = tail.slice(0, endIdx), blockEnd = afterOpen + endIdx + 8, leadingLen = skipLeadingHtmlTrivia(blockInner), rest = blockInner.slice(leadingLen), trailing = blockInner.match(/(\s*)$/), trailingLen = trailing ? trailing[0].length : 0, body = rest.slice(0, rest.length - trailingLen), firstTagMatch = body.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/);
|
|
123
123
|
let replacement;
|
|
124
124
|
if (firstTagMatch) {
|
|
125
125
|
const [fullMatch, tagName, attrs = "", selfClose] = firstTagMatch, newOpenTag = `<${tagName}${attrs} data-stx-memo="${depsExpr}"${selfClose}>`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NativeCapabilityError, STXBridge } from "../bridge/protocol.js";
|
|
2
2
|
import { createEventSourceClass, createStreamingBody } from "./event-stream.js";
|
|
3
3
|
import { abortError, isNativeDocument, NativeFormData, nativeFormParts, updateNativeDocumentVisibility } from "./jsc-globals.js";
|
|
4
|
-
import { buttonsKey, changedTabItems, chromePath, hostButton, mergeChromeButtons } from "./navigation-chrome.js";
|
|
4
|
+
import { buttonPresses, buttonsKey, changedTabItems, chromePath, hostButton, mergeChromeButtons } from "./navigation-chrome.js";
|
|
5
5
|
import { installNativeNavigation, nativeRouteParams } from "./web-navigation.js";
|
|
6
6
|
import { installNativeWebStorage } from "./web-storage.js";
|
|
7
7
|
const permissionFallbacks = new WeakSet;
|
|
@@ -873,15 +873,7 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
|
|
|
873
873
|
}, barButtons = (side) => {
|
|
874
874
|
const merged = mergeChromeButtons(ownButtons[side], effectiveChrome(), side, { name: craft.route?.name ?? "", path: craft.route?.path }), presses = navButtonPresses[side];
|
|
875
875
|
presses.clear();
|
|
876
|
-
|
|
877
|
-
const id = String(button.id);
|
|
878
|
-
if (typeof button.onPress === "function")
|
|
879
|
-
presses.set(id, button.onPress);
|
|
880
|
-
else if (button.open) {
|
|
881
|
-
const path = button.open;
|
|
882
|
-
presses.set(id, () => craft.navigation.open(path));
|
|
883
|
-
}
|
|
884
|
-
}
|
|
876
|
+
buttonPresses(merged, (path) => craft.navigation.open(path)).forEach((press, id) => presses.set(id, press));
|
|
885
877
|
sentButtons[side] = buttonsKey(merged);
|
|
886
878
|
return merged.map(hostButton);
|
|
887
879
|
}, sendOptions = (payload) => hostSetOptions ? hostSetOptions(payload) : protocol.send("NAVIGATION_SET_OPTIONS", payload);
|
|
@@ -11,6 +11,16 @@ import type { NativeLiveActivities } from '../live-activity';
|
|
|
11
11
|
* craft.navigation.open(`/m/workout/${id}`)
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
+
/** One choice in a bar button's native menu. */
|
|
15
|
+
export declare interface NativeNavigationMenuItem {
|
|
16
|
+
id: string
|
|
17
|
+
title: string
|
|
18
|
+
symbol?: string
|
|
19
|
+
disabled?: boolean
|
|
20
|
+
destructive?: boolean
|
|
21
|
+
open?: string
|
|
22
|
+
onPress?: (event: { id: string }) => unknown
|
|
23
|
+
}
|
|
14
24
|
export declare interface NativeNavigationButton {
|
|
15
25
|
id: string
|
|
16
26
|
symbol?: string
|
|
@@ -21,6 +31,7 @@ export declare interface NativeNavigationButton {
|
|
|
21
31
|
variant?: 'accent' | 'account' | 'neutral'
|
|
22
32
|
badge?: number
|
|
23
33
|
badgeStyle?: 'count' | 'dot'
|
|
34
|
+
menu?: NativeNavigationMenuItem[]
|
|
24
35
|
onPress?: (event: { id: string }) => unknown
|
|
25
36
|
}
|
|
26
37
|
/** Update one tab without replacing its stack, symbol or selection. */
|
|
@@ -12,6 +12,8 @@ export declare function showsChromeButton(button: NativeChromeButton, route: Chr
|
|
|
12
12
|
export declare function mergeChromeButtons(own: readonly NativeNavigationButton[], chrome: NativeNavigationChrome | null, side: ButtonSide, route: ChromeRoute): NativeChromeButton[];
|
|
13
13
|
/** What the host is shown for a button: no callbacks, and nothing chrome-only. */
|
|
14
14
|
export declare function hostButton(button: NativeChromeButton): NativeNavigationButton;
|
|
15
|
+
/** What pressing each button, or choosing from its menu, does in the screen. */
|
|
16
|
+
export declare function buttonPresses(buttons: readonly NativeChromeButton[], open: (path: string) => unknown): Map<string, (event: { id: string }) => unknown>;
|
|
15
17
|
/** The key two sends compare by, so an unchanged bar is not sent again. */
|
|
16
18
|
export declare function buttonsKey(buttons: readonly NativeChromeButton[]): string;
|
|
17
19
|
/** The tab items of `chrome` that differ from what was last sent for each tab. */
|
|
@@ -24,12 +24,34 @@ export function showsChromeButton(button, route) {
|
|
|
24
24
|
export function mergeChromeButtons(own, chrome, side, route) {
|
|
25
25
|
if (!chrome || chrome.bare?.includes(route.name))
|
|
26
26
|
return [...own];
|
|
27
|
-
const shared = (chrome[side] ?? []).filter((button) => button && button.id != null && showsChromeButton(button, route))
|
|
27
|
+
const shared = (chrome[side] ?? []).filter((button) => button && button.id != null && showsChromeButton(button, route)).flatMap((button) => {
|
|
28
|
+
if (!button.menu)
|
|
29
|
+
return [button];
|
|
30
|
+
const menu = button.menu.filter((item) => item && item.id != null && !(item.open && route.path && chromePath(item.open) === chromePath(route.path)));
|
|
31
|
+
return menu.length ? [{ ...button, menu }] : [];
|
|
32
|
+
}), taken = new Set((chrome.leftButtons ?? []).concat(chrome.rightButtons ?? []).map((button) => String(button?.id)));
|
|
28
33
|
return [...own.filter((button) => !taken.has(String(button?.id))), ...shared];
|
|
29
34
|
}
|
|
30
35
|
export function hostButton(button) {
|
|
31
|
-
const { onPress, open, hideOn, ...rest } = button;
|
|
32
|
-
|
|
36
|
+
const { onPress, open, hideOn, menu, ...rest } = button;
|
|
37
|
+
if (!menu)
|
|
38
|
+
return rest;
|
|
39
|
+
return { ...rest, menu: menu.map(({ onPress: press, open: path, ...item }) => item) };
|
|
40
|
+
}
|
|
41
|
+
export function buttonPresses(buttons, open) {
|
|
42
|
+
const presses = new Map, add = (target) => {
|
|
43
|
+
const path = target.open;
|
|
44
|
+
if (typeof target.onPress === "function")
|
|
45
|
+
presses.set(String(target.id), target.onPress);
|
|
46
|
+
else if (path)
|
|
47
|
+
presses.set(String(target.id), () => open(path));
|
|
48
|
+
};
|
|
49
|
+
for (const button of buttons) {
|
|
50
|
+
add(button);
|
|
51
|
+
for (const item of button.menu ?? [])
|
|
52
|
+
add(item);
|
|
53
|
+
}
|
|
54
|
+
return presses;
|
|
33
55
|
}
|
|
34
56
|
export function buttonsKey(buttons) {
|
|
35
57
|
return JSON.stringify(buttons.map(hostButton));
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-
|
|
2
|
+
import{no,Ut,Cl,Ag}from"./chunk-dgn87554.js";import{to,Ni,Tg,$g,Rg}from"./chunk-8qbp5skx.js";import{Sl,kl,_l,Cg,Eg}from"./chunk-8pj4v1eh.js";import{We,An,Mi}from"./chunk-rk2ex6qx.js";import{Pg,Ig,Og,Ng,ro,hy}from"./chunk-a1s5wqw4.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
|
|
3
|
+
Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-ndah5rvs.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
|
|
|
233
233
|
}, 5000);
|
|
234
234
|
</script>
|
|
235
235
|
</body>
|
|
236
|
-
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=We(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=
|
|
236
|
+
</html>`}function b(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=We(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=no(n,t);if(a){let s=Ut(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Ni(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,kl as auditBuildOutput,Sl as auditConfig,re as buildPwaAssets,_l as calculateAuditResult,Eg as formatAuditResult,Mi as formatSize,j as generateManifest,_ as generateManifestJson,$g as generateManifestLink,F as generateOfflinePage,We as generatePrecacheManifest,An as generatePrecacheManifestJs,M as generatePwaIcons,to as generatePwaTags,no as generateServiceWorker,Ag as generateServiceWorkerAuto,Tg as generateSwRegistrationScript,Rg as generateThemeColorMeta,N as getExpectedIconPaths,Ut as getServiceWorkerFileName,Ni as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,Cl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,ro as pwaDirectives,Pg as pwaInstallDirective,Og as pwaOfflineDirective,Ng as pwaPushDirective,Ig as pwaUpdateDirective,hy as registerPwaDirectives,Cg as runPwaAudit,D as validateManifest};
|
package/dist/ssg.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
3
|
-
`)}function J(t){return async()=>({paths:await t(),fallback:!1})}var Ot;function Lt(t){let r=s(t),{depths:n}=me(r),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=o.exec(r))!==null){if(n[l.index]!==0)continue;let u=x(r,"(",")",o.lastIndex-1),g=r.indexOf("{",u+1),v=x(r,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(l.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(r))!==null){if(n[l.index]!==0)continue;let u=
|
|
2
|
+
import"./chunk-4y6hes3h.js";import{x,il}from"./chunk-89d3h8mp.js";import"./chunk-23r3rby6.js";import"./chunk-zjqvbcwa.js";import{At,y}from"./chunk-vbw9jhz2.js";import"./chunk-8370x30n.js";import"./chunk-p65ax8s0.js";import"./chunk-11y84h2d.js";import{_t,Ct,Et,Tt,$t,Rt}from"./chunk-2j5yane9.js";import{a}from"./chunk-chjdnmqv.js";import{$s}from"./chunk-zg44cf8a.js";import"./chunk-4657mnht.js";import"./chunk-qzms4d8s.js";import{ye,nn,rn}from"./chunk-y8zzvzww.js";import"./chunk-88rwr1w2.js";import{b}from"./chunk-vwddsdk5.js";import{bt,i}from"./chunk-57x8wxdf.js";import"./chunk-z9xjhc5m.js";import"./chunk-2vprq4x0.js";import{ms}from"./chunk-8d4br2j5.js";import"./chunk-b90xw7v4.js";import"./chunk-4dxq7ft1.js";import{ec,tc,nc}from"./chunk-321e41ck.js";import{en,er,tr}from"./chunk-c18pafmf.js";import{tn}from"./chunk-xdzy4pm0.js";import"./chunk-jgx0ex9p.js";import"./chunk-1b1ntgt7.js";import{G,ve}from"./chunk-xqtt5t6d.js";import"./chunk-2fj5zev7.js";import"./chunk-ns0171xk.js";import{c}from"./chunk-z4g64re8.js";import{s,me}from"./chunk-x4f7efgp.js";import D from"fs";import f from"path";import{createHash as vt}from"crypto";function Pt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var kt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Dt(t){return Bun.hash(t).toString(16)}function ot(t,r={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let n=new Map,o=t.replace(kt,(e,u,g,v)=>{let w=v.trim();if(!w)return e;if(/\bdata-stx-src=/.test(g))return e;if(r.minify)w=Pt(w);let p=Dt(w);if(!n.has(p))n.set(p,w);let P=r.integrity?` data-stx-integrity="sha384-${vt("sha384").update(w).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${u}" data-stx-src="/_stx/islands/${p}.js"${P}${g}></script>`}),l=Array.from(n,([e,u])=>({hash:e,code:u}));return{html:o,chunks:l}}var It=new Set(["visible","idle"]);function ct(t){if(!t.includes("data-stx-src="))return t;let r=new Map,n=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,o;while((o=n.exec(t))!==null)r.set(o[1],o[2]);let l=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,u;while((u=e.exec(t))!==null)if(It.has(r.get(u[1])||""))l.add(u[2]);let g=/<\/head\s*>/iy,v=y(t,(p,P)=>(g.lastIndex=P,g.exec(p)?g.lastIndex:-1))[0]?.start??-1;if(l.size===0||v===-1)return t;let w=Array.from(l).filter((p)=>!t.includes(`rel="prefetch" href="${p}"`)).map((p)=>`<link rel="prefetch" href="${p}" as="script">`).join("");if(!w)return t;return t.slice(0,v)+w+t.slice(v)}var Bt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function X(t){let r=t.trim();if(!r)return null;let n=/^https?:\/\//i.test(r)?r:`https://${r}`;try{return new URL(n).origin+new URL(n).pathname.replace(/\/$/,"")}catch{return null}}function jt(t){for(let r of Bt){let n=t[r];if(!n)continue;let o=X(n);if(o)return{url:o,source:"env",via:r}}return null}function lt(t){if(!t||typeof t!=="object")return null;let r=t,n=r.site?.url??r.url??r.app?.url;return typeof n==="string"?X(n):null}async function Ft(t){let{existsSync:r}=await import("fs"),n=await import("path");for(let o of["site.config.ts","site.config.js",".config/site.config.ts"]){let l=n.resolve(t,o);if(!r(l))continue;try{let e=await import(l),u=lt(e.default??e);if(u)return u}catch{}}return null}async function ut(t={}){let r=t.cwd??process.cwd(),n=t.env??process.env;if(t.explicit){let u=X(t.explicit);if(u)return{url:u,source:"option"}}let o=lt(t.stxConfig);if(o)return{url:o,source:"stx.config",via:"site.url"};let l=await Ft(r);if(l)return{url:l,source:"site.config",via:"url"};let e=jt(n);if(e)return e;return{url:"http://localhost",source:"fallback"}}function dt(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
|
|
3
|
+
`)}function J(t){return async()=>({paths:await t(),fallback:!1})}var Ot;function Lt(t){let r=s(t),{depths:n}=me(r),o=/\b(?:async\s+)?function\s+getStaticPaths\s*\(/g,l;while((l=o.exec(r))!==null){if(n[l.index]!==0)continue;let u=x(r,"(",")",o.lastIndex-1),g=r.indexOf("{",u+1),v=x(r,"{","}",g);if(u<0||g<0||v<0)break;return t.slice(l.index,v+1)}let e=/\b(?:const|let|var)\s+getStaticPaths\s*=/g;while((l=e.exec(r))!==null){if(n[l.index]!==0)continue;let u=il(r,e.lastIndex).endPos;return t.slice(e.lastIndex,u).trim()}throw SyntaxError("Could not extract getStaticPaths; use a top-level function or const declaration")}async function gt(t){let r="read";try{let n=await Bun.file(t).text();r="parse";let o=tn(n),l=[...o.server,...o.client,...o.signals].filter((e)=>/(?:^|\s)server(?:\s|=|$)/i.test(s(e.attrs))).sort((e,u)=>n.indexOf(e.fullTag)-n.indexOf(u.fullTag));for(let e of l){if(!/\bgetStaticPaths\b/.test(s(e.content)))continue;let u=(Ot??=new Bun.Transpiler({loader:"ts",target:"bun"})).transformSync(e.content);if(!/\bgetStaticPaths\b/.test(s(u)))continue;let g=Lt(u);if(/\bdefineStaticPaths\b/.test(s(g))&&At(u,"defineStaticPaths"))throw SyntaxError("Cannot evaluate a module-local defineStaticPaths binding during isolated hook extraction");r="execute";let v=Function("defineStaticPaths",`return (${g})`)(J);if(typeof v!=="function")throw TypeError("getStaticPaths must be a function");let w=await v();r="result";let p=Array.isArray(w)?{paths:w}:w;if(!p||typeof p!=="object"||!("paths"in p)||!Array.isArray(p.paths))throw TypeError("getStaticPaths must return { paths: [...] } or an array of paths");for(let P of p.paths)if(!P||typeof P!=="object"||!P.params||typeof P.params!=="object"||Array.isArray(P.params))throw TypeError("Each getStaticPaths path must contain a params object");return{kind:"ok",value:p}}return{kind:"absent"}}catch(n){return{kind:"error",phase:r,error:n instanceof Error?n:Error(String(n))}}}class pt{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,r=""){this.cacheDir=t,this.salt=r}async load(){if(this.loaded)return;let t=f.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let r=JSON.parse(await Bun.file(t).text());for(let[n,o]of Object.entries(r))this.cache.set(n,o)}catch{}this.loaded=!0}async save(){await D.promises.mkdir(this.cacheDir,{recursive:!0});let t=f.join(this.cacheDir,"build-cache.json"),r={};for(let[n,o]of this.cache)r[n]=o;await Bun.write(t,JSON.stringify(r))}getHash(t,r){let n=D.statSync(t),o=`${this.salt}|${t}:${n.mtimeMs}`;for(let e of r)if(D.existsSync(e)){let u=D.statSync(e);o+=`:${e}:${u.mtimeMs}`}let l=0;for(let e=0;e<o.length;e++){let u=o.charCodeAt(e);l=(l<<5)-l+u,l=l&l}return Math.abs(l).toString(36)}get(t,r){let n=this.cache.get(t);if(!n)return null;let o=ft(r).some((u)=>D.existsSync(u)),l=[r,...n.dependencies??[]].some((u)=>u.endsWith(".stx")&&D.existsSync(u)&&ms(D.readFileSync(u,"utf8")).some((g)=>/\bserver\b/.test(g.attrs)));if(o||l)return this.cache.delete(t),null;let e=this.getHash(r,n.dependencies??[]);if(n.hash!==e)return this.cache.delete(t),null;return n.html}set(t,r,n,o){let l=this.getHash(r,n);this.cache.set(t,{hash:l,html:o,generatedAt:Date.now(),dependencies:n})}}class ht{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let r=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return f.join(this.cacheDir,"isr",r)}async get(t){let r=this.getFilePath(t);if(!await Bun.file(r).exists())return null;try{return JSON.parse(await Bun.file(r).text())}catch{return null}}async set(t,r){let n=this.getFilePath(t);await D.promises.mkdir(f.dirname(n),{recursive:!0}),await Bun.write(n,JSON.stringify(r))}async invalidate(t){let r=this.getFilePath(t);if(await Bun.file(r).exists())await D.promises.unlink(r)}async invalidatePattern(t){let r=f.join(this.cacheDir,"isr");if(!D.existsSync(r))return;let n=await D.promises.readdir(r);for(let o of n){let l=o.replace(/_/g,"/").replace(".json","");if(t.test(l))await D.promises.unlink(f.join(r,o))}}async needsRevalidation(t){let r=await this.get(t);if(!r)return!0;return Date.now()>r.revalidateAfter}}async function Ut(t){let r=[];if(!t.isDynamic)r.push({url:t.pattern,params:{}});else{let n=await gt(t.filePath);if(n.kind==="error")throw Error(`getStaticPaths ${n.phase} failed for ${t.pattern} (${t.filePath}): ${n.error.message}`,{cause:n.error});if(n.kind==="absent")return console.warn(`Warning: Dynamic route ${t.pattern} (${t.filePath}) has no getStaticPaths`),r;let o=n.value;if(o.paths.length===0)return console.info(`getStaticPaths returned no paths for dynamic route ${t.pattern} (${t.filePath})`),r;for(let l of o.paths){let e=t.pattern;for(let[u,g]of Object.entries(l.params))e=e.replace(`:${u}`,g).replace(`:${u}*`,g);r.push({url:e,params:l.params,props:l.props,revalidate:l.revalidate})}}return r}function ft(t){return[t.replace(/\.stx$/,".data.ts"),t.replace(/\.stx$/,".data.js"),t+".data.ts",t+".data.js"]}async function Mt(t){for(let r of ft(t))if(await Bun.file(r).exists())try{let n=await import(r);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:o,...l}=n;return l}}catch(n){console.error(`Error loading data file ${r}:`,n)}return null}async function Gt(t,r,n){let o=t.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!o)return null;let l=o[1];if(!l.includes("getStaticProps"))return null;try{let e=l.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!e)return null;return await Function("params",`
|
|
4
4
|
return (async function getStaticProps() {
|
|
5
5
|
${e[1]}
|
|
6
6
|
})()
|
|
7
7
|
`)(r)}catch(e){return console.error(`Error executing getStaticProps in ${n}:`,e),null}}function Nt(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function mt(t,r,n={},o,l){let e=await Bun.file(t.filePath).text(),u=await Mt(t.filePath),g=await Gt(e,r,t.filePath),v={...u||{},...g||{},...n,params:r,$route:{path:t.pattern,params:r}},w=new Set,p=[],P=[],E={...l,minifyClient:!0,...o.partialsDir?{partialsDir:o.partialsDir}:{},...o.componentsDir?{componentsDir:o.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(R)=>{p.push(`${f.relative(process.cwd(),R.templatePath)}: ${R.message}
|
|
8
|
-
resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let S=await i(e,v,t.filePath,E,w);for(let R of[t.filePath,...w])for(let
|
|
8
|
+
resolved against partialsDir: ${R.partialsDir}`)},onServerScriptError:(R)=>{P.push(`${f.relative(process.cwd(),R.sourcePath)} (${R.kind}): ${R.message}`)}};if(Nt(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let S=await i(e,v,t.filePath,E,w);for(let R of[t.filePath,...w])for(let A of ye(R))w.add(A);if(Object.keys(r).length>0){let R=`<script>if(window.stx)window.stx._rp=${JSON.stringify(r)};else window.__stx_rp=${JSON.stringify(r)};</script>`;if(S.includes("</head>"))S=S.replace("</head>",`${R}
|
|
9
9
|
</head>`);else S=`${R}
|
|
10
10
|
${S}`}if(S=await ve(S,{router:o.router}),S=await b(S),o.minify!==!1)return{html:Ht(S),dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P};return{html:S,dependencies:Array.from(w),includeFailures:p,serverScriptFailures:P}}function Ht(t){let r=[],n=0,o=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,l;while((l=o.exec(t))!==null){let u=t.slice(n,l.index);r.push(u.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let g=l[1],v=l[2],w=l[3];v=v.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),r.push(g+v+w),n=l.index+l[0].length}let e=t.slice(n);return r.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),r.join("").trim()}function zt(t){let r=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);r=(r<<5)-r+o,r=r&r}return`"${Math.abs(r).toString(36)}"`}function Wt(t,r,n,o){if(n?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(r))return!0;return o.some((l)=>{if(l instanceof RegExp)return l.test(t);return l.endsWith("/")?t===l.slice(0,-1)||t.startsWith(l):t===l})}function qt(t,r){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
11
11
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
@@ -37,18 +37,15 @@ ${t.map((o)=>{let l=new URL(o.loc,r).href,e=` <url>
|
|
|
37
37
|
${n.join(`
|
|
38
38
|
`)}
|
|
39
39
|
</channel>
|
|
40
|
-
</rss>`}async function Vt(t={}){let r=Date.now();
|
|
41
|
-
const validate = ${it[1]};
|
|
42
|
-
return validate(route);
|
|
43
|
-
`)({params:N})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=T.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await mt(k,N,St,e,n);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|
|
40
|
+
</rss>`}async function Vt(t={}){let r=Date.now();rn();let n=await a(process.cwd()),o=n.build||{},l=await ut({explicit:t.domain||o.domain,stxConfig:n});if(l.source==="fallback"&&(t.sitemap??o.sitemap??!0))console.warn(dt());let e={router:t.router??n?.router??{},pagesDir:t.pagesDir||o.pagesDir||"pages",outputDir:t.outputDir||o.outputDir||"dist",baseUrl:t.baseUrl||o.baseUrl||"/",domain:l.url,revalidate:t.revalidate??o.revalidate??!1,sitemap:t.sitemap??o.sitemap??!0,sitemapExclude:t.sitemapExclude||o.sitemapExclude||[],robots:t.robots??o.robots??!0,rss:t.rss??o.rss??!1,concurrency:t.concurrency||o.concurrency||10,cache:t.cache??o.cache??!0,cacheDir:t.cacheDir||o.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??o.minify??!0,generate404:t.generate404??o.generate404??!0,publicDir:t.publicDir||o.publicDir||"public",trailingSlash:t.trailingSlash??o.trailingSlash??!1,cleanOutput:t.cleanOutput??o.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||n?.partialsDir||"",componentsDir:t.componentsDir||n?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},u={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},g=new Set,v=0,w={},p={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&D.existsSync(e.outputDir))await D.promises.rm(e.outputDir,{recursive:!0});await D.promises.mkdir(e.outputDir,{recursive:!0});let E=e.cacheSalt;if(!E){let{resolveUserCssConfig:d,fingerprintConfig:m}=await import("./chunk-4rswqcfc.js");try{E=m(await d(process.cwd()))}catch{}}let{prepareImageDelivery:S}=await import("./chunk-g6r2313a.js"),R=await S(e.publicDir,e.outputDir);if(R.count>0)console.log(`Optimized ${R.count} image(s) for responsive delivery`),E=[E,R.fingerprint].filter(Boolean).join(":");let A=new pt(e.cacheDir,E);if(e.cache)await A.load();try{let{generateCss:d}=await import("./chunk-4rswqcfc.js");await d('<div class="bg-black"></div>')}catch{}_t();let wt=n?.routeMiddleware?.dir||"middleware";await Et(process.cwd(),wt);let V=Ct();if(V.length>0)console.log(`Loaded ${V.length} middleware: ${V.join(", ")}`);let yt=n?.routeMiddleware?.global||[];nc(n?.layoutsDir,c(process.cwd()));let Z=G(".",{pagesDir:e.pagesDir,pagesDirs:n?._layerPageDirs});console.log(`Found ${Z.length} routes`);let L=[];for(let d of Z)try{let m=await Ut(d);for(let k of m)L.push({route:d,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??e.revalidate})}catch(m){let k=m instanceof Error?m:Error(String(m));u.failedCount++,u.errors.push({route:d.pattern,error:k}),await e.hooks.onError?.(k,d.pattern),console.error(`Error discovering paths for ${d.pattern}:`,k)}u.totalPages=L.length+u.failedCount,console.log(`Generating ${L.length} pages...`);let U=[],Q=[];for(let d=0;d<L.length;d+=e.concurrency)Q.push(L.slice(d,d+e.concurrency));for(let d of Q)await Promise.all(d.map(async(m)=>{let{route:k,url:h,params:_,props:St,revalidate:rt}=m;try{await e.hooks.onPageStart?.(h);let M=await Bun.file(k.filePath).text(),T=Yt(M),xt=T?.middleware?Array.isArray(T.middleware)?T.middleware:[T.middleware]:[],nt=[...yt,...xt];if(nt.length>0){let B=Tt(h,_,T||{}),H=$t(B,null,void 0,{isServer:!0}),j=await Rt(nt,H);if(j.redirect){let C=typeof j.redirect==="string"?j.redirect:j.redirect.path||j.redirect,z=Zt(String(C),h),O=Qt(h,e);await D.promises.mkdir(f.dirname(O),{recursive:!0}),await Bun.write(O,z),u.successCount++,u.pages.push({route:h,outputPath:O,size:Buffer.byteLength(z),cached:!1}),U.push({loc:h,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${h} \u2192 redirect to ${C}`);return}if(j.abort){let C=typeof j.abort==="string"?j.abort:j.abort?.error?.message||"aborted";console.warn(` \u21B3 ${h} \u2014 middleware aborted: ${C}`);return}}let it=T?.validate;if(typeof it==="function")try{if(!await it({params:_})){console.warn(`Validation failed for ${h}, skipping...`);return}}catch{}let I=null,st=!1;if(e.cache){if(I=A.get(h,k.filePath),I)st=!0,u.cachedCount++}if(!I){let B=await mt(k,_,St,e,n);if(I=B.html,e.failOnIncludeError&&B.includeFailures.length>0)throw Error(`${B.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
|
|
44
41
|
${B.includeFailures.join(`
|
|
45
42
|
`)}
|
|
46
43
|
Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&B.serverScriptFailures.length>0)throw Error(`${B.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
|
|
47
44
|
${B.serverScriptFailures.join(`
|
|
48
45
|
`)}
|
|
49
|
-
Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)
|
|
46
|
+
Set ssg.failOnServerScriptError to false to build anyway.`);if(e.cache)A.set(h,k.filePath,B.dependencies,I)}let N;if(e.trailingSlash)N=f.join(e.outputDir,h,"index.html");else N=h==="/"?f.join(e.outputDir,"index.html"):f.join(e.outputDir,`${h}.html`);if(e.chunkIslands){let{html:B,chunks:H}=ot(I,{integrity:e.integrityIslands,minify:e.minify});if(H.length>0){let j=f.join(e.outputDir,"_stx","islands");await D.promises.mkdir(j,{recursive:!0});for(let C of H){let z=f.join(j,`${C.hash}.js`);if(!await Bun.file(z).exists())await Bun.write(z,C.code);if(!g.has(C.hash)){g.add(C.hash);let O=Buffer.byteLength(C.code,"utf8");v+=O,w[C.hash]={bytes:O,file:`/_stx/islands/${C.hash}.js`}}}if(p[h]=H.map((C)=>C.hash),I=B,e.prefetchIslands)I=ct(I)}}if(await D.promises.mkdir(f.dirname(N),{recursive:!0}),await Bun.write(N,I),!Wt(h,I,T,e.sitemapExclude))U.push({loc:h,lastmod:new Date().toISOString().split("T")[0],priority:h==="/"?1:0.8});let at={route:h,outputPath:N,size:Buffer.byteLength(I,"utf8"),cached:st};if(rt!==!1)at.revalidateAt=Date.now()+rt*1000;u.pages.push(at),u.successCount++,await e.hooks.onPageEnd?.(h,I)}catch(M){u.failedCount++,u.errors.push({route:h,error:M}),await e.hooks.onError?.(M,h),console.error(`Error generating ${h}:`,M)}}));let tt=nn();if(tt.length>0){let d=tt.map((m)=>`${m.filePath}: ${m.message}`).join(`
|
|
50
47
|
`);throw Error(`Client script bundling failed:
|
|
51
|
-
${d}`)}if(e.cache)await
|
|
48
|
+
${d}`)}if(e.cache)await A.save();if(e.generate404){let d=f.join(e.pagesDir,"404.stx");if(await Bun.file(d).exists()){let m=new Set,k={...n,minifyClient:!0,debug:!1,cache:!1},h=await i(await Bun.file(d).text(),{},d,k,m);await Bun.write(f.join(e.outputDir,"404.html"),h)}else await Bun.write(f.join(e.outputDir,"404.html"),`<!DOCTYPE html>
|
|
52
49
|
<html lang="en">
|
|
53
50
|
<head>
|
|
54
51
|
<meta charset="UTF-8">
|
|
@@ -69,7 +66,7 @@ ${d}`)}if(e.cache)await T.save();if(e.generate404){let d=f.join(e.pagesDir,"404.
|
|
|
69
66
|
<a href="/">Go home</a>
|
|
70
67
|
</div>
|
|
71
68
|
</body>
|
|
72
|
-
</html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...n,minifyClient:!0,debug:!1,cache:!1},
|
|
69
|
+
</html>`)}for(let d of[500]){let m=f.join(e.pagesDir,`${d}.stx`);if(await Bun.file(m).exists()){let k=new Set,h={...n,minifyClient:!0,debug:!1,cache:!1},_=await i(await Bun.file(m).text(),{},m,h,k);await Bun.write(f.join(e.outputDir,`${d}.html`),_)}}let K=f.join(e.pagesDir,"error.stx");if(await Bun.file(K).exists()){let d=new Set,m={...n,minifyClient:!0,debug:!1,cache:!1},k=await i(await Bun.file(K).text(),{},K,m,d);await Bun.write(f.join(e.outputDir,"error.html"),k)}if(e.sitemap&&U.length>0){let d=qt(U,e.domain),m=f.join(e.outputDir,"sitemap.xml");await Bun.write(m,d),u.sitemapPath=m,console.log(`Generated sitemap.xml with ${U.length} URLs`)}if(e.robots!==!1){let d=typeof e.robots==="object"?e.robots:{},m=[...e.sitemapExclude.filter((h)=>typeof h==="string"),...d.disallow||[]],k=$s({rules:[{userAgent:d.userAgent||"*",allow:d.allow||["/"],...m.length>0?{disallow:m}:{}}],...d.sitemap!==!1&&u.sitemapPath?{sitemap:new URL("/sitemap.xml",e.domain).href}:{}});await Bun.write(f.join(e.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(e.rss){let d=typeof e.rss==="object"?e.rss:{title:"Site Feed",description:"Latest updates",link:e.domain},m=[];if(d.getItems)m=await d.getItems();let k=Jt(d,m),h=f.join(e.outputDir,"rss.xml");await Bun.write(h,k),u.rssPath=h,console.log(`Generated rss.xml with ${m.length} items`)}let W=ec(e.outputDir);if(W.assets>0)console.log(`Externalized ${W.assets} asset(s) from ${W.pages} page(s) (${(W.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let q=tc(e.outputDir);if(q.assets>0)console.log(`Externalized ${q.assets} repeated asset(s) from ${q.pages} page(s) (${(q.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(e.publicDir&&D.existsSync(e.publicDir))await Y(e.publicDir,e.outputDir),console.log(`Copied public assets from ${e.publicDir}`);let et=tr();if(et)await Y(et,f.join(e.outputDir,er)),console.log(`Copied assets from ${en}`)}catch(E){throw await e.hooks.onError?.(E),E}if(u.buildTime=Date.now()-r,g.size>0){u.islandChunks={count:g.size,totalBytes:v};let E={generatedChunks:g.size,totalBytes:v,chunks:w,pages:p};await Bun.write(f.join(e.outputDir,"_stx","islands-manifest.json"),JSON.stringify(E,null,2))}await e.hooks.onBuildEnd?.(u);let P=u.islandChunks?`
|
|
73
70
|
Island chunks: ${u.islandChunks.count} (${(u.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
|
|
74
71
|
Build complete!
|
|
75
72
|
Total: ${u.totalPages} pages
|
|
@@ -90,4 +87,4 @@ Build complete!
|
|
|
90
87
|
<p>Redirecting to <a href="${t}">${t}</a>...</p>
|
|
91
88
|
<script>window.location.replace('${t}')</script>
|
|
92
89
|
</body>
|
|
93
|
-
</html>`}function
|
|
90
|
+
</html>`}function Qt(t,r){if(t==="/"||t==="")return f.join(r.outputDir,"index.html");let n=t.replace(/^\/|\/$/g,"");if(r.trailingSlash)return f.join(r.outputDir,n,"index.html");return f.join(r.outputDir,`${n}.html`)}var je={generateStaticSite:Vt,createISRHandler:Kt,defineStaticPaths:J,createMarkdownLoader:Xt};export{Kt as createISRHandler,Xt as createMarkdownLoader,Nt as declaresPageAction,je as default,J as defineStaticPaths,Vt as generateStaticSite,Wt as isExcludedFromSitemap};
|
package/dist/utils.js
CHANGED
|
@@ -21,7 +21,7 @@ import { isUsableParamName } from "./safe-evaluator.js";
|
|
|
21
21
|
import { processScopedStyles } from "./style-scoping.js";
|
|
22
22
|
import { findSfcTemplateBlock } from "./sfc-template.js";
|
|
23
23
|
import { importOnce } from "./lazy-module.js";
|
|
24
|
-
import { scanAtElementPosition, stashScriptElements } from "./html-masking.js";
|
|
24
|
+
import { scanAtElementPosition, skipLeadingHtmlTrivia, stashScriptElements } from "./html-masking.js";
|
|
25
25
|
import { hasReactiveDirectives } from "./reactive.js";
|
|
26
26
|
import { markProjectedRefs, markProjectedSlotRoots } from "./misc-directives.js";
|
|
27
27
|
import { collectBlockDeclarations } from "./stx-virtual-ts.js";
|
|
@@ -517,10 +517,10 @@ const WRAPPER_HOISTED_OUT_BY_PARSER = new Set([
|
|
|
517
517
|
"span"
|
|
518
518
|
]);
|
|
519
519
|
export function scopeOnRootElement(html, attrs) {
|
|
520
|
-
const opening = html.match(
|
|
520
|
+
const leadingLen = skipLeadingHtmlTrivia(html), opening = html.slice(leadingLen).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);
|
|
521
521
|
if (!opening)
|
|
522
522
|
return null;
|
|
523
|
-
const tag = opening[
|
|
523
|
+
const tag = opening[1].toLowerCase();
|
|
524
524
|
if (!WRAPPER_HOISTED_OUT_BY_PARSER.has(tag))
|
|
525
525
|
return null;
|
|
526
526
|
const matcher = new RegExp(`<\\/?${tag}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`, "iy"), tokens = scanAtElementPosition(html, (source, index) => {
|
|
@@ -543,7 +543,7 @@ export function scopeOnRootElement(html, attrs) {
|
|
|
543
543
|
}
|
|
544
544
|
if (!complete)
|
|
545
545
|
return null;
|
|
546
|
-
const insertAt = opening[0].length;
|
|
546
|
+
const insertAt = leadingLen + opening[0].length;
|
|
547
547
|
return html.slice(0, insertAt) + attrs + html.slice(insertAt);
|
|
548
548
|
}
|
|
549
549
|
function isInsideFrameworkComponentsDir(dir, options) {
|
|
@@ -748,7 +748,7 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
|
|
|
748
748
|
for (const dir of options.additionalComponentsDirs ?? [])
|
|
749
749
|
if (dir && !searchDirs.includes(dir))
|
|
750
750
|
searchDirs.push(dir);
|
|
751
|
-
const checkedControl = options._nativeHostAttrs && /^(?:checkbox|switch)$/i.test(baseName), eventNames = (renderMetadata?.events ?? []).map((name) => name.replace(/^@/, "").split(".")[0].toLowerCase().replace(/-/g, "")), usesChecked = Object.hasOwn(props, "checked") || Boolean(renderMetadata?.reactiveProps?.includes("checked")), usesValue = Object.hasOwn(props, "value") || Boolean(renderMetadata?.reactiveProps?.includes("value")), sharedCheckedUsage = !eventNames.includes("valuechange") && (usesChecked || eventNames.includes("change") && !usesValue), textInput = options._nativeHostAttrs && /^textinput$/i.test(baseName), sharedTextInputUsage = eventNames.includes("update:value") && !eventNames.includes("input"), video = options._nativeHostAttrs && /^video$/i.test(baseName), image = options._nativeHostAttrs && /^image$/i.test(baseName), sharedImageUsage = usesSharedImageApi([...Object.keys(props), ...renderMetadata?.reactiveProps ?? []], renderMetadata?.events, props), usesSrc = Object.hasOwn(props, "src") || Boolean(renderMetadata?.reactiveProps?.includes("src")), usesSource = Object.hasOwn(props, "source") || Boolean(renderMetadata?.reactiveProps?.includes("source")), sharedVideoUsage = video && (usesSrc || usesSource) && (renderMetadata?.events ?? []).every((event) => /^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(event.replace(/^@/, "").split(".")[0])), sharedButtonVariants = new Set(["", "primary", "secondary", "outline", "ghost", "danger"]), buttonVariant = typeof props.variant === "string" ? props.variant.trim().toLowerCase() : "", nativeButtonUsage = options._nativeHostAttrs && /^button$/i.test(baseName) && !sharedButtonVariants.has(buttonVariant),
|
|
751
|
+
const checkedControl = options._nativeHostAttrs && /^(?:checkbox|switch)$/i.test(baseName), eventNames = (renderMetadata?.events ?? []).map((name) => name.replace(/^@/, "").split(".")[0].toLowerCase().replace(/-/g, "")), usesChecked = Object.hasOwn(props, "checked") || Boolean(renderMetadata?.reactiveProps?.includes("checked")), usesValue = Object.hasOwn(props, "value") || Boolean(renderMetadata?.reactiveProps?.includes("value")), sharedCheckedUsage = !eventNames.includes("valuechange") && (usesChecked || eventNames.includes("change") && !usesValue), textInput = options._nativeHostAttrs && /^textinput$/i.test(baseName), sharedTextInputUsage = eventNames.includes("update:value") && !eventNames.includes("input"), video = options._nativeHostAttrs && /^video$/i.test(baseName), image = options._nativeHostAttrs && /^image$/i.test(baseName), sharedImageUsage = usesSharedImageApi([...Object.keys(props), ...renderMetadata?.reactiveProps ?? []], renderMetadata?.events, props), usesSrc = Object.hasOwn(props, "src") || Boolean(renderMetadata?.reactiveProps?.includes("src")), usesSource = Object.hasOwn(props, "source") || Boolean(renderMetadata?.reactiveProps?.includes("source")), sharedVideoUsage = video && (usesSrc || usesSource) && (renderMetadata?.events ?? []).every((event) => /^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(event.replace(/^@/, "").split(".")[0])), sharedButtonVariants = new Set(["", "primary", "secondary", "outline", "ghost", "danger"]), buttonVariant = typeof props.variant === "string" ? props.variant.trim().toLowerCase() : "", nativeButtonUsage = options._nativeHostAttrs && /^button$/i.test(baseName) && !sharedButtonVariants.has(buttonVariant), nameHasSharedCounterpart = options._targetComponentFallbackNames?.some((name) => name.toLowerCase() === baseName.toLowerCase()) ?? !1, targetIsFallback = nameHasSharedCounterpart && (!checkedControl || sharedCheckedUsage) && (!textInput || sharedTextInputUsage) && (!video || sharedVideoUsage) && (!image || sharedImageUsage) && !nativeButtonUsage;
|
|
752
752
|
for (const dir of targetIsFallback ? [] : options._targetComponentDirs ?? [])
|
|
753
753
|
if (dir && !searchDirs.includes(dir))
|
|
754
754
|
searchDirs.push(dir);
|
|
@@ -763,10 +763,10 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
|
|
|
763
763
|
for (const fallback of fallbackDirs)
|
|
764
764
|
if (!searchDirs.includes(fallback))
|
|
765
765
|
searchDirs.push(fallback);
|
|
766
|
-
if (
|
|
767
|
-
const
|
|
768
|
-
if (
|
|
769
|
-
const hostDirs = searchDirs.slice(packageDirCount).map((dir) => path.isAbsolute(dir) ? dir : path.resolve(resolveBase, dir)), overrideKey = `${baseName}\x00${hostDirs.join("\x00")}`;
|
|
766
|
+
if (nameHasSharedCounterpart) {
|
|
767
|
+
const selected = (targetIsFallback ? options._pluginComponentDirs ?? [] : options._targetComponentDirs ?? []).filter((dir) => typeof dir === "string" && dir.length > 0);
|
|
768
|
+
if (selected.length) {
|
|
769
|
+
const hostDirs = searchDirs.slice(packageDirCount).map((dir) => path.isAbsolute(dir) ? dir : path.resolve(resolveBase, dir)).filter((dir) => !selected.includes(dir)), overrideKey = `${baseName}\x00${hostDirs.join("\x00")}`;
|
|
770
770
|
let overridden = convergedOverrideCache.get(overrideKey);
|
|
771
771
|
if (overridden === void 0) {
|
|
772
772
|
overridden = !1;
|
|
@@ -782,9 +782,12 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
|
|
|
782
782
|
convergedOverrideCache.set(overrideKey, overridden);
|
|
783
783
|
}
|
|
784
784
|
if (!overridden) {
|
|
785
|
-
const
|
|
786
|
-
|
|
787
|
-
|
|
785
|
+
for (const dir of selected) {
|
|
786
|
+
const at = searchDirs.indexOf(dir);
|
|
787
|
+
if (at >= 0)
|
|
788
|
+
searchDirs.splice(at, 1);
|
|
789
|
+
}
|
|
790
|
+
searchDirs.splice(packageDirCount, 0, ...selected);
|
|
788
791
|
}
|
|
789
792
|
}
|
|
790
793
|
}
|
|
@@ -1125,7 +1128,7 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
|
|
|
1125
1128
|
try {
|
|
1126
1129
|
propsJson = ` data-stx-props="${escapeAttr(JSON.stringify(props))}"`;
|
|
1127
1130
|
} catch {}
|
|
1128
|
-
const hydrateJson = hydrateTrigger ? ` stx-hydrate="${escapeAttr(hydrateTrigger)}"` : "", slotPresence = Object.fromEntries(Object.entries($slots).map(([name, content]) => [name, Boolean(content)])), slotsJson = Object.keys(slotPresence).length > 0 ? ` data-stx-slots="${escapeAttr(JSON.stringify(slotPresence))}"` : "", scopeAttrs = ` data-stx-scope="${scopeId}"${propsJson}${slotsJson}${hydrateJson}`,
|
|
1131
|
+
const hydrateJson = hydrateTrigger ? ` stx-hydrate="${escapeAttr(hydrateTrigger)}"` : "", slotPresence = Object.fromEntries(Object.entries($slots).map(([name, content]) => [name, Boolean(content)])), slotsJson = Object.keys(slotPresence).length > 0 ? ` data-stx-slots="${escapeAttr(JSON.stringify(slotPresence))}"` : "", scopeAttrs = ` data-stx-scope="${scopeId}"${propsJson}${slotsJson}${hydrateJson}`, rootContent = result.slice(skipLeadingHtmlTrivia(result)), inlineRoot = /^<span(?=[\s/>])/i.test(rootContent), layoutRoot = /^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(rootContent), fillRoot = /^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(rootContent), wrapperTag = inlineRoot ? "span" : "div", wrapperStyle = layoutRoot && options._nativeHostAttrs ? ' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"' : fillRoot && options._nativeHostAttrs ? ' style="width:100%;height:100%"' : inlineRoot || layoutRoot ? ' style="display:contents"' : "";
|
|
1129
1132
|
output = scopeOnRootElement(result, scopeAttrs) ?? `<${wrapperTag}${scopeAttrs} data-stx-component-wrapper${wrapperStyle}>${result}</${wrapperTag}>`;
|
|
1130
1133
|
const scopedScripts = await Promise.all(clientScripts.map(async (script) => {
|
|
1131
1134
|
const scriptMatch = script.match(/<script([^>]*)>([\s\S]*)<\/script>/i);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.840",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -128,12 +128,12 @@
|
|
|
128
128
|
"dependencies": {
|
|
129
129
|
"@stacksjs/ts-css": "^0.3.21",
|
|
130
130
|
"@stacksjs/clapp": "^0.2.16",
|
|
131
|
-
"@stacksjs/desktop": "0.2.
|
|
132
|
-
"@stacksjs/sanitizer": "0.2.
|
|
131
|
+
"@stacksjs/desktop": "0.2.840",
|
|
132
|
+
"@stacksjs/sanitizer": "0.2.840",
|
|
133
133
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
134
|
-
"bun-plugin-stx": "0.2.
|
|
134
|
+
"bun-plugin-stx": "0.2.840",
|
|
135
135
|
"bunfig": "^0.15.21",
|
|
136
|
-
"stx-router": "0.2.
|
|
136
|
+
"stx-router": "0.2.840",
|
|
137
137
|
"ts-broadcasting": "^0.0.11",
|
|
138
138
|
"ts-images": "^0.2.22",
|
|
139
139
|
"ts-syntax-highlighter": "^0.2.1"
|
package/dist/chunk-0a36jnq4.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Mi,Di,Li,Ng,Mg,Dg,Cl,Lg,jg}from"./chunk-dv11h4f0.js";export{Mi as ImageProcessorCache,Cl as applyTransformations,Ng as clearImageCache,Lg as generateResponsiveVariants,jg as generateSrcset,Di as getCachedImageResult,Dg as optimizeImage,Mg as processImage,Li as setCachedImageResult};
|