@bleedingdev/modern-js-create 3.5.0-ultramodern.10 → 3.5.0-ultramodern.11

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 (25) hide show
  1. package/dist/cjs/ultramodern-tooling/commands.cjs +117 -2
  2. package/dist/cjs/ultramodern-workspace/app-files.cjs +8 -11
  3. package/dist/cjs/ultramodern-workspace/package-json.cjs +14 -6
  4. package/dist/cjs/ultramodern-workspace/versions.cjs +5 -0
  5. package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +1 -0
  6. package/dist/cjs/ultramodern-workspace/write-workspace.cjs +1 -0
  7. package/dist/esm/ultramodern-tooling/commands.js +118 -3
  8. package/dist/esm/ultramodern-workspace/app-files.js +8 -11
  9. package/dist/esm/ultramodern-workspace/package-json.js +4 -6
  10. package/dist/esm/ultramodern-workspace/versions.js +3 -1
  11. package/dist/esm/ultramodern-workspace/workspace-scripts.js +2 -1
  12. package/dist/esm/ultramodern-workspace/write-workspace.js +2 -1
  13. package/dist/esm-node/ultramodern-tooling/commands.js +118 -3
  14. package/dist/esm-node/ultramodern-workspace/app-files.js +8 -11
  15. package/dist/esm-node/ultramodern-workspace/package-json.js +4 -6
  16. package/dist/esm-node/ultramodern-workspace/versions.js +3 -1
  17. package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +2 -1
  18. package/dist/esm-node/ultramodern-workspace/write-workspace.js +2 -1
  19. package/dist/types/ultramodern-workspace/versions.d.ts +2 -0
  20. package/package.json +3 -3
  21. package/template-workspace/.gitignore.handlebars +2 -0
  22. package/template-workspace/patches/drizzle-orm-ts7-strict-declarations.patch +452 -0
  23. package/template-workspace/patches/effect-schema-error-type-id.patch +18 -0
  24. package/template-workspace/pnpm-workspace.yaml.handlebars +2 -0
  25. package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +37 -2
@@ -52,7 +52,9 @@ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_no
52
52
  const external_node_url_namespaceObject = require("node:url");
53
53
  const external_create_package_root_cjs_namespaceObject = require("../create-package-root.cjs");
54
54
  const external_ultramodern_package_source_cjs_namespaceObject = require("../ultramodern-package-source.cjs");
55
+ const app_files_cjs_namespaceObject = require("../ultramodern-workspace/app-files.cjs");
55
56
  const mf_validation_cjs_namespaceObject = require("../ultramodern-workspace/mf-validation.cjs");
57
+ const package_json_cjs_namespaceObject = require("../ultramodern-workspace/package-json.cjs");
56
58
  const versions_cjs_namespaceObject = require("../ultramodern-workspace/versions.cjs");
57
59
  const workspace_scripts_cjs_namespaceObject = require("../ultramodern-workspace/workspace-scripts.cjs");
58
60
  const external_config_cjs_namespaceObject = require("./config.cjs");
@@ -233,6 +235,10 @@ const strictEffectPackageVersionPolicyExclusions = [
233
235
  `effect@${versions_cjs_namespaceObject.EFFECT_VERSION}`,
234
236
  `@effect/opentelemetry@${versions_cjs_namespaceObject.EFFECT_VERSION}`
235
237
  ];
