@bleedingdev/modern-js-ultramodern-create 3.9.0-ultramodern.2 → 3.9.0-ultramodern.4

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 (93) hide show
  1. package/dist/cjs/ultramodern-package-source.cjs +2 -1
  2. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.cjs +5 -2
  3. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.cjs +5 -0
  4. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.cjs +1 -0
  5. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.cjs +30 -9
  6. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.cjs +9 -13
  7. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.cjs +30 -7
  8. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/shared-api-infrastructure.cjs +99 -0
  9. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/toolchain-pins.cjs +14 -5
  10. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/workspace-artifact-ownership.cjs +215 -0
  11. package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect.cjs +72 -8
  12. package/dist/cjs/ultramodern-workspace/api/client.cjs +2 -2
  13. package/dist/cjs/ultramodern-workspace/api/service.cjs +45 -16
  14. package/dist/cjs/ultramodern-workspace/api/shared.cjs +26 -16
  15. package/dist/cjs/ultramodern-workspace/mf-validation/inspect.cjs +6 -2
  16. package/dist/cjs/ultramodern-workspace/module-federation/reexport-module.cjs +18 -51
  17. package/dist/cjs/ultramodern-workspace/package-json.cjs +13 -1
  18. package/dist/cjs/ultramodern-workspace/policy.cjs +1 -0
  19. package/dist/cjs/ultramodern-workspace/tsconfigs.cjs +3 -0
  20. package/dist/cjs/ultramodern-workspace/workspace-script-plan.cjs +1 -1
  21. package/dist/cjs/ultramodern-workspace/workspace-scripts.cjs +5 -0
  22. package/dist/cjs/ultramodern-workspace/workspace-validation-contract.cjs +2 -1
  23. package/dist/cjs/ultramodern-workspace/write-app.cjs +10 -4
  24. package/dist/cjs/ultramodern-workspace/write-workspace.cjs +5 -3
  25. package/dist/esm/ultramodern-package-source.js +2 -1
  26. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.js +5 -2
  27. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.js +5 -0
  28. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.js +1 -0
  29. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.js +30 -9
  30. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.js +9 -13
  31. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.js +30 -7
  32. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/shared-api-infrastructure.js +50 -0
  33. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/toolchain-pins.js +14 -5
  34. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/workspace-artifact-ownership.js +166 -0
  35. package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect.js +73 -9
  36. package/dist/esm/ultramodern-workspace/api/client.js +2 -2
  37. package/dist/esm/ultramodern-workspace/api/service.js +45 -16
  38. package/dist/esm/ultramodern-workspace/api/shared.js +27 -17
  39. package/dist/esm/ultramodern-workspace/mf-validation/inspect.js +6 -2
  40. package/dist/esm/ultramodern-workspace/module-federation/reexport-module.js +18 -51
  41. package/dist/esm/ultramodern-workspace/package-json.js +13 -1
  42. package/dist/esm/ultramodern-workspace/policy.js +1 -0
  43. package/dist/esm/ultramodern-workspace/tsconfigs.js +3 -0
  44. package/dist/esm/ultramodern-workspace/workspace-script-plan.js +1 -1
  45. package/dist/esm/ultramodern-workspace/workspace-scripts.js +5 -0
  46. package/dist/esm/ultramodern-workspace/workspace-validation-contract.js +2 -1
  47. package/dist/esm/ultramodern-workspace/write-app.js +10 -4
  48. package/dist/esm/ultramodern-workspace/write-workspace.js +6 -4
  49. package/dist/esm-node/ultramodern-package-source.js +2 -1
  50. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.js +5 -2
  51. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.js +5 -0
  52. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.js +1 -0
  53. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.js +30 -9
  54. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.js +9 -13
  55. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.js +30 -7
  56. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/shared-api-infrastructure.js +51 -0
  57. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/toolchain-pins.js +14 -5
  58. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/workspace-artifact-ownership.js +167 -0
  59. package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect.js +73 -9
  60. package/dist/esm-node/ultramodern-workspace/api/client.js +2 -2
  61. package/dist/esm-node/ultramodern-workspace/api/service.js +45 -16
  62. package/dist/esm-node/ultramodern-workspace/api/shared.js +27 -17
  63. package/dist/esm-node/ultramodern-workspace/mf-validation/inspect.js +6 -2
  64. package/dist/esm-node/ultramodern-workspace/module-federation/reexport-module.js +18 -51
  65. package/dist/esm-node/ultramodern-workspace/package-json.js +13 -1
  66. package/dist/esm-node/ultramodern-workspace/policy.js +1 -0
  67. package/dist/esm-node/ultramodern-workspace/tsconfigs.js +3 -0
  68. package/dist/esm-node/ultramodern-workspace/workspace-script-plan.js +1 -1
  69. package/dist/esm-node/ultramodern-workspace/workspace-scripts.js +5 -0
  70. package/dist/esm-node/ultramodern-workspace/workspace-validation-contract.js +2 -1
  71. package/dist/esm-node/ultramodern-workspace/write-app.js +10 -4
  72. package/dist/esm-node/ultramodern-workspace/write-workspace.js +6 -4
  73. package/dist/types/ultramodern-package-source.d.ts +1 -1
  74. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.d.ts +3 -1
  75. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.d.ts +7 -0
  76. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/shared-api-infrastructure.d.ts +4 -0
  77. package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/workspace-artifact-ownership.d.ts +27 -0
  78. package/dist/types/ultramodern-workspace/api/client.d.ts +3 -1
  79. package/dist/types/ultramodern-workspace/api/service.d.ts +3 -1
  80. package/dist/types/ultramodern-workspace/api/shared.d.ts +2 -0
  81. package/dist/types/ultramodern-workspace/module-federation/reexport-module.d.ts +2 -2
  82. package/dist/types/ultramodern-workspace/package-json.d.ts +1 -1
  83. package/dist/types/ultramodern-workspace/policy.d.ts +2 -0
  84. package/dist/types/ultramodern-workspace/workspace-validation-contract.d.ts +1 -1
  85. package/package.json +5 -4
  86. package/template-workspace/.modernjs/release-cohort.json +40 -40
  87. package/template-workspace/scripts/bootstrap-agent-skills.mjs +4 -4
  88. package/templates/packages/effect-bff-runtime.ts +50 -0
  89. package/templates/packages/microvertical-api-baseline.ts +102 -0
  90. package/templates/workspace-scripts/check-ultramodern-api-boundaries.mts +49 -28
  91. package/templates/workspace-scripts/microvertical-api-baseline-boundary.mts +944 -0
  92. package/templates/workspace-scripts/ultramodern-cloudflare-proof.mjs +25 -7
  93. package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +1 -1
