@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.4 → 3.5.0-ultramodern.40

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.
Files changed (159) hide show
  1. package/dist/cjs/builder/generator/getBuilderEnvironments.js +1 -0
  2. package/dist/cjs/builder/shared/builderPlugins/adapterPrecompress.js +13 -4
  3. package/dist/cjs/builder/shared/lazyCompilation.js +2 -10
  4. package/dist/cjs/commands/index.js +0 -4
  5. package/dist/cjs/index.js +37 -66
  6. package/dist/cjs/plugins/backend-federation/codegen.js +209 -0
  7. package/dist/cjs/plugins/backend-federation/config.js +217 -0
  8. package/dist/cjs/plugins/backend-federation/emit.js +139 -0
  9. package/dist/cjs/plugins/backendFederationBuild.js +53 -0
  10. package/dist/cjs/plugins/deploy/index.js +4 -4
  11. package/dist/cjs/plugins/deploy/platforms/cloudflare/artifacts.js +127 -0
  12. package/dist/cjs/plugins/deploy/platforms/cloudflare/constants.js +137 -0
  13. package/dist/cjs/plugins/deploy/platforms/cloudflare/delivery-unit.js +121 -0
  14. package/dist/cjs/plugins/deploy/platforms/cloudflare/i18n-worker.js +135 -0
  15. package/dist/cjs/plugins/deploy/platforms/cloudflare/index.js +126 -0
  16. package/dist/cjs/plugins/deploy/platforms/cloudflare/security-policies.js +205 -0
  17. package/dist/cjs/plugins/deploy/platforms/cloudflare/types.js +18 -0
  18. package/dist/cjs/plugins/deploy/platforms/cloudflare/utils.js +66 -0
  19. package/dist/cjs/plugins/deploy/platforms/cloudflare/worker-manifest.js +178 -0
  20. package/dist/cjs/plugins/deploy/platforms/cloudflare/wrangler-config.js +189 -0
  21. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-contract.js +91 -0
  22. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-plan.js +93 -0
  23. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/identity.js +83 -0
  24. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js +184 -0
  25. package/dist/cjs/{baseline.js → plugins/deploy/platforms/cloudflare-output-verifier/issues.js} +19 -10
  26. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/manifest.js +83 -0
  27. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.js +149 -0
  28. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +131 -0
  29. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
  30. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
  31. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
  32. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
  33. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
  34. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
  35. package/dist/esm/builder/generator/getBuilderEnvironments.mjs +1 -0
  36. package/dist/esm/builder/shared/builderPlugins/adapterPrecompress.mjs +13 -4
  37. package/dist/esm/builder/shared/lazyCompilation.mjs +1 -3
  38. package/dist/esm/commands/index.mjs +0 -1
  39. package/dist/esm/index.mjs +3 -4
  40. package/dist/esm/plugins/analyze/getHtmlTemplate.mjs +2 -2
  41. package/dist/esm/plugins/analyze/isDefaultExportFunction.mjs +2 -2
  42. package/dist/esm/plugins/backend-federation/codegen.mjs +158 -0
  43. package/dist/esm/plugins/backend-federation/config.mjs +141 -0
  44. package/dist/esm/plugins/backend-federation/emit.mjs +88 -0
  45. package/dist/esm/plugins/backendFederationBuild.mjs +1 -0
  46. package/dist/esm/plugins/deploy/index.mjs +1 -1
  47. package/dist/esm/plugins/deploy/platforms/cloudflare/artifacts.mjs +64 -0
  48. package/dist/esm/plugins/deploy/platforms/cloudflare/constants.mjs +33 -0
  49. package/dist/esm/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +70 -0
  50. package/dist/esm/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +97 -0
  51. package/dist/esm/plugins/deploy/platforms/cloudflare/index.mjs +78 -0
  52. package/dist/esm/plugins/deploy/platforms/cloudflare/security-policies.mjs +167 -0
  53. package/dist/esm/plugins/deploy/platforms/cloudflare/types.mjs +0 -0
  54. package/dist/esm/plugins/deploy/platforms/cloudflare/utils.mjs +12 -0
  55. package/dist/esm/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +118 -0
  56. package/dist/esm/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +135 -0
  57. package/dist/esm/plugins/deploy/platforms/cloudflare-output-contract.mjs +17 -0
  58. package/dist/esm/plugins/deploy/platforms/cloudflare-output-plan.mjs +45 -0
  59. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +45 -0
  60. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +129 -0
  61. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +10 -0
  62. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +45 -0
  63. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +97 -0
  64. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +68 -0
  65. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
  66. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
  67. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
  68. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
  69. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
  70. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
  71. package/dist/esm-node/builder/generator/getBuilderEnvironments.mjs +1 -0
  72. package/dist/esm-node/builder/shared/builderPlugins/adapterPrecompress.mjs +13 -4
  73. package/dist/esm-node/builder/shared/lazyCompilation.mjs +1 -3
  74. package/dist/esm-node/commands/index.mjs +0 -1
  75. package/dist/esm-node/index.mjs +3 -4
  76. package/dist/esm-node/plugins/analyze/getHtmlTemplate.mjs +2 -2
  77. package/dist/esm-node/plugins/analyze/isDefaultExportFunction.mjs +2 -2
  78. package/dist/esm-node/plugins/backend-federation/codegen.mjs +159 -0
  79. package/dist/esm-node/plugins/backend-federation/config.mjs +142 -0
  80. package/dist/esm-node/plugins/backend-federation/emit.mjs +89 -0
  81. package/dist/esm-node/plugins/backendFederationBuild.mjs +2 -0
  82. package/dist/esm-node/plugins/deploy/index.mjs +1 -1
  83. package/dist/esm-node/plugins/deploy/platforms/cloudflare/artifacts.mjs +65 -0
  84. package/dist/esm-node/plugins/deploy/platforms/cloudflare/constants.mjs +34 -0
  85. package/dist/esm-node/plugins/deploy/platforms/cloudflare/delivery-unit.mjs +71 -0
  86. package/dist/esm-node/plugins/deploy/platforms/cloudflare/i18n-worker.mjs +98 -0
  87. package/dist/esm-node/plugins/deploy/platforms/cloudflare/index.mjs +79 -0
  88. package/dist/esm-node/plugins/deploy/platforms/cloudflare/security-policies.mjs +168 -0
  89. package/dist/esm-node/plugins/deploy/platforms/cloudflare/types.mjs +1 -0
  90. package/dist/esm-node/plugins/deploy/platforms/cloudflare/utils.mjs +13 -0
  91. package/dist/esm-node/plugins/deploy/platforms/cloudflare/worker-manifest.mjs +119 -0
  92. package/dist/esm-node/plugins/deploy/platforms/cloudflare/wrangler-config.mjs +136 -0
  93. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-contract.mjs +18 -0
  94. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-plan.mjs +46 -0
  95. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/identity.mjs +46 -0
  96. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs +130 -0
  97. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/issues.mjs +11 -0
  98. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/manifest.mjs +46 -0
  99. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +98 -0
  100. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +69 -0
  101. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.mjs +22 -0
  102. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.mjs +0 -0
  103. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.mjs +0 -0
  104. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.mjs +0 -0
  105. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.mjs +0 -0
  106. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.006-fetch-handler.mjs +32 -0
  107. package/dist/types/builder/generator/createCopyPattern.d.ts +7 -5
  108. package/dist/types/builder/shared/lazyCompilation.d.ts +2 -4
  109. package/dist/types/commands/index.d.ts +0 -1
  110. package/dist/types/index.d.ts +0 -2
  111. package/dist/types/plugins/backend-federation/codegen.d.ts +83 -0
  112. package/dist/types/plugins/backend-federation/config.d.ts +103 -0
  113. package/dist/types/plugins/backend-federation/emit.d.ts +13 -0
  114. package/dist/types/plugins/backendFederationBuild.d.ts +2 -0
  115. package/dist/types/plugins/deploy/platforms/cloudflare/artifacts.d.ts +15 -0
  116. package/dist/types/plugins/deploy/platforms/cloudflare/constants.d.ts +23 -0
  117. package/dist/types/plugins/deploy/platforms/cloudflare/delivery-unit.d.ts +23 -0
  118. package/dist/types/plugins/deploy/platforms/cloudflare/i18n-worker.d.ts +22 -0
  119. package/dist/types/plugins/deploy/platforms/{cloudflare.d.ts → cloudflare/index.d.ts} +1 -1
  120. package/dist/types/plugins/deploy/platforms/cloudflare/security-policies.d.ts +51 -0
  121. package/dist/types/plugins/deploy/platforms/cloudflare/types.d.ts +5 -0
  122. package/dist/types/plugins/deploy/platforms/cloudflare/utils.d.ts +6 -0
  123. package/dist/types/plugins/deploy/platforms/cloudflare/worker-manifest.d.ts +113 -0
  124. package/dist/types/plugins/deploy/platforms/cloudflare/wrangler-config.d.ts +39 -0
  125. package/dist/types/plugins/deploy/platforms/cloudflare-output-contract.d.ts +13 -0
  126. package/dist/types/plugins/deploy/platforms/cloudflare-output-plan.d.ts +34 -0
  127. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/identity.d.ts +4 -0
  128. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts +18 -0
  129. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/issues.d.ts +14 -0
  130. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/manifest.d.ts +2 -0
  131. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.d.ts +6 -0
  132. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +15 -0
  133. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.001-bootstrap-security.d.mts +1 -0
  134. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.002-assets-routes.d.mts +1 -0
  135. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.003-i18n-locales.d.mts +1 -0
  136. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.004-rendering-css.d.mts +1 -0
  137. package/dist/types/plugins/deploy/platforms/templates/cloudflare-entry.005-worker-dispatch.d.mts +1 -0
  138. package/dist/types/types/config/cloudflareDeploy.d.ts +22 -0
  139. package/dist/types/types/config/deploy.d.ts +15 -2
  140. package/lib/types.d.ts +2 -3
  141. package/package.json +24 -18
  142. package/dist/cjs/commands/runtime.js +0 -196
  143. package/dist/cjs/plugins/deploy/platforms/cloudflare.js +0 -540
  144. package/dist/cjs/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
  145. package/dist/cjs/ultramodern/designSystem.js +0 -123
  146. package/dist/esm/baseline.mjs +0 -4
  147. package/dist/esm/commands/runtime.mjs +0 -146
  148. package/dist/esm/plugins/deploy/platforms/cloudflare.mjs +0 -492
  149. package/dist/esm/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
  150. package/dist/esm/ultramodern/designSystem.mjs +0 -73
  151. package/dist/esm-node/baseline.mjs +0 -5
  152. package/dist/esm-node/commands/runtime.mjs +0 -147
  153. package/dist/esm-node/plugins/deploy/platforms/cloudflare.mjs +0 -493
  154. package/dist/esm-node/plugins/deploy/platforms/templates/cloudflare-entry.mjs +0 -576
  155. package/dist/esm-node/ultramodern/designSystem.mjs +0 -74
  156. package/dist/types/baseline.d.ts +0 -16
  157. package/dist/types/commands/runtime.d.ts +0 -12
  158. package/dist/types/ultramodern/designSystem.d.ts +0 -54
  159. /package/dist/types/plugins/deploy/platforms/templates/{cloudflare-entry.d.mts → cloudflare-entry.006-fetch-handler.d.mts} +0 -0