238
+ const effectDeclarationPatchPath = 'patches/effect-schema-error-type-id.patch';
239
+ const effectDeclarationPatchSourcePath = external_node_path_default().join(createPackageRoot, 'template-workspace', effectDeclarationPatchPath);
240
+ const drizzleOrmDeclarationPatchPath = 'patches/drizzle-orm-ts7-strict-declarations.patch';
241
+ const drizzleOrmDeclarationPatchSourcePath = external_node_path_default().join(createPackageRoot, 'template-workspace', drizzleOrmDeclarationPatchPath);
236
242
  function updateGeneratedToolingDependencies(packageJson) {
237
243
  let changed = false;
238
244
  for (const section of [
@@ -368,6 +374,55 @@ function ensureYamlListItem(source, key, item) {
368
374
  changed: true
369
375
  };
370
376
  }
377
+ function ensureYamlMapEntry(source, key, entryKey, value) {
378
+ const entryLine = ` '${entryKey}': ${value}`;
379
+ const packageName = entryKey.includes('@') ? entryKey.slice(0, entryKey.lastIndexOf('@')) : entryKey;
380
+ const escapedPackageName = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
381
+ const currentEntryPattern = new RegExp(`^ {2}'${escapedPackageName}@[^']+': .+$`, 'mu');
382
+ const currentEntry = source.match(currentEntryPattern);
383
+ if (currentEntry) {
384
+ if (currentEntry[0] === entryLine) return {
385
+ source,
386
+ changed: false
387
+ };
388
+ return {
389
+ source: source.replace(currentEntryPattern, entryLine),
390
+ changed: true
391
+ };
392
+ }
393
+ const headerPattern = new RegExp(`^${key}:\\n(?:(?: .+\\n)*)`, 'mu');
394
+ const header = source.match(headerPattern);
395
+ if (header) {
396
+ if (header[0].split('\n').includes(entryLine)) return {
397
+ source,
398
+ changed: false
399
+ };
400
+ return {
401
+ source: source.replace(headerPattern, `${header[0]}${entryLine}\n`),
402
+ changed: true
403
+ };
404
+ }
405
+ return {
406
+ source: `${source.trimEnd()}\n${key}:\n${entryLine}\n`,
407
+ changed: true
408
+ };
409
+ }
410
+ function ensureGeneratedPatchFile(workspaceRoot, relativePatchPath, sourcePatchPath) {
411
+ const targetPath = external_node_path_default().join(workspaceRoot, relativePatchPath);
412
+ const patch = external_node_fs_default().readFileSync(sourcePatchPath, 'utf-8');
413
+ if (external_node_fs_default().existsSync(targetPath) && external_node_fs_default().readFileSync(targetPath, 'utf-8') === patch) return false;
414
+ external_node_fs_default().mkdirSync(external_node_path_default().dirname(targetPath), {
415
+ recursive: true
416
+ });
417
+ external_node_fs_default().writeFileSync(targetPath, patch, 'utf-8');
418
+ return true;
419
+ }
420
+ function ensureGeneratedDeclarationPatches(workspaceRoot) {
421
+ let changed = false;
422
+ changed = ensureGeneratedPatchFile(workspaceRoot, effectDeclarationPatchPath, effectDeclarationPatchSourcePath) || changed;
423
+ changed = ensureGeneratedPatchFile(workspaceRoot, drizzleOrmDeclarationPatchPath, drizzleOrmDeclarationPatchSourcePath) || changed;
424
+ return changed;
425
+ }
371
426
  function updateGeneratedPnpmWorkspacePolicy(workspaceRoot) {
372
427
  const workspaceFile = external_node_path_default().join(workspaceRoot, 'pnpm-workspace.yaml');
373
428
  if (!external_node_fs_default().existsSync(workspaceFile)) return false;
@@ -407,6 +462,12 @@ function updateGeneratedPnpmWorkspacePolicy(workspaceRoot) {
407
462
  changed = policyExclude.changed || changed;
408
463
  }
409
464
  }
465
+ const effectPatch = ensureYamlMapEntry(source, 'patchedDependencies', `effect@${versions_cjs_namespaceObject.EFFECT_VERSION}`, effectDeclarationPatchPath);
466
+ source = effectPatch.source;
467
+ changed = effectPatch.changed || changed;
468
+ const drizzleOrmPatch = ensureYamlMapEntry(source, 'patchedDependencies', `drizzle-orm@${versions_cjs_namespaceObject.DRIZZLE_ORM_VERSION}`, drizzleOrmDeclarationPatchPath);
469
+ source = drizzleOrmPatch.source;
470
+ changed = drizzleOrmPatch.changed || changed;
410
471
  if (changed) external_node_fs_default().writeFileSync(workspaceFile, source, 'utf-8');
411
472
  return changed;
412
473
  }
@@ -429,6 +490,57 @@ function updateUltramodernConfig(workspaceRoot, packageSource) {
429
490
  for (const app of config.topology?.apps ?? [])if (app && 'object' == typeof app && !Array.isArray(app)) normalizeStrictEffectApiMetadata(app);
430
491
  writeJsonFile(configPath, config);
431
492
  }
493
+ function writeJsonIfChanged(filePath, value) {
494
+ const next = `${JSON.stringify(value, null, 2)}\n`;
495
+ if (external_node_fs_default().existsSync(filePath) && external_node_fs_default().readFileSync(filePath, 'utf-8') === next) return false;
496
+ external_node_fs_default().mkdirSync(external_node_path_default().dirname(filePath), {
497
+ recursive: true
498
+ });
499
+ external_node_fs_default().writeFileSync(filePath, next, 'utf-8');
500
+ return true;
501
+ }
502
+ function writeTextIfChanged(filePath, value) {
503
+ if (external_node_fs_default().existsSync(filePath) && external_node_fs_default().readFileSync(filePath, 'utf-8') === value) return false;
504
+ external_node_fs_default().mkdirSync(external_node_path_default().dirname(filePath), {
505
+ recursive: true
506
+ });
507
+ external_node_fs_default().writeFileSync(filePath, value, 'utf-8');
508
+ return true;
509
+ }
510
+ function ensureGeneratedIgnoreRules(workspaceRoot) {
511
+ const gitignorePath = external_node_path_default().join(workspaceRoot, '.gitignore');
512
+ const existing = external_node_fs_default().existsSync(gitignorePath) ? external_node_fs_default().readFileSync(gitignorePath, 'utf-8') : '';
513
+ const lines = 0 === existing.trimEnd().length ? [] : existing.trimEnd().split(/\r?\n/u);
514
+ let changed = false;
515
+ for (const rule of [
516
+ '.mf/',
517
+ '**/.mf/'
518
+ ])if (!lines.includes(rule)) {
519
+ lines.push(rule);
520
+ changed = true;
521
+ }
522
+ if (!changed) return false;
523
+ const next = `${lines.join('\n')}\n`;
524
+ external_node_fs_default().writeFileSync(gitignorePath, next, 'utf-8');
525
+ return true;
526
+ }
527
+ function updateGeneratedTypeScriptSurfaces(workspaceRoot, config) {
528
+ let changed = false;
529
+ const apps = (0, external_config_cjs_namespaceObject.workspaceAppsFromToolingConfig)(config);
530
+ const remotes = apps.filter((app)=>'shell' !== app.kind);
531
+ changed = writeJsonIfChanged(external_node_path_default().join(workspaceRoot, 'tsconfig.base.json'), (0, package_json_cjs_namespaceObject.createTsConfigBase)()) || changed;
532
+ changed = ensureGeneratedIgnoreRules(workspaceRoot) || changed;
533
+ for (const sharedPackage of [
534
+ 'packages/shared-contracts',
535
+ 'packages/shared-design-tokens'
536
+ ])changed = writeJsonIfChanged(external_node_path_default().join(workspaceRoot, sharedPackage, 'tsconfig.json'), (0, package_json_cjs_namespaceObject.createSharedPackageTsConfig)(sharedPackage)) || changed;
537
+ for (const app of apps){
538
+ changed = writeJsonIfChanged(external_node_path_default().join(workspaceRoot, app.directory, 'tsconfig.json'), (0, package_json_cjs_namespaceObject.createAppTsConfig)(app, remotes)) || changed;
539
+ changed = writeJsonIfChanged(external_node_path_default().join(workspaceRoot, app.directory, 'tsconfig.mf-types.json'), (0, package_json_cjs_namespaceObject.createAppMfTypesTsConfig)(app)) || changed;
540
+ changed = writeTextIfChanged(external_node_path_default().join(workspaceRoot, app.directory, 'src/modern-app-env.d.ts'), (0, app_files_cjs_namespaceObject.createAppEnvDts)(app, remotes)) || changed;
541
+ }
542
+ return changed;
543
+ }
432
544
  function updateReferenceTopology(workspaceRoot) {
433
545
  const topologyPath = external_node_path_default().join(workspaceRoot, 'topology/reference-topology.json');
434
546
  if (!external_node_fs_default().existsSync(topologyPath)) return false;
@@ -492,8 +604,9 @@ function runMigrateStrictEffect(args, context) {
492
604
 
493
605
  Updates generated UltraModern package-source metadata, Modern package aliases,
494
606
  framework-owned toolchain pins, direct Effect API topology metadata, strict
495
- Effect pnpm overrides/trust policy, and the pnpm lockfile. Source code still
496
- has to pass pnpm api:check and pnpm contract:check.
607
+ Effect pnpm overrides/trust policy, framework-owned TypeScript config
608
+ surfaces, and the pnpm lockfile. Source code still has to pass pnpm api:check
609
+ and pnpm contract:check.
497
610
  `);
498
611
  return 0;
499
612
  }
@@ -501,6 +614,7 @@ has to pass pnpm api:check and pnpm contract:check.
501
614
  const packageSource = createMigrationPackageSource(args, current);
502
615
  updateUltramodernConfig(context.workspaceRoot, packageSource);
503
616
  updateReferenceTopology(context.workspaceRoot);
617
+ updateGeneratedTypeScriptSurfaces(context.workspaceRoot, current);
504
618
  for (const relativePackageFile of listWorkspacePackageFiles(context.workspaceRoot)){
505
619
  const packageFile = external_node_path_default().join(context.workspaceRoot, relativePackageFile);
506
620
  const packageJson = readJsonFile(packageFile);
@@ -519,6 +633,7 @@ has to pass pnpm api:check and pnpm contract:check.
519
633
  else if ('package.json' === relativePackageFile) writeJsonFile(packageFile, packageJson);
520
634
  }
521
635
  updateGeneratedPnpmWorkspacePolicy(context.workspaceRoot);
636
+ ensureGeneratedDeclarationPatches(context.workspaceRoot);
522
637
  if (!hasFlag(args, '--skip-install')) {
523
638
  const status = runPnpmLockfileRefresh(context);
524
639
  if (0 !== status) return status;
@@ -71,17 +71,14 @@ function createAppEnvDts(app, remotes = []) {
71
71
  }
72
72
  `;
73
73
  })).join('\n');
