@format.dev/compile 0.0.0 → 0.1.1
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 +30 -20
- package/bin/format-compile +3 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs +12 -0
- package/dist/_virtual/rolldown_runtime.mjs +46 -0
- package/dist/node_modules/.pnpm/@babel_parser@7.29.8/node_modules/@babel/parser/lib/index.mjs +12606 -0
- package/dist/node_modules/.pnpm/@babel_parser@7.29.8/node_modules/@babel/parser/lib/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_compiler-core@3.5.41/node_modules/@vue/compiler-core/dist/compiler-core.cjs.mjs +4866 -0
- package/dist/node_modules/.pnpm/@vue_compiler-core@3.5.41/node_modules/@vue/compiler-core/dist/compiler-core.cjs.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_compiler-core@3.5.41/node_modules/@vue/compiler-core/index.mjs +13 -0
- package/dist/node_modules/.pnpm/@vue_compiler-core@3.5.41/node_modules/@vue/compiler-core/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_compiler-dom@3.5.41/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.mjs +663 -0
- package/dist/node_modules/.pnpm/@vue_compiler-dom@3.5.41/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_compiler-dom@3.5.41/node_modules/@vue/compiler-dom/index.mjs +13 -0
- package/dist/node_modules/.pnpm/@vue_compiler-dom@3.5.41/node_modules/@vue/compiler-dom/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_compiler-ssr@3.5.41/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.mjs +846 -0
- package/dist/node_modules/.pnpm/@vue_compiler-ssr@3.5.41/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_reactivity@3.5.41/node_modules/@vue/reactivity/dist/reactivity.cjs.mjs +1600 -0
- package/dist/node_modules/.pnpm/@vue_reactivity@3.5.41/node_modules/@vue/reactivity/dist/reactivity.cjs.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_reactivity@3.5.41/node_modules/@vue/reactivity/index.mjs +13 -0
- package/dist/node_modules/.pnpm/@vue_reactivity@3.5.41/node_modules/@vue/reactivity/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_runtime-core@3.5.41/node_modules/@vue/runtime-core/dist/runtime-core.cjs.mjs +5619 -0
- package/dist/node_modules/.pnpm/@vue_runtime-core@3.5.41/node_modules/@vue/runtime-core/dist/runtime-core.cjs.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_runtime-core@3.5.41/node_modules/@vue/runtime-core/index.mjs +13 -0
- package/dist/node_modules/.pnpm/@vue_runtime-core@3.5.41/node_modules/@vue/runtime-core/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_runtime-dom@3.5.41/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.mjs +1479 -0
- package/dist/node_modules/.pnpm/@vue_runtime-dom@3.5.41/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_runtime-dom@3.5.41/node_modules/@vue/runtime-dom/index.mjs +13 -0
- package/dist/node_modules/.pnpm/@vue_runtime-dom@3.5.41/node_modules/@vue/runtime-dom/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.41/node_modules/@vue/server-renderer/dist/server-renderer.cjs.mjs +510 -0
- package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.41/node_modules/@vue/server-renderer/dist/server-renderer.cjs.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.41/node_modules/@vue/server-renderer/index.mjs +13 -0
- package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.41/node_modules/@vue/server-renderer/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_shared@3.5.41/node_modules/@vue/shared/dist/shared.cjs.mjs +499 -0
- package/dist/node_modules/.pnpm/@vue_shared@3.5.41/node_modules/@vue/shared/dist/shared.cjs.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@vue_shared@3.5.41/node_modules/@vue/shared/index.mjs +13 -0
- package/dist/node_modules/.pnpm/@vue_shared@3.5.41/node_modules/@vue/shared/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/decode-codepoint.mjs +79 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/decode-codepoint.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/decode.mjs +471 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/decode.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/generated/decode-data-html.mjs +16 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/generated/decode-data-html.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/generated/decode-data-xml.mjs +16 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/generated/decode-data-xml.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/internal/bin-trie-flags.mjs +30 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/internal/bin-trie-flags.mjs.map +1 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/internal/decode-shared.mjs +24 -0
- package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/internal/decode-shared.mjs.map +1 -0
- package/dist/node_modules/.pnpm/estree-walker@2.0.2/node_modules/estree-walker/dist/umd/estree-walker.mjs +253 -0
- package/dist/node_modules/.pnpm/estree-walker@2.0.2/node_modules/estree-walker/dist/umd/estree-walker.mjs.map +1 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.mjs +5246 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.mjs.map +1 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-server.node.development.mjs +5616 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-server.node.development.mjs.map +1 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom.development.mjs +183 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom.development.mjs.map +1 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/index.mjs +13 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/server.node.mjs +21 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/server.node.mjs.map +1 -0
- package/dist/node_modules/.pnpm/react@19.2.8/node_modules/react/cjs/react.development.mjs +766 -0
- package/dist/node_modules/.pnpm/react@19.2.8/node_modules/react/cjs/react.development.mjs.map +1 -0
- package/dist/node_modules/.pnpm/react@19.2.8/node_modules/react/index.mjs +13 -0
- package/dist/node_modules/.pnpm/react@19.2.8/node_modules/react/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/array-set.mjs +100 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/array-set.mjs.map +1 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64-vlq.mjs +73 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64-vlq.mjs.map +1 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64.mjs +41 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64.mjs.map +1 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/binary-search.mjs +68 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/binary-search.mjs.map +1 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/mapping-list.mjs +77 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/mapping-list.mjs.map +1 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/quick-sort.mjs +89 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/quick-sort.mjs.map +1 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-consumer.mjs +788 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-consumer.mjs.map +1 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-generator.mjs +295 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-generator.mjs.map +1 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-node.mjs +293 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-node.mjs.map +1 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/util.mjs +352 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/util.mjs.map +1 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/source-map.mjs +17 -0
- package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/source-map.mjs.map +1 -0
- package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/dist/vue.cjs.mjs +67 -0
- package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/dist/vue.cjs.mjs.map +1 -0
- package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/index.mjs +13 -0
- package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/index2.mjs +10 -0
- package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/index2.mjs.map +1 -0
- package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/server-renderer/index.mjs +10 -0
- package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/server-renderer/index.mjs.map +1 -0
- package/dist/server/cli/bin.d.mts +1 -0
- package/dist/server/cli/bin.mjs +8 -0
- package/dist/server/cli/bin.mjs.map +1 -0
- package/dist/server/cli/cli-spec.mjs +150 -0
- package/dist/server/cli/cli-spec.mjs.map +1 -0
- package/dist/server/cli/index.d.mts +16 -0
- package/dist/server/cli/index.d.mts.map +1 -0
- package/dist/server/cli/index.mjs +64 -0
- package/dist/server/cli/index.mjs.map +1 -0
- package/dist/server/compile/adaptors/html-partials.d.mts +24 -0
- package/dist/server/compile/adaptors/html-partials.d.mts.map +1 -0
- package/dist/server/compile/adaptors/html-partials.mjs +50 -0
- package/dist/server/compile/adaptors/html-partials.mjs.map +1 -0
- package/dist/server/compile/adaptors/html.d.mts +15 -0
- package/dist/server/compile/adaptors/html.d.mts.map +1 -0
- package/dist/server/compile/adaptors/html.mjs +39 -0
- package/dist/server/compile/adaptors/html.mjs.map +1 -0
- package/dist/server/compile/adaptors/node-require.d.mts +6 -0
- package/dist/server/compile/adaptors/node-require.d.mts.map +1 -0
- package/dist/server/compile/adaptors/node-require.mjs +35 -0
- package/dist/server/compile/adaptors/node-require.mjs.map +1 -0
- package/dist/server/compile/adaptors/react-browser.d.mts +20 -0
- package/dist/server/compile/adaptors/react-browser.d.mts.map +1 -0
- package/dist/server/compile/adaptors/react-browser.mjs +19 -0
- package/dist/server/compile/adaptors/react-browser.mjs.map +1 -0
- package/dist/server/compile/adaptors/react-node.d.mts +17 -0
- package/dist/server/compile/adaptors/react-node.d.mts.map +1 -0
- package/dist/server/compile/adaptors/react-node.mjs +50 -0
- package/dist/server/compile/adaptors/react-node.mjs.map +1 -0
- package/dist/server/compile/adaptors/types.d.mts +14 -0
- package/dist/server/compile/adaptors/types.d.mts.map +1 -0
- package/dist/server/compile/adaptors/types.mjs +1 -0
- package/dist/server/compile/adaptors/vue-browser.d.mts +16 -0
- package/dist/server/compile/adaptors/vue-browser.d.mts.map +1 -0
- package/dist/server/compile/adaptors/vue-browser.mjs +16 -0
- package/dist/server/compile/adaptors/vue-browser.mjs.map +1 -0
- package/dist/server/compile/adaptors/vue-node.d.mts +17 -0
- package/dist/server/compile/adaptors/vue-node.d.mts.map +1 -0
- package/dist/server/compile/adaptors/vue-node.mjs +50 -0
- package/dist/server/compile/adaptors/vue-node.mjs.map +1 -0
- package/dist/server/compile/build-entry-module.d.mts +20 -0
- package/dist/server/compile/build-entry-module.d.mts.map +1 -0
- package/dist/server/compile/build-entry-module.mjs +56 -0
- package/dist/server/compile/build-entry-module.mjs.map +1 -0
- package/dist/server/compile/bundle-name.d.mts +5 -0
- package/dist/server/compile/bundle-name.d.mts.map +1 -0
- package/dist/server/compile/bundle-name.mjs +13 -0
- package/dist/server/compile/bundle-name.mjs.map +1 -0
- package/dist/server/compile/compile-cache.d.mts +23 -0
- package/dist/server/compile/compile-cache.d.mts.map +1 -0
- package/dist/server/compile/compile-cache.mjs +102 -0
- package/dist/server/compile/compile-cache.mjs.map +1 -0
- package/dist/server/compile/compile.d.mts +100 -0
- package/dist/server/compile/compile.d.mts.map +1 -0
- package/dist/server/compile/compile.mjs +735 -0
- package/dist/server/compile/compile.mjs.map +1 -0
- package/dist/server/compile/constants.d.mts +11 -0
- package/dist/server/compile/constants.d.mts.map +1 -0
- package/dist/server/compile/constants.mjs +12 -0
- package/dist/server/compile/constants.mjs.map +1 -0
- package/dist/server/compile/create-renderer.d.mts +16 -0
- package/dist/server/compile/create-renderer.d.mts.map +1 -0
- package/dist/server/compile/create-renderer.mjs +59 -0
- package/dist/server/compile/create-renderer.mjs.map +1 -0
- package/dist/server/compile/decode-style-entities.d.mts +12 -0
- package/dist/server/compile/decode-style-entities.d.mts.map +1 -0
- package/dist/server/compile/decode-style-entities.mjs +32 -0
- package/dist/server/compile/decode-style-entities.mjs.map +1 -0
- package/dist/server/compile/defaults.d.mts +18 -0
- package/dist/server/compile/defaults.d.mts.map +1 -0
- package/dist/server/compile/defaults.mjs +128 -0
- package/dist/server/compile/defaults.mjs.map +1 -0
- package/dist/server/compile/dependency-closure.d.mts +10 -0
- package/dist/server/compile/dependency-closure.d.mts.map +1 -0
- package/dist/server/compile/dependency-closure.mjs +79 -0
- package/dist/server/compile/dependency-closure.mjs.map +1 -0
- package/dist/server/compile/document-assets.d.mts +103 -0
- package/dist/server/compile/document-assets.d.mts.map +1 -0
- package/dist/server/compile/document-assets.mjs +184 -0
- package/dist/server/compile/document-assets.mjs.map +1 -0
- package/dist/server/compile/finalize-document-html.d.mts +53 -0
- package/dist/server/compile/finalize-document-html.d.mts.map +1 -0
- package/dist/server/compile/finalize-document-html.mjs +132 -0
- package/dist/server/compile/finalize-document-html.mjs.map +1 -0
- package/dist/server/compile/generated/adaptorHtml.mjs +6 -0
- package/dist/server/compile/generated/adaptorHtml.mjs.map +1 -0
- package/dist/server/compile/generated/adaptorReactBrowser.mjs +6 -0
- package/dist/server/compile/generated/adaptorReactBrowser.mjs.map +1 -0
- package/dist/server/compile/generated/adaptorReactNode.mjs +6 -0
- package/dist/server/compile/generated/adaptorReactNode.mjs.map +1 -0
- package/dist/server/compile/generated/adaptorVueBrowser.mjs +6 -0
- package/dist/server/compile/generated/adaptorVueBrowser.mjs.map +1 -0
- package/dist/server/compile/generated/adaptorVueNode.mjs +6 -0
- package/dist/server/compile/generated/adaptorVueNode.mjs.map +1 -0
- package/dist/server/compile/generated/createRenderer.mjs +6 -0
- package/dist/server/compile/generated/createRenderer.mjs.map +1 -0
- package/dist/server/compile/generated/decodeStyleEntities.mjs +6 -0
- package/dist/server/compile/generated/decodeStyleEntities.mjs.map +1 -0
- package/dist/server/compile/generated/sanitizeHtml.mjs +6 -0
- package/dist/server/compile/generated/sanitizeHtml.mjs.map +1 -0
- package/dist/server/compile/generated/validate.mjs +6 -0
- package/dist/server/compile/generated/validate.mjs.map +1 -0
- package/dist/server/compile/generated/virtualStyles.mjs +6 -0
- package/dist/server/compile/generated/virtualStyles.mjs.map +1 -0
- package/dist/server/compile/get-renderer.d.mts +18 -0
- package/dist/server/compile/get-renderer.d.mts.map +1 -0
- package/dist/server/compile/get-renderer.mjs +31 -0
- package/dist/server/compile/get-renderer.mjs.map +1 -0
- package/dist/server/compile/index.d.mts +2 -0
- package/dist/server/compile/index.mjs +3 -0
- package/dist/server/compile/make-config.d.mts +39 -0
- package/dist/server/compile/make-config.d.mts.map +1 -0
- package/dist/server/compile/make-config.mjs +278 -0
- package/dist/server/compile/make-config.mjs.map +1 -0
- package/dist/server/compile/package-json.d.mts +5 -0
- package/dist/server/compile/package-json.d.mts.map +1 -0
- package/dist/server/compile/package-json.mjs +33 -0
- package/dist/server/compile/package-json.mjs.map +1 -0
- package/dist/server/compile/producer-agreement.d.mts +82 -0
- package/dist/server/compile/producer-agreement.d.mts.map +1 -0
- package/dist/server/compile/producer-agreement.mjs +143 -0
- package/dist/server/compile/producer-agreement.mjs.map +1 -0
- package/dist/server/compile/producer-release.d.mts +19 -0
- package/dist/server/compile/producer-release.d.mts.map +1 -0
- package/dist/server/compile/producer-release.mjs +27 -0
- package/dist/server/compile/producer-release.mjs.map +1 -0
- package/dist/server/compile/render-error.d.mts +37 -0
- package/dist/server/compile/render-error.d.mts.map +1 -0
- package/dist/server/compile/render-error.mjs +55 -0
- package/dist/server/compile/render-error.mjs.map +1 -0
- package/dist/server/compile/sanitize/shared.d.mts +19 -0
- package/dist/server/compile/sanitize/shared.d.mts.map +1 -0
- package/dist/server/compile/sanitize/shared.mjs +131 -0
- package/dist/server/compile/sanitize/shared.mjs.map +1 -0
- package/dist/server/compile/sanitize-html.d.mts +5 -0
- package/dist/server/compile/sanitize-html.d.mts.map +1 -0
- package/dist/server/compile/sanitize-html.mjs +65 -0
- package/dist/server/compile/sanitize-html.mjs.map +1 -0
- package/dist/server/compile/structured-log.d.mts +22 -0
- package/dist/server/compile/structured-log.d.mts.map +1 -0
- package/dist/server/compile/structured-log.mjs +31 -0
- package/dist/server/compile/structured-log.mjs.map +1 -0
- package/dist/server/compile/virtual-styles.d.mts +5 -0
- package/dist/server/compile/virtual-styles.d.mts.map +1 -0
- package/dist/server/compile/virtual-styles.mjs +19 -0
- package/dist/server/compile/virtual-styles.mjs.map +1 -0
- package/dist/server/compile/wrapper-source.d.mts +55 -0
- package/dist/server/compile/wrapper-source.d.mts.map +1 -0
- package/dist/server/compile/wrapper-source.mjs +187 -0
- package/dist/server/compile/wrapper-source.mjs.map +1 -0
- package/dist/server/constants.d.mts +17 -0
- package/dist/server/constants.d.mts.map +1 -0
- package/dist/server/constants.mjs +41 -0
- package/dist/server/constants.mjs.map +1 -0
- package/dist/server/errors.d.mts +21 -0
- package/dist/server/errors.d.mts.map +1 -0
- package/dist/server/errors.mjs +24 -0
- package/dist/server/errors.mjs.map +1 -0
- package/dist/server/index.d.mts +4 -0
- package/dist/server/index.mjs +4 -0
- package/dist/server/integrations/nextjs/generate-entry.d.mts +19 -0
- package/dist/server/integrations/nextjs/generate-entry.d.mts.map +1 -0
- package/dist/server/integrations/nextjs/generate-entry.mjs +246 -0
- package/dist/server/integrations/nextjs/generate-entry.mjs.map +1 -0
- package/dist/server/integrations/nextjs/index.d.mts +8 -0
- package/dist/server/integrations/nextjs/index.d.mts.map +1 -0
- package/dist/server/integrations/nextjs/index.mjs +90 -0
- package/dist/server/integrations/nextjs/index.mjs.map +1 -0
- package/dist/server/integrations/nextjs/watcher.d.mts +9 -0
- package/dist/server/integrations/nextjs/watcher.d.mts.map +1 -0
- package/dist/server/integrations/nextjs/watcher.mjs +45 -0
- package/dist/server/integrations/nextjs/watcher.mjs.map +1 -0
- package/dist/server/integrations/unplugin/esbuild.d.mts +2 -0
- package/dist/server/integrations/unplugin/esbuild.mjs +3 -0
- package/dist/server/integrations/unplugin/index.d.mts +69 -0
- package/dist/server/integrations/unplugin/index.d.mts.map +1 -0
- package/dist/server/integrations/unplugin/index.mjs +539 -0
- package/dist/server/integrations/unplugin/index.mjs.map +1 -0
- package/dist/server/integrations/unplugin/rollup.d.mts +2 -0
- package/dist/server/integrations/unplugin/rollup.mjs +3 -0
- package/dist/server/integrations/unplugin/utils.d.mts +12 -0
- package/dist/server/integrations/unplugin/utils.d.mts.map +1 -0
- package/dist/server/integrations/unplugin/utils.mjs +46 -0
- package/dist/server/integrations/unplugin/utils.mjs.map +1 -0
- package/dist/server/integrations/unplugin/vite.d.mts +2 -0
- package/dist/server/integrations/unplugin/vite.mjs +3 -0
- package/dist/server/integrations/unplugin/webpack.d.mts +2 -0
- package/dist/server/integrations/unplugin/webpack.mjs +3 -0
- package/dist/server/project/documents.d.mts +21 -0
- package/dist/server/project/documents.d.mts.map +1 -0
- package/dist/server/project/documents.mjs +114 -0
- package/dist/server/project/documents.mjs.map +1 -0
- package/dist/server/project/format-env-types.d.mts +19 -0
- package/dist/server/project/format-env-types.d.mts.map +1 -0
- package/dist/server/project/format-env-types.mjs +64 -0
- package/dist/server/project/format-env-types.mjs.map +1 -0
- package/dist/server/project/paths.d.mts +21 -0
- package/dist/server/project/paths.d.mts.map +1 -0
- package/dist/server/project/paths.mjs +31 -0
- package/dist/server/project/paths.mjs.map +1 -0
- package/dist/server/project/user-project-dir.d.mts +7 -0
- package/dist/server/project/user-project-dir.d.mts.map +1 -0
- package/dist/server/project/user-project-dir.mjs +16 -0
- package/dist/server/project/user-project-dir.mjs.map +1 -0
- package/dist/server/render-worker/client.d.mts +83 -0
- package/dist/server/render-worker/client.d.mts.map +1 -0
- package/dist/server/render-worker/client.mjs +359 -0
- package/dist/server/render-worker/client.mjs.map +1 -0
- package/dist/server/render-worker/document-css.d.mts +27 -0
- package/dist/server/render-worker/document-css.d.mts.map +1 -0
- package/dist/server/render-worker/document-css.mjs +37 -0
- package/dist/server/render-worker/document-css.mjs.map +1 -0
- package/dist/server/render-worker/env.d.mts +11 -0
- package/dist/server/render-worker/env.d.mts.map +1 -0
- package/dist/server/render-worker/env.mjs +26 -0
- package/dist/server/render-worker/env.mjs.map +1 -0
- package/dist/server/render-worker/error.d.mts +17 -0
- package/dist/server/render-worker/error.d.mts.map +1 -0
- package/dist/server/render-worker/error.mjs +40 -0
- package/dist/server/render-worker/error.mjs.map +1 -0
- package/dist/server/render-worker/host.d.mts +1 -0
- package/dist/server/render-worker/host.mjs +181 -0
- package/dist/server/render-worker/host.mjs.map +1 -0
- package/dist/server/render-worker/index.d.mts +4 -0
- package/dist/server/render-worker/index.mjs +4 -0
- package/dist/server/render-worker/sandbox.d.mts +25 -0
- package/dist/server/render-worker/sandbox.d.mts.map +1 -0
- package/dist/server/render-worker/sandbox.mjs +60 -0
- package/dist/server/render-worker/sandbox.mjs.map +1 -0
- package/dist/server/render-worker/types.d.mts +59 -0
- package/dist/server/render-worker/types.d.mts.map +1 -0
- package/dist/server/render-worker/types.mjs +1 -0
- package/dist/server/runtime-state.d.mts +12 -0
- package/dist/server/runtime-state.d.mts.map +1 -0
- package/dist/server/runtime-state.mjs +24 -0
- package/dist/server/runtime-state.mjs.map +1 -0
- package/dist/server/utils/check-dir.d.mts +12 -0
- package/dist/server/utils/check-dir.d.mts.map +1 -0
- package/dist/server/utils/check-dir.mjs +30 -0
- package/dist/server/utils/check-dir.mjs.map +1 -0
- package/dist/server/utils/dependencies.d.mts +11 -0
- package/dist/server/utils/dependencies.d.mts.map +1 -0
- package/dist/server/utils/dependencies.mjs +34 -0
- package/dist/server/utils/dependencies.mjs.map +1 -0
- package/dist/server/utils/env-var.d.mts +6 -0
- package/dist/server/utils/env-var.d.mts.map +1 -0
- package/dist/server/utils/env-var.mjs +28 -0
- package/dist/server/utils/env-var.mjs.map +1 -0
- package/dist/server/utils/format-for-log.d.mts +5 -0
- package/dist/server/utils/format-for-log.d.mts.map +1 -0
- package/dist/server/utils/format-for-log.mjs +17 -0
- package/dist/server/utils/format-for-log.mjs.map +1 -0
- package/dist/server/utils/index.d.mts +8 -0
- package/dist/server/utils/index.mjs +9 -0
- package/dist/server/utils/load-config.d.mts +13 -0
- package/dist/server/utils/load-config.d.mts.map +1 -0
- package/dist/server/utils/load-config.mjs +65 -0
- package/dist/server/utils/load-config.mjs.map +1 -0
- package/dist/server/utils/log.d.mts +36 -0
- package/dist/server/utils/log.d.mts.map +1 -0
- package/dist/server/utils/log.mjs +125 -0
- package/dist/server/utils/log.mjs.map +1 -0
- package/dist/server/utils/read-file.d.mts +5 -0
- package/dist/server/utils/read-file.d.mts.map +1 -0
- package/dist/server/utils/read-file.mjs +14 -0
- package/dist/server/utils/read-file.mjs.map +1 -0
- package/dist/server/utils/resolve-path-with-extensions.d.mts +21 -0
- package/dist/server/utils/resolve-path-with-extensions.d.mts.map +1 -0
- package/dist/server/utils/resolve-path-with-extensions.mjs +39 -0
- package/dist/server/utils/resolve-path-with-extensions.mjs.map +1 -0
- package/dist/server/utils/schema.d.mts +7 -0
- package/dist/server/utils/schema.d.mts.map +1 -0
- package/dist/server/utils/schema.mjs +21 -0
- package/dist/server/utils/schema.mjs.map +1 -0
- package/dist/server/utils/standard-schema-validate.d.mts +13 -0
- package/dist/server/utils/standard-schema-validate.d.mts.map +1 -0
- package/dist/server/utils/standard-schema-validate.mjs +21 -0
- package/dist/server/utils/standard-schema-validate.mjs.map +1 -0
- package/dist/server/utils/suggest-similar.d.mts +9 -0
- package/dist/server/utils/suggest-similar.d.mts.map +1 -0
- package/dist/server/utils/suggest-similar.mjs +39 -0
- package/dist/server/utils/suggest-similar.mjs.map +1 -0
- package/dist/server/utils/warn-lockstep.d.mts +13 -0
- package/dist/server/utils/warn-lockstep.d.mts.map +1 -0
- package/dist/server/utils/warn-lockstep.mjs +23 -0
- package/dist/server/utils/warn-lockstep.mjs.map +1 -0
- package/dist/server/vite/create-config.d.mts +35 -0
- package/dist/server/vite/create-config.d.mts.map +1 -0
- package/dist/server/vite/create-config.mjs +64 -0
- package/dist/server/vite/create-config.mjs.map +1 -0
- package/dist/server/vite/plugins/collect-css.d.mts +8 -0
- package/dist/server/vite/plugins/collect-css.d.mts.map +1 -0
- package/dist/server/vite/plugins/collect-css.mjs +21 -0
- package/dist/server/vite/plugins/collect-css.mjs.map +1 -0
- package/dist/server/vite/plugins/get-styles.d.mts +14 -0
- package/dist/server/vite/plugins/get-styles.d.mts.map +1 -0
- package/dist/server/vite/plugins/get-styles.mjs +88 -0
- package/dist/server/vite/plugins/get-styles.mjs.map +1 -0
- package/dist/server/vite/plugins/html-loader.d.mts +18 -0
- package/dist/server/vite/plugins/html-loader.d.mts.map +1 -0
- package/dist/server/vite/plugins/html-loader.mjs +88 -0
- package/dist/server/vite/plugins/html-loader.mjs.map +1 -0
- package/dist/server/vite/plugins/postcss/import-url.d.mts +14 -0
- package/dist/server/vite/plugins/postcss/import-url.d.mts.map +1 -0
- package/dist/server/vite/plugins/postcss/import-url.mjs +163 -0
- package/dist/server/vite/plugins/postcss/import-url.mjs.map +1 -0
- package/dist/server/vite/plugins/styles-pre-processor.d.mts +7 -0
- package/dist/server/vite/plugins/styles-pre-processor.d.mts.map +1 -0
- package/dist/server/vite/plugins/styles-pre-processor.mjs +64 -0
- package/dist/server/vite/plugins/styles-pre-processor.mjs.map +1 -0
- package/dist/server/vite/plugins/utils.d.mts +9 -0
- package/dist/server/vite/plugins/utils.d.mts.map +1 -0
- package/dist/server/vite/plugins/utils.mjs +14 -0
- package/dist/server/vite/plugins/utils.mjs.map +1 -0
- package/dist/shared/constants.d.mts +11 -0
- package/dist/shared/constants.d.mts.map +1 -0
- package/dist/shared/constants.mjs +12 -0
- package/dist/shared/constants.mjs.map +1 -0
- package/dist/shared/env.d.mts +6 -0
- package/dist/shared/env.d.mts.map +1 -0
- package/dist/shared/env.mjs +11 -0
- package/dist/shared/env.mjs.map +1 -0
- package/dist/shared/http.d.mts +15 -0
- package/dist/shared/http.d.mts.map +1 -0
- package/dist/shared/http.mjs +54 -0
- package/dist/shared/http.mjs.map +1 -0
- package/dist/shared/types/document.d.mts +17 -0
- package/dist/shared/types/document.d.mts.map +1 -0
- package/dist/shared/types/document.mjs +1 -0
- package/dist/shared/types/index.d.mts +7 -0
- package/dist/shared/types/index.mjs +4 -0
- package/dist/shared/types/log.d.mts +10 -0
- package/dist/shared/types/log.d.mts.map +1 -0
- package/dist/shared/types/log.mjs +12 -0
- package/dist/shared/types/log.mjs.map +1 -0
- package/dist/shared/types/public/cli.d.mts +33 -0
- package/dist/shared/types/public/cli.d.mts.map +1 -0
- package/dist/shared/types/public/cli.mjs +1 -0
- package/dist/shared/types/public/compile.d.mts +45 -0
- package/dist/shared/types/public/compile.d.mts.map +1 -0
- package/dist/shared/types/public/compile.mjs +29 -0
- package/dist/shared/types/public/compile.mjs.map +1 -0
- package/dist/shared/types/public/config.d.mts +94 -0
- package/dist/shared/types/public/config.d.mts.map +1 -0
- package/dist/shared/types/public/config.mjs +20 -0
- package/dist/shared/types/public/config.mjs.map +1 -0
- package/dist/shared/types/public/index.d.mts +6 -0
- package/dist/shared/types/public/index.mjs +4 -0
- package/dist/shared/types/public/nextjs.d.mts +111 -0
- package/dist/shared/types/public/nextjs.d.mts.map +1 -0
- package/dist/shared/types/public/nextjs.mjs +1 -0
- package/dist/shared/types/public/renderer.d.mts +2 -0
- package/dist/shared/types/public/renderer.mjs +1 -0
- package/dist/shared/types/public/unplugin.d.mts +65 -0
- package/dist/shared/types/public/unplugin.d.mts.map +1 -0
- package/dist/shared/types/public/unplugin.mjs +1 -0
- package/dist/shared/types/server.d.mts +5 -0
- package/dist/shared/types/server.d.mts.map +1 -0
- package/dist/shared/types/server.mjs +1 -0
- package/dist/shared/types/state.d.mts +15 -0
- package/dist/shared/types/state.d.mts.map +1 -0
- package/dist/shared/types/state.mjs +1 -0
- package/dist/shared/types/system.d.mts +18 -0
- package/dist/shared/types/system.d.mts.map +1 -0
- package/dist/shared/types/system.mjs +1 -0
- package/package.json +146 -34
- package/types/next.d.ts +6 -0
- package/index.d.ts +0 -2
- package/index.js +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.mjs","names":["error: unknown","documents: HtmlManifestDocument[]","manifest: HtmlManifest","cssInJsVmPrewarm: Promise<void> | null","assetMode: AssetMode","LogLevel","buildDocuments: BuildDocument[]","documentName","format: Format","exportNames","output","gradient","options: NormalizedCompileOptions"],"sources":["../../../src/server/compile/compile.ts"],"sourcesContent":["import { LogLevel, type FormatConfig, type Document } from '../../shared/types'\nimport type { AssetMode, CompileOptions, NormalizedCompileOptions, Format } from '../../shared/types/public'\nimport type { RemoteAssetFetcher } from '@format.dev/zip'\n\nimport { resolve, dirname } from 'node:path'\nimport { mkdir, access, rm, readFile, writeFile, readdir } from 'node:fs/promises'\nimport { builtinModules, createRequire } from 'node:module'\nimport { pathToFileURL } from 'node:url'\nimport { build, mergeConfig } from 'vite'\nimport { scanRemoteRefs, mergeRemoteAssets, findBrokenRemoteAssets, AssetMismatchError } from '@format.dev/zip'\nimport pluralize from 'pluralize'\nimport grad, { atlas as gradient } from 'gradient-string'\n\nimport { getStyles } from '../vite/plugins/get-styles'\nimport { stylesPreProcessor } from '../vite/plugins/styles-pre-processor'\nimport { htmlLoader } from '../vite/plugins/html-loader'\nimport { getSharedAssetsDir, getDocumentsDir, getRootDir, DEFAULT_OUT_DIR_NAME } from '../project/paths'\nimport { createConfig } from '../vite/create-config'\nimport { emitPackageJson } from './package-json'\nimport { getSchemaPath } from '../utils/schema'\nimport { NO_DOCUMENTS_MESSAGE, DEFAULT_VARIANT } from '../../shared/constants'\nimport { RenderWorker } from '../render-worker'\nimport { NO_CONFIG_FILE_MESSAGE } from '../constants'\nimport { normalizeCompileOptions } from './defaults'\nimport {\n\tbuildCacheKeyOptions,\n\tcomputeCacheHash,\n\treadCachedHash,\n\twriteCacheHash,\n\tcachedOutputsExist\n} from './compile-cache'\nimport { DocumentRenderError } from './render-error'\nimport { BUNDLE_ENTRY_POINT_FILE_NAME, SHARED_ASSETS_OUT_DIR_NAME, CHUNKS_DIR_NAME } from './constants'\nimport { createStructuredOutput, type StructuredOutput } from './structured-log'\nimport { makeViteBuildConfig } from './make-config'\nimport { basePackageName } from './dependency-closure'\nimport { compileState } from '../runtime-state'\nimport { engineTarget } from './producer-release'\nimport { warnOnLockstepDrift } from '../utils/warn-lockstep'\nimport { assertProducersAgree } from './producer-agreement'\nimport { getUserProjectDir } from '../project/user-project-dir'\nimport { CompileError } from '../errors'\nimport { bakeWrapperAssetConstants } from './wrapper-source'\n\nimport {\n\tresolveDocumentAssetSources,\n\tbuildDocumentStaticAssets,\n\tbuildDocumentDynamicAssets,\n\tmaterialiseSharedDynamicAssets\n} from './document-assets'\n\nimport { getDocumentDataDir, getDocumentDataFile, getDocuments, getUserDocumentIndex } from '../project/documents'\n\nimport {\n\tlogger,\n\twithPrefixedConsole,\n\tloadConfig,\n\tsetLogLevel,\n\tparseLogLevelFromEnv,\n\tgetLogLevel,\n\tcheckDir\n} from '../utils'\nimport { buildDocumentExportMap } from '@format.dev/cli/scaffold'\n\ntype CompileSource = 'cli' | 'unplugin'\n\nexport function getDefaultOutDir(config: FormatConfig) {\n\treturn resolve(getRootDir(config), DEFAULT_OUT_DIR_NAME)\n}\n\nexport function getBundleOutDir(config: FormatConfig, outDirOverride?: string | null) {\n\treturn outDirOverride != null ? resolve(outDirOverride) : getDefaultOutDir(config)\n}\n\nconst assetsFileName = 'assets.zip'\n\nexport function getDocumentOutDir(outDir: string, documentName: string) {\n\treturn resolve(outDir, documentName)\n}\n\nexport function getDocumentEntryPath(outDir: string, documentName: string) {\n\treturn resolve(getDocumentOutDir(outDir, documentName), BUNDLE_ENTRY_POINT_FILE_NAME)\n}\n\nexport function getDocumentAssetsPath(outDir: string, documentName: string) {\n\treturn resolve(getDocumentOutDir(outDir, documentName), assetsFileName)\n}\n\nconst INDEX_HTML_FILE_NAME = 'index.html'\nconst MANIFEST_FILE_NAME = 'manifest.json'\n\nexport function getHtmlVariantPath(outDir: string, documentName: string, variant: string) {\n\treturn resolve(getDocumentOutDir(outDir, documentName), variant, INDEX_HTML_FILE_NAME)\n}\n\ninterface HtmlManifestVariant {\n\tvariant: string\n\thtml: string\n}\n\ninterface HtmlManifestDocument {\n\tdocument: string\n\tassets?: string\n\tvariants: HtmlManifestVariant[]\n}\n\ninterface HtmlManifest {\n\toutput: 'html'\n\tengine: string\n\tdocuments: HtmlManifestDocument[]\n}\n\nconst REMOTE_ASSETS_DOCS_URL = 'https://format.dev/docs/authoring/assets#remote-assets'\n\n/**\n * Post-render remote-reference pass (static mode). PDF generation never\n * fetches remote references at render time, so anything the rendered HTML\n * points at over http(s) must either be fetched into the document's zip now\n * (`remoteAssets` on) or flagged — without it, the reference is missing from\n * every generated PDF.\n */\nasync function processRemoteAssetRefs(args: {\n\thtml: string\n\tdocumentName: string\n\toutDir: string\n\tremoteAssets: boolean\n\t/** Replaces the network fetch for each remote reference. Studio passes a session cache. */\n\tremoteFetch?: RemoteAssetFetcher\n\t/** Report progress at debug level only. Set for builds the user didn't ask for. */\n\tquiet?: boolean\n}) {\n\tconst { html, documentName, outDir, remoteAssets, remoteFetch, quiet } = args\n\n\tconst remoteRefs = scanRemoteRefs(html)\n\n\tif (remoteRefs.length === 0) {\n\t\treturn\n\t}\n\n\tif (!remoteAssets) {\n\t\tconst list = remoteRefs.map(url => ` • ${url}`).join('\\n')\n\n\t\tlogger.warn(\n\t\t\t`Document \"${documentName}\" references remote assets that will be missing from generated PDFs — remote references are never fetched at render time:\\n${list}\\n` +\n\t\t\t\t`Compile with --remote-assets to fetch and bundle them, or reference local files instead. ${REMOTE_ASSETS_DOCS_URL}`\n\t\t)\n\t\treturn\n\t}\n\n\tconst assetsPath = getDocumentAssetsPath(outDir, documentName)\n\tconst existing = await readFile(assetsPath).catch(() => undefined)\n\n\tconst merged = await mergeRemoteAssets({\n\t\thtml,\n\t\tzip: existing,\n\t\toptions: remoteFetch ? { remoteAssets: { fetch: remoteFetch } } : undefined\n\t})\n\n\tif (merged && merged !== existing) {\n\t\tawait mkdir(getDocumentOutDir(outDir, documentName), { recursive: true })\n\t\tawait writeFile(assetsPath, merged)\n\n\t\tconst message = `Bundled remote assets referenced by \"${documentName}\" into its assets.zip`\n\n\t\tif (quiet) {\n\t\t\tlogger.debug(message)\n\t\t} else {\n\t\t\tlogger.info(message)\n\t\t}\n\t}\n}\n\n/**\n * Every real source file the bundler read, taken from the build's own module\n * graph. Virtual ids and dependencies are dropped: a `virtual:` id is not a\n * file to stat, and `node_modules` changes only on an install, which the\n * bundler's own cache invalidation already covers.\n */\nfunction collectModuleIds(buildOutput: unknown): string[] {\n\tconst outputs = Array.isArray(buildOutput) ? buildOutput : [buildOutput]\n\tconst ids = new Set<string>()\n\n\tfor (const result of outputs) {\n\t\tconst chunks = (result as { output?: Array<{ moduleIds?: string[] }> } | null)?.output ?? []\n\n\t\tfor (const chunk of chunks) {\n\t\t\tfor (const id of chunk.moduleIds ?? []) {\n\t\t\t\tif (isRealSourceFile(id)) {\n\t\t\t\t\tids.add(id)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn [...ids]\n}\n\nfunction isRealSourceFile(id: string): boolean {\n\tif (!id.startsWith('/') && !/^[A-Za-z]:[\\\\/]/.test(id)) {\n\t\treturn false\n\t}\n\n\tif (id.includes('\\u0000') || id.includes('node_modules')) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\ninterface RenderVariantWithWorkerArgs {\n\trenderWorker: RenderWorker\n\toutDir: string\n\tdocumentName: string\n\tvariant: string\n\tconfig: FormatConfig\n\tassetMode: AssetMode\n\t/**\n\t * Probe the remote URLs a local-asset mismatch carries, so one error reports\n\t * every unresolvable asset rather than only the local ones. Only meaningful\n\t * where remote references are being fetched at all.\n\t */\n\tprobeRemoteOnMismatch: boolean\n\t/** Replaces the network fetch used by that probe. */\n\tremoteFetch?: RemoteAssetFetcher\n}\n\n/**\n * Render one compiled document variant on an already-running strict worker.\n * Shared by the build-time smoke render and {@link renderCompiledDocument},\n * so both report a failure the same way.\n */\nasync function renderVariantWithWorker(args: RenderVariantWithWorkerArgs): Promise<string> {\n\tconst { renderWorker, outDir, documentName, variant, config, assetMode, probeRemoteOnMismatch, remoteFetch } = args\n\n\tconst data = await getDocumentDataFile(documentName, variant, config)\n\n\ttry {\n\t\treturn await renderWorker.compileRender({\n\t\t\tbundlePath: getDocumentEntryPath(outDir, documentName),\n\t\t\tdocumentName,\n\t\t\tdata: data || {},\n\t\t\tcwd: getDocumentOutDir(outDir, documentName)\n\t\t})\n\t} catch (error: unknown) {\n\t\tlogger.error(`Compiled bundle failed to render document \"${documentName}\" (variant \"${variant}\")`, error)\n\n\t\tconst errData =\n\t\t\terror && typeof error === 'object' && 'data' in error ? (error as { data?: unknown }).data : undefined\n\n\t\tif (errData !== undefined) {\n\t\t\tlogger.error('Error data', errData)\n\t\t}\n\n\t\tconst mismatch = error as { missing?: unknown; known?: unknown; remoteRefs?: unknown }\n\t\tconst isLocalMismatch = Array.isArray(mismatch.missing) && Array.isArray(mismatch.remoteRefs)\n\n\t\tconst renderFailure =\n\t\t\tisLocalMismatch && probeRemoteOnMismatch\n\t\t\t\t? await enrichWithBrokenRemotes({ documentName, assetMode, mismatch, error, remoteFetch })\n\t\t\t\t: error\n\n\t\tthrow new DocumentRenderError({ documentName, variant, cause: renderFailure })\n\t}\n}\n\nasync function enrichWithBrokenRemotes(args: {\n\tdocumentName: string\n\tassetMode: AssetMode\n\tmismatch: { missing?: unknown; known?: unknown; remoteRefs?: unknown }\n\terror: unknown\n\tremoteFetch?: RemoteAssetFetcher\n}): Promise<unknown> {\n\tconst { documentName, assetMode, mismatch, error, remoteFetch } = args\n\n\tconst brokenRemote = await findBrokenRemoteAssets({ urls: mismatch.remoteRefs as string[], fetch: remoteFetch })\n\n\tif (brokenRemote.length === 0) {\n\t\treturn error\n\t}\n\n\treturn new AssetMismatchError({\n\t\tdocumentName,\n\t\tmode: assetMode as 'static' | 'dynamic',\n\t\tmissing: mismatch.missing as string[],\n\t\tknown: Array.isArray(mismatch.known) ? (mismatch.known as string[]) : [],\n\t\tbrokenRemote\n\t})\n}\n\nexport interface RenderCompiledDocumentArgs {\n\t/** The bundle output directory a previous compile wrote. */\n\toutDir: string\n\tdocumentName: string\n\tvariant: string\n\tconfig: FormatConfig\n\t/** Fetch the rendered HTML's remote references into the document's `assets.zip`. */\n\tremoteAssets?: boolean\n\t/** Replaces the network fetch for those references. Studio passes a session cache. */\n\tremoteFetch?: RemoteAssetFetcher\n}\n\n/**\n * Render one variant of an already-compiled document and bundle the remote\n * references its HTML carries, without rebuilding the bundle.\n *\n * `compileBundle` runs this same render inline against its own long-lived\n * worker, one per build. This entry point owns a worker of its own, for callers\n * holding a bundle from an earlier compile — Studio renders each variant this\n * way rather than recompiling per download.\n */\nexport async function renderCompiledDocument(args: RenderCompiledDocumentArgs): Promise<string> {\n\tconst { outDir, documentName, variant, config, remoteAssets = false, remoteFetch } = args\n\n\tconst renderWorker = new RenderWorker({\n\t\tlog: msg => logger.debug(msg),\n\t\twarn: msg => logger.warn(msg),\n\t\tallowedReadPaths: [outDir],\n\t\tsandbox: 'strict'\n\t})\n\n\ttry {\n\t\tconst html = await renderVariantWithWorker({\n\t\t\trenderWorker,\n\t\t\toutDir,\n\t\t\tdocumentName,\n\t\t\tvariant,\n\t\t\tconfig,\n\t\t\tassetMode: 'static',\n\t\t\tprobeRemoteOnMismatch: remoteAssets,\n\t\t\tremoteFetch\n\t\t})\n\n\t\tawait processRemoteAssetRefs({ html, documentName, outDir, remoteAssets, remoteFetch })\n\n\t\treturn html\n\t} finally {\n\t\tawait renderWorker.dispose()\n\t}\n}\n\ntype BuildDocument = {\n\tname: string\n\tentryFilePath: string\n\tschemaPath?: string\n\texportName: string\n}\n\ninterface CompileBundleArgs {\n\tdocumentNames: string[]\n\tconfig: FormatConfig\n\toptions: NormalizedCompileOptions\n\tlogLevel: LogLevel\n\tsource: CompileSource\n\t/** Variant rendered by the node-target smoke test. Defaults to the default variant. */\n\tsmokeVariant?: string\n\t/** When provided, the smoke render writes each document's rendered HTML here, keyed by name. */\n\tcapturedHtml?: Map<string, string>\n\t/**\n\t * When provided, each document's computed asset state (known set + dynamic URL\n\t * map) is written here, keyed by name. The unplugin/Next.js paths read it back\n\t * to re-host assets, instead of re-deriving the map from the output on disk.\n\t */\n\tcapturedAssetState?: Map<string, DocumentAssetState>\n\t/** Per-document variant lists to render and write under output: 'html'. */\n\thtmlVariantMatrix?: Map<string, string[]>\n\t/** When provided, every source file the bundler read is added here (Studio, to invalidate its cache). */\n\tcapturedInputs?: Set<string>\n\t/** Replaces the network fetch for remote references (Studio's session cache). */\n\tremoteFetch?: RemoteAssetFetcher\n\t/**\n\t * Drop the progress and success reporting this compile would otherwise print.\n\t * Warnings and errors still go out, and `FORMAT_DEBUG` still shows everything.\n\t */\n\tquiet?: boolean\n}\n\nexport interface DocumentAssetState {\n\tknown: string[]\n\turlMap: Record<string, string> | null\n}\n\nasync function collectExternals(outDir: string, documentNames: string[]): Promise<string[]> {\n\tconst externals = new Set<string>()\n\tconst importRe = /(?:import|from)\\s+[\"']([^./][^\"']*)[\"']/g\n\n\tconst isNodeBuiltin = (specifier: string) => specifier.startsWith('node:') || builtinModules.includes(specifier)\n\n\tconst scanFile = async (filePath: string) => {\n\t\ttry {\n\t\t\tconst content = await readFile(filePath, 'utf-8')\n\t\t\tlet match\n\n\t\t\twhile ((match = importRe.exec(content)) !== null) {\n\t\t\t\tconst pkg = basePackageName(match[1]!)\n\n\t\t\t\tif (!isNodeBuiltin(pkg)) {\n\t\t\t\t\texternals.add(pkg)\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// file may not exist\n\t\t}\n\t}\n\n\tfor (const name of documentNames) {\n\t\tawait scanFile(resolve(outDir, name, BUNDLE_ENTRY_POINT_FILE_NAME))\n\t}\n\n\tconst chunksDir = resolve(outDir, 'chunks')\n\tconst chunkFiles = await readdir(chunksDir).catch(() => [] as string[])\n\n\tfor (const file of chunkFiles) {\n\t\tif (file.endsWith('.js')) {\n\t\t\tawait scanFile(resolve(chunksDir, file))\n\t\t}\n\t}\n\n\treturn [...externals].sort()\n}\n\n/**\n * HTML output ships only HTML, each document's `assets.zip`, and the manifest.\n * Remove the JS renderer artefacts left by the node build we rendered from: the\n * per-document wrappers, the bundle index, `package.json`, `externals.json`, the\n * shared chunks, and the root stylesheets (their CSS is already inlined into the\n * rendered HTML).\n */\nasync function stripJsArtefacts(outDir: string, documents: BuildDocument[]) {\n\tconst removals = documents.map(document => rm(getDocumentEntryPath(outDir, document.name), { force: true }))\n\n\tremovals.push(\n\t\trm(resolve(outDir, BUNDLE_ENTRY_POINT_FILE_NAME), { force: true }),\n\t\trm(resolve(outDir, 'package.json'), { force: true }),\n\t\trm(resolve(outDir, 'externals.json'), { force: true }),\n\t\trm(resolve(outDir, CHUNKS_DIR_NAME), { recursive: true, force: true })\n\t)\n\n\tconst rootEntries = await readdir(outDir, { withFileTypes: true }).catch(() => [])\n\n\tfor (const entry of rootEntries) {\n\t\tconst isRootStylesheet = entry.isFile() && entry.name.endsWith('.css')\n\n\t\tif (isRootStylesheet) {\n\t\t\tremovals.push(rm(resolve(outDir, entry.name), { force: true }))\n\t\t}\n\t}\n\n\tawait Promise.all(removals)\n}\n\n/**\n * Finalise HTML output: drop the JS artefacts and write the manifest grouping\n * each document's variants with the single shared zip they render from.\n */\nasync function writeHtmlOutput(args: {\n\toutDir: string\n\tbuildDocuments: BuildDocument[]\n\thtmlVariantEntries: Map<string, HtmlManifestVariant[]>\n}) {\n\tconst { outDir, buildDocuments, htmlVariantEntries } = args\n\n\tawait stripJsArtefacts(outDir, buildDocuments)\n\n\tconst documents: HtmlManifestDocument[] = []\n\n\tfor (const document of buildDocuments) {\n\t\tconst variants = htmlVariantEntries.get(document.name) ?? []\n\n\t\t// Checked on disk so a document whose zip came only from remote-asset\n\t\t// fetching (no local assets) is still listed correctly.\n\t\tconst assetsPath = getDocumentAssetsPath(outDir, document.name)\n\t\tconst hasAssets = await access(assetsPath).then(\n\t\t\t() => true,\n\t\t\t() => false\n\t\t)\n\n\t\tdocuments.push({\n\t\t\tdocument: document.name,\n\t\t\t...(hasAssets ? { assets: `${document.name}/${assetsFileName}` } : {}),\n\t\t\tvariants\n\t\t})\n\t}\n\n\tconst manifest: HtmlManifest = {\n\t\toutput: 'html',\n\t\tengine: engineTarget,\n\t\tdocuments\n\t}\n\n\tawait writeFile(resolve(outDir, MANIFEST_FILE_NAME), JSON.stringify(manifest, null, '\\t'), 'utf-8')\n}\n\nlet cssInJsVmPrewarm: Promise<void> | null = null\n\n/**\n * Pre-warm the module wyw-in-js loads when it evaluates CSS-in-JS.\n *\n * wyw-in-js extracts styles by running each component in a happy-dom VM, and\n * happy-dom loads Node's built-in `node:vm` the first time it builds a window.\n * Rolldown transforms modules in parallel, so two CSS-in-JS files can trigger\n * that load at the same instant — one `require()` then catches `node:vm`\n * mid-`import()` and Node throws \"Cannot require() ES Module node:vm because it\n * is not yet fully loaded\". Loading the graph once here, sequentially, fills the\n * module cache so the concurrent loads read from it instead of racing the\n * loader. `node:vm` is the module that actually races and is always resolvable;\n * happy-dom is what drags it in, so we warm that too when it resolves through\n * wyw-in-js. Cached so repeat builds in one process pay the cost only once.\n */\nfunction prewarmCssInJsVm(): Promise<void> {\n\tif (!cssInJsVmPrewarm) {\n\t\tcssInJsVmPrewarm = warmCssInJsVm()\n\t}\n\n\treturn cssInJsVmPrewarm\n}\n\nasync function warmCssInJsVm(): Promise<void> {\n\tawait import('node:vm')\n\n\ttry {\n\t\tconst requireFromStudio = createRequire(import.meta.url)\n\t\tconst requireFromVite = createRequire(requireFromStudio.resolve('@wyw-in-js/vite'))\n\t\tconst requireFromTransform = createRequire(requireFromVite.resolve('@wyw-in-js/transform'))\n\t\tconst happyDomEntry = requireFromTransform.resolve('happy-dom')\n\n\t\tawait import(pathToFileURL(happyDomEntry).href)\n\t} catch {\n\t\t// happy-dom may not resolve (e.g. a wyw-in-js version that no longer bundles\n\t\t// it). Warming node:vm above already covers the documented race.\n\t}\n}\n\nasync function compileBundle(args: CompileBundleArgs): Promise<StructuredOutput[]> {\n\tconst { documentNames, config, options, logLevel, source } = args\n\tconst { outDir: outDirOverride } = options\n\n\tconst isBrowserTarget = options.target === 'browser'\n\tconst isWorkerTarget = options.target === 'worker'\n\n\tconst assetMode: AssetMode = options.assets\n\tconst isHtmlOutput = options.output === 'html'\n\n\tconst isCli = source === 'cli'\n\tconst isUnplugin = source === 'unplugin'\n\n\tlogger.debug('Compile bundle context', {\n\t\tsource,\n\t\ttarget: options.target,\n\t\tuserBundler: options.userBundler\n\t})\n\n\tconst outDir = getBundleOutDir(config, outDirOverride)\n\tconst rootDir = getRootDir(config)\n\n\tif (resolve(outDir) === resolve(rootDir)) {\n\t\tthrow new CompileError(\n\t\t\t'outDir cannot be the same directory as rootDir. Please choose a different output directory before bundling.'\n\t\t)\n\t}\n\n\tif (options.clean) {\n\t\tawait rm(outDir, { recursive: true, force: true })\n\t}\n\n\tawait mkdir(outDir, { recursive: true })\n\n\tconst startTime = performance.now()\n\n\t// Never minify bundles for unplugin builds (user's bundler can choose to minify)\n\tconst shouldMinify = isUnplugin ? false : logLevel !== LogLevel.DEBUG\n\n\tconst exportNames = buildDocumentExportMap(documentNames)\n\tconst buildDocuments: BuildDocument[] = []\n\n\tfor (const documentName of documentNames) {\n\t\tconst entryFilePath = await getUserDocumentIndex({ documentName, config })\n\n\t\ttry {\n\t\t\tawait access(entryFilePath)\n\t\t} catch {\n\t\t\tthrow new Error(`Entry file not found at ${entryFilePath}`)\n\t\t}\n\n\t\tconst dataDir = getDocumentDataDir(documentName, config)\n\t\tconst schemaPath = await getSchemaPath(dataDir)\n\n\t\tif (options.validateSchema && !schemaPath) {\n\t\t\tthrow new Error(\n\t\t\t\t`Schema file not found. Either use --no-validate-schema to disable schema validation or ensure you are using a valid schema file.`\n\t\t\t)\n\t\t}\n\n\t\tbuildDocuments.push({\n\t\t\tname: documentName,\n\t\t\tentryFilePath,\n\t\t\tschemaPath: schemaPath ?? undefined,\n\t\t\texportName: exportNames.get(documentName)!\n\t\t})\n\t}\n\n\tconst { baseViteConfig, frameworkPlugins, stylePlugins } = createConfig()\n\n\t// Need fresh plugin instances per build, so state is _not_ cached between builds.\n\tconst makePlugins = () => [\n\t\thtmlLoader(),\n\t\tstylesPreProcessor(options.inlineRemoteCss),\n\t\t...frameworkPlugins,\n\t\t...stylePlugins,\n\t\tgetStyles()\n\t]\n\n\tconst format: Format = options.cjs ? 'cjs' : 'es'\n\n\tconst commonConfig = {\n\t\tdocuments: buildDocuments,\n\t\tcompiledFileName: BUNDLE_ENTRY_POINT_FILE_NAME,\n\t\tshouldMinify,\n\t\tformat,\n\t\tlogger,\n\t\temittedAssetsDir: SHARED_ASSETS_OUT_DIR_NAME,\n\t\tassetMode,\n\t\tconfig,\n\t\toptions,\n\t\tsource\n\t}\n\n\tconst buildTarget = isBrowserTarget ? 'browser' : isWorkerTarget ? 'worker' : 'node'\n\n\tconst buildConfig = makeViteBuildConfig({\n\t\t...commonConfig,\n\t\tplugins: makePlugins(),\n\t\ttarget: buildTarget,\n\t\toutDir\n\t})\n\n\tawait prewarmCssInJsVm()\n\n\t// All documents build in one Vite pass, so a build error doesn't say which\n\t// document broke. Best effort: match the failing module's path (or the error\n\t// message) against each document's directory.\n\tconst findDocumentForBuildError = (error: unknown): string | undefined => {\n\t\tconst errorShape = error as { id?: unknown; loc?: { file?: unknown }; message?: unknown } | null\n\t\tconst candidates = [errorShape?.id, errorShape?.loc?.file, errorShape?.message].filter(\n\t\t\t(value): value is string => typeof value === 'string'\n\t\t)\n\n\t\tconst failing = buildDocuments.find(document =>\n\t\t\tcandidates.some(candidate => candidate.includes(dirname(document.entryFilePath)))\n\t\t)\n\n\t\treturn failing?.name\n\t}\n\n\ttry {\n\t\tconst buildOutput = await build(mergeConfig(baseViteConfig, buildConfig))\n\n\t\tfor (const id of collectModuleIds(buildOutput)) {\n\t\t\targs.capturedInputs?.add(id)\n\t\t}\n\t} catch (error) {\n\t\tconst failingDocument = findDocumentForBuildError(error)\n\t\tconst documentLabel = failingDocument ? ` while building document \"${failingDocument}\"` : ''\n\n\t\tlogger.error(`Vite/Rollup Build Error${documentLabel}:`, error)\n\t\tthrow error\n\t}\n\n\tawait emitPackageJson(outDir, options.bundleName, format, options.version)\n\n\tconst writeBundleIndex = async (targetOutDir: string, bundleFormat: Format) => {\n\t\tconst exportNames = buildDocuments.map(doc => doc.exportName)\n\n\t\tif (bundleFormat === 'cjs') {\n\t\t\tconst requireLines = buildDocuments.map(doc => {\n\t\t\t\tconst relPath = `./${doc.name}/${BUNDLE_ENTRY_POINT_FILE_NAME}`.replace(/\\\\/g, '/')\n\t\t\t\treturn `const { ${doc.exportName} } = require(${JSON.stringify(relPath)});`\n\t\t\t})\n\n\t\t\tconst output = [...requireLines, '', `module.exports = { ${exportNames.join(', ')} };`, ''].join('\\n')\n\n\t\t\tawait writeFile(resolve(targetOutDir, BUNDLE_ENTRY_POINT_FILE_NAME), output, 'utf8')\n\t\t\treturn\n\t\t}\n\n\t\tconst importLines = buildDocuments.map(doc => {\n\t\t\tconst relPath = `./${doc.name}/${BUNDLE_ENTRY_POINT_FILE_NAME}`.replace(/\\\\/g, '/')\n\t\t\treturn `import { ${doc.exportName} } from ${JSON.stringify(relPath)};`\n\t\t})\n\t\tconst output = [\n\t\t\t...importLines,\n\t\t\t'',\n\t\t\t`export { ${exportNames.join(', ')} };`,\n\t\t\t`export default { ${exportNames.join(', ')} };`,\n\t\t\t''\n\t\t].join('\\n')\n\n\t\tawait writeFile(resolve(targetOutDir, BUNDLE_ENTRY_POINT_FILE_NAME), output, 'utf8')\n\t}\n\n\tawait writeBundleIndex(outDir, format)\n\n\t// Per-document asset bundling. Static mode zips each document's full merged\n\t// set (shared assets dir + per-doc ./assets/ + Vite-emitted) — no filtering by\n\t// rendered HTML, so any variant renders from a single zip. Dynamic mode\n\t// materialises the files next to the bundle and embeds a URL map instead.\n\tconst stagingRoot = resolve(outDir, '__assets_staging')\n\tconst documentAssetState = new Map<string, DocumentAssetState>()\n\n\t// Dynamic mode shares one `shared-assets/` dir across documents (the\n\t// sharedAssetsDir contents + Vite-emitted images and fonts). Materialise it\n\t// once and reuse its URL map for every document, so nothing is duplicated.\n\tconst sharedDynamicUrlMap =\n\t\tassetMode === 'dynamic'\n\t\t\t? await materialiseSharedDynamicAssets({ config, outDir, sharedAssetsOutDirName: SHARED_ASSETS_OUT_DIR_NAME })\n\t\t\t: {}\n\n\t// Each document's staging dir and output dir are its own, so documents\n\t// materialise in parallel.\n\tconst materialiseDocumentAssets = async (document: BuildDocument): Promise<DocumentAssetState> => {\n\t\tif (assetMode === 'none') {\n\t\t\treturn { known: [], urlMap: null }\n\t\t}\n\n\t\tconst sources = await resolveDocumentAssetSources({\n\t\t\tentryFilePath: document.entryFilePath,\n\t\t\tconfig,\n\t\t\toutDir,\n\t\t\tsharedAssetsOutDirName: SHARED_ASSETS_OUT_DIR_NAME\n\t\t})\n\n\t\tif (assetMode === 'static') {\n\t\t\tconst staticAssets = await buildDocumentStaticAssets(sources, resolve(stagingRoot, document.name))\n\n\t\t\tif (staticAssets.zip) {\n\t\t\t\tawait mkdir(getDocumentOutDir(outDir, document.name), { recursive: true })\n\t\t\t\tawait writeFile(getDocumentAssetsPath(outDir, document.name), staticAssets.zip)\n\t\t\t}\n\n\t\t\treturn { known: staticAssets.known, urlMap: null }\n\t\t}\n\n\t\tconst dynamicAssets = await buildDocumentDynamicAssets({\n\t\t\tdocumentAssetsDir: sources.documentAssetsDir,\n\t\t\tdocumentOutDir: getDocumentOutDir(outDir, document.name),\n\t\t\tsharedUrlMap: sharedDynamicUrlMap\n\t\t})\n\n\t\treturn { known: dynamicAssets.known, urlMap: dynamicAssets.urlMap }\n\t}\n\n\ttry {\n\t\tawait Promise.all(\n\t\t\tbuildDocuments.map(async document => {\n\t\t\t\tdocumentAssetState.set(document.name, await materialiseDocumentAssets(document))\n\t\t\t})\n\t\t)\n\t} finally {\n\t\tawait rm(stagingRoot, { recursive: true, force: true }).catch(() => {})\n\t}\n\n\t// Bake each document's known-asset set (and dynamic URL map) into its\n\t// emitted wrapper. No-op for unplugin builds — their wrapper is generated\n\t// after compile, reading the captured asset state below with the values\n\t// inlined directly.\n\tawait Promise.all(\n\t\tbuildDocuments.map(async document => {\n\t\t\tconst assetState = documentAssetState.get(document.name)\n\n\t\t\tif (!assetState) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\targs.capturedAssetState?.set(document.name, assetState)\n\n\t\t\tawait bakeWrapperAssetConstants({\n\t\t\t\tentryPath: getDocumentEntryPath(outDir, document.name),\n\t\t\t\tknown: assetState.known,\n\t\t\t\turlMap: assetState.urlMap\n\t\t\t})\n\t\t})\n\t)\n\n\t// `none` ships no asset bundle, but the bundler still content-hashes and\n\t// emits anything imported as a module. Those imports can't be resolved by\n\t// name and won't ship in this mode, so warn rather than let them vanish\n\t// silently. Path references (e.g. `<img src=\"logo.png\">`) are unaffected —\n\t// the consumer supplies those bytes themselves.\n\tif (assetMode === 'none') {\n\t\tconst emittedDir = resolve(outDir, SHARED_ASSETS_OUT_DIR_NAME)\n\t\tconst emittedEntries = await readdir(emittedDir, { recursive: true, withFileTypes: true }).catch(() => [])\n\t\tconst emittedCount = emittedEntries.filter(entry => entry.isFile()).length\n\n\t\tif (emittedCount > 0) {\n\t\t\tlogger.warn(\n\t\t\t\t`⚠ --assets none, but the bundle imported ${emittedCount} ${pluralize('asset', emittedCount)} ` +\n\t\t\t\t\t`(e.g. \\`import logo from './logo.png'\\`). Imported assets are content-hashed and managed by the build, ` +\n\t\t\t\t\t`so they can't be resolved by name and won't ship in this mode. Reference assets by path ` +\n\t\t\t\t\t`(e.g. \\`<img src=\"logo.png\">\\`) to supply them yourself, or use --assets static or dynamic to bundle them.`\n\t\t\t)\n\t\t}\n\t}\n\n\t// Static and none modes don't ship the loose Vite-emitted assets: static\n\t// folds them into each document's zip, none emits nothing. Either way the\n\t// shared `shared-assets/` dir is build state, so drop it.\n\tif (assetMode === 'static' || assetMode === 'none') {\n\t\tawait rm(resolve(outDir, SHARED_ASSETS_OUT_DIR_NAME), { recursive: true, force: true }).catch(() => {})\n\t}\n\n\t// The remote-reference pass needs rendered HTML, which node-target builds\n\t// produce at build time: CLI dynamic compiles smoke-render the default\n\t// variant, and HTML output renders every variant. Both qualify.\n\tconst canProcessRemoteRefs = assetMode === 'static' && options.target === 'node' && (isCli || isHtmlOutput)\n\n\t// The mode/target legs of this incompatibility are warned upfront at options\n\t// normalisation. The one left to surface here is source-dependent, which\n\t// normalisation can't see: a bundler-driven (unplugin) build never renders at\n\t// build time, so there is no HTML to fetch remote references from.\n\tconst remoteAssetsBlockedBySource =\n\t\toptions.remoteAssets && !canProcessRemoteRefs && assetMode === 'static' && options.target === 'node'\n\n\tif (remoteAssetsBlockedBySource) {\n\t\tlogger.warn(\n\t\t\t'remoteAssets was set but cannot be honoured here: fetching remote assets requires a CLI compile, where the document renders at build time. Skipping remote asset fetching.'\n\t\t)\n\t}\n\n\t// Node bundles are runnable as-is, so render the real artifact: import each\n\t// document's emitted wrapper and run it. Dynamic output smoke-renders the\n\t// default variant (CLI only) to catch broken externals, module-load failures,\n\t// and default-variant asset mismatches at build time. HTML output renders\n\t// every selected variant and writes each result to disk — that is its whole\n\t// artefact, so it runs regardless of source. Browser/worker artifacts can't\n\t// run here — their failures surface in Studio dev or at the first render.\n\tconst htmlVariantEntries = new Map<string, HtmlManifestVariant[]>()\n\n\tif (options.target === 'node' && (isCli || isHtmlOutput)) {\n\t\tconst renderWorker = new RenderWorker({\n\t\t\tlog: msg => logger.debug(msg),\n\t\t\twarn: msg => logger.warn(msg),\n\t\t\tallowedReadPaths: [outDir],\n\t\t\tsandbox: 'strict'\n\t\t})\n\n\t\tconst smokeVariant = args.smokeVariant ?? DEFAULT_VARIANT\n\n\t\ttry {\n\t\t\tfor (const document of buildDocuments) {\n\t\t\t\tconst variants = isHtmlOutput ? (args.htmlVariantMatrix?.get(document.name) ?? []) : [smokeVariant]\n\n\t\t\t\tfor (const variant of variants) {\n\t\t\t\t\tconst html = await renderVariantWithWorker({\n\t\t\t\t\t\trenderWorker,\n\t\t\t\t\t\toutDir,\n\t\t\t\t\t\tdocumentName: document.name,\n\t\t\t\t\t\tvariant,\n\t\t\t\t\t\tconfig,\n\t\t\t\t\t\tassetMode,\n\t\t\t\t\t\tprobeRemoteOnMismatch: canProcessRemoteRefs && options.remoteAssets,\n\t\t\t\t\t\tremoteFetch: args.remoteFetch\n\t\t\t\t\t})\n\n\t\t\t\t\t// Per variant so the document's shared zip accumulates the union of\n\t\t\t\t\t// every variant's remote references — any variant then resolves from it.\n\t\t\t\t\tif (canProcessRemoteRefs) {\n\t\t\t\t\t\tawait processRemoteAssetRefs({\n\t\t\t\t\t\t\thtml,\n\t\t\t\t\t\t\tdocumentName: document.name,\n\t\t\t\t\t\t\toutDir,\n\t\t\t\t\t\t\tremoteAssets: options.remoteAssets,\n\t\t\t\t\t\t\tremoteFetch: args.remoteFetch,\n\t\t\t\t\t\t\tquiet: args.quiet\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!isHtmlOutput) {\n\t\t\t\t\t\targs.capturedHtml?.set(document.name, html)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tconst htmlPath = getHtmlVariantPath(outDir, document.name, variant)\n\t\t\t\t\tawait mkdir(dirname(htmlPath), { recursive: true })\n\t\t\t\t\tawait writeFile(htmlPath, html, 'utf-8')\n\n\t\t\t\t\tconst entries = htmlVariantEntries.get(document.name) ?? []\n\t\t\t\t\tentries.push({ variant, html: `${document.name}/${variant}/${INDEX_HTML_FILE_NAME}` })\n\t\t\t\t\thtmlVariantEntries.set(document.name, entries)\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tawait renderWorker.dispose()\n\t\t}\n\t}\n\n\t// HTML output ships rendered HTML, not a runnable bundle, so it writes the\n\t// manifest and strips the JS artefacts instead of recording externals.\n\tif (isHtmlOutput) {\n\t\tawait writeHtmlOutput({ outDir, buildDocuments, htmlVariantEntries })\n\t}\n\n\tif (!isHtmlOutput) {\n\t\tconst externals = await collectExternals(outDir, documentNames)\n\t\tconst externalsPayload = { target: options.target, externals }\n\n\t\tawait writeFile(resolve(outDir, 'externals.json'), JSON.stringify(externalsPayload, null, '\\t'), 'utf-8')\n\n\t\tlogger.debug(`Externals for ${options.target}:`, externals.length ? externals.join(', ') : '(none)')\n\t}\n\n\tconst endTime = performance.now()\n\tconst compiledIn = `${(endTime - startTime).toFixed(2)}ms`\n\n\tconst documentName = buildDocuments.length === 1 ? buildDocuments[0]!.name : `${buildDocuments.length} documents`\n\n\tconst structuredOutput = createStructuredOutput({\n\t\tdocumentName,\n\t\toutDir,\n\t\tcompiledIn\n\t})\n\n\tconst isDebug = getLogLevel() === LogLevel.DEBUG\n\n\t// A quiet compile is work the user didn't ask for — a background build after\n\t// a preview render — so it says nothing on success. FORMAT_DEBUG still shows it.\n\tif ((isCli && !args.quiet) || isDebug) {\n\t\tlogger.info(\n\t\t\tgradient(`✓ Successfully compiled ${documentName}`),\n\t\t\t'\\n',\n\t\t\tJSON.stringify(structuredOutput, null, 2),\n\t\t\t'\\n'\n\t\t)\n\t}\n\n\treturn [structuredOutput]\n}\n\nfunction warnIgnoredOption(message: string) {\n\tlogger.warn(`ℹ ${message}`)\n}\n\n/**\n * Map each document to the data variants HTML output should render. Throws on\n * the two unrecoverable cases — a selected document with no data at all, and a\n * requested variant that exists for no document — and warns per document for a\n * requested variant that only some documents have.\n */\nexport function resolveHtmlVariantMatrix(documents: Document[], requestedVariants: string[]): Map<string, string[]> {\n\tconst documentsWithoutData = documents.filter(document => document.variants.length === 0)\n\n\tif (documentsWithoutData.length > 0) {\n\t\tconst names = documentsWithoutData.map(document => `\"${document.name}\"`).join(', ')\n\n\t\tthrow new CompileError(\n\t\t\t`Can't use --output html for ${names}: no data files found. Add at least a \\`data/${DEFAULT_VARIANT}.json\\`.`\n\t\t)\n\t}\n\n\tconst matrix = new Map<string, string[]>()\n\n\tif (requestedVariants.length === 0) {\n\t\tfor (const document of documents) {\n\t\t\tmatrix.set(document.name, document.variants)\n\t\t}\n\n\t\treturn matrix\n\t}\n\n\tconst orphanVariants = requestedVariants.filter(\n\t\tvariant => !documents.some(document => document.variants.includes(variant))\n\t)\n\n\tif (orphanVariants.length > 0) {\n\t\tconst names = orphanVariants.map(variant => `\"${variant}\"`).join(', ')\n\n\t\tthrow new CompileError(\n\t\t\t`No document has the variant(s) ${names}. Check the names against your \\`data/*.json\\` files.`\n\t\t)\n\t}\n\n\tfor (const document of documents) {\n\t\tconst selected = requestedVariants.filter(variant => document.variants.includes(variant))\n\t\tconst missing = requestedVariants.filter(variant => !document.variants.includes(variant))\n\n\t\tif (missing.length > 0) {\n\t\t\tconst names = missing.map(variant => `\"${variant}\"`).join(', ')\n\t\t\tlogger.warn(`Document \"${document.name}\" has no variant(s) ${names}; skipping for this document.`)\n\t\t}\n\n\t\tmatrix.set(document.name, selected)\n\t}\n\n\treturn matrix\n}\n\n/**\n * HTML output renders from a forced node build with assets bundled at build\n * time, so the JS-bundle and asset-mode flags have nothing to act on. None of\n * them is build-breaking — we override and warn per flag. The genuinely\n * unrecoverable cases (a document with no data, an unknown variant) are errors,\n * raised later in resolveHtmlVariantMatrix.\n */\nexport function warnIncompatibleHtmlOptions(options: NormalizedCompileOptions) {\n\tconst warnIgnored = (flag: string) =>\n\t\twarnIgnoredOption(`The ${flag} flag is not compatible with html output, ignoring.`)\n\n\tif (options.target !== 'node') {\n\t\twarnIgnored('--target')\n\t}\n\n\tif (options.preset !== 'node') {\n\t\twarnIgnored('--preset')\n\t}\n\n\tif (options.assets !== 'static') {\n\t\twarnIgnored('--assets')\n\t}\n\n\tif (options.external.length > 0) {\n\t\twarnIgnored('--external')\n\t}\n\n\tif (options.bundle.length > 0) {\n\t\twarnIgnored('--bundle')\n\t}\n\n\tif (options.conditions.length > 0) {\n\t\twarnIgnored('--conditions')\n\t}\n\n\tif (options.externalConditions.length > 0) {\n\t\twarnIgnored('--external-conditions')\n\t}\n\n\tif (options.cjs) {\n\t\twarnIgnored('--cjs')\n\t}\n\n\tif (options.version) {\n\t\twarnIgnored('--version')\n\t}\n}\n\ninterface RunCompileArgs {\n\t/** Raw consumer options; normalised here so every entry point shares one path. */\n\toptions: CompileOptions\n\tsource: CompileSource\n\t/** Variant the node-target smoke render uses (Studio only). Defaults to the default variant. */\n\tsmokeVariant?: string\n\t/** Collector the smoke render fills with each document's rendered HTML (Studio only). */\n\tcapturedHtml?: Map<string, string>\n\t/** Collector filled with each document's asset state (unplugin/Next.js, to re-host assets). */\n\tcapturedAssetState?: Map<string, DocumentAssetState>\n\t/** Collector filled with every source file the bundler read (Studio only). */\n\tcapturedInputs?: Set<string>\n\t/** Replaces the network fetch for remote references (Studio only). */\n\tremoteFetch?: RemoteAssetFetcher\n\t/** Suppress success and progress reporting (Studio background builds). */\n\tquiet?: boolean\n\t/**\n\t * Read and write the `.cache` hash in `outDir`. Studio owns its own bundle\n\t * directory and invalidates on a finer input set, so it turns this off — and\n\t * a hit here would skip the smoke render Studio needs the HTML from.\n\t */\n\tuseDiskCache?: boolean\n}\n\nasync function runCompile(runArgs: RunCompileArgs): Promise<StructuredOutput[]> {\n\tconst { options: inputOptions, source, smokeVariant, capturedHtml, capturedAssetState, capturedInputs } = runArgs\n\n\tsetLogLevel(parseLogLevelFromEnv())\n\tconst logLevel = getLogLevel()\n\n\tconst isCli = source === 'cli'\n\n\t// Unplugin builds default to clean: false — the consumer bundler owns the\n\t// output directory's lifecycle.\n\tconst rawOptions = normalizeCompileOptions(\n\t\tsource === 'unplugin' ? { ...inputOptions, clean: inputOptions.clean ?? false } : inputOptions\n\t)\n\n\tconst isHtmlOutput = rawOptions.output === 'html'\n\n\tif (isHtmlOutput) {\n\t\twarnIncompatibleHtmlOptions(rawOptions)\n\t}\n\n\t// HTML output has no JS runtime, so the bundle-shaping options are\n\t// meaningless. Force a node render build with bundled assets; the warning\n\t// above tells the user which of their flags were dropped.\n\tconst options: NormalizedCompileOptions = isHtmlOutput\n\t\t? {\n\t\t\t\t...rawOptions,\n\t\t\t\ttarget: 'node',\n\t\t\t\tpreset: 'node',\n\t\t\t\tassets: 'static',\n\t\t\t\tcjs: false,\n\t\t\t\texternal: [],\n\t\t\t\tbundle: [],\n\t\t\t\tconditions: [],\n\t\t\t\texternalConditions: [],\n\t\t\t\tbundleAll: false\n\t\t\t}\n\t\t: rawOptions\n\n\tlogger.debug('Compile options', options)\n\n\tconst { documents: documentNames } = options\n\n\tconst { config } = await loadConfig(options.configPath)\n\n\tif (!config) {\n\t\tthrow new Error(NO_CONFIG_FILE_MESSAGE)\n\t}\n\n\t// after loadConfig, which is what sets the project dir — before it, this reads\n\t// whatever directory the command was launched from\n\tassertProducersAgree(getUserProjectDir())\n\n\tcompileState.setConfig(config)\n\n\tconst allDocuments = await getDocuments(config)\n\n\tconst documents = allDocuments\n\t\t.filter(({ name }) => documentNames.length === 0 || documentNames.includes(name))\n\t\t.sort((a, b) => a.name.localeCompare(b.name))\n\n\tconst missingDocuments = documentNames.filter(\n\t\tname => !allDocuments.some(({ name: documentName }) => documentName === name)\n\t)\n\n\tif (missingDocuments.length > 0) {\n\t\tlogger.warn(`Couldn't find the following documents: \"${missingDocuments.join(', ')}\"`)\n\t}\n\n\tif (documents.length === 0) {\n\t\tthrow new Error(NO_DOCUMENTS_MESSAGE)\n\t}\n\n\t// Fail on export-name collisions before any build work starts — compileBundle\n\t// would otherwise only hit this after cleaning the output directory.\n\tbuildDocumentExportMap(documents.map(({ name }) => name))\n\n\t// The default `assets/` dir is optional, but an explicitly configured one\n\t// that's missing is a mistake worth failing on.\n\tif (config.sharedAssetsDir) {\n\t\tconst sharedAssetsDir = getSharedAssetsDir(config)\n\t\tconst { isDirectory } = await checkDir(sharedAssetsDir)\n\t\tif (!isDirectory) {\n\t\t\tthrow new Error(`Your configured \\`sharedAssetsDir\\` not found or is not a directory: ${sharedAssetsDir}`)\n\t\t}\n\t}\n\n\tconst htmlVariantMatrix = isHtmlOutput ? resolveHtmlVariantMatrix(documents, options.variants) : undefined\n\n\tconst outDir = getBundleOutDir(config, options.outDir)\n\n\t// CLI and unplugin builds use disk-persisted caching to skip recompilation\n\t// when nothing changed. HTML output isn't cached: it renders the whole\n\t// variant matrix and always writes fresh HTML. Dynamic-mode unplugin builds\n\t// aren't cached either — the plugin needs the per-document asset state a\n\t// compile captures, and a cache hit would skip capturing it.\n\tconst isCacheableRun =\n\t\t(runArgs.useDiskCache ?? true) &&\n\t\t(isCli || (source === 'unplugin' && options.assets !== 'dynamic')) &&\n\t\t!isHtmlOutput\n\n\t// The consumer bundler only changes compile output through the webpack-node\n\t// compat rewrite (see make-config), so key on that fact rather than the raw\n\t// bundler name — vite/rollup/esbuild consumers then share one cached compile.\n\tconst cacheKeyOptions = buildCacheKeyOptions({\n\t\toptions,\n\t\twebpackNodeCompat: options.target === 'node' && source === 'unplugin' && options.userBundler === 'webpack'\n\t})\n\n\tif (isCacheableRun) {\n\t\tconst documentsDir = getDocumentsDir(config)\n\t\tconst currentHash = await computeCacheHash(documentsDir, cacheKeyOptions)\n\t\tconst cachedHash = await readCachedHash(outDir)\n\n\t\tif (cachedHash === currentHash) {\n\t\t\tconst expectedEntryPaths = documents.map(({ name }) => getDocumentEntryPath(outDir, name))\n\t\t\tconst outputsPresent = await cachedOutputsExist(expectedEntryPaths)\n\n\t\t\tif (outputsPresent) {\n\t\t\t\tlogger.info('Cache hit — documents unchanged, skipping compile.')\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\tlogger.debug('Cache hash matched but compiled outputs are missing — recompiling.')\n\t\t}\n\t}\n\n\tconst runAll = () =>\n\t\tcompileBundle({\n\t\t\tdocumentNames: documents.map(({ name }) => name),\n\t\t\tconfig,\n\t\t\toptions,\n\t\t\tlogLevel,\n\t\t\tsource,\n\t\t\tsmokeVariant,\n\t\t\tcapturedHtml,\n\t\t\tcapturedAssetState,\n\t\t\tcapturedInputs,\n\t\t\tremoteFetch: runArgs.remoteFetch,\n\t\t\tquiet: runArgs.quiet,\n\t\t\thtmlVariantMatrix\n\t\t})\n\n\tconst suppressBuildLogs = (_level: string, ...args: unknown[]) => {\n\t\tconst msg = args.join(' ')\n\n\t\tif (msg.includes('building SSR bundle for production')) return false\n\t\tif (msg.includes('vite v') && msg.includes('building')) return false\n\t\tif (msg.includes('built in')) return false\n\n\t\treturn true\n\t}\n\n\tconst results = isCli\n\t\t? ((await withPrefixedConsole(() => runAll(), suppressBuildLogs)) as StructuredOutput[])\n\t\t: await runAll()\n\n\t// Write cache hash after successful compilation\n\tif (isCacheableRun) {\n\t\tconst documentsDir = getDocumentsDir(config)\n\t\tconst currentHash = await computeCacheHash(documentsDir, cacheKeyOptions)\n\t\tawait writeCacheHash(outDir, currentHash)\n\t}\n\n\tconst { external } = options\n\tconst externalLen = external.length\n\n\tif (isCli && externalLen > 0 && !runArgs.quiet) {\n\t\tlogger.info(\n\t\t\t`ℹ External packages: ${external.join(', ')}. Make sure ${pluralize('this', externalLen)} ${pluralize(\n\t\t\t\t'is',\n\t\t\t\texternalLen\n\t\t\t)} installed where you call render.`\n\t\t)\n\t}\n\n\treturn results\n}\n\nexport async function compile(options: CompileOptions): Promise<StructuredOutput[]> {\n\tawait warnOnLockstepDrift(options.configPath ? dirname(options.configPath) : process.cwd())\n\n\treturn runCompile({ options, source: 'cli' })\n\t\t.then(() => process.exit(0))\n\t\t.catch(error => {\n\t\t\tlogger.error('Compile error', error)\n\t\t\tprocess.exit(1)\n\t\t})\n}\n\nexport interface StudioCompileOptions {\n\t/**\n\t * Variant the node-target smoke render uses. The download route passes the\n\t * variant being downloaded so its remote assets land in the zip and its\n\t * rendered HTML comes back ready to send. Defaults to the default variant.\n\t */\n\tvariant?: string\n\t/**\n\t * Use the compile package's own `.cache` hash in `outDir`. Off for callers\n\t * that keep the output directory and track its inputs themselves — a hit\n\t * skips the smoke render, so the HTML would come back empty.\n\t */\n\tuseDiskCache?: boolean\n\t/**\n\t * Replaces the network fetch for remote references. Studio passes a\n\t * session-wide cache so a rebuilt bundle doesn't download every remote asset\n\t * again.\n\t */\n\tremoteFetch?: RemoteAssetFetcher\n\t/**\n\t * Compile without the usual success and progress reporting. Studio sets this\n\t * for background builds, which the user never asked for and shouldn't have to\n\t * read about on every save. Warnings and errors are unaffected, and\n\t * `FORMAT_DEBUG=true` restores the full output.\n\t */\n\tquiet?: boolean\n}\n\nexport interface StudioCompileResult {\n\toutputs: StructuredOutput[]\n\t/** Each document's smoke-rendered HTML, keyed by document name. */\n\thtml: Map<string, string>\n\t/**\n\t * Absolute paths of every source file the bundler read. Studio stats these to\n\t * decide whether a kept bundle is still current. Empty when the compile was\n\t * served from the disk cache.\n\t */\n\tinputs: string[]\n}\n\nexport async function compileForStudio(\n\toptions: CompileOptions,\n\tstudioOptions: StudioCompileOptions = {}\n): Promise<StudioCompileResult> {\n\tconst capturedHtml = new Map<string, string>()\n\tconst capturedInputs = new Set<string>()\n\n\tconst outputs = await runCompile({\n\t\toptions,\n\t\tsource: 'cli',\n\t\tsmokeVariant: studioOptions.variant,\n\t\tcapturedHtml,\n\t\tcapturedInputs,\n\t\tuseDiskCache: studioOptions.useDiskCache,\n\t\tremoteFetch: studioOptions.remoteFetch,\n\t\tquiet: studioOptions.quiet\n\t})\n\n\treturn { outputs, html: capturedHtml, inputs: [...capturedInputs] }\n}\n\nexport async function compileForUnplugin(\n\toptions: CompileOptions,\n\textras: { capturedAssetState?: Map<string, DocumentAssetState> } = {}\n): Promise<StructuredOutput[]> {\n\treturn runCompile({ options, source: 'unplugin', capturedAssetState: extras.capturedAssetState })\n}\n\nexport async function compileForTest(options: CompileOptions): Promise<StructuredOutput[]> {\n\t// Using the Unplugin entrypoint for compile tests, as it's the same as the unplugin process and tests\n\treturn compileForUnplugin(options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,SAAgB,iBAAiB,QAAsB;AACtD,QAAO,QAAQ,WAAW,OAAO,EAAE,qBAAqB;;AAGzD,SAAgB,gBAAgB,QAAsB,gBAAgC;AACrF,QAAO,kBAAkB,OAAO,QAAQ,eAAe,GAAG,iBAAiB,OAAO;;AAGnF,MAAM,iBAAiB;AAEvB,SAAgB,kBAAkB,QAAgB,cAAsB;AACvE,QAAO,QAAQ,QAAQ,aAAa;;AAGrC,SAAgB,qBAAqB,QAAgB,cAAsB;AAC1E,QAAO,QAAQ,kBAAkB,QAAQ,aAAa,EAAE,6BAA6B;;AAGtF,SAAgB,sBAAsB,QAAgB,cAAsB;AAC3E,QAAO,QAAQ,kBAAkB,QAAQ,aAAa,EAAE,eAAe;;AAGxE,MAAM,uBAAuB;AAC7B,MAAM,qBAAqB;AAE3B,SAAgB,mBAAmB,QAAgB,cAAsB,SAAiB;AACzF,QAAO,QAAQ,kBAAkB,QAAQ,aAAa,EAAE,SA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AoB,CAAC;;AAGlG,eAAsB,eAAe,SAAsD;AAE1F,QAAO,mBAAmB,QAAQ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/server/compile/constants.d.ts
|
|
2
|
+
declare const DEFAULT_BUNDLE_NAME = "documents";
|
|
3
|
+
declare const BUNDLE_ENTRY_POINT_FILE_NAME = "index.js";
|
|
4
|
+
declare const STYLES_BY_FILE_REPLACEMENT = "__FMT_STYLES_BY_FILE__";
|
|
5
|
+
declare const ENTRY_CSS_FILES_REPLACEMENT = "__FMT_ENTRY_CSS_FILES__";
|
|
6
|
+
declare const SHARED_ASSETS_OUT_DIR_NAME = "shared-assets";
|
|
7
|
+
declare const CHUNKS_DIR_NAME = "chunks";
|
|
8
|
+
declare const RESERVED_DOCUMENT_NAMES: string[];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { BUNDLE_ENTRY_POINT_FILE_NAME, CHUNKS_DIR_NAME, DEFAULT_BUNDLE_NAME, ENTRY_CSS_FILES_REPLACEMENT, RESERVED_DOCUMENT_NAMES, SHARED_ASSETS_OUT_DIR_NAME, STYLES_BY_FILE_REPLACEMENT };
|
|
11
|
+
//# sourceMappingURL=constants.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.mts","names":[],"sources":["../../../src/server/compile/constants.ts"],"sourcesContent":[],"mappings":";cAAa,mBAAA;AAAA,cACA,4BAAA,GADmB,UAAA;AACnB,cACA,0BAAA,GAD4B,wBAAA;AAC5B,cACA,2BAAA,GAD0B,yBAAA;AAC1B,cAKA,0BAAA,GAL2B,eAAA;AAK3B,cACA,eAAA,GAD0B,QAAA;AAC1B,cAQA,uBARe,EAAA,MAAA,EAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/server/compile/constants.ts
|
|
2
|
+
const DEFAULT_BUNDLE_NAME = "documents";
|
|
3
|
+
const BUNDLE_ENTRY_POINT_FILE_NAME = "index.js";
|
|
4
|
+
const STYLES_BY_FILE_REPLACEMENT = "__FMT_STYLES_BY_FILE__";
|
|
5
|
+
const ENTRY_CSS_FILES_REPLACEMENT = "__FMT_ENTRY_CSS_FILES__";
|
|
6
|
+
const SHARED_ASSETS_OUT_DIR_NAME = "shared-assets";
|
|
7
|
+
const CHUNKS_DIR_NAME = "chunks";
|
|
8
|
+
const RESERVED_DOCUMENT_NAMES = [SHARED_ASSETS_OUT_DIR_NAME, CHUNKS_DIR_NAME];
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { BUNDLE_ENTRY_POINT_FILE_NAME, CHUNKS_DIR_NAME, DEFAULT_BUNDLE_NAME, ENTRY_CSS_FILES_REPLACEMENT, RESERVED_DOCUMENT_NAMES, SHARED_ASSETS_OUT_DIR_NAME, STYLES_BY_FILE_REPLACEMENT };
|
|
12
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../../../src/server/compile/constants.ts"],"sourcesContent":["export const DEFAULT_BUNDLE_NAME = 'documents'\nexport const BUNDLE_ENTRY_POINT_FILE_NAME = 'index.js'\nexport const STYLES_BY_FILE_REPLACEMENT = '__FMT_STYLES_BY_FILE__'\nexport const ENTRY_CSS_FILES_REPLACEMENT = '__FMT_ENTRY_CSS_FILES__'\n\n// Output directories at the bundle root. `shared-assets/` holds everything\n// shared across documents — the `sharedAssetsDir` contents plus the assets Vite\n// emits (imported images + fonts). `chunks/` holds shared JS/CSS chunks.\nexport const SHARED_ASSETS_OUT_DIR_NAME = 'shared-assets'\nexport const CHUNKS_DIR_NAME = 'chunks'\n\n// A document compiles to its own `<name>/` dir at the bundle root, so its name\n// can't collide with a reserved output dir. Deliberately defined locally, NOT\n// re-exported from @format.dev/cli/scaffold: this file is imported by document-side\n// compile code, and a scaffold import would bundle the whole scaffold module\n// into compiled document chunks. Keep in step with the copy in\n// packages/cli/src/scaffold/document/validate-name.ts.\nexport const RESERVED_DOCUMENT_NAMES = [SHARED_ASSETS_OUT_DIR_NAME, CHUNKS_DIR_NAME]\n"],"mappings":";AAAA,MAAa,sBAAsB;AACnC,MAAa,+BAA+B;AAC5C,MAAa,6BAA6B;AAC1C,MAAa,8BAA8B;AAK3C,MAAa,6BAA6B;AAC1C,MAAa,kBAAkB;AAQ/B,MAAa,0BAA0B,CAAC,4BAA4B,gBAAgB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/server/compile/create-renderer.d.ts
|
|
2
|
+
type CreateRendererInput = {
|
|
3
|
+
Component: any;
|
|
4
|
+
schema?: any;
|
|
5
|
+
styles?: string;
|
|
6
|
+
};
|
|
7
|
+
declare function createRenderer({
|
|
8
|
+
Component,
|
|
9
|
+
schema,
|
|
10
|
+
styles
|
|
11
|
+
}: CreateRendererInput): {
|
|
12
|
+
render: (data: any, cwd: string) => Promise<string>;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { createRenderer, createRenderer as default };
|
|
16
|
+
//# sourceMappingURL=create-renderer.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-renderer.d.mts","names":[],"sources":["../../../src/server/compile/create-renderer.ts"],"sourcesContent":[],"mappings":";KAkBK,mBAAA;EAAA,SAAA,EAAA,GAAA;EAsBW,MAAA,CAAA,EAAA,GAAA;EAAiB,MAAA,CAAA,EAAA,MAAA;CAAW;AAAQ,iBAApC,cAAA,CAAoC;EAAA,SAAA;EAAA,MAAA;EAAA;AAAA,CAAA,EAAU,mBAAV,CAAA,EAAA;EAAU,MAAA,EAAA,CAAA,IAAA,EAAA,GAAA,EAAA,GAAA,EAAA,MAAA,EAAA,GAGd,OAHc,CAAA,MAAA,CAAA;CAGd"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { _defineProperty } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs";
|
|
2
|
+
import { finalizeDocumentHtml } from "./finalize-document-html.mjs";
|
|
3
|
+
import adaptor from "virtual:adaptor";
|
|
4
|
+
import validate from "virtual:validate";
|
|
5
|
+
import { decodeStyleEntities } from "virtual:decode-style-entities";
|
|
6
|
+
import { sanitizeHtml } from "virtual:sanitize-html";
|
|
7
|
+
|
|
8
|
+
//#region src/server/compile/create-renderer.ts
|
|
9
|
+
var FormatRenderError = class FormatRenderError extends Error {
|
|
10
|
+
constructor(data = {}, ...params) {
|
|
11
|
+
super(...params);
|
|
12
|
+
_defineProperty(this, "data", void 0);
|
|
13
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, FormatRenderError);
|
|
14
|
+
this.message = [this.message, "See error.data for more details"].join(" ");
|
|
15
|
+
this.name = "FormatRenderError";
|
|
16
|
+
this.data = data;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function createRenderer({ Component, schema, styles }) {
|
|
20
|
+
const stylesText = typeof styles === "string" ? styles : "";
|
|
21
|
+
const render = async (data, cwd) => {
|
|
22
|
+
if (_FMT_VALIDATE_SCHEMA_ && schema) {
|
|
23
|
+
const validation = await validate(schema, data);
|
|
24
|
+
if (!validation.ok) throw new FormatRenderError({ issues: validation.errors }, "Schema validation failed.", { cause: "ERROR_SCHEMA_VALIDATION" });
|
|
25
|
+
data = validation.data;
|
|
26
|
+
}
|
|
27
|
+
const sdk = _FMT_JS_VERSION_;
|
|
28
|
+
const engine = _FMT_ENGINE_VERSION_;
|
|
29
|
+
try {
|
|
30
|
+
const element = await adaptor.create({
|
|
31
|
+
Component,
|
|
32
|
+
data,
|
|
33
|
+
cwd
|
|
34
|
+
});
|
|
35
|
+
let out = finalizeDocumentHtml({
|
|
36
|
+
html: await adaptor.render({
|
|
37
|
+
engine,
|
|
38
|
+
element,
|
|
39
|
+
cwd
|
|
40
|
+
}),
|
|
41
|
+
sdk,
|
|
42
|
+
engine,
|
|
43
|
+
css: stylesText
|
|
44
|
+
});
|
|
45
|
+
out = decodeStyleEntities(out);
|
|
46
|
+
out = sanitizeHtml(out);
|
|
47
|
+
return out;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
50
|
+
throw new FormatRenderError({ error }, errorMessage, { cause: "ERROR_RENDER" });
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return { render };
|
|
54
|
+
}
|
|
55
|
+
var create_renderer_default = createRenderer;
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { createRenderer, create_renderer_default as default };
|
|
59
|
+
//# sourceMappingURL=create-renderer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-renderer.mjs","names":[],"sources":["../../../src/server/compile/create-renderer.ts"],"sourcesContent":["// @ts-ignore\nimport adaptor from 'virtual:adaptor'\n\n// @ts-ignore\nimport validate from 'virtual:validate'\n\n// @ts-ignore\nimport { decodeStyleEntities } from 'virtual:decode-style-entities'\n\n// @ts-ignore\nimport { sanitizeHtml } from 'virtual:sanitize-html'\n\nimport { finalizeDocumentHtml } from './finalize-document-html'\n\ndeclare const _FMT_VALIDATE_SCHEMA_: boolean\ndeclare const _FMT_JS_VERSION_: string\ndeclare const _FMT_ENGINE_VERSION_: string\n\ntype CreateRendererInput = {\n\tComponent: any\n\tschema?: any\n\tstyles?: string\n}\n\nclass FormatRenderError extends Error {\n\tpublic data: any\n\n\tconstructor(data = {}, ...params: any[]) {\n\t\tsuper(...params)\n\n\t\tif (Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(this, FormatRenderError)\n\t\t}\n\n\t\tthis.message = [this.message, 'See error.data for more details'].join(' ')\n\t\tthis.name = 'FormatRenderError'\n\t\tthis.data = data\n\t}\n}\n\nexport function createRenderer({ Component, schema, styles }: CreateRendererInput) {\n\tconst stylesText = typeof styles === 'string' ? styles : ''\n\n\tconst render = async (data: any, cwd: string): Promise<string> => {\n\t\tif (_FMT_VALIDATE_SCHEMA_ && schema) {\n\t\t\tconst validation = await validate(schema, data)\n\n\t\t\tif (!validation.ok) {\n\t\t\t\tthrow new FormatRenderError({ issues: validation.errors }, 'Schema validation failed.', {\n\t\t\t\t\tcause: 'ERROR_SCHEMA_VALIDATION'\n\t\t\t\t})\n\t\t\t}\n\t\t\tdata = validation.data\n\t\t}\n\n\t\tconst sdk = _FMT_JS_VERSION_\n\t\tconst engine = _FMT_ENGINE_VERSION_\n\n\t\ttry {\n\t\t\tconst element = await adaptor.create({ Component, data, cwd })\n\t\t\tconst html = await adaptor.render({ engine, element, cwd })\n\n\t\t\tlet out = finalizeDocumentHtml({ html, sdk, engine, css: stylesText })\n\t\t\tout = decodeStyleEntities(out)\n\t\t\tout = sanitizeHtml(out)\n\n\t\t\treturn out\n\t\t} catch (error) {\n\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error)\n\t\t\tthrow new FormatRenderError({ error }, errorMessage, { cause: 'ERROR_RENDER' })\n\t\t}\n\t}\n\n\treturn { render }\n}\n\nexport default createRenderer\n"],"mappings":";;;;;;;;AAwBA,IAAM,oBAAN,MAAM,0BAA0B,MAAM;CAGrC,YAAY,OAAO,EAAE,EAAE,GAAG,QAAe;AACxC,QAAM,GAAG,OAAO;wBAHV;AAKN,MAAI,MAAM,kBACT,OAAM,kBAAkB,MAAM,kBAAkB;AAGjD,OAAK,UAAU,CAAC,KAAK,SAAS,kCAAkC,CAAC,KAAK,IAAI;AAC1E,OAAK,OAAO;AACZ,OAAK,OAAO;;;AAId,SAAgB,eAAe,EAAE,WAAW,QAAQ,UAA+B;CAClF,MAAM,aAAa,OAAO,WAAW,WAAW,SAAS;CAEzD,MAAM,SAAS,OAAO,MAAW,QAAiC;AACjE,MAAI,yBAAyB,QAAQ;GACpC,MAAM,aAAa,MAAM,SAAS,QAAQ,KAAK;AAE/C,OAAI,CAAC,WAAW,GACf,OAAM,IAAI,kBAAkB,EAAE,QAAQ,WAAW,QAAQ,EAAE,6BAA6B,EACvF,OAAO,2BACP,CAAC;AAEH,UAAO,WAAW;;EAGnB,MAAM,MAAM;EACZ,MAAM,SAAS;AAEf,MAAI;GACH,MAAM,UAAU,MAAM,QAAQ,OAAO;IAAE;IAAW;IAAM;IAAK,CAAC;GAG9D,IAAI,MAAM,qBAAqB;IAAE,MAFpB,MAAM,QAAQ,OAAO;KAAE;KAAQ;KAAS;KAAK,CAAC;IAEpB;IAAK;IAAQ,KAAK;IAAY,CAAC;AACtE,SAAM,oBAAoB,IAAI;AAC9B,SAAM,aAAa,IAAI;AAEvB,UAAO;WACC,OAAO;GACf,MAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AAC3E,SAAM,IAAI,kBAAkB,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,gBAAgB,CAAC;;;AAIjF,QAAO,EAAE,QAAQ;;AAGlB,8BAAe"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/server/compile/decode-style-entities.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Decode HTML entities inside <style> tag contents in an HTML string.
|
|
4
|
+
*
|
|
5
|
+
* Some SSR renderers escape text nodes inside <style> (notably React 18 and Vue SSR),
|
|
6
|
+
* which can produce invalid CSS when consuming the HTML as a string.
|
|
7
|
+
*/
|
|
8
|
+
declare function decodeReactVueStyleEntities(input: any): any;
|
|
9
|
+
declare function decodeStyleEntities(html: string): string;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { decodeReactVueStyleEntities, decodeStyleEntities, decodeStyleEntities as default };
|
|
12
|
+
//# sourceMappingURL=decode-style-entities.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-style-entities.d.mts","names":[],"sources":["../../../src/server/compile/decode-style-entities.ts"],"sourcesContent":[],"mappings":";;AAeA;AA2BA;;;;iBA3BgB,2BAAA;iBA2BA,mBAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/server/compile/decode-style-entities.ts
|
|
2
|
+
/**
|
|
3
|
+
* Decode HTML entities inside <style> tag contents in an HTML string.
|
|
4
|
+
*
|
|
5
|
+
* Some SSR renderers escape text nodes inside <style> (notably React 18 and Vue SSR),
|
|
6
|
+
* which can produce invalid CSS when consuming the HTML as a string.
|
|
7
|
+
*/
|
|
8
|
+
const REACT_VUE_ENTITY_RE = /&(quot|amp|lt|gt);|&#(?:x27|39);|�*27;|�*39;/gi;
|
|
9
|
+
function decodeReactVueStyleEntities(input) {
|
|
10
|
+
if (input == null) return input;
|
|
11
|
+
const str = String(input);
|
|
12
|
+
if (!str.includes("&")) return str;
|
|
13
|
+
return str.replace(REACT_VUE_ENTITY_RE, (_m, named) => {
|
|
14
|
+
if (named) switch (named.toLowerCase()) {
|
|
15
|
+
case "quot": return "\"";
|
|
16
|
+
case "amp": return "&";
|
|
17
|
+
case "lt": return "<";
|
|
18
|
+
case "gt": return ">";
|
|
19
|
+
}
|
|
20
|
+
return "'";
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function decodeStyleEntities(html) {
|
|
24
|
+
return html.replace(/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi, (_m, open, cssText, close) => {
|
|
25
|
+
return `${open}${decodeReactVueStyleEntities(cssText)}${close}`;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
var decode_style_entities_default = decodeStyleEntities;
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { decodeReactVueStyleEntities, decodeStyleEntities, decode_style_entities_default as default };
|
|
32
|
+
//# sourceMappingURL=decode-style-entities.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-style-entities.mjs","names":[],"sources":["../../../src/server/compile/decode-style-entities.ts"],"sourcesContent":["/**\n * Decode HTML entities inside <style> tag contents in an HTML string.\n *\n * Some SSR renderers escape text nodes inside <style> (notably React 18 and Vue SSR),\n * which can produce invalid CSS when consuming the HTML as a string.\n */\n\n// Decodes ONLY the HTML entities that React 18 SSR + Vue 3 SSR can introduce in\n// <style> (text nodes), and nothing else.\n//\n// React 18: " & < > '\n// Vue 3: " & < > '\n// (We also handle a couple equivalent apostrophe forms for robustness.)\nconst REACT_VUE_ENTITY_RE = /&(quot|amp|lt|gt);|&#(?:x27|39);|�*27;|�*39;/gi\n\nexport function decodeReactVueStyleEntities(input: any) {\n\tif (input == null) return input\n\tconst str = String(input)\n\t// Fast path\n\tif (!str.includes('&')) return str\n\n\treturn str.replace(REACT_VUE_ENTITY_RE, (_m: string, named?: string) => {\n\t\t// Named entities\n\t\tif (named) {\n\t\t\tswitch (named.toLowerCase()) {\n\t\t\t\tcase 'quot':\n\t\t\t\t\treturn '\"'\n\t\t\t\tcase 'amp':\n\t\t\t\t\treturn '&'\n\t\t\t\tcase 'lt':\n\t\t\t\t\treturn '<'\n\t\t\t\tcase 'gt':\n\t\t\t\t\treturn '>'\n\t\t\t}\n\t\t}\n\n\t\t// Numeric apostrophe entities (React/Vue forms)\n\t\t// m could be: ' ' plus zero-padded variants we allowed.\n\t\treturn \"'\"\n\t})\n}\n\nexport function decodeStyleEntities(html: string): string {\n\treturn html.replace(/(<style\\b[^>]*>)([\\s\\S]*?)(<\\/style>)/gi, (_m, open: string, cssText: string, close: string) => {\n\t\treturn `${open}${decodeReactVueStyleEntities(cssText)}${close}`\n\t})\n}\n\nexport default decodeStyleEntities\n"],"mappings":";;;;;;;AAaA,MAAM,sBAAsB;AAE5B,SAAgB,4BAA4B,OAAY;AACvD,KAAI,SAAS,KAAM,QAAO;CAC1B,MAAM,MAAM,OAAO,MAAM;AAEzB,KAAI,CAAC,IAAI,SAAS,IAAI,CAAE,QAAO;AAE/B,QAAO,IAAI,QAAQ,sBAAsB,IAAY,UAAmB;AAEvE,MAAI,MACH,SAAQ,MAAM,aAAa,EAA3B;GACC,KAAK,OACJ,QAAO;GACR,KAAK,MACJ,QAAO;GACR,KAAK,KACJ,QAAO;GACR,KAAK,KACJ,QAAO;;AAMV,SAAO;GACN;;AAGH,SAAgB,oBAAoB,MAAsB;AACzD,QAAO,KAAK,QAAQ,4CAA4C,IAAI,MAAc,SAAiB,UAAkB;AACpH,SAAO,GAAG,OAAO,4BAA4B,QAAQ,GAAG;GACvD;;AAGH,oCAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CompileOptions, NormalizedCompileOptions } from "../../shared/types/public/compile.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/server/compile/defaults.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Surface incompatible option combinations at normalisation time, so the user
|
|
7
|
+
* learns as soon as options are read rather than deep in the pipeline. Every
|
|
8
|
+
* combination here is ignored or risky, never build-breaking, so the intent is
|
|
9
|
+
* warn-and-continue — matching how the pipeline has always treated them.
|
|
10
|
+
*
|
|
11
|
+
* HTML output is excluded: it force-overrides the JS-bundle options and warns
|
|
12
|
+
* per flag in `warnIncompatibleHtmlOptions` instead.
|
|
13
|
+
*/
|
|
14
|
+
declare function warnIncompatibleOptionCombos(options: NormalizedCompileOptions): void;
|
|
15
|
+
declare function normalizeCompileOptions(input: CompileOptions): NormalizedCompileOptions;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { normalizeCompileOptions, warnIncompatibleOptionCombos };
|
|
18
|
+
//# sourceMappingURL=defaults.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.mts","names":[],"sources":["../../../src/server/compile/defaults.ts"],"sourcesContent":[],"mappings":";;;;;;AAkFA;AAwEA;;;;;;iBAxEgB,4BAAA,UAAsC;iBAwEtC,uBAAA,QAA+B,iBAAiB"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { DEFAULT_BUNDLE_NAME } from "./constants.mjs";
|
|
2
|
+
import { logger } from "../utils/log.mjs";
|
|
3
|
+
import { resolveBundleName } from "./bundle-name.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/server/compile/defaults.ts
|
|
6
|
+
function uniq(arr) {
|
|
7
|
+
return [...new Set(arr)];
|
|
8
|
+
}
|
|
9
|
+
function presetDefaults(preset) {
|
|
10
|
+
if (preset === "browser") return {
|
|
11
|
+
target: "browser",
|
|
12
|
+
bundleAll: true,
|
|
13
|
+
conditions: [],
|
|
14
|
+
externalConditions: []
|
|
15
|
+
};
|
|
16
|
+
if (preset === "edge") return {
|
|
17
|
+
target: "worker",
|
|
18
|
+
bundleAll: true,
|
|
19
|
+
conditions: [
|
|
20
|
+
"workerd",
|
|
21
|
+
"worker",
|
|
22
|
+
"browser",
|
|
23
|
+
"module"
|
|
24
|
+
],
|
|
25
|
+
externalConditions: [
|
|
26
|
+
"workerd",
|
|
27
|
+
"worker",
|
|
28
|
+
"browser",
|
|
29
|
+
"node"
|
|
30
|
+
]
|
|
31
|
+
};
|
|
32
|
+
if (preset === "node") return {
|
|
33
|
+
target: "node",
|
|
34
|
+
bundleAll: false,
|
|
35
|
+
conditions: [],
|
|
36
|
+
externalConditions: []
|
|
37
|
+
};
|
|
38
|
+
throw new Error(`Invalid preset: ${preset}`);
|
|
39
|
+
}
|
|
40
|
+
const DEFAULTS = {
|
|
41
|
+
documents: [],
|
|
42
|
+
external: [],
|
|
43
|
+
bundle: [],
|
|
44
|
+
assets: "static",
|
|
45
|
+
output: "renderer",
|
|
46
|
+
variants: [],
|
|
47
|
+
remoteAssets: false,
|
|
48
|
+
inlineRemoteCss: false,
|
|
49
|
+
validateSchema: true,
|
|
50
|
+
cjs: false,
|
|
51
|
+
bundleName: DEFAULT_BUNDLE_NAME,
|
|
52
|
+
version: null,
|
|
53
|
+
clean: true,
|
|
54
|
+
outDir: null,
|
|
55
|
+
configPath: null,
|
|
56
|
+
target: "node",
|
|
57
|
+
preset: "node",
|
|
58
|
+
conditions: [],
|
|
59
|
+
externalConditions: [],
|
|
60
|
+
userBundler: null
|
|
61
|
+
};
|
|
62
|
+
const warnIgnored = (message) => logger.warn(`ℹ ${message}`);
|
|
63
|
+
const warnRisky = (message) => logger.warn(`⚠ ${message}`);
|
|
64
|
+
/**
|
|
65
|
+
* Surface incompatible option combinations at normalisation time, so the user
|
|
66
|
+
* learns as soon as options are read rather than deep in the pipeline. Every
|
|
67
|
+
* combination here is ignored or risky, never build-breaking, so the intent is
|
|
68
|
+
* warn-and-continue — matching how the pipeline has always treated them.
|
|
69
|
+
*
|
|
70
|
+
* HTML output is excluded: it force-overrides the JS-bundle options and warns
|
|
71
|
+
* per flag in `warnIncompatibleHtmlOptions` instead.
|
|
72
|
+
*/
|
|
73
|
+
function warnIncompatibleOptionCombos(options) {
|
|
74
|
+
if (options.output === "html") return;
|
|
75
|
+
if (options.variants.length > 0) warnIgnored("The --variants flag only applies to html output, ignoring.");
|
|
76
|
+
if (options.remoteAssets && options.assets !== "static") warnIgnored(`remoteAssets applies to static mode only — ${options.assets === "dynamic" ? "dynamic bundles build their zip at render time in your runtime" : "none mode emits no assets"}. It will be ignored.`);
|
|
77
|
+
if (options.remoteAssets && options.assets === "static" && options.target !== "node") warnIgnored(`remoteAssets requires a node-target compile, where the document renders at build time — target: "${options.target}" bundles never render during the build. It will be ignored.`);
|
|
78
|
+
if (options.target === "browser" && options.bundle.length) warnIgnored("The bundle option is ignored for target: \"browser\". All packages are bundled by default. Use the \"external\" option to exclude packages from the bundle.");
|
|
79
|
+
if (options.target === "node" && options.external.length) warnIgnored("The external option is ignored for target: \"node\". All packages are externalized by default (and need to be installed where you call render). Use the \"bundle\" option to include packages in the bundle.");
|
|
80
|
+
if (options.preset === "edge" && options.bundle.length) warnIgnored("The bundle option is ignored for preset: \"edge\". All packages are bundled by default. Use the \"external\" option to exclude packages from the bundle.");
|
|
81
|
+
if (options.preset === "edge") {
|
|
82
|
+
if (options.external.length) warnRisky("Using \"external\" with preset: \"edge\" means those packages must be provided by your edge runtime environment. In most cases, you want everything bundled.");
|
|
83
|
+
if (options.cjs) warnRisky("preset: \"edge\" commonly requires ESM. Using --cjs may not work in your edge runtime.");
|
|
84
|
+
}
|
|
85
|
+
if (options.preset === "browser" && options.external.length) warnRisky("Using \"external\" with preset: \"browser\" means those packages must be resolved by the consumer bundler at runtime.");
|
|
86
|
+
if (options.target === "worker" && options.external.length) warnRisky("Using \"external\" with target: \"worker\" means those packages must be provided by your worker runtime environment.");
|
|
87
|
+
if (options.target === "worker" && options.cjs) warnRisky("target: \"worker\" commonly requires ESM. Using --cjs may not work in your worker runtime.");
|
|
88
|
+
}
|
|
89
|
+
function normalizeCompileOptions(input) {
|
|
90
|
+
const preset = input.preset ?? DEFAULTS.preset;
|
|
91
|
+
const presetConfig = presetDefaults(preset);
|
|
92
|
+
const target = input.target ?? presetConfig.target;
|
|
93
|
+
const bundleAll = preset === "edge" ? true : presetConfig.bundleAll;
|
|
94
|
+
const documents = input.documents ?? DEFAULTS.documents;
|
|
95
|
+
const external = input.external ?? DEFAULTS.external;
|
|
96
|
+
const bundle = input.bundle ?? DEFAULTS.bundle;
|
|
97
|
+
const conditions = uniq([...presetConfig.conditions ?? [], ...input.conditions ?? DEFAULTS.conditions]);
|
|
98
|
+
const externalConditions = uniq([...presetConfig.externalConditions ?? [], ...input.externalConditions ?? DEFAULTS.externalConditions]);
|
|
99
|
+
const normalized = {
|
|
100
|
+
documents,
|
|
101
|
+
external,
|
|
102
|
+
bundle,
|
|
103
|
+
assets: input.assets ?? DEFAULTS.assets,
|
|
104
|
+
output: input.output ?? DEFAULTS.output,
|
|
105
|
+
variants: input.variants ?? DEFAULTS.variants,
|
|
106
|
+
remoteAssets: input.remoteAssets ?? DEFAULTS.remoteAssets,
|
|
107
|
+
validateSchema: input.validateSchema ?? DEFAULTS.validateSchema,
|
|
108
|
+
inlineRemoteCss: input.inlineRemoteCss ?? DEFAULTS.inlineRemoteCss,
|
|
109
|
+
cjs: input.cjs ?? DEFAULTS.cjs,
|
|
110
|
+
bundleName: resolveBundleName(input.bundleName ?? DEFAULTS.bundleName),
|
|
111
|
+
version: input.version ?? DEFAULTS.version,
|
|
112
|
+
clean: input.clean ?? DEFAULTS.clean,
|
|
113
|
+
outDir: input.outDir ?? DEFAULTS.outDir,
|
|
114
|
+
target,
|
|
115
|
+
preset,
|
|
116
|
+
configPath: input.configPath ?? DEFAULTS.configPath,
|
|
117
|
+
bundleAll,
|
|
118
|
+
conditions,
|
|
119
|
+
externalConditions,
|
|
120
|
+
userBundler: input.userBundler ?? DEFAULTS.userBundler
|
|
121
|
+
};
|
|
122
|
+
warnIncompatibleOptionCombos(normalized);
|
|
123
|
+
return normalized;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
export { normalizeCompileOptions, warnIncompatibleOptionCombos };
|
|
128
|
+
//# sourceMappingURL=defaults.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.mjs","names":["preset: Preset | undefined","target: Target","normalized: NormalizedCompileOptions"],"sources":["../../../src/server/compile/defaults.ts"],"sourcesContent":["import type { CompileOptions, NormalizedCompileOptions, Preset, Target } from '../../shared/types/public'\nimport { logger } from '../utils/log'\nimport { resolveBundleName } from './bundle-name'\nimport { DEFAULT_BUNDLE_NAME } from './constants'\n\nfunction uniq(arr: string[]) {\n\treturn [...new Set(arr)]\n}\n\ninterface PresetDefaults {\n\ttarget: Target\n\tbundleAll: boolean\n\tconditions: string[]\n\texternalConditions: string[]\n}\n\nfunction presetDefaults(preset?: Preset): PresetDefaults {\n\tif (preset === 'browser') {\n\t\treturn {\n\t\t\ttarget: 'browser',\n\t\t\tbundleAll: true,\n\t\t\tconditions: [],\n\t\t\texternalConditions: []\n\t\t}\n\t}\n\n\tif (preset === 'edge') {\n\t\treturn {\n\t\t\ttarget: 'worker',\n\t\t\tbundleAll: true,\n\t\t\tconditions: ['workerd', 'worker', 'browser', 'module'],\n\t\t\texternalConditions: ['workerd', 'worker', 'browser', 'node']\n\t\t}\n\t}\n\n\tif (preset === 'node') {\n\t\treturn {\n\t\t\ttarget: 'node',\n\t\t\tbundleAll: false,\n\t\t\tconditions: [],\n\t\t\texternalConditions: []\n\t\t}\n\t}\n\n\tthrow new Error(`Invalid preset: ${preset}`)\n}\n\nconst DEFAULTS = {\n\tdocuments: [] as string[],\n\texternal: [] as string[],\n\tbundle: [] as string[],\n\tassets: 'static',\n\toutput: 'renderer',\n\tvariants: [] as string[],\n\tremoteAssets: false,\n\tinlineRemoteCss: false,\n\tvalidateSchema: true,\n\tcjs: false,\n\tbundleName: DEFAULT_BUNDLE_NAME,\n\tversion: null,\n\tclean: true,\n\toutDir: null,\n\tconfigPath: null,\n\ttarget: 'node',\n\tpreset: 'node',\n\tconditions: [],\n\texternalConditions: [],\n\tuserBundler: null\n} satisfies Required<CompileOptions>\n\nconst warnIgnored = (message: string) => logger.warn(`ℹ ${message}`)\nconst warnRisky = (message: string) => logger.warn(`⚠ ${message}`)\n\n/**\n * Surface incompatible option combinations at normalisation time, so the user\n * learns as soon as options are read rather than deep in the pipeline. Every\n * combination here is ignored or risky, never build-breaking, so the intent is\n * warn-and-continue — matching how the pipeline has always treated them.\n *\n * HTML output is excluded: it force-overrides the JS-bundle options and warns\n * per flag in `warnIncompatibleHtmlOptions` instead.\n */\nexport function warnIncompatibleOptionCombos(options: NormalizedCompileOptions) {\n\tif (options.output === 'html') {\n\t\treturn\n\t}\n\n\tif (options.variants.length > 0) {\n\t\twarnIgnored('The --variants flag only applies to html output, ignoring.')\n\t}\n\n\tif (options.remoteAssets && options.assets !== 'static') {\n\t\tconst reason =\n\t\t\toptions.assets === 'dynamic'\n\t\t\t\t? 'dynamic bundles build their zip at render time in your runtime'\n\t\t\t\t: 'none mode emits no assets'\n\n\t\twarnIgnored(`remoteAssets applies to static mode only — ${reason}. It will be ignored.`)\n\t}\n\n\tif (options.remoteAssets && options.assets === 'static' && options.target !== 'node') {\n\t\twarnIgnored(\n\t\t\t`remoteAssets requires a node-target compile, where the document renders at build time — ` +\n\t\t\t\t`target: \"${options.target}\" bundles never render during the build. It will be ignored.`\n\t\t)\n\t}\n\n\t// bundle/external rules are preset defaults. Users can still specify overrides (warn only).\n\tif (options.target === 'browser' && options.bundle.length) {\n\t\twarnIgnored(\n\t\t\t'The bundle option is ignored for target: \"browser\". All packages are bundled by default. Use the \"external\" option to exclude packages from the bundle.'\n\t\t)\n\t}\n\n\tif (options.target === 'node' && options.external.length) {\n\t\twarnIgnored(\n\t\t\t'The external option is ignored for target: \"node\". All packages are externalized by default (and need to be installed where you call render). Use the \"bundle\" option to include packages in the bundle.'\n\t\t)\n\t}\n\n\tif (options.preset === 'edge' && options.bundle.length) {\n\t\twarnIgnored(\n\t\t\t'The bundle option is ignored for preset: \"edge\". All packages are bundled by default. Use the \"external\" option to exclude packages from the bundle.'\n\t\t)\n\t}\n\n\tif (options.preset === 'edge') {\n\t\tif (options.external.length) {\n\t\t\twarnRisky(\n\t\t\t\t'Using \"external\" with preset: \"edge\" means those packages must be provided by your edge runtime environment. In most cases, you want everything bundled.'\n\t\t\t)\n\t\t}\n\t\tif (options.cjs) {\n\t\t\twarnRisky('preset: \"edge\" commonly requires ESM. Using --cjs may not work in your edge runtime.')\n\t\t}\n\t}\n\n\tif (options.preset === 'browser' && options.external.length) {\n\t\twarnRisky(\n\t\t\t'Using \"external\" with preset: \"browser\" means those packages must be resolved by the consumer bundler at runtime.'\n\t\t)\n\t}\n\n\tif (options.target === 'worker' && options.external.length) {\n\t\twarnRisky(\n\t\t\t'Using \"external\" with target: \"worker\" means those packages must be provided by your worker runtime environment.'\n\t\t)\n\t}\n\n\tif (options.target === 'worker' && options.cjs) {\n\t\twarnRisky('target: \"worker\" commonly requires ESM. Using --cjs may not work in your worker runtime.')\n\t}\n}\n\nexport function normalizeCompileOptions(input: CompileOptions): NormalizedCompileOptions {\n\tconst preset: Preset | undefined = input.preset ?? DEFAULTS.preset\n\tconst presetConfig = presetDefaults(preset)\n\n\tconst target: Target = input.target ?? presetConfig.target\n\tconst bundleAll = preset === 'edge' ? true : presetConfig.bundleAll\n\n\tconst documents = input.documents ?? DEFAULTS.documents\n\tconst external = input.external ?? DEFAULTS.external\n\tconst bundle = input.bundle ?? DEFAULTS.bundle\n\n\tconst conditions = uniq([...(presetConfig.conditions ?? []), ...(input.conditions ?? DEFAULTS.conditions)])\n\tconst externalConditions = uniq([\n\t\t...(presetConfig.externalConditions ?? []),\n\t\t...(input.externalConditions ?? DEFAULTS.externalConditions)\n\t])\n\n\tconst normalized: NormalizedCompileOptions = {\n\t\tdocuments,\n\t\texternal,\n\t\tbundle,\n\t\tassets: input.assets ?? DEFAULTS.assets,\n\t\toutput: input.output ?? DEFAULTS.output,\n\t\tvariants: input.variants ?? DEFAULTS.variants,\n\t\tremoteAssets: input.remoteAssets ?? DEFAULTS.remoteAssets,\n\t\tvalidateSchema: input.validateSchema ?? DEFAULTS.validateSchema,\n\t\tinlineRemoteCss: input.inlineRemoteCss ?? DEFAULTS.inlineRemoteCss,\n\t\tcjs: input.cjs ?? DEFAULTS.cjs,\n\t\tbundleName: resolveBundleName(input.bundleName ?? DEFAULTS.bundleName),\n\t\tversion: input.version ?? DEFAULTS.version,\n\t\tclean: input.clean ?? DEFAULTS.clean,\n\t\toutDir: input.outDir ?? DEFAULTS.outDir,\n\t\ttarget,\n\t\tpreset,\n\t\tconfigPath: input.configPath ?? DEFAULTS.configPath,\n\t\tbundleAll,\n\t\tconditions,\n\t\texternalConditions,\n\t\tuserBundler: input.userBundler ?? DEFAULTS.userBundler\n\t}\n\n\twarnIncompatibleOptionCombos(normalized)\n\n\treturn normalized\n}\n"],"mappings":";;;;;AAKA,SAAS,KAAK,KAAe;AAC5B,QAAO,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC;;AAUzB,SAAS,eAAe,QAAiC;AACxD,KAAI,WAAW,UACd,QAAO;EACN,QAAQ;EACR,WAAW;EACX,YAAY,EAAE;EACd,oBAAoB,EAAE;EACtB;AAGF,KAAI,WAAW,OACd,QAAO;EACN,QAAQ;EACR,WAAW;EACX,YAAY;GAAC;GAAW;GAAU;GAAW;GAAS;EACtD,oBAAoB;GAAC;GAAW;GAAU;GAAW;GAAO;EAC5D;AAGF,KAAI,WAAW,OACd,QAAO;EACN,QAAQ;EACR,WAAW;EACX,YAAY,EAAE;EACd,oBAAo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,YAAY,QAAQ,IAC1C,WAAU,6FAA2F;;AAIvG,SAAgB,wBAAwB,OAAiD;CACxF,MAAMA,SAA6B,MAAM,UAAU,SAAS;CAC5D,MAAM,eAAe,eAAe,OAAO;CAE3C,MAAMC,SAAiB,MAAM,UAAU,aAAa;CACpD,MAAM,YAAY,WAAW,SAAS,OAAO,aAAa;CAE1D,MAAM,YAAY,MAAM,aAAa,SAAS;CAC9C,MAAM,WAAW,MAAM,YAAY,SAAS;CAC5C,MAAM,SAAS,MAAM,UAAU,SAAS;CAExC,MAAM,aAAa,KAAK,CAAC,GAAI,aAAa,cAAc,EAAE,EAAG,GAAI,MAAM,cAAc,SAAS,WAAY,CAAC;CAC3G,MAAM,qBAAqB,KAAK,CAC/B,GAAI,aAAa,sBAAsB,EAAE,EACzC,GAAI,MAAM,sBAAsB,SAAS,mBACzC,CAAC;CAEF,MAAMC,aAAuC;EAC5C;EACA;EACA;EACA,QAAQ,MAAM,UAAU,SAAS;EACjC,QAAQ,MAAM,UAAU,SAAS;EACjC,UAAU,MAAM,YAAY,SAAS;EACrC,cAAc,MAAM,gBAAgB,SAAS;EAC7C,gBAAgB,MAAM,kBAAkB,SAAS;EACjD,iBAAiB,MAAM,mBAAmB,SAAS;EACnD,KAAK,MAAM,OAAO,SAAS;EAC3B,YAAY,kBAAkB,MAAM,cAAc,SAAS,WAAW;EACtE,SAAS,MAAM,WAAW,SAAS;EACnC,OAAO,MAAM,SAAS,SAAS;EAC/B,QAAQ,MAAM,UAAU,SAAS;EACjC;EACA;EACA,YAAY,MAAM,cAAc,SAAS;EACzC;EACA;EACA;EACA,aAAa,MAAM,eAAe,SAAS;EAC3C;AAED,8BAA6B,WAAW;AAExC,QAAO"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/server/compile/dependency-closure.d.ts
|
|
2
|
+
declare function basePackageName(id: string): string;
|
|
3
|
+
type ExpandDependencyClosureInput = {
|
|
4
|
+
seedPackages: string[];
|
|
5
|
+
excludedPackages?: string[];
|
|
6
|
+
};
|
|
7
|
+
declare function expandTransitiveDependencyClosure(input: ExpandDependencyClosureInput): string[];
|
|
8
|
+
//#endregion
|
|
9
|
+
export { basePackageName, expandTransitiveDependencyClosure };
|
|
10
|
+
//# sourceMappingURL=dependency-closure.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-closure.d.mts","names":[],"sources":["../../../src/server/compile/dependency-closure.ts"],"sourcesContent":[],"mappings":";iBAMgB,eAAA;AAAhB,KAyEK,4BAAA,GAzE0B;EAyE1B,YAAA,EAAA,MAAA,EAAA;EAKW,gBAAA,CAAA,EAAA,MAAA,EAAA;;iBAAA,iCAAA,QAAyC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
|
|
5
|
+
//#region src/server/compile/dependency-closure.ts
|
|
6
|
+
const req = createRequire(import.meta.url);
|
|
7
|
+
function basePackageName(id) {
|
|
8
|
+
if (id.startsWith("@")) {
|
|
9
|
+
const parts = id.split("/");
|
|
10
|
+
return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : id;
|
|
11
|
+
}
|
|
12
|
+
return id.split("/")[0] ?? id;
|
|
13
|
+
}
|
|
14
|
+
const pkgJsonPathCache = /* @__PURE__ */ new Map();
|
|
15
|
+
function resolvePackageJsonPath(pkg) {
|
|
16
|
+
const name = basePackageName(pkg);
|
|
17
|
+
const cached = pkgJsonPathCache.get(name);
|
|
18
|
+
if (cached !== void 0) return cached;
|
|
19
|
+
try {
|
|
20
|
+
const p = req.resolve(`${name}/package.json`);
|
|
21
|
+
pkgJsonPathCache.set(name, p);
|
|
22
|
+
return p;
|
|
23
|
+
} catch {
|
|
24
|
+
try {
|
|
25
|
+
let dir = dirname(req.resolve(name));
|
|
26
|
+
for (let i = 0; i < 10; i++) {
|
|
27
|
+
const candidate = join(dir, "package.json");
|
|
28
|
+
try {
|
|
29
|
+
JSON.parse(readFileSync(candidate, "utf8"));
|
|
30
|
+
pkgJsonPathCache.set(name, candidate);
|
|
31
|
+
return candidate;
|
|
32
|
+
} catch {}
|
|
33
|
+
dir = dirname(dir);
|
|
34
|
+
}
|
|
35
|
+
} catch {}
|
|
36
|
+
pkgJsonPathCache.set(name, null);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const directDepsCache = /* @__PURE__ */ new Map();
|
|
41
|
+
function getDirectDeps(pkg) {
|
|
42
|
+
const name = basePackageName(pkg);
|
|
43
|
+
const cached = directDepsCache.get(name);
|
|
44
|
+
if (cached) return cached;
|
|
45
|
+
const pkgJsonPath = resolvePackageJsonPath(name);
|
|
46
|
+
if (!pkgJsonPath) {
|
|
47
|
+
directDepsCache.set(name, []);
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
const json = JSON.parse(readFileSync(pkgJsonPath, "utf8"));
|
|
52
|
+
const deps = [...Object.keys(json.dependencies ?? {}), ...Object.keys(json.optionalDependencies ?? {})].map(basePackageName);
|
|
53
|
+
directDepsCache.set(name, deps);
|
|
54
|
+
return deps;
|
|
55
|
+
} catch {
|
|
56
|
+
directDepsCache.set(name, []);
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function expandTransitiveDependencyClosure(input) {
|
|
61
|
+
const { seedPackages, excludedPackages = [] } = input;
|
|
62
|
+
const excluded = new Set(excludedPackages.map(basePackageName));
|
|
63
|
+
const out = /* @__PURE__ */ new Set();
|
|
64
|
+
const queue = seedPackages.map(basePackageName);
|
|
65
|
+
while (queue.length) {
|
|
66
|
+
const next = queue.pop();
|
|
67
|
+
if (!next) continue;
|
|
68
|
+
const name = basePackageName(next);
|
|
69
|
+
if (out.has(name)) continue;
|
|
70
|
+
out.add(name);
|
|
71
|
+
if (excluded.has(name)) continue;
|
|
72
|
+
for (const dep of getDirectDeps(name)) if (!out.has(dep) && !excluded.has(dep)) queue.push(dep);
|
|
73
|
+
}
|
|
74
|
+
return [...out];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { basePackageName, expandTransitiveDependencyClosure };
|
|
79
|
+
//# sourceMappingURL=dependency-closure.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-closure.mjs","names":[],"sources":["../../../src/server/compile/dependency-closure.ts"],"sourcesContent":["import { readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { dirname, join } from 'node:path'\n\nconst req = createRequire(import.meta.url)\n\nexport function basePackageName(id: string) {\n\t// Convert subpaths (e.g. `react-dom/client`) into package names (`react-dom`).\n\t// Preserve scoped packages (e.g. `@scope/name/subpath` -> `@scope/name`).\n\tif (id.startsWith('@')) {\n\t\tconst parts = id.split('/')\n\t\treturn parts.length >= 2 ? `${parts[0]}/${parts[1]}` : id\n\t}\n\treturn id.split('/')[0] ?? id\n}\n\nconst pkgJsonPathCache = new Map<string, string | null>()\nfunction resolvePackageJsonPath(pkg: string): string | null {\n\tconst name = basePackageName(pkg)\n\tconst cached = pkgJsonPathCache.get(name)\n\tif (cached !== undefined) return cached\n\n\ttry {\n\t\tconst p = req.resolve(`${name}/package.json`)\n\t\tpkgJsonPathCache.set(name, p)\n\t\treturn p\n\t} catch {\n\t\t// Some packages restrict `package.json` in `exports`.\n\t\t// Fall back to locating package.json from the resolved entry file.\n\t\ttry {\n\t\t\tconst entry = req.resolve(name)\n\t\t\tlet dir = dirname(entry)\n\t\t\tfor (let i = 0; i < 10; i++) {\n\t\t\t\tconst candidate = join(dir, 'package.json')\n\t\t\t\ttry {\n\t\t\t\t\tJSON.parse(readFileSync(candidate, 'utf8'))\n\t\t\t\t\tpkgJsonPathCache.set(name, candidate)\n\t\t\t\t\treturn candidate\n\t\t\t\t} catch {\n\t\t\t\t\t// keep walking\n\t\t\t\t}\n\t\t\t\tdir = dirname(dir)\n\t\t\t}\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t\tpkgJsonPathCache.set(name, null)\n\t\treturn null\n\t}\n}\n\nconst directDepsCache = new Map<string, string[]>()\nfunction getDirectDeps(pkg: string): string[] {\n\tconst name = basePackageName(pkg)\n\tconst cached = directDepsCache.get(name)\n\tif (cached) return cached\n\n\tconst pkgJsonPath = resolvePackageJsonPath(name)\n\tif (!pkgJsonPath) {\n\t\tdirectDepsCache.set(name, [])\n\t\treturn []\n\t}\n\n\ttry {\n\t\tconst json = JSON.parse(readFileSync(pkgJsonPath, 'utf8')) as {\n\t\t\tdependencies?: Record<string, string>\n\t\t\toptionalDependencies?: Record<string, string>\n\t\t}\n\t\tconst deps = [...Object.keys(json.dependencies ?? {}), ...Object.keys(json.optionalDependencies ?? {})].map(\n\t\t\tbasePackageName\n\t\t)\n\t\tdirectDepsCache.set(name, deps)\n\t\treturn deps\n\t} catch {\n\t\tdirectDepsCache.set(name, [])\n\t\treturn []\n\t}\n}\n\ntype ExpandDependencyClosureInput = {\n\tseedPackages: string[]\n\texcludedPackages?: string[]\n}\n\nexport function expandTransitiveDependencyClosure(input: ExpandDependencyClosureInput): string[] {\n\tconst { seedPackages, excludedPackages = [] } = input\n\tconst excluded = new Set(excludedPackages.map(basePackageName))\n\tconst out = new Set<string>()\n\tconst queue = seedPackages.map(basePackageName)\n\n\t// Vite's `ssr.noExternal` is not recursive for package dependency graphs.\n\t// We expand the full transitive closure so nested sanitizer deps are also bundled.\n\twhile (queue.length) {\n\t\tconst next = queue.pop()\n\t\tif (!next) continue\n\n\t\tconst name = basePackageName(next)\n\t\tif (out.has(name)) continue\n\t\tout.add(name)\n\n\t\tif (excluded.has(name)) continue\n\n\t\tfor (const dep of getDirectDeps(name)) {\n\t\t\tif (!out.has(dep) && !excluded.has(dep)) {\n\t\t\t\tqueue.push(dep)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn [...out]\n}\n"],"mappings":";;;;;AAIA,MAAM,MAAM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