@@ -0,0 +1,217 @@
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
+ COMPACT_CONFIG_PATH: ()=>COMPACT_CONFIG_PATH,
41
+ buildArtifactPathFor: ()=>buildArtifactPathFor,
42
+ buildModulePathFor: ()=>buildModulePathFor,
43
+ createAppFromCompactMetadata: ()=>createAppFromCompactMetadata,
44
+ createStampedDeliveryUnit: ()=>createStampedDeliveryUnit,
45
+ findBackendFederationApp: ()=>findBackendFederationApp,
46
+ findWorkspaceRoot: ()=>findWorkspaceRoot,
47
+ normalizeRelativePath: ()=>normalizeRelativePath,
48
+ readBuildIdentity: ()=>readBuildIdentity,
49
+ resolveWorkspaceSourceRevision: ()=>resolveWorkspaceSourceRevision
50
+ });
51
+ const external_node_child_process_namespaceObject = require("node:child_process");
52
+ const external_node_fs_namespaceObject = require("node:fs");
53
+ const promises_namespaceObject = require("node:fs/promises");
54
+ var promises_default = /*#__PURE__*/ __webpack_require__.n(promises_namespaceObject);
55
+ const external_node_path_namespaceObject = require("node:path");
56
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
57
+ const external_node_util_namespaceObject = require("node:util");
58
+ const universal_namespaceObject = require("@modern-js/utils/universal");
59
+ const COMPACT_CONFIG_PATH = '.modernjs/ultramodern.json';
60
+ const execFileAsync = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile);
61
+ const normalizeRelativePath = (value)=>value.replace(/\\/gu, '/').replace(/^\.\/+/u, '');
62
+ const isRecord = (value)=>'object' == typeof value && null !== value;
63
+ const readJsonFile = async (filePath)=>JSON.parse(await promises_default().readFile(filePath, 'utf8'));
64
+ const buildArtifactPathFor = (appDirectory)=>external_node_path_default().join(appDirectory, universal_namespaceObject.ULTRAMODERN_BUILD_ARTIFACT_PATH);
65
+ const buildModulePathFor = (appDirectory)=>external_node_path_default().join(appDirectory, universal_namespaceObject.ULTRAMODERN_BUILD_MODULE_PATH);
66
+ const readBuildIdentity = async (appDirectory)=>{
67
+ const buildArtifactPath = buildArtifactPathFor(appDirectory);
68
+ if ((0, external_node_fs_namespaceObject.existsSync)(buildArtifactPath)) {
69
+ const artifact = await readJsonFile(buildArtifactPath);
70
+ const artifactValidation = (0, universal_namespaceObject.validateUltramodernBuildArtifact)(artifact, buildArtifactPath);
71
+ if (!artifactValidation.ok) throw new Error(`[backend-federation-build] Invalid delivery-unit build artifact at ${buildArtifactPath}.`);
72
+ const deliveryUnit = artifact.deliveryUnit;
73
+ return {
74
+ artifact,
75
+ appId: deliveryUnit.appId,
76
+ buildVersion: deliveryUnit.buildMarker,
77
+ packageName: deliveryUnit.packageName,
78
+ version: deliveryUnit.version,
79
+ unitId: deliveryUnit.unitId,
80
+ sourceRevision: deliveryUnit.sourceRevision
81
+ };
82
+ }
83
+ const buildModulePath = buildModulePathFor(appDirectory);
84
+ if (!(0, external_node_fs_namespaceObject.existsSync)(buildModulePath)) return {};
85
+ console.warn(`[backend-federation-build] ${buildArtifactPath} missing; falling back to legacy regex parsing of ${buildModulePath}. Regenerate the workspace to emit ${universal_namespaceObject.ULTRAMODERN_BUILD_ARTIFACT_FILE}.`);
86
+ const source = await promises_default().readFile(buildModulePath, 'utf8');
87
+ return {
88
+ appId: source.match(/\bappId:\s*['"]([^'"]+)['"]/u)?.[1],
89
+ buildVersion: source.match(/\bbuild:\s*['"]([^'"]+)['"]/u)?.[1],
90
+ packageName: source.match(/\bpackageName:\s*['"]([^'"]+)['"]/u)?.[1],
91
+ version: source.match(/\bversion:\s*['"]([^'"]+)['"]/u)?.[1],
92
+ unitId: source.match(/\bunitId:\s*['"]([^'"]+)['"]/u)?.[1],
93
+ sourceRevision: source.match(/\bsourceRevision:\s*['"]([^'"]+)['"]/u)?.[1]
94
+ };
95
+ };
96
+ const toPascalCase = (value)=>value.split(/[^a-zA-Z0-9]+/u).filter(Boolean).map((part)=>part.charAt(0).toUpperCase() + part.slice(1)).join('');
97
+ const stringValue = (value)=>'string' == typeof value && value.length > 0 ? value : void 0;
98
+ const createBackendName = (app, id)=>{
99
+ const configuredName = stringValue(app.backendFederation?.name) ?? stringValue(app.backendFederation?.executionSurfaces?.node?.remoteName) ?? stringValue(app.serverExecution?.node?.remoteName);
100
+ if (configuredName) return configuredName;
101
+ const mfName = stringValue(app.moduleFederation?.name);
102
+ return mfName ? `${mfName}Backend` : `vertical${toPascalCase(id)}Backend`;
103
+ };
104
+ const findWorkspaceRoot = (appDirectory)=>{
105
+ let current = appDirectory;
106
+ while(true){
107
+ if ((0, external_node_fs_namespaceObject.existsSync)(external_node_path_default().join(current, COMPACT_CONFIG_PATH))) return current;
108
+ const parent = external_node_path_default().dirname(current);
109
+ if (parent === current) return;
110
+ current = parent;
111
+ }
112
+ };
113
+ const resolveWorkspaceSourceRevision = async (workspaceRoot)=>{
114
+ const envRevision = process.env.ULTRAMODERN_SOURCE_REVISION?.trim();
115
+ if (envRevision) return envRevision;
116
+ try {
117
+ const { stdout } = await execFileAsync('git', [
118
+ '-C',
119
+ workspaceRoot,
120
+ 'rev-parse',
121
+ 'HEAD'
122
+ ]);
123
+ const revision = stdout.trim();
124
+ if (revision.length > 0) return revision;
125
+ } catch {}
126
+ console.warn('[backend-federation-build] Could not resolve git source revision; stamping sourceRevision as "workspace". Set ULTRAMODERN_SOURCE_REVISION to override.');
127
+ return 'workspace';
128
+ };
129
+ const createStampedDeliveryUnit = (input)=>{
130
+ if (!input.unitId || !input.buildMarker || !input.packageName || !input.version) return;
131
+ const record = {
132
+ schemaVersion: universal_namespaceObject.DELIVERY_UNIT_SCHEMA_VERSION,
133
+ kind: universal_namespaceObject.DELIVERY_UNIT_KIND,
134
+ appId: input.appId,
135
+ unitId: input.unitId,
136
+ packageName: input.packageName,
137
+ version: input.version,
138
+ buildMarker: input.buildMarker,
139
+ sourceRevision: input.sourceRevision,
140
+ deployProfile: universal_namespaceObject.DELIVERY_UNIT_DEPLOY_PROFILE
141
+ };
142
+ const validation = (0, universal_namespaceObject.validateDeliveryUnitRecord)(record);
143
+ if (!validation.ok) return;
144
+ return (0, universal_namespaceObject.deliveryUnitContractBlock)(record);
145
+ };
146
+ const createAppFromCompactMetadata = (workspaceRoot, appDirectory, compactApp)=>{
147
+ const id = stringValue(compactApp.id);
148
+ const appPath = stringValue(compactApp.path);
149
+ if (!id || 'vertical' !== compactApp.kind || !isRecord(compactApp.api)) return;
150
+ const directory = appPath ? normalizeRelativePath(appPath) : `verticals/${id}`;
151
+ if (external_node_path_default().resolve(workspaceRoot, directory) !== external_node_path_default().resolve(appDirectory)) return;
152
+ const port = 'number' == typeof compactApp.port ? compactApp.port : void 0;
153
+ if (void 0 === port) return;
154
+ const apiPrefix = stringValue(compactApp.api.prefix) ?? `/${id}-api`;
155
+ const apiStem = stringValue(compactApp.api.stem) ?? id;
156
+ const backendName = createBackendName(compactApp, id);
157
+ const manifestUrl = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.manifestUrl) ?? stringValue(compactApp.serverExecution?.node?.manifestUrl) ?? `http://localhost:${port}/${universal_namespaceObject.BACKEND_FEDERATION_MANIFEST_FILE}`;
158
+ const containerEntry = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.containerEntry) ?? stringValue(compactApp.serverExecution?.node?.containerEntry) ?? `http://localhost:${port}/${universal_namespaceObject.BACKEND_FEDERATION_REMOTE_ENTRY_FILE}`;
159
+ const remoteType = stringValue(compactApp.backendFederation?.executionSurfaces?.node?.remoteType) ?? stringValue(compactApp.serverExecution?.node?.remoteType) ?? 'module';
160
+ const packageName = stringValue(compactApp.package);
161
+ const uiManifestUrl = stringValue(compactApp.backendFederation?.versionBoundary?.ui?.manifestUrl) ?? stringValue(compactApp.moduleFederation?.manifestUrl);
162
+ const compactDeliveryUnit = isRecord(compactApp.deliveryUnit) ? {
163
+ unitId: stringValue(compactApp.deliveryUnit.unitId),
164
+ buildMarker: stringValue(compactApp.deliveryUnit.buildMarker),
165
+ sourceRevision: stringValue(compactApp.deliveryUnit.sourceRevision),
166
+ packageName: stringValue(compactApp.deliveryUnit.packageName),
167
+ version: stringValue(compactApp.deliveryUnit.version)
168
+ } : void 0;
169
+ return {
170
+ id,
171
+ directory,
172
+ packageName,
173
+ port,
174
+ apiPrefix,
175
+ apiStem,
176
+ backendName,
177
+ manifestUrl,
178
+ containerEntry,
179
+ remoteType,
180
+ uiManifestUrl,
181
+ compactDeliveryUnit
182
+ };
183
+ };
184
+ const findBackendFederationApp = async (workspaceRoot, appDirectory)=>{
185
+ const compactConfigPath = external_node_path_default().join(workspaceRoot, COMPACT_CONFIG_PATH);
186
+ const compactConfig = await readJsonFile(compactConfigPath);
187
+ const apps = Array.isArray(compactConfig.topology?.apps) ? compactConfig.topology.apps : [];
188
+ for (const app of apps){
189
+ const resolved = createAppFromCompactMetadata(workspaceRoot, appDirectory, app);
190
+ if (resolved) return resolved;
191
+ }
192
+ };
193
+ exports.COMPACT_CONFIG_PATH = __webpack_exports__.COMPACT_CONFIG_PATH;
194
+ exports.buildArtifactPathFor = __webpack_exports__.buildArtifactPathFor;
195
+ exports.buildModulePathFor = __webpack_exports__.buildModulePathFor;
196
+ exports.createAppFromCompactMetadata = __webpack_exports__.createAppFromCompactMetadata;
197
+ exports.createStampedDeliveryUnit = __webpack_exports__.createStampedDeliveryUnit;
198
+ exports.findBackendFederationApp = __webpack_exports__.findBackendFederationApp;
199
+ exports.findWorkspaceRoot = __webpack_exports__.findWorkspaceRoot;
200
+ exports.normalizeRelativePath = __webpack_exports__.normalizeRelativePath;
201
+ exports.readBuildIdentity = __webpack_exports__.readBuildIdentity;
202
+ exports.resolveWorkspaceSourceRevision = __webpack_exports__.resolveWorkspaceSourceRevision;
203
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
204
+ "COMPACT_CONFIG_PATH",
205
+ "buildArtifactPathFor",
206
+ "buildModulePathFor",
207
+ "createAppFromCompactMetadata",
208
+ "createStampedDeliveryUnit",
209
+ "findBackendFederationApp",
210
+ "findWorkspaceRoot",
211
+ "normalizeRelativePath",
212
+ "readBuildIdentity",
213
+ "resolveWorkspaceSourceRevision"
214
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
215
+ Object.defineProperty(exports, '__esModule', {
216
+ value: true
217
+ });
@@ -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
+ });
@@ -33,18 +33,18 @@ __webpack_require__.d(__webpack_exports__, {
33
33
  resolveDeployTarget: ()=>resolveDeployTarget
34
34
  });
