@flanksource/page-runtime 0.0.0 → 0.1.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/README.md +495 -0
- package/dist/build/README.md +96 -0
- package/{spikes/lib → dist/build}/cjs-export-names.mjs +4 -2
- package/dist/build/dependencies.mjs +279 -0
- package/dist/build/dependencies.mjs.map +1 -0
- package/dist/build/dependency-cache-Zg-FGasE.mjs +2130 -0
- package/dist/build/dependency-cache-Zg-FGasE.mjs.map +1 -0
- package/dist/build/index.mjs +42 -0
- package/dist/build/index.mjs.map +1 -0
- package/{builder-package.json → dist/build/package.json} +1 -1
- package/dist/build/types/activity-schema.d.ts +62 -0
- package/dist/build/types/build/barrels.d.ts +70 -0
- package/dist/build/types/build/base.d.ts +2 -0
- package/dist/build/types/build/browser-runtime-exports.d.ts +19 -0
- package/dist/build/types/build/check-fragment.d.ts +5 -0
- package/dist/build/types/build/commonjs-exports.d.ts +5 -0
- package/dist/build/types/build/convert-commonjs.d.ts +12 -0
- package/dist/build/types/build/dependencies.d.ts +6 -0
- package/dist/build/types/build/dependency-barrel-index.d.ts +5 -0
- package/dist/build/types/build/dependency-barrels.d.ts +7 -0
- package/dist/build/types/build/dependency-cache.d.ts +7 -0
- package/dist/build/types/build/dependency-optional.d.ts +4 -0
- package/dist/build/types/build/dependency-plugin.d.ts +8 -0
- package/dist/build/types/build/dependency-runtime.d.ts +20 -0
- package/dist/build/types/build/dependency-workers.d.ts +8 -0
- package/dist/build/types/build/errors.d.ts +9 -0
- package/dist/build/types/build/fragment.d.ts +13 -0
- package/dist/build/types/build/index.d.ts +7 -0
- package/dist/build/types/build/library-runtime.d.ts +21 -0
- package/dist/build/types/build/module-utils.d.ts +3 -0
- package/dist/build/types/build/recipe-dependencies.d.ts +2 -0
- package/dist/build/types/build/runtime-entries.d.ts +4 -0
- package/dist/build/types/build/runtime-layer.d.ts +17 -0
- package/dist/build/types/build/trace.d.ts +140 -0
- package/dist/build/types/design-schema.d.ts +98 -0
- package/dist/build/types/host/agent-source.d.ts +2 -0
- package/dist/build/types/host/agent-validation.d.ts +3 -0
- package/dist/build/types/host/design-validation.d.ts +2 -0
- package/dist/build/types/host/message-values.d.ts +8 -0
- package/dist/build/types/host/review/validation.d.ts +5 -0
- package/dist/build/types/host/validation.d.ts +6 -0
- package/dist/build/types/link/page-sources.d.ts +31 -0
- package/dist/build/types/link/types.d.ts +62 -0
- package/dist/build/types/link/validation.d.ts +9 -0
- package/dist/build/types/markers.d.ts +10 -0
- package/dist/build/types/review-schema.d.ts +60 -0
- package/dist/build/types/schema.d.ts +319 -0
- package/dist/build/types/sw/barrels.d.ts +9 -0
- package/dist/build/types/sw/compiler-plugins.d.ts +6 -0
- package/dist/build/types/sw/composition.d.ts +8 -0
- package/dist/build/types/sw/module-transform.d.ts +68 -0
- package/dist/build/types/sw/profile.d.ts +7 -0
- package/dist/build/types/sw/source-provider.d.ts +7 -0
- package/dist/build/types/sw/versions.d.ts +10 -0
- package/dist/node/catalog.mjs +1 -0
- package/dist/node/chunks/publication-RchcQvxD.mjs +229 -0
- package/dist/node/chunks/publication-RchcQvxD.mjs.map +1 -0
- package/dist/node/chunks/schema-CaRTfg2x.mjs +12 -0
- package/dist/node/chunks/schema-CaRTfg2x.mjs.map +1 -0
- package/dist/node/dev.mjs +410 -0
- package/dist/node/dev.mjs.map +1 -0
- package/dist/node/publication/cli.mjs +13 -0
- package/dist/node/publication/cli.mjs.map +1 -0
- package/dist/node/publication.mjs +1 -0
- package/dist/node/schema.mjs +1 -0
- package/dist/node/styles.mjs +49 -0
- package/dist/node/styles.mjs.map +1 -0
- package/dist/static/boot.js +40938 -0
- package/dist/static/boot.js.map +1 -0
- package/dist/static/bootstrap.html +1 -0
- package/dist/static/devtools-hook.js +118 -0
- package/dist/static/document-bundle.js +1 -0
- package/dist/static/document.js +2621 -0
- package/dist/static/editing.js +37 -0
- package/dist/static/export-compiler.js +81521 -0
- package/dist/static/export-compiler.js.map +1 -0
- package/dist/static/page-agent.js +17193 -0
- package/dist/static/page-agent.js.map +1 -0
- package/dist/static/sw.js +86112 -0
- package/dist/static/sw.js.map +1 -0
- package/package.json +46 -13
- package/scripts/build-node.ts +26 -0
- package/scripts/build-static.ts +15 -4
- package/scripts/build.ts +1 -0
- package/scripts/react-externals.ts +18 -0
- package/scripts/release-version.ts +2 -1
- package/src/activity-schema.ts +3 -2
- package/src/build/README.md +3 -1
- package/src/build/browser-runtime-exports.ts +52 -0
- package/src/build/dependencies.ts +3 -1
- package/src/build/dependency-barrel-index.ts +48 -0
- package/src/build/dependency-barrels.ts +26 -5
- package/src/build/dependency-cache.ts +1 -1
- package/src/build/dependency-optional.ts +15 -0
- package/src/build/dependency-plugin.ts +2 -2
- package/src/build/dependency-runtime.ts +48 -13
- package/src/build/dependency-workers.ts +41 -0
- package/src/build/library-runtime.ts +6 -3
- package/src/build/runtime-layer.ts +99 -0
- package/src/build/trace.ts +12 -10
- package/src/dev/README.md +30 -0
- package/src/dev/index.ts +4 -1
- package/src/dev/runtime-origin.ts +63 -0
- package/src/editing.ts +1 -1
- package/src/form/entry-source.ts +68 -0
- package/src/form/form-page.ts +63 -0
- package/src/form/index.ts +2 -0
- package/src/form/source-update.ts +17 -0
- package/src/frame/activity.ts +4 -2
- package/src/frame/agent/README.md +1 -1
- package/src/frame/agent/agent.browser.ts +1 -1
- package/src/frame/agent/frame-layout.ts +54 -0
- package/src/frame/agent/index.ts +11 -8
- package/src/frame/agent/overlay.ts +19 -6
- package/src/frame/agent/owner.ts +6 -3
- package/src/frame/agent/review.ts +3 -2
- package/src/frame/agent.ts +1 -0
- package/src/frame/boot-styles.ts +3 -3
- package/src/frame/boot.ts +98 -34
- package/src/frame/bridge.ts +4 -4
- package/src/frame/document-assets.ts +76 -0
- package/src/frame/document-entry.ts +68 -0
- package/src/frame/document-modules.ts +113 -0
- package/src/frame/document-mount.ts +32 -0
- package/src/frame/export-page.ts +6 -4
- package/src/frame/export.ts +5 -6
- package/src/frame/index.ts +2 -1
- package/src/frame/mount-page.ts +36 -0
- package/src/frame/render-job.ts +101 -0
- package/src/frame/runtime.browser.ts +20 -1
- package/src/frame/tailwind/load.ts +16 -7
- package/src/frame/tailwind/recipe.ts +4 -9
- package/src/frame/tailwind/runtime.ts +4 -4
- package/src/frame/tailwind/stylesheets.ts +12 -7
- package/src/frame/tailwind/testing/client.ts +8 -7
- package/src/frame/tailwind/testing/server.ts +1 -1
- package/src/frame/testing/boot-layout.ts +3 -0
- package/src/frame/testing/host.ts +18 -0
- package/src/frame/testing/server.ts +18 -3
- package/src/host/BuildLog.tsx +2 -1
- package/src/host/DEBUG_CONSOLE.md +13 -0
- package/src/host/PageForm.tsx +63 -0
- package/src/host/PageFrame.tsx +14 -6
- package/src/host/RuntimeActivity.tsx +3 -1
- package/src/host/RuntimeDebugPanel.tsx +18 -0
- package/src/host/activity-state.ts +1 -1
- package/src/host/bridge.ts +2 -1
- package/src/host/debug-runtime.tsx +17 -0
- package/src/host/design-validation.ts +1 -1
- package/src/host/index.ts +1 -0
- package/src/host/link/transport.ts +2 -1
- package/src/host/review/index.ts +6 -5
- package/src/host/runtime-diagnostics.ts +41 -0
- package/src/host/validation.ts +40 -3
- package/src/link/testing/server.ts +10 -7
- package/src/link/testing/worker.ts +1 -1
- package/src/schema.ts +32 -6
- package/src/styles.ts +40 -0
- package/src/sw/compile.ts +1 -1
- package/src/sw/compiler.ts +14 -7
- package/src/sw/converted.browser.ts +1 -1
- package/src/sw/errors.ts +15 -2
- package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/browser-server.ts +5 -5
- package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures.ts +2 -2
- package/src/sw/link-compiler.ts +12 -4
- package/src/sw/link-route.ts +1 -1
- package/src/sw/markers.ts +1 -1
- package/src/sw/module-transform.ts +14 -2
- package/src/sw/profile.ts +3 -1
- package/src/sw/resolver.ts +8 -4
- package/src/sw/router.ts +52 -12
- package/src/sw/runtime-exports.ts +39 -0
- package/src/sw/source-provider.ts +20 -0
- package/src/sw/versions.ts +11 -4
- package/src/sw/worker.ts +5 -1
- package/.vitest/gavel-reporter-3e3dfb64eda19344.mjs +0 -59
- package/.vitest/vitest-report-root-1793958008919344000.json +0 -1
- package/.vitest/vitest-report-root-1793958052786561000.json +0 -1
- package/.vitest/vitest-report-root-1793958143511414000.json +0 -1
- package/.vitest/vitest-report-root-1793958185908019000.json +0 -1
- package/.vitest/vitest-report-root-1793958252687550000.json +0 -1
- package/.vitest/vitest-report-root-1793958260385388000.json +0 -1
- package/.vitest/vitest-report-root-1793958312358683000.json +0 -1
- package/.vitest/vitest-report-root-1793958386118791000.json +0 -1
- package/.vitest/vitest-report-root-1793958388712140000.json +0 -1
- package/.vitest/vitest-report-root-1793958429135603000.json +0 -1
- package/.vitest/vitest-report-root-1793958433387809000.json +0 -1
- package/.vitest/vitest-report-root-1793958517322792000.json +0 -1
- package/.vitest/vitest-report-root-1793958542332252000.json +0 -1
- package/.vitest/vitest-report-root-1793958617698698000.json +0 -1
- package/.vitest/vitest-report-root-1793958676587753000.json +0 -1
- package/.vitest/vitest-report-root-1793958707827469000.json +0 -1
- package/.vitest/vitest-report-root-1793958729745028000.json +0 -1
- package/.vitest/vitest-report-root-1793958736696408000.json +0 -1
- package/.vitest/vitest-report-root-1793958740449993000.json +0 -1
- package/.vitest/vitest-report-root-1793958841510921000.json +0 -1
- package/.vitest/vitest-report-root-1793958847664582000.json +0 -1
- package/.vitest/vitest-report-root-1793958900327643000.json +0 -1
- package/.vitest/vitest-report-root-1793958950822823000.json +0 -1
- package/.vitest/vitest-report-root-1793959013655262000.json +0 -1
- package/.vitest/vitest-report-root-1793959017905881000.json +0 -1
- package/.vitest/vitest-report-root-1793959093169044000.json +0 -1
- package/.vitest/vitest-report-root-1793959093978087000.json +0 -1
- package/.vitest/vitest-report-root-1793959101111925000.json +0 -1
- package/.vitest/vitest-report-root-1793959145317906000.json +0 -1
- package/.vitest/vitest-report-root-1793959190760607000.json +0 -1
- package/.vitest/vitest-report-root-1793959249695805000.json +0 -1
- package/.vitest/vitest-report-root-1793959323191511000.json +0 -1
- package/.vitest/vitest-report-root-1793959453311564000.json +0 -1
- package/.vitest/vitest-report-root-1793959495806182000.json +0 -1
- package/.vitest/vitest-report-root-1793959499945435000.json +0 -1
- package/.vitest/vitest-report-root-1793959546773807000.json +0 -1
- package/.vitest/vitest-report-root-1793959583335593000.json +0 -1
- package/.vitest/vitest-report-root-1793959621479504000.json +0 -1
- package/.vitest/vitest-report-root-1793959651002360000.json +0 -1
- package/.vitest/vitest-report-root-1793959655646061000.json +0 -1
- package/.vitest/vitest-report-root-1793959741176826000.json +0 -1
- package/.vitest/vitest-report-root-1793959744743733000.json +0 -1
- package/.vitest/vitest-report-root-1793959833244182000.json +0 -1
- package/.vitest/vitest-report-root-1793959882131751000.json +0 -1
- package/.vitest/vitest-report-root-1793959887033254000.json +0 -1
- package/.vitest/vitest-report-root-1793960000631977000.json +0 -1
- package/.vitest/vitest-report-root-1793960011938504000.json +0 -1
- package/.vitest/vitest-report-root-1793961370018852000.json +0 -1
- package/.vitest/vitest-report-root-1793961745370827000.json +0 -1
- package/.vitest/vitest-report-root-1793961764143180000.json +0 -1
- package/.vitest/vitest-report-root-1793961835963066000.json +0 -1
- package/.vitest/vitest-report-root-1793961890729922000.json +0 -1
- package/.vitest/vitest-report-root-1793961968680074000.json +0 -1
- package/.vitest/vitest-report-root-1793962066862337000.json +0 -1
- package/.vitest/vitest-report-root-1793962087917497000.json +0 -1
- package/.vitest/vitest-report-root-1793962157254386000.json +0 -1
- package/.vitest/vitest-report-root-1793962171214865000.json +0 -1
- package/.vitest/vitest-report-root-1793962183290533000.json +0 -1
- package/.vitest/vitest-report-root-1793962184809932000.json +0 -1
- package/.vitest/vitest-report-root-1793962197715204000.json +0 -1
- package/.vitest/vitest-report-root-1793962244650717000.json +0 -1
- package/.vitest/vitest-report-root-1793962259802273000.json +0 -1
- package/.vitest/vitest-report-root-1793962278799745000.json +0 -1
- package/.vitest/vitest-report-root-1793962304412974000.json +0 -1
- package/.vitest/vitest-report-root-1793962328411454000.json +0 -1
- package/.vitest/vitest-report-root-1793962355747869000.json +0 -1
- package/.vitest/vitest-report-root-1793962381401572000.json +0 -1
- package/.vitest/vitest-report-root-1793962393326735000.json +0 -1
- package/.vitest/vitest-report-root-1793962393329206000.json +0 -1
- package/.vitest/vitest-report-root-1793962437796768000.json +0 -1
- package/.vitest/vitest-report-root-1793962444190384000.json +0 -1
- package/.vitest/vitest-report-root-1793962445347541000.json +0 -1
- package/.vitest/vitest-report-root-1793962473691143000.json +0 -1
- package/.vitest/vitest-report-root-1793962474291457000.json +0 -1
- package/.vitest/vitest-report-root-1793962499680468000.json +0 -1
- package/.vitest/vitest-report-root-1793962504410483000.json +0 -1
- package/.vitest/vitest-report-root-1793962516850524000.json +0 -1
- package/.vitest/vitest-report-root-1793962536736273000.json +0 -1
- package/.vitest/vitest-report-root-1793962551181783000.json +0 -1
- package/.vitest/vitest-report-root-1793962553575620000.json +0 -1
- package/.vitest/vitest-report-root-1793962555169730000.json +0 -1
- package/.vitest/vitest-report-root-1793962572639765000.json +0 -1
- package/.vitest/vitest-report-root-1793962597102952000.json +0 -1
- package/.vitest/vitest-report-root-1793962637156669000.json +0 -1
- package/.vitest/vitest-report-root-1793962653530027000.json +0 -1
- package/.vitest/vitest-report-root-1793962665824334000.json +0 -1
- package/.vitest/vitest-report-root-1793962682161714000.json +0 -1
- package/.vitest/vitest-report-root-1793962719526168000.json +0 -1
- package/.vitest/vitest-report-root-1793962723853934000.json +0 -1
- package/.vitest/vitest-report-root-1793962741927728000.json +0 -1
- package/.vitest/vitest-report-root-1793962794308371000.json +0 -1
- package/.vitest/vitest-report-root-1793962796334481000.json +0 -1
- package/.vitest/vitest-report-root-1793962798075169000.json +0 -1
- package/.vitest/vitest-report-root-1793962836466676000.json +0 -1
- package/.vitest/vitest-report-root-1793962846507317000.json +0 -1
- package/.vitest/vitest-report-root-1793962876266701000.json +0 -1
- package/.vitest/vitest-report-root-1793962922031308000.json +0 -1
- package/.vitest/vitest-report-root-1793962932957166000.json +0 -1
- package/.vitest/vitest-report-root-1793962946930725000.json +0 -1
- package/.vitest/vitest-report-root-1793963027896350000.json +0 -1
- package/.vitest/vitest-report-root-1793963036618707000.json +0 -1
- package/.vitest/vitest-report-root-1793963067365318000.json +0 -1
- package/.vitest/vitest-report-root-1793963077597641000.json +0 -1
- package/.vitest/vitest-report-root-1793963126365651000.json +0 -1
- package/.vitest/vitest-report-root-1793963208744553000.json +0 -1
- package/.vitest/vitest-report-root-1793963232806450000.json +0 -1
- package/.vitest/vitest-report-root-1793963325077422000.json +0 -1
- package/.vitest/vitest-report-root-1793963392172877000.json +0 -1
- package/.vitest/vitest-report-root-1793963398218324000.json +0 -1
- package/.vitest/vitest-report-root-1793963410749092000.json +0 -1
- package/.vitest/vitest-report-root-1793963437279580000.json +0 -1
- package/.vitest/vitest-report-root-1793963450096193000.json +0 -1
- package/.vitest/vitest-report-root-1793963478908641000.json +0 -1
- package/.vitest/vitest-report-root-1793963507838465000.json +0 -1
- package/.vitest/vitest-report-root-1793963528668174000.json +0 -1
- package/.vitest/vitest-report-root-1793963601860390000.json +0 -1
- package/.vitest/vitest-report-root-1793963611633446000.json +0 -1
- package/.vitest/vitest-report-root-1793963624713406000.json +0 -1
- package/.vitest/vitest-report-root-1793963680656685000.json +0 -1
- package/.vitest/vitest-report-root-1793963705231851000.json +0 -1
- package/.vitest/vitest-report-root-1793963708929500000.json +0 -1
- package/.vitest/vitest-report-root-1793963710267844000.json +0 -1
- package/.vitest/vitest-report-root-1793963713999248000.json +0 -1
- package/.vitest/vitest-report-root-1793963786513455000.json +0 -1
- package/.vitest/vitest-report-root-1793963792518765000.json +0 -1
- package/.vitest/vitest-report-root-1793963804089549000.json +0 -1
- package/.vitest/vitest-report-root-1793963840412921000.json +0 -1
- package/.vitest/vitest-report-root-1793963880361176000.json +0 -1
- package/.vitest/vitest-report-root-1793963935121106000.json +0 -1
- package/.vitest/vitest-report-root-1793963937290698000.json +0 -1
- package/.vitest/vitest-report-root-1793963977050773000.json +0 -1
- package/.vitest/vitest-report-root-1793963981229158000.json +0 -1
- package/.vitest/vitest-report-root-1793963989422080000.json +0 -1
- package/.vitest/vitest-report-root-1793964025924629000.json +0 -1
- package/.vitest/vitest-report-root-1793964027983705000.json +0 -1
- package/.vitest/vitest-report-root-1793964059969386000.json +0 -1
- package/.vitest/vitest-report-root-1793964071524069000.json +0 -1
- package/.vitest/vitest-report-root-1793964076285860000.json +0 -1
- package/.vitest/vitest-report-root-1793964077988100000.json +0 -1
- package/.vitest/vitest-report-root-1793964093289042000.json +0 -1
- package/.vitest/vitest-report-root-1793964102899356000.json +0 -1
- package/.vitest/vitest-report-root-1793964128089691000.json +0 -1
- package/.vitest/vitest-report-root-1793964129495156000.json +0 -1
- package/.vitest/vitest-report-root-1793964182849665000.json +0 -1
- package/.vitest/vitest-report-root-1793964223959893000.json +0 -1
- package/.vitest/vitest-report-root-1793964253351716000.json +0 -1
- package/.vitest/vitest-report-root-1793964290220122000.json +0 -1
- package/.vitest/vitest-report-root-1793964318037006000.json +0 -1
- package/.vitest/vitest-report-root-1793964334676691000.json +0 -1
- package/.vitest/vitest-report-root-1793964378520677000.json +0 -1
- package/.vitest/vitest-report-root-1793964383748994000.json +0 -1
- package/.vitest/vitest-report-root-1793964394042303000.json +0 -1
- package/.vitest/vitest-report-root-1793964466521881000.json +0 -1
- package/.vitest/vitest-report-root-1793964470478175000.json +0 -1
- package/.vitest/vitest-report-root-1793964484499019000.json +0 -1
- package/.vitest/vitest-report-root-1793964527645213000.json +0 -1
- package/.vitest/vitest-report-root-1793964608875865000.json +0 -1
- package/.vitest/vitest-report-root-1793964623608336000.json +0 -1
- package/.vitest/vitest-report-root-1793964629870846000.json +0 -1
- package/.vitest/vitest-report-root-1793964674515564000.json +0 -1
- package/.vitest/vitest-report-root-1793964706923651000.json +0 -1
- package/.vitest/vitest-report-root-1793964712832942000.json +0 -1
- package/.vitest/vitest-report-root-1793964714824633000.json +0 -1
- package/.vitest/vitest-report-root-1793964755433952000.json +0 -1
- package/.vitest/vitest-report-root-1793964783157670000.json +0 -1
- package/.vitest/vitest-report-root-1793964818963246000.json +0 -1
- package/.vitest/vitest-report-root-1793964843818548000.json +0 -1
- package/.vitest/vitest-report-root-1793964929824204000.json +0 -1
- package/.vitest/vitest-report-root-1793964973060713000.json +0 -1
- package/.vitest/vitest-report-root-1793964983122482000.json +0 -1
- package/.vitest/vitest-report-root-1793965107264567000.json +0 -1
- package/.vitest/vitest-report-root-1793965258759177000.json +0 -1
- package/.vitest/vitest-report-root-1793965277212091000.json +0 -1
- package/.vitest/vitest-report-root-1793965420648188000.json +0 -1
- package/.vitest/vitest-report-root-1793965611688414000.json +0 -1
- package/.vitest/vitest-report-root-1793965753407694000.json +0 -1
- package/.vitest/vitest-report-root-1793965766104309000.json +0 -1
- package/.vitest/vitest-report-root-1793965766823098000.json +0 -1
- package/.vitest/vitest-report-root-1793965806066109000.json +0 -1
- package/.vitest/vitest-report-root-1793965824697182000.json +0 -1
- package/.vitest/vitest-report-root-1793965904374564000.json +0 -1
- package/.vitest/vitest-report-root-1793965920838340000.json +0 -1
- package/.vitest/vitest-report-root-1793965932520617000.json +0 -1
- package/.vitest/vitest-report-root-1793965971574656000.json +0 -1
- package/.vitest/vitest-report-root-1793966049815024000.json +0 -1
- package/.vitest/vitest-report-root-1793966057888034000.json +0 -1
- package/.vitest/vitest-report-root-1793966066838868000.json +0 -1
- package/.vitest/vitest-report-root-1793966160347764000.json +0 -1
- package/.vitest/vitest-report-root-1793966196305985000.json +0 -1
- package/.vitest/vitest-report-root-1793966221538043000.json +0 -1
- package/.vitest/vitest-report-root-1793966251519918000.json +0 -1
- package/.vitest/vitest-report-root-1793966447000588000.json +0 -1
- package/.vitest/vitest-report-root-1793966463178249000.json +0 -1
- package/.vitest/vitest-report-root-1793966486995648000.json +0 -1
- package/.vitest/vitest-report-root-1793966726756953000.json +0 -1
- package/.vitest/vitest-report-root-1793966763656807000.json +0 -1
- package/.vitest/vitest-report-root-1793966979409799000.json +0 -1
- package/.vitest/vitest-report-root-1793967385250149000.json +0 -1
- package/.vitest/vitest-report-root-1793967617080163000.json +0 -1
- package/.vitest/vitest-report-root-1793967649428508000.json +0 -1
- package/.vitest/vitest-report-root-1793967773689520000.json +0 -1
- package/.vitest/vitest-report-root-1793968743743508000.json +0 -1
- package/.vitest/vitest-report-root-1793968846470407000.json +0 -1
- package/.vitest/vitest-report-root-1793968880878391000.json +0 -1
- package/.vitest/vitest-report-root-1793969027713529000.json +0 -1
- package/.vitest/vitest-report-root-1793969041841266000.json +0 -1
- package/.vitest/vitest-report-root-1793969142007468000.json +0 -1
- package/.vitest/vitest-report-root-1793969164867379000.json +0 -1
- package/.vitest/vitest-report-root-1793969193145858000.json +0 -1
- package/.vitest/vitest-report-root-1793969246818533000.json +0 -1
- package/.vitest/vitest-report-root-1793969270845486000.json +0 -1
- package/.vitest/vitest-report-root-1793969272514219000.json +0 -1
- package/.vitest/vitest-report-root-1793969302476105000.json +0 -1
- package/.vitest/vitest-report-root-1793969401697799000.json +0 -1
- package/.vitest/vitest-report-root-1793969433222630000.json +0 -1
- package/.vitest/vitest-report-root-1793969453350714000.json +0 -1
- package/.vitest/vitest-report-root-1793969567187400000.json +0 -1
- package/.vitest/vitest-report-root-1793969602230024000.json +0 -1
- package/.vitest/vitest-report-root-1793969633261063000.json +0 -1
- package/.vitest/vitest-report-root-1793969673876404000.json +0 -1
- package/.vitest/vitest-report-root-1793969702287010000.json +0 -1
- package/.vitest/vitest-report-root-1793969745828386000.json +0 -1
- package/.vitest/vitest-report-root-1793969893687205000.json +0 -1
- package/.vitest/vitest-report-root-1793969949642120000.json +0 -1
- package/.vitest/vitest-report-root-1793969981399076000.json +0 -1
- package/.vitest/vitest-report-root-1793970027152713000.json +0 -1
- package/.vitest/vitest-report-root-1793970030585158000.json +0 -1
- package/.vitest/vitest-report-root-1793970160195767000.json +0 -1
- package/.vitest/vitest-report-root-1793970215752422000.json +0 -1
- package/.vitest/vitest-report-root-1793970217114968000.json +0 -1
- package/.vitest/vitest-report-root-1793970329879319000.json +0 -1
- package/.vitest/vitest-report-root-1793970590586994000.json +0 -1
- package/.vitest/vitest-report-root-1793970625359990000.json +0 -1
- package/.vitest/vitest-report-root-1793970672590269000.json +0 -1
- package/.vitest/vitest-report-root-1793970796789022000.json +0 -1
- package/.vitest/vitest-report-root-1793970825710990000.json +0 -1
- package/.vitest/vitest-report-root-1793970884000509000.json +0 -1
- package/.vitest/vitest-report-root-1793970900444617000.json +0 -1
- package/.vitest/vitest-report-root-1793972186024681000.json +0 -1
- package/.vitest/vitest-report-root-1793972227757396000.json +0 -1
- package/.vitest/vitest-report-root-1793972736341600000.json +0 -1
- package/.vitest/vitest-report-root-1793972769249562000.json +0 -1
- package/.vitest/vitest-report-root-1793972859435283000.json +0 -1
- package/.vitest/vitest-report-root-1793972915169294000.json +0 -1
- package/.vitest/vitest-report-root-1793973081515450000.json +0 -1
- package/.vitest/vitest-report-root-1793973111336773000.json +0 -1
- package/.vitest/vitest-report-root-1793973253986969000.json +0 -1
- package/.vitest/vitest-report-root-1793973561283775000.json +0 -1
- package/.vitest/vitest-report-root-1793973593320977000.json +0 -1
- package/.vitest/vitest-report-root-1793973648302867000.json +0 -1
- package/.vitest/vitest-report-root-1793973819657242000.json +0 -1
- package/.vitest/vitest-report-root-1793973952727311000.json +0 -1
- package/.vitest/vitest-report-root-1793974334455876000.json +0 -1
- package/.vitest/vitest-report-root-1793974437074196000.json +0 -1
- package/.vitest/vitest-report-root-1793974437553146000.json +0 -1
- package/.vitest/vitest-report-root-1793974461818626000.json +0 -1
- package/.vitest/vitest-report-root-1793974515255198000.json +0 -1
- package/.vitest/vitest-report-root-1793974516267191000.json +0 -1
- package/.vitest/vitest-report-root-1793974621202824000.json +0 -1
- package/.vitest/vitest-report-root-1793974718450330000.json +0 -1
- package/.vitest/vitest-report-root-1793974834942373000.json +0 -1
- package/.vitest/vitest-report-root-1793974921367314000.json +0 -1
- package/.vitest/vitest-report-root-1793975019367156000.json +0 -1
- package/.vitest/vitest-report-root-1793975048166096000.json +0 -1
- package/.vitest/vitest-report-root-1793975133024339000.json +0 -1
- package/.vitest/vitest-report-root-1793975159711704000.json +0 -1
- package/.vitest/vitest-report-root-1793975517481736000.json +0 -1
- package/.vitest/vitest-report-root-1793975680008825000.json +0 -1
- package/.vitest/vitest-report-root-1793976067648494000.json +0 -1
- package/.vitest/vitest-report-root-1793976314122479000.json +0 -1
- package/.vitest/vitest-report-root-1793976513022402000.json +0 -1
- package/.vitest/vitest-report-root-1793976540410805000.json +0 -1
- package/.vitest/vitest-report-root-1793976555103273000.json +0 -1
- package/.vitest/vitest-report-root-1793976702974407000.json +0 -1
- package/.vitest/vitest-report-root-1793976721093108000.json +0 -1
- package/.vitest/vitest-report-root-1793976955473681000.json +0 -1
- package/.vitest/vitest-report-root-1793977049628483000.json +0 -1
- package/.vitest/vitest-report-root-1793977098467804000.json +0 -1
- package/.vitest/vitest-report-root-1793977132144900000.json +0 -1
- package/.vitest/vitest-report-root-1793977279648191000.json +0 -1
- package/.vitest/vitest-report-root-1793977365312127000.json +0 -1
- package/.vitest/vitest-report-root-1793978227796817000.json +0 -1
- package/.vitest/vitest-report-root-1793978255189735000.json +0 -1
- package/.vitest/vitest-report-root-1793978306509070000.json +0 -1
- package/.vitest/vitest-report-root-1793978418301216000.json +0 -1
- package/.vitest/vitest-report-root-1793978445072573000.json +0 -1
- package/.vitest/vitest-report-root-1793978546605517000.json +0 -1
- package/.vitest/vitest-report-root-1793978576060950000.json +0 -1
- package/.vitest/vitest-report-root-1793978590261408000.json +0 -1
- package/.vitest/vitest-report-root-1793978674733179000.json +0 -1
- package/.vitest/vitest-report-root-1793978718588785000.json +0 -1
- package/.vitest/vitest-report-root-1793978725363453000.json +0 -1
- package/.vitest/vitest-report-root-1793978729967285000.json +0 -1
- package/.vitest/vitest-report-root-1793978755641607000.json +0 -1
- package/.vitest/vitest-report-root-1793978782769802000.json +0 -1
- package/.vitest/vitest-report-root-1793978784870947000.json +0 -1
- package/.vitest/vitest-report-root-1793978806927335000.json +0 -1
- package/.vitest/vitest-report-root-1793978822508324000.json +0 -1
- package/.vitest/vitest-report-root-1793978836339794000.json +0 -1
- package/.vitest/vitest-report-root-1793978837947352000.json +0 -1
- package/.vitest/vitest-report-root-1793978891548295000.json +0 -1
- package/.vitest/vitest-report-root-1793978946172947000.json +0 -1
- package/.vitest/vitest-report-root-1793978947109807000.json +0 -1
- package/.vitest/vitest-report-root-1793979034208662000.json +0 -1
- package/.vitest/vitest-report-root-1793979070583608000.json +0 -1
- package/.vitest/vitest-report-root-1793979081187144000.json +0 -1
- package/.vitest/vitest-report-root-1793979085428673000.json +0 -1
- package/.vitest/vitest-report-root-1793979155097858000.json +0 -1
- package/.vitest/vitest-report-root-1793979233508873000.json +0 -1
- package/.vitest/vitest-report-root-1793979268653273000.json +0 -1
- package/.vitest/vitest-report-root-1793979341978843000.json +0 -1
- package/.vitest/vitest-report-root-1793979345344877000.json +0 -1
- package/.vitest/vitest-report-root-1793979389390374000.json +0 -1
- package/.vitest/vitest-report-root-1793979400063493000.json +0 -1
- package/.vitest/vitest-report-root-1793979432448725000.json +0 -1
- package/.vitest/vitest-report-root-1793979459139430000.json +0 -1
- package/.vitest/vitest-report-root-1793979480341961000.json +0 -1
- package/.vitest/vitest-report-root-1793979510130869000.json +0 -1
- package/.vitest/vitest-report-root-1793979524763924000.json +0 -1
- package/.vitest/vitest-report-root-1793979571563010000.json +0 -1
- package/.vitest/vitest-report-root-1793979627916920000.json +0 -1
- package/.vitest/vitest-report-root-1793979726395379000.json +0 -1
- package/.vitest/vitest-report-root-1793979752029533000.json +0 -1
- package/.vitest/vitest-report-root-1793979753365744000.json +0 -1
- package/.vitest/vitest-report-root-1793979759386206000.json +0 -1
- package/.vitest/vitest-report-root-1793979787819109000.json +0 -1
- package/.vitest/vitest-report-root-1793979827615051000.json +0 -1
- package/.vitest/vitest-report-root-1793979927737393000.json +0 -1
- package/.vitest/vitest-report-root-1793979929836169000.json +0 -1
- package/.vitest/vitest-report-root-1793979955780781000.json +0 -1
- package/.vitest/vitest-report-root-1793980200569636000.json +0 -1
- package/.vitest/vitest-report-root-1793980206045213000.json +0 -1
- package/.vitest/vitest-report-root-1793980285772027000.json +0 -1
- package/.vitest/vitest-report-root-1793980459229828000.json +0 -1
- package/.vitest/vitest-report-root-1793980460545874000.json +0 -1
- package/.vitest/vitest-report-root-1793980554484341000.json +0 -1
- package/.vitest/vitest-report-root-1793980674494388000.json +0 -1
- package/.vitest/vitest-report-root-1793980683752195000.json +0 -1
- package/.vitest/vitest-report-root-1793980947108651000.json +0 -1
- package/.vitest/vitest-report-root-1793981129616629000.json +0 -1
- package/.vitest/vitest-report-root-1793981196611441000.json +0 -1
- package/.vitest/vitest-report-root-1793981226583545000.json +0 -1
- package/.vitest/vitest-report-root-1793981294259721000.json +0 -1
- package/.vitest/vitest-report-root-1793981353393048000.json +0 -1
- package/.vitest/vitest-report-root-1793981424585368000.json +0 -1
- package/.vitest/vitest-report-root-1793981513266687000.json +0 -1
- package/.vitest/vitest-report-root-1793981526418218000.json +0 -1
- package/.vitest/vitest-report-root-1793981540069877000.json +0 -1
- package/.vitest/vitest-report-root-1793981761193625000.json +0 -1
- package/.vitest/vitest-report-root-1793981868520992000.json +0 -1
- package/.vitest/vitest-report-root-1793982048467772000.json +0 -1
- package/.vitest/vitest-report-root-1793982119518020000.json +0 -1
- package/.vitest/vitest-report-root-1793982243473651000.json +0 -1
- package/.vitest/vitest-report-root-1793982406880629000.json +0 -1
- package/.vitest/vitest-report-root-1793982433563632000.json +0 -1
- package/.vitest/vitest-report-root-1793982496753204000.json +0 -1
- package/.vitest/vitest-report-root-1793982500153311000.json +0 -1
- package/.vitest/vitest-report-root-1793982542086095000.json +0 -1
- package/.vitest/vitest-report-root-1793982659482988000.json +0 -1
- package/.vitest/vitest-report-root-1793983799132716000.json +0 -1
- package/.vitest/vitest-report-root-1793983822721833000.json +0 -1
- package/.vitest/vitest-report-root-1793984998618484000.json +0 -1
- package/.vitest/vitest-report-root-1793985050475750000.json +0 -1
- package/.vitest/vitest-report-root-1793985095516077000.json +0 -1
- package/.vitest/vitest-report-root-1793985130729074000.json +0 -1
- package/.vitest/vitest-report-root-1793985177150997000.json +0 -1
- package/.vitest/vitest-report-root-1793985267658626000.json +0 -1
- package/.vitest/vitest-report-root-1793985412705211000.json +0 -1
- package/.vitest/vitest-report-root-1793985433752853000.json +0 -1
- package/.vitest/vitest-report-root-1794087938302852000.json +0 -1
- package/.vitest/vitest-report-root-1794087978339022000.json +0 -1
- package/.vitest/vitest-report-root-1794088095283811000.json +0 -1
- package/.vitest/vitest-report-root-1794088129997065000.json +0 -1
- package/.vitest/vitest-report-root-1794088147336556000.json +0 -1
- package/.vitest/vitest-report-root-1794088173414593000.json +0 -1
- package/.vitest/vitest-report-root-1794088221289657000.json +0 -1
- package/.vitest/vitest-report-root-1794088250766611000.json +0 -1
- package/.vitest/vitest-report-root-1794088365553234000.json +0 -1
- package/.vitest/vitest-report-root-1794088395202655000.json +0 -1
- package/.vitest/vitest-report-root-1794090028732187000.json +0 -1
- package/.vitest/vitest-report-root-1794090054787283000.json +0 -1
- package/.vitest/vitest-report-root-1794090153955794000.json +0 -1
- package/.vitest/vitest-report-root-1794090161850160000.json +0 -1
- package/.vitest/vitest-report-root-1794091755693314000.json +0 -1
- package/.vitest/vitest-report-root-1794091765029349000.json +0 -1
- package/.vitest/vitest-report-root-1794091975649927000.json +0 -1
- package/.vitest/vitest-report-root-1794091994027950000.json +0 -1
- package/.vitest/vitest-report-root-1794092005178771000.json +0 -1
- package/.vitest/vitest-report-root-1794113295302382000.json +0 -1
- package/.vitest/vitest-report-root-1794114156337032000.json +0 -1
- package/.vitest/vitest-report-root-1794114198454137000.json +0 -1
- package/.vitest/vitest-report-root-1794114254064413000.json +0 -1
- package/.vitest/vitest-report-root-1794114280107510000.json +0 -1
- package/.vitest/vitest-report-root-1794114495199837000.json +0 -1
- package/.vitest/vitest-report-root-1794114646604233000.json +0 -1
- package/.vitest/vitest-report-root-1794114666311689000.json +0 -1
- package/.vitest/vitest-report-root-1794114974303438000.json +0 -1
- package/.vitest/vitest-report-root-1794115037361450000.json +0 -1
- package/.vitest/vitest-report-root-1794115097838937000.json +0 -1
- package/.vitest/vitest-report-root-1794115604669388000.json +0 -1
- package/.vitest/vitest-report-root-1794115633814500000.json +0 -1
- package/.vitest/vitest-report-root-1794115648756242000.json +0 -1
- package/.vitest/vitest-report-root-1794115873440741000.json +0 -1
- package/.vitest/vitest-report-root-1794115952930230000.json +0 -1
- package/.vitest/vitest-report-root-1794115963344701000.json +0 -1
- package/.vitest/vitest-report-root-1794116196067450000.json +0 -1
- package/.vitest/vitest-report-root-1794116254301280000.json +0 -1
- package/.vitest/vitest-report-root-1794116259342966000.json +0 -1
- package/.vitest/vitest-report-root-1794118178787879000.json +0 -1
- package/.vitest/vitest-report-root-1794137087891409000.json +0 -1
- package/.vitest/vitest-report-root-1794137100301214000.json +0 -1
- package/.vitest/vitest-report-root-1794137107377813000.json +0 -1
- package/.vitest/vitest-report-root-1794137171230704000.json +0 -1
- package/.vitest/vitest-report-root-1794137317761465000.json +0 -1
- package/.vitest/vitest-report-root-1794137320282368000.json +0 -1
- package/PACKAGE_PUBLICATIONS.md +0 -26
- package/scripts/local-workspaces.test.ts +0 -31
- package/scripts/release-version-cli.test.ts +0 -40
- package/scripts/release-version.test.ts +0 -29
- package/spikes/README.md +0 -70
- package/spikes/barrel-rewriting/README.md +0 -97
- package/spikes/barrel-rewriting/measure.ts +0 -134
- package/spikes/barrel-rewriting/readme.ts +0 -174
- package/spikes/barrel-rewriting/results.json +0 -3440
- package/spikes/barrel-rewriting/run.ts +0 -330
- package/spikes/barrel-rewriting/setup.ts +0 -90
- package/spikes/barrel-rewriting/sw.ts +0 -148
- package/spikes/barrel-rewriting/tenant.ts +0 -91
- package/spikes/barrel-rewriting/worker-config.ts +0 -33
- package/spikes/closure-fragments/README.md +0 -157
- package/spikes/closure-fragments/results.json +0 -959
- package/spikes/closure-fragments/run.ts +0 -298
- package/spikes/compiler/README.md +0 -177
- package/spikes/compiler/compile.test.ts +0 -78
- package/spikes/compiler/compile.ts +0 -82
- package/spikes/compiler/facet-redact.d.ts +0 -5
- package/spikes/compiler/markers.ts +0 -88
- package/spikes/compiler/pages.ts +0 -43
- package/spikes/compiler/readme.ts +0 -116
- package/spikes/compiler/reference.ts +0 -81
- package/spikes/compiler/render.ts +0 -113
- package/spikes/compiler/results.json +0 -3310
- package/spikes/compiler/run.ts +0 -250
- package/spikes/compiler/sucrase-parser.d.ts +0 -8
- package/spikes/compiler/sw.ts +0 -62
- package/spikes/diagram-readiness/README.md +0 -134
- package/spikes/diagram-readiness/analysis.test.ts +0 -52
- package/spikes/diagram-readiness/analysis.ts +0 -35
- package/spikes/diagram-readiness/browser.ts +0 -209
- package/spikes/diagram-readiness/readme.ts +0 -65
- package/spikes/diagram-readiness/results.json +0 -30289
- package/spikes/diagram-readiness/run.ts +0 -103
- package/spikes/diagram-readiness/server.ts +0 -53
- package/spikes/esm-sh/README.md +0 -27
- package/spikes/frame-commenting/README.md +0 -183
- package/spikes/frame-commenting/agent.ts +0 -110
- package/spikes/frame-commenting/hook.ts +0 -1
- package/spikes/frame-commenting/host.ts +0 -66
- package/spikes/frame-commenting/measure.ts +0 -180
- package/spikes/frame-commenting/model.test.ts +0 -27
- package/spikes/frame-commenting/model.ts +0 -40
- package/spikes/frame-commenting/readme.ts +0 -61
- package/spikes/frame-commenting/results.json +0 -5320
- package/spikes/frame-commenting/run.ts +0 -73
- package/spikes/frame-commenting/setup.ts +0 -125
- package/spikes/lib/barrels.test.ts +0 -107
- package/spikes/lib/barrels.ts +0 -309
- package/spikes/lib/content-types.ts +0 -28
- package/spikes/lib/convert-commonjs.ts +0 -168
- package/spikes/lib/fragment.ts +0 -108
- package/spikes/lib/library-set.ts +0 -194
- package/spikes/lib/module-transform.test.ts +0 -133
- package/spikes/lib/module-transform.ts +0 -351
- package/spikes/lib/origin.ts +0 -140
- package/spikes/lib/pages.ts +0 -290
- package/spikes/lib/report.ts +0 -23
- package/spikes/lib/runtime-server.ts +0 -282
- package/spikes/lib/static-server.ts +0 -82
- package/spikes/lib/trace.ts +0 -384
- package/spikes/local-folder-link/README.md +0 -85
- package/spikes/local-folder-link/checkout.ts +0 -132
- package/spikes/local-folder-link/documents.ts +0 -36
- package/spikes/local-folder-link/readme.ts +0 -42
- package/spikes/local-folder-link/results.json +0 -12815
- package/spikes/local-folder-link/rewrite.test.ts +0 -27
- package/spikes/local-folder-link/rewrite.ts +0 -38
- package/spikes/local-folder-link/run.ts +0 -123
- package/spikes/local-folder-link/server.ts +0 -100
- package/spikes/local-folder-link/sw.ts +0 -97
- package/spikes/origin-isolation/README.md +0 -426
- package/spikes/origin-isolation/browsers.ts +0 -43
- package/spikes/origin-isolation/helper.ts +0 -6
- package/spikes/origin-isolation/host.ts +0 -25
- package/spikes/origin-isolation/measure.ts +0 -118
- package/spikes/origin-isolation/model.test.ts +0 -45
- package/spikes/origin-isolation/model.ts +0 -49
- package/spikes/origin-isolation/proxy.ts +0 -35
- package/spikes/origin-isolation/readme.ts +0 -83
- package/spikes/origin-isolation/results.json +0 -3242
- package/spikes/origin-isolation/run.ts +0 -35
- package/spikes/origin-isolation/server.ts +0 -108
- package/spikes/origin-isolation/sw.ts +0 -28
- package/spikes/origin-isolation/tenant.ts +0 -165
- package/spikes/react-runtime-set/README.md +0 -48
- package/spikes/react-runtime-set/convert.ts +0 -118
- package/spikes/react-runtime-set/export-names.mjs +0 -8
- package/spikes/react-runtime-set/page/page.js +0 -46
- package/spikes/react-runtime-set/results.json +0 -84
- package/spikes/react-runtime-set/run.ts +0 -255
- package/spikes/run.ts +0 -15
- package/spikes/sw-tenant-frame/README.md +0 -95
- package/spikes/sw-tenant-frame/results.json +0 -1348
- package/spikes/sw-tenant-frame/run.ts +0 -373
- package/spikes/sw-tenant-frame/site/frame.html +0 -113
- package/spikes/sw-tenant-frame/site/host.html +0 -25
- package/spikes/sw-tenant-frame/site/sw.js +0 -10
- package/spikes/tailwind-parity/README.md +0 -78
- package/spikes/tailwind-parity/compare.test.ts +0 -70
- package/spikes/tailwind-parity/compare.ts +0 -91
- package/spikes/tailwind-parity/facet-font-scale.d.ts +0 -6
- package/spikes/tailwind-parity/facet-styles.ts +0 -77
- package/spikes/tailwind-parity/results.json +0 -885
- package/spikes/tailwind-parity/run.ts +0 -385
- package/spikes/tailwind-parity/runtime-tailwind.ts +0 -82
- package/src/activity.test.ts +0 -57
- package/src/build/barrels.test.ts +0 -107
- package/src/build/dependency-runtime.test.ts +0 -121
- package/src/build/library-runtime.test.ts +0 -343
- package/src/dev/cli.test.ts +0 -12
- package/src/dev/packages.test.ts +0 -175
- package/src/editing.test.tsx +0 -31
- package/src/frame/activity.test.ts +0 -27
- package/src/frame/agent/overlay.test.ts +0 -42
- package/src/frame/agent/owner.test.ts +0 -78
- package/src/frame/agent/vocabulary.test.ts +0 -36
- package/src/frame/boot-bundle.test.ts +0 -20
- package/src/frame/boot-styles.test.ts +0 -102
- package/src/frame/boot.test.ts +0 -108
- package/src/frame/export-compiler.test.ts +0 -23
- package/src/frame/export.test.ts +0 -17
- package/src/frame/tailwind/cache.test.ts +0 -53
- package/src/frame/tailwind/load.test.ts +0 -74
- package/src/frame/tailwind/runtime-cache.test.ts +0 -97
- package/src/frame/tailwind/store.test.ts +0 -104
- package/src/frame/tailwind/tailwind.test.ts +0 -119
- package/src/host/BuildLog.test.tsx +0 -40
- package/src/host/PageFrame.test.tsx +0 -39
- package/src/host/activity-state.test.ts +0 -37
- package/src/host/agent-source.test.ts +0 -9
- package/src/host/agent-validation.test.ts +0 -40
- package/src/host/bridge-request.test.ts +0 -87
- package/src/host/bridge.test.ts +0 -34
- package/src/host/build-log.test.ts +0 -47
- package/src/host/clear-cache.test.ts +0 -75
- package/src/host/design-validation.test.ts +0 -38
- package/src/host/link/transport.test.ts +0 -10
- package/src/host/origin.test.ts +0 -10
- package/src/host/review/remote.test.ts +0 -21
- package/src/host/review/source.test.ts +0 -19
- package/src/host/review/validation.test.ts +0 -34
- package/src/host/runtime-integration.test.ts +0 -29
- package/src/host/source-path.test.ts +0 -14
- package/src/host/vocabulary-validation.test.ts +0 -60
- package/src/link/build.test.ts +0 -25
- package/src/link/commonjs.test.ts +0 -34
- package/src/link/overrides.test.ts +0 -103
- package/src/link/page-sources.test.ts +0 -52
- package/src/publication/publication.test.ts +0 -89
- package/src/storage/db.test.ts +0 -52
- package/src/sw/activity-router.test.ts +0 -53
- package/src/sw/candidates.test.ts +0 -9
- package/src/sw/compile.test.ts +0 -152
- package/src/sw/compiler.test.ts +0 -51
- package/src/sw/composition.test.ts +0 -51
- package/src/sw/converted-resolver.test.ts +0 -129
- package/src/sw/converted-router.test.ts +0 -91
- package/src/sw/converted.test.ts +0 -31
- package/src/sw/errors.test.ts +0 -8
- package/src/sw/link-activity.test.ts +0 -126
- package/src/sw/link-cache.test.ts +0 -15
- package/src/sw/link-markdown.test.ts +0 -52
- package/src/sw/link-route.test.ts +0 -150
- package/src/sw/link-source.test.ts +0 -31
- package/src/sw/markers.test.ts +0 -33
- package/src/sw/module-transform.test.ts +0 -131
- package/src/sw/package-generation.test.ts +0 -33
- package/src/sw/page-clients.test.ts +0 -37
- package/src/sw/profile.test.ts +0 -21
- package/src/sw/resolver.test.ts +0 -183
- package/src/sw/router-cache.test.ts +0 -78
- package/src/sw/runtime-module.test.ts +0 -61
- package/src/sw/source-hash.test.ts +0 -7
- package/src/sw/storage.test.ts +0 -108
- package/tsconfig.json +0 -10
- package/vitest.browser.config.ts +0 -4
- package/vitest.config.ts +0 -9
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/browser-client.ts +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/copy-to-clipboard-entry.headers +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/copy-to-clipboard-entry.mjs.txt +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/copy-to-clipboard-module.headers +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/copy-to-clipboard-module.mjs.txt +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/react-copy-to-clipboard-entry.headers +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/react-copy-to-clipboard-entry.mjs.txt +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/react-copy-to-clipboard-module.headers +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/react-copy-to-clipboard-module.mjs.txt +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/toggle-selection-entry.headers +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/toggle-selection-entry.mjs.txt +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/toggle-selection-module.headers +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/fixtures/toggle-selection-module.mjs.txt +0 -0
- /package/{spikes/esm-sh → src/sw/esm-sh-fixtures}/redact.ts +0 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { n as validateCatalog, t as BUILD_ID } from "./chunks/schema-CaRTfg2x.mjs";
|
|
2
|
+
import { a as readPublication, n as atomicJson, o as readManifest, r as publicationRoot } from "./chunks/publication-RchcQvxD.mjs";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { readFile, realpath } from "node:fs/promises";
|
|
5
|
+
import { dirname, extname, join, resolve, sep } from "node:path";
|
|
6
|
+
import { createServer } from "node:http";
|
|
7
|
+
import { existsSync, unwatchFile, watchFile } from "node:fs";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
// src/dev/catalog.ts
|
|
10
|
+
async function createCatalogStore(options) {
|
|
11
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
12
|
+
const retained = /* @__PURE__ */ new Map();
|
|
13
|
+
const directories = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const path of options.packages) {
|
|
15
|
+
const publication = await readPublication(path);
|
|
16
|
+
if (directories.has(publication.name)) throw new Error(`Duplicate local package: ${publication.name}`);
|
|
17
|
+
directories.set(publication.name, path);
|
|
18
|
+
}
|
|
19
|
+
let current;
|
|
20
|
+
let failure;
|
|
21
|
+
const load = async () => {
|
|
22
|
+
const entries = await Promise.all([...directories].sort(([a], [b]) => a.localeCompare(b)).map(async ([name, path]) => {
|
|
23
|
+
const publication = await readPublication(path);
|
|
24
|
+
if (publication.name !== name) throw new Error(`${path}: package identity changed; restart the local origin`);
|
|
25
|
+
return publication;
|
|
26
|
+
}));
|
|
27
|
+
const packages = Object.fromEntries(entries.map(({ name, version, build }) => [name, {
|
|
28
|
+
name,
|
|
29
|
+
version,
|
|
30
|
+
build
|
|
31
|
+
}]));
|
|
32
|
+
const revision = createHash("sha256").update(JSON.stringify(packages)).digest("hex");
|
|
33
|
+
if (current?.catalog.revision === revision) {
|
|
34
|
+
failure = void 0;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const catalog = {
|
|
38
|
+
revision,
|
|
39
|
+
packages
|
|
40
|
+
};
|
|
41
|
+
const locals = await localPackages(entries);
|
|
42
|
+
await atomicJson(resolve(options.stateDir, `${revision}.json`), catalog);
|
|
43
|
+
current = {
|
|
44
|
+
catalog,
|
|
45
|
+
locals
|
|
46
|
+
};
|
|
47
|
+
failure = void 0;
|
|
48
|
+
retained.set(revision, current);
|
|
49
|
+
listeners.forEach((listener) => listener(catalog));
|
|
50
|
+
};
|
|
51
|
+
await load();
|
|
52
|
+
let queue = Promise.resolve();
|
|
53
|
+
const refresh = () => {
|
|
54
|
+
queue = queue.then(load).catch((error) => {
|
|
55
|
+
failure = error instanceof Error ? error : new Error(String(error));
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const watchers = options.packages.map((path) => {
|
|
59
|
+
const file = resolve(publicationRoot(path), "current.json");
|
|
60
|
+
const listener = () => refresh();
|
|
61
|
+
watchFile(file, {
|
|
62
|
+
interval: 250,
|
|
63
|
+
persistent: false
|
|
64
|
+
}, listener);
|
|
65
|
+
return () => unwatchFile(file, listener);
|
|
66
|
+
});
|
|
67
|
+
refresh();
|
|
68
|
+
return {
|
|
69
|
+
current() {
|
|
70
|
+
if (failure) throw failure;
|
|
71
|
+
return current.catalog;
|
|
72
|
+
},
|
|
73
|
+
async get(revision) {
|
|
74
|
+
if (!revision) {
|
|
75
|
+
if (failure) throw failure;
|
|
76
|
+
return current;
|
|
77
|
+
}
|
|
78
|
+
if (!BUILD_ID.test(revision)) throw new Error("Invalid package catalog revision");
|
|
79
|
+
const known = retained.get(revision);
|
|
80
|
+
if (known) return known;
|
|
81
|
+
const catalog = validateCatalog(JSON.parse(await readFile(resolve(options.stateDir, `${revision}.json`), "utf8")));
|
|
82
|
+
if (catalog.revision !== revision || createHash("sha256").update(JSON.stringify(catalog.packages)).digest("hex") !== revision) throw new Error("Package catalog integrity mismatch");
|
|
83
|
+
const loaded = {
|
|
84
|
+
catalog,
|
|
85
|
+
locals: await localPackages(Object.values(catalog.packages).map((entry) => {
|
|
86
|
+
const path = directories.get(entry.name);
|
|
87
|
+
if (!path) throw new Error(`Unconfigured catalog package: ${entry.name}`);
|
|
88
|
+
return {
|
|
89
|
+
...entry,
|
|
90
|
+
directory: resolve(publicationRoot(path), "generations", entry.build, "package")
|
|
91
|
+
};
|
|
92
|
+
}))
|
|
93
|
+
};
|
|
94
|
+
retained.set(revision, loaded);
|
|
95
|
+
return loaded;
|
|
96
|
+
},
|
|
97
|
+
subscribe(listener) {
|
|
98
|
+
listeners.add(listener);
|
|
99
|
+
return () => {
|
|
100
|
+
listeners.delete(listener);
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
close() {
|
|
104
|
+
watchers.forEach((close) => close());
|
|
105
|
+
listeners.clear();
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
async function localPackages(entries) {
|
|
110
|
+
return new Map(await Promise.all(entries.map(async (entry) => {
|
|
111
|
+
const directory = await realpath(entry.directory);
|
|
112
|
+
const manifest = await readManifest(directory);
|
|
113
|
+
if (manifest.name !== entry.name || manifest.version !== entry.version) throw new Error(`Package snapshot identity mismatch: ${entry.name}`);
|
|
114
|
+
return [entry.name, {
|
|
115
|
+
directory,
|
|
116
|
+
manifest
|
|
117
|
+
}];
|
|
118
|
+
})));
|
|
119
|
+
}
|
|
120
|
+
// src/dev/runtime-origin.ts
|
|
121
|
+
function packageAssets() {
|
|
122
|
+
for (let dir = dirname(fileURLToPath(import.meta.url)); dir !== dirname(dir); dir = dirname(dir)) if (existsSync(join(dir, "package.json")) && existsSync(join(dir, "dist/static"))) return join(dir, "dist/static");
|
|
123
|
+
throw new Error("Cannot find the built page-runtime assets; run the page-runtime build");
|
|
124
|
+
}
|
|
125
|
+
/** Serves built browser assets and local package publications on a separate loopback origin. */
|
|
126
|
+
async function serveRuntime(options) {
|
|
127
|
+
const host = new URL(options.hostOrigin);
|
|
128
|
+
if (host.origin !== options.hostOrigin || !["http:", "https:"].includes(host.protocol) || ![
|
|
129
|
+
"localhost",
|
|
130
|
+
"127.0.0.1",
|
|
131
|
+
"[::1]"
|
|
132
|
+
].includes(host.hostname)) throw new Error("Local page runtime requires an exact loopback origin");
|
|
133
|
+
const assetsDir = options.assetsDir ?? packageAssets();
|
|
134
|
+
const assets = new Map(await Promise.all([
|
|
135
|
+
"bootstrap.html",
|
|
136
|
+
"sw.js",
|
|
137
|
+
"boot.js",
|
|
138
|
+
"page-agent.js",
|
|
139
|
+
"editing.js",
|
|
140
|
+
"export-compiler.js",
|
|
141
|
+
"devtools-hook.js"
|
|
142
|
+
].map(async (file) => [file, await readFile(resolve(assetsDir, file))])));
|
|
143
|
+
const packages = await createPackageHandler(options);
|
|
144
|
+
const dependencies = () => Object.fromEntries(Object.entries(packages.current().packages).map(([name, entry]) => [name, entry.version]));
|
|
145
|
+
let origin;
|
|
146
|
+
const server = createServer((request, response) => {
|
|
147
|
+
try {
|
|
148
|
+
const path = new URL(request.url ?? "/", "http://localhost").pathname;
|
|
149
|
+
if (path.startsWith("/_generations/")) {
|
|
150
|
+
packages.handle(request, response);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
154
|
+
response.writeHead(405).end();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (path === "/profile.json") {
|
|
158
|
+
const packageOrigin = `${origin}/_generations/${packages.current().revision}`;
|
|
159
|
+
const profile = {
|
|
160
|
+
runtimeDomain: new URL(origin).host,
|
|
161
|
+
embedders: [host.origin],
|
|
162
|
+
packageOrigin,
|
|
163
|
+
registry: packageOrigin,
|
|
164
|
+
managed: dependencies(),
|
|
165
|
+
policy: { dependencies: "strict" },
|
|
166
|
+
minReleaseAgeDays: 0,
|
|
167
|
+
network: { allow: ["https://fonts.googleapis.com/*", "https://fonts.gstatic.com/*"] },
|
|
168
|
+
csp: { add: {
|
|
169
|
+
"style-src": ["https://fonts.googleapis.com"],
|
|
170
|
+
"font-src": [
|
|
171
|
+
"'self'",
|
|
172
|
+
"data:",
|
|
173
|
+
"https://fonts.gstatic.com"
|
|
174
|
+
]
|
|
175
|
+
} },
|
|
176
|
+
links: "deny",
|
|
177
|
+
sources: ["host"],
|
|
178
|
+
readinessTimeoutMs: 3e4
|
|
179
|
+
};
|
|
180
|
+
response.writeHead(200, {
|
|
181
|
+
"content-type": "application/json",
|
|
182
|
+
"cache-control": "no-store"
|
|
183
|
+
}).end(request.method === "HEAD" ? void 0 : JSON.stringify(profile));
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const file = path.startsWith("/frame/") ? "bootstrap.html" : path.slice(1);
|
|
187
|
+
const asset = assets.get(file);
|
|
188
|
+
if (!asset) {
|
|
189
|
+
response.writeHead(404).end("Runtime asset not found");
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
response.writeHead(200, {
|
|
193
|
+
"content-type": file.endsWith(".html") ? "text/html; charset=utf-8" : "text/javascript; charset=utf-8",
|
|
194
|
+
"cache-control": "no-store",
|
|
195
|
+
...file === "sw.js" ? { "service-worker-allowed": "/frame/" } : {}
|
|
196
|
+
});
|
|
197
|
+
response.end(request.method === "HEAD" ? void 0 : asset);
|
|
198
|
+
} catch (error) {
|
|
199
|
+
response.writeHead(500, {
|
|
200
|
+
"content-type": "text/plain; charset=utf-8",
|
|
201
|
+
"cache-control": "no-store"
|
|
202
|
+
}).end(request.method === "HEAD" ? void 0 : error instanceof Error ? error.message : String(error));
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
try {
|
|
206
|
+
await new Promise((done, fail) => {
|
|
207
|
+
server.once("error", fail);
|
|
208
|
+
server.listen(0, "127.0.0.1", done);
|
|
209
|
+
});
|
|
210
|
+
} catch (error) {
|
|
211
|
+
packages.close();
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
origin = `http://127.0.0.1:${server.address().port}`;
|
|
215
|
+
return {
|
|
216
|
+
origin,
|
|
217
|
+
get dependencies() {
|
|
218
|
+
return dependencies();
|
|
219
|
+
},
|
|
220
|
+
close: () => new Promise((done, fail) => {
|
|
221
|
+
packages.close();
|
|
222
|
+
server.closeAllConnections();
|
|
223
|
+
server.close((error) => error ? fail(error) : done());
|
|
224
|
+
})
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
// src/dev/index.ts
|
|
228
|
+
const LOCAL_RELEASE_TIME = "2000-01-01T00:00:00.000Z";
|
|
229
|
+
const types = {
|
|
230
|
+
".js": "text/javascript",
|
|
231
|
+
".mjs": "text/javascript",
|
|
232
|
+
".cjs": "text/javascript",
|
|
233
|
+
".json": "application/json",
|
|
234
|
+
".map": "application/json",
|
|
235
|
+
".css": "text/css",
|
|
236
|
+
".html": "text/html",
|
|
237
|
+
".txt": "text/plain",
|
|
238
|
+
".md": "text/markdown",
|
|
239
|
+
".svg": "image/svg+xml",
|
|
240
|
+
".png": "image/png",
|
|
241
|
+
".jpg": "image/jpeg",
|
|
242
|
+
".jpeg": "image/jpeg",
|
|
243
|
+
".gif": "image/gif",
|
|
244
|
+
".webp": "image/webp",
|
|
245
|
+
".avif": "image/avif",
|
|
246
|
+
".ico": "image/x-icon",
|
|
247
|
+
".woff": "font/woff",
|
|
248
|
+
".woff2": "font/woff2",
|
|
249
|
+
".ttf": "font/ttf",
|
|
250
|
+
".otf": "font/otf",
|
|
251
|
+
".wasm": "application/wasm"
|
|
252
|
+
};
|
|
253
|
+
const textResponse = (status, body) => ({
|
|
254
|
+
status,
|
|
255
|
+
body,
|
|
256
|
+
type: "text/plain; charset=utf-8",
|
|
257
|
+
cache: "no-store"
|
|
258
|
+
});
|
|
259
|
+
function upstreamBase(value) {
|
|
260
|
+
const url = new URL(value);
|
|
261
|
+
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash) throw new Error(`upstream must be an HTTP(S) URL without credentials, query or hash: ${value}`);
|
|
262
|
+
return url.href.replace(/\/$/, "");
|
|
263
|
+
}
|
|
264
|
+
async function localFile(local, path) {
|
|
265
|
+
if (!path || path.split(/[\\/]/).some((part) => part === "..") || path.includes("\0")) return textResponse(404, "Invalid local package file path");
|
|
266
|
+
try {
|
|
267
|
+
const file = await realpath(resolve(local.directory, path));
|
|
268
|
+
if (!file.startsWith(`${local.directory}${sep}`)) return textResponse(404, "File is outside the local package directory");
|
|
269
|
+
return {
|
|
270
|
+
body: await readFile(file),
|
|
271
|
+
status: 200,
|
|
272
|
+
type: types[extname(file)] ?? "application/octet-stream",
|
|
273
|
+
cache: "no-store"
|
|
274
|
+
};
|
|
275
|
+
} catch (error) {
|
|
276
|
+
if ([
|
|
277
|
+
"ENOENT",
|
|
278
|
+
"ENOTDIR",
|
|
279
|
+
"EISDIR"
|
|
280
|
+
].includes(error.code ?? "")) return textResponse(404, `${local.manifest.name}@${local.manifest.version}: file not found: ${path}`);
|
|
281
|
+
throw error;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
async function serveRequest(options) {
|
|
285
|
+
const { url, method, locals, registry, origin } = options;
|
|
286
|
+
if (method === "OPTIONS") return textResponse(204, "");
|
|
287
|
+
if (!["GET", "HEAD"].includes(method)) return textResponse(405, "Only GET, HEAD and OPTIONS are supported");
|
|
288
|
+
let path;
|
|
289
|
+
try {
|
|
290
|
+
path = decodeURIComponent(url.split("?")[0]);
|
|
291
|
+
} catch {
|
|
292
|
+
return textResponse(400, "Invalid URL encoding");
|
|
293
|
+
}
|
|
294
|
+
if (path === "/") return {
|
|
295
|
+
status: 200,
|
|
296
|
+
body: JSON.stringify({ packages: [...locals.keys()] }),
|
|
297
|
+
type: "application/json",
|
|
298
|
+
cache: "no-store"
|
|
299
|
+
};
|
|
300
|
+
const match = path.match(/^\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+)(?:\/(.*))?)?$/);
|
|
301
|
+
if (!match) return textResponse(404, `Invalid package path: ${path}`);
|
|
302
|
+
const [, name, version, file] = match;
|
|
303
|
+
const local = locals.get(name);
|
|
304
|
+
if (local) {
|
|
305
|
+
const manifest = local.manifest;
|
|
306
|
+
if (!version) return {
|
|
307
|
+
status: 200,
|
|
308
|
+
body: JSON.stringify({
|
|
309
|
+
name,
|
|
310
|
+
versions: { [manifest.version]: manifest },
|
|
311
|
+
time: { [manifest.version]: LOCAL_RELEASE_TIME },
|
|
312
|
+
"dist-tags": { latest: manifest.version }
|
|
313
|
+
}),
|
|
314
|
+
type: "application/json",
|
|
315
|
+
cache: options.immutable ? "public, max-age=31536000, immutable" : "no-store"
|
|
316
|
+
};
|
|
317
|
+
if (version !== manifest.version) return textResponse(404, `Requested ${name}@${version}; local package is ${name}@${manifest.version}`);
|
|
318
|
+
const served = await localFile(local, file ?? "");
|
|
319
|
+
if (options.immutable && served.status === 200) served.cache = "public, max-age=31536000, immutable";
|
|
320
|
+
return served;
|
|
321
|
+
}
|
|
322
|
+
const target = `${version ? origin : registry}${url}`;
|
|
323
|
+
try {
|
|
324
|
+
const response = await fetch(target, {
|
|
325
|
+
method,
|
|
326
|
+
signal: AbortSignal.timeout(3e4)
|
|
327
|
+
});
|
|
328
|
+
return {
|
|
329
|
+
status: response.status,
|
|
330
|
+
body: new Uint8Array(await response.arrayBuffer()),
|
|
331
|
+
type: response.headers.get("content-type") ?? "application/octet-stream",
|
|
332
|
+
cache: response.headers.get("cache-control") ?? "no-store"
|
|
333
|
+
};
|
|
334
|
+
} catch (error) {
|
|
335
|
+
return textResponse(502, `Proxy ${target}: ${error instanceof Error ? error.message : String(error)}`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
async function createPackageHandler(options) {
|
|
339
|
+
const registry = upstreamBase(options.upstreamRegistry);
|
|
340
|
+
const origin = upstreamBase(options.upstreamOrigin);
|
|
341
|
+
if (!options.packages.length) throw new Error("At least one local package directory is required");
|
|
342
|
+
const store = await createCatalogStore(options);
|
|
343
|
+
const handle = async (request, response) => {
|
|
344
|
+
response.setHeader("access-control-allow-origin", "*");
|
|
345
|
+
response.setHeader("access-control-allow-methods", "GET, HEAD, OPTIONS");
|
|
346
|
+
response.setHeader("access-control-allow-headers", "*");
|
|
347
|
+
try {
|
|
348
|
+
const raw = request.url ?? "/";
|
|
349
|
+
const generation = raw.match(/^\/_generations\/([^/]+)(\/.*)$/);
|
|
350
|
+
const selected = await store.get(generation?.[1]);
|
|
351
|
+
const url = generation?.[2] ?? raw;
|
|
352
|
+
const served = ["GET", "HEAD"].includes(request.method ?? "GET") && url.split("?")[0] === "/__catalog.json" ? {
|
|
353
|
+
status: 200,
|
|
354
|
+
body: JSON.stringify(selected.catalog),
|
|
355
|
+
type: "application/json",
|
|
356
|
+
cache: generation ? "public, max-age=31536000, immutable" : "no-store"
|
|
357
|
+
} : await serveRequest({
|
|
358
|
+
url,
|
|
359
|
+
method: request.method ?? "GET",
|
|
360
|
+
locals: selected.locals,
|
|
361
|
+
registry,
|
|
362
|
+
origin,
|
|
363
|
+
immutable: Boolean(generation)
|
|
364
|
+
});
|
|
365
|
+
response.writeHead(served.status, {
|
|
366
|
+
"content-type": served.type,
|
|
367
|
+
"cache-control": served.cache,
|
|
368
|
+
...served.status === 204 || served.status === 304 ? {} : { "content-length": typeof served.body === "string" ? Buffer.byteLength(served.body) : served.body.byteLength },
|
|
369
|
+
"timing-allow-origin": "*",
|
|
370
|
+
"access-control-expose-headers": "content-length, content-encoding, server-timing"
|
|
371
|
+
});
|
|
372
|
+
response.end(request.method === "HEAD" ? void 0 : served.body);
|
|
373
|
+
} catch (error) {
|
|
374
|
+
console.error("Package request failed", error);
|
|
375
|
+
response.writeHead(error.code === "ENOENT" ? 404 : 500, {
|
|
376
|
+
"content-type": "text/plain; charset=utf-8",
|
|
377
|
+
"cache-control": "no-store"
|
|
378
|
+
});
|
|
379
|
+
response.end(error.code === "ENOENT" ? "Package not found" : "Package request failed");
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
return {
|
|
383
|
+
handle,
|
|
384
|
+
current: store.current,
|
|
385
|
+
subscribe: store.subscribe,
|
|
386
|
+
close: store.close
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
async function servePackages(options) {
|
|
390
|
+
if (!Number.isInteger(options.port) || options.port < 0 || options.port > 65535) throw new Error(`Invalid port: ${options.port}`);
|
|
391
|
+
const handler = await createPackageHandler(options);
|
|
392
|
+
const server = createServer((request, response) => {
|
|
393
|
+
handler.handle(request, response);
|
|
394
|
+
});
|
|
395
|
+
await new Promise((done, fail) => {
|
|
396
|
+
server.once("error", fail);
|
|
397
|
+
server.listen(options.port, "127.0.0.1", done);
|
|
398
|
+
});
|
|
399
|
+
return {
|
|
400
|
+
origin: `http://127.0.0.1:${server.address().port}`,
|
|
401
|
+
close: () => new Promise((done, fail) => {
|
|
402
|
+
handler.close();
|
|
403
|
+
server.closeAllConnections();
|
|
404
|
+
server.close((error) => error ? fail(error) : done());
|
|
405
|
+
})
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
export { LOCAL_RELEASE_TIME, createPackageHandler, servePackages, serveRuntime };
|
|
409
|
+
|
|
410
|
+
//# sourceMappingURL=dev.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.mjs","names":[],"sources":["../../src/dev/catalog.ts","../../src/dev/runtime-origin.ts","../../src/dev/index.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { watchFile, unwatchFile } from \"node:fs\";\nimport { readFile, realpath } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { atomicJson, publicationRoot, readPublication, type PackageCatalog, type Publication } from \"../publication/index.ts\";\nimport { readManifest, type PackageManifest } from \"../publication/manifest.ts\";\nimport { BUILD_ID, validateCatalog } from \"../publication/schema.ts\";\n\nexport type LocalPackage = { directory: string; manifest: PackageManifest };\ntype Catalog = { catalog: PackageCatalog; locals: Map<string, LocalPackage> };\nexport async function createCatalogStore(options: { packages: string[]; stateDir: string }) {\n const listeners = new Set<(catalog: PackageCatalog) => void>();\n const retained = new Map<string, Catalog>();\n const directories = new Map<string, string>();\n for (const path of options.packages) {\n const publication = await readPublication(path);\n if (directories.has(publication.name)) throw new Error(`Duplicate local package: ${publication.name}`);\n directories.set(publication.name, path);\n }\n let current: Catalog;\n let failure: Error | undefined;\n const load = async () => {\n const entries = await Promise.all([...directories].sort(([a], [b]) => a.localeCompare(b)).map(async ([name, path]) => {\n const publication = await readPublication(path);\n if (publication.name !== name) throw new Error(`${path}: package identity changed; restart the local origin`);\n return publication;\n }));\n const packages = Object.fromEntries(entries.map(({ name, version, build }) => [name, { name, version, build }]));\n const revision = createHash(\"sha256\").update(JSON.stringify(packages)).digest(\"hex\");\n if (current?.catalog.revision === revision) { failure = undefined; return; }\n const catalog = { revision, packages };\n const locals = await localPackages(entries);\n await atomicJson(resolve(options.stateDir, `${revision}.json`), catalog);\n current = { catalog, locals }; failure = undefined;\n retained.set(revision, current);\n listeners.forEach(listener => listener(catalog));\n };\n await load();\n let queue = Promise.resolve();\n const refresh = () => { queue = queue.then(load).catch(error => { failure = error instanceof Error ? error : new Error(String(error)); }); };\n const watchers = options.packages.map(path => {\n const file = resolve(publicationRoot(path), \"current.json\");\n const listener = () => refresh();\n watchFile(file, { interval: 250, persistent: false }, listener);\n return () => unwatchFile(file, listener);\n });\n // Catch a publication completed between the initial read and watcher setup.\n refresh();\n return {\n current(): PackageCatalog { if (failure) throw failure; return current.catalog; },\n async get(revision?: string): Promise<Catalog> {\n if (!revision) { if (failure) throw failure; return current; }\n if (!BUILD_ID.test(revision)) throw new Error(\"Invalid package catalog revision\");\n const known = retained.get(revision);\n if (known) return known;\n const catalog = validateCatalog(JSON.parse(await readFile(resolve(options.stateDir, `${revision}.json`), \"utf8\")));\n if (catalog.revision !== revision || createHash(\"sha256\").update(JSON.stringify(catalog.packages)).digest(\"hex\") !== revision) throw new Error(\"Package catalog integrity mismatch\");\n const entries = Object.values(catalog.packages).map(entry => {\n const path = directories.get(entry.name);\n if (!path) throw new Error(`Unconfigured catalog package: ${entry.name}`);\n return { ...entry, directory: resolve(publicationRoot(path), \"generations\", entry.build, \"package\") };\n });\n const loaded = { catalog, locals: await localPackages(entries) };\n retained.set(revision, loaded);\n return loaded;\n },\n subscribe(listener: (catalog: PackageCatalog) => void) { listeners.add(listener); return () => { listeners.delete(listener); }; },\n close() { watchers.forEach(close => close()); listeners.clear(); },\n };\n}\n\nasync function localPackages(entries: Publication[]): Promise<Map<string, LocalPackage>> {\n return new Map(await Promise.all(entries.map(async entry => {\n const directory = await realpath(entry.directory);\n const manifest = await readManifest(directory);\n if (manifest.name !== entry.name || manifest.version !== entry.version) throw new Error(`Package snapshot identity mismatch: ${entry.name}`);\n return [entry.name, { directory, manifest }] as const;\n })));\n}\n","import { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { createServer } from \"node:http\";\nimport type { AddressInfo } from \"node:net\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { RuntimeProfile } from \"../schema.ts\";\nimport { createPackageHandler, type PackageOriginOptions } from \"./index.ts\";\n\n// This module runs from src/ in the workspace and from a bundle in dist/node/ when installed, so locate the package root.\nfunction packageAssets(): string {\n for (let dir = dirname(fileURLToPath(import.meta.url)); dir !== dirname(dir); dir = dirname(dir)) {\n if (existsSync(join(dir, \"package.json\")) && existsSync(join(dir, \"dist/static\"))) return join(dir, \"dist/static\");\n }\n throw new Error(\"Cannot find the built page-runtime assets; run the page-runtime build\");\n}\n\nexport type RuntimeOriginOptions = PackageOriginOptions & { hostOrigin: string; assetsDir?: string };\n\n/** Serves built browser assets and local package publications on a separate loopback origin. */\nexport async function serveRuntime(options: RuntimeOriginOptions): Promise<{ origin: string; dependencies: Record<string, string>; close: () => Promise<void> }> {\n const host = new URL(options.hostOrigin);\n if (host.origin !== options.hostOrigin || ![\"http:\", \"https:\"].includes(host.protocol) || ![\"localhost\", \"127.0.0.1\", \"[::1]\"].includes(host.hostname)) throw new Error(\"Local page runtime requires an exact loopback origin\");\n const assetsDir = options.assetsDir ?? packageAssets();\n const assets = new Map(await Promise.all([\"bootstrap.html\", \"sw.js\", \"boot.js\", \"page-agent.js\", \"editing.js\", \"export-compiler.js\", \"devtools-hook.js\"].map(async (file) => [file, await readFile(resolve(assetsDir, file))] as const)));\n const packages = await createPackageHandler(options);\n const dependencies = () => Object.fromEntries(Object.entries(packages.current().packages).map(([name, entry]) => [name, entry.version]));\n let origin: string;\n const server = createServer((request, response) => {\n try {\n const path = new URL(request.url ?? \"/\", \"http://localhost\").pathname;\n if (path.startsWith(\"/_generations/\")) { void packages.handle(request, response); return; }\n if (request.method !== \"GET\" && request.method !== \"HEAD\") { response.writeHead(405).end(); return; }\n if (path === \"/profile.json\") {\n const packageOrigin = `${origin}/_generations/${packages.current().revision}`;\n const profile: RuntimeProfile = {\n runtimeDomain: new URL(origin).host, embedders: [host.origin], packageOrigin, registry: packageOrigin, managed: dependencies(),\n policy: { dependencies: \"strict\" }, minReleaseAgeDays: 0,\n network: { allow: [\"https://fonts.googleapis.com/*\", \"https://fonts.gstatic.com/*\"] },\n csp: { add: { \"style-src\": [\"https://fonts.googleapis.com\"], \"font-src\": [\"'self'\", \"data:\", \"https://fonts.gstatic.com\"] } },\n links: \"deny\", sources: [\"host\"], readinessTimeoutMs: 30000,\n };\n response.writeHead(200, { \"content-type\": \"application/json\", \"cache-control\": \"no-store\" }).end(request.method === \"HEAD\" ? undefined : JSON.stringify(profile));\n return;\n }\n const file = path.startsWith(\"/frame/\") ? \"bootstrap.html\" : path.slice(1);\n const asset = assets.get(file);\n if (!asset) { response.writeHead(404).end(\"Runtime asset not found\"); return; }\n response.writeHead(200, { \"content-type\": file.endsWith(\".html\") ? \"text/html; charset=utf-8\" : \"text/javascript; charset=utf-8\", \"cache-control\": \"no-store\", ...(file === \"sw.js\" ? { \"service-worker-allowed\": \"/frame/\" } : {}) });\n response.end(request.method === \"HEAD\" ? undefined : asset);\n } catch (error) {\n response.writeHead(500, { \"content-type\": \"text/plain; charset=utf-8\", \"cache-control\": \"no-store\" }).end(request.method === \"HEAD\" ? undefined : error instanceof Error ? error.message : String(error));\n }\n });\n try { await new Promise<void>((done, fail) => { server.once(\"error\", fail); server.listen(0, \"127.0.0.1\", done); }); }\n catch (error) { packages.close(); throw error; }\n origin = `http://127.0.0.1:${(server.address() as AddressInfo).port}`;\n return { origin, get dependencies() { return dependencies(); }, close: () => new Promise<void>((done, fail) => {\n packages.close();\n server.closeAllConnections();\n server.close((error) => error ? fail(error) : done());\n }) };\n}\n","import { readFile, realpath } from \"node:fs/promises\";\nimport { createServer, type IncomingMessage, type ServerResponse } from \"node:http\";\nimport type { AddressInfo } from \"node:net\";\nimport { extname, resolve, sep } from \"node:path\";\nimport { createCatalogStore, type LocalPackage } from \"./catalog.ts\";\n\nexport { serveRuntime, type RuntimeOriginOptions } from \"./runtime-origin.ts\";\n\nexport type PackageOriginOptions = { packages: string[]; upstreamRegistry: string; upstreamOrigin: string; stateDir: string };\nexport type PackageHandler = (request: IncomingMessage, response: ServerResponse) => Promise<void>;\nexport const LOCAL_RELEASE_TIME = \"2000-01-01T00:00:00.000Z\";\n\ntype Served = { body: string | Uint8Array; type: string; status: number; cache: string };\nconst types: Record<string, string> = {\n \".js\": \"text/javascript\", \".mjs\": \"text/javascript\", \".cjs\": \"text/javascript\",\n \".json\": \"application/json\", \".map\": \"application/json\", \".css\": \"text/css\",\n \".html\": \"text/html\", \".txt\": \"text/plain\", \".md\": \"text/markdown\",\n \".svg\": \"image/svg+xml\", \".png\": \"image/png\", \".jpg\": \"image/jpeg\", \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\", \".webp\": \"image/webp\", \".avif\": \"image/avif\", \".ico\": \"image/x-icon\",\n \".woff\": \"font/woff\", \".woff2\": \"font/woff2\", \".ttf\": \"font/ttf\", \".otf\": \"font/otf\", \".wasm\": \"application/wasm\",\n};\nconst textResponse = (status: number, body: string): Served => ({ status, body, type: \"text/plain; charset=utf-8\", cache: \"no-store\" });\n\nfunction upstreamBase(value: string): string {\n const url = new URL(value);\n if (![\"http:\", \"https:\"].includes(url.protocol) || url.username || url.password || url.search || url.hash) throw new Error(`upstream must be an HTTP(S) URL without credentials, query or hash: ${value}`);\n return url.href.replace(/\\/$/, \"\");\n}\n\nasync function localFile(local: LocalPackage, path: string): Promise<Served> {\n if (!path || path.split(/[\\\\/]/).some((part) => part === \"..\") || path.includes(\"\\0\")) return textResponse(404, \"Invalid local package file path\");\n try {\n const file = await realpath(resolve(local.directory, path));\n if (!file.startsWith(`${local.directory}${sep}`)) return textResponse(404, \"File is outside the local package directory\");\n return { body: await readFile(file), status: 200, type: types[extname(file)] ?? \"application/octet-stream\", cache: \"no-store\" };\n } catch (error) {\n if ([\"ENOENT\", \"ENOTDIR\", \"EISDIR\"].includes((error as NodeJS.ErrnoException).code ?? \"\")) return textResponse(404, `${local.manifest.name}@${local.manifest.version}: file not found: ${path}`);\n throw error;\n }\n}\n\nasync function serveRequest(options: { url: string; method: string; locals: Map<string, LocalPackage>; registry: string; origin: string; immutable: boolean }): Promise<Served> {\n const { url, method, locals, registry, origin } = options;\n if (method === \"OPTIONS\") return textResponse(204, \"\");\n if (![\"GET\", \"HEAD\"].includes(method)) return textResponse(405, \"Only GET, HEAD and OPTIONS are supported\");\n let path: string;\n try { path = decodeURIComponent(url.split(\"?\")[0]!); }\n catch { return textResponse(400, \"Invalid URL encoding\"); }\n if (path === \"/\") return { status: 200, body: JSON.stringify({ packages: [...locals.keys()] }), type: \"application/json\", cache: \"no-store\" };\n const match = path.match(/^\\/((?:@[^/@]+\\/)?[^/@]+)(?:@([^/]+)(?:\\/(.*))?)?$/);\n if (!match) return textResponse(404, `Invalid package path: ${path}`);\n const [, name, version, file] = match;\n const local = locals.get(name!);\n if (local) {\n const manifest = local.manifest;\n if (!version) return { status: 200, body: JSON.stringify({ name, versions: { [manifest.version]: manifest }, time: { [manifest.version]: LOCAL_RELEASE_TIME }, \"dist-tags\": { latest: manifest.version } }), type: \"application/json\", cache: options.immutable ? \"public, max-age=31536000, immutable\" : \"no-store\" };\n if (version !== manifest.version) return textResponse(404, `Requested ${name}@${version}; local package is ${name}@${manifest.version}`);\n const served = await localFile(local, file ?? \"\");\n if (options.immutable && served.status === 200) served.cache = \"public, max-age=31536000, immutable\";\n return served;\n }\n const target = `${version ? origin : registry}${url}`;\n try {\n const response = await fetch(target, { method, signal: AbortSignal.timeout(30_000) });\n return { status: response.status, body: new Uint8Array(await response.arrayBuffer()), type: response.headers.get(\"content-type\") ?? \"application/octet-stream\", cache: response.headers.get(\"cache-control\") ?? \"no-store\" };\n } catch (error) {\n return textResponse(502, `Proxy ${target}: ${error instanceof Error ? error.message : String(error)}`);\n }\n}\n\nexport async function createPackageHandler(options: PackageOriginOptions) {\n const registry = upstreamBase(options.upstreamRegistry);\n const origin = upstreamBase(options.upstreamOrigin);\n if (!options.packages.length) throw new Error(\"At least one local package directory is required\");\n const store = await createCatalogStore(options);\n const handle: PackageHandler = async (request, response) => {\n response.setHeader(\"access-control-allow-origin\", \"*\");\n response.setHeader(\"access-control-allow-methods\", \"GET, HEAD, OPTIONS\");\n response.setHeader(\"access-control-allow-headers\", \"*\");\n try {\n const raw = request.url ?? \"/\";\n const generation = raw.match(/^\\/_generations\\/([^/]+)(\\/.*)$/);\n const selected = await store.get(generation?.[1]);\n const url = generation?.[2] ?? raw;\n const served = [\"GET\", \"HEAD\"].includes(request.method ?? \"GET\") && url.split(\"?\")[0] === \"/__catalog.json\"\n ? { status: 200, body: JSON.stringify(selected.catalog), type: \"application/json\", cache: generation ? \"public, max-age=31536000, immutable\" : \"no-store\" }\n : await serveRequest({ url, method: request.method ?? \"GET\", locals: selected.locals, registry, origin, immutable: Boolean(generation) });\n response.writeHead(served.status, {\n \"content-type\": served.type,\n \"cache-control\": served.cache,\n ...(served.status === 204 || served.status === 304 ? {} : { \"content-length\": typeof served.body === \"string\" ? Buffer.byteLength(served.body) : served.body.byteLength }),\n \"timing-allow-origin\": \"*\",\n \"access-control-expose-headers\": \"content-length, content-encoding, server-timing\",\n });\n response.end(request.method === \"HEAD\" ? undefined : served.body);\n } catch (error) {\n console.error(\"Package request failed\", error);\n response.writeHead((error as NodeJS.ErrnoException).code === \"ENOENT\" ? 404 : 500, { \"content-type\": \"text/plain; charset=utf-8\", \"cache-control\": \"no-store\" });\n response.end((error as NodeJS.ErrnoException).code === \"ENOENT\" ? \"Package not found\" : \"Package request failed\");\n }\n };\n return { handle, current: store.current, subscribe: store.subscribe, close: store.close };\n}\n\nexport async function servePackages(options: PackageOriginOptions & { port: number }): Promise<{ origin: string; close: () => Promise<void> }> {\n if (!Number.isInteger(options.port) || options.port < 0 || options.port > 65535) throw new Error(`Invalid port: ${options.port}`);\n const handler = await createPackageHandler(options);\n const server = createServer((request, response) => { void handler.handle(request, response); });\n await new Promise<void>((done, fail) => { server.once(\"error\", fail); server.listen(options.port, \"127.0.0.1\", done); });\n return {\n origin: `http://127.0.0.1:${(server.address() as AddressInfo).port}`,\n close: () => new Promise<void>((done, fail) => {\n handler.close();\n server.closeAllConnections();\n server.close((error) => error ? fail(error) : done());\n }),\n };\n}\n"],"mappings":";;;;;;;;;AAUA,eAAsB,mBAAmB,SAAmD;CAC1F,MAAM,4BAAY,IAAI,IAAuC;CAC7D,MAAM,2BAAW,IAAI,IAAqB;CAC1C,MAAM,8BAAc,IAAI,IAAoB;CAC5C,KAAK,MAAM,QAAQ,QAAQ,UAAU;EACnC,MAAM,cAAc,MAAM,gBAAgB,IAAI;EAC9C,IAAI,YAAY,IAAI,YAAY,IAAI,GAAG,MAAM,IAAI,MAAM,4BAA4B,YAAY,MAAM;EACrG,YAAY,IAAI,YAAY,MAAM,IAAI;CACxC;CACA,IAAI;CACJ,IAAI;CACJ,MAAM,OAAO,YAAY;EACvB,MAAM,UAAU,MAAM,QAAQ,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,UAAU;GACpH,MAAM,cAAc,MAAM,gBAAgB,IAAI;GAC9C,IAAI,YAAY,SAAS,MAAM,MAAM,IAAI,MAAM,GAAG,KAAK,qDAAqD;GAC5G,OAAO;EACT,CAAC,CAAC;EACF,MAAM,WAAW,OAAO,YAAY,QAAQ,KAAK,EAAE,MAAM,SAAS,YAAY,CAAC,MAAM;GAAE;GAAM;GAAS;EAAM,CAAC,CAAC,CAAC;EAC/G,MAAM,WAAW,WAAW,QAAQ,CAAC,CAAC,OAAO,KAAK,UAAU,QAAQ,CAAC,CAAC,CAAC,OAAO,KAAK;EACnF,IAAI,SAAS,QAAQ,aAAa,UAAU;GAAE,UAAU,KAAA;GAAW;EAAQ;EAC3E,MAAM,UAAU;GAAE;GAAU;EAAS;EACrC,MAAM,SAAS,MAAM,cAAc,OAAO;EAC1C,MAAM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AE,OAAO,KAAK,SAAS,IAAI;EAAG,OAAO,OAAO,QAAQ,MAAM,aAAa,IAAI;CAAG,CAAC;CACvH,OAAO;EACL,QAAQ,oBAAqB,OAAO,QAAQ,CAAC,CAAiB;EAC9D,aAAa,IAAI,SAAe,MAAM,SAAS;GAC7C,QAAQ,MAAM;GACd,OAAO,oBAAoB;GAC3B,OAAO,OAAO,UAAU,QAAQ,KAAK,KAAK,IAAI,KAAK,CAAC;EACtD,CAAC;CACH;AACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { i as publishPackage, t as runPackageBuild } from "../chunks/publication-RchcQvxD.mjs";
|
|
2
|
+
// scripts/run-package-build.ts
|
|
3
|
+
const args = process.argv.slice(2);
|
|
4
|
+
if (args.length > 1 || args[0] !== void 0 && args[0] !== "--publish-only") throw new Error("Usage: run-package-build.ts [--publish-only]");
|
|
5
|
+
const publication = args[0] === "--publish-only" ? await publishPackage({ libraryDir: process.cwd() }) : await runPackageBuild({
|
|
6
|
+
libraryDir: process.cwd(),
|
|
7
|
+
command: "pnpm",
|
|
8
|
+
args: ["run", "build:artifacts"]
|
|
9
|
+
});
|
|
10
|
+
process.stdout.write(`Published ${publication.name}@${publication.version} build ${publication.build}\n`);
|
|
11
|
+
export {};
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=cli.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../../../scripts/run-package-build.ts"],"sourcesContent":["import { runPackageBuild, publishPackage } from \"../src/publication/index.ts\";\n\nconst args = process.argv.slice(2);\nif (args.length > 1 || (args[0] !== undefined && args[0] !== \"--publish-only\")) throw new Error(\"Usage: run-package-build.ts [--publish-only]\");\nconst publication = args[0] === \"--publish-only\"\n ? await publishPackage({ libraryDir: process.cwd() })\n : await runPackageBuild({ libraryDir: process.cwd(), command: \"pnpm\", args: [\"run\", \"build:artifacts\"] });\nprocess.stdout.write(`Published ${publication.name}@${publication.version} build ${publication.build}\\n`);\n"],"mappings":";;AAEA,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,IAAI,KAAK,SAAS,KAAM,KAAK,OAAO,KAAA,KAAa,KAAK,OAAO,kBAAmB,MAAM,IAAI,MAAM,8CAA8C;AAC9I,MAAM,cAAc,KAAK,OAAO,mBAC5B,MAAM,eAAe,EAAE,YAAY,QAAQ,IAAI,EAAE,CAAC,IAClD,MAAM,gBAAgB;CAAE,YAAY,QAAQ,IAAI;CAAG,SAAS;CAAQ,MAAM,CAAC,OAAO,iBAAiB;AAAE,CAAC;AAC1G,QAAQ,OAAO,MAAM,aAAa,YAAY,KAAK,GAAG,YAAY,QAAQ,SAAS,YAAY,MAAM,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as atomicJson, r as publicationRoot, i as publishPackage, a as readPublication, t as runPackageBuild } from "./chunks/publication-RchcQvxD.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/styles.ts
|
|
2
|
+
/** Normal declarations: dependencies first, derived libraries next, utilities last. */
|
|
3
|
+
function cascadeOrder(layers = ["components", "facet"]) {
|
|
4
|
+
const ordered = [...new Set(layers)];
|
|
5
|
+
for (const layer of ordered) if (!/^[a-zA-Z_][\w-]*$/.test(layer) || [
|
|
6
|
+
"theme",
|
|
7
|
+
"base",
|
|
8
|
+
"utilities"
|
|
9
|
+
].includes(layer)) throw new Error(`Invalid library cascade layer: ${layer}`);
|
|
10
|
+
return `@layer theme, base, ${ordered.join(", ")}, utilities;`;
|
|
11
|
+
}
|
|
12
|
+
const layerOrder = cascadeOrder();
|
|
13
|
+
function inspectStyles(document) {
|
|
14
|
+
const view = document.defaultView;
|
|
15
|
+
if (!view) throw new Error("Style inspection requires a live document");
|
|
16
|
+
const root = view.getComputedStyle(document.documentElement);
|
|
17
|
+
const body = view.getComputedStyle(document.body);
|
|
18
|
+
const documentRoot = document.querySelector("[data-facet-theme]") ?? document.body;
|
|
19
|
+
const documentStyle = view.getComputedStyle(documentRoot);
|
|
20
|
+
const heading = document.querySelector("h2");
|
|
21
|
+
const page = documentRoot.querySelector("[data-page-size]");
|
|
22
|
+
return {
|
|
23
|
+
order: [...document.querySelectorAll("style")].map((style) => style.textContent?.match(/@layer\s+[^{};]+;/)?.[0]).find(Boolean) ?? "No explicit layer order",
|
|
24
|
+
theme: documentRoot.getAttribute("data-facet-theme") ?? "facet",
|
|
25
|
+
"--text-xl": root.getPropertyValue("--text-xl").trim(),
|
|
26
|
+
"--text-sm": root.getPropertyValue("--text-sm").trim(),
|
|
27
|
+
...Object.fromEntries([.../* @__PURE__ */ new Set([...Array.from(root), ...Array.from(documentStyle)])].filter((name) => /^--(?:facet|text)-/.test(name)).map((name) => [name, (documentStyle.getPropertyValue(name) || root.getPropertyValue(name)).trim()])),
|
|
28
|
+
"body font size": body.fontSize,
|
|
29
|
+
"document font size": documentStyle.fontSize,
|
|
30
|
+
"document font family": documentStyle.fontFamily,
|
|
31
|
+
"document line height": documentStyle.lineHeight,
|
|
32
|
+
"document text color": documentStyle.color,
|
|
33
|
+
"document background": documentStyle.backgroundColor === "rgba(0, 0, 0, 0)" ? body.backgroundColor : documentStyle.backgroundColor,
|
|
34
|
+
"heading font size": heading ? view.getComputedStyle(heading).fontSize : "No h2",
|
|
35
|
+
...page ? {
|
|
36
|
+
"page size": page.getAttribute("data-page-size") ?? "",
|
|
37
|
+
...Object.fromEntries([
|
|
38
|
+
"top",
|
|
39
|
+
"right",
|
|
40
|
+
"bottom",
|
|
41
|
+
"left"
|
|
42
|
+
].map((side) => [`page margin ${side}`, page.getAttribute(`data-margin-${side}`) ?? ""]))
|
|
43
|
+
} : {},
|
|
44
|
+
stylesheets: [...document.querySelectorAll("[data-page-runtime-base]")].map((style) => style.getAttribute("data-page-runtime-base")).join("\n")
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export { cascadeOrder, inspectStyles, layerOrder };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=styles.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.mjs","names":[],"sources":["../../src/styles.ts"],"sourcesContent":["/** Normal declarations: dependencies first, derived libraries next, utilities last. */\nexport function cascadeOrder(layers: string[] = ['components', 'facet']): string {\n const ordered = [...new Set(layers)];\n for (const layer of ordered) if (!/^[a-zA-Z_][\\w-]*$/.test(layer) || ['theme', 'base', 'utilities'].includes(layer)) throw new Error(`Invalid library cascade layer: ${layer}`);\n return `@layer theme, base, ${ordered.join(', ')}, utilities;`;\n}\n\nexport const layerOrder = cascadeOrder();\n\nexport function inspectStyles(document: Document): Record<string, string> {\n const view = document.defaultView;\n if (!view) throw new Error('Style inspection requires a live document');\n const root = view.getComputedStyle(document.documentElement);\n const body = view.getComputedStyle(document.body);\n const documentRoot = document.querySelector('[data-facet-theme]') ?? document.body;\n const documentStyle = view.getComputedStyle(documentRoot);\n const heading = document.querySelector('h2');\n const page = documentRoot.querySelector('[data-page-size]');\n return {\n order: [...document.querySelectorAll('style')].map(style => style.textContent?.match(/@layer\\s+[^{};]+;/)?.[0]).find(Boolean) ?? 'No explicit layer order',\n theme: documentRoot.getAttribute('data-facet-theme') ?? 'facet',\n '--text-xl': root.getPropertyValue('--text-xl').trim(),\n '--text-sm': root.getPropertyValue('--text-sm').trim(),\n ...Object.fromEntries([...new Set([...Array.from(root), ...Array.from(documentStyle)])]\n .filter(name => /^--(?:facet|text)-/.test(name))\n .map(name => [name, (documentStyle.getPropertyValue(name) || root.getPropertyValue(name)).trim()])),\n 'body font size': body.fontSize,\n 'document font size': documentStyle.fontSize,\n 'document font family': documentStyle.fontFamily,\n 'document line height': documentStyle.lineHeight,\n 'document text color': documentStyle.color,\n 'document background': documentStyle.backgroundColor === 'rgba(0, 0, 0, 0)' ? body.backgroundColor : documentStyle.backgroundColor,\n 'heading font size': heading ? view.getComputedStyle(heading).fontSize : 'No h2',\n ...(page ? {\n 'page size': page.getAttribute('data-page-size') ?? '',\n ...Object.fromEntries(['top', 'right', 'bottom', 'left'].map(side => [`page margin ${side}`, page.getAttribute(`data-margin-${side}`) ?? ''])),\n } : {}),\n stylesheets: [...document.querySelectorAll('[data-page-runtime-base]')].map(style => style.getAttribute('data-page-runtime-base')).join('\\n'),\n };\n}\n"],"mappings":";;AACA,SAAgB,aAAa,SAAmB,CAAC,cAAc,OAAO,GAAW;CAC/E,MAAM,UAAU,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC;CACnC,KAAK,MAAM,SAAS,SAAS,IAAI,CAAC,oBAAoB,KAAK,KAAK,KAAK;EAAC;EAAS;EAAQ;CAAW,CAAC,CAAC,SAAS,KAAK,GAAG,MAAM,IAAI,MAAM,kCAAkC,OAAO;CAC9K,OAAO,uBAAuB,QAAQ,KAAK,IAAI,EAAE;AACnD;AAEA,MAAa,aAAa,aAAa;AAEvC,SAAgB,cAAc,UAA4C;CACxE,MAAM,OAAO,SAAS;CACtB,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,2CAA2C;CACtE,MAAM,OAAO,KAAK,iBAAiB,SAAS,eAAe;CAC3D,MAAM,OAAO,KAAK,iBAAiB,SAAS,IAAI;CAChD,MAAM,eAAe,SAAS,cAAc,oBAAoB,KAAK,SAAS;CAC9E,MAAM,gBAAgB,KAAK,iBAAiB,YAAY;CACxD,MAAM,UAAU,SAAS,cAAc,IAAI;CAC3C,MAAM,OAAO,aAAa,cAAc,kBAAkB;CAC1D,OAAO;EACL,OAAO,CAAC,GAAG,SAAS,iBAAiB,OAAO,CAAC,CAAC,CAAC,KAAI,UAAS,MAAM,aAAa,MAAM,mBAAmB,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,OAAO,KAAK;EACjI,OAAO,aAAa,aAAa,kBAAkB,KAAK;EACxD,aAAa,KAAK,iBAAiB,WAAW,CAAC,CAAC,KAAK;EACrD,aAAa,KAAK,iBAAiB,WAAW,CAAC,CAAC,KAAK;EACrD,GAAG,OA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