74
- const reactTypeReference = remoteModuleDeclarations ? "/// <reference types='react' />\n" : '';
75
- const siteUrlDeclaration = 'declare const ULTRAMODERN_SITE_URL: string;';
76
- return `${reactTypeReference}/// <reference types='@modern-js/app-tools/types' />
77
-
78
- ${siteUrlDeclaration}
79
- declare module '*.svg' {
80
- const url: string;
81
- export default url;
82
- }
83
- declare module '*.css';
84
- ${remoteModuleDeclarations ? `\n${remoteModuleDeclarations}` : ''}`;
74
+ const reactTypeImport = remoteModuleDeclarations ? "import type React from 'react';\n" : '';
75
+ return [
76
+ `import '@modern-js/app-tools/types';\n${reactTypeImport}`.trimEnd(),
77
+ `declare global {
78
+ const ULTRAMODERN_SITE_URL: string;
79
+ }`,
80
+ remoteModuleDeclarations.trimEnd()
81
+ ].filter((section)=>section.length > 0).join('\n\n').concat('\n');
85
82
  }
86
83
  function createAppRuntimeConfig(app, scope, remotes = []) {
87
84
  const pluginsConfig = 'shell' === app.kind ? ` plugins: [
@@ -1,5 +1,14 @@
1
1
  "use strict";
2
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
+ })();
3
12
  (()=>{
4
13
  __webpack_require__.d = (exports1, getters, values)=>{
5
14
  var define = (defs, kind)=>{
@@ -44,6 +53,8 @@ __webpack_require__.d(__webpack_exports__, {
44
53
  createZephyrDependencies: ()=>createZephyrDependencies,
45
54
  effectDiagnostics: ()=>effectDiagnostics
46
55
  });
56
+ const external_node_path_namespaceObject = require("node:path");
57
+ var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
47
58
  const external_ultramodern_package_source_cjs_namespaceObject = require("../ultramodern-package-source.cjs");
48
59
  const external_descriptors_cjs_namespaceObject = require("./descriptors.cjs");
49
60
  const external_fs_io_cjs_namespaceObject = require("./fs-io.cjs");
@@ -294,7 +305,6 @@ function createTsConfigBase() {
294
305
  noFallthroughCasesInSwitch: true,
295
306
  noPropertyAccessFromIndexSignature: true,
296
307
  noImplicitReturns: true,
297
- skipLibCheck: true,
298
308
  resolveJsonModule: true,
299
309
  plugins: [
300
310
  {
@@ -326,7 +336,7 @@ function createReferences(packageDir, references) {
326
336
  return [
327
337
  ...new Set(references)
328
338
  ].filter((reference)=>reference !== packageDir).map((reference)=>({
329
- path: `${(0, external_naming_cjs_namespaceObject.relativeRootFor)(packageDir)}/${reference}`
339
+ path: external_node_path_default().relative(packageDir, reference).split(external_node_path_default().sep).join('/')
330
340
  }));
331
341
  }
332
342
  function createPackageTsConfig(packageDir, options = {}) {
@@ -336,8 +346,6 @@ function createPackageTsConfig(packageDir, options = {}) {
336
346
  const include = resolvedOptions.include ?? [
337
347
  'src',
338
348
  'locales/**/*.json',
339
- 'modern.config.ts',
340
- 'module-federation.config.ts',
341
349
  'package.json',
342
350
  'shared'
343
351
  ];
@@ -371,9 +379,9 @@ function createAppTsConfig(app, remotes = []) {
371
379
  });
372
380
  }
373
381
  function createAppMfTypesTsConfig(app) {
374
- const exposedFiles = Object.values(app.exposes ?? {}).map((exposePath)=>exposePath.replace(/^\.\//u, ''));
382
+ const exposedFiles = Object.entries(app.exposes ?? {}).sort(([left], [right])=>'./Route' === left ? -1 : './Route' === right ? 1 : 0).map(([, exposePath])=>exposePath.replace(/^\.\//u, ''));
375
383
  return {
376
- extends: './tsconfig.json',
384
+ extends: `${(0, external_naming_cjs_namespaceObject.relativeRootFor)(app.directory)}/tsconfig.base.json`,
377
385
  include: [
378
386
  ...new Set([
379
387
  ...exposedFiles,
@@ -40,6 +40,7 @@ const POSTCSS_VERSION = '8.5.15';
40
40
  const EFFECT_VERSION = '4.0.0-beta.91';
41
41
  const EFFECT_VITEST_VERSION = '4.0.0-beta.91';
42
42
  const EFFECT_TSGO_VERSION = '0.14.6';
43
+ const DRIZZLE_ORM_VERSION = '1.0.0-rc.4';
43
44
  const TYPESCRIPT_STABLE_VERSION = '6.0.3';
44
45
  const TYPESCRIPT_NATIVE_PREVIEW_VERSION = '7.0.0-dev.20260628.1';
45
46
  const TYPESCRIPT_VERSION = TYPESCRIPT_STABLE_VERSION;
@@ -64,11 +65,13 @@ const ultramodernWorkspaceVersions = {
64
65
  moduleFederation: MODULE_FEDERATION_VERSION,
65
66
  effect: EFFECT_VERSION,
66
67
  effectVitest: EFFECT_VITEST_VERSION,
68
+ drizzleOrm: DRIZZLE_ORM_VERSION,
67
69
  tailwind: TAILWIND_VERSION,
68
70
  tailwindPostcss: TAILWIND_POSTCSS_VERSION
69
71
  };
70
72
  __webpack_require__.d(__webpack_exports__, {}, {
71
73
  CLOUDFLARE_COMPATIBILITY_DATE: CLOUDFLARE_COMPATIBILITY_DATE,
74
+ DRIZZLE_ORM_VERSION: DRIZZLE_ORM_VERSION,
72
75
  EFFECT_TSGO_VERSION: EFFECT_TSGO_VERSION,
73
76
  EFFECT_VERSION: EFFECT_VERSION,
74
77
  EFFECT_VITEST_VERSION: EFFECT_VITEST_VERSION,
@@ -102,6 +105,7 @@ __webpack_require__.d(__webpack_exports__, {}, {
102
105
  ultramodernWorkspaceVersions: ultramodernWorkspaceVersions
103
106
  });
104
107
  exports.CLOUDFLARE_COMPATIBILITY_DATE = __webpack_exports__.CLOUDFLARE_COMPATIBILITY_DATE;
108
+ exports.DRIZZLE_ORM_VERSION = __webpack_exports__.DRIZZLE_ORM_VERSION;
105
109
  exports.EFFECT_TSGO_VERSION = __webpack_exports__.EFFECT_TSGO_VERSION;
106
110
  exports.EFFECT_VERSION = __webpack_exports__.EFFECT_VERSION;
107
111
  exports.EFFECT_VITEST_VERSION = __webpack_exports__.EFFECT_VITEST_VERSION;
@@ -135,6 +139,7 @@ exports.ZEPHYR_RSPACK_PLUGIN_VERSION = __webpack_exports__.ZEPHYR_RSPACK_PLUGIN_
135
139
  exports.ultramodernWorkspaceVersions = __webpack_exports__.ultramodernWorkspaceVersions;
136
140
  for(var __rspack_i in __webpack_exports__)if (-1 === [
137
141
  "CLOUDFLARE_COMPATIBILITY_DATE",
142
+ "DRIZZLE_ORM_VERSION",
138
143
  "EFFECT_TSGO_VERSION",
139
144
  "EFFECT_VERSION",
140
145
  "EFFECT_VITEST_VERSION",
@@ -174,6 +174,7 @@ function createWorkspaceValidationScript(scope, enableTailwind, remotes = []) {
174
174
  const expectedCloudflareSecurity = (0, external_policy_cjs_namespaceObject.createCloudflareSecurityContract)();
175
175
  return (0, external_fs_io_cjs_namespaceObject.renderFileTemplate)("workspace-scripts/validate-ultramodern-workspace.mjs", {
176
176
  packageScope: scope,
177
+ effectVersion: external_versions_cjs_namespaceObject.EFFECT_VERSION,
177
178
  nodeVersion: external_versions_cjs_namespaceObject.NODE_VERSION,
178
179
  pnpmVersion: external_versions_cjs_namespaceObject.PNPM_VERSION,
179
180
  tailwindEnabledJson: JSON.stringify(enableTailwind),
@@ -175,6 +175,7 @@ function generateUltramodernWorkspace(options) {
175
175
  nodeVersion: external_versions_cjs_namespaceObject.NODE_VERSION,
176
176
  pnpmVersion: external_versions_cjs_namespaceObject.PNPM_VERSION,
177
177
  nodeFetchVersion: external_versions_cjs_namespaceObject.NODE_FETCH_VERSION,
178
+ drizzleOrmVersion: external_versions_cjs_namespaceObject.DRIZZLE_ORM_VERSION,
178
179
  effectVersion: external_versions_cjs_namespaceObject.EFFECT_VERSION,
179
180
  effectVitestVersion: external_versions_cjs_namespaceObject.EFFECT_VITEST_VERSION,
180
181
  tanstackRouterCoreVersion: external_versions_cjs_namespaceObject.TANSTACK_ROUTER_CORE_VERSION,
@@ -5,8 +5,10 @@ import node_path from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { resolveCreatePackageRoot } from "../create-package-root.js";
7
7
  import { BLEEDINGDEV_PACKAGE_NAME_PREFIX, BLEEDINGDEV_PACKAGE_SCOPE, ULTRAMODERN_SINGLE_APP_MODERN_PACKAGES, ULTRAMODERN_WORKSPACE_MODERN_PACKAGES, WORKSPACE_PACKAGE_VERSION, modernPackageSpecifier } from "../ultramodern-package-source.js";
8
+ import { createAppEnvDts } from "../ultramodern-workspace/app-files.js";
8
9
  import { validateModuleFederationTypes } from "../ultramodern-workspace/mf-validation.js";
9
- import { EFFECT_TSGO_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, OXFMT_VERSION, OXLINT_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION } from "../ultramodern-workspace/versions.js";
10
+ import { createAppMfTypesTsConfig, createAppTsConfig, createSharedPackageTsConfig, createTsConfigBase } from "../ultramodern-workspace/package-json.js";
11
+ import { DRIZZLE_ORM_VERSION, EFFECT_TSGO_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, OXFMT_VERSION, OXLINT_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION } from "../ultramodern-workspace/versions.js";
10
12
  import { createWorkspaceValidationScript } from "../ultramodern-workspace/workspace-scripts.js";
11
13
  import { readUltramodernConfig, workspaceAppsFromToolingConfig } from "./config.js";
12
14
  const commands_dirname = node_path.dirname(fileURLToPath(import.meta.url));
@@ -186,6 +188,10 @@ const strictEffectPackageVersionPolicyExclusions = [
186
188
  `effect@${EFFECT_VERSION}`,
187
189
  `@effect/opentelemetry@${EFFECT_VERSION}`
188
190
  ];
191
+ const effectDeclarationPatchPath = 'patches/effect-schema-error-type-id.patch';
192
+ const effectDeclarationPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', effectDeclarationPatchPath);
193
+ const drizzleOrmDeclarationPatchPath = 'patches/drizzle-orm-ts7-strict-declarations.patch';
194
+ const drizzleOrmDeclarationPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', drizzleOrmDeclarationPatchPath);
189
195
  function updateGeneratedToolingDependencies(packageJson) {
190
196
  let changed = false;
191
197
  for (const section of [
@@ -321,6 +327,55 @@ function ensureYamlListItem(source, key, item) {
321
327
  changed: true
322
328
  };
323
329
  }
330
+ function ensureYamlMapEntry(source, key, entryKey, value) {
331
+ const entryLine = ` '${entryKey}': ${value}`;
332
+ const packageName = entryKey.includes('@') ? entryKey.slice(0, entryKey.lastIndexOf('@')) : entryKey;
333
+ const escapedPackageName = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
334
+ const currentEntryPattern = new RegExp(`^ {2}'${escapedPackageName}@[^']+': .+$`, 'mu');
335
+ const currentEntry = source.match(currentEntryPattern);
336
+ if (currentEntry) {
337
+ if (currentEntry[0] === entryLine) return {
338
+ source,
339
+ changed: false
340
+ };
341
+ return {
342
+ source: source.replace(currentEntryPattern, entryLine),
343
+ changed: true
344
+ };
345
+ }
346
+ const headerPattern = new RegExp(`^${key}:\\n(?:(?: .+\\n)*)`, 'mu');
347
+ const header = source.match(headerPattern);
348
+ if (header) {
349
+ if (header[0].split('\n').includes(entryLine)) return {
350
+ source,
351
+ changed: false
352
+ };
353
+ return {
354
+ source: source.replace(headerPattern, `${header[0]}${entryLine}\n`),
355
+ changed: true
356
+ };
357
+ }
358
+ return {
359
+ source: `${source.trimEnd()}\n${key}:\n${entryLine}\n`,
360
+ changed: true
361
+ };
362
+ }
363
+ function ensureGeneratedPatchFile(workspaceRoot, relativePatchPath, sourcePatchPath) {
364
+ const targetPath = node_path.join(workspaceRoot, relativePatchPath);
365
+ const patch = node_fs.readFileSync(sourcePatchPath, 'utf-8');
366
+ if (node_fs.existsSync(targetPath) && node_fs.readFileSync(targetPath, 'utf-8') === patch) return false;
367
+ node_fs.mkdirSync(node_path.dirname(targetPath), {
368
+ recursive: true
369
+ });
370
+ node_fs.writeFileSync(targetPath, patch, 'utf-8');
371
+ return true;
372
+ }
373
+ function ensureGeneratedDeclarationPatches(workspaceRoot) {
374
+ let changed = false;
375
+ changed = ensureGeneratedPatchFile(workspaceRoot, effectDeclarationPatchPath, effectDeclarationPatchSourcePath) || changed;
376
+ changed = ensureGeneratedPatchFile(workspaceRoot, drizzleOrmDeclarationPatchPath, drizzleOrmDeclarationPatchSourcePath) || changed;
377
+ return changed;
378
+ }
324
379
  function updateGeneratedPnpmWorkspacePolicy(workspaceRoot) {
325
380
  const workspaceFile = node_path.join(workspaceRoot, 'pnpm-workspace.yaml');
326
381
  if (!node_fs.existsSync(workspaceFile)) return false;
@@ -360,6 +415,12 @@ function updateGeneratedPnpmWorkspacePolicy(workspaceRoot) {
360
415
  changed = policyExclude.changed || changed;
361
416
  }
362
417
  }