35
35
  const external_std_env_namespaceObject = require("std-env");
36
- const cloudflare_js_namespaceObject = require("./platforms/cloudflare.js");
36
+ const index_js_namespaceObject = require("./platforms/cloudflare/index.js");
37
37
  const gh_pages_js_namespaceObject = require("./platforms/gh-pages.js");
38
38
  const netlify_js_namespaceObject = require("./platforms/netlify.js");
39
39
  const node_js_namespaceObject = require("./platforms/node.js");
40
40
  const vercel_js_namespaceObject = require("./platforms/vercel.js");
41
- const index_js_namespaceObject = require("./utils/index.js");
41
+ const external_utils_index_js_namespaceObject = require("./utils/index.js");
42
42
  const deployPresets = {
43
43
  node: node_js_namespaceObject.createNodePreset,
44
44
  vercel: vercel_js_namespaceObject.createVercelPreset,
45
45
  netlify: netlify_js_namespaceObject.createNetlifyPreset,
46
46
  ghPages: gh_pages_js_namespaceObject.createGhPagesPreset,
47
- cloudflare: cloudflare_js_namespaceObject.createCloudflarePreset
47
+ cloudflare: index_js_namespaceObject.createCloudflarePreset
48
48
  };
49
49
  const getSupportedDeployTargets = ()=>Object.keys(deployPresets);
