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

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 (48) hide show
  1. package/dist/cjs/ultramodern-workspace/add-vertical.cjs +24 -0
  2. package/dist/cjs/ultramodern-workspace/contracts.cjs +8 -4
  3. package/dist/cjs/ultramodern-workspace/demo-components.cjs +14 -21
  4. package/dist/cjs/ultramodern-workspace/descriptors.cjs +2 -2
  5. package/dist/cjs/ultramodern-workspace/effect-api.cjs +162 -31
  6. package/dist/cjs/ultramodern-workspace/module-federation.cjs +29 -10
  7. package/dist/cjs/ultramodern-workspace/package-json.cjs +102 -14
  8. package/dist/cjs/ultramodern-workspace/versions.cjs +1 -5
  9. package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +7 -0
  10. package/dist/cjs/ultramodern-workspace/write-workspace.cjs +6 -8
  11. package/dist/esm/ultramodern-workspace/add-vertical.js +25 -1
  12. package/dist/esm/ultramodern-workspace/contracts.js +9 -5
  13. package/dist/esm/ultramodern-workspace/demo-components.js +14 -21
  14. package/dist/esm/ultramodern-workspace/descriptors.js +2 -2
  15. package/dist/esm/ultramodern-workspace/effect-api.js +162 -31
  16. package/dist/esm/ultramodern-workspace/module-federation.js +27 -11
  17. package/dist/esm/ultramodern-workspace/package-json.js +87 -11
  18. package/dist/esm/ultramodern-workspace/versions.js +2 -3
  19. package/dist/esm/ultramodern-workspace/workspace-scripts.js +5 -1
  20. package/dist/esm/ultramodern-workspace/write-workspace.js +9 -11
  21. package/dist/esm-node/ultramodern-workspace/add-vertical.js +25 -1
  22. package/dist/esm-node/ultramodern-workspace/contracts.js +9 -5
  23. package/dist/esm-node/ultramodern-workspace/demo-components.js +14 -21
  24. package/dist/esm-node/ultramodern-workspace/descriptors.js +2 -2
  25. package/dist/esm-node/ultramodern-workspace/effect-api.js +162 -31
  26. package/dist/esm-node/ultramodern-workspace/module-federation.js +27 -11
  27. package/dist/esm-node/ultramodern-workspace/package-json.js +87 -11
  28. package/dist/esm-node/ultramodern-workspace/versions.js +2 -3
  29. package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +5 -1
  30. package/dist/esm-node/ultramodern-workspace/write-workspace.js +9 -11
  31. package/dist/types/ultramodern-workspace/module-federation.d.ts +1 -0
  32. package/dist/types/ultramodern-workspace/package-json.d.ts +12 -2
  33. package/dist/types/ultramodern-workspace/versions.d.ts +1 -2
  34. package/dist/types/ultramodern-workspace/workspace-scripts.d.ts +1 -0
  35. package/package.json +4 -4
  36. package/template-workspace/AGENTS.md.handlebars +2 -1
  37. package/template-workspace/README.md.handlebars +7 -0
  38. package/template-workspace/oxfmt.config.ts +3 -1
  39. package/template-workspace/oxlint.config.ts +3 -1
  40. package/template-workspace/patches/@tanstack__router-core@1.171.13.patch +51 -0
  41. package/template-workspace/pnpm-workspace.yaml.handlebars +11 -0
  42. package/template-workspace/scripts/bootstrap-agent-skills.mjs +42 -10
  43. package/templates/app/shell-frame.tsx +1 -2
  44. package/templates/app/ultramodern-route-head.tsx.handlebars +22 -11
  45. package/templates/packages/shared-contracts-index.ts +206 -272
  46. package/templates/workspace-scripts/assert-mf-types.mjs.handlebars +9 -0
  47. package/templates/workspace-scripts/ultramodern-typecheck.mjs +197 -0
  48. package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +234 -2
@@ -1,10 +1,10 @@
1
1
  import { WORKSPACE_PACKAGE_VERSION, modernPackageSpecifier } from "../ultramodern-package-source.js";
2
- import { appHasEffectApi, remoteDependencyAlias, resolveRemoteRefs, shellApp, verticalEffectApps, zephyrRemoteDependency } from "./descriptors.js";
2
+ import { appHasEffectApi, remoteDependencyAlias, resolveRemoteRefs, sharedPackages, shellApp, verticalEffectApps, zephyrRemoteDependency } from "./descriptors.js";
3
3
  import { readFileTemplate } from "./fs-io.js";
4
4
  import { packageName, relativeRootFor } from "./naming.js";
5
5
  import { createPublicSurfaceGenerationCommand } from "./public-surface.js";