418
+ const effectPatch = ensureYamlMapEntry(source, 'patchedDependencies', `effect@${EFFECT_VERSION}`, effectDeclarationPatchPath);
419
+ source = effectPatch.source;
420
+ changed = effectPatch.changed || changed;
421
+ const drizzleOrmPatch = ensureYamlMapEntry(source, 'patchedDependencies', `drizzle-orm@${DRIZZLE_ORM_VERSION}`, drizzleOrmDeclarationPatchPath);
422
+ source = drizzleOrmPatch.source;
423
+ changed = drizzleOrmPatch.changed || changed;
363
424
  if (changed) node_fs.writeFileSync(workspaceFile, source, 'utf-8');
364
425
  return changed;
365
426
  }
@@ -382,6 +443,57 @@ function updateUltramodernConfig(workspaceRoot, packageSource) {
382
443
  for (const app of config.topology?.apps ?? [])if (app && 'object' == typeof app && !Array.isArray(app)) normalizeStrictEffectApiMetadata(app);
383
444
  writeJsonFile(configPath, config);
384
445
  }
446
+ function writeJsonIfChanged(filePath, value) {
447
+ const next = `${JSON.stringify(value, null, 2)}\n`;
448
+ if (node_fs.existsSync(filePath) && node_fs.readFileSync(filePath, 'utf-8') === next) return false;
449
+ node_fs.mkdirSync(node_path.dirname(filePath), {
450
+ recursive: true
451
+ });
452
+ node_fs.writeFileSync(filePath, next, 'utf-8');
453
+ return true;
454
+ }
455
+ function writeTextIfChanged(filePath, value) {
456
+ if (node_fs.existsSync(filePath) && node_fs.readFileSync(filePath, 'utf-8') === value) return false;
457
+ node_fs.mkdirSync(node_path.dirname(filePath), {
458
+ recursive: true
459
+ });
460
+ node_fs.writeFileSync(filePath, value, 'utf-8');
461
+ return true;
462
+ }
463
+ function ensureGeneratedIgnoreRules(workspaceRoot) {
464
+ const gitignorePath = node_path.join(workspaceRoot, '.gitignore');
465
+ const existing = node_fs.existsSync(gitignorePath) ? node_fs.readFileSync(gitignorePath, 'utf-8') : '';
466
+ const lines = 0 === existing.trimEnd().length ? [] : existing.trimEnd().split(/\r?\n/u);
467
+ let changed = false;
468
+ for (const rule of [
469
+ '.mf/',
470
+ '**/.mf/'
471
+ ])if (!lines.includes(rule)) {
472
+ lines.push(rule);
473
+ changed = true;
474
+ }
475
+ if (!changed) return false;
476
+ const next = `${lines.join('\n')}\n`;
477
+ node_fs.writeFileSync(gitignorePath, next, 'utf-8');
478
+ return true;
479
+ }
480
+ function updateGeneratedTypeScriptSurfaces(workspaceRoot, config) {
481
+ let changed = false;
482
+ const apps = workspaceAppsFromToolingConfig(config);
483
+ const remotes = apps.filter((app)=>'shell' !== app.kind);
484
+ changed = writeJsonIfChanged(node_path.join(workspaceRoot, 'tsconfig.base.json'), createTsConfigBase()) || changed;
485
+ changed = ensureGeneratedIgnoreRules(workspaceRoot) || changed;
486
+ for (const sharedPackage of [
487
+ 'packages/shared-contracts',
488
+ 'packages/shared-design-tokens'
489
+ ])changed = writeJsonIfChanged(node_path.join(workspaceRoot, sharedPackage, 'tsconfig.json'), createSharedPackageTsConfig(sharedPackage)) || changed;
490
+ for (const app of apps){
491
+ changed = writeJsonIfChanged(node_path.join(workspaceRoot, app.directory, 'tsconfig.json'), createAppTsConfig(app, remotes)) || changed;
492
+ changed = writeJsonIfChanged(node_path.join(workspaceRoot, app.directory, 'tsconfig.mf-types.json'), createAppMfTypesTsConfig(app)) || changed;
493
+ changed = writeTextIfChanged(node_path.join(workspaceRoot, app.directory, 'src/modern-app-env.d.ts'), createAppEnvDts(app, remotes)) || changed;
494
+ }
495
+ return changed;
496
+ }
385
497
  function updateReferenceTopology(workspaceRoot) {
386
498
  const topologyPath = node_path.join(workspaceRoot, 'topology/reference-topology.json');
387
499
  if (!node_fs.existsSync(topologyPath)) return false;
@@ -445,8 +557,9 @@ function runMigrateStrictEffect(args, context) {
445
557
 
446
558
  Updates generated UltraModern package-source metadata, Modern package aliases,
447
559
  framework-owned toolchain pins, direct Effect API topology metadata, strict
448
- Effect pnpm overrides/trust policy, and the pnpm lockfile. Source code still
449
- has to pass pnpm api:check and pnpm contract:check.
560
+ Effect pnpm overrides/trust policy, framework-owned TypeScript config
561
+ surfaces, and the pnpm lockfile. Source code still has to pass pnpm api:check
562
+ and pnpm contract:check.
450
563
  `);
451
564
  return 0;
452
565
  }
@@ -454,6 +567,7 @@ has to pass pnpm api:check and pnpm contract:check.
454
567
  const packageSource = createMigrationPackageSource(args, current);
455
568
  updateUltramodernConfig(context.workspaceRoot, packageSource);
456
569
  updateReferenceTopology(context.workspaceRoot);
570
+ updateGeneratedTypeScriptSurfaces(context.workspaceRoot, current);
457
571
  for (const relativePackageFile of listWorkspacePackageFiles(context.workspaceRoot)){
458
572
  const packageFile = node_path.join(context.workspaceRoot, relativePackageFile);
459
573
  const packageJson = readJsonFile(packageFile);
@@ -472,6 +586,7 @@ has to pass pnpm api:check and pnpm contract:check.
472
586
  else if ('package.json' === relativePackageFile) writeJsonFile(packageFile, packageJson);
473
587
  }
474
588
  updateGeneratedPnpmWorkspacePolicy(context.workspaceRoot);
589
+ ensureGeneratedDeclarationPatches(context.workspaceRoot);
475
590
  if (!hasFlag(args, '--skip-install')) {
476
591
  const status = runPnpmLockfileRefresh(context);
477
592
  if (0 !== status) return status;
@@ -27,17 +27,14 @@ function createAppEnvDts(app, remotes = []) {
27
27
  }
28
28
  `;
29
29
  })).join('\n');