50
50
  const isDeployTarget = (target)=>Object.prototype.hasOwnProperty.call(deployPresets, target);
@@ -59,7 +59,7 @@ const normalizeDetectedProvider = (value)=>value ? providerDeployTargets[value]
59
59
  const resolveDeployTarget = (modernConfig, envDeployTarget = process.env.MODERNJS_DEPLOY, detectedProvider = external_std_env_namespaceObject.provider)=>modernConfig.deploy?.target || envDeployTarget || normalizeDetectedProvider(detectedProvider) || 'node';
60
60
  async function getDeployPreset(appContext, modernConfig, deployTarget, api) {
61
61
  const { appDirectory, distDirectory, metaName } = appContext;
62
- const { useSSR, useAPI, useWebServer } = (0, index_js_namespaceObject.getProjectUsage)(appDirectory, distDirectory, metaName);
62
+ const { useSSR, useAPI, useWebServer } = (0, external_utils_index_js_namespaceObject.getProjectUsage)(appDirectory, distDirectory, metaName);
63
63
  const needModernServer = useSSR || useAPI || useWebServer;
64
64
  if (!isDeployTarget(deployTarget)) throw new Error(`Unknown deploy target: '${deployTarget}'. deploy.target or MODERNJS_DEPLOY should be one of: ${getSupportedDeployTargets().join(', ')}.`);
65
65
  const createPreset = deployPresets[deployTarget];
@@ -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
+ });