@@ -1,11 +1,16 @@
1
1
  import "node:module";
2
2
  import node_fs from "node:fs";
3
3
  import node_path from "node:path";
4
+ import { semver } from "@modern-js/utils";
4
5
  import { ULTRAMODERN_PACKAGE_PINS, ULTRAMODERN_WORKSPACE_POLICY } from "../../../ultramodern-workspace/policy.js";
5
6
  const { toolchain: toolchain } = ULTRAMODERN_WORKSPACE_POLICY;
6
7
  const retiredRootToolingDependencies = [
7
8
  "@typescript/typescript6"
8
9
  ];
10
+ function migrationPnpmVersion(value) {
11
+ const baseline = toolchain.packageManager.version;
12
+ return 'string' == typeof value && semver.valid(value) && semver.major(value) === semver.major(baseline) && semver.gte(value, baseline) ? value : baseline;
13
+ }
9
14
  function isRecord(value) {
10
15
  return Boolean(value) && 'object' == typeof value && !Array.isArray(value);
11
16
  }
@@ -23,22 +28,24 @@ function updateUltramodernConfigToolchain(config) {
23
28
  const workspace = ensureRecord(config, 'workspace', 'workspace');
24
29
  const packageManager = ensureRecord(workspace, 'packageManager', 'workspace.packageManager');
25
30
  packageManager.name = toolchain.packageManager.name;
26
- packageManager.version = toolchain.packageManager.version;
31
+ packageManager.version = migrationPnpmVersion(packageManager.version);
27
32
  const node = ensureRecord(workspace, 'node', 'workspace.node');
28
33
  node.version = toolchain.node.version;
29
34
  node.engineRange = toolchain.node.engineRange;
30
35
  }
31
36
  function updateRootPackageToolchain(packageJson) {
32
- packageJson.packageManager = `${toolchain.packageManager.name}@${toolchain.packageManager.version}`;
37
+ const currentVersion = 'string' == typeof packageJson.packageManager ? packageJson.packageManager.match(/^pnpm@([^+]+)(?:\+.*)?$/u)?.[1] : void 0;
38
+ packageJson.packageManager = `${toolchain.packageManager.name}@${migrationPnpmVersion(currentVersion)}`;
33
39
  const engines = ensureRecord(packageJson, 'engines', 'package.json engines');
34
40
  engines.node = toolchain.node.engineRange;
35
41
  engines.pnpm = toolchain.packageManager.engineRange;
36
42
  const devDependencies = ensureRecord(packageJson, 'devDependencies', 'package.json devDependencies');
37
43
  for (const packageName of retiredRootToolingDependencies)delete devDependencies[packageName];
38
44
  devDependencies["@typescript/native"] = ULTRAMODERN_PACKAGE_PINS.rootDevDependencies["@typescript/native"];
45
+ devDependencies['@types/node'] = ULTRAMODERN_PACKAGE_PINS.rootDevDependencies["@types/node"];
39
46
  devDependencies.miniflare = ULTRAMODERN_PACKAGE_PINS.rootDevDependencies.miniflare;
40
47
  }
