@bleedingdev/modern-js-create 3.4.0-ultramodern.9 → 3.5.0-ultramodern.1

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 (135) hide show
  1. package/README.md +49 -23
  2. package/dist/cjs/index.cjs +37 -4
  3. package/dist/cjs/locale/en.cjs +12 -2
  4. package/dist/cjs/locale/zh.cjs +12 -2
  5. package/dist/cjs/ultramodern-tooling/commands.cjs +431 -0
  6. package/dist/cjs/ultramodern-tooling/config.cjs +172 -0
  7. package/dist/cjs/ultramodern-workspace/add-vertical.cjs +87 -75
  8. package/dist/cjs/ultramodern-workspace/{effect-api.cjs → api.cjs} +207 -208
  9. package/dist/cjs/ultramodern-workspace/bridge-config.cjs +327 -0
  10. package/dist/cjs/ultramodern-workspace/codesmith.cjs +1 -0
  11. package/dist/cjs/ultramodern-workspace/contracts.cjs +128 -657
  12. package/dist/cjs/ultramodern-workspace/demo-components.cjs +12 -12
  13. package/dist/cjs/ultramodern-workspace/descriptors.cjs +25 -25
  14. package/dist/cjs/ultramodern-workspace/fs-io.cjs +117 -0
  15. package/dist/cjs/ultramodern-workspace/generation-result.cjs +5 -5
  16. package/dist/cjs/ultramodern-workspace/index.cjs +4 -0
  17. package/dist/cjs/ultramodern-workspace/mf-validation.cjs +571 -0
  18. package/dist/cjs/ultramodern-workspace/module-federation.cjs +39 -12
  19. package/dist/cjs/ultramodern-workspace/overlays.cjs +2 -2
  20. package/dist/cjs/ultramodern-workspace/package-json.cjs +58 -41
  21. package/dist/cjs/ultramodern-workspace/policy.cjs +4 -4
  22. package/dist/cjs/ultramodern-workspace/public-api.cjs +4 -0
  23. package/dist/cjs/ultramodern-workspace/public-surface.cjs +2 -2
  24. package/dist/cjs/ultramodern-workspace/versions.cjs +15 -0
  25. package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +120 -50
  26. package/dist/cjs/ultramodern-workspace/write-workspace.cjs +64 -21
  27. package/dist/esm/index.js +37 -4
  28. package/dist/esm/locale/en.js +12 -2
  29. package/dist/esm/locale/zh.js +12 -2
  30. package/dist/esm/ultramodern-tooling/commands.js +378 -0
  31. package/dist/esm/ultramodern-tooling/config.js +120 -0
  32. package/dist/esm/ultramodern-workspace/add-vertical.js +88 -79
  33. package/dist/esm/ultramodern-workspace/{effect-api.js → api.js} +146 -147
  34. package/dist/esm/ultramodern-workspace/bridge-config.js +270 -0
  35. package/dist/esm/ultramodern-workspace/codesmith.js +1 -0
  36. package/dist/esm/ultramodern-workspace/contracts.js +130 -611
  37. package/dist/esm/ultramodern-workspace/demo-components.js +13 -13
  38. package/dist/esm/ultramodern-workspace/descriptors.js +11 -11
  39. package/dist/esm/ultramodern-workspace/fs-io.js +116 -2
  40. package/dist/esm/ultramodern-workspace/generation-result.js +6 -6
  41. package/dist/esm/ultramodern-workspace/index.js +1 -0
  42. package/dist/esm/ultramodern-workspace/mf-validation.js +516 -0
  43. package/dist/esm/ultramodern-workspace/module-federation.js +40 -13
  44. package/dist/esm/ultramodern-workspace/overlays.js +2 -2
  45. package/dist/esm/ultramodern-workspace/package-json.js +57 -40
  46. package/dist/esm/ultramodern-workspace/policy.js +5 -5
  47. package/dist/esm/ultramodern-workspace/public-api.js +1 -0
  48. package/dist/esm/ultramodern-workspace/public-surface.js +2 -2
  49. package/dist/esm/ultramodern-workspace/versions.js +7 -1
  50. package/dist/esm/ultramodern-workspace/workspace-scripts.js +108 -34
  51. package/dist/esm/ultramodern-workspace/write-workspace.js +66 -26
  52. package/dist/esm-node/index.js +37 -4
  53. package/dist/esm-node/locale/en.js +12 -2
  54. package/dist/esm-node/locale/zh.js +12 -2
  55. package/dist/esm-node/ultramodern-tooling/commands.js +379 -0
  56. package/dist/esm-node/ultramodern-tooling/config.js +121 -0
  57. package/dist/esm-node/ultramodern-workspace/add-vertical.js +88 -79
  58. package/dist/esm-node/ultramodern-workspace/{effect-api.js → api.js} +146 -147
  59. package/dist/esm-node/ultramodern-workspace/bridge-config.js +271 -0
  60. package/dist/esm-node/ultramodern-workspace/codesmith.js +1 -0
  61. package/dist/esm-node/ultramodern-workspace/contracts.js +130 -611
  62. package/dist/esm-node/ultramodern-workspace/demo-components.js +13 -13
  63. package/dist/esm-node/ultramodern-workspace/descriptors.js +11 -11
  64. package/dist/esm-node/ultramodern-workspace/fs-io.js +116 -2
  65. package/dist/esm-node/ultramodern-workspace/generation-result.js +6 -6
  66. package/dist/esm-node/ultramodern-workspace/index.js +1 -0
  67. package/dist/esm-node/ultramodern-workspace/mf-validation.js +517 -0
  68. package/dist/esm-node/ultramodern-workspace/module-federation.js +40 -13
  69. package/dist/esm-node/ultramodern-workspace/overlays.js +2 -2
  70. package/dist/esm-node/ultramodern-workspace/package-json.js +57 -40
  71. package/dist/esm-node/ultramodern-workspace/policy.js +5 -5
  72. package/dist/esm-node/ultramodern-workspace/public-api.js +1 -0
  73. package/dist/esm-node/ultramodern-workspace/public-surface.js +2 -2
  74. package/dist/esm-node/ultramodern-workspace/versions.js +7 -1
  75. package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +108 -34
  76. package/dist/esm-node/ultramodern-workspace/write-workspace.js +66 -26
  77. package/dist/types/locale/en.d.ts +10 -0
  78. package/dist/types/locale/index.d.ts +20 -0
  79. package/dist/types/locale/zh.d.ts +10 -0
  80. package/dist/types/ultramodern-tooling/commands.d.ts +1 -0
  81. package/dist/types/ultramodern-tooling/config.d.ts +43 -0
  82. package/dist/types/ultramodern-workspace/add-vertical.d.ts +5 -2
  83. package/dist/types/ultramodern-workspace/api.d.ts +73 -0
  84. package/dist/types/ultramodern-workspace/bridge-config.d.ts +64 -0
  85. package/dist/types/ultramodern-workspace/codesmith.d.ts +1 -0
  86. package/dist/types/ultramodern-workspace/contracts.d.ts +2 -17
  87. package/dist/types/ultramodern-workspace/descriptors.d.ts +10 -10
  88. package/dist/types/ultramodern-workspace/fs-io.d.ts +1 -0
  89. package/dist/types/ultramodern-workspace/index.d.ts +2 -0
  90. package/dist/types/ultramodern-workspace/mf-validation.d.ts +27 -0
  91. package/dist/types/ultramodern-workspace/package-json.d.ts +5 -4
  92. package/dist/types/ultramodern-workspace/public-api.d.ts +2 -0
  93. package/dist/types/ultramodern-workspace/types.d.ts +9 -7
  94. package/dist/types/ultramodern-workspace/versions.d.ts +6 -0
  95. package/dist/types/ultramodern-workspace/workspace-scripts.d.ts +2 -7
  96. package/dist/types/ultramodern-workspace/write-workspace.d.ts +4 -2
  97. package/package.json +5 -3
  98. package/template-workspace/{.agents → .codex}/skills-lock.json +12 -12
  99. package/template-workspace/.github/workflows/ultramodern-workspace-gates.yml.handlebars +2 -0
  100. package/template-workspace/.gitignore.handlebars +3 -0
  101. package/template-workspace/AGENTS.md.handlebars +11 -5
  102. package/template-workspace/README.md.handlebars +55 -13
  103. package/template-workspace/oxfmt.config.ts +1 -0
  104. package/template-workspace/oxlint.config.ts +1 -0
  105. package/template-workspace/patches/@tanstack__router-core@1.171.13.patch +51 -0
  106. package/template-workspace/pnpm-workspace.yaml.handlebars +7 -0
  107. package/template-workspace/scripts/bootstrap-agent-skills.mjs +77 -67
  108. package/templates/workspace-scripts/assert-mf-types.mjs.handlebars +51 -8
  109. package/templates/workspace-scripts/check-ultramodern-api-boundaries.mts +366 -0
  110. package/templates/workspace-scripts/{check-ultramodern-i18n-boundaries.mjs → check-ultramodern-i18n-boundaries.mts} +1 -1
  111. package/templates/workspace-scripts/generate-public-surface-assets.mjs +246 -9
  112. package/templates/workspace-scripts/proof-cloudflare-version.mjs +277 -9
  113. package/templates/workspace-scripts/ultramodern-cloudflare-proof.mjs +35 -10
  114. package/templates/workspace-scripts/ultramodern-performance-readiness.mjs +165 -2
  115. package/templates/workspace-scripts/ultramodern-typecheck.mjs +4 -2
  116. package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +842 -84
  117. package/dist/types/ultramodern-workspace/effect-api.d.ts +0 -73
  118. /package/template-workspace/{.agents → .codex}/rstackjs-agent-skills-LICENSE +0 -0
  119. /package/template-workspace/{.agents → .codex}/skills/rsbuild-best-practices/SKILL.md +0 -0
  120. /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/SKILL.md +0 -0
  121. /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/command-map.md +0 -0
  122. /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/common-analysis-patterns.md +0 -0
  123. /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-common.md +0 -0
  124. /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-rspack.md +0 -0
  125. /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor-webpack.md +0 -0
  126. /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/install-rsdoctor.md +0 -0
  127. /package/template-workspace/{.agents → .codex}/skills/rsdoctor-analysis/references/rsdoctor-data-types.md +0 -0
  128. /package/template-workspace/{.agents → .codex}/skills/rslib-best-practices/SKILL.md +0 -0
  129. /package/template-workspace/{.agents → .codex}/skills/rslib-modern-package/SKILL.md +0 -0
  130. /package/template-workspace/{.agents → .codex}/skills/rspack-best-practices/SKILL.md +0 -0
  131. /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/SKILL.md +0 -0
  132. /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/references/bottlenecks.md +0 -0
  133. /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/references/tracing-guide.md +0 -0
  134. /package/template-workspace/{.agents → .codex}/skills/rspack-tracing/scripts/analyze_trace.js +0 -0
  135. /package/template-workspace/{.agents → .codex}/skills/rstest-best-practices/SKILL.md +0 -0
