@ohos-ports/stacksjs-stx 0.2.287-beta.0 → 0.2.307-beta.0
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/_bun-compat.js +290 -0
- package/dist/a11y.js +5 -4
- package/dist/analyzer.js +3 -2
- package/dist/api-client.d.ts +26 -0
- package/dist/api-client.js +22 -0
- package/dist/api-handler.d.ts +6 -0
- package/dist/api-handler.js +3 -0
- package/dist/app-shell.js +20 -6
- package/dist/application-layers.d.ts +30 -0
- package/dist/application-layers.js +203 -0
- package/dist/assets.js +2 -1
- package/dist/broadcasting.js +0 -1
- package/dist/build-externalize-repeated.js +2 -1
- package/dist/build-externalize.js +2 -1
- package/dist/build-mode-detector.js +4 -3
- package/dist/build-views.js +4 -3
- package/dist/build.js +9 -1
- package/dist/builtins/icon.js +2 -1
- package/dist/builtins/image-delivery.js +75 -1
- package/dist/caching.d.ts +25 -0
- package/dist/caching.js +18 -8
- package/dist/{chunk-58f0mthg.js → chunk-09zjty4k.js} +1 -1
- package/dist/{chunk-zqqx1qaj.js → chunk-0gbptqh2.js} +1 -1
- package/dist/chunk-0mnv8pf5.js +2 -0
- package/dist/chunk-0va2vsqa.js +19 -0
- package/dist/chunk-0wwgr4wv.js +2 -0
- package/dist/chunk-18p8dqya.js +3 -0
- package/dist/chunk-1vwgywtn.js +2 -0
- package/dist/{chunk-sscwkffs.js → chunk-1ztjv7a4.js} +1 -1
- package/dist/chunk-20yc1zrp.js +43 -0
- package/dist/chunk-24bgm3hh.js +3 -0
- package/dist/chunk-2559vc7d.js +2 -0
- package/dist/chunk-286rffvb.js +8 -0
- package/dist/{chunk-de7fye10.js → chunk-2kv2gnzc.js} +1 -1
- package/dist/chunk-2pv79p7x.js +2 -0
- package/dist/chunk-2ver2s2y.js +4 -0
- package/dist/chunk-322qz0cj.js +2 -0
- package/dist/chunk-397rqs12.js +11 -0
- package/dist/{chunk-nkb3scg6.js → chunk-3by4c2g9.js} +1 -1
- package/dist/chunk-3pv0qj5f.js +2 -0
- package/dist/chunk-455m2k1y.js +2 -0
- package/dist/{chunk-5kk8gsj2.js → chunk-4ee1aaet.js} +1 -1
- package/dist/{chunk-5w1e3yxs.js → chunk-4hk5ewgp.js} +1 -1
- package/dist/chunk-4z3yyryn.js +2 -0
- package/dist/{chunk-r3ayvdz3.js → chunk-51gea48g.js} +1 -1
- package/dist/chunk-58xpr98x.js +13 -0
- package/dist/chunk-59fva5cz.js +2 -0
- package/dist/{chunk-qzkhpsam.js → chunk-5g39e9ra.js} +71 -70
- package/dist/{chunk-248e84r1.js → chunk-5tefa8qb.js} +2 -2
- package/dist/chunk-604qr43v.js +2 -0
- package/dist/{chunk-bz820epz.js → chunk-64djh88a.js} +1 -1
- package/dist/chunk-64ttktzc.js +4 -0
- package/dist/chunk-6dmrpd71.js +2 -0
- package/dist/chunk-6vt9ddra.js +2 -0
- package/dist/{chunk-2tk1zkrz.js → chunk-6xqgkfb3.js} +1 -1
- package/dist/chunk-75vxhxn1.js +2 -0
- package/dist/{chunk-1kah92n2.js → chunk-769jvq54.js} +2 -2
- package/dist/{chunk-xgnc1wy6.js → chunk-7c1qq9zq.js} +1 -1
- package/dist/{chunk-y7m2dpd3.js → chunk-7kw3grq5.js} +1 -1
- package/dist/chunk-7n6fq2t7.js +2 -0
- package/dist/chunk-7xrvkrrx.js +4409 -0
- package/dist/chunk-7yzyn9k7.js +2 -0
- package/dist/chunk-80rmf67y.js +2 -0
- package/dist/{chunk-g4vpzv6b.js → chunk-85p4dmft.js} +1 -1
- package/dist/chunk-8g6jwkjy.js +31 -0
- package/dist/chunk-8q8gj45z.js +2 -0
- package/dist/chunk-8tkn0yxq.js +2 -0
- package/dist/chunk-8wqhts61.js +18 -0
- package/dist/{chunk-54st8g2j.js → chunk-9368t9jm.js} +1 -1
- package/dist/chunk-9aw5d4rr.js +2 -0
- package/dist/{chunk-x650vjcp.js → chunk-9ebfmdyb.js} +1 -1
- package/dist/{chunk-19nfvxfw.js → chunk-a50hb40e.js} +4 -3
- package/dist/{chunk-hcq5dw7a.js → chunk-ajhrz96a.js} +1 -1
- package/dist/{chunk-8mjdpr94.js → chunk-aqrp68m6.js} +1 -1
- package/dist/{chunk-pkaabd8h.js → chunk-at84gyvf.js} +1 -1
- package/dist/{chunk-csbgwaa5.js → chunk-b8cteeha.js} +1 -1
- package/dist/chunk-ba5t40dx.js +2 -0
- package/dist/{chunk-1kms3b9d.js → chunk-bnq0p4r4.js} +1 -1
- package/dist/chunk-bzmxbz48.js +2 -0
- package/dist/{chunk-9y0g8kzt.js → chunk-c79nfdyj.js} +1 -1
- package/dist/chunk-cpsepyzg.js +4 -0
- package/dist/{chunk-xttsqmkm.js → chunk-cr8v8k53.js} +1 -1
- package/dist/chunk-czje8k8c.js +2 -0
- package/dist/chunk-d4b67e6m.js +2 -0
- package/dist/chunk-dvvx1wny.js +3 -0
- package/dist/chunk-e16hkjh9.js +2 -0
- package/dist/{chunk-t6nseeb9.js → chunk-ej8mv2k6.js} +1 -1
- package/dist/{chunk-kxzb4et3.js → chunk-f044qmn3.js} +2 -2
- package/dist/chunk-f7e286pa.js +2 -0
- package/dist/chunk-f91yrkcz.js +5 -0
- package/dist/{chunk-7q9mwh4v.js → chunk-fqq5k9ve.js} +1 -1
- package/dist/chunk-fsee2x1q.js +2 -0
- package/dist/chunk-fwdn408g.js +2 -0
- package/dist/chunk-gy3sf0fw.js +2 -0
- package/dist/chunk-h78pksyp.js +2 -0
- package/dist/chunk-hg7ptfd4.js +2 -0
- package/dist/{chunk-bfqfs07m.js → chunk-hsbrta4s.js} +11 -10
- package/dist/{chunk-dgrt76d2.js → chunk-j3ajrx2n.js} +1 -1
- package/dist/{chunk-mf4n3x1j.js → chunk-jd9nv63q.js} +1 -1
- package/dist/chunk-jwnbwemq.js +3 -0
- package/dist/chunk-k14nr7rz.js +6 -0
- package/dist/chunk-k1qzydkj.js +33 -0
- package/dist/chunk-k48jp969.js +2 -0
- package/dist/{chunk-zg75gjns.js → chunk-ka2xspj3.js} +1 -1
- package/dist/chunk-ka5wtqmw.js +4 -0
- package/dist/{chunk-y98jsjqq.js → chunk-kexk6z9s.js} +1 -1
- package/dist/chunk-kh9r3pfb.js +29 -0
- package/dist/{chunk-vrrax298.js → chunk-ksqba0cq.js} +1 -1
- package/dist/chunk-kwjgt9jx.js +2 -0
- package/dist/{chunk-hpybjwwf.js → chunk-m3a20mmb.js} +1 -1
- package/dist/chunk-mk0j30e1.js +20 -0
- package/dist/{chunk-fvhm8psm.js → chunk-msmhta0w.js} +3 -2
- package/dist/chunk-mvj75wef.js +2 -0
- package/dist/chunk-mvyadg84.js +12 -0
- package/dist/{chunk-w3ycm4na.js → chunk-mwh3ymwc.js} +3 -2
- package/dist/{chunk-ccspd3mc.js → chunk-n43zq50e.js} +1 -1
- package/dist/{chunk-nnd4wq8j.js → chunk-nnv8wytm.js} +1 -1
- package/dist/chunk-ns8fx1f9.js +5 -0
- package/dist/{chunk-jr3jp3ev.js → chunk-pcvayb2f.js} +1 -1
- package/dist/{chunk-kdh37tp8.js → chunk-pwv15j35.js} +4 -3
- package/dist/{chunk-b6ej2fdf.js → chunk-r7qap4bh.js} +249 -62
- package/dist/chunk-r8z1rexd.js +3760 -0
- package/dist/chunk-raxr83fs.js +61 -0
- package/dist/chunk-ry1key0g.js +6 -0
- package/dist/{chunk-se0p17c2.js → chunk-s3pvp8qv.js} +1 -1
- package/dist/{chunk-b8rrnqry.js → chunk-snmtft92.js} +1 -1
- package/dist/{chunk-fed3xsp9.js → chunk-t41aaehf.js} +1 -1
- package/dist/{chunk-dtq7y5ym.js → chunk-t5kwx6fa.js} +1 -1
- package/dist/chunk-ttny9g8k.js +3 -0
- package/dist/chunk-v0ne90ft.js +2 -0
- package/dist/chunk-v33qvj8y.js +2 -0
- package/dist/{chunk-acn1b56m.js → chunk-vbwq7he6.js} +4 -3
- package/dist/{chunk-74cv4ta1.js → chunk-vd5xvsnv.js} +1 -1
- package/dist/{chunk-btav940g.js → chunk-vhan24as.js} +1 -1
- package/dist/chunk-vpbw6g2t.js +2 -0
- package/dist/{chunk-k56rjjc0.js → chunk-vtd5bgt9.js} +7 -6
- package/dist/chunk-vwq4kwwj.js +4 -0
- package/dist/{chunk-866y9d8b.js → chunk-w8hkprzv.js} +338 -42
- package/dist/chunk-wbt9kz3j.js +2 -0
- package/dist/{chunk-rj4kajww.js → chunk-wm86mmgq.js} +1 -1
- package/dist/{chunk-ya386h70.js → chunk-wwghzbbg.js} +1 -1
- package/dist/chunk-xcsf7my7.js +5 -0
- package/dist/{chunk-9n0gvfrg.js → chunk-xwxdwqn9.js} +1 -1
- package/dist/{chunk-vqxmxgaj.js → chunk-xz3evxqp.js} +1 -2
- package/dist/{chunk-qy73j6m4.js → chunk-y4dd2n2n.js} +1 -1
- package/dist/{chunk-wcm80anz.js → chunk-y4nzmkea.js} +1 -1
- package/dist/{chunk-refwkt87.js → chunk-ya5m5vbn.js} +1 -1
- package/dist/{chunk-1q4y74mh.js → chunk-ybct46zd.js} +2 -2
- package/dist/chunk-ym3r8ktq.js +31 -0
- package/dist/chunk-yp0jymdz.js +2 -0
- package/dist/chunk-yyxhjfgd.js +7 -0
- package/dist/chunk-zdzd2jb4.js +4 -0
- package/dist/chunk-zr1r73p3.js +2 -0
- package/dist/cli.js +25 -26
- package/dist/client-module-registry.d.ts +36 -0
- package/dist/client-module-registry.js +56 -0
- package/dist/client-script-bundler.d.ts +58 -0
- package/dist/client-script-bundler.js +124 -24
- package/dist/client-script.d.ts +12 -0
- package/dist/client-script.js +12 -25
- package/dist/component-client-factories.js +35 -12
- package/dist/component-contract-checks.d.ts +19 -0
- package/dist/component-contract-checks.js +147 -0
- package/dist/component-contract.d.ts +20 -0
- package/dist/component-contract.js +108 -0
- package/dist/component-library.js +3 -2
- package/dist/component-model.d.ts +29 -0
- package/dist/component-model.js +59 -0
- package/dist/component-processing.js +2 -1
- package/dist/component-registry.js +7 -64
- package/dist/component-renderer.d.ts +1 -18
- package/dist/component-renderer.js +6 -233
- package/dist/component-resolution.d.ts +21 -0
- package/dist/component-resolution.js +118 -0
- package/dist/component-tags.d.ts +9 -0
- package/dist/component-tags.js +174 -0
- package/dist/composable-loader.d.ts +2 -13
- package/dist/composable-loader.js +21 -31
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/use-fetch.d.ts +117 -42
- package/dist/composables/use-fetch.js +47 -4
- package/dist/composition-api.d.ts +43 -19
- package/dist/config.d.ts +1 -1
- package/dist/config.js +46 -4
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/deploy/config-generators.js +7 -6
- package/dist/deploy/index.js +4 -3
- package/dist/deploy/netlify.js +3 -2
- package/dist/dev-server/serve-app.js +66 -26
- package/dist/dev-server/serve-file.js +17 -10
- package/dist/dev-server/serve-markdown.js +1 -1
- package/dist/dev-server/serve-multi.js +6 -6
- package/dist/dev-server/ts-css.d.ts +1 -1
- package/dist/dev-server/ts-css.js +80 -10
- package/dist/docs.js +5 -4
- package/dist/expressions.d.ts +10 -1
- package/dist/expressions.js +43 -12
- package/dist/framework-composables.js +3 -2
- package/dist/head.d.ts +12 -0
- package/dist/head.js +21 -2
- package/dist/hot-reload.js +2 -1
- package/dist/i18n.js +2 -1
- package/dist/image-optimization/auto-sibling.js +2 -1
- package/dist/image-optimization/build-plugin.js +2 -1
- package/dist/image-optimization/processor.js +7 -6
- package/dist/image-optimization/serve.js +4 -3
- package/dist/imported-signals.js +1 -1
- package/dist/includes.js +67 -24
- package/dist/index.d.ts +11 -0
- package/dist/index.js +7 -0
- package/dist/init.js +5 -4
- package/dist/inline-assets.d.ts +0 -14
- package/dist/inline-assets.js +21 -6
- package/dist/interactive.js +9 -8
- package/dist/island-chunking.js +3 -2
- package/dist/manifest.d.ts +6 -0
- package/dist/menubar.js +2 -1
- package/dist/misc-directives.d.ts +2 -0
- package/dist/misc-directives.js +39 -1
- package/dist/native-build.js +16 -15
- package/dist/plugin.js +2 -1
- package/dist/process.js +57 -19
- package/dist/production-build.js +21 -20
- package/dist/production-builder.d.ts +4 -0
- package/dist/production-builder.js +52 -12
- package/dist/production-server.d.ts +4 -1
- package/dist/production-server.js +122 -74
- package/dist/pwa/icons.js +2 -1
- package/dist/pwa/offline.js +3 -2
- package/dist/pwa.js +4 -3
- package/dist/render-memo.js +2 -1
- package/dist/render.js +12 -4
- package/dist/route-response-cache.d.ts +7 -0
- package/dist/route-response-cache.js +72 -0
- package/dist/route-rules.d.ts +17 -0
- package/dist/route-rules.js +40 -0
- package/dist/router.d.ts +1 -0
- package/dist/runtime-config-loader.d.ts +5 -0
- package/dist/runtime-config-loader.js +43 -0
- package/dist/runtime-config-server.d.ts +26 -0
- package/dist/runtime-config-server.js +77 -0
- package/dist/runtime-config-types.d.ts +2 -0
- package/dist/runtime-config-types.js +0 -0
- package/dist/runtime-config.d.ts +5 -0
- package/dist/runtime-config.js +9 -0
- package/dist/runtime-globals.js +3 -0
- package/dist/runtime-injection.js +5 -3
- package/dist/safe-evaluator.d.ts +18 -0
- package/dist/safe-evaluator.js +100 -17
- package/dist/scaffolding.js +11 -10
- package/dist/screenshot.js +2 -2
- package/dist/seo.js +59 -6
- package/dist/serve.js +41 -19
- package/dist/server-api.d.ts +27 -0
- package/dist/server-api.js +182 -0
- package/dist/server-data.d.ts +17 -0
- package/dist/server-data.js +40 -0
- package/dist/signal-processing.js +17 -17
- package/dist/signals.js +272 -39
- package/dist/site-builder/build.js +4 -3
- package/dist/spa-nav.d.ts +20 -0
- package/dist/spa-nav.js +12 -0
- package/dist/ssg.js +10 -9
- package/dist/ssr.js +4 -3
- package/dist/store-loader.js +5 -4
- package/dist/story/bun-test.js +2 -1
- package/dist/story/commands/preview.js +4 -3
- package/dist/story/server.js +3 -2
- package/dist/story/testing.js +2 -1
- package/dist/streaming.js +4 -3
- package/dist/strip-literals.d.ts +20 -0
- package/dist/strip-literals.js +16 -0
- package/dist/stx-virtual-ts.d.ts +6 -0
- package/dist/stx-virtual-ts.js +31 -7
- package/dist/stx.d.ts +28 -0
- package/dist/style-scoping.d.ts +10 -0
- package/dist/style-scoping.js +27 -9
- package/dist/template-compiler.d.ts +1 -0
- package/dist/template-compiler.js +3 -3
- package/dist/template-hydrator.js +15 -4
- package/dist/typecheck.d.ts +1 -0
- package/dist/typecheck.js +9 -7
- package/dist/types/config-types.d.ts +37 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/utils.js +38 -14
- package/dist/variable-extractor.d.ts +1 -1
- package/dist/variable-extractor.js +12 -1
- package/dist/visual-testing.js +5 -4
- package/dist/vue-template.js +19 -41
- package/dist/web-components.js +4 -3
- package/package.json +40 -15
- package/stx.d.ts +28 -0
- package/vendor/ts-broadcasting/LICENSE.md +21 -0
- package/vendor/ts-broadcasting/README.md +448 -0
- package/vendor/ts-broadcasting/bin/cli.ts +182 -0
- package/vendor/ts-broadcasting/dist/acknowledgments.d.ts +31 -0
- package/vendor/ts-broadcasting/dist/batch-operations.d.ts +28 -0
- package/vendor/ts-broadcasting/dist/bin/cli.js +43 -0
- package/vendor/ts-broadcasting/dist/broadcaster.d.ts +34 -0
- package/vendor/ts-broadcasting/dist/channel-state.d.ts +32 -0
- package/vendor/ts-broadcasting/dist/channels.d.ts +17 -0
- package/vendor/ts-broadcasting/dist/chunk-1z2ckqvx.js +4 -0
- package/vendor/ts-broadcasting/dist/chunk-2yrq7kae.js +3 -0
- package/vendor/ts-broadcasting/dist/chunk-5443dbw9.js +62 -0
- package/vendor/ts-broadcasting/dist/chunk-6p05scqc.js +2 -0
- package/vendor/ts-broadcasting/dist/chunk-cf2bp0yb.js +2 -0
- package/vendor/ts-broadcasting/dist/chunk-xryaymj8.js +3 -0
- package/vendor/ts-broadcasting/dist/circuit-breaker.d.ts +49 -0
- package/vendor/ts-broadcasting/dist/client/index.d.ts +138 -0
- package/vendor/ts-broadcasting/dist/config.d.ts +5 -0
- package/vendor/ts-broadcasting/dist/encryption.d.ts +18 -0
- package/vendor/ts-broadcasting/dist/facade.d.ts +81 -0
- package/vendor/ts-broadcasting/dist/helpers.d.ts +34 -0
- package/vendor/ts-broadcasting/dist/index.d.ts +56 -0
- package/vendor/ts-broadcasting/dist/lifecycle-hooks.d.ts +25 -0
- package/vendor/ts-broadcasting/dist/load-management.d.ts +28 -0
- package/vendor/ts-broadcasting/dist/message-deduplication.d.ts +19 -0
- package/vendor/ts-broadcasting/dist/metrics/prometheus.d.ts +31 -0
- package/vendor/ts-broadcasting/dist/middleware.d.ts +79 -0
- package/vendor/ts-broadcasting/dist/persistence.d.ts +21 -0
- package/vendor/ts-broadcasting/dist/presence-heartbeat.d.ts +27 -0
- package/vendor/ts-broadcasting/dist/queue-manager.d.ts +93 -0
- package/vendor/ts-broadcasting/dist/redis-adapter.d.ts +41 -0
- package/vendor/ts-broadcasting/dist/server.d.ts +85 -0
- package/vendor/ts-broadcasting/dist/src/index.js +2 -0
- package/vendor/ts-broadcasting/dist/types.d.ts +192 -0
- package/vendor/ts-broadcasting/dist/webhooks.d.ts +34 -0
- package/vendor/ts-broadcasting/package.json +44 -0
- package/dist/bun-shim.js +0 -496
- package/dist/chunk-122tyfre.js +0 -2
- package/dist/chunk-24ps8kft.js +0 -2
- package/dist/chunk-2et5hxfv.js +0 -2
- package/dist/chunk-2r1rd8f0.js +0 -2
- package/dist/chunk-38ejahd9.js +0 -3
- package/dist/chunk-3zv4wz87.js +0 -2
- package/dist/chunk-4122k1bh.js +0 -2
- package/dist/chunk-45az9zht.js +0 -2
- package/dist/chunk-4qr85f07.js +0 -2
- package/dist/chunk-4ww3znrr.js +0 -15
- package/dist/chunk-5a19dhx5.js +0 -2
- package/dist/chunk-6gdycmxr.js +0 -2
- package/dist/chunk-6hmnaza7.js +0 -4473
- package/dist/chunk-71t0yan0.js +0 -5
- package/dist/chunk-74v15e8z.js +0 -2
- package/dist/chunk-7b329e5v.js +0 -3
- package/dist/chunk-8fwerspy.js +0 -2
- package/dist/chunk-92mj1t26.js +0 -60
- package/dist/chunk-9b22663r.js +0 -2
- package/dist/chunk-9hjdgm4d.js +0 -2
- package/dist/chunk-9wr7zcad.js +0 -18
- package/dist/chunk-a0nfbmeh.js +0 -3
- package/dist/chunk-awkq3xfx.js +0 -2
- package/dist/chunk-bs6kapy7.js +0 -2
- package/dist/chunk-d8t4sjsp.js +0 -2
- package/dist/chunk-dap191q2.js +0 -2
- package/dist/chunk-dhh5q7qt.js +0 -3
- package/dist/chunk-dsffsqnt.js +0 -2
- package/dist/chunk-ferav3bw.js +0 -19
- package/dist/chunk-g9csmj0s.js +0 -2
- package/dist/chunk-gtcrpmz1.js +0 -2
- package/dist/chunk-h4xh8cms.js +0 -4
- package/dist/chunk-h8yqsz9m.js +0 -2
- package/dist/chunk-hm0xha6c.js +0 -12
- package/dist/chunk-jegt35zh.js +0 -2
- package/dist/chunk-mkd9kjgb.js +0 -3
- package/dist/chunk-mxfh1nxg.js +0 -2
- package/dist/chunk-n3ggrhb3.js +0 -3
- package/dist/chunk-nsp1cw38.js +0 -11
- package/dist/chunk-nx5qkm8k.js +0 -30
- package/dist/chunk-p3242nck.js +0 -2
- package/dist/chunk-p98kfh94.js +0 -2
- package/dist/chunk-pzm13sdc.js +0 -3
- package/dist/chunk-q4p5k2p3.js +0 -2
- package/dist/chunk-qpyjak7z.js +0 -2
- package/dist/chunk-qr82je1m.js +0 -22
- package/dist/chunk-r7r66978.js +0 -2
- package/dist/chunk-rbb7dvja.js +0 -30
- package/dist/chunk-rp4rjjmf.js +0 -2
- package/dist/chunk-sj9pmene.js +0 -2
- package/dist/chunk-svpqxn2c.js +0 -2
- package/dist/chunk-t8y1ggdy.js +0 -2
- package/dist/chunk-tndhnk9e.js +0 -2
- package/dist/chunk-v5e1gxwm.js +0 -3
- package/dist/chunk-wrzwgkbx.js +0 -22
- package/dist/chunk-xpp135ad.js +0 -11
- package/dist/chunk-y11cxbxd.js +0 -3757
- package/dist/chunk-ydrz60kr.js +0 -2
- package/dist/chunk-ypmqf7tm.js +0 -4
- package/dist/chunk-z4jhj5e5.js +0 -28
- package/dist/{chunk-qc1f74ek.js → chunk-jryjwara.js} +1 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import * as __bunCompat from "./_bun-compat.js";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
const resourceKeys = ["pages", "components", "layouts", "partials", "composables"], configSources = new Set;
|
|
6
|
+
export function isLayerConfigSource(file) {
|
|
7
|
+
try {
|
|
8
|
+
return configSources.has(fs.realpathSync(file));
|
|
9
|
+
} catch {
|
|
10
|
+
return configSources.has(path.resolve(file));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const localKeys = new Set(["extends", "root", ...resourceKeys.map((key) => `${key}Dir`), "publicDir", "stateDir", "cachePath"]), plain = (value) => value !== null && typeof value === "object" && (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
|
|
14
|
+
export function mergeLayerConfig(base, override, key = "") {
|
|
15
|
+
if (Array.isArray(override))
|
|
16
|
+
return ["middleware", "plugins"].includes(key) ? [...Array.isArray(base) ? base : [], ...override] : [...override];
|
|
17
|
+
if (!plain(override))
|
|
18
|
+
return override;
|
|
19
|
+
const out = { ...plain(base) ? base : {} };
|
|
20
|
+
for (const [name, value] of Object.entries(override)) {
|
|
21
|
+
if (["__proto__", "constructor", "prototype"].includes(name))
|
|
22
|
+
throw Error(`Invalid layer config key: ${name}`);
|
|
23
|
+
out[name] = mergeLayerConfig(out[name], value, name);
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
function findConfig(root) {
|
|
28
|
+
for (const name of ["stx.config.ts", "stx.config.js", "stx.config.mjs", ".config/stx.config.ts", ".config/stx.ts", "ui.config.ts"]) {
|
|
29
|
+
const file = path.join(root, name);
|
|
30
|
+
if (fs.existsSync(file))
|
|
31
|
+
return fs.realpathSync(file);
|
|
32
|
+
}
|
|
33
|
+
throw Error(`Application layer has no stx.config.ts: ${root}`);
|
|
34
|
+
}
|
|
35
|
+
function resolveLayer(specifier, parent, dependencies) {
|
|
36
|
+
if (typeof specifier !== "string" || !specifier || /^(?:https?:|git[+:])/.test(specifier))
|
|
37
|
+
throw Error(`Invalid application layer ${JSON.stringify(specifier)} in ${parent}; use a local path or installed package`);
|
|
38
|
+
if (specifier.startsWith(".") || path.isAbsolute(specifier)) {
|
|
39
|
+
const resolved = path.resolve(parent, specifier);
|
|
40
|
+
return fs.statSync(resolved).isDirectory() ? findConfig(resolved) : fs.realpathSync(resolved);
|
|
41
|
+
}
|
|
42
|
+
let directory = parent;
|
|
43
|
+
while (!0) {
|
|
44
|
+
const candidate = path.join(directory, "node_modules", specifier), pkg = path.join(candidate, "package.json");
|
|
45
|
+
if (fs.existsSync(pkg)) {
|
|
46
|
+
dependencies.add(fs.realpathSync(pkg));
|
|
47
|
+
const metadata = JSON.parse(fs.readFileSync(pkg, "utf8"));
|
|
48
|
+
return metadata.stx?.layer ? fs.realpathSync(path.resolve(candidate, metadata.stx.layer)) : findConfig(candidate);
|
|
49
|
+
}
|
|
50
|
+
const next = path.dirname(directory);
|
|
51
|
+
if (next === directory)
|
|
52
|
+
break;
|
|
53
|
+
directory = next;
|
|
54
|
+
}
|
|
55
|
+
throw Error(`Cannot resolve application layer ${JSON.stringify(specifier)} from ${parent}`);
|
|
56
|
+
}
|
|
57
|
+
async function readConfig(file, dependencies) {
|
|
58
|
+
const build = await Bun.build({
|
|
59
|
+
entrypoints: [file],
|
|
60
|
+
target: "bun",
|
|
61
|
+
format: "esm",
|
|
62
|
+
splitting: !1,
|
|
63
|
+
plugins: [{ name: "stx-layer-config", setup(builder) {
|
|
64
|
+
builder.onResolve({ filter: /^[^./]/ }, (args) => {
|
|
65
|
+
if (args.path.startsWith("node:"))
|
|
66
|
+
return { path: args.path, external: !0 };
|
|
67
|
+
return { path: Bun.resolveSync(args.path, args.resolveDir), external: !0 };
|
|
68
|
+
});
|
|
69
|
+
builder.onLoad({ filter: /./ }, (args) => {
|
|
70
|
+
const file = fs.realpathSync(args.path);
|
|
71
|
+
dependencies.add(file);
|
|
72
|
+
configSources.add(file);
|
|
73
|
+
return;
|
|
74
|
+
});
|
|
75
|
+
} }]
|
|
76
|
+
});
|
|
77
|
+
if (!build.success)
|
|
78
|
+
throw Error(`Cannot load layer ${file}: ${build.logs.join(`
|
|
79
|
+
`)}`);
|
|
80
|
+
const output = build.outputs.find((item) => item.kind === "entry-point");
|
|
81
|
+
if (!output || build.outputs.length !== 1)
|
|
82
|
+
throw Error(`Unsupported layer config output: ${file}`);
|
|
83
|
+
const loaded = (await import(`data:text/javascript;base64,${Buffer.from(await output.text()).toString("base64")}`)).default;
|
|
84
|
+
if (!plain(loaded))
|
|
85
|
+
throw Error(`Layer ${file} must default-export a config object`);
|
|
86
|
+
return loaded;
|
|
87
|
+
}
|
|
88
|
+
export async function resolveApplicationLayers(appRoot, defaults) {
|
|
89
|
+
const dependencies = new Set, layers = [], configs = [], seen = new Set, active = [];
|
|
90
|
+
async function visit(file, root) {
|
|
91
|
+
file = fs.realpathSync(file);
|
|
92
|
+
if (active.includes(file))
|
|
93
|
+
throw Error(`Application layer cycle: ${[...active, file].join(" -> ")}`);
|
|
94
|
+
if (seen.has(file))
|
|
95
|
+
return;
|
|
96
|
+
seen.add(file);
|
|
97
|
+
active.push(file);
|
|
98
|
+
const declared = await readConfig(file, dependencies);
|
|
99
|
+
root ??= path.basename(path.dirname(file)) === ".config" ? path.dirname(path.dirname(file)) : path.dirname(file);
|
|
100
|
+
root = fs.realpathSync(root);
|
|
101
|
+
const base = path.resolve(root, declared.root ?? "."), resources = Object.fromEntries(resourceKeys.map((name) => [name, path.resolve(base, declared[`${name}Dir`] ?? (name === "composables" ? "functions" : name))]));
|
|
102
|
+
layers.push({ root, configFile: file, resources });
|
|
103
|
+
const config = { ...declared };
|
|
104
|
+
if (config.plugins)
|
|
105
|
+
config.plugins = config.plugins.map((entry) => {
|
|
106
|
+
const spec = typeof entry === "string" ? entry : entry[0], resolved = spec.startsWith(".") ? path.resolve(root, spec) : path.isAbsolute(spec) ? spec : Bun.resolveSync(spec, root);
|
|
107
|
+
dependencies.add(fs.realpathSync(resolved));
|
|
108
|
+
return typeof entry === "string" ? resolved : [resolved, entry[1]];
|
|
109
|
+
});
|
|
110
|
+
if (typeof config.css === "string")
|
|
111
|
+
config.css = path.resolve(root, config.css);
|
|
112
|
+
if (config.serverApi)
|
|
113
|
+
config.serverApi = { ...typeof config.serverApi === "object" ? config.serverApi : {}, dir: path.resolve(root, typeof config.serverApi === "object" ? config.serverApi.dir ?? "server/api" : "server/api") };
|
|
114
|
+
configs.push(config);
|
|
115
|
+
if (declared.extends !== void 0 && !Array.isArray(declared.extends))
|
|
116
|
+
throw Error(`extends in ${file} must be an array`);
|
|
117
|
+
for (const spec of declared.extends ?? [])
|
|
118
|
+
await visit(resolveLayer(spec, root, dependencies));
|
|
119
|
+
active.pop();
|
|
120
|
+
}
|
|
121
|
+
await visit(findConfig(appRoot), appRoot);
|
|
122
|
+
for (const name of ["package.json", "bun.lock", "package-lock.json", "pnpm-lock.yaml"]) {
|
|
123
|
+
const file = path.join(appRoot, name);
|
|
124
|
+
if (fs.existsSync(file))
|
|
125
|
+
dependencies.add(fs.realpathSync(file));
|
|
126
|
+
}
|
|
127
|
+
let config = mergeLayerConfig({}, defaults);
|
|
128
|
+
for (let i = configs.length - 1;i >= 0; i--) {
|
|
129
|
+
const values = i === 0 ? configs[i] : Object.fromEntries(Object.entries(configs[i]).filter(([key]) => !localKeys.has(key)));
|
|
130
|
+
config = mergeLayerConfig(config, values);
|
|
131
|
+
}
|
|
132
|
+
const graph = { layers, configDependencies: [...dependencies].sort() };
|
|
133
|
+
config._layerGraph = graph;
|
|
134
|
+
config._layerPageDirs = layers.map((layer) => layer.resources.pages);
|
|
135
|
+
config._layerComponentDirs = layers.map((layer) => layer.resources.components);
|
|
136
|
+
config._layerLayoutDirs = layers.map((layer) => layer.resources.layouts);
|
|
137
|
+
config._layerPartialDirs = layers.map((layer) => layer.resources.partials);
|
|
138
|
+
config._layerComposableDirs = layers.map((layer) => layer.resources.composables);
|
|
139
|
+
await refreshLayerDiagnostics(graph, appRoot);
|
|
140
|
+
return { config, graph };
|
|
141
|
+
}
|
|
142
|
+
export async function refreshLayerDiagnostics(graph, appRoot) {
|
|
143
|
+
const selected = new Map, overrides = [];
|
|
144
|
+
for (const layer of graph.layers)
|
|
145
|
+
for (const [kind, dir] of Object.entries(layer.resources)) {
|
|
146
|
+
if (!fs.existsSync(dir))
|
|
147
|
+
continue;
|
|
148
|
+
const glob = new __bunCompat.Glob(kind === "composables" ? "**/*.ts" : "**/*.stx");
|
|
149
|
+
for (const relative of [...glob.scanSync({ cwd: dir })].sort()) {
|
|
150
|
+
const resource = `${kind}/${relative}`, file = path.join(dir, relative), winner = selected.get(resource);
|
|
151
|
+
if (winner)
|
|
152
|
+
overrides.push({ resource, winner, shadowed: file });
|
|
153
|
+
else
|
|
154
|
+
selected.set(resource, file);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
Object.assign(graph, { overrides });
|
|
158
|
+
await __bunCompat.write(path.join(appRoot, ".stx/layers.json"), JSON.stringify(graph, null, 2));
|
|
159
|
+
}
|
|
160
|
+
export function layerDependencies(graph) {
|
|
161
|
+
const files = new Set(graph.configDependencies);
|
|
162
|
+
function walk(dir) {
|
|
163
|
+
if (!fs.existsSync(dir))
|
|
164
|
+
return;
|
|
165
|
+
files.add(dir);
|
|
166
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: !0 }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
167
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules")
|
|
168
|
+
continue;
|
|
169
|
+
const file = path.join(dir, entry.name);
|
|
170
|
+
if (entry.isDirectory())
|
|
171
|
+
walk(file);
|
|
172
|
+
else if (entry.isFile())
|
|
173
|
+
files.add(file);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
for (const layer of graph.layers)
|
|
177
|
+
for (const dir of Object.values(layer.resources))
|
|
178
|
+
walk(dir);
|
|
179
|
+
return [...files].sort();
|
|
180
|
+
}
|
|
181
|
+
export function layerSignature(graph) {
|
|
182
|
+
return fileSignature(layerDependencies(graph));
|
|
183
|
+
}
|
|
184
|
+
export function layerConfigSignature(graph) {
|
|
185
|
+
return fileSignature(graph.configDependencies);
|
|
186
|
+
}
|
|
187
|
+
function fileSignature(files) {
|
|
188
|
+
return files.map((file) => {
|
|
189
|
+
try {
|
|
190
|
+
const stat = fs.statSync(file);
|
|
191
|
+
return `${file}:${stat.mtimeMs}:${stat.size}`;
|
|
192
|
+
} catch {
|
|
193
|
+
return `${file}:missing`;
|
|
194
|
+
}
|
|
195
|
+
}).join(`
|
|
196
|
+
`);
|
|
197
|
+
}
|
|
198
|
+
export function layerManifest(graph) {
|
|
199
|
+
return graph.layers.map((layer) => ({
|
|
200
|
+
config: path.relative(layer.root, layer.configFile),
|
|
201
|
+
files: layerDependencies({ layers: [layer], configDependencies: graph.configDependencies.filter((file) => file.startsWith(`${layer.root}${path.sep}`)) }).filter((file) => fs.statSync(file).isFile()).map((file) => ({ path: path.relative(layer.root, file).replaceAll(path.sep, "/"), sha256: createHash("sha256").update(fs.readFileSync(file)).digest("hex") }))
|
|
202
|
+
}));
|
|
203
|
+
}
|
package/dist/assets.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as __bunCompat from "./_bun-compat.js";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { createHighlighter } from "ts-syntax-highlighter";
|
|
@@ -18,7 +19,7 @@ export async function readMarkdownFile(filePath, options = {}) {
|
|
|
18
19
|
data: cached.data
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
const fileContent = await
|
|
22
|
+
const fileContent = await __bunCompat.file(filePath).text(), { data, content: markdownContent } = parseFrontmatter(fileContent), markdownConfig = options.markdown || config.markdown || {
|
|
22
23
|
enabled: !0,
|
|
23
24
|
syntaxHighlighting: {
|
|
24
25
|
enabled: !0,
|
package/dist/broadcasting.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import * as __bunCompat from "./_bun-compat.js";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { EXTERNALIZED_ASSET_DIR } from "./build-externalize.js";
|
|
4
5
|
const MIN_BLOB_BYTES = 1024, INLINE_BLOB = /<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi, JS_TYPES = new Set(["", "module", "text/javascript", "application/javascript", "module/javascript"]);
|
|
5
6
|
function contentHash(source) {
|
|
6
|
-
return
|
|
7
|
+
return __bunCompat.hash(source).toString(16).slice(0, 8);
|
|
7
8
|
}
|
|
8
9
|
function listHtmlFiles(dir) {
|
|
9
10
|
const found = [], walk = (current) => {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import * as __bunCompat from "./_bun-compat.js";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
export const EXTERNALIZED_ASSET_DIR = "_stx";
|
|
4
5
|
function contentHash(source) {
|
|
5
|
-
return
|
|
6
|
+
return __bunCompat.hash(source).toString(16).slice(0, 8);
|
|
6
7
|
}
|
|
7
8
|
function listHtmlFiles(dir) {
|
|
8
9
|
const found = [], walk = (current) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as __bunCompat from "./_bun-compat.js";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { loadStxConfig } from "./config.js";
|
|
3
4
|
const SERVER_SCRIPT_RE = /<script\b[^>]*\bserver\b/i, CLIENT_SCRIPT_RE = /<script\b[^>]*\bclient\b/i;
|
|
@@ -13,7 +14,7 @@ export async function detectBuildMode(root) {
|
|
|
13
14
|
const stxFiles = await collectStxFiles(dir);
|
|
14
15
|
for (const file of stxFiles) {
|
|
15
16
|
totalFilesScanned++;
|
|
16
|
-
const content = await
|
|
17
|
+
const content = await __bunCompat.file(file).text();
|
|
17
18
|
if (SERVER_SCRIPT_RE.test(content))
|
|
18
19
|
serverScriptFiles.push(path.relative(projectRoot, file));
|
|
19
20
|
}
|
|
@@ -28,7 +29,7 @@ export async function detectBuildMode(root) {
|
|
|
28
29
|
export async function validateComponentScripts(root) {
|
|
29
30
|
const config = await loadStxConfig(root), projectRoot = root || config.root || process.cwd(), componentsDir = path.resolve(projectRoot, config.componentsDir || "components"), errors = [], stxFiles = await collectStxFiles(componentsDir);
|
|
30
31
|
for (const file of stxFiles) {
|
|
31
|
-
const content = await
|
|
32
|
+
const content = await __bunCompat.file(file).text(), hasServer = SERVER_SCRIPT_RE.test(content), hasClient = CLIENT_SCRIPT_RE.test(content) || /<script\b(?![^>]*\bserver\b)[^>]*>/i.test(content) && !hasServer;
|
|
32
33
|
if (hasServer && hasClient) {
|
|
33
34
|
const relative = path.relative(projectRoot, file);
|
|
34
35
|
errors.push({
|
|
@@ -42,7 +43,7 @@ export async function validateComponentScripts(root) {
|
|
|
42
43
|
async function collectStxFiles(dir) {
|
|
43
44
|
const files = [];
|
|
44
45
|
try {
|
|
45
|
-
const glob = new
|
|
46
|
+
const glob = new __bunCompat.Glob("**/*.stx");
|
|
46
47
|
for await (const file of glob.scan({ cwd: dir, absolute: !0 }))
|
|
47
48
|
files.push(file);
|
|
48
49
|
} catch {}
|
package/dist/build-views.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import { file, write } from "./_bun-compat.js";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { extractVariables } from "./variable-extractor.js";
|
|
4
5
|
import { defaultConfig } from "./config.js";
|
|
5
6
|
import { processDirectives } from "./process.js";
|
|
6
7
|
export async function renderView(templatePath, props = {}, options = {}) {
|
|
7
|
-
const content = await
|
|
8
|
+
const content = await file(templatePath).text(), scriptMatch = content.match(/<script\s+server\s*>([\s\S]*?)<\/script>/i), scriptContent = scriptMatch ? scriptMatch[1] : "";
|
|
8
9
|
let templateContent = scriptMatch ? content.replace(/<script\s+server\s*>[\s\S]*?<\/script>/i, "") : content;
|
|
9
10
|
templateContent = templateContent.replace(/<script\s+client\s*>/gi, "<script>");
|
|
10
11
|
const context = {
|
|
@@ -66,7 +67,7 @@ export async function buildViews(options) {
|
|
|
66
67
|
...view.props,
|
|
67
68
|
...placeholders
|
|
68
69
|
}, html = await renderView(inputPath, props, stxOptions);
|
|
69
|
-
await
|
|
70
|
+
await write(outputPath, html);
|
|
70
71
|
result.views.push(outputName);
|
|
71
72
|
} catch (error) {
|
|
72
73
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -83,7 +84,7 @@ export async function buildViews(options) {
|
|
|
83
84
|
placeholders,
|
|
84
85
|
errors: result.errors.length > 0 ? result.errors : void 0
|
|
85
86
|
};
|
|
86
|
-
await
|
|
87
|
+
await write(path.join(outputDir, "manifest.json"), JSON.stringify(manifest, null, 2));
|
|
87
88
|
}
|
|
88
89
|
result.duration = performance.now() - startTime;
|
|
89
90
|
if (debug)
|
package/dist/build.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { loadStxConfig } from "./config.js";
|
|
3
|
+
import { validateRouteRules } from "./route-rules.js";
|
|
3
4
|
export async function buildApp(options = {}) {
|
|
4
|
-
const startTime = performance.now(), root = options.root || process.cwd(), config = await loadStxConfig(),
|
|
5
|
+
const startTime = performance.now(), root = options.root || process.cwd(), config = await loadStxConfig(root), rules = options.ssr?.routeRules ?? config.routeRules ?? {};
|
|
6
|
+
validateRouteRules(rules);
|
|
7
|
+
if (!config.ssr && Object.keys(rules).length)
|
|
8
|
+
throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");
|
|
9
|
+
if (!config.ssr && (options.ssr?.serverApi ?? config.serverApi))
|
|
10
|
+
throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");
|
|
11
|
+
const mode = config.ssr ? "ssr" : "ssg";
|
|
5
12
|
console.log(`[stx build] Mode: ${mode.toUpperCase()}${config.ssr ? " (ssr: true in stx.config.ts)" : " (default \u2014 ssr is false)"}`);
|
|
6
13
|
let ssgResult, ssrResult;
|
|
7
14
|
if (mode === "ssg") {
|
|
@@ -19,6 +26,7 @@ export async function buildApp(options = {}) {
|
|
|
19
26
|
} else {
|
|
20
27
|
const { buildForProduction } = await import("./production-builder.js");
|
|
21
28
|
ssrResult = await buildForProduction({
|
|
29
|
+
root,
|
|
22
30
|
outputDir: ".output",
|
|
23
31
|
debug: options.debug,
|
|
24
32
|
...options.ssr
|
package/dist/builtins/icon.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as __bunCompat from "../_bun-compat.js";
|
|
1
2
|
var {require}=import.meta;import { escapeAttr } from "./escape.js";
|
|
2
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
4
|
const collectionCache = new Map, warnedMissingCollections = new Set;
|
|
@@ -52,7 +53,7 @@ async function loadCollection(prefix, speculative = !1) {
|
|
|
52
53
|
return null;
|
|
53
54
|
}
|
|
54
55
|
try {
|
|
55
|
-
const data = await
|
|
56
|
+
const data = await __bunCompat.file(jsonPath).json();
|
|
56
57
|
collectionCache.set(prefix, data.icons);
|
|
57
58
|
return data.icons;
|
|
58
59
|
} catch {
|
|
@@ -12,6 +12,30 @@ function catalogName(relativePath) {
|
|
|
12
12
|
const extension = path.extname(relativePath), readable = relativePath.slice(0, -extension.length).replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, ""), pathHash = createHash("sha256").update(relativePath).digest("hex").slice(0, 8);
|
|
13
13
|
return `${readable || "image"}-${pathHash}`;
|
|
14
14
|
}
|
|
15
|
+
function deliveryStorage(outDir) {
|
|
16
|
+
const url = (key) => `${DELIVERY_URL}/${key.split("/").map(encodeURIComponent).join("/")}`;
|
|
17
|
+
return {
|
|
18
|
+
cacheNamespace: `stx:${DELIVERY_URL}`,
|
|
19
|
+
async stat(key) {
|
|
20
|
+
const file = path.join(outDir, key);
|
|
21
|
+
try {
|
|
22
|
+
const stats = await fs.promises.stat(file);
|
|
23
|
+
return stats.size > 0 ? { bytes: stats.size, path: file, url: url(key) } : null;
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
async write(key, bytes) {
|
|
29
|
+
const file = path.join(outDir, key);
|
|
30
|
+
await fs.promises.mkdir(path.dirname(file), { recursive: !0 });
|
|
31
|
+
const pending = `${file}.${process.pid}.tmp`;
|
|
32
|
+
await fs.promises.writeFile(pending, bytes);
|
|
33
|
+
await fs.promises.rename(pending, file);
|
|
34
|
+
return { bytes: bytes.byteLength, path: file, url: url(key) };
|
|
35
|
+
},
|
|
36
|
+
url
|
|
37
|
+
};
|
|
38
|
+
}
|
|
15
39
|
async function collectRasterImages(root, directory = root) {
|
|
16
40
|
const entries = await fs.promises.readdir(directory, { withFileTypes: !0 });
|
|
17
41
|
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -51,6 +75,31 @@ async function decodableFiles(files) {
|
|
|
51
75
|
}
|
|
52
76
|
return supported;
|
|
53
77
|
}
|
|
78
|
+
function undecodableCachePath(outputDir) {
|
|
79
|
+
return path.join(outputDir, "undecodable.json");
|
|
80
|
+
}
|
|
81
|
+
function readUndecodableCache(outputDir) {
|
|
82
|
+
try {
|
|
83
|
+
const raw = fs.readFileSync(undecodableCachePath(outputDir), "utf-8"), parsed = JSON.parse(raw);
|
|
84
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
85
|
+
} catch {
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function writeUndecodableCache(outputDir, cache) {
|
|
90
|
+
try {
|
|
91
|
+
fs.mkdirSync(path.dirname(undecodableCachePath(outputDir)), { recursive: !0 });
|
|
92
|
+
fs.writeFileSync(undecodableCachePath(outputDir), JSON.stringify(cache));
|
|
93
|
+
} catch {}
|
|
94
|
+
}
|
|
95
|
+
function statIdentity(absolutePath) {
|
|
96
|
+
try {
|
|
97
|
+
const stats = fs.statSync(absolutePath);
|
|
98
|
+
return { mtimeMs: stats.mtimeMs, size: stats.size };
|
|
99
|
+
} catch {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
54
103
|
function normalizeLookupSource(src) {
|
|
55
104
|
if (!src || src.startsWith("data:") || src.startsWith("blob:") || /^https?:\/\//i.test(src) || src.startsWith("//"))
|
|
56
105
|
return;
|
|
@@ -75,13 +124,25 @@ export async function prepareImageDelivery(publicDir, outputDir) {
|
|
|
75
124
|
clearImageDeliveryCatalog();
|
|
76
125
|
return { count: 0, fingerprint: "" };
|
|
77
126
|
}
|
|
78
|
-
const
|
|
127
|
+
const allFiles = await collectRasterImages(publicDir);
|
|
128
|
+
if (allFiles.length === 0) {
|
|
129
|
+
clearImageDeliveryCatalog();
|
|
130
|
+
return { count: 0, fingerprint: "" };
|
|
131
|
+
}
|
|
132
|
+
const undecodable = readUndecodableCache(outputDir), files = allFiles.filter((file) => {
|
|
133
|
+
const known = undecodable[file.relativePath];
|
|
134
|
+
if (!known)
|
|
135
|
+
return !0;
|
|
136
|
+
const identity = statIdentity(file.absolutePath);
|
|
137
|
+
return !identity || identity.mtimeMs !== known.mtimeMs || identity.size !== known.size;
|
|
138
|
+
});
|
|
79
139
|
if (files.length === 0) {
|
|
80
140
|
clearImageDeliveryCatalog();
|
|
81
141
|
return { count: 0, fingerprint: "" };
|
|
82
142
|
}
|
|
83
143
|
const catalogOptions = {
|
|
84
144
|
outDir: path.join(outputDir, "_stx", "images"),
|
|
145
|
+
storage: deliveryStorage(path.join(outputDir, "_stx", "images")),
|
|
85
146
|
baseUrl: DELIVERY_URL,
|
|
86
147
|
widths: DEFAULT_WIDTHS,
|
|
87
148
|
formats: ["avif", "webp"],
|
|
@@ -101,6 +162,19 @@ export async function prepareImageDelivery(publicDir, outputDir) {
|
|
|
101
162
|
optimizedFiles = await decodableFiles(files);
|
|
102
163
|
if (optimizedFiles.length === files.length)
|
|
103
164
|
throw error;
|
|
165
|
+
const survived = new Set(optimizedFiles.map((file) => file.relativePath));
|
|
166
|
+
let changed = !1;
|
|
167
|
+
for (const file of files) {
|
|
168
|
+
if (survived.has(file.relativePath))
|
|
169
|
+
continue;
|
|
170
|
+
const identity = statIdentity(file.absolutePath);
|
|
171
|
+
if (!identity)
|
|
172
|
+
continue;
|
|
173
|
+
undecodable[file.relativePath] = identity;
|
|
174
|
+
changed = !0;
|
|
175
|
+
}
|
|
176
|
+
if (changed)
|
|
177
|
+
writeUndecodableCache(outputDir, undecodable);
|
|
104
178
|
if (optimizedFiles.length === 0) {
|
|
105
179
|
clearImageDeliveryCatalog();
|
|
106
180
|
return { count: 0, fingerprint: "" };
|
package/dist/caching.d.ts
CHANGED
|
@@ -43,6 +43,31 @@ export declare function getCachedSignalsRuntime(debug?: boolean): Promise<string
|
|
|
43
43
|
* Get the router script with module-level caching.
|
|
44
44
|
*/
|
|
45
45
|
export declare function getCachedRouterScript(): Promise<string>;
|
|
46
|
+
/** A shared client script as serve mode references and serves it. */
|
|
47
|
+
export interface ServeClientAsset {
|
|
48
|
+
content: string;
|
|
49
|
+
/** 16 hex characters, the same width the serve path uses for CSS. */
|
|
50
|
+
hash: string;
|
|
51
|
+
/** `/_stx/<kind>.<hash>.js` */
|
|
52
|
+
url: string;
|
|
53
|
+
}
|
|
54
|
+
export type ServeClientAssetKind = 'runtime' | 'router';
|
|
55
|
+
/**
|
|
56
|
+
* The signals runtime or the router, with the content-addressed URL serve mode
|
|
57
|
+
* links it under.
|
|
58
|
+
*
|
|
59
|
+
* Both used to be served at fixed URLs (`/_stx/runtime.js`, `/_stx/router.js`)
|
|
60
|
+
* with an hour's cache and a day of stale-while-revalidate. A fix to either one
|
|
61
|
+
* then took hours to reach anybody: a CDN in front (Cloudflare raises a short
|
|
62
|
+
* max-age to its own four-hour default) and every browser kept serving the old
|
|
63
|
+
* file under the unchanged URL, so freshly rendered HTML ran against the
|
|
64
|
+
* previous release's router. Naming the file after its content makes every
|
|
65
|
+
* change a new URL, and lets an unchanged one be cached forever.
|
|
66
|
+
*
|
|
67
|
+
* The page and the endpoint both go through here, so the hash a page links to
|
|
68
|
+
* is always the hash of what the endpoint returns for it.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getServeClientAsset(kind: ServeClientAssetKind, debug?: boolean): Promise<ServeClientAsset>;
|
|
46
71
|
/**
|
|
47
72
|
* Clear all dev caches. Called during full rebuild or HMR reset.
|
|
48
73
|
*/
|
package/dist/caching.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import * as __bunCompat from "./_bun-compat.js";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { clearComponentCache, fileExists } from "./utils.js";
|
|
@@ -13,7 +13,7 @@ export async function readFileCached(filePath) {
|
|
|
13
13
|
const mtime1 = (await fs.promises.stat(filePath)).mtime.getTime(), cached = fileContentCache.get(filePath);
|
|
14
14
|
if (cached && cached.mtime === mtime1)
|
|
15
15
|
return cached.content;
|
|
16
|
-
const content = await
|
|
16
|
+
const content = await __bunCompat.file(filePath).text(), mtime2 = (await fs.promises.stat(filePath)).mtime.getTime();
|
|
17
17
|
if (mtime2 !== mtime1)
|
|
18
18
|
continue;
|
|
19
19
|
fileContentCache.set(filePath, { content, mtime: mtime2 });
|
|
@@ -53,6 +53,16 @@ export async function getCachedRouterScript() {
|
|
|
53
53
|
}
|
|
54
54
|
return _cachedRouterScript;
|
|
55
55
|
}
|
|
56
|
+
const _clientAssetHashes = {};
|
|
57
|
+
export async function getServeClientAsset(kind, debug = !1) {
|
|
58
|
+
const content = kind === "runtime" ? await getCachedSignalsRuntime(debug) : await getCachedRouterScript(), memoKey = kind === "runtime" && debug ? "runtime-debug" : kind;
|
|
59
|
+
let memo = _clientAssetHashes[memoKey];
|
|
60
|
+
if (!memo || memo.content !== content) {
|
|
61
|
+
memo = { content, hash: __bunCompat.hash(content).toString(16).padStart(16, "0").slice(0, 16) };
|
|
62
|
+
_clientAssetHashes[memoKey] = memo;
|
|
63
|
+
}
|
|
64
|
+
return { content, hash: memo.hash, url: `/_stx/${kind}.${memo.hash}.js` };
|
|
65
|
+
}
|
|
56
66
|
export function clearDevCaches() {
|
|
57
67
|
fileContentCache.clear();
|
|
58
68
|
clearComponentCache();
|
|
@@ -75,7 +85,7 @@ function createCacheOptionsSignature(options) {
|
|
|
75
85
|
handler: String(directive.handler)
|
|
76
86
|
}))
|
|
77
87
|
};
|
|
78
|
-
return new
|
|
88
|
+
return new __bunCompat.CryptoHasher("sha1").update(JSON.stringify(signature)).digest("hex");
|
|
79
89
|
}
|
|
80
90
|
export async function checkCache(filePath, options) {
|
|
81
91
|
try {
|
|
@@ -84,7 +94,7 @@ export async function checkCache(filePath, options) {
|
|
|
84
94
|
const cachePath = path.resolve(options.cachePath), cacheFile = path.join(cachePath, `${hashFilePath(filePath)}.html`), metaFile = path.join(cachePath, `${hashFilePath(filePath)}.meta.json`);
|
|
85
95
|
if (!await fileExists(cacheFile) || !await fileExists(metaFile))
|
|
86
96
|
return null;
|
|
87
|
-
const metaContent = await
|
|
97
|
+
const metaContent = await __bunCompat.file(metaFile).text(), meta = JSON.parse(metaContent);
|
|
88
98
|
if (meta.cacheVersion !== options.cacheVersion)
|
|
89
99
|
return null;
|
|
90
100
|
if (meta.optionsSignature !== createCacheOptionsSignature(options))
|
|
@@ -97,7 +107,7 @@ export async function checkCache(filePath, options) {
|
|
|
97
107
|
return null;
|
|
98
108
|
} else
|
|
99
109
|
return null;
|
|
100
|
-
return await
|
|
110
|
+
return await __bunCompat.file(cacheFile).text();
|
|
101
111
|
} catch (err) {
|
|
102
112
|
console.warn(`Cache error for ${filePath}:`, err);
|
|
103
113
|
return null;
|
|
@@ -110,7 +120,7 @@ export async function cacheTemplate(filePath, output, dependencies, options) {
|
|
|
110
120
|
const cachePath = path.resolve(options.cachePath);
|
|
111
121
|
await fs.promises.mkdir(cachePath, { recursive: !0 });
|
|
112
122
|
const cacheFile = path.join(cachePath, `${hashFilePath(filePath)}.html`), metaFile = path.join(cachePath, `${hashFilePath(filePath)}.meta.json`), stats = await fs.promises.stat(filePath);
|
|
113
|
-
await
|
|
123
|
+
await __bunCompat.write(cacheFile, output);
|
|
114
124
|
const meta = {
|
|
115
125
|
sourcePath: filePath,
|
|
116
126
|
mtime: stats.mtime.getTime(),
|
|
@@ -119,7 +129,7 @@ export async function cacheTemplate(filePath, output, dependencies, options) {
|
|
|
119
129
|
optionsSignature: createCacheOptionsSignature(options),
|
|
120
130
|
generatedAt: Date.now()
|
|
121
131
|
};
|
|
122
|
-
await
|
|
132
|
+
await __bunCompat.write(metaFile, JSON.stringify(meta, null, 2));
|
|
123
133
|
templateCache.set(filePath, {
|
|
124
134
|
output,
|
|
125
135
|
mtime: stats.mtime.getTime(),
|
|
@@ -131,5 +141,5 @@ export async function cacheTemplate(filePath, output, dependencies, options) {
|
|
|
131
141
|
}
|
|
132
142
|
const CACHE_HASH_LENGTH = 16;
|
|
133
143
|
export function hashFilePath(filePath) {
|
|
134
|
-
return new
|
|
144
|
+
return new __bunCompat.CryptoHasher("sha1").update(filePath).digest("hex").substring(0, CACHE_HASH_LENGTH);
|
|
135
145
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ah as v,Bh as P,th as x,yh as M,zh as C}from"./chunk-vd5xvsnv.js";import{ew as y}from"./chunk-jryjwara.js";import{resolve as h,basename as f,extname as u,join as m}from"path";import{mkdir as l}from"fs/promises";var I={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class z{config;constructor(J={}){this.config={...I,...J}}async get(J,Z){return C(J,Z,"image",this.config)}async set(J,Z,Y){return v(J,Z,Y,"image",this.config)}async clear(){return P("image",this.config)}updateConfig(J){this.config={...this.config,...J}}}var H=null;function S(J){if(!H)H=new z(J);else if(J)H.updateConfig(J);return H}async function w(J,Z,Y){let K=Y?{directory:`${Y.outputDir}/../.cache`}:{};return S(K).get(J,Z)}async function Q(J,Z,Y,K){let X=K?{directory:`${K.outputDir}/../.cache`}:{};return S(X).set(J,Z,Y)}async function d(){return S().clear()}async function R(){try{return await import("ts-images")}catch{return null}}function b(J){switch(J){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function p(J,Z){let Y=Z?b(Z):b("web"),K=J.formatQuality||{};return{jpeg:{...Y.jpeg,...K.jpeg},png:{...Y.png,...K.png},webp:{...Y.webp,...K.webp},avif:{...Y.avif,...K.avif}}}async function g(J,Z,Y){let K=await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:J,processed:!1};let X=await w(J,Z,Y);if(X)return X;try{let N=h(J);if(!await M(N))return{src:J,processed:!1,errors:[`Source file not found: ${J}`]};let L=p(Y,Z.preset),V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await l(V,{recursive:!0});let q=await x(N),U=f(J,u(J)),E=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],G={src:J,processed:!0,variants:[],hash:q},j=null;if(Z.transformations&&Z.transformations.length>0)j=await D(N,Z.transformations,K);for(let $ of E){let A=L[$]||{},W=`${U}-${q}.${$}`,_=m(V,W);try{let O=await K.optimizeImage({input:j||N,output:_,format:$,quality:A.quality,progressive:A.progressive});if(O){if(G.variants.push({path:_,url:`${F}/${W}`,width:O.width||0,height:O.height||0,format:$,size:O.outputSize||0}),!G.originalWidth&&O.width)G.originalWidth=O.width,G.originalHeight=O.height}}catch(O){G.errors=G.errors||[],G.errors.push(`Failed to optimize ${$}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let $=await K.generateThumbHash(N);G.placeholder=$.dataUrl}catch($){G.errors=G.errors||[],G.errors.push(`Failed to generate thumbhash: ${$}`)}if(Z.useDominantColor)try{let $=await K.generatePlaceholder(N,{strategy:"dominant-color"});G.dominantColor=$.dominantColor}catch($){G.errors=G.errors||[],G.errors.push(`Failed to extract dominant color: ${$}`)}return await Q(J,Z,G,Y),G}catch(N){return{src:J,processed:!1,errors:[`Processing failed: ${N}`]}}}async function n(J,Z,Y,K){let X=await R();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:J,output:K,format:Z,quality:Y}))?.outputSize}}catch(N){return{success:!1,error:String(N)}}}async function D(J,Z,Y){let K=Y||await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await K.decode(J);for(let N of Z){let L=N.options||{};switch(N.type){case"resize":if(L.width||L.height)X=await K.resize(X,{width:L.width,height:L.height,fit:L.fit});break;case"blur":if(L.sigma!==void 0)X=await K.blur(X,L.sigma);break;case"sharpen":if(L.amount!==void 0)X=await K.sharpen(X,L.amount);break;case"grayscale":X=await K.grayscale(X);break;case"rotate":if(L.angle!==void 0)X=await K.rotate(X,L.angle);break;case"flip":X=await K.flip(X);break;case"flop":X=await K.flop(X);break;case"brightness":if(L.value!==void 0)X=await K.brightness(X,L.value);break;case"contrast":if(L.value!==void 0)X=await K.contrast(X,L.value);break;case"saturation":if(L.value!==void 0)X=await K.saturation(X,L.value);break}}return await K.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}import{resolve as c,basename as i,extname as r,join as o}from"path";import{mkdir as a}from"fs/promises";async function e(){try{return await import("ts-images")}catch{return null}}var s=[320,480,640,768,1024,1280,1536,1920];async function t(J,Z,Y){let K=await e();if(!K)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=c(J);if(!await M(X))return console.warn(`[stx-media] Source file not found: ${J}`),null;try{let N=Z.responsiveWidths||Y.breakpoints||s,L=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await a(V,{recursive:!0});let q=await x(X),U=i(J,r(J)),E=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},G={src:J,byFormat:{},srcsets:{}};for(let $ of L){G.byFormat[$]=[];let A=[];for(let W of N){let _=`${U}-${W}w-${q}.${$}`,O=o(V,_),B=`${F}/${_}`;try{let T=E[$]?.quality||80;if(await M(O)){G.byFormat[$].push({path:O,url:B,width:W,height:0,format:$,size:0}),A.push(`${B} ${W}w`);continue}let k=await K.processImage({input:X,output:O,format:$,quality:T,resize:{width:W}});if(k)G.byFormat[$].push({path:O,url:B,width:W,height:k.height||Math.round(W*(k.height||1)/(k.width||1)),format:$,size:k.outputSize||0}),A.push(`${B} ${W}w`)}catch(T){console.warn(`[stx-media] Failed to generate ${$} at ${W}w: ${T}`)}}G.srcsets[$]=A.join(", ")}let j=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let $=await K.generateThumbHash(X);G.placeholder={dataURL:$.dataUrl,width:$.width||32,height:$.height||32,strategy:"thumbhash"}}else{let $=await K.generatePlaceholder(X,{strategy:j,width:20});G.placeholder={dataURL:$.dataURL,width:$.width,height:$.height,strategy:j}}}catch($){console.warn(`[stx-media] Failed to generate placeholder: ${$}`)}return G.sizes=Z.sizes||JJ(N),G}catch(N){return console.error(`[stx-media] Responsive generation failed: ${N}`),null}}function JJ(J){let Z=[...J].sort((K,X)=>K-X),Y=[];for(let K=0;K<Z.length-1;K++){let X=Z[K];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function KJ(J,Z="width"){if(!J||J.length===0)return"";if(Z==="dpr")return J.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return J.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}export{z as $g,w as ah,Q as bh,d as ch,g as dh,n as eh,D as fh,t as gh,KJ as hh};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as __bunCompat from "./_bun-compat.js";
|
|
2
|
+
// @bun
|
|
3
|
+
import{$p as w,Jo as x,Qo as k,Zl as A,_l as b,bn as T,cn as y,do as M,om as B,qm as F,vo as R,wr as P}from"./chunk-r8z1rexd.js";import{ew as v}from"./chunk-jryjwara.js";function j(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,Y){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(Y?.some((X)=>q>=X.start&&N<=X.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,Y)=>J.start-Y.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function D(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>b(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as f,resolve as H}from"path";function S(K){let z=K,G=M(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],Y=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],X=$[2],E=$[0],Z=N.includes("server");if(Y(X))J.push(E);else if(Z)Q.push(X);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,X,E=[];while((X=N.exec(q))!==null){let Z=X.index+X[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:X.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function g(K,z){return`<!DOCTYPE html>
|
|
4
|
+
<html lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
<meta charset="UTF-8">
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
8
|
+
<title>${(z||"stx").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</title>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
${K}
|
|
12
|
+
</body>
|
|
13
|
+
</html>`}async function o(K,z={}){let G=H(K),_=__bunCompat.file(G);if(!await _.exists())throw Error(`Template file not found: ${G}`);let U=await _.text(),Q=null;if(j(G)){let J=await D(U,{renderer:z.markdownRenderer});U=J.html,Q=J.frontmatter}if(Q)z={...z,context:{...Q,...z.context||{}}};if(z.layout){let J=H(z.layout),Y=__bunCompat.file(J);if(!await Y.exists())throw Error(`Layout template not found: ${J}`);let{layout:$,injectCSS:q,...N}=z,X={...z.context||{}};x(X);let E=await V(U,G,{...N,context:{...X,__stx_defer_server_data:!0},injectCSS:!1}),Z=await Y.text(),L={...X,content:E},I={...N,context:L,injectCSS:q};return V(Z,J,I)}return V(U,G,z)}async function r(K,z={},G={}){return V(K,process.cwd(),{context:z,...G})}async function V(K,z,G={}){let{templateContent:_,serverScripts:U,clientScripts:Q}=S(K),J={...P,...G.options},Y={__filename:z,__dirname:f(z),__stx:{},__stx_options:J,__stx_sfc_mode:!0,__stx_inject_css:G.injectCSS===!0,__stxServeContext:void 0,...y(G.context??{}),definePageMeta:()=>{},...G.context||{}};for(let N of U)await k(N,Y,z);let $=new Set,q=_;if(q=await w(q,Y,z,J,$),T(Y,G.context),G.templateOnly){if(q=q.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),q=q.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),Q.length>0)q+=`
|
|
14
|
+
${Q.join(`
|
|
15
|
+
`)}`}else{if(G.processClientScripts!==!1&&Q.length>0){let N=Y.__stx_event_bindings||[],X=B(Y),Z=(await Promise.all(Q.map(async(I)=>{let W=I.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W)return I;return await F(W[1],{eventBindings:N,templateContent:q,serverData:X,filePath:z})}))).join(`
|
|
16
|
+
`);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${Z}
|
|
17
|
+
$1`);else q+=`
|
|
18
|
+
${Z}`}q=await R(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCss:N}=await import("./chunk-6xqgkfb3.js");q=await N(q)}catch{}return q}
|
|
19
|
+
export{j as xk,C as yk,D as zk,o as Ak,r as Bk,V as Ck};
|