41
- function updateMiseTools(content) {
48
+ function updateMiseTools(content, pnpmVersion) {
42
49
  const lines = content.replace(/\r\n/gu, '\n').split('\n');
43
50
  if ('' === lines.at(-1)) lines.pop();
44
51
  let toolsStart = lines.findIndex((line)=>/^\s*\[tools\]\s*(?:#.*)?$/u.test(line));
@@ -65,13 +72,15 @@ function updateMiseTools(content) {
65
72
  lines[index] = line;
66
73
  };
67
74
  upsertTool('node', toolchain.node.version);
68
- upsertTool('pnpm', toolchain.packageManager.version);
75
+ upsertTool('pnpm', pnpmVersion);
69
76
  return `${lines.join('\n')}\n`;
70
77
  }
71
78
  function updateGeneratedToolchainFiles(io) {
72
79
  const misePath = node_path.join(io.workspaceRoot, '.mise.toml');
73
80
  const miseContent = node_fs.existsSync(misePath) ? node_fs.readFileSync(misePath, 'utf-8') : '';
74
- io.write(misePath, updateMiseTools(miseContent));
81
+ const packageJson = JSON.parse(node_fs.readFileSync(node_path.join(io.workspaceRoot, 'package.json'), 'utf8'));
82
+ const pnpmVersion = migrationPnpmVersion(packageJson.packageManager?.match(/^pnpm@([^+]+)(?:\+.*)?$/u)?.[1]);
83
+ io.write(misePath, updateMiseTools(miseContent, pnpmVersion));
75
84
  const workflowPath = node_path.join(io.workspaceRoot, '.github/workflows/ultramodern-workspace-gates.yml');
76
85
  if (!node_fs.existsSync(workflowPath)) return;
77
86
  const workflow = node_fs.readFileSync(workflowPath, 'utf-8');
@@ -0,0 +1,167 @@
1
+ import "node:module";
2
+ import node_fs from "node:fs";
3
+ import node_path from "node:path";
4
+ import { parse } from "@babel/parser";
5
+ import { formatGeneratedSourceCandidates } from "../../../ultramodern-workspace/fs-io.js";
6
+ function isLiteralData(node, literalIdentifiers) {
7
+ if (!node) return false;
8
+ if ('Identifier' === node.type) return literalIdentifiers?.has(node.name) ?? false;
9
+ if ([
10
+ 'StringLiteral',
11
+ 'NumericLiteral',
12
+ 'BooleanLiteral',
13
+ 'NullLiteral'
14
+ ].includes(node.type)) return true;
15
+ if ('UnaryExpression' === node.type) return '-' === node.operator && 'NumericLiteral' === node.argument.type;
16
+ if ('ArrayExpression' === node.type) return node.elements.every((element)=>isLiteralData(element, literalIdentifiers));
17
+ return 'ObjectExpression' === node.type && node.properties.every((property)=>'ObjectProperty' === property.type && !property.computed && !property.shorthand && [
18
+ 'Identifier',
19
+ 'StringLiteral',
20
+ 'NumericLiteral'
21
+ ].includes(property.key.type) && isLiteralData(property.value, literalIdentifiers));
22
+ }
23
+ function withoutGeneratedData(source, binding) {
24
+ if (!binding) return source;
25
+ const parsed = parse(source, {
26
+ sourceType: 'module',
27
+ plugins: [
28
+ "typescript"
29
+ ]
30
+ });
31
+ for (const statement of parsed.program.body)if ('VariableDeclaration' === statement.type && 'const' === statement.kind) {
32
+ for (const declaration of statement.declarations)if ('Identifier' === declaration.id.type && declaration.id.name === binding && declaration.init && isLiteralData(declaration.init)) return source.slice(0, declaration.init.start) + '{}' + source.slice(declaration.init.end);
33
+ }
34
+ return source;
35
+ }
36
+ function staticPropertyValue(node, name) {
37
+ if (node?.type !== 'ObjectExpression') return;
38
+ const keys = new Set();
39
+ let value;
40
+ for (const property of node.properties){
41
+ if ('ObjectProperty' !== property.type || property.computed || property.shorthand || ![
42
+ 'Identifier',
43
+ 'StringLiteral'
44
+ ].includes(property.key.type)) return;
45
+ const key = property.key.name ?? property.key.value;
46
+ if (keys.has(key)) return;
47
+ keys.add(key);
48
+ if (key === name) value = property.value;
49
+ }
50
+ return value;
51
+ }
52
+ function refreshValidatorReleaseCohort(source, releaseCohort) {
53
+ try {
54
+ const parsed = parse(source, {
55
+ sourceType: 'module',
56
+ plugins: [
57
+ "typescript"
58
+ ],
59
+ tokens: true
60
+ });
61
+ const constants = parsed.program.body.flatMap((statement)=>'VariableDeclaration' === statement.type && 'const' === statement.kind ? statement.declarations : []);
62
+ const matches = [];
63
+ for (const statement of parsed.program.body)if ('VariableDeclaration' === statement.type && 'const' === statement.kind) for (const declaration of statement.declarations){
64
+ const kind = staticPropertyValue(declaration.init, 'kind');
65
+ if (kind?.type !== 'StringLiteral' || 'modernjs.ultramodern-workspace-validation-contract' !== kind.value) continue;
66
+ const cohort = staticPropertyValue(staticPropertyValue(declaration.init, 'cohort'), 'releaseCohort');
67
+ const schema = staticPropertyValue(cohort, 'schema');
68
+ const schemaVersion = staticPropertyValue(cohort, 'schemaVersion');
69
+ const version = staticPropertyValue(staticPropertyValue(cohort, 'release'), 'version');
70
+ const versionConstant = version?.type === 'Identifier' ? constants.find((declaration)=>'Identifier' === declaration.id.type && declaration.id.name === version.name && declaration.init?.type === 'StringLiteral') : void 0;
71
+ if (schema?.type === 'StringLiteral' && 'bleedingdev.ultramodern.release-cohort' === schema.value && schemaVersion?.type === 'NumericLiteral' && 1 === schemaVersion.value && isLiteralData(cohort, versionConstant ? new Set([
72
+ version.name
73
+ ]) : void 0)) matches.push({
74
+ cohort,
75
+ version,
76
+ versionConstant
77
+ });
78
+ }
79
+ if (1 !== matches.length) return source;
80
+ const { cohort, version, versionConstant } = matches[0];
81
+ let content = JSON.stringify(releaseCohort, null, 2);
82
+ const edits = [];
83
+ if (versionConstant && !parsed.tokens?.some((token)=>'name' === token.type.label && token.value === version.name && token.start !== versionConstant.id.start && (token.start < cohort.start || token.end > cohort.end))) {
84
+ content = content.replaceAll(`"version": ${JSON.stringify(releaseCohort.release.version)}`, `"version": ${version.name}`);
85
+ edits.push({
86
+ start: versionConstant.init.start,
87
+ end: versionConstant.init.end,
88
+ content: JSON.stringify(releaseCohort.release.version)
89
+ });
90
+ }
91
+ edits.push({
92
+ start: cohort.start,
93
+ end: cohort.end,
94
+ content
95
+ });
96
+ for (const edit of edits.toSorted((left, right)=>right.start - left.start))source = source.slice(0, edit.start) + edit.content + source.slice(edit.end);
97
+ return source;
98
+ } catch {
99
+ return source;
100
+ }
101
+ }
102
+ function preserveConsumerWorkspaceArtifacts(io, candidates) {
103
+ const preservedPaths = new Set();
104
+ const physicalRoot = node_fs.realpathSync(io.workspaceRoot);
105
+ const canonicalSources = formatGeneratedSourceCandidates(candidates.map((candidate, index)=>[
106
+ `canonical/${index}/${candidate.relativePath}`,
107
+ withoutGeneratedData(candidate.content, candidate.generatedDataBinding)
108
+ ]));
109
+ for (const [index, candidate] of candidates.entries()){
110
+ const paths = [
111
+ candidate.relativePath,
112
+ candidate.legacyPath
113
+ ].filter((value)=>void 0 !== value);
114
+ for (const relativePath of paths){
115
+ const filePath = node_path.join(io.workspaceRoot, relativePath);
116
+ if (!node_fs.existsSync(filePath)) continue;
117
+ const physicalRelative = node_path.relative(physicalRoot, node_fs.realpathSync(filePath));
118
+ if ('..' === physicalRelative || physicalRelative.startsWith(`..${node_path.sep}`) || node_path.isAbsolute(physicalRelative)) throw new Error(`Refusing to inspect an artifact outside the workspace: ${relativePath}`);
119
+ const source = node_fs.readFileSync(filePath, 'utf8');
120
+ let recognized = source === candidate.content;
121
+ if (!recognized) try {
122
+ const normalized = withoutGeneratedData(source, candidate.generatedDataBinding);
123
+ const canonical = canonicalSources[index];
124
+ recognized = normalized === canonical || formatGeneratedSourceCandidates([
125
+ [
126
+ relativePath,
127
+ normalized
128
+ ]
129
+ ])[0] === canonical;
130
+ } catch {}
131
+ if (!recognized) for (const pairedPath of paths)preservedPaths.add(pairedPath);
132
+ }
133
+ }
134
+ const reported = new Set();
135
+ const isPreserved = (filePath)=>{
136
+ const relativePath = node_path.relative(io.workspaceRoot, filePath).split(node_path.sep).join('/');
137
+ if (!preservedPaths.has(relativePath)) return false;
138
+ if (!reported.has(relativePath)) {
139
+ io.log(`${relativePath} preserved consumer-owned artifact: its canonical generated source does not match.`);
140
+ reported.add(relativePath);
141
+ }
142
+ return true;
143
+ };
144
+ return {
145
+ preservedPaths,
146
+ refreshReleaseCohort (releaseCohort) {
147
+ if (!releaseCohort) return;
148
+ for (const candidate of candidates)if ('workspaceValidationContract' === candidate.generatedDataBinding) for (const relativePath of [
149
+ candidate.relativePath,
150
+ candidate.legacyPath
151
+ ]){
152
+ if (!relativePath || !preservedPaths.has(relativePath)) continue;
153
+ const filePath = node_path.join(io.workspaceRoot, relativePath);
154
+ if (!node_fs.existsSync(filePath)) continue;
155
+ const source = node_fs.readFileSync(filePath, 'utf8');
156
+ io.write(filePath, refreshValidatorReleaseCohort(source, releaseCohort));
157
+ }
158
+ },
159
+ io: {
160
+ ...io,
161
+ write: (filePath, content)=>isPreserved(filePath) ? false : io.write(filePath, content),
162
+ writeGenerated: (filePath, content)=>isPreserved(filePath) ? false : io.writeGenerated(filePath, content),
163
+ remove: (filePath)=>isPreserved(filePath) ? false : io.remove(filePath)
164
+ }
165
+ };
166
+ }
167
+ export { preserveConsumerWorkspaceArtifacts };
@@ -2,11 +2,13 @@ import "node:module";
2
2
  import node_fs from "node:fs";
3
3
  import node_path from "node:path";
4
4
  import { RELEASE_COHORT_PROJECTION_PATH, readCreateReleaseCohort } from "../../ultramodern-release-cohort.js";
5
+ import { createAppEnvDts } from "../../ultramodern-workspace/app-files.js";
5
6
  import { createDevelopmentOverlay, createTopology, createUltramodernConfig } from "../../ultramodern-workspace/contracts.js";
6
7
  import { stampDeliveryUnitIdentity } from "../../ultramodern-workspace/delivery-unit-stamp.js";
7
8
  import { ULTRAMODERN_WORKSPACE_POLICY } from "../../ultramodern-workspace/policy.js";
8
9
  import { createAdditionalShellConfigEntry } from "../../ultramodern-workspace/shells.js";
9
- import { createWorkspaceValidationScript, migratedWorkspaceScriptArtifacts } from "../../ultramodern-workspace/workspace-scripts.js";
10
+ import { createWorkspaceValidationScript, createZeropsRuntimeMaterializationScript, migratedWorkspaceScriptArtifacts } from "../../ultramodern-workspace/workspace-scripts.js";
11
+ import { createZeropsYaml } from "../../ultramodern-workspace/zerops.js";
10
12
  import { additionalShellsFromToolingConfig, allWorkspaceAppsFromToolingConfig, normalizeCompactUltramodernConfig, synthesizeCompactUltramodernConfig, workspaceAppsFromToolingConfig } from "../config.js";
11
13
  import { reconcileCompactPackageSourceMetadata, reconcilePackageSourceMetadata, updateReferenceTopology, updateUltramodernConfig } from "./migrate-strict-effect/api-metadata.js";
12
14
  import { ensureGeneratedDeclarationPatches } from "./migrate-strict-effect/declaration-patches.js";
@@ -19,7 +21,9 @@ import { ensureBffEffectDependencies, updateGeneratedPackageScripts, updateGener
19
21
  import { createMigrationPackageSource } from "./migrate-strict-effect/package-source.js";
20
22
  import { updateGeneratedPnpmWorkspacePolicy, validateGeneratedPnpmLockReleaseAgePolicy } from "./migrate-strict-effect/pnpm-policy.js";
21
23
  import { ensureGeneratedModuleFederationBridgeRouterOptOut, preflightModuleFederationBridgeRouter, removeRetiredReactRouterDependency } from "./migrate-strict-effect/react-router-retirement.js";
24
+ import { ensureSharedApiInfrastructure } from "./migrate-strict-effect/shared-api-infrastructure.js";
22
25
  import { updateGeneratedToolchainFiles, updateRootPackageToolchain } from "./migrate-strict-effect/toolchain-pins.js";
26
+ import { preserveConsumerWorkspaceArtifacts } from "./migrate-strict-effect/workspace-artifact-ownership.js";
23
27
  import { hasFlag } from "./options.js";
24
28
  const retiredMetadataPaths = [
25
29
  '.modernjs/ultramodern-generated-contract.json',
@@ -75,10 +79,24 @@ function synchronizeMigrationDeliveryUnitMetadata(io, raw, packageSource) {
75
79
  'schemaVersion',
76
80
  'id',
77
81
  "description",
78
- 'preset',
79
- 'sharedPackages',
80
- 'validation'
81
- ])topology[key] = canonicalTopology[key];
82
+ 'preset'
83
+ ])if ('id' === key || "description" === key) topology[key] ??= canonicalTopology[key];
84
+ else topology[key] = canonicalTopology[key];
85
+ const existingSharedPackages = Array.isArray(topology.sharedPackages) ? topology.sharedPackages : [];
86
+ topology.sharedPackages = [
87
+ ...existingSharedPackages,
88
+ ...canonicalTopology.sharedPackages.filter((candidate)=>!existingSharedPackages.some((existing)=>existing.id === candidate.id))
89
+ ];
90
+ topology.validation = {
91
+ ...canonicalTopology.validation,
92
+ ...topology.validation,
93
+ commands: [
94
+ ...new Set([
95
+ ...topology.validation?.commands ?? [],
96
+ ...canonicalTopology.validation.commands
97
+ ])
98
+ ]
99
+ };
82
100
  const canonicalTopologyApps = new Map([
83
101
  canonicalTopology.shell,
84
102
  ...canonicalTopology.verticals ?? []
@@ -101,8 +119,21 @@ function synchronizeMigrationDeliveryUnitMetadata(io, raw, packageSource) {
101
119
  'api',
102
120
  'cloudflare',
103
121
  'ownership'
104
- ])if (Object.hasOwn(canonicalEntry, key)) entry[key] = canonicalEntry[key];
105
- else delete entry[key];
122
+ ])if (Object.hasOwn(canonicalEntry, key)) {
123
+ const canonicalValue = canonicalEntry[key];
124
+ if ('api' === key && entry.api && canonicalValue && 'object' == typeof canonicalValue) {
125
+ const nextApi = {
126
+ ...entry.api,
127
+ ...canonicalValue
128
+ };
129
+ if (!Object.hasOwn(entry.api, 'domainOperations')) delete nextApi.domainOperations;
130
+ entry.api = nextApi;
131
+ } else if ('cloudflare' === key && entry.cloudflare && canonicalValue && 'object' == typeof canonicalValue) entry.cloudflare = {
132
+ ...canonicalValue,
133
+ ...entry.cloudflare
134
+ };
135
+ else entry[key] = canonicalValue;
136
+ } else delete entry[key];
106
137
  }
107
138
  }