6
6
  import { EFFECT_TSGO_VERSION, I18NEXT_VERSION, LEFTHOOK_VERSION, MODULE_FEDERATION_VERSION, NODE_FETCH_VERSION, OXFMT_VERSION, OXLINT_VERSION, PNPM_VERSION, POSTCSS_VERSION, REACT_DOM_VERSION, REACT_ROUTER_VERSION, REACT_VERSION, TAILWIND_POSTCSS_VERSION, TAILWIND_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, TYPESCRIPT_VERSION, TYPES_REACT_DOM_VERSION, TYPES_REACT_VERSION, ULTRACITE_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION } from "./versions.js";
7
- const effectTsgoTypecheckCommand = "node -e \"const fs = require('node:fs'); const { execFileSync, spawnSync } = require('node:child_process'); const bin = execFileSync('effect-tsgo', ['get-exe-path'], { encoding: 'utf8' }).trim(); if (process.platform !== 'win32') fs.chmodSync(bin, 0o755); const result = spawnSync(bin, ['--noEmit', '-p', 'tsconfig.json'], { stdio: 'inherit' }); process.exit(result.status ?? 1);\"";
7
+ const createEffectTsgoTypecheckCommand = (packageDir)=>`node ${relativeRootFor(packageDir)}/scripts/ultramodern-typecheck.mjs --project tsconfig.json`;
8
8
  const effectDiagnostics = [
9
9
  'anyUnknownInErrorContext',
10
10
  'classSelfMismatch',
@@ -150,7 +150,7 @@ function createRootPackageJson(scope, packageSource, remotes = []) {
150
150
  'format:check': "oxfmt --check . '!repos/**'",
151
151
  lint: 'oxlint apps verticals packages',
152
152
  'lint:fix': 'oxlint apps verticals packages --fix',
153
- typecheck: `pnpm -r --filter "@${scope}/*" typecheck`,
153
+ typecheck: "node ./scripts/ultramodern-typecheck.mjs --build tsconfig.json",
154
154
  'cloudflare:build': `${remoteCloudflareBuildPrefix}pnpm --filter "./apps/shell-super-app" run cloudflare:build && pnpm mf:types`,
155
155
  'cloudflare:deploy': `${remoteCloudflareDeployPrefix}pnpm --filter "./apps/shell-super-app" run cloudflare:deploy`,
156
156
  'cloudflare:proof': "node ./scripts/proof-cloudflare-version.mjs --out .codex/reports/cloudflare-version-proof/public-url-proof.json",
@@ -251,17 +251,93 @@ function createTsConfigBase() {
251
251
  }
252
252
  };
253
253
  }
