@bleedingdev/modern-js-create 3.4.0-ultramodern.2 → 3.4.0-ultramodern.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -11
- package/dist/cjs/index.cjs +37 -4
- package/dist/cjs/locale/en.cjs +12 -2
- package/dist/cjs/locale/zh.cjs +12 -2
- package/dist/cjs/ultramodern-tooling/commands.cjs +185 -0
- package/dist/cjs/ultramodern-tooling/config.cjs +172 -0
- package/dist/cjs/ultramodern-workspace/add-vertical.cjs +79 -61
- package/dist/cjs/ultramodern-workspace/bridge-config.cjs +327 -0
- package/dist/cjs/ultramodern-workspace/codesmith.cjs +1 -0
- package/dist/cjs/ultramodern-workspace/contracts.cjs +121 -648
- package/dist/cjs/ultramodern-workspace/demo-components.cjs +26 -33
- package/dist/cjs/ultramodern-workspace/descriptors.cjs +4 -4
- package/dist/cjs/ultramodern-workspace/effect-api.cjs +230 -100
- package/dist/cjs/ultramodern-workspace/fs-io.cjs +117 -0
- package/dist/cjs/ultramodern-workspace/generation-result.cjs +1 -1
- package/dist/cjs/ultramodern-workspace/index.cjs +4 -0
- package/dist/cjs/ultramodern-workspace/mf-validation.cjs +571 -0
- package/dist/cjs/ultramodern-workspace/module-federation.cjs +51 -20
- package/dist/cjs/ultramodern-workspace/package-json.cjs +62 -19
- package/dist/cjs/ultramodern-workspace/policy.cjs +2 -2
- package/dist/cjs/ultramodern-workspace/public-api.cjs +4 -0
- package/dist/cjs/ultramodern-workspace/versions.cjs +5 -0
- package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +80 -43
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +63 -20
- package/dist/esm/index.js +37 -4
- package/dist/esm/locale/en.js +12 -2
- package/dist/esm/locale/zh.js +12 -2
- package/dist/esm/ultramodern-tooling/commands.js +132 -0
- package/dist/esm/ultramodern-tooling/config.js +120 -0
- package/dist/esm/ultramodern-workspace/add-vertical.js +81 -66
- package/dist/esm/ultramodern-workspace/bridge-config.js +270 -0
- package/dist/esm/ultramodern-workspace/codesmith.js +1 -0
- package/dist/esm/ultramodern-workspace/contracts.js +124 -603
- package/dist/esm/ultramodern-workspace/demo-components.js +26 -33
- package/dist/esm/ultramodern-workspace/descriptors.js +2 -2
- package/dist/esm/ultramodern-workspace/effect-api.js +230 -100
- package/dist/esm/ultramodern-workspace/fs-io.js +116 -2
- package/dist/esm/ultramodern-workspace/generation-result.js +2 -2
- package/dist/esm/ultramodern-workspace/index.js +1 -0
- package/dist/esm/ultramodern-workspace/mf-validation.js +516 -0
- package/dist/esm/ultramodern-workspace/module-federation.js +49 -21
- package/dist/esm/ultramodern-workspace/package-json.js +60 -20
- package/dist/esm/ultramodern-workspace/policy.js +2 -2
- package/dist/esm/ultramodern-workspace/public-api.js +1 -0
- package/dist/esm/ultramodern-workspace/versions.js +3 -1
- package/dist/esm/ultramodern-workspace/workspace-scripts.js +78 -26
- package/dist/esm/ultramodern-workspace/write-workspace.js +67 -27
- package/dist/esm-node/index.js +37 -4
- package/dist/esm-node/locale/en.js +12 -2
- package/dist/esm-node/locale/zh.js +12 -2
- package/dist/esm-node/ultramodern-tooling/commands.js +133 -0
- package/dist/esm-node/ultramodern-tooling/config.js +121 -0
- package/dist/esm-node/ultramodern-workspace/add-vertical.js +81 -66
- package/dist/esm-node/ultramodern-workspace/bridge-config.js +271 -0
- package/dist/esm-node/ultramodern-workspace/codesmith.js +1 -0
- package/dist/esm-node/ultramodern-workspace/contracts.js +124 -603
- package/dist/esm-node/ultramodern-workspace/demo-components.js +26 -33
- package/dist/esm-node/ultramodern-workspace/descriptors.js +2 -2
- package/dist/esm-node/ultramodern-workspace/effect-api.js +230 -100
- package/dist/esm-node/ultramodern-workspace/fs-io.js +116 -2
- package/dist/esm-node/ultramodern-workspace/generation-result.js +2 -2
- package/dist/esm-node/ultramodern-workspace/index.js +1 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation.js +517 -0
- package/dist/esm-node/ultramodern-workspace/module-federation.js +49 -21
- package/dist/esm-node/ultramodern-workspace/package-json.js +60 -20
- package/dist/esm-node/ultramodern-workspace/policy.js +2 -2
- package/dist/esm-node/ultramodern-workspace/public-api.js +1 -0
- package/dist/esm-node/ultramodern-workspace/versions.js +3 -1
- package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +78 -26
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +67 -27
- package/dist/types/locale/en.d.ts +10 -0
- package/dist/types/locale/index.d.ts +20 -0
- package/dist/types/locale/zh.d.ts +10 -0
- package/dist/types/ultramodern-tooling/commands.d.ts +1 -0
- package/dist/types/ultramodern-tooling/config.d.ts +43 -0
- package/dist/types/ultramodern-workspace/add-vertical.d.ts +5 -2
- package/dist/types/ultramodern-workspace/bridge-config.d.ts +64 -0
- package/dist/types/ultramodern-workspace/codesmith.d.ts +1 -0
- package/dist/types/ultramodern-workspace/contracts.d.ts +2 -17
- package/dist/types/ultramodern-workspace/descriptors.d.ts +1 -1
- package/dist/types/ultramodern-workspace/fs-io.d.ts +1 -0
- package/dist/types/ultramodern-workspace/index.d.ts +2 -0
- package/dist/types/ultramodern-workspace/mf-validation.d.ts +27 -0
- package/dist/types/ultramodern-workspace/module-federation.d.ts +1 -0
- package/dist/types/ultramodern-workspace/package-json.d.ts +5 -3
- package/dist/types/ultramodern-workspace/public-api.d.ts +2 -0
- package/dist/types/ultramodern-workspace/types.d.ts +2 -0
- package/dist/types/ultramodern-workspace/versions.d.ts +2 -0
- package/dist/types/ultramodern-workspace/workspace-scripts.d.ts +2 -7
- package/dist/types/ultramodern-workspace/write-workspace.d.ts +4 -2
- package/package.json +5 -3
- package/template-workspace/{.agents → .codex}/skills-lock.json +12 -12
- package/template-workspace/.gitignore.handlebars +3 -0
- package/template-workspace/AGENTS.md.handlebars +11 -5
- package/template-workspace/README.md.handlebars +15 -12
- package/template-workspace/oxfmt.config.ts +1 -0
- package/template-workspace/oxlint.config.ts +1 -0
- package/template-workspace/patches/@tanstack__router-core@1.171.13.patch +51 -0
- package/template-workspace/pnpm-workspace.yaml.handlebars +12 -0
- package/template-workspace/scripts/bootstrap-agent-skills.mjs +96 -69
- package/templates/app/shell-frame.tsx +1 -2
- package/templates/app/ultramodern-route-head.tsx.handlebars +5 -6
- package/templates/workspace-scripts/assert-mf-types.mjs.handlebars +59 -7
- package/templates/workspace-scripts/check-ultramodern-api-boundaries.mjs +339 -0
- package/templates/workspace-scripts/generate-public-surface-assets.mjs +245 -8
- package/templates/workspace-scripts/proof-cloudflare-version.mjs +276 -8
- package/templates/workspace-scripts/ultramodern-cloudflare-proof.mjs +35 -10
- package/templates/workspace-scripts/ultramodern-performance-readiness.mjs +164 -1
- package/templates/workspace-scripts/ultramodern-typecheck.mjs +4 -2
- package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +949 -63
- /package/template-workspace/{.agents → .codex}/rstackjs-agent-skills-LICENSE +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsbuild-best-practices/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/command-map.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/common-analysis-patterns.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-common.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-rspack.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-webpack.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/rsdoctor-data-types.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rslib-best-practices/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rslib-modern-package/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-best-practices/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/SKILL.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/references/bottlenecks.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/references/tracing-guide.md +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/scripts/analyze_trace.js +0 -0
- /package/template-workspace/{.agents → .codex}/skills/rstest-best-practices/SKILL.md +0 -0
|
@@ -42,6 +42,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
42
42
|
addUltramodernVertical: ()=>addUltramodernVertical,
|
|
43
43
|
assertCanCreate: ()=>assertCanCreate,
|
|
44
44
|
assertValidVerticalName: ()=>assertValidVerticalName,
|
|
45
|
+
existingBridgeConfig: ()=>existingBridgeConfig,
|
|
45
46
|
existingPackageSource: ()=>existingPackageSource,
|
|
46
47
|
existingTailwindEnabled: ()=>existingTailwindEnabled,
|
|
47
48
|
nextAvailablePort: ()=>nextAvailablePort,
|
|
@@ -60,8 +61,8 @@ var external_node_os_default = /*#__PURE__*/ __webpack_require__.n(external_node
|
|
|
60
61
|
const external_node_path_namespaceObject = require("node:path");
|
|
61
62
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
62
63
|
const external_ultramodern_package_source_cjs_namespaceObject = require("../ultramodern-package-source.cjs");
|
|
64
|
+
const config_cjs_namespaceObject = require("../ultramodern-tooling/config.cjs");
|
|
63
65
|
const external_app_files_cjs_namespaceObject = require("./app-files.cjs");
|
|
64
|
-
const external_contracts_cjs_namespaceObject = require("./contracts.cjs");
|
|
65
66
|
const external_demo_components_cjs_namespaceObject = require("./demo-components.cjs");
|
|
66
67
|
const external_descriptors_cjs_namespaceObject = require("./descriptors.cjs");
|
|
67
68
|
const external_effect_api_cjs_namespaceObject = require("./effect-api.cjs");
|
|
@@ -82,7 +83,6 @@ const FIRST_VERTICAL_PORT = 4101;
|
|
|
82
83
|
const TOPOLOGY_PATH = 'topology/reference-topology.json';
|
|
83
84
|
const OWNERSHIP_PATH = 'topology/ownership.json';
|
|
84
85
|
const DEVELOPMENT_OVERLAY_PATH = 'topology/local-overlays/development.json';
|
|
85
|
-
const PACKAGE_SOURCE_METADATA_PATH = '.modernjs/ultramodern-package-source.json';
|
|
86
86
|
function existingPackageSource(workspaceRoot, modernVersion, packageSource) {
|
|
87
87
|
if (packageSource) return (0, external_package_source_cjs_namespaceObject.resolvePackageSource)({
|
|
88
88
|
targetDir: workspaceRoot,
|
|
@@ -90,35 +90,21 @@ function existingPackageSource(workspaceRoot, modernVersion, packageSource) {
|
|
|
90
90
|
modernVersion,
|
|
91
91
|
packageSource
|
|
92
92
|
});
|
|
93
|
-
const
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
});
|
|
99
|
-
const metadata = (0, external_fs_io_cjs_namespaceObject.readJsonFile)(metadataPath);
|
|
100
|
-
const aliases = metadata.modernPackages?.aliases ?? {};
|
|
101
|
-
const firstAlias = Object.values(aliases).find((value)=>'string' == typeof value);
|
|
102
|
-
const firstPackage = Object.keys(aliases)[0];
|
|
103
|
-
const aliasScope = firstAlias?.match(/^@([^/]+)\//)?.[1];
|
|
104
|
-
const unscopedName = firstPackage?.split('/').at(-1) ?? '';
|
|
105
|
-
const aliasUnscopedName = firstAlias?.split('/').at(-1) ?? '';
|
|
106
|
-
const aliasPackageNamePrefix = aliasUnscopedName && unscopedName && aliasUnscopedName.endsWith(unscopedName) ? aliasUnscopedName.slice(0, -unscopedName.length) : void 0;
|
|
107
|
-
return {
|
|
108
|
-
strategy: 'install' === metadata.strategy ? 'install' : 'workspace',
|
|
109
|
-
modernPackageVersion: 'string' == typeof metadata.modernPackages?.specifier ? metadata.modernPackages.specifier : modernVersion,
|
|
110
|
-
registry: metadata.modernPackages?.registry,
|
|
111
|
-
aliasScope,
|
|
112
|
-
aliasPackageNamePrefix
|
|
113
|
-
};
|
|
93
|
+
const compactPath = external_node_path_default().join(workspaceRoot, external_descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH);
|
|
94
|
+
if (external_node_fs_default().existsSync(compactPath)) {
|
|
95
|
+
const compactConfig = (0, config_cjs_namespaceObject.readUltramodernConfig)(workspaceRoot);
|
|
96
|
+
if (compactConfig.packageSource) return compactConfig.packageSource;
|
|
97
|
+
}
|
|
98
|
+
throw new Error(`Missing UltraModern workspace file: ${compactPath}`);
|
|
114
99
|
}
|
|
115
100
|
function existingTailwindEnabled(workspaceRoot) {
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
101
|
+
const compactPath = external_node_path_default().join(workspaceRoot, external_descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH);
|
|
102
|
+
if (external_node_fs_default().existsSync(compactPath)) return (0, config_cjs_namespaceObject.readUltramodernConfig)(workspaceRoot).features.tailwind;
|
|
103
|
+
throw new Error(`Missing UltraModern workspace file: ${compactPath}`);
|
|
104
|
+
}
|
|
105
|
+
function existingBridgeConfig(workspaceRoot) {
|
|
106
|
+
const compactPath = external_node_path_default().join(workspaceRoot, external_descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH);
|
|
107
|
+
return external_node_fs_default().existsSync(compactPath) ? (0, config_cjs_namespaceObject.readUltramodernConfig)(workspaceRoot).bridge : void 0;
|
|
122
108
|
}
|
|
123
109
|
function assertValidVerticalName(name) {
|
|
124
110
|
const normalized = (0, external_naming_cjs_namespaceObject.toKebabCase)(name);
|
|
@@ -132,18 +118,19 @@ function nextAvailablePort(ports) {
|
|
|
132
118
|
function assertCanCreate(workspaceRoot, relativePath) {
|
|
133
119
|
if (external_node_fs_default().existsSync(external_node_path_default().join(workspaceRoot, relativePath))) throw new Error(`Refusing to overwrite existing path: ${relativePath}`);
|
|
134
120
|
}
|
|
135
|
-
function updateRootWorkspaceScripts(workspaceRoot, scope, packageSource, remotes) {
|
|
121
|
+
function updateRootWorkspaceScripts(workspaceRoot, scope, packageSource, remotes, bridge) {
|
|
136
122
|
const packagePath = external_node_path_default().join(workspaceRoot, 'package.json');
|
|
137
123
|
const rootPackage = (0, external_fs_io_cjs_namespaceObject.readJsonFile)(packagePath);
|
|
138
|
-
const generatedRootPackage = (0, external_package_json_cjs_namespaceObject.createRootPackageJson)(scope, packageSource, remotes);
|
|
124
|
+
const generatedRootPackage = (0, external_package_json_cjs_namespaceObject.createRootPackageJson)(scope, packageSource, remotes, bridge);
|
|
139
125
|
rootPackage.scripts = generatedRootPackage.scripts;
|
|
140
126
|
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(packagePath, rootPackage);
|
|
141
127
|
}
|
|
142
|
-
function rewriteShellAppFiles(workspaceRoot, scope, packageSource, enableTailwind, remotes) {
|
|
128
|
+
function rewriteShellAppFiles(workspaceRoot, scope, packageSource, enableTailwind, remotes, bridge) {
|
|
143
129
|
const shellHost = (0, external_descriptors_cjs_namespaceObject.createShellHost)(remotes);
|
|
144
130
|
const publicWeb = (0, external_public_surface_cjs_namespaceObject.createPublicWebAppArtifacts)(shellHost);
|
|
145
|
-
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/package.json`), (0, external_package_json_cjs_namespaceObject.createAppPackage)(scope, shellHost, packageSource, enableTailwind, remotes));
|
|
131
|
+
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/package.json`), (0, external_package_json_cjs_namespaceObject.createAppPackage)(scope, shellHost, packageSource, enableTailwind, remotes, bridge));
|
|
146
132
|
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/tsconfig.json`), (0, external_package_json_cjs_namespaceObject.createAppTsConfig)(shellHost, remotes));
|
|
133
|
+
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/tsconfig.mf-types.json`), (0, external_package_json_cjs_namespaceObject.createAppMfTypesTsConfig)(shellHost));
|
|
147
134
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/src/modern-app-env.d.ts`, (0, external_app_files_cjs_namespaceObject.createAppEnvDts)(shellHost, remotes));
|
|
148
135
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
|
|
149
136
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
|
|
@@ -159,7 +146,7 @@ function rewriteShellAppFiles(workspaceRoot, scope, packageSource, enableTailwin
|
|
|
159
146
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/src/routes/[lang]/page.tsx`, (0, external_demo_components_cjs_namespaceObject.createShellPage)(remotes));
|
|
160
147
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/src/routes/vertical-components.tsx`, (0, external_demo_components_cjs_namespaceObject.createShellRemoteComponents)(scope, remotes));
|
|
161
148
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/src/routes/shell-frame.tsx`, (0, external_app_files_cjs_namespaceObject.createShellFrameComponent)());
|
|
162
|
-
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/src/
|
|
149
|
+
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/src/api/vertical-clients.ts`, (0, external_effect_api_cjs_namespaceObject.createShellEffectClient)(scope, remotes));
|
|
163
150
|
}
|
|
164
151
|
function addShellZephyrDependency(workspaceRoot, scope, remote) {
|
|
165
152
|
const packagePath = external_node_path_default().join(workspaceRoot, external_descriptors_cjs_namespaceObject.shellApp.directory, 'package.json');
|
|
@@ -215,10 +202,11 @@ function verticalsFromTopology(topology, ports) {
|
|
|
215
202
|
return (topology.verticals ?? []).map((vertical)=>{
|
|
216
203
|
const domain = vertical.domain ?? String(vertical.id);
|
|
217
204
|
const packageSuffix = vertical.package?.split('/').at(-1) ?? domain;
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
205
|
+
const apiTopology = vertical.api;
|
|
206
|
+
const effectApi = apiTopology?.runtime === 'effect' ? {
|
|
207
|
+
stem: 'string' == typeof apiTopology.basePath ? apiTopology.basePath.split('/').filter(Boolean).at(-1) ?? domain : domain,
|
|
208
|
+
prefix: apiTopology.bff?.prefix ?? `/${domain}-api`,
|
|
209
|
+
consumedBy: Array.isArray(apiTopology.consumedBy) ? apiTopology.consumedBy : [
|
|
222
210
|
external_descriptors_cjs_namespaceObject.shellApp.id,
|
|
223
211
|
vertical.id
|
|
224
212
|
]
|
|
@@ -260,8 +248,7 @@ function prepareAddUltramodernVertical(options) {
|
|
|
260
248
|
const topology = readRequiredJsonObject(topologyPath);
|
|
261
249
|
const ownership = readRequiredJsonObject(ownershipPath);
|
|
262
250
|
const overlay = readRequiredJsonObject(overlayPath);
|
|
263
|
-
|
|
264
|
-
readRequiredJsonObject(external_node_path_default().join(options.workspaceRoot, PACKAGE_SOURCE_METADATA_PATH));
|
|
251
|
+
readRequiredWorkspaceConfig(options.workspaceRoot);
|
|
265
252
|
assertOptionalJsonObject(topology.shell, 'topology.shell', topologyPath);
|
|
266
253
|
assertOptionalJsonArray(topology.verticals, 'topology.verticals', topologyPath);
|
|
267
254
|
assertOptionalJsonArray(ownership.owners, 'ownership.owners', ownershipPath);
|
|
@@ -272,6 +259,7 @@ function prepareAddUltramodernVertical(options) {
|
|
|
272
259
|
const scope = (0, external_naming_cjs_namespaceObject.toPackageScope)(String(rootPackage.name ?? external_node_path_default().basename(options.workspaceRoot)));
|
|
273
260
|
const packageSource = existingPackageSource(options.workspaceRoot, options.modernVersion, options.packageSource);
|
|
274
261
|
const enableTailwind = options.enableTailwind ?? existingTailwindEnabled(options.workspaceRoot);
|
|
262
|
+
const bridge = existingBridgeConfig(options.workspaceRoot);
|
|
275
263
|
const existingVerticals = verticalsFromTopology(topology, overlay.ports);
|
|
276
264
|
const port = nextAvailablePort(overlay.ports);
|
|
277
265
|
const vertical = (0, external_descriptors_cjs_namespaceObject.createVerticalDescriptor)(name, port);
|
|
@@ -299,6 +287,7 @@ function prepareAddUltramodernVertical(options) {
|
|
|
299
287
|
overlay,
|
|
300
288
|
packageSource,
|
|
301
289
|
enableTailwind,
|
|
290
|
+
bridge,
|
|
302
291
|
vertical,
|
|
303
292
|
updatedVerticals
|
|
304
293
|
};
|
|
@@ -309,6 +298,10 @@ function readRequiredJsonObject(filePath) {
|
|
|
309
298
|
if (!(0, external_types_cjs_namespaceObject.isRecord)(value)) throw new Error(`UltraModern workspace file must contain a JSON object: ${filePath}`);
|
|
310
299
|
return value;
|
|
311
300
|
}
|
|
301
|
+
function readRequiredWorkspaceConfig(workspaceRoot) {
|
|
302
|
+
const compactPath = external_node_path_default().join(workspaceRoot, external_descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH);
|
|
303
|
+
readRequiredJsonObject(compactPath);
|
|
304
|
+
}
|
|
312
305
|
function assertOptionalJsonObject(value, label, filePath) {
|
|
313
306
|
if (void 0 !== value && !(0, external_types_cjs_namespaceObject.isRecord)(value)) throw new Error(`${label} in ${filePath} must be a JSON object`);
|
|
314
307
|
}
|
|
@@ -328,8 +321,8 @@ function validateWorkspaceAppDescriptors(apps) {
|
|
|
328
321
|
if ('number' != typeof app.port || !Number.isFinite(app.port) || app.port <= 0) throw new Error(`Invalid development port for ${appLabel}`);
|
|
329
322
|
assertNonEmptyString(app.mfName, `Module Federation name for ${appLabel}`);
|
|
330
323
|
if (app.effectApi) {
|
|
331
|
-
assertNonEmptyString(app.effectApi.prefix, `
|
|
332
|
-
if (!app.effectApi.prefix.startsWith('/')) throw new Error(`
|
|
324
|
+
assertNonEmptyString(app.effectApi.prefix, `API prefix for ${appLabel}`);
|
|
325
|
+
if (!app.effectApi.prefix.startsWith('/')) throw new Error(`API prefix for ${appLabel} must start with "/"`);
|
|
333
326
|
}
|
|
334
327
|
}
|
|
335
328
|
}
|
|
@@ -339,7 +332,7 @@ function validateUniqueWorkspaceAppDescriptors(apps) {
|
|
|
339
332
|
assertUniqueAppField(apps, 'output path', (app)=>(0, external_naming_cjs_namespaceObject.normalizePath)(app.directory));
|
|
340
333
|
assertUniqueAppField(apps, 'Module Federation name', (app)=>app.mfName);
|
|
341
334
|
assertUniqueAppField(apps, 'development port', (app)=>String(app.port));
|
|
342
|
-
assertUniqueAppField(apps, '
|
|
335
|
+
assertUniqueAppField(apps, 'API prefix', (app)=>app.effectApi?.prefix);
|
|
343
336
|
assertUniqueAppField(apps, 'manifest environment name', (app)=>'vertical' === app.kind ? (0, external_descriptors_cjs_namespaceObject.createRemoteManifestEnv)(app) : void 0);
|
|
344
337
|
}
|
|
345
338
|
function assertUniqueAppField(apps, label, readValue) {
|
|
@@ -413,7 +406,7 @@ function createVerticalPlan(preflight, result) {
|
|
|
413
406
|
shellDependencyChanges: createShellDependencyChanges(scope, vertical),
|
|
414
407
|
generatedContractChanges: [
|
|
415
408
|
{
|
|
416
|
-
path: external_descriptors_cjs_namespaceObject.
|
|
409
|
+
path: external_descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH,
|
|
417
410
|
addedAppIds: [
|
|
418
411
|
vertical.id
|
|
419
412
|
],
|
|
@@ -428,7 +421,7 @@ function createDryRunJsonMutations(preflight, manifestUrl) {
|
|
|
428
421
|
{
|
|
429
422
|
path: DEVELOPMENT_OVERLAY_PATH,
|
|
430
423
|
pointer: `/apis/${vertical.id}`,
|
|
431
|
-
description: `Add local
|
|
424
|
+
description: `Add local API URL for ${vertical.id}`,
|
|
432
425
|
value: `http://localhost:${vertical.port}${(0, external_descriptors_cjs_namespaceObject.effectApiPrefix)(vertical)}`
|
|
433
426
|
}
|
|
434
427
|
] : [];
|
|
@@ -495,9 +488,14 @@ function createDryRunJsonMutations(preflight, manifestUrl) {
|
|
|
495
488
|
description: `Add ${vertical.id} to the shell TS-Go project references`
|
|
496
489
|
},
|
|
497
490
|
{
|
|
498
|
-
path: external_descriptors_cjs_namespaceObject.
|
|
499
|
-
pointer: '/
|
|
500
|
-
description:
|
|
491
|
+
path: `${external_descriptors_cjs_namespaceObject.shellApp.directory}/tsconfig.mf-types.json`,
|
|
492
|
+
pointer: '/include',
|
|
493
|
+
description: 'Keep shell Module Federation DTS compilation scoped'
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
path: external_descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH,
|
|
497
|
+
pointer: '/topology/apps',
|
|
498
|
+
description: `Regenerate compact config with ${vertical.id}`
|
|
501
499
|
}
|
|
502
500
|
];
|
|
503
501
|
}
|
|
@@ -521,8 +519,8 @@ function createShellDependencyChanges(scope, vertical) {
|
|
|
521
519
|
}
|
|
522
520
|
function addUltramodernVertical(options) {
|
|
523
521
|
const beforeFiles = (0, external_generation_result_cjs_namespaceObject.createFileSnapshot)(options.workspaceRoot);
|
|
524
|
-
const { scope, topologyPath, ownershipPath, overlayPath, topology, ownership, overlay, packageSource, enableTailwind, vertical, updatedVerticals } = prepareAddUltramodernVertical(options);
|
|
525
|
-
(0, external_write_workspace_cjs_namespaceObject.writeApp)(options.workspaceRoot, scope, vertical, packageSource, enableTailwind);
|
|
522
|
+
const { scope, topologyPath, ownershipPath, overlayPath, topology, ownership, overlay, packageSource, enableTailwind, bridge, vertical, updatedVerticals } = prepareAddUltramodernVertical(options);
|
|
523
|
+
(0, external_write_workspace_cjs_namespaceObject.writeApp)(options.workspaceRoot, scope, vertical, packageSource, enableTailwind, updatedVerticals, bridge);
|
|
526
524
|
topology.shell ??= {};
|
|
527
525
|
topology.shell.verticalRefs ??= [];
|
|
528
526
|
topology.shell.verticalRefs.push(vertical.id);
|
|
@@ -545,18 +543,18 @@ function addUltramodernVertical(options) {
|
|
|
545
543
|
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(topologyPath, topology);
|
|
546
544
|
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(ownershipPath, ownership);
|
|
547
545
|
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(overlayPath, overlay);
|
|
548
|
-
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(options.workspaceRoot, external_descriptors_cjs_namespaceObject.
|
|
546
|
+
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(options.workspaceRoot, external_descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH), (0, external_write_workspace_cjs_namespaceObject.createCompactUltramodernConfig)(scope, options.modernVersion, packageSource, [
|
|
549
547
|
{
|
|
550
548
|
...external_descriptors_cjs_namespaceObject.shellApp,
|
|
551
549
|
verticalRefs: updatedVerticals.map((vertical)=>vertical.id)
|
|
552
550
|
},
|
|
553
551
|
...updatedVerticals
|
|
554
|
-
], enableTailwind));
|
|
555
|
-
rewriteShellAppFiles(options.workspaceRoot, scope, packageSource, enableTailwind, updatedVerticals);
|
|
552
|
+
], enableTailwind, bridge));
|
|
553
|
+
rewriteShellAppFiles(options.workspaceRoot, scope, packageSource, enableTailwind, updatedVerticals, bridge);
|
|
556
554
|
(0, external_workspace_scripts_cjs_namespaceObject.writeGeneratedWorkspaceScripts)(options.workspaceRoot, scope, enableTailwind, updatedVerticals);
|
|
557
555
|
addShellZephyrDependency(options.workspaceRoot, scope, vertical);
|
|
558
556
|
addShellWorkspaceDependency(options.workspaceRoot, scope, vertical);
|
|
559
|
-
updateRootWorkspaceScripts(options.workspaceRoot, scope, packageSource, updatedVerticals);
|
|
557
|
+
updateRootWorkspaceScripts(options.workspaceRoot, scope, packageSource, updatedVerticals, bridge);
|
|
560
558
|
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(options.workspaceRoot, 'tsconfig.json'), (0, external_package_json_cjs_namespaceObject.createRootTsConfig)([
|
|
561
559
|
{
|
|
562
560
|
...external_descriptors_cjs_namespaceObject.shellApp,
|
|
@@ -564,9 +562,9 @@ function addUltramodernVertical(options) {
|
|
|
564
562
|
},
|
|
565
563
|
...updatedVerticals
|
|
566
564
|
]));
|
|
567
|
-
const
|
|
568
|
-
const
|
|
569
|
-
const
|
|
565
|
+
const preliminaryAfterFiles = (0, external_generation_result_cjs_namespaceObject.createFileSnapshot)(options.workspaceRoot);
|
|
566
|
+
const preliminaryDiff = (0, external_generation_result_cjs_namespaceObject.diffFileSnapshots)(beforeFiles, preliminaryAfterFiles);
|
|
567
|
+
const preliminaryResult = (0, external_generation_result_cjs_namespaceObject.createGenerationResult)({
|
|
570
568
|
operation: 'vertical',
|
|
571
569
|
workspaceRoot: options.workspaceRoot,
|
|
572
570
|
packageScope: scope,
|
|
@@ -574,21 +572,40 @@ function addUltramodernVertical(options) {
|
|
|
574
572
|
createdApps: [
|
|
575
573
|
vertical
|
|
576
574
|
],
|
|
577
|
-
createdPaths,
|
|
578
|
-
rewrittenPaths
|
|
575
|
+
createdPaths: preliminaryDiff.createdPaths,
|
|
576
|
+
rewrittenPaths: preliminaryDiff.rewrittenPaths
|
|
579
577
|
});
|
|
580
578
|
(0, external_overlays_cjs_namespaceObject.runCodeSmithOverlays)({
|
|
581
579
|
workspaceRoot: options.workspaceRoot,
|
|
582
580
|
overlays: options.overlays,
|
|
583
|
-
result
|
|
581
|
+
result: preliminaryResult
|
|
582
|
+
});
|
|
583
|
+
const afterOverlaysFiles = (0, external_generation_result_cjs_namespaceObject.createFileSnapshot)(options.workspaceRoot);
|
|
584
|
+
const changedPaths = (0, external_generation_result_cjs_namespaceObject.diffFileSnapshots)(beforeFiles, afterOverlaysFiles);
|
|
585
|
+
(0, external_fs_io_cjs_namespaceObject.formatGeneratedWorkspaceFiles)(options.workspaceRoot, [
|
|
586
|
+
...changedPaths.createdPaths,
|
|
587
|
+
...changedPaths.rewrittenPaths
|
|
588
|
+
]);
|
|
589
|
+
const afterFiles = (0, external_generation_result_cjs_namespaceObject.createFileSnapshot)(options.workspaceRoot);
|
|
590
|
+
const { createdPaths, rewrittenPaths } = (0, external_generation_result_cjs_namespaceObject.diffFileSnapshots)(beforeFiles, afterFiles);
|
|
591
|
+
return (0, external_generation_result_cjs_namespaceObject.createGenerationResult)({
|
|
592
|
+
operation: 'vertical',
|
|
593
|
+
workspaceRoot: options.workspaceRoot,
|
|
594
|
+
packageScope: scope,
|
|
595
|
+
packageSource,
|
|
596
|
+
createdApps: [
|
|
597
|
+
vertical
|
|
598
|
+
],
|
|
599
|
+
createdPaths,
|
|
600
|
+
rewrittenPaths
|
|
584
601
|
});
|
|
585
|
-
return result;
|
|
586
602
|
}
|
|
587
603
|
exports.addShellWorkspaceDependency = __webpack_exports__.addShellWorkspaceDependency;
|
|
588
604
|
exports.addShellZephyrDependency = __webpack_exports__.addShellZephyrDependency;
|
|
589
605
|
exports.addUltramodernVertical = __webpack_exports__.addUltramodernVertical;
|
|
590
606
|
exports.assertCanCreate = __webpack_exports__.assertCanCreate;
|
|
591
607
|
exports.assertValidVerticalName = __webpack_exports__.assertValidVerticalName;
|
|
608
|
+
exports.existingBridgeConfig = __webpack_exports__.existingBridgeConfig;
|
|
592
609
|
exports.existingPackageSource = __webpack_exports__.existingPackageSource;
|
|
593
610
|
exports.existingTailwindEnabled = __webpack_exports__.existingTailwindEnabled;
|
|
594
611
|
exports.nextAvailablePort = __webpack_exports__.nextAvailablePort;
|
|
@@ -605,6 +622,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
605
622
|
"addUltramodernVertical",
|
|
606
623
|
"assertCanCreate",
|
|
607
624
|
"assertValidVerticalName",
|
|
625
|
+
"existingBridgeConfig",
|
|
608
626
|
"existingPackageSource",
|
|
609
627
|
"existingTailwindEnabled",
|
|
610
628
|
"nextAvailablePort",
|
|
@@ -0,0 +1,327 @@
|
|
|
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
|
+
const ultramodernBridgeCliFlags = {
|
|
31
|
+
enabled: '--bridge',
|
|
32
|
+
parentRoot: '--bridge-parent-root',
|
|
33
|
+
workspacePackage: '--bridge-workspace-package',
|
|
34
|
+
workspacePackageName: '--bridge-workspace-package-name',
|
|
35
|
+
testAlias: '--bridge-test-alias',
|
|
36
|
+
dependency: '--bridge-dependency',
|
|
37
|
+
lockfilePolicy: '--bridge-lockfile-policy',
|
|
38
|
+
gate: '--bridge-gate',
|
|
39
|
+
gateCwd: '--bridge-gate-cwd',
|
|
40
|
+
reactSingleton: '--bridge-react-singleton'
|
|
41
|
+
};
|
|
42
|
+
const ultramodernBridgeCliValueFlags = [
|
|
43
|
+
ultramodernBridgeCliFlags.parentRoot,
|
|
44
|
+
ultramodernBridgeCliFlags.workspacePackage,
|
|
45
|
+
ultramodernBridgeCliFlags.workspacePackageName,
|
|
46
|
+
ultramodernBridgeCliFlags.testAlias,
|
|
47
|
+
ultramodernBridgeCliFlags.dependency,
|
|
48
|
+
ultramodernBridgeCliFlags.lockfilePolicy,
|
|
49
|
+
ultramodernBridgeCliFlags.gate,
|
|
50
|
+
ultramodernBridgeCliFlags.gateCwd,
|
|
51
|
+
ultramodernBridgeCliFlags.reactSingleton
|
|
52
|
+
];
|
|
53
|
+
const ultramodernBridgeCliBooleanFlags = [
|
|
54
|
+
ultramodernBridgeCliFlags.enabled
|
|
55
|
+
];
|
|
56
|
+
const ultramodernBridgeLockfilePolicies = [
|
|
57
|
+
'nested',
|
|
58
|
+
'parent'
|
|
59
|
+
];
|
|
60
|
+
const defaultReactSingletons = [
|
|
61
|
+
'react',
|
|
62
|
+
'react-dom'
|
|
63
|
+
];
|
|
64
|
+
function hasUltramodernBridgeCliOptions(args) {
|
|
65
|
+
return args.some((arg)=>[
|
|
66
|
+
...ultramodernBridgeCliBooleanFlags,
|
|
67
|
+
...ultramodernBridgeCliValueFlags
|
|
68
|
+
].some((flag)=>arg === flag || arg.startsWith(`${flag}=`)));
|
|
69
|
+
}
|
|
70
|
+
function parseUltramodernBridgeCliOptions(args) {
|
|
71
|
+
rejectBooleanFlagValues(args);
|
|
72
|
+
if (!hasUltramodernBridgeCliOptions(args)) return;
|
|
73
|
+
const parentRoot = readSingleValue(args, ultramodernBridgeCliFlags.parentRoot);
|
|
74
|
+
const lockfilePolicy = readSingleValue(args, ultramodernBridgeCliFlags.lockfilePolicy) ?? 'nested';
|
|
75
|
+
const workspacePackages = readWorkspacePackages(args);
|
|
76
|
+
const gates = readBridgeGates(args);
|
|
77
|
+
const reactSingletons = readCsvOptionValues(args, ultramodernBridgeCliFlags.reactSingleton);
|
|
78
|
+
return normalizeUltramodernBridgeConfig({
|
|
79
|
+
enabled: true,
|
|
80
|
+
parentRoot: requireNonEmptyValue(parentRoot, ultramodernBridgeCliFlags.parentRoot),
|
|
81
|
+
workspacePackages,
|
|
82
|
+
dependencies: readCsvOptionValues(args, ultramodernBridgeCliFlags.dependency),
|
|
83
|
+
lockfilePolicy: parseLockfilePolicy(lockfilePolicy),
|
|
84
|
+
gates,
|
|
85
|
+
reactSingletons: reactSingletons.length > 0 ? reactSingletons : void 0
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function normalizeUltramodernBridgeConfig(bridge) {
|
|
89
|
+
if (!bridge || false === bridge.enabled) return;
|
|
90
|
+
const parentRoot = requireNonEmptyValue(bridge.parentRoot, 'bridge.parentRoot');
|
|
91
|
+
const workspacePackages = normalizeWorkspacePackages(bridge.workspacePackages);
|
|
92
|
+
const dependencies = uniqueNonEmptyValues(bridge.dependencies, 'bridge.dependencies');
|
|
93
|
+
const gates = normalizeBridgeGates(bridge.gates);
|
|
94
|
+
const reactSingletons = bridge.reactSingletons && bridge.reactSingletons.length > 0 ? uniqueNonEmptyValues(bridge.reactSingletons, 'bridge.reactSingletons') : [
|
|
95
|
+
...defaultReactSingletons
|
|
96
|
+
];
|
|
97
|
+
if (0 === workspacePackages.length) throw new Error('Bridge mode requires at least one bridge.workspacePackages entry.');
|
|
98
|
+
if (0 === dependencies.length) throw new Error('Bridge mode requires at least one explicit bridge.dependencies package name.');
|
|
99
|
+
if (0 === gates.length) throw new Error('Bridge mode requires at least one bridge.gates delegated parent command.');
|
|
100
|
+
validateParentPackageCoverage(workspacePackages, dependencies);
|
|
101
|
+
validateReactSingletons(reactSingletons);
|
|
102
|
+
return {
|
|
103
|
+
enabled: true,
|
|
104
|
+
parentRoot,
|
|
105
|
+
workspacePackages,
|
|
106
|
+
dependencies,
|
|
107
|
+
lockfilePolicy: parseLockfilePolicy(bridge.lockfilePolicy ?? 'nested'),
|
|
108
|
+
gates,
|
|
109
|
+
reactSingletons
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function rejectBooleanFlagValues(args) {
|
|
113
|
+
for (const flag of ultramodernBridgeCliBooleanFlags)if (args.some((arg)=>arg.startsWith(`${flag}=`))) throw new Error(`${flag} does not accept a value.`);
|
|
114
|
+
}
|
|
115
|
+
function readRepeatedOptionValues(args, flag) {
|
|
116
|
+
const values = [];
|
|
117
|
+
for(let index = 0; index < args.length; index++){
|
|
118
|
+
const arg = args[index];
|
|
119
|
+
if (arg === flag) {
|
|
120
|
+
const value = args[index + 1];
|
|
121
|
+
if (!value || value.startsWith('-')) throw new Error(`${flag} requires a value.`);
|
|
122
|
+
values.push(value);
|
|
123
|
+
index += 1;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (arg.startsWith(`${flag}=`)) values.push(arg.slice(flag.length + 1));
|
|
127
|
+
}
|
|
128
|
+
return values;
|
|
129
|
+
}
|
|
130
|
+
function readSingleValue(args, flag) {
|
|
131
|
+
const values = readRepeatedOptionValues(args, flag);
|
|
132
|
+
if (values.length > 1) throw new Error(`${flag} can be provided only once.`);
|
|
133
|
+
return values[0];
|
|
134
|
+
}
|
|
135
|
+
function readCsvOptionValues(args, flag) {
|
|
136
|
+
return readRepeatedOptionValues(args, flag).flatMap((value)=>value.split(',').map((entry)=>entry.trim()).filter(Boolean));
|
|
137
|
+
}
|
|
138
|
+
function requireNonEmptyValue(value, label) {
|
|
139
|
+
if ('string' != typeof value || 0 === value.trim().length) throw new Error(`${label} must be a non-empty string.`);
|
|
140
|
+
return value.trim();
|
|
141
|
+
}
|
|
142
|
+
function parseLockfilePolicy(value) {
|
|
143
|
+
if (!ultramodernBridgeLockfilePolicies.includes(value)) throw new Error(`${ultramodernBridgeCliFlags.lockfilePolicy} must be "nested" or "parent".`);
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
function readWorkspacePackages(args) {
|
|
147
|
+
const drafts = new Map();
|
|
148
|
+
const getDraft = (pattern)=>{
|
|
149
|
+
const normalizedPattern = requireNonEmptyValue(pattern, ultramodernBridgeCliFlags.workspacePackage);
|
|
150
|
+
const existing = drafts.get(normalizedPattern);
|
|
151
|
+
if (existing) return existing;
|
|
152
|
+
const draft = {
|
|
153
|
+
pattern: normalizedPattern,
|
|
154
|
+
packageNames: [],
|
|
155
|
+
testAliases: []
|
|
156
|
+
};
|
|
157
|
+
drafts.set(normalizedPattern, draft);
|
|
158
|
+
return draft;
|
|
159
|
+
};
|
|
160
|
+
for (const pattern of readRepeatedOptionValues(args, ultramodernBridgeCliFlags.workspacePackage))getDraft(pattern);
|
|
161
|
+
for (const value of readRepeatedOptionValues(args, ultramodernBridgeCliFlags.workspacePackageName)){
|
|
162
|
+
const { left: pattern, right: packageNames } = splitAssignment(value, ultramodernBridgeCliFlags.workspacePackageName, '<pattern>=<package-name>[,<package-name>]');
|
|
163
|
+
getDraft(pattern).packageNames.push(...packageNames.split(',').map((packageName)=>packageName.trim()).filter(Boolean));
|
|
164
|
+
}
|
|
165
|
+
for (const value of readRepeatedOptionValues(args, ultramodernBridgeCliFlags.testAlias)){
|
|
166
|
+
const separator = value.indexOf(':');
|
|
167
|
+
if (-1 === separator) throw new Error(`${ultramodernBridgeCliFlags.testAlias} must use <pattern>:<alias>=<target>.`);
|
|
168
|
+
const pattern = value.slice(0, separator);
|
|
169
|
+
const aliasDefinition = value.slice(separator + 1);
|
|
170
|
+
const { left: alias, right: target } = splitAssignment(aliasDefinition, ultramodernBridgeCliFlags.testAlias, '<pattern>:<alias>=<target>');
|
|
171
|
+
getDraft(pattern).testAliases.push({
|
|
172
|
+
alias: requireNonEmptyValue(alias, `${ultramodernBridgeCliFlags.testAlias} alias`),
|
|
173
|
+
target: requireNonEmptyValue(target, `${ultramodernBridgeCliFlags.testAlias} target`)
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return normalizeWorkspacePackages([
|
|
177
|
+
...drafts.values()
|
|
178
|
+
]);
|
|
179
|
+
}
|
|
180
|
+
function readBridgeGates(args) {
|
|
181
|
+
const gates = new Map();
|
|
182
|
+
const getGate = (name)=>{
|
|
183
|
+
const normalizedName = requireNonEmptyValue(name, `${ultramodernBridgeCliFlags.gate} name`);
|
|
184
|
+
const existing = gates.get(normalizedName);
|
|
185
|
+
if (existing) return existing;
|
|
186
|
+
const draft = {
|
|
187
|
+
name: normalizedName
|
|
188
|
+
};
|
|
189
|
+
gates.set(normalizedName, draft);
|
|
190
|
+
return draft;
|
|
191
|
+
};
|
|
192
|
+
for (const value of readRepeatedOptionValues(args, ultramodernBridgeCliFlags.gate)){
|
|
193
|
+
const { left: name, right: command } = splitAssignment(value, ultramodernBridgeCliFlags.gate, '<name>=<command>');
|
|
194
|
+
getGate(name).command = requireNonEmptyValue(command, `${ultramodernBridgeCliFlags.gate} command`);
|
|
195
|
+
}
|
|
196
|
+
for (const value of readRepeatedOptionValues(args, ultramodernBridgeCliFlags.gateCwd)){
|
|
197
|
+
const { left: name, right: cwd } = splitAssignment(value, ultramodernBridgeCliFlags.gateCwd, '<name>=<cwd>');
|
|
198
|
+
getGate(name).cwd = requireNonEmptyValue(cwd, `${ultramodernBridgeCliFlags.gateCwd} cwd`);
|
|
199
|
+
}
|
|
200
|
+
const missingCommand = [
|
|
201
|
+
...gates.values()
|
|
202
|
+
].find((gate)=>!gate.command);
|
|
203
|
+
if (missingCommand) throw new Error(`${ultramodernBridgeCliFlags.gateCwd} references "${missingCommand.name}" without a matching ${ultramodernBridgeCliFlags.gate}.`);
|
|
204
|
+
return normalizeBridgeGates([
|
|
205
|
+
...gates.values()
|
|
206
|
+
].map((gate)=>({
|
|
207
|
+
name: gate.name,
|
|
208
|
+
command: gate.command,
|
|
209
|
+
cwd: gate.cwd
|
|
210
|
+
})));
|
|
211
|
+
}
|
|
212
|
+
function splitAssignment(value, flag, usage) {
|
|
213
|
+
const separator = value.indexOf('=');
|
|
214
|
+
if (-1 === separator) throw new Error(`${flag} must use ${usage}.`);
|
|
215
|
+
return {
|
|
216
|
+
left: value.slice(0, separator),
|
|
217
|
+
right: value.slice(separator + 1)
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function normalizeWorkspacePackages(workspacePackages) {
|
|
221
|
+
return workspacePackages.map((entry, index)=>{
|
|
222
|
+
const label = `bridge.workspacePackages[${index}]`;
|
|
223
|
+
const packageNames = entry.packageNames && entry.packageNames.length > 0 ? uniqueNonEmptyValues(entry.packageNames, `${label}.packageNames`) : void 0;
|
|
224
|
+
const testAliases = entry.testAliases && entry.testAliases.length > 0 ? normalizeTestAliases(entry.testAliases, label) : void 0;
|
|
225
|
+
return {
|
|
226
|
+
pattern: requireNonEmptyValue(entry.pattern, `${label}.pattern`),
|
|
227
|
+
...packageNames ? {
|
|
228
|
+
packageNames
|
|
229
|
+
} : {},
|
|
230
|
+
...testAliases ? {
|
|
231
|
+
testAliases
|
|
232
|
+
} : {}
|
|
233
|
+
};
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function validateParentPackageCoverage(workspacePackages, dependencies) {
|
|
237
|
+
const declaredPackages = new Set();
|
|
238
|
+
for (const [index, entry] of workspacePackages.entries()){
|
|
239
|
+
const label = `bridge.workspacePackages[${index}]`;
|
|
240
|
+
const packageNames = entry.packageNames ?? [];
|
|
241
|
+
if (0 === packageNames.length && (entry.testAliases ?? []).length > 0) throw new Error(`${label}.packageNames must declare the parent package names covered by "${entry.pattern}" before testAliases can be checked.`);
|
|
242
|
+
for (const packageName of packageNames)declaredPackages.add(packageName);
|
|
243
|
+
for (const alias of entry.testAliases ?? []){
|
|
244
|
+
if (!packageNames.some((packageName)=>aliasMatchesPackage(alias.alias, packageName))) throw new Error(`${label}.testAliases entry "${alias.alias}" must match one of ${label}.packageNames.`);
|
|
245
|
+
if (pointsAtBuildOutput(alias.target)) throw new Error(`${label}.testAliases target "${alias.target}" must point at source files, not dist output.`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const missingDependencies = dependencies.filter((dependency)=>!declaredPackages.has(dependency));
|
|
249
|
+
if (declaredPackages.size > 0 && missingDependencies.length > 0) throw new Error(`Bridge mode dependencies must be declared by bridge.workspacePackages[].packageNames: ${missingDependencies.join(', ')}.`);
|
|
250
|
+
}
|
|
251
|
+
function aliasMatchesPackage(alias, packageName) {
|
|
252
|
+
return alias === packageName || alias.startsWith(`${packageName}/`);
|
|
253
|
+
}
|
|
254
|
+
function pointsAtBuildOutput(target) {
|
|
255
|
+
return target.split(/[\\/]/u).includes('dist');
|
|
256
|
+
}
|
|
257
|
+
function validateReactSingletons(reactSingletons) {
|
|
258
|
+
const missing = defaultReactSingletons.filter((packageName)=>!reactSingletons.includes(packageName));
|
|
259
|
+
if (missing.length > 0) throw new Error(`Bridge mode React singleton/dedupe declarations must include ${defaultReactSingletons.join(' and ')}. Missing: ${missing.join(', ')}.`);
|
|
260
|
+
}
|
|
261
|
+
function normalizeTestAliases(testAliases, parentLabel) {
|
|
262
|
+
const aliases = new Map();
|
|
263
|
+
for (const [index, alias] of testAliases.entries()){
|
|
264
|
+
const label = `${parentLabel}.testAliases[${index}]`;
|
|
265
|
+
const normalizedAlias = requireNonEmptyValue(alias.alias, `${label}.alias`);
|
|
266
|
+
aliases.set(normalizedAlias, {
|
|
267
|
+
alias: normalizedAlias,
|
|
268
|
+
target: requireNonEmptyValue(alias.target, `${label}.target`)
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
return [
|
|
272
|
+
...aliases.values()
|
|
273
|
+
];
|
|
274
|
+
}
|
|
275
|
+
function normalizeBridgeGates(gates) {
|
|
276
|
+
const normalized = new Map();
|
|
277
|
+
for (const [index, gate] of gates.entries()){
|
|
278
|
+
const label = `bridge.gates[${index}]`;
|
|
279
|
+
const name = requireNonEmptyValue(gate.name, `${label}.name`);
|
|
280
|
+
normalized.set(name, {
|
|
281
|
+
name,
|
|
282
|
+
command: requireNonEmptyValue(gate.command, `${label}.command`),
|
|
283
|
+
...gate.cwd ? {
|
|
284
|
+
cwd: requireNonEmptyValue(gate.cwd, `${label}.cwd`)
|
|
285
|
+
} : {}
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
return [
|
|
289
|
+
...normalized.values()
|
|
290
|
+
];
|
|
291
|
+
}
|
|
292
|
+
function uniqueNonEmptyValues(values, label) {
|
|
293
|
+
const unique = new Set();
|
|
294
|
+
for (const [index, value] of values.entries())unique.add(requireNonEmptyValue(value, `${label}[${index}]`));
|
|
295
|
+
return [
|
|
296
|
+
...unique
|
|
297
|
+
];
|
|
298
|
+
}
|
|
299
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
300
|
+
hasUltramodernBridgeCliOptions: ()=>hasUltramodernBridgeCliOptions,
|
|
301
|
+
normalizeUltramodernBridgeConfig: ()=>normalizeUltramodernBridgeConfig,
|
|
302
|
+
parseUltramodernBridgeCliOptions: ()=>parseUltramodernBridgeCliOptions
|
|
303
|
+
}, {
|
|
304
|
+
ultramodernBridgeCliBooleanFlags: ultramodernBridgeCliBooleanFlags,
|
|
305
|
+
ultramodernBridgeCliFlags: ultramodernBridgeCliFlags,
|
|
306
|
+
ultramodernBridgeCliValueFlags: ultramodernBridgeCliValueFlags,
|
|
307
|
+
ultramodernBridgeLockfilePolicies: ultramodernBridgeLockfilePolicies
|
|
308
|
+
});
|
|
309
|
+
exports.hasUltramodernBridgeCliOptions = __webpack_exports__.hasUltramodernBridgeCliOptions;
|
|
310
|
+
exports.normalizeUltramodernBridgeConfig = __webpack_exports__.normalizeUltramodernBridgeConfig;
|
|
311
|
+
exports.parseUltramodernBridgeCliOptions = __webpack_exports__.parseUltramodernBridgeCliOptions;
|
|
312
|
+
exports.ultramodernBridgeCliBooleanFlags = __webpack_exports__.ultramodernBridgeCliBooleanFlags;
|
|
313
|
+
exports.ultramodernBridgeCliFlags = __webpack_exports__.ultramodernBridgeCliFlags;
|
|
314
|
+
exports.ultramodernBridgeCliValueFlags = __webpack_exports__.ultramodernBridgeCliValueFlags;
|
|
315
|
+
exports.ultramodernBridgeLockfilePolicies = __webpack_exports__.ultramodernBridgeLockfilePolicies;
|
|
316
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
317
|
+
"hasUltramodernBridgeCliOptions",
|
|
318
|
+
"normalizeUltramodernBridgeConfig",
|
|
319
|
+
"parseUltramodernBridgeCliOptions",
|
|
320
|
+
"ultramodernBridgeCliBooleanFlags",
|
|
321
|
+
"ultramodernBridgeCliFlags",
|
|
322
|
+
"ultramodernBridgeCliValueFlags",
|
|
323
|
+
"ultramodernBridgeLockfilePolicies"
|
|
324
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
325
|
+
Object.defineProperty(exports, '__esModule', {
|
|
326
|
+
value: true
|
|
327
|
+
});
|