108
139
  writeJsonFile(io, topologyPath, topology);
@@ -123,7 +154,10 @@ function synchronizeMigrationCompactPolicy(io, raw, packageSource) {
123
154
  const apps = workspaceAppsFromToolingConfig(migrated);
124
155
  apps.filter((app)=>'shell' !== app.kind);
125
156
  const canonical = requireRecord(createUltramodernConfig(migrated.workspace.packageScope, packageSource.modernPackageVersion, packageSource, apps, migrated.features.tailwind, migrated.bridge, additionalShellsFromToolingConfig(migrated), apps.find((app)=>'shell' === app.kind)), 'Generated compact policy');
126
- for (const key of compactPolicyKeys)raw[key] = canonical[key];
157
+ for (const key of compactPolicyKeys){
158
+ if ('workspace' === key) canonical.workspace.packageManager.version = raw.workspace.packageManager.version;
159
+ raw[key] = canonical[key];
160
+ }
127
161
  writeJsonFile(io, node_path.join(io.workspaceRoot, '.modernjs/ultramodern.json'), raw);
128
162
  }
129
163
  function reconcileRootPackageSourceMetadata(packageJson, packageSource) {
@@ -263,6 +297,33 @@ function migrateStrictEffect(args, context, io, dryRun, skipInstall) {
263
297
  version: packageSource.modernPackageVersion
264
298
  });
