@bleedingdev/modern-js-app-tools 3.8.3-ultramodern.1 → 3.8.3-ultramodern.3
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-bundle-docs.js +11 -0
- package/bin/modern.js +11 -0
- package/dist/cjs/builder/generator/getBuilderEnvironments.js +13 -241
- package/dist/cjs/builder/generator/index.js +0 -1
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +37 -9
- package/dist/cjs/builder/shared/builderPlugins/index.js +6 -13
- package/dist/cjs/builder/shared/bundlerPlugins/index.js +6 -13
- package/dist/cjs/builder/shared/lazyCompilation.js +9 -9
- package/dist/cjs/bundleDocs.js +1 -1
- package/dist/cjs/index.js +59 -60
- package/dist/cjs/plugins/analyze/getServerRoutes.js +1 -1
- package/dist/cjs/plugins/analyze/isDefaultExportFunction.js +1 -9
- package/dist/cjs/plugins/backend-federation/codegen.js +2 -1
- package/dist/cjs/plugins/backend-federation/config.js +2 -2
- package/dist/cjs/plugins/backend-federation/emit.js +6 -4
- package/dist/cjs/plugins/deploy/index.js +4 -4
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +23 -149
- package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.cjs +41 -62
- package/dist/cjs/plugins/deploy/platforms/templates/netlify-entry.mjs +41 -63
- package/dist/cjs/plugins/deploy/platforms/templates/node-entry.cjs +35 -52
- package/dist/cjs/plugins/deploy/platforms/templates/node-entry.mjs +35 -53
- package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.cjs +41 -61
- package/dist/cjs/plugins/deploy/platforms/templates/vercel-entry.mjs +40 -61
- package/dist/cjs/plugins/ultramodernReleaseEnvelope.js +3 -59
- package/dist/cjs/presetUltramodern.js +9 -4
- package/dist/cjs/run/index.js +9 -9
- package/dist/cjs/utils/register.js +6 -3
- package/dist/esm/builder/generator/getBuilderEnvironments.mjs +12 -231
- package/dist/esm/builder/generator/index.mjs +1 -2
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.mjs +34 -9
- package/dist/esm/builder/shared/builderPlugins/index.mjs +0 -1
- package/dist/esm/builder/shared/bundlerPlugins/index.mjs +0 -1
- package/dist/esm/builder/shared/lazyCompilation.mjs +4 -4
- package/dist/esm/bundleDocs.mjs +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/plugins/analyze/getServerRoutes.mjs +1 -1
- package/dist/esm/plugins/analyze/isDefaultExportFunction.mjs +1 -9
- package/dist/esm/plugins/backend-federation/codegen.mjs +2 -1
- package/dist/esm/plugins/backend-federation/config.mjs +1 -1
- package/dist/esm/plugins/backend-federation/emit.mjs +5 -3
- package/dist/esm/plugins/deploy/index.mjs +1 -1
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -133
- package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.cjs +41 -62
- package/dist/esm/plugins/deploy/platforms/templates/netlify-entry.mjs +41 -63
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.cjs +35 -52
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.mjs +35 -53
- package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.cjs +41 -61
- package/dist/esm/plugins/deploy/platforms/templates/vercel-entry.mjs +40 -61
- package/dist/esm/plugins/ultramodernReleaseEnvelope.mjs +3 -49
- package/dist/esm/presetUltramodern.mjs +2 -1
- package/dist/esm/run/index.mjs +9 -9
- package/dist/esm/utils/register.mjs +6 -3
- package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +12 -234
- package/dist/esm-node/builder/generator/index.mjs +1 -2
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.mjs +34 -9
- package/dist/esm-node/builder/shared/builderPlugins/index.mjs +0 -1
- package/dist/esm-node/builder/shared/bundlerPlugins/index.mjs +0 -1
- package/dist/esm-node/builder/shared/lazyCompilation.mjs +4 -4
- package/dist/esm-node/bundleDocs.mjs +1 -1
- package/dist/esm-node/index.mjs +3 -3
- package/dist/esm-node/plugins/analyze/getServerRoutes.mjs +1 -1
- package/dist/esm-node/plugins/analyze/isDefaultExportFunction.mjs +1 -9
- package/dist/esm-node/plugins/backend-federation/codegen.mjs +2 -1
- package/dist/esm-node/plugins/backend-federation/config.mjs +1 -1
- package/dist/esm-node/plugins/backend-federation/emit.mjs +5 -3
- package/dist/esm-node/plugins/deploy/index.mjs +1 -1
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +1 -133
- package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.cjs +41 -62
- package/dist/esm-node/plugins/deploy/platforms/templates/netlify-entry.mjs +41 -63
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.cjs +35 -52
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.mjs +35 -53
- package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.cjs +41 -61
- package/dist/esm-node/plugins/deploy/platforms/templates/vercel-entry.mjs +40 -61
- package/dist/esm-node/plugins/ultramodernReleaseEnvelope.mjs +3 -49
- package/dist/esm-node/presetUltramodern.mjs +2 -1
- package/dist/esm-node/run/index.mjs +9 -9
- package/dist/esm-node/utils/register.mjs +6 -3
- package/dist/types/builder/generator/getBuilderEnvironments.d.ts +0 -29
- package/dist/types/builder/shared/builderPlugins/adapterSSR.d.ts +11 -0
- package/dist/types/builder/shared/builderPlugins/index.d.ts +0 -1
- package/dist/types/builder/shared/bundlerPlugins/index.d.ts +0 -1
- package/dist/types/builder/shared/lazyCompilation.d.ts +7 -7
- package/dist/types/plugins/analyze/getServerRoutes.d.ts +1 -1
- package/dist/types/plugins/backend-federation/codegen.d.ts +4 -1
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +1 -18
- package/dist/types/presetUltramodern.d.ts +1 -0
- package/dist/types/types/config/deploy.d.ts +2 -2
- package/docs/community/showcase.md +3 -5
- package/docs/guides/advanced-features/bff/frameworks.md +1 -1
- package/docs/guides/basic-features/deploy.md +2 -2
- package/docs/guides/get-started/quick-start.md +9 -8
- package/docs/guides/get-started/tech-stack.md +1 -1
- package/docs/guides/get-started/ultramodern.md +18 -18
- package/docs/guides/troubleshooting/cli.md +1 -1
- package/docs/llms.txt +2 -2
- package/docs/tutorials/examples/csr-auth.md +1 -1
- package/package.json +15 -27
- package/rslib.config.mts +4 -7
- package/dist/cjs/builder/shared/builderPlugins/adapterLazyCompilation.js +0 -74
- package/dist/cjs/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.js +0 -72
- package/dist/cjs/plugins/deploy/platforms/cloudflare/artifacts.js +0 -127
- package/dist/cjs/plugins/deploy/platforms/cloudflare/constants.js +0 -141
- package/dist/cjs/plugins/deploy/platforms/cloudflare/delivery-unit.js +0 -139
- package/dist/cjs/plugins/deploy/platforms/cloudflare/i18n-worker.js +0 -135
- package/dist/cjs/plugins/deploy/platforms/cloudflare/index.js +0 -150
- package/dist/cjs/plugins/deploy/platforms/cloudflare/security-policies.js +0 -205
- package/dist/cjs/plugins/deploy/platforms/cloudflare/types.js +0 -18
- package/dist/cjs/plugins/deploy/platforms/cloudflare/utils.js +0 -66
- package/dist/cjs/plugins/deploy/platforms/cloudflare/worker-manifest.js +0 -208
- package/dist/cjs/plugins/deploy/platforms/cloudflare/wrangler-config.js +0 -204
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-contract.js +0 -108
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-plan.js +0 -93
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/identity.js +0 -83
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/issues.js +0 -54
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/manifest.js +0 -89
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.js +0 -151
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +0 -378
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +0 -251
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -191
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -514
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -1012
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -363
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +0 -93
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +0 -11
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +0 -281
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +0 -14
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +0 -98
- package/dist/cjs/types/config/cloudflareDeploy.js +0 -18
- package/dist/cjs/ultramodern-release-envelope/canonical.js +0 -68
- package/dist/cjs/ultramodern-release-envelope/framework-output.js +0 -649
- package/dist/cjs/ultramodern-release-envelope/index.js +0 -399
- package/dist/cjs/ultramodern-release-envelope/types.js +0 -51
- package/dist/cjs/ultramodern-release-identity.js +0 -110
- package/dist/esm/builder/shared/builderPlugins/adapterLazyCompilation.mjs +0 -36
- package/dist/esm/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.mjs +0 -30
- package/dist/esm/plugins/deploy/platforms/cloudflare/artifacts.mjs +0 -64
- package/dist/esm/plugins/deploy/platforms/cloudflare/constants.mjs +0 -34
- package/dist/esm/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +0 -88
- package/dist/esm/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +0 -97
- package/dist/esm/plugins/deploy/platforms/cloudflare/index.mjs +0 -102
- package/dist/esm/plugins/deploy/platforms/cloudflare/security-policies.mjs +0 -167
- package/dist/esm/plugins/deploy/platforms/cloudflare/types.mjs +0 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/utils.mjs +0 -12
- package/dist/esm/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +0 -148
- package/dist/esm/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +0 -150
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-contract.mjs +0 -31
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-plan.mjs +0 -45
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +0 -45
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +0 -10
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +0 -51
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +0 -99
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +0 -313
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +0 -251
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -191
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -514
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -1012
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -363
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +0 -93
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +0 -11
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +0 -281
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +0 -14
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +0 -98
- package/dist/esm/types/config/cloudflareDeploy.mjs +0 -0
- package/dist/esm/ultramodern-release-envelope/canonical.mjs +0 -21
- package/dist/esm/ultramodern-release-envelope/framework-output.mjs +0 -573
- package/dist/esm/ultramodern-release-envelope/index.mjs +0 -335
- package/dist/esm/ultramodern-release-envelope/types.mjs +0 -7
- package/dist/esm/ultramodern-release-identity.mjs +0 -66
- package/dist/esm-node/builder/shared/builderPlugins/adapterLazyCompilation.mjs +0 -37
- package/dist/esm-node/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.mjs +0 -31
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/artifacts.mjs +0 -65
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/constants.mjs +0 -35
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +0 -89
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +0 -98
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/index.mjs +0 -103
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/security-policies.mjs +0 -168
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/types.mjs +0 -1
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/utils.mjs +0 -13
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +0 -149
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +0 -151
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-contract.mjs +0 -32
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-plan.mjs +0 -46
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +0 -46
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +0 -11
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +0 -52
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +0 -100
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +0 -314
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +0 -251
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -191
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -514
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -1012
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -363
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +0 -93
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.mjs +0 -11
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.mjs +0 -281
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.mjs +0 -14
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-worker-path.mjs +0 -98
- package/dist/esm-node/types/config/cloudflareDeploy.mjs +0 -1
- package/dist/esm-node/ultramodern-release-envelope/canonical.mjs +0 -22
- package/dist/esm-node/ultramodern-release-envelope/framework-output.mjs +0 -574
- package/dist/esm-node/ultramodern-release-envelope/index.mjs +0 -336
- package/dist/esm-node/ultramodern-release-envelope/types.mjs +0 -8
- package/dist/esm-node/ultramodern-release-identity.mjs +0 -67
- package/dist/types/builder/shared/builderPlugins/adapterLazyCompilation.d.ts +0 -3
- package/dist/types/builder/shared/bundlerPlugins/CssExtractRuntimePlugin.d.ts +0 -6
- package/dist/types/plugins/deploy/platforms/cloudflare/artifacts.d.ts +0 -15
- package/dist/types/plugins/deploy/platforms/cloudflare/constants.d.ts +0 -24
- package/dist/types/plugins/deploy/platforms/cloudflare/delivery-unit.d.ts +0 -23
- package/dist/types/plugins/deploy/platforms/cloudflare/i18n-worker.d.ts +0 -22
- package/dist/types/plugins/deploy/platforms/cloudflare/index.d.ts +0 -2
- package/dist/types/plugins/deploy/platforms/cloudflare/security-policies.d.ts +0 -51
- package/dist/types/plugins/deploy/platforms/cloudflare/types.d.ts +0 -5
- package/dist/types/plugins/deploy/platforms/cloudflare/utils.d.ts +0 -6
- package/dist/types/plugins/deploy/platforms/cloudflare/worker-manifest.d.ts +0 -122
- package/dist/types/plugins/deploy/platforms/cloudflare/wrangler-config.d.ts +0 -46
- package/dist/types/plugins/deploy/platforms/cloudflare-output-contract.d.ts +0 -14
- package/dist/types/plugins/deploy/platforms/cloudflare-output-plan.d.ts +0 -34
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/identity.d.ts +0 -4
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/issues.d.ts +0 -14
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/manifest.d.ts +0 -2
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.d.ts +0 -14
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +0 -20
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +0 -1
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.d.mts +0 -1
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.d.mts +0 -1
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.d.mts +0 -1
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.d.mts +0 -1
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.d.mts +0 -4
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-fs-promises.d.mts +0 -5
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-loadable-server.d.mts +0 -48
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-mf-ssr-runtime-plugin.d.mts +0 -13
- package/dist/types/plugins/deploy/platforms/templates/cloudflare-worker-path.d.mts +0 -21
- package/dist/types/types/config/cloudflareDeploy.d.ts +0 -161
- package/dist/types/ultramodern-release-envelope/canonical.d.ts +0 -5
- package/dist/types/ultramodern-release-envelope/framework-output.d.ts +0 -32
- package/dist/types/ultramodern-release-envelope/index.d.ts +0 -6
- package/dist/types/ultramodern-release-envelope/types.d.ts +0 -62
- package/dist/types/ultramodern-release-identity.d.ts +0 -16
|
@@ -1,336 +0,0 @@
|
|
|
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 };
|
|
@@ -1,8 +0,0 @@
|
|
|
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 };
|
|
@@ -1,67 +0,0 @@
|
|
|
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,6 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CloudflareModernConfig } from './types';
|
|
2
|
-
export declare const getCloudflareArtifacts: (modernConfig: CloudflareModernConfig) => {
|
|
3
|
-
from: string;
|
|
4
|
-
to: string;
|
|
5
|
-
index: number;
|
|
6
|
-
}[];
|
|
7
|
-
export declare const getCloudflarePublicAssets: (modernConfig: CloudflareModernConfig) => {
|
|
8
|
-
from: string;
|
|
9
|
-
to: string;
|
|
10
|
-
index: number;
|
|
11
|
-
}[];
|
|
12
|
-
export declare const copyCloudflareArtifacts: (appDirectory: string, outputDirectory: string, artifacts: ReturnType<typeof getCloudflareArtifacts>) => Promise<void>;
|
|
13
|
-
export declare const copyCloudflarePublicAssets: (appDirectory: string, publicDirectory: string, publicAssets: ReturnType<typeof getCloudflarePublicAssets>) => Promise<void>;
|
|
14
|
-
export declare const copyCloudflareD1Migrations: (appDirectory: string, outputDirectory: string, modernConfig: CloudflareModernConfig) => Promise<void>;
|
|
15
|
-
export declare const readRouteSpec: (outputDirectory: string) => Promise<any>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { CLOUDFLARE_RUNTIME_TYPE, CLOUDFLARE_WORKER_BUNDLE_FORMAT } from '../cloudflare-output-contract';
|
|
2
|
-
export { CLOUDFLARE_RUNTIME_TYPE, CLOUDFLARE_WORKER_BUNDLE_FORMAT };
|
|
3
|
-
export declare const WORKER_ENTRY = "server/index.mjs";
|
|
4
|
-
export declare const WORKER_MANIFEST = "server/modern-worker-manifest.json";
|
|
5
|
-
export declare const WRANGLER_CONFIG_FILE = "wrangler.json";
|
|
6
|
-
export declare const OUTPUT_PACKAGE_FILE = "package.json";
|
|
7
|
-
export declare const ASSETS_BINDING = "ASSETS";
|
|
8
|
-
export declare const ROUTE_SPEC_FILE = "route.json";
|
|
9
|
-
export declare const ROUTE_SPEC_OUTPUT = "server/route.json";
|
|
10
|
-
export declare const LOADABLE_STATS_FILE = "loadable-stats.json";
|
|
11
|
-
export declare const ROUTE_MANIFEST_FILE = "routes-manifest.json";
|
|
12
|
-
export declare const PUBLIC_ASSETS_DIRECTORY = "public";
|
|
13
|
-
export declare const WORKER_BUNDLE_DIRECTORY = "worker";
|
|
14
|
-
export declare const SERVER_BUNDLE_DIRECTORY = "bundles";
|
|
15
|
-
export declare const SERVER_OUTPUT_DIRECTORY = "server";
|
|
16
|
-
export declare const DEFAULT_SERVER_ONLY_PUBLIC_ASSET_EXCLUDES: readonly ['api', 'shared'];
|
|
17
|
-
export declare const BFF_EFFECT_WORKER_ENTRY = "worker/__modern_bff_effect.js";
|
|
18
|
-
export declare const BFF_EFFECT_WORKER_DISPATCHER_EXPORT = "__modern_create_effect_bff_dispatcher";
|
|
19
|
-
export declare const EFFECT_BFF_CLOUDFLARE_IMPORT_GUIDANCE = "Ensure the Effect API entry exists at api/index.ts or bff.effect.entry, and import Cloudflare edge handlers from @modern-js/plugin-bff/effect-edge instead of lambda/Hono server helpers.";
|
|
20
|
-
export declare const DEFAULT_COMPATIBILITY_DATE = "2026-06-02";
|
|
21
|
-
export declare const COMPATIBILITY_DATE_PATTERN: RegExp;
|
|
22
|
-
export declare const REQUIRED_COMPATIBILITY_FLAGS: readonly ["nodejs_compat", "global_fetch_strictly_public"];
|
|
23
|
-
export declare const RESERVED_ARTIFACT_DESTINATION_FILES: Set<string>;
|
|
24
|
-
export declare const RESERVED_ARTIFACT_DESTINATION_DIRECTORIES: Set<string>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type DeliveryUnitIdentity } from '@modern-js/utils/universal';
|
|
2
|
-
export type DeliveryUnitStamp = DeliveryUnitIdentity & {
|
|
3
|
-
surfaces: {
|
|
4
|
-
ui: DeliveryUnitIdentity & {
|
|
5
|
-
surface: 'ui';
|
|
6
|
-
};
|
|
7
|
-
api: DeliveryUnitIdentity & {
|
|
8
|
-
surface: 'api';
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Resolve the delivery-unit record declared for this app by the workspace
|
|
14
|
-
* compact config (`.modernjs/ultramodern.json`). This is the topology source
|
|
15
|
-
* of truth the Cloudflare worker snapshot is verified against.
|
|
16
|
-
*/
|
|
17
|
-
export declare const resolveTopologyDeliveryUnit: (appDirectory: string) => Promise<DeliveryUnitIdentity | undefined>;
|
|
18
|
-
/**
|
|
19
|
-
* Resolve the delivery-unit identity actually bundled into the worker by
|
|
20
|
-
* parsing the generated `shared/ultramodern-build.ts` module. This is the
|
|
21
|
-
* worker snapshot / UI+API surface source that gets stamped into the manifest.
|
|
22
|
-
*/
|
|
23
|
-
export declare const resolveWorkerDeliveryUnitStamp: (appDirectory: string) => Promise<DeliveryUnitStamp | undefined>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { CloudflareAppContext } from './types';
|
|
2
|
-
type WorkerI18nDetection = {
|
|
3
|
-
order: string[];
|
|
4
|
-
lookupQuerystring: string;
|
|
5
|
-
lookupCookie: string;
|
|
6
|
-
lookupHeader: string;
|
|
7
|
-
};
|
|
8
|
-
type WorkerI18nEntry = {
|
|
9
|
-
i18nextDetector: boolean;
|
|
10
|
-
languages: string[];
|
|
11
|
-
fallbackLanguage: string;
|
|
12
|
-
detection: WorkerI18nDetection;
|
|
13
|
-
ignoreRedirectRoutes: string[];
|
|
14
|
-
staticRoutePrefixes: string[];
|
|
15
|
-
localisedUrls?: Record<string, Record<string, string>>;
|
|
16
|
-
};
|
|
17
|
-
export declare const createI18nWorkerManifest: (routeSpec: {
|
|
18
|
-
routes: Array<Record<string, unknown>>;
|
|
19
|
-
}, appContext: CloudflareAppContext) => {
|
|
20
|
-
entries: Record<string, WorkerI18nEntry>;
|
|
21
|
-
} | undefined;
|
|
22
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export declare const createCloudflareWorkerSecurityPolicy: (modernConfig: Parameters<CreatePreset>[0]['modernConfig']) => {
|
|
2
|
-
enabled: boolean;
|
|
3
|
-
cors: {
|
|
4
|
-
assets: boolean;
|
|
5
|
-
allowedOrigins: string[];
|
|
6
|
-
allowedMethods: string[];
|
|
7
|
-
allowedHeaders: string[];
|
|
8
|
-
reason: string | undefined;
|
|
9
|
-
};
|
|
10
|
-
reason: any;
|
|
11
|
-
headers?: undefined;
|
|
12
|
-
contentSecurityPolicy?: undefined;
|
|
13
|
-
noindex?: undefined;
|
|
14
|
-
} | {
|
|
15
|
-
enabled: boolean;
|
|
16
|
-
headers: {
|
|
17
|
-
referrerPolicy: any;
|
|
18
|
-
contentTypeOptions: any;
|
|
19
|
-
permissionsPolicy: any;
|
|
20
|
-
};
|
|
21
|
-
contentSecurityPolicy: {
|
|
22
|
-
mode: "off";
|
|
23
|
-
directives: {};
|
|
24
|
-
reason: string | undefined;
|
|
25
|
-
} | {
|
|
26
|
-
mode: "enforce" | "report-only";
|
|
27
|
-
directives: {
|
|
28
|
-
[k: string]: string[];
|
|
29
|
-
};
|
|
30
|
-
reason: string | undefined;
|
|
31
|
-
};
|
|
32
|
-
noindex: {
|
|
33
|
-
workersDev: boolean;
|
|
34
|
-
localhost: boolean;
|
|
35
|
-
previewHostnames: never[];
|
|
36
|
-
reason?: undefined;
|
|
37
|
-
} | {
|
|
38
|
-
workersDev: boolean;
|
|
39
|
-
localhost: boolean;
|
|
40
|
-
previewHostnames: string[];
|
|
41
|
-
reason: string | undefined;
|
|
42
|
-
};
|
|
43
|
-
cors: {
|
|
44
|
-
assets: boolean;
|
|
45
|
-
allowedOrigins: string[];
|
|
46
|
-
allowedMethods: string[];
|
|
47
|
-
allowedHeaders: string[];
|
|
48
|
-
reason: string | undefined;
|
|
49
|
-
};
|
|
50
|
-
reason: any;
|
|
51
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { CreatePreset } from '../platform';
|
|
2
|
-
type CloudflarePresetOptions = Parameters<CreatePreset>[0];
|
|
3
|
-
export type CloudflareAppContext = CloudflarePresetOptions['appContext'];
|
|
4
|
-
export type CloudflareModernConfig = CloudflarePresetOptions['modernConfig'];
|
|
5
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { JsonValue } from '../../../../types/config/deploy';
|
|
2
|
-
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
3
|
-
export declare const normalizeRelativePath: (value: unknown, label: string, scope?: string, options?: {
|
|
4
|
-
allowRoot?: boolean;
|
|
5
|
-
}) => string;
|
|
6
|
-
export declare const isJsonRecord: (value: unknown) => value is Record<string, JsonValue>;
|