@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.5 → 3.5.0-ultramodern.75
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/bin/modern.js +0 -0
- package/dist/cjs/builder/generator/getBuilderEnvironments.js +13 -16
- package/dist/cjs/builder/shared/builderPlugins/adapterPrecompress.js +13 -4
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +14 -11
- package/dist/cjs/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.js +72 -0
- package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +28 -11
- package/dist/cjs/builder/shared/bundlerPlugins/index.js +13 -6
- package/dist/cjs/builder/shared/lazyCompilation.js +2 -10
- package/dist/cjs/commands/index.js +0 -4
- package/dist/cjs/config/build-environment.js +268 -0
- package/dist/cjs/config/index.js +11 -4
- package/dist/cjs/config/public.js +46 -0
- package/dist/cjs/index.js +39 -62
- package/dist/cjs/plugins/analyze/getServerRoutes.js +19 -0
- package/dist/cjs/plugins/analyze/index.js +20 -12
- package/dist/cjs/plugins/backend-federation/codegen.js +255 -0
- package/dist/cjs/plugins/backend-federation/config.js +204 -0
- package/dist/cjs/plugins/backend-federation/emit.js +148 -0
- package/dist/cjs/plugins/backendFederationBuild.js +53 -0
- package/dist/cjs/plugins/deploy/index.js +4 -4
- package/dist/cjs/plugins/deploy/platforms/cloudflare/artifacts.js +127 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/constants.js +141 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/delivery-unit.js +139 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/i18n-worker.js +135 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/index.js +150 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/security-policies.js +205 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/types.js +18 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/utils.js +66 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/worker-manifest.js +208 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/wrangler-config.js +204 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-contract.js +108 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-plan.js +93 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/identity.js +83 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +188 -0
- package/dist/cjs/{baseline.js → plugins/deploy/platforms/cloudflare-output-verifier/issues.js} +19 -10
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/manifest.js +89 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.js +151 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +302 -0
- package/dist/cjs/plugins/deploy/platforms/node.js +20 -2
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +250 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +191 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +514 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +1012 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +363 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +93 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +8 -4
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +251 -155
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +78 -39
- package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.cjs +62 -41
- package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.mjs +63 -41
- package/dist/cjs/plugins/deploy/platforms/templates/node-entry.cjs +52 -35
- package/dist/cjs/plugins/deploy/platforms/templates/node-entry.mjs +53 -35
- package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.cjs +61 -41
- package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.mjs +61 -40
- package/dist/cjs/plugins/deploy/utils/npmAliases.js +226 -0
- package/dist/cjs/plugins/ultramodernReleaseEnvelope.js +100 -0
- package/dist/cjs/presetUltramodern.js +33 -2
- package/dist/cjs/ultramodern-release-envelope/canonical.js +68 -0
- package/dist/cjs/ultramodern-release-envelope/framework-output.js +597 -0
- package/dist/cjs/ultramodern-release-envelope/index.js +399 -0
- package/dist/cjs/ultramodern-release-envelope/types.js +51 -0
- package/dist/cjs/ultramodern-release-identity.js +110 -0
- package/dist/esm/builder/generator/getBuilderEnvironments.mjs +12 -15
- package/dist/esm/builder/shared/builderPlugins/adapterPrecompress.mjs +13 -4
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.mjs +15 -12
- package/dist/esm/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.mjs +30 -0
- package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.mjs +24 -10
- package/dist/esm/builder/shared/bundlerPlugins/index.mjs +1 -0
- package/dist/esm/builder/shared/lazyCompilation.mjs +1 -3
- package/dist/esm/commands/index.mjs +0 -1
- package/dist/esm/config/build-environment.mjs +224 -0
- package/dist/esm/config/index.mjs +1 -0
- package/dist/esm/config/public.mjs +1 -0
- package/dist/esm/index.mjs +5 -4
- package/dist/esm/plugins/analyze/getHtmlTemplate.mjs +2 -2
- package/dist/esm/plugins/analyze/getServerRoutes.mjs +17 -1
- package/dist/esm/plugins/analyze/index.mjs +20 -12
- package/dist/esm/plugins/analyze/isDefaultExportFunction.mjs +2 -2
- package/dist/esm/plugins/backend-federation/codegen.mjs +204 -0
- package/dist/esm/plugins/backend-federation/config.mjs +128 -0
- package/dist/esm/plugins/backend-federation/emit.mjs +97 -0
- package/dist/esm/plugins/backendFederationBuild.mjs +1 -0
- package/dist/esm/plugins/deploy/index.mjs +1 -1
- package/dist/esm/plugins/deploy/platforms/cloudflare/artifacts.mjs +64 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/constants.mjs +34 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +88 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +97 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/index.mjs +102 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/security-policies.mjs +167 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/types.mjs +0 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/utils.mjs +12 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +148 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +150 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-contract.mjs +31 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-plan.mjs +45 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +45 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +133 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +10 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +51 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +99 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +238 -0
- package/dist/esm/plugins/deploy/platforms/node.mjs +20 -2
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +250 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +191 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +514 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +1012 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +363 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +93 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +8 -4
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +251 -155
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +78 -39
- package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.cjs +62 -41
- package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.mjs +63 -41
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.cjs +52 -35
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.mjs +53 -35
- package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.cjs +61 -41
- package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.mjs +61 -40
- package/dist/esm/plugins/deploy/utils/npmAliases.mjs +174 -0
- package/dist/esm/plugins/ultramodernReleaseEnvelope.mjs +52 -0
- package/dist/esm/presetUltramodern.mjs +33 -2
- package/dist/esm/ultramodern-release-envelope/canonical.mjs +21 -0
- package/dist/esm/ultramodern-release-envelope/framework-output.mjs +524 -0
- package/dist/esm/ultramodern-release-envelope/index.mjs +335 -0
- package/dist/esm/ultramodern-release-envelope/types.mjs +7 -0
- package/dist/esm/ultramodern-release-identity.mjs +66 -0
- package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +12 -15
- package/dist/esm-node/builder/shared/builderPlugins/adapterPrecompress.mjs +13 -4
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.mjs +15 -12
- package/dist/esm-node/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.mjs +31 -0
- package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.mjs +24 -10
- package/dist/esm-node/builder/shared/bundlerPlugins/index.mjs +1 -0
- package/dist/esm-node/builder/shared/lazyCompilation.mjs +1 -3
- package/dist/esm-node/commands/index.mjs +0 -1
- package/dist/esm-node/config/build-environment.mjs +225 -0
- package/dist/esm-node/config/index.mjs +1 -0
- package/dist/esm-node/config/public.mjs +2 -0
- package/dist/esm-node/index.mjs +5 -4
- package/dist/esm-node/plugins/analyze/getHtmlTemplate.mjs +2 -2
- package/dist/esm-node/plugins/analyze/getServerRoutes.mjs +17 -1
- package/dist/esm-node/plugins/analyze/index.mjs +20 -12
- package/dist/esm-node/plugins/analyze/isDefaultExportFunction.mjs +2 -2
- package/dist/esm-node/plugins/backend-federation/codegen.mjs +205 -0
- package/dist/esm-node/plugins/backend-federation/config.mjs +129 -0
- package/dist/esm-node/plugins/backend-federation/emit.mjs +98 -0
- package/dist/esm-node/plugins/backendFederationBuild.mjs +2 -0
- package/dist/esm-node/plugins/deploy/index.mjs +1 -1
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/artifacts.mjs +65 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/constants.mjs +35 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +89 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +98 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/index.mjs +103 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/security-policies.mjs +168 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/types.mjs +1 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/utils.mjs +13 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +149 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +151 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-contract.mjs +32 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-plan.mjs +46 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +46 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +134 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +11 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +52 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +100 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +239 -0
- package/dist/esm-node/plugins/deploy/platforms/node.mjs +20 -2
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +250 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +191 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +514 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +1012 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +363 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +93 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +8 -4
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +251 -155
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +78 -39
- package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.cjs +62 -41
- package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.mjs +63 -41
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.cjs +52 -35
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.mjs +53 -35
- package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.cjs +61 -41
- package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.mjs +61 -40
- package/dist/esm-node/plugins/deploy/utils/npmAliases.mjs +175 -0
- package/dist/esm-node/plugins/ultramodernReleaseEnvelope.mjs +53 -0
- package/dist/esm-node/presetUltramodern.mjs +33 -2
- package/dist/esm-node/ultramodern-release-envelope/canonical.mjs +22 -0
- package/dist/esm-node/ultramodern-release-envelope/framework-output.mjs +525 -0
- package/dist/esm-node/ultramodern-release-envelope/index.mjs +336 -0
- package/dist/esm-node/ultramodern-release-envelope/types.mjs +8 -0
- package/dist/esm-node/ultramodern-release-identity.mjs +67 -0
- package/dist/types/builder/generator/createCopyPattern.d.ts +7 -5
- package/dist/types/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.d.ts +6 -0
- package/dist/types/builder/shared/bundlerPlugins/RouterPlugin.d.ts +1 -0
- package/dist/types/builder/shared/bundlerPlugins/index.d.ts +1 -0
- package/dist/types/builder/shared/lazyCompilation.d.ts +2 -4
- package/dist/types/commands/index.d.ts +0 -1
- package/dist/types/config/build-environment.d.ts +22 -0
- package/dist/types/config/index.d.ts +1 -0
- package/dist/types/config/public.d.ts +2 -0
- package/dist/types/index.d.ts +0 -2
- package/dist/types/plugins/analyze/getServerRoutes.d.ts +1 -0
- package/dist/types/plugins/backend-federation/codegen.d.ts +83 -0
- package/dist/types/plugins/backend-federation/config.d.ts +103 -0
- package/dist/types/plugins/backend-federation/emit.d.ts +13 -0
- package/dist/types/plugins/backendFederationBuild.d.ts +2 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/artifacts.d.ts +15 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/constants.d.ts +24 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/delivery-unit.d.ts +23 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/i18n-worker.d.ts +22 -0
- package/dist/types/plugins/deploy/platforms/{cloudflare.d.ts → cloudflare/index.d.ts} +1 -1
- package/dist/types/plugins/deploy/platforms/cloudflare/security-policies.d.ts +51 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/types.d.ts +5 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/utils.d.ts +6 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/worker-manifest.d.ts +122 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/wrangler-config.d.ts +46 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-contract.d.ts +14 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-plan.d.ts +34 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/identity.d.ts +4 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +18 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/issues.d.ts +14 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/manifest.d.ts +2 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.d.ts +14 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +20 -0
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.d.mts +1 -0
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.d.mts +1 -0
- package/dist/types/plugins/deploy/utils/npmAliases.d.ts +14 -0
- package/dist/types/plugins/ultramodernReleaseEnvelope.d.ts +3 -0
- package/dist/types/presetUltramodern.d.ts +10 -0
- package/dist/types/run/index.d.ts +1 -1
- package/dist/types/types/config/cloudflareDeploy.d.ts +41 -0
- package/dist/types/types/config/deploy.d.ts +15 -2
- package/dist/types/ultramodern-release-envelope/canonical.d.ts +5 -0
- package/dist/types/ultramodern-release-envelope/framework-output.d.ts +31 -0
- package/dist/types/ultramodern-release-envelope/index.d.ts +6 -0
- package/dist/types/ultramodern-release-envelope/types.d.ts +62 -0
- package/dist/types/ultramodern-release-identity.d.ts +16 -0
- package/lib/types.d.ts +2 -3
- package/package.json +38 -23
- package/rslib.config.mts +11 -12
- package/dist/cjs/commands/runtime.js +0 -196
- package/dist/cjs/plugins/deploy/platforms/cloudflare.js +0 -540
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
- package/dist/cjs/ultramodern/designSystem.js +0 -123
- package/dist/esm/baseline.mjs +0 -4
- package/dist/esm/commands/runtime.mjs +0 -146
- package/dist/esm/plugins/deploy/platforms/cloudflare.mjs +0 -492
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
- package/dist/esm/ultramodern/designSystem.mjs +0 -73
- package/dist/esm-node/baseline.mjs +0 -5
- package/dist/esm-node/commands/runtime.mjs +0 -147
- package/dist/esm-node/plugins/deploy/platforms/cloudflare.mjs +0 -493
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
- package/dist/esm-node/ultramodern/designSystem.mjs +0 -74
- package/dist/types/baseline.d.ts +0 -16
- package/dist/types/commands/runtime.d.ts +0 -12
- package/dist/types/ultramodern/designSystem.d.ts +0 -54
- /package/dist/types/plugins/deploy/platforms/templates/{cloudflare-entry.d.mts → cloudflare-entry.006-fetch-handler.d.mts} +0 -0
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import promises from "node:fs/promises";
|
|
4
|
+
import node_path from "node:path";
|
|
5
|
+
import { canonicalSerializeMicroVerticalReleaseEnvelope, digestMicroVerticalReleaseEnvelopePayload, releaseEnvelopePayload } from "./canonical.mjs";
|
|
6
|
+
import { MICROVERTICAL_RELEASE_ENVELOPE_KIND, MICROVERTICAL_RELEASE_ENVELOPE_SCHEMA_VERSION, MICROVERTICAL_RELEASE_TARGETS } from "./types.mjs";
|
|
7
|
+
const SHA256_PATTERN = /^[a-f0-9]{64}$/u;
|
|
8
|
+
const SOURCE_REVISION_PATTERN = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;
|
|
9
|
+
const TARGETS = new Set(MICROVERTICAL_RELEASE_TARGETS);
|
|
10
|
+
const isRecord = (value)=>'object' == typeof value && null !== value && !Array.isArray(value);
|
|
11
|
+
const assertRecord = (value, location)=>{
|
|
12
|
+
if (!isRecord(value)) throw new Error(`${location} must be an object.`);
|
|
13
|
+
return value;
|
|
14
|
+
};
|
|
15
|
+
const assertExactKeys = (value, expected, location)=>{
|
|
16
|
+
const expectedKeys = new Set(expected);
|
|
17
|
+
for (const key of Object.keys(value))if (!expectedKeys.has(key)) throw new Error(`${location} contains unknown field "${key}".`);
|
|
18
|
+
for (const key of expected)if (!(key in value)) throw new Error(`${location}.${key} is required.`);
|
|
19
|
+
};
|
|
20
|
+
const assertNonEmptyString = (value, location)=>{
|
|
21
|
+
if ('string' != typeof value || 0 === value.trim().length) throw new Error(`${location} must be a non-empty string.`);
|
|
22
|
+
if (value !== value.trim()) throw new Error(`${location} must not contain surrounding whitespace.`);
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
25
|
+
const assertTarget = (value, location = 'target')=>{
|
|
26
|
+
const target = assertNonEmptyString(value, location);
|
|
27
|
+
if (!TARGETS.has(target)) throw new Error(`${location} must be one of: ${MICROVERTICAL_RELEASE_TARGETS.join(', ')}.`);
|
|
28
|
+
return target;
|
|
29
|
+
};
|
|
30
|
+
const assertReleaseIdentity = (value, location = 'identity')=>{
|
|
31
|
+
const identity = assertRecord(value, location);
|
|
32
|
+
assertExactKeys(identity, [
|
|
33
|
+
'unitId',
|
|
34
|
+
'buildMarker',
|
|
35
|
+
'sourceRevision',
|
|
36
|
+
'releaseVersion'
|
|
37
|
+
], location);
|
|
38
|
+
const sourceRevision = assertNonEmptyString(identity.sourceRevision, `${location}.sourceRevision`);
|
|
39
|
+
if (!SOURCE_REVISION_PATTERN.test(sourceRevision)) throw new Error(`${location}.sourceRevision must be an exact lowercase 40- or 64-character Git object ID; "${sourceRevision}" is not promotable.`);
|
|
40
|
+
return {
|
|
41
|
+
unitId: assertNonEmptyString(identity.unitId, `${location}.unitId`),
|
|
42
|
+
buildMarker: assertNonEmptyString(identity.buildMarker, `${location}.buildMarker`),
|
|
43
|
+
sourceRevision,
|
|
44
|
+
releaseVersion: assertNonEmptyString(identity.releaseVersion, `${location}.releaseVersion`)
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const assertNormalizedLogicalPath = (value, location)=>{
|
|
48
|
+
const logicalPath = assertNonEmptyString(value, location);
|
|
49
|
+
if (logicalPath.includes('\\') || node_path.posix.isAbsolute(logicalPath) || node_path.posix.normalize(logicalPath) !== logicalPath || '.' === logicalPath || logicalPath.split('/').some((segment)=>'..' === segment || '.' === segment)) throw new Error(`${location} must be a normalized relative POSIX path.`);
|
|
50
|
+
return logicalPath;
|
|
51
|
+
};
|
|
52
|
+
const isPathInside = (root, candidate)=>{
|
|
53
|
+
const relative = node_path.relative(root, candidate);
|
|
54
|
+
return '' === relative || !relative.startsWith(`..${node_path.sep}`) && '..' !== relative && !node_path.isAbsolute(relative);
|
|
55
|
+
};
|
|
56
|
+
const assertArtifactInput = (value, location)=>{
|
|
57
|
+
const artifact = assertRecord(value, location);
|
|
58
|
+
assertExactKeys(artifact, [
|
|
59
|
+
'logicalPath',
|
|
60
|
+
'runtime'
|
|
61
|
+
], location);
|
|
62
|
+
return {
|
|
63
|
+
logicalPath: assertNormalizedLogicalPath(artifact.logicalPath, `${location}.logicalPath`),
|
|
64
|
+
runtime: assertNonEmptyString(artifact.runtime, `${location}.runtime`)
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const readFinalArtifact = async (artifactRoot, input, resolvedLogicalPath = input.logicalPath)=>{
|
|
68
|
+
const artifactInput = {
|
|
69
|
+
logicalPath: input.logicalPath,
|
|
70
|
+
runtime: input.runtime
|
|
71
|
+
};
|
|
72
|
+
const logicalPath = assertNormalizedLogicalPath(resolvedLogicalPath, `staged path for ${input.logicalPath}`);
|
|
73
|
+
const resolvedRoot = node_path.resolve(artifactRoot);
|
|
74
|
+
const logicalSegments = logicalPath.split('/');
|
|
75
|
+
const lexicalPath = node_path.resolve(resolvedRoot, ...logicalSegments);
|
|
76
|
+
if (!isPathInside(resolvedRoot, lexicalPath)) throw new Error(`Artifact logicalPath "${logicalPath}" resolves outside artifactRoot.`);
|
|
77
|
+
const realRoot = await promises.realpath(resolvedRoot);
|
|
78
|
+
for(let index = 0; index < logicalSegments.length - 1; index++){
|
|
79
|
+
const linkLogicalPath = logicalSegments.slice(0, index + 1).join('/');
|
|
80
|
+
const candidate = node_path.join(resolvedRoot, ...logicalSegments.slice(0, index + 1));
|
|
81
|
+
let candidateStat;
|
|
82
|
+
try {
|
|
83
|
+
candidateStat = await promises.lstat(candidate);
|
|
84
|
+
} catch {
|
|
85
|
+
throw new Error(`Artifact "${logicalPath}" does not exist.`);
|
|
86
|
+
}
|
|
87
|
+
if (candidateStat.isSymbolicLink()) throw new Error(`Artifact "${logicalPath}" traverses symbolic-link ancestor "${linkLogicalPath}"; bind the symbolic link itself.`);
|
|
88
|
+
}
|
|
89
|
+
let lexicalStat;
|
|
90
|
+
try {
|
|
91
|
+
lexicalStat = await promises.lstat(lexicalPath);
|
|
92
|
+
} catch {
|
|
93
|
+
throw new Error(`Artifact "${logicalPath}" does not exist.`);
|
|
94
|
+
}
|
|
95
|
+
if (lexicalStat.isSymbolicLink()) {
|
|
96
|
+
let realTarget;
|
|
97
|
+
try {
|
|
98
|
+
realTarget = await promises.realpath(lexicalPath);
|
|
99
|
+
} catch {
|
|
100
|
+
throw new Error(`Artifact symbolic link "${logicalPath}" cannot be resolved.`);
|
|
101
|
+
}
|
|
102
|
+
if (!isPathInside(realRoot, realTarget)) throw new Error(`Artifact logicalPath "${logicalPath}" resolves outside artifactRoot.`);
|
|
103
|
+
const targetStat = await promises.stat(realTarget);
|
|
104
|
+
const targetKind = targetStat.isFile() ? 'file' : targetStat.isDirectory() ? 'directory' : void 0;
|
|
105
|
+
if (!targetKind) throw new Error(`Artifact symbolic link "${logicalPath}" must resolve to a file or directory.`);
|
|
106
|
+
const targetLogicalPath = node_path.relative(realRoot, realTarget).split(node_path.sep).join('/');
|
|
107
|
+
if ('release' === targetLogicalPath || targetLogicalPath.startsWith('release/')) throw new Error(`Artifact symbolic link "${logicalPath}" targets private release metadata.`);
|
|
108
|
+
if ('directory' === targetKind && isPathInside(realTarget, await promises.realpath(node_path.dirname(lexicalPath)))) throw new Error(`Artifact symbolic link "${logicalPath}" targets an ancestor directory.`);
|
|
109
|
+
return {
|
|
110
|
+
...artifactInput,
|
|
111
|
+
kind: 'symbolic-link',
|
|
112
|
+
linkTarget: await promises.readlink(lexicalPath),
|
|
113
|
+
targetKind,
|
|
114
|
+
targetLogicalPath
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (!lexicalStat.isFile()) throw new Error(`Artifact "${logicalPath}" must be a file or symlink.`);
|
|
118
|
+
const realPath = await promises.realpath(lexicalPath);
|
|
119
|
+
if (!isPathInside(realRoot, realPath)) throw new Error(`Artifact logicalPath "${logicalPath}" resolves outside artifactRoot.`);
|
|
120
|
+
const bytes = await promises.readFile(realPath);
|
|
121
|
+
return {
|
|
122
|
+
...artifactInput,
|
|
123
|
+
kind: 'file',
|
|
124
|
+
byteLength: bytes.byteLength,
|
|
125
|
+
sha256: createHash('sha256').update(bytes).digest('hex')
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const assertReleaseArtifact = (value, location)=>{
|
|
129
|
+
const artifact = assertRecord(value, location);
|
|
130
|
+
const kind = assertNonEmptyString(artifact.kind, `${location}.kind`);
|
|
131
|
+
const input = {
|
|
132
|
+
logicalPath: artifact.logicalPath,
|
|
133
|
+
runtime: artifact.runtime
|
|
134
|
+
};
|
|
135
|
+
if ('file' === kind) {
|
|
136
|
+
assertExactKeys(artifact, [
|
|
137
|
+
'kind',
|
|
138
|
+
'logicalPath',
|
|
139
|
+
'runtime',
|
|
140
|
+
'byteLength',
|
|
141
|
+
'sha256'
|
|
142
|
+
], location);
|
|
143
|
+
const byteLength = artifact.byteLength;
|
|
144
|
+
if ('number' != typeof byteLength || !Number.isSafeInteger(byteLength) || byteLength < 0) throw new Error(`${location}.byteLength must be a non-negative integer.`);
|
|
145
|
+
const sha256 = assertNonEmptyString(artifact.sha256, `${location}.sha256`);
|
|
146
|
+
if (!SHA256_PATTERN.test(sha256)) throw new Error(`${location}.sha256 must be a lowercase SHA-256 digest.`);
|
|
147
|
+
return {
|
|
148
|
+
...assertArtifactInput(input, location),
|
|
149
|
+
kind,
|
|
150
|
+
byteLength,
|
|
151
|
+
sha256
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if ('symbolic-link' === kind) {
|
|
155
|
+
assertExactKeys(artifact, [
|
|
156
|
+
'kind',
|
|
157
|
+
'logicalPath',
|
|
158
|
+
'runtime',
|
|
159
|
+
'linkTarget',
|
|
160
|
+
'targetKind',
|
|
161
|
+
'targetLogicalPath'
|
|
162
|
+
], location);
|
|
163
|
+
const targetKind = assertNonEmptyString(artifact.targetKind, `${location}.targetKind`);
|
|
164
|
+
if ('directory' !== targetKind && 'file' !== targetKind) throw new Error(`${location}.targetKind must be "directory" or "file".`);
|
|
165
|
+
return {
|
|
166
|
+
...assertArtifactInput(input, location),
|
|
167
|
+
kind,
|
|
168
|
+
linkTarget: assertNonEmptyString(artifact.linkTarget, `${location}.linkTarget`),
|
|
169
|
+
targetKind,
|
|
170
|
+
targetLogicalPath: assertNormalizedLogicalPath(artifact.targetLogicalPath, `${location}.targetLogicalPath`)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
throw new Error(`${location}.kind must be "file" or "symbolic-link".`);
|
|
174
|
+
};
|
|
175
|
+
const assertUniqueSortedArtifacts = (artifacts, location)=>{
|
|
176
|
+
const paths = artifacts.map((artifact)=>artifact.logicalPath);
|
|
177
|
+
const unique = new Set(paths);
|
|
178
|
+
if (unique.size !== paths.length) {
|
|
179
|
+
const duplicate = paths.find((logicalPath, index)=>paths.indexOf(logicalPath) !== index);
|
|
180
|
+
throw new Error(`Duplicate artifact logicalPath "${duplicate}".`);
|
|
181
|
+
}
|
|
182
|
+
const sorted = [
|
|
183
|
+
...paths
|
|
184
|
+
].sort((left, right)=>left.localeCompare(right));
|
|
185
|
+
if (paths.some((logicalPath, index)=>logicalPath !== sorted[index])) throw new Error(`${location} must be sorted by logicalPath.`);
|
|
186
|
+
};
|
|
187
|
+
const assertSurfacePaths = (value, location)=>{
|
|
188
|
+
if (!Array.isArray(value) || 0 === value.length) throw new Error(`${location} must contain at least one artifact path.`);
|
|
189
|
+
const paths = value.map((item, index)=>assertNormalizedLogicalPath(item, `${location}[${index}]`));
|
|
190
|
+
const sorted = [
|
|
191
|
+
...paths
|
|
192
|
+
].sort((left, right)=>left.localeCompare(right));
|
|
193
|
+
if (paths.some((logicalPath, index)=>logicalPath !== sorted[index])) throw new Error(`${location} must be sorted by logicalPath.`);
|
|
194
|
+
if (new Set(paths).size !== paths.length) throw new Error(`${location} must not contain duplicate artifact paths.`);
|
|
195
|
+
return paths;
|
|
196
|
+
};
|
|
197
|
+
const assertSurfaces = (value)=>{
|
|
198
|
+
const surfaces = assertRecord(value, 'surfaces');
|
|
199
|
+
assertExactKeys(surfaces, [
|
|
200
|
+
'uiClient',
|
|
201
|
+
'ssr',
|
|
202
|
+
'apiBackend',
|
|
203
|
+
'backendFederation'
|
|
204
|
+
], 'surfaces');
|
|
205
|
+
const backendFederation = assertRecord(surfaces.backendFederation, 'surfaces.backendFederation');
|
|
206
|
+
assertExactKeys(backendFederation, [
|
|
207
|
+
'manifest',
|
|
208
|
+
'container'
|
|
209
|
+
], 'surfaces.backendFederation');
|
|
210
|
+
return {
|
|
211
|
+
uiClient: assertSurfacePaths(surfaces.uiClient, 'surfaces.uiClient'),
|
|
212
|
+
ssr: assertSurfacePaths(surfaces.ssr, 'surfaces.ssr'),
|
|
213
|
+
apiBackend: assertSurfacePaths(surfaces.apiBackend, 'surfaces.apiBackend'),
|
|
214
|
+
backendFederation: {
|
|
215
|
+
manifest: assertNormalizedLogicalPath(backendFederation.manifest, 'surfaces.backendFederation.manifest'),
|
|
216
|
+
container: assertNormalizedLogicalPath(backendFederation.container, 'surfaces.backendFederation.container')
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
const assertSurfaceReferences = (artifacts, surfaces)=>{
|
|
221
|
+
const artifactPaths = new Set(artifacts.map((artifact)=>artifact.logicalPath));
|
|
222
|
+
for (const [surface, paths] of Object.entries({
|
|
223
|
+
uiClient: surfaces.uiClient,
|
|
224
|
+
ssr: surfaces.ssr,
|
|
225
|
+
apiBackend: surfaces.apiBackend,
|
|
226
|
+
'backendFederation.manifest': [
|
|
227
|
+
surfaces.backendFederation.manifest
|
|
228
|
+
],
|
|
229
|
+
'backendFederation.container': [
|
|
230
|
+
surfaces.backendFederation.container
|
|
231
|
+
]
|
|
232
|
+
}))for (const logicalPath of paths)if (!artifactPaths.has(logicalPath)) throw new Error(`surfaces.${surface} references unbound artifact "${logicalPath}".`);
|
|
233
|
+
};
|
|
234
|
+
const assertTargetSurfaceContract = (target, artifacts, surfaces)=>{
|
|
235
|
+
const byPath = new Map(artifacts.map((artifact)=>[
|
|
236
|
+
artifact.logicalPath,
|
|
237
|
+
artifact
|
|
238
|
+
]));
|
|
239
|
+
const assertRuntime = (paths, expected, surface)=>{
|
|
240
|
+
for (const logicalPath of paths){
|
|
241
|
+
const artifact = byPath.get(logicalPath);
|
|
242
|
+
if (artifact?.runtime !== expected) throw new Error(`${target} ${surface} artifact "${logicalPath}" must use runtime "${expected}"; received "${String(artifact?.runtime)}".`);
|
|
243
|
+
if ('kind' in artifact && 'file' !== artifact.kind) throw new Error(`${target} ${surface} artifact "${logicalPath}" must be a file.`);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
assertRuntime(surfaces.uiClient, 'browser', 'UI/client');
|
|
247
|
+
assertRuntime(surfaces.ssr, 'node' === target ? 'nodejs' : 'workerd', 'SSR');
|
|
248
|
+
assertRuntime(surfaces.apiBackend, 'node' === target ? 'nodejs' : 'workerd-effect', 'API/backend');
|
|
249
|
+
assertRuntime([
|
|
250
|
+
surfaces.backendFederation.manifest
|
|
251
|
+
], 'module-federation-manifest', 'backend federation manifest');
|
|
252
|
+
assertRuntime([
|
|
253
|
+
surfaces.backendFederation.container
|
|
254
|
+
], 'node' === target ? 'nodejs' : 'commonjs-module', 'backend federation container');
|
|
255
|
+
};
|
|
256
|
+
const deepFreeze = (value)=>{
|
|
257
|
+
if (null !== value && 'object' == typeof value && !Object.isFrozen(value)) {
|
|
258
|
+
Object.freeze(value);
|
|
259
|
+
for (const child of Object.values(value))deepFreeze(child);
|
|
260
|
+
}
|
|
261
|
+
return value;
|
|
262
|
+
};
|
|
263
|
+
const assertEnvelope = (value)=>{
|
|
264
|
+
const envelope = assertRecord(value, 'envelope');
|
|
265
|
+
assertExactKeys(envelope, [
|
|
266
|
+
'schemaVersion',
|
|
267
|
+
'kind',
|
|
268
|
+
'target',
|
|
269
|
+
'identity',
|
|
270
|
+
'artifacts',
|
|
271
|
+
'surfaces',
|
|
272
|
+
'envelopeDigest'
|
|
273
|
+
], 'envelope');
|
|
274
|
+
if (envelope.schemaVersion !== MICROVERTICAL_RELEASE_ENVELOPE_SCHEMA_VERSION) throw new Error(`envelope.schemaVersion must be ${MICROVERTICAL_RELEASE_ENVELOPE_SCHEMA_VERSION}.`);
|
|
275
|
+
if (envelope.kind !== MICROVERTICAL_RELEASE_ENVELOPE_KIND) throw new Error(`envelope.kind must be "${MICROVERTICAL_RELEASE_ENVELOPE_KIND}".`);
|
|
276
|
+
if (!Array.isArray(envelope.artifacts) || 0 === envelope.artifacts.length) throw new Error('envelope.artifacts must contain at least one artifact.');
|
|
277
|
+
const artifacts = envelope.artifacts.map((artifact, index)=>assertReleaseArtifact(artifact, `envelope.artifacts[${index}]`));
|
|
278
|
+
assertUniqueSortedArtifacts(artifacts, 'envelope.artifacts');
|
|
279
|
+
const target = assertTarget(envelope.target, 'envelope.target');
|
|
280
|
+
const surfaces = assertSurfaces(envelope.surfaces);
|
|
281
|
+
assertSurfaceReferences(artifacts, surfaces);
|
|
282
|
+
assertTargetSurfaceContract(target, artifacts, surfaces);
|
|
283
|
+
const parsed = {
|
|
284
|
+
schemaVersion: MICROVERTICAL_RELEASE_ENVELOPE_SCHEMA_VERSION,
|
|
285
|
+
kind: MICROVERTICAL_RELEASE_ENVELOPE_KIND,
|
|
286
|
+
target,
|
|
287
|
+
identity: assertReleaseIdentity(envelope.identity, 'envelope.identity'),
|
|
288
|
+
artifacts,
|
|
289
|
+
surfaces,
|
|
290
|
+
envelopeDigest: assertNonEmptyString(envelope.envelopeDigest, 'envelope.envelopeDigest')
|
|
291
|
+
};
|
|
292
|
+
if (!SHA256_PATTERN.test(parsed.envelopeDigest)) throw new Error('envelope.envelopeDigest must be a lowercase SHA-256 digest.');
|
|
293
|
+
const expectedDigest = digestMicroVerticalReleaseEnvelopePayload(releaseEnvelopePayload(parsed));
|
|
294
|
+
if (parsed.envelopeDigest !== expectedDigest) throw new Error('envelope.envelopeDigest does not match canonical payload.');
|
|
295
|
+
return parsed;
|
|
296
|
+
};
|
|
297
|
+
const createMicroVerticalReleaseEnvelope = async (input)=>{
|
|
298
|
+
const artifactRoot = await promises.realpath(node_path.resolve(input.artifactRoot));
|
|
299
|
+
const target = assertTarget(input.target);
|
|
300
|
+
const identity = assertReleaseIdentity(input.identity);
|
|
301
|
+
if (!Array.isArray(input.artifacts) || 0 === input.artifacts.length) throw new Error('artifacts must contain at least one artifact.');
|
|
302
|
+
const inputs = input.artifacts.map((artifact, index)=>assertArtifactInput(artifact, `artifacts[${index}]`));
|
|
303
|
+
const sortedInputs = [
|
|
304
|
+
...inputs
|
|
305
|
+
].sort((left, right)=>left.logicalPath.localeCompare(right.logicalPath));
|
|
306
|
+
assertUniqueSortedArtifacts(sortedInputs, 'artifacts');
|
|
307
|
+
const surfaces = assertSurfaces(input.surfaces);
|
|
308
|
+
assertSurfaceReferences(sortedInputs, surfaces);
|
|
309
|
+
assertTargetSurfaceContract(target, sortedInputs, surfaces);
|
|
310
|
+
const artifacts = await Promise.all(sortedInputs.map((artifact)=>readFinalArtifact(artifactRoot, artifact)));
|
|
311
|
+
assertTargetSurfaceContract(target, artifacts, surfaces);
|
|
312
|
+
const payload = {
|
|
313
|
+
schemaVersion: MICROVERTICAL_RELEASE_ENVELOPE_SCHEMA_VERSION,
|
|
314
|
+
kind: MICROVERTICAL_RELEASE_ENVELOPE_KIND,
|
|
315
|
+
target,
|
|
316
|
+
identity,
|
|
317
|
+
artifacts,
|
|
318
|
+
surfaces
|
|
319
|
+
};
|
|
320
|
+
return deepFreeze({
|
|
321
|
+
...payload,
|
|
322
|
+
envelopeDigest: digestMicroVerticalReleaseEnvelopePayload(payload)
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
const verifyMicroVerticalReleaseEnvelope = async (value, options)=>{
|
|
326
|
+
const envelope = assertEnvelope(value);
|
|
327
|
+
if (void 0 !== options.expectedTarget && envelope.target !== options.expectedTarget) throw new Error(`envelope.target must be "${options.expectedTarget}" for this staging target; received "${envelope.target}".`);
|
|
328
|
+
const artifactRoot = await promises.realpath(node_path.resolve(options.artifactRoot));
|
|
329
|
+
for (const artifact of envelope.artifacts){
|
|
330
|
+
const finalArtifact = await readFinalArtifact(artifactRoot, artifact, options.logicalPathForArtifact?.(artifact) ?? artifact.logicalPath);
|
|
331
|
+
const matches = finalArtifact.kind === artifact.kind && ('file' === artifact.kind && 'file' === finalArtifact.kind ? finalArtifact.byteLength === artifact.byteLength && finalArtifact.sha256 === artifact.sha256 : 'symbolic-link' === artifact.kind && 'symbolic-link' === finalArtifact.kind && finalArtifact.linkTarget === artifact.linkTarget && finalArtifact.targetKind === artifact.targetKind && finalArtifact.targetLogicalPath === artifact.targetLogicalPath);
|
|
332
|
+
if (!matches) throw new Error('file' === artifact.kind && 'file' === finalArtifact.kind ? `Artifact "${artifact.logicalPath}" digest does not match final artifact bytes.` : `Artifact "${artifact.logicalPath}" does not match its final filesystem binding.`);
|
|
333
|
+
}
|
|
334
|
+
return deepFreeze(envelope);
|
|
335
|
+
};
|
|
336
|
+
export { MICROVERTICAL_RELEASE_ENVELOPE_KIND, MICROVERTICAL_RELEASE_ENVELOPE_SCHEMA_VERSION, MICROVERTICAL_RELEASE_TARGETS, canonicalSerializeMicroVerticalReleaseEnvelope, createMicroVerticalReleaseEnvelope, verifyMicroVerticalReleaseEnvelope };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
const MICROVERTICAL_RELEASE_ENVELOPE_SCHEMA_VERSION = 3;
|
|
3
|
+
const MICROVERTICAL_RELEASE_ENVELOPE_KIND = 'ultramodern-target-microvertical-release-envelope';
|
|
4
|
+
const MICROVERTICAL_RELEASE_TARGETS = [
|
|
5
|
+
'node',
|
|
6
|
+
'cloudflare'
|
|
7
|
+
];
|
|
8
|
+
export { MICROVERTICAL_RELEASE_ENVELOPE_KIND, MICROVERTICAL_RELEASE_ENVELOPE_SCHEMA_VERSION, MICROVERTICAL_RELEASE_TARGETS };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
const BUILD_MARKER_NAMESPACE = 'ultramodern-delivery-unit-release-build-marker:v1';
|
|
5
|
+
const PROMOTABLE_SOURCE_REVISION_PATTERN = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;
|
|
6
|
+
const gitOutput = (workspaceRoot, args)=>{
|
|
7
|
+
try {
|
|
8
|
+
return execFileSync('git', [
|
|
9
|
+
'-C',
|
|
10
|
+
workspaceRoot,
|
|
11
|
+
...args
|
|
12
|
+
], {
|
|
13
|
+
encoding: 'utf8',
|
|
14
|
+
stdio: [
|
|
15
|
+
'ignore',
|
|
16
|
+
'pipe',
|
|
17
|
+
'ignore'
|
|
18
|
+
]
|
|
19
|
+
}).trim();
|
|
20
|
+
} catch {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const createUltramodernReleaseBuildMarker = ({ generationBuildMarker, sourceRevision, unitId })=>createHash('sha256').update(`${BUILD_MARKER_NAMESPACE}:${unitId}:${generationBuildMarker}:${sourceRevision}`).digest('hex').slice(0, 16);
|
|
25
|
+
const resolveUltramodernSourceRevision = (workspaceRoot = process.cwd(), configuredSourceRevision)=>{
|
|
26
|
+
const configuredArgumentValue = configuredSourceRevision?.trim();
|
|
27
|
+
const configuredEnvironmentValue = process.env.ULTRAMODERN_SOURCE_REVISION?.trim();
|
|
28
|
+
const configuredArgument = configuredArgumentValue && 'workspace' !== configuredArgumentValue ? configuredArgumentValue : void 0;
|
|
29
|
+
const configuredEnvironment = configuredEnvironmentValue && 'workspace' !== configuredEnvironmentValue ? configuredEnvironmentValue : void 0;
|
|
30
|
+
if (configuredArgument && configuredEnvironment && configuredArgument !== configuredEnvironment) throw new Error(`Configured source revision ${configuredArgument} does not match environment source revision ${configuredEnvironment}.`);
|
|
31
|
+
const configured = configuredArgument ?? configuredEnvironment;
|
|
32
|
+
const gitRoot = gitOutput(workspaceRoot, [
|
|
33
|
+
'rev-parse',
|
|
34
|
+
'--show-toplevel'
|
|
35
|
+
]);
|
|
36
|
+
if (!gitRoot) {
|
|
37
|
+
if (!configured) return 'workspace';
|
|
38
|
+
if (!PROMOTABLE_SOURCE_REVISION_PATTERN.test(configured)) throw new Error(`Configured source revision ${configured} must be an exact lowercase 40- or 64-character Git object ID.`);
|
|
39
|
+
return configured;
|
|
40
|
+
}
|
|
41
|
+
const revision = gitOutput(gitRoot, [
|
|
42
|
+
'rev-parse',
|
|
43
|
+
'HEAD'
|
|
44
|
+
]);
|
|
45
|
+
const status = gitOutput(gitRoot, [
|
|
46
|
+
'status',
|
|
47
|
+
'--porcelain=v1',
|
|
48
|
+
'--untracked-files=all'
|
|
49
|
+
]);
|
|
50
|
+
if (!revision || void 0 === status || status.length > 0) return 'workspace';
|
|
51
|
+
if (!PROMOTABLE_SOURCE_REVISION_PATTERN.test(revision)) return 'workspace';
|
|
52
|
+
if (configured && configured !== revision) throw new Error(`Configured source revision ${configured} does not match clean Git HEAD ${revision}.`);
|
|
53
|
+
return revision;
|
|
54
|
+
};
|
|
55
|
+
const resolveUltramodernReleaseIdentity = ({ generationBuildMarker, sourceRevision: configuredSourceRevision, unitId, workspaceRoot })=>{
|
|
56
|
+
const explicitSourceRevision = configuredSourceRevision?.trim();
|
|
57
|
+
const sourceRevision = resolveUltramodernSourceRevision(workspaceRoot, explicitSourceRevision);
|
|
58
|
+
return {
|
|
59
|
+
buildMarker: 'workspace' === sourceRevision ? generationBuildMarker : createUltramodernReleaseBuildMarker({
|
|
60
|
+
generationBuildMarker,
|
|
61
|
+
sourceRevision,
|
|
62
|
+
unitId
|
|
63
|
+
}),
|
|
64
|
+
sourceRevision
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export { createUltramodernReleaseBuildMarker, resolveUltramodernReleaseIdentity, resolveUltramodernSourceRevision };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Rspack, RspackChain } from '@rsbuild/core';
|
|
2
2
|
import type { AppNormalizedConfig } from '../../types';
|
|
3
3
|
import type { AppToolsContext } from '../../types/plugin';
|
|
4
|
+
declare const info: (file: {
|
|
5
|
+
sourceFilename: string;
|
|
6
|
+
}) => {
|
|
7
|
+
minimized: boolean;
|
|
8
|
+
};
|
|
4
9
|
export declare function createPublicPattern(appContext: AppToolsContext, config: AppNormalizedConfig, chain: RspackChain): {
|
|
5
|
-
info:
|
|
6
|
-
sourceFilename: string;
|
|
7
|
-
}) => {
|
|
8
|
-
minimized: boolean;
|
|
9
|
-
};
|
|
10
|
+
info: typeof info;
|
|
10
11
|
from: string;
|
|
11
12
|
to: string;
|
|
12
13
|
context: string;
|
|
@@ -14,3 +15,4 @@ export declare function createPublicPattern(appContext: AppToolsContext, config:
|
|
|
14
15
|
transform: (content: Buffer, absoluteFrom: string) => string | Buffer<ArrayBufferLike>;
|
|
15
16
|
};
|
|
16
17
|
export declare function createUploadPattern(appContext: AppToolsContext, config: AppNormalizedConfig): Rspack.CopyRspackPluginOptions['patterns']['0'];
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Rspack } from '@rsbuild/core';
|
|
2
|
+
export declare const normalizeCssExtractRuntimeStylesheetLookup: (source: string) => string;
|
|
3
|
+
export declare class CssExtractRuntimePlugin {
|
|
4
|
+
readonly name = "ModernjsCssExtractRuntimePlugin";
|
|
5
|
+
apply(compiler: Rspack.Compiler): void;
|
|
6
|
+
}
|
|
@@ -6,7 +6,7 @@ type ModuleLike = {
|
|
|
6
6
|
type LazyCompilationTestFn = (m: ModuleLike) => boolean;
|
|
7
7
|
/** Matches Rspack's `LazyCompilationOptions['test']`. */
|
|
8
8
|
type LazyCompilationTest = RegExp | LazyCompilationTestFn | undefined;
|
|
9
|
-
|
|
9
|
+
type EagerRouteComponentInfo = {
|
|
10
10
|
files: Set<string>;
|
|
11
11
|
/** Specifiers that could not be resolved, keyed by entry name. */
|
|
12
12
|
unresolvedByEntry: Map<string, string[]>;
|
|
@@ -26,8 +26,7 @@ export declare function aggregateEagerRouteComponentFiles(byEntry: EagerRouteCom
|
|
|
26
26
|
* (defaulting to lazy when the user did not provide one).
|
|
27
27
|
*/
|
|
28
28
|
export declare function buildRouteEagerLazyCompilationTest(eagerRouteFiles: Set<string>, userTest?: LazyCompilationTest): LazyCompilationTestFn;
|
|
29
|
-
|
|
30
|
-
export type SSRLazyPlan = {
|
|
29
|
+
type SSRLazyPlan = {
|
|
31
30
|
apply: false;
|
|
32
31
|
unresolvedByEntry?: Map<string, string[]>;
|
|
33
32
|
} | {
|
|
@@ -42,4 +41,3 @@ export type SSRLazyPlan = {
|
|
|
42
41
|
* existing `dev.lazyCompilation` value (lazy must be enabled for this to apply).
|
|
43
42
|
*/
|
|
44
43
|
export declare function planRouteEagerLazyCompilation(current: unknown, info: EagerRouteComponentInfo): SSRLazyPlan;
|
|
45
|
-
export declare const planSSRLazyCompilation: typeof planRouteEagerLazyCompilation;
|
|
@@ -7,4 +7,3 @@ export declare const serverCommand: (program: Command, api: CLIPluginAPI<AppTool
|
|
|
7
7
|
export declare const deployCommand: (program: Command, api: CLIPluginAPI<AppTools>) => void;
|
|
8
8
|
export declare const inspectCommand: (program: Command, api: CLIPluginAPI<AppTools>) => void;
|
|
9
9
|
export declare const infoCommand: (program: Command, api: CLIPluginAPI<AppTools>) => void;
|
|
10
|
-
export { runtimeCommand } from './runtime';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { URL } from 'node:url';
|
|
2
|
+
import type { Rspack } from '@rsbuild/core';
|
|
3
|
+
/**
|
|
4
|
+
* Reads an environment variable while keeping generated build configs free of
|
|
5
|
+
* direct process access.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getBuildConfigEnvironment(name: string): string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Runs a Rspack config setup under a leased environment value. The lease is
|
|
10
|
+
* restored when that compiler reaches any supported terminal hook.
|
|
11
|
+
*/
|
|
12
|
+
export declare function withBuildConfigEnvironment<Config extends {
|
|
13
|
+
plugins?: Rspack.Plugin[];
|
|
14
|
+
}, SetupArguments extends unknown[]>(name: string, value: string, setup: (config: Config, ...args: SetupArguments) => Config | void | Promise<Config | void>): (config: Config, ...args: SetupArguments) => Promise<Config>;
|
|
15
|
+
export type ResolveEffectTsgoCompilerOptions = {
|
|
16
|
+
/** Module URL or absolute filename used to resolve the consumer's compiler. */
|
|
17
|
+
from: string | URL;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Resolves the Effect TS-Go executable used by Module Federation DTS builds.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveEffectTsgoCompiler(options: ResolveEffectTsgoCompilerOptions): string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { AppTools, CliPlugin } from './types';
|
|
2
2
|
import { initAppContext } from './utils/initAppContext';
|
|
3
|
-
export * from './baseline';
|
|
4
3
|
export * from './defineConfig';
|
|
5
4
|
export * from './presetUltramodern';
|
|
6
|
-
export * from './ultramodern/designSystem';
|
|
7
5
|
export declare const appTools: () => CliPlugin<AppTools>;
|
|
8
6
|
export { dev } from './commands/dev';
|
|
9
7
|
export { serve } from './commands/serve';
|
|
@@ -6,3 +6,4 @@ export declare const getServerRoutes: (entrypoints: Entrypoint[], { appContext,
|
|
|
6
6
|
config: AppNormalizedConfig;
|
|
7
7
|
}) => ServerRoute[];
|
|
8
8
|
export declare const getProdServerRoutes: (distDirectory: string) => any;
|
|
9
|
+
export declare const getProdEntrypoints: (distDirectory: string, routes: ServerRoute[], mainEntryName?: any) => Entrypoint[];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type BackendFederationApp } from './config';
|
|
2
|
+
export declare const createBackendRemoteEntrySource: (workspaceRoot: string, app: BackendFederationApp, effectApiPath: string, entryPath: string) => Promise<string>;
|
|
3
|
+
export declare const createBackendManifest: (workspaceRoot: string, distDirectory: string, app: BackendFederationApp) => {
|
|
4
|
+
schemaVersion: number;
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
version: string | undefined;
|
|
8
|
+
buildVersion: string | undefined;
|
|
9
|
+
metaData: {
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
buildInfo: {
|
|
13
|
+
buildVersion: string | undefined;
|
|
14
|
+
buildName: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
remoteEntry: {
|
|
17
|
+
name: string;
|
|
18
|
+
path: string;
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
globalName: string;
|
|
22
|
+
publicPath: string;
|
|
23
|
+
ssrRemoteEntry: {
|
|
24
|
+
name: string;
|
|
25
|
+
path: string;
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
ssrPublicPath: string;
|
|
29
|
+
};
|
|
30
|
+
entry: {
|
|
31
|
+
file: string;
|
|
32
|
+
path: string;
|
|
33
|
+
type: string;
|
|
34
|
+
url: string;
|
|
35
|
+
};
|
|
36
|
+
exposes: {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
path: string;
|
|
40
|
+
assets: {
|
|
41
|
+
js: {
|
|
42
|
+
async: never[];
|
|
43
|
+
sync: string[];
|
|
44
|
+
};
|
|
45
|
+
css: {
|
|
46
|
+
async: never[];
|
|
47
|
+
sync: never[];
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
}[];
|
|
51
|
+
shared: never[];
|
|
52
|
+
backendFederation: {
|
|
53
|
+
role: string;
|
|
54
|
+
appId: string;
|
|
55
|
+
name: string;
|
|
56
|
+
runtimeFramework: string;
|
|
57
|
+
strictEffectApproach: boolean;
|
|
58
|
+
contractVersion: string;
|
|
59
|
+
nodeAdapterVersion: string;
|
|
60
|
+
remoteType: string;
|
|
61
|
+
expose: string;
|
|
62
|
+
manifestUrl: string;
|
|
63
|
+
containerEntry: string;
|
|
64
|
+
source: {
|
|
65
|
+
module: string;
|
|
66
|
+
};
|
|
67
|
+
readinessPath: string;
|
|
68
|
+
openapiPath: string;
|
|
69
|
+
deliveryUnit?: import("@modern-js/utils/universal").DeliveryUnitContractBlock | undefined;
|
|
70
|
+
versionBoundary: {
|
|
71
|
+
invariant: string;
|
|
72
|
+
packageName: string | undefined;
|
|
73
|
+
version: string | undefined;
|
|
74
|
+
buildVersion: string | undefined;
|
|
75
|
+
uiManifestUrl?: string | undefined;
|
|
76
|
+
deliveryUnit?: {
|
|
77
|
+
unitId: string;
|
|
78
|
+
buildMarker: string;
|
|
79
|
+
sourceRevision: string;
|
|
80
|
+
} | undefined;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|