265
299
  const releaseCohort = 'install' === packageSource.strategy ? readCreateReleaseCohort() : void 0;
300
+ const currentApps = workspaceAppsFromToolingConfig(current);
301
+ const allCurrentApps = allWorkspaceAppsFromToolingConfig(current);
302
+ const artifactOwnership = preserveConsumerWorkspaceArtifacts(io, [
303
+ ...allCurrentApps.map((app)=>({
304
+ relativePath: `${app.directory}/src/modern-app-env.d.ts`,
305
+ content: createAppEnvDts(app, allCurrentApps.filter((remote)=>'shell' !== remote.kind), current.workspace.packageScope)
306
+ })),
307
+ ...migratedWorkspaceScriptArtifacts({
308
+ shellOnly: false,
309
+ hasBackendSurface: true
310
+ }).filter((artifact)=>"scripts/validate-ultramodern-workspace.mts" !== artifact.relativePath),
311
+ {
312
+ relativePath: "scripts/validate-ultramodern-workspace.mts",
313
+ legacyPath: "scripts/validate-ultramodern-workspace.mjs",
314
+ generatedDataBinding: 'workspaceValidationContract',
315
+ content: createWorkspaceValidationScript(current.workspace.packageScope, current.features.tailwind, currentApps.filter((app)=>'shell' !== app.kind), void 0, additionalShellsFromToolingConfig(current), currentApps.find((app)=>'shell' === app.kind))
316
+ },
317
+ {
318
+ relativePath: 'zerops.yaml',
319
+ content: `${createZeropsYaml(current.workspace.packageScope, allWorkspaceAppsFromToolingConfig(current))}\n`
320
+ },
321
+ {
322
+ relativePath: "scripts/materialize-zerops-runtime.mjs",
323
+ content: createZeropsRuntimeMaterializationScript()
324
+ }
325
+ ]);
326
+ io = artifactOwnership.io;
266
327
  reconcileCompactPackageSourceMetadata(raw.packageSource, packageSource);
267
328
  reconcileRootPackageSourceMetadata(readJsonFile(node_path.join(io.workspaceRoot, 'package.json')), packageSource);