@@ -0,0 +1,431 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
3
+ return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
4
+ }();
5
+ var __webpack_require__ = {};
6
+ (()=>{
7
+ __webpack_require__.n = (module)=>{
8
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
9
+ __webpack_require__.d(getter, {
10
+ a: getter
11
+ });
12
+ return getter;
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.d = (exports1, getters, values)=>{
17
+ var define = (defs, kind)=>{
18
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
19
+ enumerable: true,
20
+ [kind]: defs[key]
21
+ });
22
+ };
23
+ define(getters, "get");
24
+ define(values, "value");
25
+ };
26
+ })();
27
+ (()=>{
28
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
29
+ })();
30
+ (()=>{
31
+ __webpack_require__.r = (exports1)=>{
32
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
33
+ value: 'Module'
34
+ });
35
+ Object.defineProperty(exports1, '__esModule', {
36
+ value: true
37
+ });
38
+ };
39
+ })();
40
+ var __webpack_exports__ = {};
41
+ __webpack_require__.r(__webpack_exports__);
42
+ __webpack_require__.d(__webpack_exports__, {
43
+ runUltramodernToolingCli: ()=>runUltramodernToolingCli
44
+ });
45
+ const external_node_child_process_namespaceObject = require("node:child_process");
46
+ const external_node_fs_namespaceObject = require("node:fs");
47
+ var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
48
+ const external_node_os_namespaceObject = require("node:os");
49
+ var external_node_os_default = /*#__PURE__*/ __webpack_require__.n(external_node_os_namespaceObject);
50
+ const external_node_path_namespaceObject = require("node:path");
51
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
52
+ const external_node_url_namespaceObject = require("node:url");
53
+ const external_create_package_root_cjs_namespaceObject = require("../create-package-root.cjs");
54
+ const external_ultramodern_package_source_cjs_namespaceObject = require("../ultramodern-package-source.cjs");
55
+ const mf_validation_cjs_namespaceObject = require("../ultramodern-workspace/mf-validation.cjs");
56
+ const workspace_scripts_cjs_namespaceObject = require("../ultramodern-workspace/workspace-scripts.cjs");
57
+ const external_config_cjs_namespaceObject = require("./config.cjs");
58
+ const commands_dirname = external_node_path_default().dirname((0, external_node_url_namespaceObject.fileURLToPath)(__rslib_import_meta_url__));
59
+ const createPackageRoot = (0, external_create_package_root_cjs_namespaceObject.resolveCreatePackageRoot)(commands_dirname);
60
+ function printHelp() {
61
+ process.stdout.write(`Usage:
62
+ modern-js-create ultramodern <command> [args]
63
+
64
+ Commands:
65
+ validate
66
+ typecheck
67
+ mf-types
68
+ migrate-strict-effect
69
+ public-surface
70
+ cloudflare-proof
71
+ performance-readiness
72
+ skills install
73
+ skills check
74
+ `);
75
+ }
76
+ function spawnNodeScript(relativeScriptPath, args, context, options = {}) {
77
+ const scriptPath = external_node_path_default().join(createPackageRoot, relativeScriptPath);
78
+ const result = (0, external_node_child_process_namespaceObject.spawnSync)(process.execPath, [
79
+ scriptPath,
80
+ ...args
81
+ ], {
82
+ cwd: options.cwd ?? context.workspaceRoot,
83
+ env: {
84
+ ...process.env,
85
+ ULTRAMODERN_WORKSPACE_ROOT: context.workspaceRoot
86
+ },
87
+ stdio: 'inherit'
88
+ });
89
+ if (result.error) throw result.error;
90
+ return result.status ?? 1;
91
+ }
92
+ function runRenderedModule(source, context) {
93
+ const tempDir = external_node_fs_default().mkdtempSync(external_node_path_default().join(external_node_os_default().tmpdir(), 'ultramodern-tool-'));
94
+ const tempFile = external_node_path_default().join(tempDir, 'command.mjs');
95
+ try {
96
+ external_node_fs_default().writeFileSync(tempFile, source, 'utf-8');
97
+ const result = (0, external_node_child_process_namespaceObject.spawnSync)(process.execPath, [
98
+ tempFile
99
+ ], {
100
+ cwd: context.workspaceRoot,
101
+ stdio: 'inherit'
102
+ });
103
+ if (result.error) throw result.error;
104
+ return result.status ?? 1;
105
+ } finally{
106
+ external_node_fs_default().rmSync(tempDir, {
107
+ force: true,
108
+ recursive: true
109
+ });
110
+ }
111
+ }
112
+ function runValidate(context) {
113
+ const config = (0, external_config_cjs_namespaceObject.readUltramodernConfig)(context.workspaceRoot);
114
+ const apps = (0, external_config_cjs_namespaceObject.workspaceAppsFromToolingConfig)(config);
115
+ const remotes = apps.filter((app)=>'shell' !== app.kind);
116
+ const source = (0, workspace_scripts_cjs_namespaceObject.createWorkspaceValidationScript)(config.workspace.packageScope, config.features.tailwind, remotes);
117
+ return runRenderedModule(source, context);
118
+ }
119
+ function runMfTypes(args, context) {
120
+ if (args.includes('--help') || args.includes('-h')) {
121
+ process.stdout.write(`Usage:
122
+ modern-js-create ultramodern mf-types [app-dir...]
123
+
124
+ Checks real Module Federation config files and DTS archives for exposed apps.
125
+ `);
126
+ return 0;
127
+ }
128
+ (0, mf_validation_cjs_namespaceObject.validateModuleFederationTypes)({
129
+ workspaceRoot: context.workspaceRoot,
130
+ appDirs: args.length > 0 ? args : void 0
131
+ });
132
+ return 0;
133
+ }
134
+ const modernPackageNames = new Set([
135
+ ...external_ultramodern_package_source_cjs_namespaceObject.ULTRAMODERN_SINGLE_APP_MODERN_PACKAGES,
136
+ ...external_ultramodern_package_source_cjs_namespaceObject.ULTRAMODERN_WORKSPACE_MODERN_PACKAGES
137
+ ]);
138
+ function readJsonFile(filePath) {
139
+ return JSON.parse(external_node_fs_default().readFileSync(filePath, 'utf-8'));
140
+ }
141
+ function writeJsonFile(filePath, value) {
142
+ external_node_fs_default().writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`, 'utf-8');
143
+ }
144
+ function readOption(args, name) {
145
+ const prefix = `${name}=`;
146
+ const inline = args.find((arg)=>arg.startsWith(prefix));
147
+ if (inline) {
148
+ const value = inline.slice(prefix.length);
149
+ if (!value) throw new Error(`${name} needs a value.`);
150
+ return value;
151
+ }
152
+ const index = args.indexOf(name);
153
+ if (-1 === index) return;
154
+ const value = args[index + 1];
155
+ if (!value || value.startsWith('--')) throw new Error(`${name} needs a value.`);
156
+ return value;
157
+ }
158
+ function hasFlag(args, name) {
159
+ return args.includes(name);
160
+ }
161
+ function listWorkspacePackageFiles(workspaceRoot) {
162
+ const packageFiles = [
163
+ 'package.json'
164
+ ];
165
+ for (const directory of [
166
+ 'apps',
167
+ 'verticals',
168
+ 'packages'
169
+ ]){
170
+ const absoluteDirectory = external_node_path_default().join(workspaceRoot, directory);
171
+ if (external_node_fs_default().existsSync(absoluteDirectory)) for (const entry of external_node_fs_default().readdirSync(absoluteDirectory, {
172
+ withFileTypes: true
173
+ })){
174
+ if (!entry.isDirectory()) continue;
175
+ const packageFile = external_node_path_default().join(directory, entry.name, 'package.json');
176
+ if (external_node_fs_default().existsSync(external_node_path_default().join(workspaceRoot, packageFile))) packageFiles.push(packageFile);
177
+ }
178
+ }
179
+ return packageFiles;
180
+ }
181
+ function updateModernDependencies(packageJson, packageSource) {
182
+ let changed = false;
183
+ for (const section of [
184
+ 'dependencies',
185
+ 'devDependencies',
186
+ 'peerDependencies',
187
+ 'optionalDependencies'
188
+ ]){
189
+ const dependencies = packageJson[section];
190
+ if (!(!dependencies || 'object' != typeof dependencies || Array.isArray(dependencies))) for (const packageName of Object.keys(dependencies)){
191
+ if (!modernPackageNames.has(packageName)) continue;
192
+ const nextSpecifier = (0, external_ultramodern_package_source_cjs_namespaceObject.modernPackageSpecifier)(packageName, packageSource);
193
+ if (dependencies[packageName] !== nextSpecifier) {
194
+ dependencies[packageName] = nextSpecifier;
195
+ changed = true;
196
+ }
197
+ }
198
+ }
199
+ return changed;
200
+ }
201
+ function normalizeStrictEffectApiMetadata(value) {
202
+ const api = value.api;
203
+ if (!api || 'object' != typeof api || Array.isArray(api)) return false;
204
+ let changed = false;
205
+ const oldEffect = api.effect;
206
+ if (oldEffect && 'object' == typeof oldEffect && !Array.isArray(oldEffect)) {
207
+ if (void 0 === api.stem && 'string' == typeof oldEffect.stem) {
208
+ api.stem = oldEffect.stem;
209
+ changed = true;
210
+ }
211
+ if (void 0 === api.prefix && 'string' == typeof oldEffect.prefix) {
212
+ api.prefix = oldEffect.prefix;
213
+ changed = true;
214
+ }
215
+ if (void 0 === api.consumedBy && Array.isArray(oldEffect.consumedBy)) {
216
+ api.consumedBy = oldEffect.consumedBy;
217
+ changed = true;
218
+ }
219
+ delete api.effect;
220
+ changed = true;
221
+ }
222
+ if (void 0 !== api.runtime && 'effect' !== api.runtime) {
223
+ api.runtime = 'effect';
224
+ changed = true;
225
+ }
226
+ if (api.bff && 'object' == typeof api.bff && !Array.isArray(api.bff)) {
227
+ if (true !== api.bff.strictEffectApproach) {
228
+ api.bff.strictEffectApproach = true;
229
+ changed = true;
230
+ }
231
+ }
232
+ if ('string' == typeof value.path) {
233
+ const directServerEntry = `${value.path}/api/index.ts`;
234
+ if ('string' == typeof api.serverEntry && /\/api\/effect\/index\.[cm]?[jt]sx?$/u.test(api.serverEntry)) {
235
+ api.serverEntry = directServerEntry;
236
+ changed = true;
237
+ }
238
+ if (api.contract && 'object' == typeof api.contract && !Array.isArray(api.contract)) {
239
+ if ('./shared/effect/api' === api.contract.export) {
240
+ api.contract.export = './api';
241
+ changed = true;
242
+ }
243
+ if ('string' == typeof api.contract.path && /\/shared\/effect\/api\.[cm]?[jt]sx?$/u.test(api.contract.path)) {
244
+ api.contract.path = `${value.path}/shared/api.ts`;
245
+ changed = true;
246
+ }
247
+ }
248
+ if (api.client && 'object' == typeof api.client && !Array.isArray(api.client)) {
249
+ if ('./effect/client' === api.client.export) {
250
+ api.client.export = './api/client';
251
+ changed = true;
252
+ }
253
+ if ('string' == typeof api.client.path && /\/src\/effect\/[^/]+-client\.[cm]?ts$/u.test(api.client.path)) {
254
+ const basename = external_node_path_default().basename(api.client.path);
255
+ api.client.path = `${value.path}/src/api/${basename}`;
256
+ changed = true;
257
+ }
258
+ }
259
+ if (void 0 === api.serverEntry && 'effect' === api.runtime) {
260
+ api.serverEntry = directServerEntry;
261
+ changed = true;
262
+ }
263
+ }
264
+ return changed;
265
+ }
266
+ function updateUltramodernConfig(workspaceRoot, packageSource) {
267
+ const configPath = external_node_path_default().join(workspaceRoot, '.modernjs/ultramodern.json');
268
+ const config = readJsonFile(configPath);
269
+ config.packageSource = {
270
+ strategy: packageSource.strategy,
271
+ modernPackageVersion: packageSource.modernPackageVersion,
272
+ ...packageSource.registry ? {
273
+ registry: packageSource.registry
274
+ } : {},
275
+ ...packageSource.aliasScope ? {
276
+ aliasScope: packageSource.aliasScope
277
+ } : {},
278
+ ...packageSource.aliasPackageNamePrefix ? {
279
+ aliasPackageNamePrefix: packageSource.aliasPackageNamePrefix
280
+ } : {}
281
+ };
282
+ for (const app of config.topology?.apps ?? [])if (app && 'object' == typeof app && !Array.isArray(app)) normalizeStrictEffectApiMetadata(app);
283
+ writeJsonFile(configPath, config);
284
+ }
285
+ function updateReferenceTopology(workspaceRoot) {
286
+ const topologyPath = external_node_path_default().join(workspaceRoot, 'topology/reference-topology.json');
287
+ if (!external_node_fs_default().existsSync(topologyPath)) return false;
288
+ const topology = readJsonFile(topologyPath);
289
+ let changed = false;
290
+ for (const vertical of topology.verticals ?? [])if (vertical && 'object' == typeof vertical && !Array.isArray(vertical)) changed = normalizeStrictEffectApiMetadata(vertical) || changed;
291
+ if (changed) writeJsonFile(topologyPath, topology);
292
+ return changed;
293
+ }
294
+ function createMigrationPackageSource(args, current) {
295
+ const strategy = hasFlag(args, '--workspace') ? 'workspace' : 'install';
296
+ const registry = readOption(args, '--registry') ?? readOption(args, '--ultramodern-package-registry');
297
+ const explicitAliasScope = readOption(args, '--alias-scope') ?? readOption(args, '--ultramodern-package-scope');
298
+ const aliasScope = explicitAliasScope ?? ('install' === strategy && void 0 === registry ? current.packageSource?.aliasScope ?? external_ultramodern_package_source_cjs_namespaceObject.BLEEDINGDEV_PACKAGE_SCOPE : current.packageSource?.aliasScope);
299
+ const aliasPackageNamePrefix = readOption(args, '--alias-package-name-prefix') ?? readOption(args, '--ultramodern-package-name-prefix') ?? current.packageSource?.aliasPackageNamePrefix ?? (aliasScope ? external_ultramodern_package_source_cjs_namespaceObject.BLEEDINGDEV_PACKAGE_NAME_PREFIX : void 0);
300
+ if ('workspace' === strategy) return {
301
+ strategy,
302
+ modernPackageVersion: external_ultramodern_package_source_cjs_namespaceObject.WORKSPACE_PACKAGE_VERSION,
303
+ ...registry ? {
304
+ registry
305
+ } : {},
306
+ ...aliasScope ? {
307
+ aliasScope
308
+ } : {},
309
+ ...aliasPackageNamePrefix ? {
310
+ aliasPackageNamePrefix
311
+ } : {}
312
+ };
313
+ const version = readOption(args, '--version') ?? readOption(args, '--ultramodern-package-version') ?? current.packageSource?.modernPackageVersion;
314
+ if (!version || version === external_ultramodern_package_source_cjs_namespaceObject.WORKSPACE_PACKAGE_VERSION) throw new Error('migrate-strict-effect needs --version <published-ultramodern-version> for install package source.');
315
+ return {
316
+ strategy,
317
+ modernPackageVersion: version,
318
+ ...registry ? {
319
+ registry
320
+ } : {},
321
+ ...aliasScope ? {
322
+ aliasScope
323
+ } : {},
324
+ ...aliasPackageNamePrefix ? {
325
+ aliasPackageNamePrefix
326
+ } : {}
327
+ };
328
+ }
329
+ function runPnpmLockfileRefresh(context) {
330
+ const result = (0, external_node_child_process_namespaceObject.spawnSync)('pnpm', [
331
+ 'install',
332
+ '--lockfile-only',
333
+ "--ignore-scripts"
334
+ ], {
335
+ cwd: context.workspaceRoot,
336
+ stdio: 'inherit'
337
+ });
338
+ if (result.error) throw result.error;
339
+ return result.status ?? 1;
340
+ }
341
+ function runMigrateStrictEffect(args, context) {
342
+ if (args.includes('--help') || args.includes('-h')) {
343
+ process.stdout.write(`Usage:
344
+ modern-js-create ultramodern migrate-strict-effect --version <version> [--skip-install]
345
+
346
+ Updates generated UltraModern package-source metadata, Modern package aliases,
347
+ direct Effect API topology metadata, and the pnpm lockfile for strict Effect
348
+ workspaces. Source code still has to pass pnpm api:check and pnpm contract:check.
349
+ `);
350
+ return 0;
351
+ }
352
+ const current = (0, external_config_cjs_namespaceObject.readUltramodernConfig)(context.workspaceRoot);
353
+ const packageSource = createMigrationPackageSource(args, current);
354
+ updateUltramodernConfig(context.workspaceRoot, packageSource);
355
+ updateReferenceTopology(context.workspaceRoot);
356
+ for (const relativePackageFile of listWorkspacePackageFiles(context.workspaceRoot)){
357
+ const packageFile = external_node_path_default().join(context.workspaceRoot, relativePackageFile);
358
+ const packageJson = readJsonFile(packageFile);
359
+ if ('package.json' === relativePackageFile) {
360
+ packageJson.modernjs ??= {};
361
+ packageJson.modernjs.packageSource = {
362
+ strategy: packageSource.strategy,
363
+ config: './.modernjs/ultramodern.json'
364
+ };
365
+ }
366
+ if (updateModernDependencies(packageJson, packageSource)) writeJsonFile(packageFile, packageJson);
367
+ else if ('package.json' === relativePackageFile) writeJsonFile(packageFile, packageJson);
368
+ }
369
+ if (!hasFlag(args, '--skip-install')) {
370
+ const status = runPnpmLockfileRefresh(context);
371
+ if (0 !== status) return status;
372
+ }
373
+ process.stdout.write(`UltraModern strict Effect metadata migrated to ${packageSource.modernPackageVersion}. Run pnpm api:check && pnpm contract:check next.\n`);
374
+ return 0;
375
+ }
376
+ function runSkills(args, context) {
377
+ const [subcommand, ...rest] = args;
378
+ if ('install' === subcommand) return spawnNodeScript("template-workspace/scripts/bootstrap-agent-skills.mjs", rest, context);
379
+ if ('check' === subcommand) return spawnNodeScript("template-workspace/scripts/bootstrap-agent-skills.mjs", [
380
+ '--check',
381
+ ...rest
382
+ ], context);
383
+ throw new Error('Usage: modern-js-create ultramodern skills <install|check>');
384
+ }
385
+ async function runUltramodernToolingCli(args, workspaceRoot = process.env.ULTRAMODERN_WORKSPACE_ROOT ?? process.cwd()) {
386
+ try {
387
+ const [command, ...rest] = args;
388
+ const context = {
389
+ workspaceRoot: external_node_path_default().resolve(workspaceRoot),
390
+ invocationCwd: process.cwd()
391
+ };
392
+ switch(command){
393
+ case void 0:
394
+ case '--help':
395
+ case '-h':
396
+ printHelp();
397
+ return 0;
398
+ case 'validate':
399
+ return runValidate(context);
400
+ case 'typecheck':
401
+ return spawnNodeScript("templates/workspace-scripts/ultramodern-typecheck.mjs", rest, context, {
402
+ cwd: context.invocationCwd
403
+ });
404
+ case 'mf-types':
405
+ return runMfTypes(rest, context);
406
+ case 'migrate-strict-effect':
407
+ return runMigrateStrictEffect(rest, context);
408
+ case 'public-surface':
409
+ return spawnNodeScript("templates/workspace-scripts/generate-public-surface-assets.mjs", rest, context);
410
+ case 'cloudflare-proof':
411
+ return spawnNodeScript("templates/workspace-scripts/proof-cloudflare-version.mjs", rest, context);
412
+ case 'performance-readiness':
413
+ return spawnNodeScript("templates/workspace-scripts/ultramodern-performance-readiness.mjs", rest, context);
414
+ case 'skills':
415
+ return runSkills(rest, context);
416
+ default:
417
+ throw new Error(`Unknown UltraModern command: ${command}`);
418
+ }
419
+ } catch (error) {
420
+ const message = error instanceof Error ? error.message : String(error);
421
+ process.stderr.write(`[ultramodern] ${message}\n`);
422
+ return 1;
423
+ }
424
+ }
425
+ exports.runUltramodernToolingCli = __webpack_exports__.runUltramodernToolingCli;
426
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
427
+ "runUltramodernToolingCli"
428
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
429
+ Object.defineProperty(exports, '__esModule', {
430
+ value: true
431
+ });
@@ -0,0 +1,172 @@
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
+ readUltramodernConfig: ()=>readUltramodernConfig,
41
+ workspaceAppsFromToolingConfig: ()=>workspaceAppsFromToolingConfig
42
+ });
43
+ const external_node_fs_namespaceObject = require("node:fs");
44
+ var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
45
+ const external_node_path_namespaceObject = require("node:path");
46
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
47
+ const bridge_config_cjs_namespaceObject = require("../ultramodern-workspace/bridge-config.cjs");
48
+ const descriptors_cjs_namespaceObject = require("../ultramodern-workspace/descriptors.cjs");
49
+ const naming_cjs_namespaceObject = require("../ultramodern-workspace/naming.cjs");
50
+ function readJsonObject(filePath) {
51
+ const value = JSON.parse(external_node_fs_default().readFileSync(filePath, 'utf-8'));
52
+ if (null === value || 'object' != typeof value || Array.isArray(value)) throw new Error(`UltraModern config must contain a JSON object: ${filePath}`);
53
+ return value;
54
+ }
55
+ function readOptionalJsonObject(filePath) {
56
+ return external_node_fs_default().existsSync(filePath) ? readJsonObject(filePath) : {};
57
+ }
58
+ function packageScopeFromRoot(workspaceRoot1) {
59
+ const rootPackage = readOptionalJsonObject(external_node_path_default().join(workspaceRoot1, 'package.json'));
60
+ return 'string' == typeof rootPackage.name && rootPackage.name.length > 0 ? rootPackage.name : external_node_path_default().basename(workspaceRoot1);
61
+ }
62
+ function normalizeCompactConfig(sourcePath, config) {
63
+ const packageSource = config.packageSource && 'object' == typeof config.packageSource ? {
64
+ strategy: 'install' === config.packageSource.strategy ? 'install' : 'workspace',
65
+ modernPackageVersion: 'string' == typeof config.packageSource.modernPackageVersion ? config.packageSource.modernPackageVersion : 'workspace:*',
66
+ registry: 'string' == typeof config.packageSource.registry ? config.packageSource.registry : void 0,
67
+ aliasScope: 'string' == typeof config.packageSource.aliasScope ? config.packageSource.aliasScope : void 0,
68
+ aliasPackageNamePrefix: 'string' == typeof config.packageSource.aliasPackageNamePrefix ? config.packageSource.aliasPackageNamePrefix : void 0
69
+ } : void 0;
70
+ return {
71
+ schemaVersion: 'number' == typeof config.schemaVersion ? config.schemaVersion : 1,
72
+ profile: 'string' == typeof config.profile ? config.profile : void 0,
73
+ source: 'compact',
74
+ sourcePath,
75
+ workspace: {
76
+ packageScope: 'string' == typeof config.workspace?.packageScope ? config.workspace.packageScope : packageScopeFromRoot(workspaceRoot)
77
+ },
78
+ packageSource,
79
+ features: {
80
+ tailwind: config.features?.tailwind !== false
81
+ },
82
+ bridge: (0, bridge_config_cjs_namespaceObject.normalizeUltramodernBridgeConfig)(config.bridge),
83
+ topology: {
84
+ apps: Array.isArray(config.topology?.apps) ? config.topology.apps.map((app)=>({
85
+ id: String(app.id),
86
+ kind: 'vertical' === app.kind ? 'vertical' : 'shell',
87
+ path: 'string' == typeof app.path ? app.path : '.',
88
+ package: 'string' == typeof app.package ? app.package : void 0,
89
+ packageSuffix: 'string' == typeof app.packageSuffix ? app.packageSuffix : void 0,
90
+ displayName: 'string' == typeof app.displayName ? app.displayName : void 0,
91
+ domain: 'string' == typeof app.domain ? app.domain : void 0,
92
+ port: 'number' == typeof app.port ? app.port : void 0,
93
+ portEnv: 'string' == typeof app.portEnv ? app.portEnv : void 0,
94
+ moduleFederation: app.moduleFederation && 'object' == typeof app.moduleFederation ? {
95
+ role: 'remote' === app.moduleFederation.role ? 'remote' : 'host',
96
+ name: 'string' == typeof app.moduleFederation.name ? app.moduleFederation.name : void 0,
97
+ exposes: Array.isArray(app.moduleFederation.exposes) ? app.moduleFederation.exposes.filter((expose)=>'string' == typeof expose) : void 0,
98
+ exposePaths: null === app.moduleFederation.exposePaths || 'object' != typeof app.moduleFederation.exposePaths || Array.isArray(app.moduleFederation.exposePaths) ? void 0 : Object.fromEntries(Object.entries(app.moduleFederation.exposePaths).filter((entry)=>'string' == typeof entry[0] && 'string' == typeof entry[1])),
99
+ verticalRefs: Array.isArray(app.moduleFederation.verticalRefs) ? app.moduleFederation.verticalRefs.filter((ref)=>'string' == typeof ref) : void 0,
100
+ hostOnly: true === app.moduleFederation.hostOnly,
101
+ noExposes: true === app.moduleFederation.noExposes
102
+ } : void 0,
103
+ api: app.api && 'object' == typeof app.api ? {
104
+ stem: 'string' == typeof app.api.stem ? app.api.stem : String(app.id),
105
+ prefix: 'string' == typeof app.api.prefix ? app.api.prefix : `/${String(app.id)}-api`,
106
+ consumedBy: Array.isArray(app.api.consumedBy) ? app.api.consumedBy.filter((consumer)=>'string' == typeof consumer) : [
107
+ descriptors_cjs_namespaceObject.shellApp.id,
108
+ String(app.id)
109
+ ]
110
+ } : void 0
111
+ })) : []
112
+ }
113
+ };
114
+ }
115
+ function readUltramodernConfig(workspaceRoot1 = process.cwd()) {
116
+ const compactPath = external_node_path_default().join(workspaceRoot1, descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH);
117
+ if (external_node_fs_default().existsSync(compactPath)) return normalizeCompactConfig(compactPath, readJsonObject(compactPath));
118
+ throw new Error(`Missing UltraModern config. Expected ${descriptors_cjs_namespaceObject.ULTRAMODERN_CONFIG_PATH}.`);
119
+ }
120
+ function workspaceAppsFromToolingConfig(config) {
121
+ return config.topology.apps.map((app)=>{
122
+ if ('shell' === app.kind) return {
123
+ ...descriptors_cjs_namespaceObject.shellApp,
124
+ directory: app.path,
125
+ packageSuffix: app.packageSuffix ?? descriptors_cjs_namespaceObject.shellApp.packageSuffix,
126
+ displayName: app.displayName ?? descriptors_cjs_namespaceObject.shellApp.displayName,
127
+ port: app.port ?? descriptors_cjs_namespaceObject.shellApp.port,
128
+ portEnv: app.portEnv ?? descriptors_cjs_namespaceObject.shellApp.portEnv,
129
+ mfName: app.moduleFederation?.name ?? descriptors_cjs_namespaceObject.shellApp.mfName,
130
+ verticalRefs: app.moduleFederation?.verticalRefs ?? []
131
+ };
132
+ const domain = app.domain ?? app.id;
133
+ const packageSuffix = app.packageSuffix ?? domain;
134
+ const exposePaths = app.moduleFederation?.exposePaths ?? {};
135
+ const exposes = Object.fromEntries((app.moduleFederation?.exposes ?? []).map((expose)=>{
136
+ const configuredPath = exposePaths[expose];
137
+ const inferredPath = './Route' === expose ? './src/federation-entry.tsx' : './Widget' === expose ? `./src/components/${domain}-widget.tsx` : `./src/components/${(0, naming_cjs_namespaceObject.toKebabCase)(expose.replace(/^\.\//u, ''))}.tsx`;
138
+ return [
139
+ expose,
140
+ configuredPath ?? inferredPath
141
+ ];
142
+ }));
143
+ return {
144
+ id: app.id,
145
+ directory: app.path,
146
+ packageSuffix,
147
+ displayName: app.displayName ?? `${domain} Vertical`,
148
+ kind: 'vertical',
149
+ domain,
150
+ portEnv: app.portEnv ?? `VERTICAL_${domain.replace(/[^a-zA-Z0-9]+/g, '_').toUpperCase()}_PORT`,
151
+ port: app.port ?? 0,
152
+ mfName: app.moduleFederation?.name ?? app.id,
153
+ exposes,
154
+ ...app.moduleFederation?.verticalRefs ? {
155
+ verticalRefs: app.moduleFederation.verticalRefs
156
+ } : {},
157
+ ...app.api ? {
158
+ api: app.api
159
+ } : {},
160
+ ownership: (0, descriptors_cjs_namespaceObject.createNeutralOwnership)(app.id)
161
+ };
162
+ });
163
+ }
164
+ exports.readUltramodernConfig = __webpack_exports__.readUltramodernConfig;
165
+ exports.workspaceAppsFromToolingConfig = __webpack_exports__.workspaceAppsFromToolingConfig;
166
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
167
+ "readUltramodernConfig",
168
+ "workspaceAppsFromToolingConfig"
169
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
170
+ Object.defineProperty(exports, '__esModule', {
171
+ value: true
172
+ });