@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.3 → 3.5.0-ultramodern.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/builder/generator/getBuilderEnvironments.js +1 -0
- package/dist/cjs/index.js +50 -44
- package/dist/cjs/plugins/backend-federation/codegen.js +208 -0
- package/dist/cjs/plugins/backend-federation/config.js +217 -0
- package/dist/cjs/plugins/backend-federation/emit.js +139 -0
- package/dist/cjs/plugins/backendFederationBuild.js +53 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/artifacts.js +127 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/constants.js +137 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/delivery-unit.js +118 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/i18n-worker.js +135 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/index.js +126 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/security-policies.js +223 -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 +178 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare/wrangler-config.js +189 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-contract.js +91 -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 +184 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/issues.js +54 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/manifest.js +83 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.js +158 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +137 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier.js +62 -0
- package/dist/cjs/plugins/deploy/platforms/cloudflare.js +2 -502
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
- package/dist/esm/builder/generator/getBuilderEnvironments.mjs +1 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/plugins/backend-federation/codegen.mjs +157 -0
- package/dist/esm/plugins/backend-federation/config.mjs +141 -0
- package/dist/esm/plugins/backend-federation/emit.mjs +88 -0
- package/dist/esm/plugins/backendFederationBuild.mjs +1 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/artifacts.mjs +64 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/constants.mjs +33 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +67 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +97 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/index.mjs +78 -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 +118 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +135 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-contract.mjs +17 -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 +129 -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 +45 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +97 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +68 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier.mjs +1 -0
- package/dist/esm/plugins/deploy/platforms/cloudflare.mjs +1 -492
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
- package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +1 -0
- package/dist/esm-node/index.mjs +2 -0
- package/dist/esm-node/plugins/backend-federation/codegen.mjs +158 -0
- package/dist/esm-node/plugins/backend-federation/config.mjs +142 -0
- package/dist/esm-node/plugins/backend-federation/emit.mjs +89 -0
- package/dist/esm-node/plugins/backendFederationBuild.mjs +2 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/artifacts.mjs +65 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/constants.mjs +34 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +68 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +98 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/index.mjs +79 -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 +119 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +136 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-contract.mjs +18 -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 +130 -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 +46 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +98 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +69 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier.mjs +2 -0
- package/dist/esm-node/plugins/deploy/platforms/cloudflare.mjs +1 -492
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
- package/dist/types/plugins/backend-federation/codegen.d.ts +82 -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 +23 -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 +21 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/index.d.ts +2 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/security-policies.d.ts +88 -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 +100 -0
- package/dist/types/plugins/deploy/platforms/cloudflare/wrangler-config.d.ts +39 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-contract.d.ts +13 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-plan.d.ts +33 -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 +13 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +16 -0
- package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier.d.ts +1 -0
- package/dist/types/plugins/deploy/platforms/cloudflare.d.ts +1 -2
- 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/types/config/cloudflareDeploy.d.ts +22 -0
- package/dist/types/types/config/deploy.d.ts +15 -2
- package/lib/types.d.ts +2 -3
- package/package.json +17 -11
- package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
- package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
- package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
- /package/dist/types/plugins/deploy/platforms/templates/{cloudflare-entry.d.mts → cloudflare-entry.006-fetch-handler.d.mts} +0 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
default: ()=>emit,
|
|
41
|
+
emitBackendFederationArtifacts: ()=>emitBackendFederationArtifacts
|
|
42
|
+
});
|
|
43
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
44
|
+
const promises_namespaceObject = require("node:fs/promises");
|
|
45
|
+
var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObject);
|
|
46
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
47
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
48
|
+
const universal_namespaceObject = require("@modern-js/utils/universal");
|
|
49
|
+
const external_codegen_js_namespaceObject = require("./codegen.js");
|
|
50
|
+
const external_config_js_namespaceObject = require("./config.js");
|
|
51
|
+
const emitBackendFederationArtifacts = async (appDirectory, distDirectory)=>{
|
|
52
|
+
const workspaceRoot = (0, external_config_js_namespaceObject.findWorkspaceRoot)(appDirectory);
|
|
53
|
+
if (!workspaceRoot) return;
|
|
54
|
+
const effectApiPath = external_node_path_default().join(appDirectory, 'api/effect-api.ts');
|
|
55
|
+
const backendFederationConfigPath = external_node_path_default().join(appDirectory, 'backend-federation.config.ts');
|
|
56
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(effectApiPath) || !(0, external_node_fs_namespaceObject.existsSync)(backendFederationConfigPath)) return;
|
|
57
|
+
const app = await (0, external_config_js_namespaceObject.findBackendFederationApp)(workspaceRoot, appDirectory);
|
|
58
|
+
if (!app) return;
|
|
59
|
+
const buildIdentity = await (0, external_config_js_namespaceObject.readBuildIdentity)(appDirectory);
|
|
60
|
+
const compactDeliveryUnit = app.compactDeliveryUnit;
|
|
61
|
+
const hasCompactDeliveryUnit = void 0 !== compactDeliveryUnit && (void 0 !== compactDeliveryUnit.unitId || void 0 !== compactDeliveryUnit.buildMarker || void 0 !== compactDeliveryUnit.packageName || void 0 !== compactDeliveryUnit.version);
|
|
62
|
+
const hasBuildIdentity = void 0 !== buildIdentity.unitId || void 0 !== buildIdentity.buildVersion || void 0 !== buildIdentity.packageName || void 0 !== buildIdentity.version;
|
|
63
|
+
if (hasBuildIdentity) {
|
|
64
|
+
const compactConfigPath = external_node_path_default().join(workspaceRoot, external_config_js_namespaceObject.COMPACT_CONFIG_PATH);
|
|
65
|
+
const buildIdentityPath = (0, external_node_fs_namespaceObject.existsSync)((0, external_config_js_namespaceObject.buildArtifactPathFor)(appDirectory)) ? (0, external_config_js_namespaceObject.buildArtifactPathFor)(appDirectory) : (0, external_config_js_namespaceObject.buildModulePathFor)(appDirectory);
|
|
66
|
+
const mismatches = [];
|
|
67
|
+
const compare = (label, a, b, leftLabel = 'deliveryUnit')=>{
|
|
68
|
+
if (void 0 !== a && void 0 !== b && a !== b) mismatches.push(`${label}: ${leftLabel}=${a} vs ultramodern-build=${b}`);
|
|
69
|
+
};
|
|
70
|
+
compare('appId', app.id, buildIdentity.appId, 'topology');
|
|
71
|
+
if (hasCompactDeliveryUnit) {
|
|
72
|
+
compare('unitId', compactDeliveryUnit?.unitId, buildIdentity.unitId);
|
|
73
|
+
compare('buildMarker/build', compactDeliveryUnit?.buildMarker, buildIdentity.buildVersion);
|
|
74
|
+
compare('packageName', compactDeliveryUnit?.packageName, buildIdentity.packageName);
|
|
75
|
+
compare('version', compactDeliveryUnit?.version, buildIdentity.version);
|
|
76
|
+
}
|
|
77
|
+
if (mismatches.length > 0) throw new Error(`[backend-federation-build] Delivery-unit identity drift between ${compactConfigPath} (topology) and ${buildIdentityPath}: ${mismatches.join('; ')}`);
|
|
78
|
+
}
|
|
79
|
+
const unitId = compactDeliveryUnit?.unitId ?? buildIdentity.unitId;
|
|
80
|
+
const buildVersion = compactDeliveryUnit?.buildMarker ?? buildIdentity.buildVersion;
|
|
81
|
+
const sourceRevision = await (0, external_config_js_namespaceObject.resolveWorkspaceSourceRevision)(workspaceRoot);
|
|
82
|
+
const packageName = compactDeliveryUnit?.packageName ?? buildIdentity.packageName ?? app.packageName;
|
|
83
|
+
const version = compactDeliveryUnit?.version ?? buildIdentity.version;
|
|
84
|
+
const deliveryUnit = (0, external_config_js_namespaceObject.createStampedDeliveryUnit)({
|
|
85
|
+
appId: app.id,
|
|
86
|
+
unitId,
|
|
87
|
+
buildMarker: buildVersion,
|
|
88
|
+
packageName,
|
|
89
|
+
version,
|
|
90
|
+
sourceRevision
|
|
91
|
+
});
|
|
92
|
+
const stampedBuildArtifact = buildIdentity.artifact ? (0, universal_namespaceObject.stampUltramodernBuildArtifactSourceRevision)(buildIdentity.artifact, sourceRevision) : void 0;
|
|
93
|
+
const resolvedApp = {
|
|
94
|
+
...app,
|
|
95
|
+
packageName,
|
|
96
|
+
version,
|
|
97
|
+
buildVersion,
|
|
98
|
+
unitId,
|
|
99
|
+
sourceRevision,
|
|
100
|
+
deliveryUnit
|
|
101
|
+
};
|
|
102
|
+
const manifestPath = external_node_path_default().join(distDirectory, universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE);
|
|
103
|
+
const entryPath = external_node_path_default().join(distDirectory, universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE);
|
|
104
|
+
const deliveryUnitArtifactPath = stampedBuildArtifact ? external_node_path_default().join(distDirectory, universal_namespaceObject.ULTRAMODERN_BUILD_ARTIFACT_FILE) : void 0;
|
|
105
|
+
await promises_default().mkdir(distDirectory, {
|
|
106
|
+
recursive: true
|
|
107
|
+
});
|
|
108
|
+
await promises_default().writeFile(entryPath, (0, external_codegen_js_namespaceObject.createBackendRemoteEntrySource)(workspaceRoot, resolvedApp, effectApiPath, entryPath));
|
|
109
|
+
await promises_default().writeFile(manifestPath, `${JSON.stringify((0, external_codegen_js_namespaceObject.createBackendManifest)(workspaceRoot, distDirectory, resolvedApp), null, 2)}\n`);
|
|
110
|
+
if (stampedBuildArtifact && deliveryUnitArtifactPath) await promises_default().writeFile(deliveryUnitArtifactPath, `${JSON.stringify(stampedBuildArtifact, null, 2)}\n`);
|
|
111
|
+
return {
|
|
112
|
+
appId: resolvedApp.id,
|
|
113
|
+
manifestPath,
|
|
114
|
+
containerPath: entryPath,
|
|
115
|
+
...deliveryUnitArtifactPath ? {
|
|
116
|
+
deliveryUnitArtifactPath
|
|
117
|
+
} : {},
|
|
118
|
+
remoteName: resolvedApp.backendName,
|
|
119
|
+
remoteType: resolvedApp.remoteType
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
const emit = ()=>({
|
|
123
|
+
name: '@modern-js/backend-federation-build',
|
|
124
|
+
setup (api) {
|
|
125
|
+
api.onAfterBuild(async ()=>{
|
|
126
|
+
const { appDirectory, distDirectory } = api.getAppContext();
|
|
127
|
+
await emitBackendFederationArtifacts(appDirectory, distDirectory);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
exports["default"] = __webpack_exports__["default"];
|
|
132
|
+
exports.emitBackendFederationArtifacts = __webpack_exports__.emitBackendFederationArtifacts;
|
|
133
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
134
|
+
"default",
|
|
135
|
+
"emitBackendFederationArtifacts"
|
|
136
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
137
|
+
Object.defineProperty(exports, '__esModule', {
|
|
138
|
+
value: true
|
|
139
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
default: ()=>emit_js_default(),
|
|
41
|
+
emitBackendFederationArtifacts: ()=>emit_js_namespaceObject.emitBackendFederationArtifacts
|
|
42
|
+
});
|
|
43
|
+
const emit_js_namespaceObject = require("./backend-federation/emit.js");
|
|
44
|
+
var emit_js_default = /*#__PURE__*/ __webpack_require__.n(emit_js_namespaceObject);
|
|
45
|
+
exports["default"] = __webpack_exports__["default"];
|
|
46
|
+
exports.emitBackendFederationArtifacts = __webpack_exports__.emitBackendFederationArtifacts;
|
|
47
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
48
|
+
"default",
|
|
49
|
+
"emitBackendFederationArtifacts"
|
|
50
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
51
|
+
Object.defineProperty(exports, '__esModule', {
|
|
52
|
+
value: true
|
|
53
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
copyCloudflareArtifacts: ()=>copyCloudflareArtifacts,
|
|
41
|
+
copyCloudflareD1Migrations: ()=>copyCloudflareD1Migrations,
|
|
42
|
+
copyCloudflarePublicAssets: ()=>copyCloudflarePublicAssets,
|
|
43
|
+
getCloudflareArtifacts: ()=>getCloudflareArtifacts,
|
|
44
|
+
getCloudflarePublicAssets: ()=>getCloudflarePublicAssets,
|
|
45
|
+
readRouteSpec: ()=>readRouteSpec
|
|
46
|
+
});
|
|
47
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
48
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
49
|
+
const utils_namespaceObject = require("@modern-js/utils");
|
|
50
|
+
const external_constants_js_namespaceObject = require("./constants.js");
|
|
51
|
+
const external_utils_js_namespaceObject = require("./utils.js");
|
|
52
|
+
const normalizeCloudflareArtifact = (artifact, index)=>{
|
|
53
|
+
const from = (0, external_utils_js_namespaceObject.normalizeRelativePath)(artifact.from, `deploy.worker.artifacts[${index}].from`, 'app root');
|
|
54
|
+
const to = (0, external_utils_js_namespaceObject.normalizeRelativePath)(artifact.to, `deploy.worker.artifacts[${index}].to`, 'Cloudflare output');
|
|
55
|
+
const [topLevelDestination] = to.split('/');
|
|
56
|
+
const reservedDestination = external_constants_js_namespaceObject.RESERVED_ARTIFACT_DESTINATION_FILES.has(to) ? to : topLevelDestination;
|
|
57
|
+
if (external_constants_js_namespaceObject.RESERVED_ARTIFACT_DESTINATION_FILES.has(to) || external_constants_js_namespaceObject.RESERVED_ARTIFACT_DESTINATION_DIRECTORIES.has(topLevelDestination)) throw new Error(`deploy.worker.artifacts[${index}].to must not target generated Cloudflare output path ${JSON.stringify(reservedDestination)}.`);
|
|
58
|
+
return {
|
|
59
|
+
from,
|
|
60
|
+
to,
|
|
61
|
+
index
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const getCloudflareArtifacts = (modernConfig)=>(modernConfig.deploy?.worker?.artifacts ?? []).map(normalizeCloudflareArtifact);
|
|
65
|
+
const normalizeCloudflarePublicAsset = (asset, index)=>{
|
|
66
|
+
const from = (0, external_utils_js_namespaceObject.normalizeRelativePath)(asset.from, `deploy.worker.publicAssets[${index}].from`, 'app root');
|
|
67
|
+
const to = (0, external_utils_js_namespaceObject.normalizeRelativePath)(asset.to, `deploy.worker.publicAssets[${index}].to`, 'Cloudflare public output', {
|
|
68
|
+
allowRoot: true
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
from,
|
|
72
|
+
to,
|
|
73
|
+
index
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
const getCloudflarePublicAssets = (modernConfig)=>(modernConfig.deploy?.worker?.publicAssets ?? []).map(normalizeCloudflarePublicAsset);
|
|
77
|
+
const copyCloudflareArtifacts = async (appDirectory, outputDirectory, artifacts)=>{
|
|
78
|
+
for (const artifact of artifacts){
|
|
79
|
+
const sourcePath = external_node_path_default().join(appDirectory, artifact.from);
|
|
80
|
+
if (!await utils_namespaceObject.fs.pathExists(sourcePath)) throw new Error(`deploy.worker.artifacts[${artifact.index}].from does not exist: ${artifact.from}`);
|
|
81
|
+
await utils_namespaceObject.fs.copy(sourcePath, external_node_path_default().join(outputDirectory, artifact.to));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const copyCloudflarePublicAssets = async (appDirectory, publicDirectory, publicAssets)=>{
|
|
85
|
+
for (const asset of publicAssets){
|
|
86
|
+
const sourcePath = external_node_path_default().join(appDirectory, asset.from);
|
|
87
|
+
if (!await utils_namespaceObject.fs.pathExists(sourcePath)) throw new Error(`deploy.worker.publicAssets[${asset.index}].from does not exist: ${asset.from}`);
|
|
88
|
+
await utils_namespaceObject.fs.copy(sourcePath, external_node_path_default().join(publicDirectory, asset.to));
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const copyCloudflareD1Migrations = async (appDirectory, outputDirectory, modernConfig)=>{
|
|
92
|
+
for (const [index, database] of (modernConfig.deploy?.worker?.d1Databases ?? []).entries()){
|
|
93
|
+
if (!database.migrationsDir) continue;
|
|
94
|
+
const migrationsDir = (0, external_utils_js_namespaceObject.normalizeRelativePath)(database.migrationsDir, `deploy.worker.d1Databases[${index}].migrationsDir`, 'app root');
|
|
95
|
+
const sourcePath = external_node_path_default().join(appDirectory, migrationsDir);
|
|
96
|
+
if (!await utils_namespaceObject.fs.pathExists(sourcePath)) throw new Error(`deploy.worker.d1Databases[${index}].migrationsDir does not exist: ${migrationsDir}`);
|
|
97
|
+
await utils_namespaceObject.fs.copy(sourcePath, external_node_path_default().join(outputDirectory, migrationsDir));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const readRouteSpec = async (outputDirectory)=>{
|
|
101
|
+
const routeSpecPath = external_node_path_default().join(outputDirectory, external_constants_js_namespaceObject.ROUTE_SPEC_OUTPUT);
|
|
102
|
+
if (!await utils_namespaceObject.fs.pathExists(routeSpecPath)) return {
|
|
103
|
+
routes: []
|
|
104
|
+
};
|
|
105
|
+
const routeSpec = await utils_namespaceObject.fs.readJSON(routeSpecPath);
|
|
106
|
+
return {
|
|
107
|
+
...routeSpec,
|
|
108
|
+
routes: Array.isArray(routeSpec.routes) ? routeSpec.routes : []
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
exports.copyCloudflareArtifacts = __webpack_exports__.copyCloudflareArtifacts;
|
|
112
|
+
exports.copyCloudflareD1Migrations = __webpack_exports__.copyCloudflareD1Migrations;
|
|
113
|
+
exports.copyCloudflarePublicAssets = __webpack_exports__.copyCloudflarePublicAssets;
|
|
114
|
+
exports.getCloudflareArtifacts = __webpack_exports__.getCloudflareArtifacts;
|
|
115
|
+
exports.getCloudflarePublicAssets = __webpack_exports__.getCloudflarePublicAssets;
|
|
116
|
+
exports.readRouteSpec = __webpack_exports__.readRouteSpec;
|
|
117
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
118
|
+
"copyCloudflareArtifacts",
|
|
119
|
+
"copyCloudflareD1Migrations",
|
|
120
|
+
"copyCloudflarePublicAssets",
|
|
121
|
+
"getCloudflareArtifacts",
|
|
122
|
+
"getCloudflarePublicAssets",
|
|
123
|
+
"readRouteSpec"
|
|
124
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
125
|
+
Object.defineProperty(exports, '__esModule', {
|
|
126
|
+
value: true
|
|
127
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
ASSETS_BINDING: ()=>ASSETS_BINDING,
|
|
32
|
+
BFF_EFFECT_WORKER_ENTRY: ()=>BFF_EFFECT_WORKER_ENTRY,
|
|
33
|
+
CLOUDFLARE_RUNTIME_TYPE: ()=>external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_RUNTIME_TYPE,
|
|
34
|
+
CLOUDFLARE_WORKER_BUNDLE_FORMAT: ()=>external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_WORKER_BUNDLE_FORMAT,
|
|
35
|
+
COMPATIBILITY_DATE_PATTERN: ()=>COMPATIBILITY_DATE_PATTERN,
|
|
36
|
+
DEFAULT_COMPATIBILITY_DATE: ()=>DEFAULT_COMPATIBILITY_DATE,
|
|
37
|
+
DEFAULT_SERVER_ONLY_PUBLIC_ASSET_EXCLUDES: ()=>DEFAULT_SERVER_ONLY_PUBLIC_ASSET_EXCLUDES,
|
|
38
|
+
EFFECT_BFF_CLOUDFLARE_IMPORT_GUIDANCE: ()=>EFFECT_BFF_CLOUDFLARE_IMPORT_GUIDANCE,
|
|
39
|
+
LOADABLE_STATS_FILE: ()=>LOADABLE_STATS_FILE,
|
|
40
|
+
OUTPUT_PACKAGE_FILE: ()=>OUTPUT_PACKAGE_FILE,
|
|
41
|
+
PUBLIC_ASSETS_DIRECTORY: ()=>PUBLIC_ASSETS_DIRECTORY,
|
|
42
|
+
REQUIRED_COMPATIBILITY_FLAGS: ()=>REQUIRED_COMPATIBILITY_FLAGS,
|
|
43
|
+
RESERVED_ARTIFACT_DESTINATION_DIRECTORIES: ()=>RESERVED_ARTIFACT_DESTINATION_DIRECTORIES,
|
|
44
|
+
RESERVED_ARTIFACT_DESTINATION_FILES: ()=>RESERVED_ARTIFACT_DESTINATION_FILES,
|
|
45
|
+
ROUTE_MANIFEST_FILE: ()=>ROUTE_MANIFEST_FILE,
|
|
46
|
+
ROUTE_SPEC_FILE: ()=>ROUTE_SPEC_FILE,
|
|
47
|
+
ROUTE_SPEC_OUTPUT: ()=>ROUTE_SPEC_OUTPUT,
|
|
48
|
+
SERVER_BUNDLE_DIRECTORY: ()=>SERVER_BUNDLE_DIRECTORY,
|
|
49
|
+
SERVER_OUTPUT_DIRECTORY: ()=>SERVER_OUTPUT_DIRECTORY,
|
|
50
|
+
WORKER_BUNDLE_DIRECTORY: ()=>WORKER_BUNDLE_DIRECTORY,
|
|
51
|
+
WORKER_ENTRY: ()=>WORKER_ENTRY,
|
|
52
|
+
WORKER_MANIFEST: ()=>WORKER_MANIFEST,
|
|
53
|
+
WRANGLER_CONFIG_FILE: ()=>WRANGLER_CONFIG_FILE
|
|
54
|
+
});
|
|
55
|
+
const external_cloudflare_output_contract_js_namespaceObject = require("../cloudflare-output-contract.js");
|
|
56
|
+
const WORKER_ENTRY = external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_WORKER_ENTRY;
|
|
57
|
+
const WORKER_MANIFEST = external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_WORKER_MANIFEST;
|
|
58
|
+
const WRANGLER_CONFIG_FILE = external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_WRANGLER_CONFIG_FILE;
|
|
59
|
+
const OUTPUT_PACKAGE_FILE = external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_OUTPUT_PACKAGE_FILE;
|
|
60
|
+
const ASSETS_BINDING = external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_ASSETS_BINDING;
|
|
61
|
+
const ROUTE_SPEC_FILE = 'route.json';
|
|
62
|
+
const ROUTE_SPEC_OUTPUT = `server/${ROUTE_SPEC_FILE}`;
|
|
63
|
+
const LOADABLE_STATS_FILE = 'loadable-stats.json';
|
|
64
|
+
const ROUTE_MANIFEST_FILE = 'routes-manifest.json';
|
|
65
|
+
const PUBLIC_ASSETS_DIRECTORY = external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_PUBLIC_ASSETS_DIRECTORY;
|
|
66
|
+
const WORKER_BUNDLE_DIRECTORY = external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_WORKER_BUNDLE_DIRECTORY;
|
|
67
|
+
const SERVER_BUNDLE_DIRECTORY = 'bundles';
|
|
68
|
+
const SERVER_OUTPUT_DIRECTORY = 'server';
|
|
69
|
+
const DEFAULT_SERVER_ONLY_PUBLIC_ASSET_EXCLUDES = [
|
|
70
|
+
'api',
|
|
71
|
+
'shared'
|
|
72
|
+
];
|
|
73
|
+
const BFF_EFFECT_WORKER_ENTRY = `${WORKER_BUNDLE_DIRECTORY}/__modern_bff_effect.js`;
|
|
74
|
+
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.';
|
|
75
|
+
const DEFAULT_COMPATIBILITY_DATE = '2026-06-02';
|
|
76
|
+
const COMPATIBILITY_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/u;
|
|
77
|
+
const REQUIRED_COMPATIBILITY_FLAGS = external_cloudflare_output_contract_js_namespaceObject.CLOUDFLARE_REQUIRED_COMPATIBILITY_FLAGS;
|
|
78
|
+
const RESERVED_ARTIFACT_DESTINATION_FILES = new Set([
|
|
79
|
+
WRANGLER_CONFIG_FILE,
|
|
80
|
+
OUTPUT_PACKAGE_FILE
|
|
81
|
+
]);
|
|
82
|
+
const RESERVED_ARTIFACT_DESTINATION_DIRECTORIES = new Set([
|
|
83
|
+
PUBLIC_ASSETS_DIRECTORY,
|
|
84
|
+
SERVER_OUTPUT_DIRECTORY,
|
|
85
|
+
WORKER_BUNDLE_DIRECTORY
|
|
86
|
+
]);
|
|
87
|
+
exports.ASSETS_BINDING = __webpack_exports__.ASSETS_BINDING;
|
|
88
|
+
exports.BFF_EFFECT_WORKER_ENTRY = __webpack_exports__.BFF_EFFECT_WORKER_ENTRY;
|
|
89
|
+
exports.CLOUDFLARE_RUNTIME_TYPE = __webpack_exports__.CLOUDFLARE_RUNTIME_TYPE;
|
|
90
|
+
exports.CLOUDFLARE_WORKER_BUNDLE_FORMAT = __webpack_exports__.CLOUDFLARE_WORKER_BUNDLE_FORMAT;
|
|
91
|
+
exports.COMPATIBILITY_DATE_PATTERN = __webpack_exports__.COMPATIBILITY_DATE_PATTERN;
|
|
92
|
+
exports.DEFAULT_COMPATIBILITY_DATE = __webpack_exports__.DEFAULT_COMPATIBILITY_DATE;
|
|
93
|
+
exports.DEFAULT_SERVER_ONLY_PUBLIC_ASSET_EXCLUDES = __webpack_exports__.DEFAULT_SERVER_ONLY_PUBLIC_ASSET_EXCLUDES;
|
|
94
|
+
exports.EFFECT_BFF_CLOUDFLARE_IMPORT_GUIDANCE = __webpack_exports__.EFFECT_BFF_CLOUDFLARE_IMPORT_GUIDANCE;
|
|
95
|
+
exports.LOADABLE_STATS_FILE = __webpack_exports__.LOADABLE_STATS_FILE;
|
|
96
|
+
exports.OUTPUT_PACKAGE_FILE = __webpack_exports__.OUTPUT_PACKAGE_FILE;
|
|
97
|
+
exports.PUBLIC_ASSETS_DIRECTORY = __webpack_exports__.PUBLIC_ASSETS_DIRECTORY;
|
|
98
|
+
exports.REQUIRED_COMPATIBILITY_FLAGS = __webpack_exports__.REQUIRED_COMPATIBILITY_FLAGS;
|
|
99
|
+
exports.RESERVED_ARTIFACT_DESTINATION_DIRECTORIES = __webpack_exports__.RESERVED_ARTIFACT_DESTINATION_DIRECTORIES;
|
|
100
|
+
exports.RESERVED_ARTIFACT_DESTINATION_FILES = __webpack_exports__.RESERVED_ARTIFACT_DESTINATION_FILES;
|
|
101
|
+
exports.ROUTE_MANIFEST_FILE = __webpack_exports__.ROUTE_MANIFEST_FILE;
|
|
102
|
+
exports.ROUTE_SPEC_FILE = __webpack_exports__.ROUTE_SPEC_FILE;
|
|
103
|
+
exports.ROUTE_SPEC_OUTPUT = __webpack_exports__.ROUTE_SPEC_OUTPUT;
|
|
104
|
+
exports.SERVER_BUNDLE_DIRECTORY = __webpack_exports__.SERVER_BUNDLE_DIRECTORY;
|
|
105
|
+
exports.SERVER_OUTPUT_DIRECTORY = __webpack_exports__.SERVER_OUTPUT_DIRECTORY;
|
|
106
|
+
exports.WORKER_BUNDLE_DIRECTORY = __webpack_exports__.WORKER_BUNDLE_DIRECTORY;
|
|
107
|
+
exports.WORKER_ENTRY = __webpack_exports__.WORKER_ENTRY;
|
|
108
|
+
exports.WORKER_MANIFEST = __webpack_exports__.WORKER_MANIFEST;
|
|
109
|
+
exports.WRANGLER_CONFIG_FILE = __webpack_exports__.WRANGLER_CONFIG_FILE;
|
|
110
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
111
|
+
"ASSETS_BINDING",
|
|
112
|
+
"BFF_EFFECT_WORKER_ENTRY",
|
|
113
|
+
"CLOUDFLARE_RUNTIME_TYPE",
|
|
114
|
+
"CLOUDFLARE_WORKER_BUNDLE_FORMAT",
|
|
115
|
+
"COMPATIBILITY_DATE_PATTERN",
|
|
116
|
+
"DEFAULT_COMPATIBILITY_DATE",
|
|
117
|
+
"DEFAULT_SERVER_ONLY_PUBLIC_ASSET_EXCLUDES",
|
|
118
|
+
"EFFECT_BFF_CLOUDFLARE_IMPORT_GUIDANCE",
|
|
119
|
+
"LOADABLE_STATS_FILE",
|
|
120
|
+
"OUTPUT_PACKAGE_FILE",
|
|
121
|
+
"PUBLIC_ASSETS_DIRECTORY",
|
|
122
|
+
"REQUIRED_COMPATIBILITY_FLAGS",
|
|
123
|
+
"RESERVED_ARTIFACT_DESTINATION_DIRECTORIES",
|
|
124
|
+
"RESERVED_ARTIFACT_DESTINATION_FILES",
|
|
125
|
+
"ROUTE_MANIFEST_FILE",
|
|
126
|
+
"ROUTE_SPEC_FILE",
|
|
127
|
+
"ROUTE_SPEC_OUTPUT",
|
|
128
|
+
"SERVER_BUNDLE_DIRECTORY",
|
|
129
|
+
"SERVER_OUTPUT_DIRECTORY",
|
|
130
|
+
"WORKER_BUNDLE_DIRECTORY",
|
|
131
|
+
"WORKER_ENTRY",
|
|
132
|
+
"WORKER_MANIFEST",
|
|
133
|
+
"WRANGLER_CONFIG_FILE"
|
|
134
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
135
|
+
Object.defineProperty(exports, '__esModule', {
|
|
136
|
+
value: true
|
|
137
|
+
});
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
resolveTopologyDeliveryUnit: ()=>resolveTopologyDeliveryUnit,
|
|
41
|
+
resolveWorkerDeliveryUnitStamp: ()=>resolveWorkerDeliveryUnitStamp
|
|
42
|
+
});
|
|
43
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
44
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
45
|
+
const utils_namespaceObject = require("@modern-js/utils");
|
|
46
|
+
const universal_namespaceObject = require("@modern-js/utils/universal");
|
|
47
|
+
const external_utils_js_namespaceObject = require("./utils.js");
|
|
48
|
+
const COMPACT_CONFIG_PATH = '.modernjs/ultramodern.json';
|
|
49
|
+
const findWorkspaceRoot = async (appDirectory)=>{
|
|
50
|
+
let current = external_node_path_default().resolve(appDirectory);
|
|
51
|
+
for(;;){
|
|
52
|
+
if (await utils_namespaceObject.fs.pathExists(external_node_path_default().join(current, COMPACT_CONFIG_PATH))) return current;
|
|
53
|
+
const parent = external_node_path_default().dirname(current);
|
|
54
|
+
if (parent === current) return;
|
|
55
|
+
current = parent;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const resolveTopologyDeliveryUnit = async (appDirectory)=>{
|
|
59
|
+
const workspaceRoot = await findWorkspaceRoot(appDirectory);
|
|
60
|
+
if (!workspaceRoot) return;
|
|
61
|
+
let compactConfig;
|
|
62
|
+
try {
|
|
63
|
+
compactConfig = await utils_namespaceObject.fs.readJSON(external_node_path_default().join(workspaceRoot, COMPACT_CONFIG_PATH));
|
|
64
|
+
} catch {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (!(0, external_utils_js_namespaceObject.isRecord)(compactConfig)) return;
|
|
68
|
+
const topology = (0, external_utils_js_namespaceObject.isRecord)(compactConfig.topology) ? compactConfig.topology : void 0;
|
|
69
|
+
const apps = Array.isArray(topology?.apps) ? topology.apps : [];
|
|
70
|
+
const resolvedAppDirectory = external_node_path_default().resolve(appDirectory);
|
|
71
|
+
for (const app of apps){
|
|
72
|
+
if (!(0, external_utils_js_namespaceObject.isRecord)(app)) continue;
|
|
73
|
+
const appPath = (0, universal_namespaceObject.nonEmptyString)(app.path);
|
|
74
|
+
if (appPath && external_node_path_default().resolve(workspaceRoot, appPath.replace(/^\.\/+/u, '')) === resolvedAppDirectory) return (0, universal_namespaceObject.toDeliveryUnitIdentity)(app.deliveryUnit);
|
|
75
|
+
}
|
|
76
|
+
return (0, universal_namespaceObject.toDeliveryUnitIdentity)(compactConfig.deliveryUnit);
|
|
77
|
+
};
|
|
78
|
+
const resolveWorkerDeliveryUnitStamp = async (appDirectory)=>{
|
|
79
|
+
const buildArtifactPath = external_node_path_default().join(appDirectory, universal_namespaceObject.ULTRAMODERN_BUILD_ARTIFACT_PATH);
|
|
80
|
+
const buildModulePath = external_node_path_default().join(appDirectory, universal_namespaceObject.ULTRAMODERN_BUILD_MODULE_PATH);
|
|
81
|
+
let identity;
|
|
82
|
+
if (await utils_namespaceObject.fs.pathExists(buildArtifactPath)) {
|
|
83
|
+
const artifact = await utils_namespaceObject.fs.readJSON(buildArtifactPath);
|
|
84
|
+
if (!(0, universal_namespaceObject.isUltramodernBuildArtifact)(artifact)) return;
|
|
85
|
+
identity = (0, universal_namespaceObject.toDeliveryUnitIdentity)(artifact.deliveryUnit);
|
|
86
|
+
} else if (await utils_namespaceObject.fs.pathExists(buildModulePath)) {
|
|
87
|
+
console.warn(`[cloudflare] ${buildArtifactPath} missing; falling back to legacy regex parsing of ${buildModulePath}. Regenerate the workspace to emit ultramodern-build.json.`);
|
|
88
|
+
const source = await utils_namespaceObject.fs.readFile(buildModulePath, 'utf8');
|
|
89
|
+
identity = (0, universal_namespaceObject.toDeliveryUnitIdentity)({
|
|
90
|
+
buildMarker: source.match(/\bbuild:\s*['"]([^'"]+)['"]/u)?.[1],
|
|
91
|
+
unitId: source.match(/\bunitId:\s*['"]([^'"]+)['"]/u)?.[1],
|
|
92
|
+
sourceRevision: source.match(/\bsourceRevision:\s*['"]([^'"]+)['"]/u)?.[1]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (!identity) return;
|
|
96
|
+
return {
|
|
97
|
+
...identity,
|
|
98
|
+
surfaces: {
|
|
99
|
+
ui: {
|
|
100
|
+
...identity,
|
|
101
|
+
surface: 'ui'
|
|
102
|
+
},
|
|
103
|
+
api: {
|
|
104
|
+
...identity,
|
|
105
|
+
surface: 'api'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
exports.resolveTopologyDeliveryUnit = __webpack_exports__.resolveTopologyDeliveryUnit;
|
|
111
|
+
exports.resolveWorkerDeliveryUnitStamp = __webpack_exports__.resolveWorkerDeliveryUnitStamp;
|
|
112
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
113
|
+
"resolveTopologyDeliveryUnit",
|
|
114
|
+
"resolveWorkerDeliveryUnitStamp"
|
|
115
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
116
|
+
Object.defineProperty(exports, '__esModule', {
|
|
117
|
+
value: true
|
|
118
|
+
});
|