30
- const reactTypeReference = remoteModuleDeclarations ? "/// <reference types='react' />\n" : '';
31
- const siteUrlDeclaration = 'declare const ULTRAMODERN_SITE_URL: string;';
32
- return `${reactTypeReference}/// <reference types='@modern-js/app-tools/types' />
33
-
34
- ${siteUrlDeclaration}
35
- declare module '*.svg' {
36
- const url: string;
37
- export default url;
38
- }
39
- declare module '*.css';
40
- ${remoteModuleDeclarations ? `\n${remoteModuleDeclarations}` : ''}`;
30
+ const reactTypeImport = remoteModuleDeclarations ? "import type React from 'react';\n" : '';
31
+ return [
32
+ `import '@modern-js/app-tools/types';\n${reactTypeImport}`.trimEnd(),
33
+ `declare global {
34
+ const ULTRAMODERN_SITE_URL: string;
35
+ }`,
36
+ remoteModuleDeclarations.trimEnd()
37
+ ].filter((section)=>section.length > 0).join('\n\n').concat('\n');
41
38
  }
42
39
  function createAppRuntimeConfig(app, scope, remotes = []) {
43
40
  const pluginsConfig = 'shell' === app.kind ? ` plugins: [
@@ -1,3 +1,4 @@
1
+ import node_path from "node:path";
1
2
  import { WORKSPACE_PACKAGE_VERSION, modernPackageSpecifier } from "../ultramodern-package-source.js";
2
3
  import { appHasApi, remoteDependencyAlias, resolveRemoteRefs, sharedPackages, shellApp, verticalApiApps, zephyrRemoteDependency } from "./descriptors.js";
3
4
  import { readFileTemplate } from "./fs-io.js";
@@ -248,7 +249,6 @@ function createTsConfigBase() {
248
249
  noFallthroughCasesInSwitch: true,
249
250
  noPropertyAccessFromIndexSignature: true,
250
251
  noImplicitReturns: true,
251
- skipLibCheck: true,
252
252
  resolveJsonModule: true,
253
253
  plugins: [
254
254
  {
@@ -280,7 +280,7 @@ function createReferences(packageDir, references) {
280
280
  return [
281
281
  ...new Set(references)
282
282
  ].filter((reference)=>reference !== packageDir).map((reference)=>({
283
- path: `${relativeRootFor(packageDir)}/${reference}`
283
+ path: node_path.relative(packageDir, reference).split(node_path.sep).join('/')
284
284
  }));
285
285
  }
286
286
  function createPackageTsConfig(packageDir, options = {}) {
@@ -290,8 +290,6 @@ function createPackageTsConfig(packageDir, options = {}) {
290
290
  const include = resolvedOptions.include ?? [
291
291
  'src',
292
292
  'locales/**/*.json',
293
- 'modern.config.ts',
294
- 'module-federation.config.ts',
295
293
  'package.json',
296
294
  'shared'
297
295
  ];
@@ -325,9 +323,9 @@ function createAppTsConfig(app, remotes = []) {
325
323
  });
326
324
  }
327
325
  function createAppMfTypesTsConfig(app) {
328
- const exposedFiles = Object.values(app.exposes ?? {}).map((exposePath)=>exposePath.replace(/^\.\//u, ''));
326
+ const exposedFiles = Object.entries(app.exposes ?? {}).sort(([left], [right])=>'./Route' === left ? -1 : './Route' === right ? 1 : 0).map(([, exposePath])=>exposePath.replace(/^\.\//u, ''));
329
327
  return {
330
- extends: './tsconfig.json',
328
+ extends: `${relativeRootFor(app.directory)}/tsconfig.base.json`,
331
329
  include: [
332
330
  ...new Set([
333
331
  ...exposedFiles,
@@ -11,6 +11,7 @@ const POSTCSS_VERSION = '8.5.15';
11
11
  const EFFECT_VERSION = '4.0.0-beta.91';
12
12
  const EFFECT_VITEST_VERSION = '4.0.0-beta.91';
13
13
  const EFFECT_TSGO_VERSION = '0.14.6';
14
+ const DRIZZLE_ORM_VERSION = '1.0.0-rc.4';
14
15
  const TYPESCRIPT_STABLE_VERSION = '6.0.3';
15
16
  const TYPESCRIPT_NATIVE_PREVIEW_VERSION = '7.0.0-dev.20260628.1';
16
17
  const TYPESCRIPT_VERSION = TYPESCRIPT_STABLE_VERSION;
@@ -35,7 +36,8 @@ const ultramodernWorkspaceVersions = {
35
36
  moduleFederation: MODULE_FEDERATION_VERSION,
36
37
  effect: EFFECT_VERSION,
37
38
  effectVitest: EFFECT_VITEST_VERSION,
39
+ drizzleOrm: DRIZZLE_ORM_VERSION,
38
40
  tailwind: TAILWIND_VERSION,
39
41
  tailwindPostcss: TAILWIND_POSTCSS_VERSION
40
42
  };
41
- export { CLOUDFLARE_COMPATIBILITY_DATE, EFFECT_TSGO_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, I18NEXT_VERSION, LEFTHOOK_VERSION, MODULE_FEDERATION_AGENT_SKILLS_COMMIT, MODULE_FEDERATION_VERSION, NODE_FETCH_VERSION, NODE_VERSION, OXFMT_VERSION, OXLINT_VERSION, PNPM_VERSION, POSTCSS_VERSION, REACT_DOM_VERSION, REACT_ROUTER_VERSION, REACT_VERSION, RSTACK_AGENT_SKILLS_COMMIT, TAILWIND_POSTCSS_VERSION, TAILWIND_VERSION, TANSTACK_ROUTER_CORE_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, TYPESCRIPT_STABLE_VERSION, TYPESCRIPT_VERSION, TYPES_REACT_DOM_VERSION, TYPES_REACT_VERSION, ULTRACITE_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION, ultramodernWorkspaceVersions };
43
+ export { CLOUDFLARE_COMPATIBILITY_DATE, DRIZZLE_ORM_VERSION, EFFECT_TSGO_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, I18NEXT_VERSION, LEFTHOOK_VERSION, MODULE_FEDERATION_AGENT_SKILLS_COMMIT, MODULE_FEDERATION_VERSION, NODE_FETCH_VERSION, NODE_VERSION, OXFMT_VERSION, OXLINT_VERSION, PNPM_VERSION, POSTCSS_VERSION, REACT_DOM_VERSION, REACT_ROUTER_VERSION, REACT_VERSION, RSTACK_AGENT_SKILLS_COMMIT, TAILWIND_POSTCSS_VERSION, TAILWIND_VERSION, TANSTACK_ROUTER_CORE_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, TYPESCRIPT_STABLE_VERSION, TYPESCRIPT_VERSION, TYPES_REACT_DOM_VERSION, TYPES_REACT_VERSION, ULTRACITE_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION, ultramodernWorkspaceVersions };
@@ -8,7 +8,7 @@ import { packageName, tailwindPrefixForApp } from "./naming.js";
8
8
  import { createCloudflareSecurityContract } from "./policy.js";
9
9
  import { publicSurfaceManagedSourceAssetPaths } from "./public-surface.js";
10
10
  import { createLocalisedUrlsMap, createRouteMetaFilePath, createRouteOwnedI18nPaths, createRoutePageFilePath } from "./routes.js";
11
- import { CLOUDFLARE_COMPATIBILITY_DATE, NODE_VERSION, PNPM_VERSION } from "./versions.js";
11
+ import { CLOUDFLARE_COMPATIBILITY_DATE, EFFECT_VERSION, NODE_VERSION, PNPM_VERSION } from "./versions.js";
12
12
  function createToolWrapperScript(command, extraArgs = []) {
13
13
  const commandJson = JSON.stringify(command);
14
14
  const extraArgsJson = JSON.stringify(extraArgs);
@@ -127,6 +127,7 @@ function createWorkspaceValidationScript(scope, enableTailwind, remotes = []) {
127
127
  const expectedCloudflareSecurity = createCloudflareSecurityContract();
128
128
  return renderFileTemplate("workspace-scripts/validate-ultramodern-workspace.mjs", {
129
129
  packageScope: scope,
130
+ effectVersion: EFFECT_VERSION,
130
131
  nodeVersion: NODE_VERSION,
131
132
  pnpmVersion: PNPM_VERSION,
132
133
  tailwindEnabledJson: JSON.stringify(enableTailwind),
@@ -14,7 +14,7 @@ import { runCodeSmithOverlays } from "./overlays.js";
14
14
  import { createAppMfTypesTsConfig, createAppPackage, createAppTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase } from "./package-json.js";
15
15
  import { resolvePackageSource } from "./package-source.js";
16
16
  import { createPublicWebAppArtifacts } from "./public-surface.js";
17
- import { EFFECT_VERSION, EFFECT_VITEST_VERSION, NODE_FETCH_VERSION, NODE_VERSION, PNPM_VERSION, TANSTACK_ROUTER_CORE_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_VERSION } from "./versions.js";
17
+ import { DRIZZLE_ORM_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, NODE_FETCH_VERSION, NODE_VERSION, PNPM_VERSION, TANSTACK_ROUTER_CORE_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_VERSION } from "./versions.js";
18
18
  import { writeGeneratedWorkspaceScripts } from "./workspace-scripts.js";
19
19
  function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes = [], bridge) {
20
20
  const resolvedApp = 'shell' === app.kind ? createShellHost(remotes) : app;
@@ -130,6 +130,7 @@ function generateUltramodernWorkspace(options) {
130
130
  nodeVersion: NODE_VERSION,
131
131
  pnpmVersion: PNPM_VERSION,
132
132
  nodeFetchVersion: NODE_FETCH_VERSION,
133
+ drizzleOrmVersion: DRIZZLE_ORM_VERSION,
133
134
  effectVersion: EFFECT_VERSION,
134
135
  effectVitestVersion: EFFECT_VITEST_VERSION,
135
136
  tanstackRouterCoreVersion: TANSTACK_ROUTER_CORE_VERSION,