254
- function createPackageTsConfig(packageDir, includeApi = false) {
255
- const include = [
254
+ function createTsBuildInfoFile(packageDir) {
255
+ const cacheKey = packageDir.replace(/[^a-zA-Z0-9._-]+/gu, '__');
256
+ return `${relativeRootFor(packageDir)}/node_modules/.cache/tsgo/${cacheKey}.tsbuildinfo`;
257
+ }
258
+ function createTsDeclarationOutDir(packageDir) {
259
+ const cacheKey = packageDir.replace(/[^a-zA-Z0-9._-]+/gu, '__');
260
+ return `${relativeRootFor(packageDir)}/node_modules/.cache/tsgo/declarations/${cacheKey}`;
261
+ }
262
+ function createReferences(packageDir, references) {
263
+ return [
264
+ ...new Set(references)
265
+ ].filter((reference)=>reference !== packageDir).map((reference)=>({
266
+ path: `${relativeRootFor(packageDir)}/${reference}`
267
+ }));
268
+ }
269
+ function createPackageTsConfig(packageDir, options = {}) {
270
+ const resolvedOptions = 'boolean' == typeof options ? {
271
+ includeApi: options
272
+ } : options;
273
+ const include = resolvedOptions.include ?? [
256
274
  'src',
275
+ 'locales/**/*.json',
257
276
  'modern.config.ts',
258
- 'module-federation.config.ts'
277
+ 'module-federation.config.ts',
278
+ 'package.json',
279
+ 'shared'
259
280
  ];
260
- if (includeApi) include.push('api', 'shared');
261
- return {
281
+ if (resolvedOptions.includeApi) include.push('api');
282
+ const references = createReferences(packageDir, resolvedOptions.references ?? []);
283
+ const tsconfig = {
262
284
  extends: `${relativeRootFor(packageDir)}/tsconfig.base.json`,
285
+ compilerOptions: {
286
+ composite: true,
287
+ declaration: true,
288
+ declarationMap: false,
289
+ emitDeclarationOnly: true,
290
+ incremental: true,
291
+ noEmit: false,
292
+ outDir: createTsDeclarationOutDir(packageDir),
293
+ tsBuildInfoFile: createTsBuildInfoFile(packageDir)
294
+ },
263
295
  include
264
296
  };
297
+ if (references.length > 0) tsconfig.references = references;
298
+ return tsconfig;
299
+ }
300
+ function createAppTsConfig(app, remotes = []) {
301
+ const references = [
302
+ ...sharedPackages.map((sharedPackage)=>sharedPackage.directory),
303
+ ...'shell' === app.kind ? verticalEffectApps(remotes).map((remote)=>remote.directory) : resolveRemoteRefs(app, remotes).map((remote)=>remote.directory)
304
+ ];
305
+ return createPackageTsConfig(app.directory, {
306
+ includeApi: appHasEffectApi(app),
307
+ references
308
+ });
309
+ }
310
+ function createAppMfTypesTsConfig(app) {
311
+ const exposedFiles = Object.values(app.exposes ?? {}).map((exposePath)=>exposePath.replace(/^\.\//u, ''));
312
+ return {
313
+ extends: './tsconfig.json',
314
+ include: [
315
+ ...new Set([
316
+ ...exposedFiles,
317
+ 'src/modern-app-env.d.ts'
318
+ ])
319
+ ]
320
+ };
321
+ }
322
+ function createSharedPackageTsConfig(packageDir) {
323
+ return createPackageTsConfig(packageDir, {
324
+ include: [
325
+ 'src'
326
+ ]
327
+ });
328
+ }
329
+ function createRootTsConfig(apps = []) {
330
+ return {
331
+ files: [],
332
+ references: [
333
+ ...sharedPackages.map((sharedPackage)=>({
334
+ path: sharedPackage.directory
335
+ })),
336
+ ...apps.map((app)=>({
337
+ path: app.directory
338
+ }))
339
+ ]
340
+ };
265
341
  }
266
342
  function createAppPackage(scope, app, packageSource, enableTailwind, remotes = []) {
267
343
  const publicSurfaceBuildCommand = createPublicSurfaceGenerationCommand(app, 'dist');
@@ -283,7 +359,7 @@ function createAppPackage(scope, app, packageSource, enableTailwind, remotes = [
283
359
  'cloudflare:preview': 'pnpm run cloudflare:build && wrangler dev --config .output/wrangler.json',
284
360
  'cloudflare:proof': `node ${relativeRootFor(app.directory)}/scripts/proof-cloudflare-version.mjs --app ${app.id}`,
285
361
  serve: 'modern serve',
286
- typecheck: effectTsgoTypecheckCommand
362
+ typecheck: createEffectTsgoTypecheckCommand(app.directory)
287
363
  },
288
364
  modernjs: {
289
365
  preset: 'presetUltramodern',
@@ -319,7 +395,7 @@ function createSharedPackage(scope, id, description) {
319
395
  '.': './src/index.ts'
320
396
  },
321
397
  scripts: {
322
- typecheck: effectTsgoTypecheckCommand
398
+ typecheck: createEffectTsgoTypecheckCommand(`packages/${id}`)
323
399
  },
324
400
  devDependencies: {
325
401
  '@effect/tsgo': EFFECT_TSGO_VERSION,
@@ -335,4 +411,4 @@ function createSharedPackage(scope, id, description) {
335
411
  function createSharedContractsIndex() {
336
412
  return readFileTemplate('packages/shared-contracts-index.ts');
337
413
  }
338
- export { appDependencies, appDevDependencies, createAppPackage, createPackageTsConfig, createRootPackageJson, createSharedContractsIndex, createSharedPackage, createTsConfigBase, createZephyrDependencies, effectDiagnostics, effectTsgoTypecheckCommand };
414
+ export { appDependencies, appDevDependencies, createAppMfTypesTsConfig, createAppPackage, createAppTsConfig, createEffectTsgoTypecheckCommand, createPackageTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase, createZephyrDependencies, effectDiagnostics };
@@ -9,9 +9,8 @@ const TAILWIND_POSTCSS_VERSION = '4.3.1';
9
9
  const POSTCSS_VERSION = '8.5.15';
10
10
  const EFFECT_TSGO_VERSION = '0.14.6';
11
11
  const TYPESCRIPT_STABLE_VERSION = '6.0.3';
12
- const TYPESCRIPT_7_VERSION = '7.0.1-rc';
13
- const TYPESCRIPT_VERSION = TYPESCRIPT_STABLE_VERSION;
14
12
  const TYPESCRIPT_NATIVE_PREVIEW_VERSION = '7.0.0-dev.20260624.1';
13
+ const TYPESCRIPT_VERSION = TYPESCRIPT_STABLE_VERSION;
15
14
  const OXLINT_VERSION = '1.71.0';
16
15
  const OXFMT_VERSION = '0.55.0';
17
16
  const ULTRACITE_VERSION = '7.8.3';
@@ -33,4 +32,4 @@ const ultramodernWorkspaceVersions = {
33
32
  tailwind: TAILWIND_VERSION,
34
33
  tailwindPostcss: TAILWIND_POSTCSS_VERSION
35
34
  };
36
- export { CLOUDFLARE_COMPATIBILITY_DATE, EFFECT_TSGO_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_VERSION, TYPESCRIPT_7_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 };
35
+ export { CLOUDFLARE_COMPATIBILITY_DATE, EFFECT_TSGO_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_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 };
@@ -79,6 +79,9 @@ function createPerformanceReadinessConfigScript() {
79
79
  function createPerformanceReadinessScript() {
80
80
  return readFileTemplate("workspace-scripts/ultramodern-performance-readiness.mjs");
81
81
  }
82
+ function createUltramodernTypecheckScript() {
83
+ return readFileTemplate("workspace-scripts/ultramodern-typecheck.mjs");
84
+ }
82
85
  function writeGeneratedWorkspaceScripts(targetDir, scope, enableTailwind, remotes = []) {
83
86
  writeFileReplacing(targetDir, "scripts/assert-mf-types.mjs", createAssertMfTypesScript(remotes));
84
87
  writeFileReplacing(targetDir, "scripts/validate-ultramodern-workspace.mjs", createWorkspaceValidationScript(scope, enableTailwind, remotes));
@@ -88,5 +91,6 @@ function writeGeneratedWorkspaceScripts(targetDir, scope, enableTailwind, remote
88
91
  writeFileReplacing(targetDir, "scripts/proof-cloudflare-version.mjs", createCloudflareVersionProofScript());
89
92
  writeFileReplacing(targetDir, "scripts/ultramodern-performance-readiness.config.mjs", createPerformanceReadinessConfigScript());
90
93
  writeFileReplacing(targetDir, "scripts/ultramodern-performance-readiness.mjs", createPerformanceReadinessScript());
94
+ writeFileReplacing(targetDir, "scripts/ultramodern-typecheck.mjs", createUltramodernTypecheckScript());
91
95
  }
92
- export { createAssertMfTypesScript, createCloudflareProofHelperScript, createCloudflareVersionProofScript, createPerformanceReadinessConfigScript, createPerformanceReadinessScript, createPublicSurfaceAssetsScript, createWorkspaceI18nBoundaryValidationScript, createWorkspaceValidationScript, writeGeneratedWorkspaceScripts };
96
+ export { createAssertMfTypesScript, createCloudflareProofHelperScript, createCloudflareVersionProofScript, createPerformanceReadinessConfigScript, createPerformanceReadinessScript, createPublicSurfaceAssetsScript, createUltramodernTypecheckScript, createWorkspaceI18nBoundaryValidationScript, createWorkspaceValidationScript, writeGeneratedWorkspaceScripts };
@@ -7,10 +7,10 @@ import { createEffectClient, createEffectServiceEntry, createEffectSharedApi, cr
7
7
  import { copyRootTemplate, writeFile, writeJson } from "./fs-io.js";
8
8
  import { createFileSnapshot, createGenerationResult, diffFileSnapshots } from "./generation-result.js";
9
9
  import { createAppPublicLocaleMessages } from "./locales.js";
10
- import { createAppModernConfig, createRemoteModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule } from "./module-federation.js";
11
- import { assertUniqueTailwindPrefixes, relativeRootFor, toPackageScope } from "./naming.js";
10
+ import { createAppModernConfig, createRemoteModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule, createUltramodernBuildReexportModule } from "./module-federation.js";
11
+ import { assertUniqueTailwindPrefixes, toPackageScope } from "./naming.js";
12
12
  import { runCodeSmithOverlays } from "./overlays.js";
13
- import { createAppPackage, createPackageTsConfig, createRootPackageJson, createSharedContractsIndex, createSharedPackage, createTsConfigBase } from "./package-json.js";
13
+ import { createAppMfTypesTsConfig, createAppPackage, createAppTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase } from "./package-json.js";
14
14
  import { resolvePackageSource } from "./package-source.js";
15
15
  import { createPublicWebAppArtifacts } from "./public-surface.js";
16
16
  import { NODE_FETCH_VERSION, NODE_VERSION, PNPM_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_VERSION } from "./versions.js";
@@ -22,9 +22,11 @@ function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes
22
22
  writeFile(targetDir, `${resolvedApp.directory}/${relativePath}`, content);
23
23
  };
24
24
  writeJson(targetDir, `${resolvedApp.directory}/package.json`, createAppPackage(scope, resolvedApp, packageSource, enableTailwind, remotes));
25
- writeJson(targetDir, `${resolvedApp.directory}/tsconfig.json`, createPackageTsConfig(resolvedApp.directory, appHasEffectApi(resolvedApp)));
25
+ writeJson(targetDir, `${resolvedApp.directory}/tsconfig.json`, createAppTsConfig(resolvedApp, remotes));
26
+ writeJson(targetDir, `${resolvedApp.directory}/tsconfig.mf-types.json`, createAppMfTypesTsConfig(resolvedApp));
26
27
  writeFile(targetDir, `${resolvedApp.directory}/src/modern-app-env.d.ts`, createAppEnvDts(resolvedApp, remotes));
27
- writeFile(targetDir, `${resolvedApp.directory}/src/ultramodern-build.ts`, createUltramodernBuildModule(scope, resolvedApp));
28
+ writeFile(targetDir, `${resolvedApp.directory}/src/ultramodern-build.ts`, createUltramodernBuildReexportModule());
29
+ writeFile(targetDir, `${resolvedApp.directory}/shared/ultramodern-build.ts`, createUltramodernBuildModule(scope, resolvedApp));
28
30
  writeFile(targetDir, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
29
31
  writeFile(targetDir, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
30
32
  writeFile(targetDir, publicWeb.routeHeadFile.path, publicWeb.routeHeadFile.content);
@@ -65,12 +67,7 @@ function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes
65
67
  function writeSharedPackages(targetDir, scope) {
66
68
  for (const sharedPackage of sharedPackages){
67
69
  writeJson(targetDir, `${sharedPackage.directory}/package.json`, createSharedPackage(scope, sharedPackage.id, sharedPackage.description));
68
- writeJson(targetDir, `${sharedPackage.directory}/tsconfig.json`, {
69
- extends: `${relativeRootFor(sharedPackage.directory)}/tsconfig.base.json`,
70
- include: [
71
- 'src'
72
- ]
73
- });
70
+ writeJson(targetDir, `${sharedPackage.directory}/tsconfig.json`, createSharedPackageTsConfig(sharedPackage.directory));
74
71
  }
75
72
  writeFile(targetDir, 'packages/shared-contracts/src/index.ts', createSharedContractsIndex());
76
73
  writeFile(targetDir, 'packages/shared-design-tokens/src/index.ts', `export const sharedDesignTokens = {
@@ -112,6 +109,7 @@ function generateUltramodernWorkspace(options) {
112
109
  });
113
110
  writeJson(options.targetDir, 'package.json', createRootPackageJson(scope, packageSource, initialVerticals));
114
111
  writeJson(options.targetDir, 'tsconfig.base.json', createTsConfigBase());
112
+ writeJson(options.targetDir, 'tsconfig.json', createRootTsConfig(createdApps));
115
113
  writeJson(options.targetDir, 'topology/reference-topology.json', createTopology(scope, initialVerticals));
116
114
  writeJson(options.targetDir, 'topology/ownership.json', createOwnership(scope, initialVerticals));
117
115
  writeJson(options.targetDir, 'topology/local-overlays/development.json', createDevelopmentOverlay(initialVerticals));
@@ -14,7 +14,7 @@ import { createAppPublicLocaleMessages } from "./locales.js";
14
14
  import { createShellModuleFederationConfig } from "./module-federation.js";
15
15
  import { assertUniqueTailwindPrefixes, normalizePath, packageName, toEnvSegment, toKebabCase, toPackageScope, toPascalCase } from "./naming.js";
16
16
  import { runCodeSmithOverlays } from "./overlays.js";
17
- import { createAppPackage, createRootPackageJson } from "./package-json.js";
17
+ import { createAppMfTypesTsConfig, createAppPackage, createAppTsConfig, createRootPackageJson, createRootTsConfig } from "./package-json.js";
18
18
  import { resolvePackageSource } from "./package-source.js";
19
19
  import { createCloudflareDeployContract } from "./policy.js";
20
20
  import { createPublicWebAppArtifacts, rewriteWorkspaceAssetsForApp } from "./public-surface.js";
@@ -86,6 +86,8 @@ function rewriteShellAppFiles(workspaceRoot, scope, packageSource, enableTailwin
86
86
  const shellHost = createShellHost(remotes);
87
87
  const publicWeb = createPublicWebAppArtifacts(shellHost);
88
88
  writeJsonFile(node_path.join(workspaceRoot, `${shellApp.directory}/package.json`), createAppPackage(scope, shellHost, packageSource, enableTailwind, remotes));
89
+ writeJsonFile(node_path.join(workspaceRoot, `${shellApp.directory}/tsconfig.json`), createAppTsConfig(shellHost, remotes));
90
+ writeJsonFile(node_path.join(workspaceRoot, `${shellApp.directory}/tsconfig.mf-types.json`), createAppMfTypesTsConfig(shellHost));
89
91
  writeFileReplacing(workspaceRoot, `${shellApp.directory}/src/modern-app-env.d.ts`, createAppEnvDts(shellHost, remotes));
90
92
  writeFileReplacing(workspaceRoot, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
91
93
  writeFileReplacing(workspaceRoot, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
@@ -426,6 +428,21 @@ function createDryRunJsonMutations(preflight, manifestUrl) {
426
428
  pointer: '/dependencies',
427
429
  description: `Wire shell dependencies for ${vertical.id}`
428
430
  },
431
+ {
432
+ path: 'tsconfig.json',
433
+ pointer: '/references',
434
+ description: `Add ${vertical.id} to the root TS-Go build graph`
435
+ },
436
+ {
437
+ path: `${shellApp.directory}/tsconfig.json`,
438
+ pointer: '/references',
439
+ description: `Add ${vertical.id} to the shell TS-Go project references`
440
+ },
441
+ {
442
+ path: `${shellApp.directory}/tsconfig.mf-types.json`,
443
+ pointer: '/include',
444
+ description: 'Keep shell Module Federation DTS compilation scoped'
445
+ },
429
446
  {
430
447
  path: GENERATED_CONTRACT_PATH,
431
448
  pointer: '/apps',
@@ -489,6 +506,13 @@ function addUltramodernVertical(options) {
489
506
  addShellZephyrDependency(options.workspaceRoot, scope, vertical);
490
507
  addShellWorkspaceDependency(options.workspaceRoot, scope, vertical);
491
508
  updateRootWorkspaceScripts(options.workspaceRoot, scope, packageSource, updatedVerticals);
509
+ writeJsonFile(node_path.join(options.workspaceRoot, 'tsconfig.json'), createRootTsConfig([
510
+ {
511
+ ...shellApp,
512
+ verticalRefs: updatedVerticals.map((vertical)=>vertical.id)
513
+ },
514
+ ...updatedVerticals
515
+ ]));
492
516
  const afterFiles = createFileSnapshot(options.workspaceRoot);
493
517
  const { createdPaths, rewrittenPaths } = diffFileSnapshots(beforeFiles, afterFiles);
494
518
  const result = createGenerationResult({
@@ -8,7 +8,7 @@ import { createRspackChunkLoadingGlobal, createRspackUniqueName, packageName, ta
8
8
  import { createCloudflareDeployContract, createCloudflareSecurityContract } from "./policy.js";
9
9
  import { createPublicWebAppArtifacts } from "./public-surface.js";
10
10
  import { createLocalisedUrlsMap, createPublicRouteMetadata, createRouteOwnedI18nPaths } from "./routes.js";
11
- import { CLOUDFLARE_COMPATIBILITY_DATE, I18NEXT_VERSION, MODULE_FEDERATION_AGENT_SKILLS_COMMIT, MODULE_FEDERATION_VERSION, NODE_VERSION, PNPM_VERSION, RSTACK_AGENT_SKILLS_COMMIT, TANSTACK_ROUTER_VERSION, TYPESCRIPT_7_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, TYPESCRIPT_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION } from "./versions.js";
11
+ import { CLOUDFLARE_COMPATIBILITY_DATE, I18NEXT_VERSION, MODULE_FEDERATION_AGENT_SKILLS_COMMIT, MODULE_FEDERATION_VERSION, NODE_VERSION, PNPM_VERSION, RSTACK_AGENT_SKILLS_COMMIT, TANSTACK_ROUTER_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, TYPESCRIPT_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION } from "./versions.js";
12
12
  const baselineAgentSkills = [
13
13
  'rsbuild-best-practices',
14
14
  'rspack-best-practices',
@@ -186,7 +186,7 @@ function createAppConfigContract(app) {
186
186
  ],
187
187
  default: '/'
188
188
  },
189
- disableTsChecker: true,
189
+ disableTsChecker: false,
190
190
  distPath: {
191
191
  html: './'
192
192
  },
@@ -545,8 +545,9 @@ function createAppGeneratedContract(scope, app, apps, enableTailwind) {
545
545
  } : {},
546
546
  exposes: Object.keys(app.exposes ?? {}),
547
547
  dts: {
548
+ compilerInstance: 'tsgo',
548
549
  displayErrorInTerminal: true,
549
- compilerInstance: 'tsgo'
550
+ tsConfigPath: './tsconfig.mf-types.json'
550
551
  },
551
552
  browserSafeExposesOnly: true,
552
553
  zephyrRspackPlugin: ZEPHYR_RSPACK_PLUGIN_VERSION
@@ -598,8 +599,8 @@ function createGeneratedContract(scope, apps = [
598
599
  toolchain: 'mise'
599
600
  },
600
601
  versions: {
601
- typescript: TYPESCRIPT_VERSION,
602
- typescript7Rc: TYPESCRIPT_7_VERSION,
602
+ typescript: TYPESCRIPT_NATIVE_PREVIEW_VERSION,
603
+ typescriptCompatibility: TYPESCRIPT_VERSION,
603
604
  typescriptNativePreview: TYPESCRIPT_NATIVE_PREVIEW_VERSION,
604
605
  moduleFederation: MODULE_FEDERATION_VERSION,
605
606
  tanstackRouter: TANSTACK_ROUTER_VERSION,
@@ -666,9 +667,11 @@ function createTemplateManifest(modernVersion, packageSource) {
666
667
  'package.json',
667
668
  'oxfmt.config.ts',
668
669
  'oxlint.config.ts',
670
+ 'patches/**',
669
671
  'pnpm-workspace.yaml',
670
672
  "scripts/**",
671
673
  'topology/**',
674
+ 'tsconfig.json',
672
675
  'tsconfig.base.json'
673
676
  ],
674
677
  deniedPaths: [
@@ -733,6 +736,7 @@ function createTemplateManifest(modernVersion, packageSource) {
733
736
  expectedCommands: [
734
737
  'mise install',
735
738
  'pnpm install',
739
+ 'pnpm run typecheck',
736
740
  'pnpm run i18n:boundaries',
737
741
  'pnpm run contract:check',
738
742
  'pnpm run performance:readiness'
@@ -11,8 +11,7 @@ import { VerticalShowcase } from '../vertical-components';
11
11
  import { ultramodernUiMarker } from '../../ultramodern-build';
12
12
 
13
13
  export default function ShellHome() {
14
- const { i18nInstance } = useModernI18n();
15
- const t = i18nInstance['t'].bind(i18nInstance);
14
+ const { t } = useModernI18n();
16
15
 
17
16
  return (
18
17
  <ShellFrame>
@@ -85,13 +84,14 @@ const loadRemoteComponent = (specifier: string) =>
85
84
 
86
85
  const createRemoteFallback = (specifier: string) =>
87
86
  ({ error }: { error: Error }) => {
88
- const { i18nInstance } = useModernI18n();
89
- const t = i18nInstance['t'].bind(i18nInstance);
87
+ const { t } = useModernI18n();
90
88
  const classification = classifyModuleFederationFallback(error);
89
+ const telemetryEntry =
90
+ typeof window === 'undefined' ? undefined : window.location.href;
91
91
  const telemetry = createModuleFederationFallbackTelemetry({
92
92
  appName: '${shellApp.id}',
93
93
  classification,
94
- entry: typeof window === 'undefined' ? undefined : window.location.href,
94
+ ...(telemetryEntry === undefined ? {} : { entry: telemetryEntry }),
95
95
  error,
96
96
  eventName: 'mf.client.remote.fallback',
97
97
  exportName: 'default',
@@ -104,7 +104,7 @@ const createRemoteFallback = (specifier: string) =>
104
104
  void emitModuleFederationFallbackTelemetry({
105
105
  appName: telemetry.appName,
106
106
  classification,
107
- entry: telemetry.entry,
107
+ ...(telemetry.entry === undefined ? {} : { entry: telemetry.entry }),
108
108
  error,
109
109
  eventName: telemetry.eventName,
110
110
  exportName: 'default',
@@ -113,7 +113,7 @@ const createRemoteFallback = (specifier: string) =>
113
113
  remote: specifier,
114
114
  status: 'degraded',
115
115
  });
116
- }, [classification, error, specifier, telemetry]);
116
+ }, [classification, error, telemetry]);
117
117
 
118
118
  return <div className="${tw('rounded-xl border border-red-900/20 bg-red-50 px-4 py-3 text-sm font-semibold text-red-900')}" data-remote-error={error.name} {...toModuleFederationFallbackAttributes(telemetry)}>{t('shell.remoteUnavailable')}</div>;
119
119
  };
@@ -168,8 +168,7 @@ const createHydratedRemote =
168
168
  ${hydratedExports}
169
169
 
170
170
  export const Header = () => {
171
- const { i18nInstance } = useModernI18n();
172
- const t = i18nInstance['t'].bind(i18nInstance);
171
+ const { t } = useModernI18n();
173
172
 
174
173
  return (
175
174
  <header className="${tw('flex min-w-0 flex-wrap items-center gap-x-8 gap-y-2 md:flex-1')}" data-modern-boundary-id="${shellApp.mfName}" data-modern-mf-expose="shell/Header">
@@ -179,8 +178,7 @@ const createHydratedRemote =
179
178
  };
180
179
 
181
180
  export const StatusBadge = () => {
182
- const { i18nInstance } = useModernI18n();
183
- const t = i18nInstance['t'].bind(i18nInstance);
181
+ const { t } = useModernI18n();
184
182
 
185
183
  return (
186
184
  <span className="${tw('inline-flex h-10 shrink-0 items-center justify-center rounded-full border border-stone-900/15 bg-white px-4 text-sm font-extrabold text-stone-950 shadow-lg shadow-stone-900/5')}">
@@ -190,8 +188,7 @@ export const StatusBadge = () => {
190
188
  };
191
189
 
192
190
  export const VerticalShowcase = () => {
193
- const { i18nInstance } = useModernI18n();
194
- const t = i18nInstance['t'].bind(i18nInstance);
191
+ const { t } = useModernI18n();
195
192
 
196
193
  if (widgetCount === 0) {
197
194
  return (
@@ -258,8 +255,7 @@ import { ultramodernUiMarker } from '../../ultramodern-build';
258
255
  ` : '';
259
256
  return `${effectBffImport}
260
257
  export default function ${toPascalCase(app.id)}Home() {
261
- const { i18nInstance, language, supportedLanguages } = useModernI18n();
262
- const t = i18nInstance['t'].bind(i18nInstance);
258
+ const { language, supportedLanguages, t } = useModernI18n();
263
259
  ${effectBffState} return (
264
260
  <main className="${tw('min-h-screen bg-um-canvas px-4 py-6 text-um-foreground sm:px-8')}">
265
261
  <UltramodernRouteHead />
@@ -305,8 +301,7 @@ function createRemoteEntry(app) {
305
301
  return `import { useModernI18n } from '@modern-js/plugin-i18n/runtime';
306
302
 
307
303
  export default function ${toPascalCase(domain)}Route() {
308
- const { i18nInstance } = useModernI18n();
309
- const t = i18nInstance['t'].bind(i18nInstance);
304
+ const { t } = useModernI18n();
310
305
 
311
306
  return (
312
307
  <section className="${tw('rounded-2xl bg-white/90 p-5 shadow-xl shadow-stone-900/10')}" data-modern-boundary-id="${app.mfName}" data-modern-mf-expose="./Route">
@@ -324,8 +319,7 @@ function createRemoteWidget(app) {
324
319
  return `import { useModernI18n } from '@modern-js/plugin-i18n/runtime';
325
320
 
326
321
  export default function ${componentName}() {
327
- const { i18nInstance } = useModernI18n();
328
- const t = i18nInstance['t'].bind(i18nInstance);
322
+ const { t } = useModernI18n();
329
323
 
330
324
  return (
331
325
  <section className="${tw('rounded-2xl bg-white/90 p-5 shadow-xl shadow-stone-900/10')}" data-modern-boundary-id="${app.mfName}" data-modern-mf-expose="./Widget">
@@ -344,8 +338,7 @@ function createRemoteExposeComponent(app, expose) {
344
338
  return `import { useModernI18n } from '@modern-js/plugin-i18n/runtime';
345
339
 
346
340
  export default function ${componentName}() {
347
- const { i18nInstance } = useModernI18n();
348
- const t = i18nInstance['t'].bind(i18nInstance);
341
+ const { t } = useModernI18n();
349
342
 
350
343
  return (
351
344
  <section className="${tw('rounded-2xl bg-white/90 p-5 shadow-xl shadow-stone-900/10')}" data-modern-boundary-id="${app.mfName}" data-modern-mf-expose="${expose}">
@@ -36,12 +36,12 @@ const sharedPackages = [
36
36
  {
37
37
  id: 'shared-contracts',
38
38
  directory: 'packages/shared-contracts',
39
- description: 'Route, ownership, and topology contract placeholders.'
39
+ description: 'Generated route, ownership, and topology contracts.'
40
40
  },
41
41
  {
42
42
  id: 'shared-design-tokens',
43
43
  directory: 'packages/shared-design-tokens',
44
- description: 'Design token placeholders consumed by shell and verticals.'
44
+ description: 'Generated design tokens consumed by shell and verticals.'
45
45
  }
46
46
  ];
47
47
  function createNeutralOwnership(id, tier = 'tier-2-vertical') {