268
329
  updateGeneratedPnpmWorkspacePolicy(createMigrationIo(io.workspaceRoot, true), packageSource, {
@@ -283,6 +344,7 @@ function migrateStrictEffect(args, context, io, dryRun, skipInstall) {
283
344
  const verticalApps = migrated.topology.apps.filter((app)=>'shell' !== app.kind);
284
345
  const hasBackendSurface = verticalApps.some((app)=>app.api);
285
346
  const shellOnly = 0 === verticalApps.length;
347
+ if (hasBackendSurface) ensureSharedApiInfrastructure(io, migrated.workspace.packageScope, packageSource);
286
348
  if (shellOnly) {
287
349
  io.log('Shell-only workspace: skipping backend-federation and Zerops runtime stages.');
288
350
  for (const relativePath of [
@@ -313,6 +375,7 @@ function migrateStrictEffect(args, context, io, dryRun, skipInstall) {
313
375
  io.writeGenerated(node_path.join(io.workspaceRoot, artifact.relativePath), artifact.content);
314
376
  }
315
377
  io.writeGenerated(node_path.join(io.workspaceRoot, "scripts/validate-ultramodern-workspace.mts"), createWorkspaceValidationScript(validationContractInputs.scope, validationContractInputs.enableTailwind, validationContractInputs.remotes, releaseCohort, validationContractInputs.additionalShells, validationContractInputs.primaryShell, raw, node_fs.existsSync(node_path.join(io.workspaceRoot, 'topology/ownership.json')) ? requireRecord(readJsonFile(node_path.join(io.workspaceRoot, 'topology/ownership.json')), 'Ownership topology') : void 0, developmentOverlay));
378
+ artifactOwnership.refreshReleaseCohort(releaseCohort);
316
379
  for (const relativePath of retiredMetadataPaths)io.remove(node_path.join(io.workspaceRoot, relativePath));
317
380
  updateGeneratedBuildIdentityModules(io, migrated);
318
381
  updateGeneratedTypeScriptSurfaces(io, migrated);
@@ -327,7 +390,7 @@ function migrateStrictEffect(args, context, io, dryRun, skipInstall) {
327
390
  reconcileRootPackageSourceMetadata(packageJson, packageSource);
328
391
  updateRootPackageToolchain(packageJson);
329
392
  }
330
- updateModernDependencies(packageJson, packageSource);
393
+ updateModernDependencies(packageJson, packageSource, releaseCohort);
331
394
  const ownsGeneratedScripts = 'package.json' === relativePackageFile || allMigratedApps.some((app)=>`${app.directory}/package.json` === relativePackageFile);
332
395
  updateGeneratedToolingDependencies(packageJson, {
333
396
  ownsGeneratedScripts
@@ -337,6 +400,7 @@ function migrateStrictEffect(args, context, io, dryRun, skipInstall) {
337
400
  if ('preserved' === retiredReactRouter) io.log(`${relativePackageFile} keeps its react-router dependency: authored source imports React Router directly, so its generated Module Federation config keeps bridge.enableBridgeRouter: true.`);
338
401
  else if ('removed' === retiredReactRouter) io.log(`${relativePackageFile} dropped its obsolete react-router dependency: no authored source imports React Router.`);
339
402
  updateGeneratedPackageScripts(packageJson, {
403
+ preservedArtifacts: artifactOwnership.preservedPaths,
340
404
  relativePackageFile,
341
405
  apps: allMigratedApps,
342
406
  shellOnly,
@@ -3,7 +3,7 @@ import { resolveApiProtocol, resolveApiStem, verticalApiApps } from "../descript
3
3
  import { packageName, toPascalCase } from "../naming.js";
4
4
  import { createCheckoutCartClientExports, serviceHasCheckoutCartState } from "./checkout-cart.js";
5
5
  import { verticalApiErrorStem, verticalApiExport, verticalApiGroupName, verticalApiNotFoundErrorExport } from "./names.js";
6
- function createApiClient(service, contractImportPath) {
6
+ function createApiClient(service, contractImportPath, options) {
7
7
  const apiExport = verticalApiExport(service);
8
8
  const contractExport = verticalApiGroupName(service);
9
9
  const stem = resolveApiStem(service);
@@ -119,7 +119,7 @@ export const ${readinessName} = (
119
119
  operationContext:
120
120
  options.operationContext ?? ${groupName}OperationContexts.readiness,
121
121
  }).pipe(
122
- Effect.flatMap(client => client.${groupName}.readiness({})),
122
+ Effect.flatMap(client => client.${options ? 'foundation' : groupName}.readiness({})),
123
123
  );
124
124
 
125
125
  export const ${getName} = (
@@ -5,23 +5,22 @@ import { packageName } from "../naming.js";
5
5
  import { createCheckoutCartServerHandlers, createCheckoutCartServerState } from "./checkout-cart.js";
6
6
  import { verticalApiExport, verticalApiGroupName, verticalApiNotFoundErrorExport } from "./names.js";
7
7
  import { createRpcApiServiceEntry, rpcPath, verticalRpcContractExport, verticalRpcGroupExport } from "./rpc.js";
8
- function createApiServiceEntry(service, contractImportPath) {
8
+ function createApiServiceEntry(service, contractImportPath, options) {
9
9
  if ((service.api?.protocol ?? 'rest') === 'rpc') return createRpcApiServiceEntry(service);
10
10
  const apiExport = verticalApiExport(service);
11
11
  const groupName = verticalApiGroupName(service);
12
12
  const notFoundErrorExport = verticalApiNotFoundErrorExport(service);
13
13
  const stem = resolveApiStem(service);
14
- return `import {
15
- defineEffectBff,
14
+ const assemblyImport = options ? `import { assembleEffectBffRuntime } from '${packageName(options.scope, 'shared-contracts')}/server/effect-bff-runtime';\n` : '';
15
+ return `${assemblyImport}import {
16
+ ${options ? '' : 'defineEffectBff,'}
16
17
  Effect,
17
18
  HttpApiBuilder,
18
19
  Layer,
19
20
  } from '@modern-js/plugin-bff/effect-edge';
20
- import type {
21
- EffectBffDefinition,
22
- EffectBffRuntime,
21
+ ${options ? '' : `import type {
23
22
  EffectRuntimeLayer,
24
- } from '@modern-js/plugin-bff/effect-edge';
23
+ } from '@modern-js/plugin-bff/effect-edge';`}
25
24
  import { ultramodernApiMarker } from '../shared/ultramodern-build.ts';
26
25
  import {
27
26
  ${apiExport},
@@ -51,6 +50,31 @@ const operationAttributes = (operationContext: OperationContext) => ({
51
50
  : {}),
52
51
  });
53
52
 
53
+ ${options ? `const ${groupName}ReadinessLayer = HttpApiBuilder.group(
54
+ ${apiExport},
55
+ 'foundation',
56
+ handlers => handlers
57
+ .handle('readiness', () =>
58
+ Effect.succeed({
59
+ checks: {
60
+ api: 'ready' as const,
61
+ moduleFederation: 'ready' as const,
62
+ ssr: 'ready' as const,
63
+ translations: 'ready' as const,
64
+ },
65
+ marker: ultramodernApiMarker,
66
+ status: 'ready' as const,
67
+ versionSkew: 'none' as const,
68
+ }).pipe(
69
+ Effect.withSpan('ultramodern.api.${groupName}.readiness', {
70
+ attributes: operationAttributes(${groupName}OperationContexts.readiness),
71
+ kind: 'server',
72
+ }),
73
+ ),
74
+ )
75
+ ,
76
+ );` : ''}
77
+
54
78
  const ${groupName}Layer = HttpApiBuilder.group(
55
79
  ${apiExport},
56
80
  '${groupName}',
@@ -69,7 +93,7 @@ const ${groupName}Layer = HttpApiBuilder.group(
69
93
  }),
70
94
  ),
71
95
  )
72
- .handle('readiness', () =>
96
+ ${options ? '' : ` .handle('readiness', () =>
73
97
  Effect.succeed({
74
98
  checks: {
75
99
  api: 'ready' as const,
@@ -87,6 +111,7 @@ const ${groupName}Layer = HttpApiBuilder.group(
87
111
  }),
88
112
  ),
89
113
  )
114
+ `}
90
115
  .handle('get', ({ params }) => {
91
116
  const matchedItem = ${groupName}Items.find(
92
117
  candidate => candidate.id === params.id,
@@ -126,14 +151,18 @@ const ${groupName}Layer = HttpApiBuilder.group(
126
151
  )${createCheckoutCartServerHandlers(service)},
127
152
  );
128
153
 
129
- const layer = HttpApiBuilder.layer(${apiExport}).pipe(
130
- Layer.provide(${groupName}Layer),
131
- ) satisfies EffectRuntimeLayer;
132
- const apiRuntime: EffectBffDefinition<typeof ${apiExport}, EffectRuntimeLayer> &
133
- EffectBffRuntime<typeof ${apiExport}, EffectRuntimeLayer> = defineEffectBff({
134
- api: ${apiExport},
135
- layer,
136
- });
154
+ ${options ? `const apiHandlersLive = Layer.mergeAll(${groupName}Layer, ${groupName}ReadinessLayer);
155
+ export const make${apiExport[0].toUpperCase()}${apiExport.slice(1)}Runtime = () =>
156
+ assembleEffectBffRuntime({
157
+ api: ${apiExport},
158
+ handlers: apiHandlersLive,
159
+ });` : `export const make${apiExport[0].toUpperCase()}${apiExport.slice(1)}Runtime = () => {
160
+ const layer = HttpApiBuilder.layer(${apiExport}).pipe(
161
+ Layer.provide(${groupName}Layer),
162
+ ) satisfies EffectRuntimeLayer;
163
+ return defineEffectBff({ api: ${apiExport}, layer });
164
+ };`}
165
+ const apiRuntime = make${apiExport[0].toUpperCase()}${apiExport.slice(1)}Runtime();
137
166
 
138
167
  export default apiRuntime;
139
168
  `;
@@ -1,7 +1,7 @@
1
1
  import "node:module";
2
2
  import { resolveApiPrefix, resolveApiStem } from "../descriptors.js";
3
3
  import { renderTemplate } from "../fs-io.js";
4
- import { toPascalCase } from "../naming.js";
4
+ import { packageName, toPascalCase } from "../naming.js";
5
5
  import { createCheckoutCartApiContractFields, createCheckoutCartEndpointDefinitions, createCheckoutCartOperationContexts, createCheckoutCartSharedSchemas } from "./checkout-cart.js";
6
6
  import { verticalApiCreatePayloadSchemaExport, verticalApiExport, verticalApiGroupName, verticalApiMarkerSchemaExport, verticalApiName, verticalApiNotFoundErrorExport, verticalApiNotFoundSchemaExport, verticalApiReadinessSchemaExport, verticalApiSchemaExport } from "./names.js";
7
7
  function createSharedApiImports() {
@@ -14,7 +14,7 @@ function createSharedApiImports() {
14
14
  } from '@modern-js/plugin-bff/effect-client';
15
15
  `;
16
16
  }
17
- function createSharedApiContract(service) {
17
+ function createSharedApiContract(service, shared = false) {
18
18
  const schemaExport = verticalApiSchemaExport(service);
19
19
  const markerSchemaExport = verticalApiMarkerSchemaExport(service);
20
20
  const readinessSchemaExport = verticalApiReadinessSchemaExport(service);
@@ -71,7 +71,7 @@ function createSharedApiContract(service) {
71
71
  listOperationContext,
72
72
  readinessOperationContext
73
73
  }).trim();
74
- return `export interface ${markerType} {
74
+ return `${shared ? `export type ${markerType} = MicroVerticalBuildMarker;` : `export interface ${markerType} {
75
75
  readonly appId: string;
76
76
  readonly build: string;
77
77
  readonly buildMarker: string;
@@ -81,7 +81,7 @@ function createSharedApiContract(service) {
81
81
  readonly surface: string;
82
82
  readonly unitId: string;
83
83
  readonly version: string;
84
- }
84
+ }`}
85
85
 
86
86
  export interface ${itemType} {
87
87
  readonly id: string;
@@ -89,7 +89,7 @@ export interface ${itemType} {
89
89
  readonly title: string;
90
90
  }
91
91
 
92
- export interface ${readinessType} {
92
+ ${shared ? `export type ${readinessType} = MicroVerticalReadiness;` : `export interface ${readinessType} {
93
93
  readonly checks: {
94
94
  readonly api: 'ready';
95
95
  readonly moduleFederation: 'ready';
@@ -99,7 +99,7 @@ export interface ${readinessType} {
99
99
  readonly marker: ${markerType};
100
100
  readonly status: 'ready';
101
101
  readonly versionSkew: 'none';
102
- }
102
+ }`}
103
103
 
104
104
  export interface ${createPayloadType} {
105
105
  readonly title: string;
@@ -118,7 +118,7 @@ export interface ${notFoundErrorExport} {
118
118
  readonly id: string;
119
119
  }
120
120
 
121
- export const ${markerSchemaExport}: Schema.Codec<${markerType}> = Schema.Struct({
121
+ ${shared ? `export const ${markerSchemaExport}: Schema.Codec<${markerType}> = MicroVerticalBuildMarkerSchema;` : `export const ${markerSchemaExport}: Schema.Codec<${markerType}> = Schema.Struct({
122
122
  appId: Schema.String,
123
123
  build: Schema.String,
124
124
  buildMarker: Schema.String,
@@ -128,7 +128,7 @@ export const ${markerSchemaExport}: Schema.Codec<${markerType}> = Schema.Struct(
128
128
  surface: Schema.String,
129
129
  unitId: Schema.String,
130
130
  version: Schema.String,
131
- });
131
+ });`}
132
132
 
133
133
  export const ${schemaExport}: Schema.Codec<${itemType}> = Schema.Struct({
134
134
  id: Schema.String,
@@ -136,7 +136,7 @@ export const ${schemaExport}: Schema.Codec<${itemType}> = Schema.Struct({
136
136
  title: Schema.String,
137
137
  });
138
138
 
139
- export const ${readinessSchemaExport}: Schema.Codec<${readinessType}> = Schema.Struct({
139
+ ${shared ? `export const ${readinessSchemaExport}: Schema.Codec<${readinessType}> = MicroVerticalReadinessSchema;` : `export const ${readinessSchemaExport}: Schema.Codec<${readinessType}> = Schema.Struct({
140
140
  checks: Schema.Struct({
141
141
  api: Schema.Literal('ready'),
142
142
  moduleFederation: Schema.Literal('ready'),
@@ -146,7 +146,7 @@ export const ${readinessSchemaExport}: Schema.Codec<${readinessType}> = Schema.S
146
146
  marker: ${markerSchemaExport},
147
147
  status: Schema.Literal('ready'),
148
148
  versionSkew: Schema.Literal('none'),
149
- });
149
+ });`}
150
150
 
151
151
  export const ${createPayloadSchemaExport}: Schema.Codec<${createPayloadType}> = Schema.Struct({
152
152
  title: Schema.String,
@@ -158,7 +158,7 @@ ${checkoutCartSharedSchemaSection}export const ${notFoundSchemaExport}: Schema.C
158
158
  HttpApiSchema.status(404),
159
159
  );
160
160
 
161
- export interface OperationContext {
161
+ ${shared ? 'export type OperationContext = MicroVerticalOperationContext;' : `export interface OperationContext {
162
162
  method: string;
163
163
  operationId: string;
164
164
  routePath: string;
@@ -170,9 +170,14 @@ export interface OperationContext {
170
170
  | 'data-platform'
171
171
  | 'unknown';
172
172
  traceId?: string;
173
- }
173
+ }`}
174
174
 
175
- export const ${apiExport} = HttpApi.make('${apiName}').add(
175
+ ${shared ? `export const ${groupName}FoundationApi = HttpApi.make('${apiName}Foundation').add(
176
+ HttpApiGroup.make('foundation').add(
177
+ HttpApiEndpoint.get('readiness', '/${stem}/readiness', { success: ${readinessSchemaExport} }),
178
+ ),
179
+ );` : ''}
180
+ export const ${apiExport} = HttpApi.make('${apiName}')${shared ? `.addHttpApi(${groupName}FoundationApi)` : ''}.add(
176
181
  HttpApiGroup.make('${groupName}')
177
182
  .add(
178
183
  HttpApiEndpoint.get('list', '/${stem}', {
@@ -184,11 +189,12 @@ export const ${apiExport} = HttpApi.make('${apiName}').add(
184
189
  }),
185
190
  }),
186
191
  )
187
- .add(
192
+ ${shared ? '' : ` .add(
188
193
  HttpApiEndpoint.get('readiness', '/${stem}/readiness', {
189
194
  success: ${readinessSchemaExport},
190
195
  }),
191
196
  )
197
+ `}
192
198
  .add(
193
199
  HttpApiEndpoint.get('get', '/${stem}/:id', {
194
200
  error: ${notFoundSchemaExport},
@@ -209,7 +215,7 @@ export const ${apiExport} = HttpApi.make('${apiName}').add(
209
215
  );
210
216
 
211
217
  export const ${groupName}OperationContexts = {
212
- ${operationContextEntries}
218
+ ${shared ? operationContextEntries.replaceAll(/(\w+: )\{([\s\S]*?)\},/gu, (_, key, fields)=>`${key}createMicroVerticalOperationContext({${fields.replace(/\n\s*source: 'generated-client',/u, '')}}),`) : operationContextEntries}
213
219
  } satisfies Record<string, OperationContext>;
214
220
 
215
221
  export const ${groupName}ApiContract = {
@@ -220,8 +226,12 @@ ${createCheckoutCartApiContractFields(service)} ownerId: '${service.id}',
220
226
  } as const;
221
227
  `;
222
228
  }
223
- function createSharedApi(service) {
229
+ function createSharedApi(service, options) {
230
+ const imports = options ? `import { MicroVerticalBuildMarkerSchema, MicroVerticalReadinessSchema, createMicroVerticalOperationContext } from '${packageName(options.scope, 'shared-contracts')}/microvertical-api-baseline';
231
+ import type { MicroVerticalBuildMarker, MicroVerticalReadiness, MicroVerticalOperationContext } from '${packageName(options.scope, 'shared-contracts')}/microvertical-api-baseline';
232
+ ` : '';
224
233
  return `${createSharedApiImports()}
225
- ${createSharedApiContract(service)}`;
234
+ ${imports}
235
+ ${createSharedApiContract(service, void 0 !== options)}`;
226
236
  }
227
237
  export { createSharedApi };