@bleedingdev/modern-js-create 3.4.0-ultramodern.4 → 3.4.0-ultramodern.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ultramodern-workspace/add-vertical.cjs +6 -0
- package/dist/cjs/ultramodern-workspace/contracts.cjs +2 -1
- package/dist/cjs/ultramodern-workspace/demo-components.cjs +4 -2
- package/dist/cjs/ultramodern-workspace/effect-api.cjs +12 -12
- package/dist/cjs/ultramodern-workspace/module-federation.cjs +13 -0
- package/dist/cjs/ultramodern-workspace/package-json.cjs +18 -2
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +3 -1
- package/dist/esm/ultramodern-workspace/add-vertical.js +7 -1
- package/dist/esm/ultramodern-workspace/contracts.js +2 -1
- package/dist/esm/ultramodern-workspace/demo-components.js +4 -2
- package/dist/esm/ultramodern-workspace/effect-api.js +12 -12
- package/dist/esm/ultramodern-workspace/module-federation.js +11 -1
- package/dist/esm/ultramodern-workspace/package-json.js +16 -3
- package/dist/esm/ultramodern-workspace/write-workspace.js +5 -3
- package/dist/esm-node/ultramodern-workspace/add-vertical.js +7 -1
- package/dist/esm-node/ultramodern-workspace/contracts.js +2 -1
- package/dist/esm-node/ultramodern-workspace/demo-components.js +4 -2
- package/dist/esm-node/ultramodern-workspace/effect-api.js +12 -12
- package/dist/esm-node/ultramodern-workspace/module-federation.js +11 -1
- package/dist/esm-node/ultramodern-workspace/package-json.js +16 -3
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +5 -3
- package/dist/types/ultramodern-workspace/module-federation.d.ts +1 -0
- package/dist/types/ultramodern-workspace/package-json.d.ts +1 -0
- package/package.json +3 -3
- package/templates/workspace-scripts/assert-mf-types.mjs.handlebars +9 -0
- package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +39 -0
|
@@ -144,6 +144,7 @@ function rewriteShellAppFiles(workspaceRoot, scope, packageSource, enableTailwin
|
|
|
144
144
|
const publicWeb = (0, external_public_surface_cjs_namespaceObject.createPublicWebAppArtifacts)(shellHost);
|
|
145
145
|
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/package.json`), (0, external_package_json_cjs_namespaceObject.createAppPackage)(scope, shellHost, packageSource, enableTailwind, remotes));
|
|
146
146
|
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/tsconfig.json`), (0, external_package_json_cjs_namespaceObject.createAppTsConfig)(shellHost, remotes));
|
|
147
|
+
(0, external_fs_io_cjs_namespaceObject.writeJsonFile)(external_node_path_default().join(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/tsconfig.mf-types.json`), (0, external_package_json_cjs_namespaceObject.createAppMfTypesTsConfig)(shellHost));
|
|
147
148
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, `${external_descriptors_cjs_namespaceObject.shellApp.directory}/src/modern-app-env.d.ts`, (0, external_app_files_cjs_namespaceObject.createAppEnvDts)(shellHost, remotes));
|
|
148
149
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
|
|
149
150
|
(0, external_fs_io_cjs_namespaceObject.writeFileReplacing)(workspaceRoot, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
|
|
@@ -494,6 +495,11 @@ function createDryRunJsonMutations(preflight, manifestUrl) {
|
|
|
494
495
|
pointer: '/references',
|
|
495
496
|
description: `Add ${vertical.id} to the shell TS-Go project references`
|
|
496
497
|
},
|
|
498
|
+
{
|
|
499
|
+
path: `${external_descriptors_cjs_namespaceObject.shellApp.directory}/tsconfig.mf-types.json`,
|
|
500
|
+
pointer: '/include',
|
|
501
|
+
description: 'Keep shell Module Federation DTS compilation scoped'
|
|
502
|
+
},
|
|
497
503
|
{
|
|
498
504
|
path: external_descriptors_cjs_namespaceObject.GENERATED_CONTRACT_PATH,
|
|
499
505
|
pointer: '/apps',
|
|
@@ -595,8 +595,9 @@ function createAppGeneratedContract(scope, app, apps, enableTailwind) {
|
|
|
595
595
|
} : {},
|
|
596
596
|
exposes: Object.keys(app.exposes ?? {}),
|
|
597
597
|
dts: {
|
|
598
|
+
compilerInstance: 'tsgo',
|
|
598
599
|
displayErrorInTerminal: true,
|
|
599
|
-
|
|
600
|
+
tsConfigPath: './tsconfig.mf-types.json'
|
|
600
601
|
},
|
|
601
602
|
browserSafeExposesOnly: true,
|
|
602
603
|
zephyrRspackPlugin: external_versions_cjs_namespaceObject.ZEPHYR_RSPACK_PLUGIN_VERSION
|
|
@@ -124,10 +124,12 @@ const createRemoteFallback = (specifier: string) =>
|
|
|
124
124
|
({ error }: { error: Error }) => {
|
|
125
125
|
const { t } = useModernI18n();
|
|
126
126
|
const classification = classifyModuleFederationFallback(error);
|
|
127
|
+
const telemetryEntry =
|
|
128
|
+
typeof window === 'undefined' ? undefined : window.location.href;
|
|
127
129
|
const telemetry = createModuleFederationFallbackTelemetry({
|
|
128
130
|
appName: '${external_descriptors_cjs_namespaceObject.shellApp.id}',
|
|
129
131
|
classification,
|
|
130
|
-
|
|
132
|
+
...(telemetryEntry === undefined ? {} : { entry: telemetryEntry }),
|
|
131
133
|
error,
|
|
132
134
|
eventName: 'mf.client.remote.fallback',
|
|
133
135
|
exportName: 'default',
|
|
@@ -140,7 +142,7 @@ const createRemoteFallback = (specifier: string) =>
|
|
|
140
142
|
void emitModuleFederationFallbackTelemetry({
|
|
141
143
|
appName: telemetry.appName,
|
|
142
144
|
classification,
|
|
143
|
-
entry: telemetry.entry,
|
|
145
|
+
...(telemetry.entry === undefined ? {} : { entry: telemetry.entry }),
|
|
144
146
|
error,
|
|
145
147
|
eventName: telemetry.eventName,
|
|
146
148
|
exportName: 'default',
|
|
@@ -96,7 +96,7 @@ export interface CheckoutCartLine {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
export interface CheckoutCart {
|
|
99
|
-
readonly lines:
|
|
99
|
+
readonly lines: readonly CheckoutCartLine[];
|
|
100
100
|
readonly subtotalCents: number;
|
|
101
101
|
readonly totalQuantity: number;
|
|
102
102
|
}
|
|
@@ -112,27 +112,27 @@ export interface CheckoutRemoveCartItemPayload {
|
|
|
112
112
|
readonly sku: string;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
export const checkoutCartLineSchema: Schema.
|
|
115
|
+
export const checkoutCartLineSchema: Schema.Codec<CheckoutCartLine> = Schema.Struct({
|
|
116
116
|
sku: Schema.String,
|
|
117
117
|
name: Schema.String,
|
|
118
118
|
quantity: Schema.Finite,
|
|
119
119
|
unitPriceCents: Schema.Finite,
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
-
export const checkoutCartSchema: Schema.
|
|
122
|
+
export const checkoutCartSchema: Schema.Codec<CheckoutCart> = Schema.Struct({
|
|
123
123
|
lines: Schema.Array(checkoutCartLineSchema),
|
|
124
124
|
subtotalCents: Schema.Finite,
|
|
125
125
|
totalQuantity: Schema.Finite,
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
-
export const checkoutAddCartItemPayloadSchema: Schema.
|
|
128
|
+
export const checkoutAddCartItemPayloadSchema: Schema.Codec<CheckoutAddCartItemPayload> = Schema.Struct({
|
|
129
129
|
sku: Schema.String,
|
|
130
130
|
name: Schema.optional(Schema.String),
|
|
131
131
|
quantity: Schema.Finite,
|
|
132
132
|
unitPriceCents: Schema.optional(Schema.Finite),
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
-
export const checkoutRemoveCartItemPayloadSchema: Schema.
|
|
135
|
+
export const checkoutRemoveCartItemPayloadSchema: Schema.Codec<CheckoutRemoveCartItemPayload> = Schema.Struct({
|
|
136
136
|
sku: Schema.String,
|
|
137
137
|
});
|
|
138
138
|
`;
|
|
@@ -423,7 +423,7 @@ export interface ${createPayloadType} {
|
|
|
423
423
|
}
|
|
424
424
|
|
|
425
425
|
export interface ${listResponseType} {
|
|
426
|
-
readonly items:
|
|
426
|
+
readonly items: readonly ${itemType}[];
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
export interface ${createResponseType} {
|
|
@@ -435,7 +435,7 @@ export interface ${notFoundErrorExport} {
|
|
|
435
435
|
readonly id: string;
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
-
export const ${markerSchemaExport}: Schema.
|
|
438
|
+
export const ${markerSchemaExport}: Schema.Codec<${markerType}> = Schema.Struct({
|
|
439
439
|
appId: Schema.String,
|
|
440
440
|
build: Schema.String,
|
|
441
441
|
deployProfile: Schema.String,
|
|
@@ -444,13 +444,13 @@ export const ${markerSchemaExport}: Schema.Schema<${markerType}> = Schema.Struct
|
|
|
444
444
|
version: Schema.String,
|
|
445
445
|
});
|
|
446
446
|
|
|
447
|
-
export const ${schemaExport}: Schema.
|
|
447
|
+
export const ${schemaExport}: Schema.Codec<${itemType}> = Schema.Struct({
|
|
448
448
|
id: Schema.String,
|
|
449
449
|
marker: ${markerSchemaExport},
|
|
450
450
|
title: Schema.String,
|
|
451
451
|
});
|
|
452
452
|
|
|
453
|
-
export const ${readinessSchemaExport}: Schema.
|
|
453
|
+
export const ${readinessSchemaExport}: Schema.Codec<${readinessType}> = Schema.Struct({
|
|
454
454
|
checks: Schema.Struct({
|
|
455
455
|
effectBff: Schema.Literal('ready'),
|
|
456
456
|
moduleFederation: Schema.Literal('ready'),
|
|
@@ -462,11 +462,11 @@ export const ${readinessSchemaExport}: Schema.Schema<${readinessType}> = Schema.
|
|
|
462
462
|
versionSkew: Schema.Literal('none'),
|
|
463
463
|
});
|
|
464
464
|
|
|
465
|
-
export const ${createPayloadSchemaExport}: Schema.
|
|
465
|
+
export const ${createPayloadSchemaExport}: Schema.Codec<${createPayloadType}> = Schema.Struct({
|
|
466
466
|
title: Schema.String,
|
|
467
467
|
});
|
|
468
468
|
|
|
469
|
-
${checkoutCartSharedSchemaSection}export const ${notFoundSchemaExport}: Schema.
|
|
469
|
+
${checkoutCartSharedSchemaSection}export const ${notFoundSchemaExport}: Schema.Codec<${notFoundErrorExport}> = Schema.TaggedStruct('${notFoundErrorExport}', {
|
|
470
470
|
id: Schema.String,
|
|
471
471
|
}).pipe(
|
|
472
472
|
HttpApiSchema.status(404),
|
|
@@ -577,7 +577,7 @@ import type {
|
|
|
577
577
|
EffectBffRuntime,
|
|
578
578
|
EffectRuntimeLayer,
|
|
579
579
|
} from '@modern-js/plugin-bff/effect-edge';
|
|
580
|
-
import { ultramodernApiMarker } from '../../
|
|
580
|
+
import { ultramodernApiMarker } from '../../shared/ultramodern-build.ts';
|
|
581
581
|
import {
|
|
582
582
|
${apiExport},
|
|
583
583
|
${groupName}OperationContexts,
|
|
@@ -45,6 +45,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
45
45
|
createSharedModuleFederationConfig: ()=>createSharedModuleFederationConfig,
|
|
46
46
|
createShellModuleFederationConfig: ()=>createShellModuleFederationConfig,
|
|
47
47
|
createUltramodernBuildModule: ()=>createUltramodernBuildModule,
|
|
48
|
+
createUltramodernBuildReexportModule: ()=>createUltramodernBuildReexportModule,
|
|
48
49
|
formatTsObjectLiteral: ()=>formatTsObjectLiteral
|
|
49
50
|
});
|
|
50
51
|
const external_node_crypto_namespaceObject = require("node:crypto");
|
|
@@ -406,6 +407,7 @@ const moduleFederationConfig: Parameters<
|
|
|
406
407
|
generateTypes: {
|
|
407
408
|
compilerInstance: 'tsgo',
|
|
408
409
|
},
|
|
410
|
+
tsConfigPath: './tsconfig.mf-types.json',
|
|
409
411
|
},
|
|
410
412
|
filename: 'remoteEntry.js',
|
|
411
413
|
name: '${external_descriptors_cjs_namespaceObject.shellApp.mfName}',
|
|
@@ -439,6 +441,14 @@ export const ultramodernApiMarker = {
|
|
|
439
441
|
} as const;
|
|
440
442
|
`;
|
|
441
443
|
}
|
|
444
|
+
function createUltramodernBuildReexportModule() {
|
|
445
|
+
return `export {
|
|
446
|
+
ultramodernApiMarker,
|
|
447
|
+
ultramodernUiMarker,
|
|
448
|
+
ultramodernVerticalIdentity,
|
|
449
|
+
} from '../shared/ultramodern-build';
|
|
450
|
+
`;
|
|
451
|
+
}
|
|
442
452
|
function createRemoteModuleFederationConfig(scope, app, remotes = []) {
|
|
443
453
|
const exposes = formatTsObjectLiteral(app.exposes ?? {});
|
|
444
454
|
return `// @effect-diagnostics nodeBuiltinImport:off
|
|
@@ -468,6 +478,7 @@ const moduleFederationConfig: Parameters<
|
|
|
468
478
|
generateTypes: {
|
|
469
479
|
compilerInstance: 'tsgo',
|
|
470
480
|
},
|
|
481
|
+
tsConfigPath: './tsconfig.mf-types.json',
|
|
471
482
|
},
|
|
472
483
|
exposes: ${exposes},
|
|
473
484
|
filename: 'remoteEntry.js',
|
|
@@ -487,6 +498,7 @@ exports.createRemoteModuleFederationConfig = __webpack_exports__.createRemoteMod
|
|
|
487
498
|
exports.createSharedModuleFederationConfig = __webpack_exports__.createSharedModuleFederationConfig;
|
|
488
499
|
exports.createShellModuleFederationConfig = __webpack_exports__.createShellModuleFederationConfig;
|
|
489
500
|
exports.createUltramodernBuildModule = __webpack_exports__.createUltramodernBuildModule;
|
|
501
|
+
exports.createUltramodernBuildReexportModule = __webpack_exports__.createUltramodernBuildReexportModule;
|
|
490
502
|
exports.formatTsObjectLiteral = __webpack_exports__.formatTsObjectLiteral;
|
|
491
503
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
492
504
|
"createAppModernConfig",
|
|
@@ -497,6 +509,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
497
509
|
"createSharedModuleFederationConfig",
|
|
498
510
|
"createShellModuleFederationConfig",
|
|
499
511
|
"createUltramodernBuildModule",
|
|
512
|
+
"createUltramodernBuildReexportModule",
|
|
500
513
|
"formatTsObjectLiteral"
|
|
501
514
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
502
515
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -30,6 +30,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
31
|
appDependencies: ()=>appDependencies,
|
|
32
32
|
appDevDependencies: ()=>appDevDependencies,
|
|
33
|
+
createAppMfTypesTsConfig: ()=>createAppMfTypesTsConfig,
|
|
33
34
|
createAppPackage: ()=>createAppPackage,
|
|
34
35
|
createAppTsConfig: ()=>createAppTsConfig,
|
|
35
36
|
createEffectTsgoTypecheckCommand: ()=>createEffectTsgoTypecheckCommand,
|
|
@@ -320,9 +321,10 @@ function createPackageTsConfig(packageDir, options = {}) {
|
|
|
320
321
|
'locales/**/*.json',
|
|
321
322
|
'modern.config.ts',
|
|
322
323
|
'module-federation.config.ts',
|
|
323
|
-
'package.json'
|
|
324
|
+
'package.json',
|
|
325
|
+
'shared'
|
|
324
326
|
];
|
|
325
|
-
if (resolvedOptions.includeApi) include.push('api'
|
|
327
|
+
if (resolvedOptions.includeApi) include.push('api');
|
|
326
328
|
const references = createReferences(packageDir, resolvedOptions.references ?? []);
|
|
327
329
|
const tsconfig = {
|
|
328
330
|
extends: `${(0, external_naming_cjs_namespaceObject.relativeRootFor)(packageDir)}/tsconfig.base.json`,
|
|
@@ -351,6 +353,18 @@ function createAppTsConfig(app, remotes = []) {
|
|
|
351
353
|
references
|
|
352
354
|
});
|
|
353
355
|
}
|
|
356
|
+
function createAppMfTypesTsConfig(app) {
|
|
357
|
+
const exposedFiles = Object.values(app.exposes ?? {}).map((exposePath)=>exposePath.replace(/^\.\//u, ''));
|
|
358
|
+
return {
|
|
359
|
+
extends: './tsconfig.json',
|
|
360
|
+
include: [
|
|
361
|
+
...new Set([
|
|
362
|
+
...exposedFiles,
|
|
363
|
+
'src/modern-app-env.d.ts'
|
|
364
|
+
])
|
|
365
|
+
]
|
|
366
|
+
};
|
|
367
|
+
}
|
|
354
368
|
function createSharedPackageTsConfig(packageDir) {
|
|
355
369
|
return createPackageTsConfig(packageDir, {
|
|
356
370
|
include: [
|
|
@@ -445,6 +459,7 @@ function createSharedContractsIndex() {
|
|
|
445
459
|
}
|
|
446
460
|
exports.appDependencies = __webpack_exports__.appDependencies;
|
|
447
461
|
exports.appDevDependencies = __webpack_exports__.appDevDependencies;
|
|
462
|
+
exports.createAppMfTypesTsConfig = __webpack_exports__.createAppMfTypesTsConfig;
|
|
448
463
|
exports.createAppPackage = __webpack_exports__.createAppPackage;
|
|
449
464
|
exports.createAppTsConfig = __webpack_exports__.createAppTsConfig;
|
|
450
465
|
exports.createEffectTsgoTypecheckCommand = __webpack_exports__.createEffectTsgoTypecheckCommand;
|
|
@@ -460,6 +475,7 @@ exports.effectDiagnostics = __webpack_exports__.effectDiagnostics;
|
|
|
460
475
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
461
476
|
"appDependencies",
|
|
462
477
|
"appDevDependencies",
|
|
478
|
+
"createAppMfTypesTsConfig",
|
|
463
479
|
"createAppPackage",
|
|
464
480
|
"createAppTsConfig",
|
|
465
481
|
"createEffectTsgoTypecheckCommand",
|
|
@@ -67,8 +67,10 @@ function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes
|
|
|
67
67
|
};
|
|
68
68
|
(0, external_fs_io_cjs_namespaceObject.writeJson)(targetDir, `${resolvedApp.directory}/package.json`, (0, external_package_json_cjs_namespaceObject.createAppPackage)(scope, resolvedApp, packageSource, enableTailwind, remotes));
|
|
69
69
|
(0, external_fs_io_cjs_namespaceObject.writeJson)(targetDir, `${resolvedApp.directory}/tsconfig.json`, (0, external_package_json_cjs_namespaceObject.createAppTsConfig)(resolvedApp, remotes));
|
|
70
|
+
(0, external_fs_io_cjs_namespaceObject.writeJson)(targetDir, `${resolvedApp.directory}/tsconfig.mf-types.json`, (0, external_package_json_cjs_namespaceObject.createAppMfTypesTsConfig)(resolvedApp));
|
|
70
71
|
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, `${resolvedApp.directory}/src/modern-app-env.d.ts`, (0, external_app_files_cjs_namespaceObject.createAppEnvDts)(resolvedApp, remotes));
|
|
71
|
-
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, `${resolvedApp.directory}/src/ultramodern-build.ts`, (0, external_module_federation_cjs_namespaceObject.
|
|
72
|
+
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, `${resolvedApp.directory}/src/ultramodern-build.ts`, (0, external_module_federation_cjs_namespaceObject.createUltramodernBuildReexportModule)());
|
|
73
|
+
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, `${resolvedApp.directory}/shared/ultramodern-build.ts`, (0, external_module_federation_cjs_namespaceObject.createUltramodernBuildModule)(scope, resolvedApp));
|
|
72
74
|
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
|
|
73
75
|
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
|
|
74
76
|
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, publicWeb.routeHeadFile.path, publicWeb.routeHeadFile.content);
|
|
@@ -13,7 +13,7 @@ import { createAppPublicLocaleMessages } from "./locales.js";
|
|
|
13
13
|
import { createShellModuleFederationConfig } from "./module-federation.js";
|
|
14
14
|
import { assertUniqueTailwindPrefixes, normalizePath, packageName, toEnvSegment, toKebabCase, toPackageScope, toPascalCase } from "./naming.js";
|
|
15
15
|
import { runCodeSmithOverlays } from "./overlays.js";
|
|
16
|
-
import { createAppPackage, createAppTsConfig, createRootPackageJson, createRootTsConfig } from "./package-json.js";
|
|
16
|
+
import { createAppMfTypesTsConfig, createAppPackage, createAppTsConfig, createRootPackageJson, createRootTsConfig } from "./package-json.js";
|
|
17
17
|
import { resolvePackageSource } from "./package-source.js";
|
|
18
18
|
import { createCloudflareDeployContract } from "./policy.js";
|
|
19
19
|
import { createPublicWebAppArtifacts, rewriteWorkspaceAssetsForApp } from "./public-surface.js";
|
|
@@ -86,6 +86,7 @@ function rewriteShellAppFiles(workspaceRoot, scope, packageSource, enableTailwin
|
|
|
86
86
|
const publicWeb = createPublicWebAppArtifacts(shellHost);
|
|
87
87
|
writeJsonFile(node_path.join(workspaceRoot, `${shellApp.directory}/package.json`), createAppPackage(scope, shellHost, packageSource, enableTailwind, remotes));
|
|
88
88
|
writeJsonFile(node_path.join(workspaceRoot, `${shellApp.directory}/tsconfig.json`), createAppTsConfig(shellHost, remotes));
|
|
89
|
+
writeJsonFile(node_path.join(workspaceRoot, `${shellApp.directory}/tsconfig.mf-types.json`), createAppMfTypesTsConfig(shellHost));
|
|
89
90
|
writeFileReplacing(workspaceRoot, `${shellApp.directory}/src/modern-app-env.d.ts`, createAppEnvDts(shellHost, remotes));
|
|
90
91
|
writeFileReplacing(workspaceRoot, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
|
|
91
92
|
writeFileReplacing(workspaceRoot, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
|
|
@@ -436,6 +437,11 @@ function createDryRunJsonMutations(preflight, manifestUrl) {
|
|
|
436
437
|
pointer: '/references',
|
|
437
438
|
description: `Add ${vertical.id} to the shell TS-Go project references`
|
|
438
439
|
},
|
|
440
|
+
{
|
|
441
|
+
path: `${shellApp.directory}/tsconfig.mf-types.json`,
|
|
442
|
+
pointer: '/include',
|
|
443
|
+
description: 'Keep shell Module Federation DTS compilation scoped'
|
|
444
|
+
},
|
|
439
445
|
{
|
|
440
446
|
path: GENERATED_CONTRACT_PATH,
|
|
441
447
|
pointer: '/apps',
|
|
@@ -544,8 +544,9 @@ function createAppGeneratedContract(scope, app, apps, enableTailwind) {
|
|
|
544
544
|
} : {},
|
|
545
545
|
exposes: Object.keys(app.exposes ?? {}),
|
|
546
546
|
dts: {
|
|
547
|
+
compilerInstance: 'tsgo',
|
|
547
548
|
displayErrorInTerminal: true,
|
|
548
|
-
|
|
549
|
+
tsConfigPath: './tsconfig.mf-types.json'
|
|
549
550
|
},
|
|
550
551
|
browserSafeExposesOnly: true,
|
|
551
552
|
zephyrRspackPlugin: ZEPHYR_RSPACK_PLUGIN_VERSION
|
|
@@ -85,10 +85,12 @@ const createRemoteFallback = (specifier: string) =>
|
|
|
85
85
|
({ error }: { error: Error }) => {
|
|
86
86
|
const { t } = useModernI18n();
|
|
87
87
|
const classification = classifyModuleFederationFallback(error);
|
|
88
|
+
const telemetryEntry =
|
|
89
|
+
typeof window === 'undefined' ? undefined : window.location.href;
|
|
88
90
|
const telemetry = createModuleFederationFallbackTelemetry({
|
|
89
91
|
appName: '${shellApp.id}',
|
|
90
92
|
classification,
|
|
91
|
-
|
|
93
|
+
...(telemetryEntry === undefined ? {} : { entry: telemetryEntry }),
|
|
92
94
|
error,
|
|
93
95
|
eventName: 'mf.client.remote.fallback',
|
|
94
96
|
exportName: 'default',
|
|
@@ -101,7 +103,7 @@ const createRemoteFallback = (specifier: string) =>
|
|
|
101
103
|
void emitModuleFederationFallbackTelemetry({
|
|
102
104
|
appName: telemetry.appName,
|
|
103
105
|
classification,
|
|
104
|
-
entry: telemetry.entry,
|
|
106
|
+
...(telemetry.entry === undefined ? {} : { entry: telemetry.entry }),
|
|
105
107
|
error,
|
|
106
108
|
eventName: telemetry.eventName,
|
|
107
109
|
exportName: 'default',
|
|
@@ -44,7 +44,7 @@ export interface CheckoutCartLine {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export interface CheckoutCart {
|
|
47
|
-
readonly lines:
|
|
47
|
+
readonly lines: readonly CheckoutCartLine[];
|
|
48
48
|
readonly subtotalCents: number;
|
|
49
49
|
readonly totalQuantity: number;
|
|
50
50
|
}
|
|
@@ -60,27 +60,27 @@ export interface CheckoutRemoveCartItemPayload {
|
|
|
60
60
|
readonly sku: string;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
export const checkoutCartLineSchema: Schema.
|
|
63
|
+
export const checkoutCartLineSchema: Schema.Codec<CheckoutCartLine> = Schema.Struct({
|
|
64
64
|
sku: Schema.String,
|
|
65
65
|
name: Schema.String,
|
|
66
66
|
quantity: Schema.Finite,
|
|
67
67
|
unitPriceCents: Schema.Finite,
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
export const checkoutCartSchema: Schema.
|
|
70
|
+
export const checkoutCartSchema: Schema.Codec<CheckoutCart> = Schema.Struct({
|
|
71
71
|
lines: Schema.Array(checkoutCartLineSchema),
|
|
72
72
|
subtotalCents: Schema.Finite,
|
|
73
73
|
totalQuantity: Schema.Finite,
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
export const checkoutAddCartItemPayloadSchema: Schema.
|
|
76
|
+
export const checkoutAddCartItemPayloadSchema: Schema.Codec<CheckoutAddCartItemPayload> = Schema.Struct({
|
|
77
77
|
sku: Schema.String,
|
|
78
78
|
name: Schema.optional(Schema.String),
|
|
79
79
|
quantity: Schema.Finite,
|
|
80
80
|
unitPriceCents: Schema.optional(Schema.Finite),
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
export const checkoutRemoveCartItemPayloadSchema: Schema.
|
|
83
|
+
export const checkoutRemoveCartItemPayloadSchema: Schema.Codec<CheckoutRemoveCartItemPayload> = Schema.Struct({
|
|
84
84
|
sku: Schema.String,
|
|
85
85
|
});
|
|
86
86
|
`;
|
|
@@ -371,7 +371,7 @@ export interface ${createPayloadType} {
|
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
export interface ${listResponseType} {
|
|
374
|
-
readonly items:
|
|
374
|
+
readonly items: readonly ${itemType}[];
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
export interface ${createResponseType} {
|
|
@@ -383,7 +383,7 @@ export interface ${notFoundErrorExport} {
|
|
|
383
383
|
readonly id: string;
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
export const ${markerSchemaExport}: Schema.
|
|
386
|
+
export const ${markerSchemaExport}: Schema.Codec<${markerType}> = Schema.Struct({
|
|
387
387
|
appId: Schema.String,
|
|
388
388
|
build: Schema.String,
|
|
389
389
|
deployProfile: Schema.String,
|
|
@@ -392,13 +392,13 @@ export const ${markerSchemaExport}: Schema.Schema<${markerType}> = Schema.Struct
|
|
|
392
392
|
version: Schema.String,
|
|
393
393
|
});
|
|
394
394
|
|
|
395
|
-
export const ${schemaExport}: Schema.
|
|
395
|
+
export const ${schemaExport}: Schema.Codec<${itemType}> = Schema.Struct({
|
|
396
396
|
id: Schema.String,
|
|
397
397
|
marker: ${markerSchemaExport},
|
|
398
398
|
title: Schema.String,
|
|
399
399
|
});
|
|
400
400
|
|
|
401
|
-
export const ${readinessSchemaExport}: Schema.
|
|
401
|
+
export const ${readinessSchemaExport}: Schema.Codec<${readinessType}> = Schema.Struct({
|
|
402
402
|
checks: Schema.Struct({
|
|
403
403
|
effectBff: Schema.Literal('ready'),
|
|
404
404
|
moduleFederation: Schema.Literal('ready'),
|
|
@@ -410,11 +410,11 @@ export const ${readinessSchemaExport}: Schema.Schema<${readinessType}> = Schema.
|
|
|
410
410
|
versionSkew: Schema.Literal('none'),
|
|
411
411
|
});
|
|
412
412
|
|
|
413
|
-
export const ${createPayloadSchemaExport}: Schema.
|
|
413
|
+
export const ${createPayloadSchemaExport}: Schema.Codec<${createPayloadType}> = Schema.Struct({
|
|
414
414
|
title: Schema.String,
|
|
415
415
|
});
|
|
416
416
|
|
|
417
|
-
${checkoutCartSharedSchemaSection}export const ${notFoundSchemaExport}: Schema.
|
|
417
|
+
${checkoutCartSharedSchemaSection}export const ${notFoundSchemaExport}: Schema.Codec<${notFoundErrorExport}> = Schema.TaggedStruct('${notFoundErrorExport}', {
|
|
418
418
|
id: Schema.String,
|
|
419
419
|
}).pipe(
|
|
420
420
|
HttpApiSchema.status(404),
|
|
@@ -525,7 +525,7 @@ import type {
|
|
|
525
525
|
EffectBffRuntime,
|
|
526
526
|
EffectRuntimeLayer,
|
|
527
527
|
} from '@modern-js/plugin-bff/effect-edge';
|
|
528
|
-
import { ultramodernApiMarker } from '../../
|
|
528
|
+
import { ultramodernApiMarker } from '../../shared/ultramodern-build.ts';
|
|
529
529
|
import {
|
|
530
530
|
${apiExport},
|
|
531
531
|
${groupName}OperationContexts,
|
|
@@ -356,6 +356,7 @@ const moduleFederationConfig: Parameters<
|
|
|
356
356
|
generateTypes: {
|
|
357
357
|
compilerInstance: 'tsgo',
|
|
358
358
|
},
|
|
359
|
+
tsConfigPath: './tsconfig.mf-types.json',
|
|
359
360
|
},
|
|
360
361
|
filename: 'remoteEntry.js',
|
|
361
362
|
name: '${shellApp.mfName}',
|
|
@@ -389,6 +390,14 @@ export const ultramodernApiMarker = {
|
|
|
389
390
|
} as const;
|
|
390
391
|
`;
|
|
391
392
|
}
|
|
393
|
+
function createUltramodernBuildReexportModule() {
|
|
394
|
+
return `export {
|
|
395
|
+
ultramodernApiMarker,
|
|
396
|
+
ultramodernUiMarker,
|
|
397
|
+
ultramodernVerticalIdentity,
|
|
398
|
+
} from '../shared/ultramodern-build';
|
|
399
|
+
`;
|
|
400
|
+
}
|
|
392
401
|
function createRemoteModuleFederationConfig(scope, app, remotes = []) {
|
|
393
402
|
const exposes = formatTsObjectLiteral(app.exposes ?? {});
|
|
394
403
|
return `// @effect-diagnostics nodeBuiltinImport:off
|
|
@@ -418,6 +427,7 @@ const moduleFederationConfig: Parameters<
|
|
|
418
427
|
generateTypes: {
|
|
419
428
|
compilerInstance: 'tsgo',
|
|
420
429
|
},
|
|
430
|
+
tsConfigPath: './tsconfig.mf-types.json',
|
|
421
431
|
},
|
|
422
432
|
exposes: ${exposes},
|
|
423
433
|
filename: 'remoteEntry.js',
|
|
@@ -429,4 +439,4 @@ ${createModuleFederationRemotesConfig(scope, app, remotes)}${createSharedModuleF
|
|
|
429
439
|
export default moduleFederationConfig;
|
|
430
440
|
`;
|
|
431
441
|
}
|
|
432
|
-
export { createAppModernConfig, createBuildMarker, createModuleFederationRemoteUrlHelpers, createModuleFederationRemotesConfig, createRemoteModuleFederationConfig, createSharedModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule, formatTsObjectLiteral };
|
|
442
|
+
export { createAppModernConfig, createBuildMarker, createModuleFederationRemoteUrlHelpers, createModuleFederationRemotesConfig, createRemoteModuleFederationConfig, createSharedModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule, createUltramodernBuildReexportModule, formatTsObjectLiteral };
|
|
@@ -275,9 +275,10 @@ function createPackageTsConfig(packageDir, options = {}) {
|
|
|
275
275
|
'locales/**/*.json',
|
|
276
276
|
'modern.config.ts',
|
|
277
277
|
'module-federation.config.ts',
|
|
278
|
-
'package.json'
|
|
278
|
+
'package.json',
|
|
279
|
+
'shared'
|
|
279
280
|
];
|
|
280
|
-
if (resolvedOptions.includeApi) include.push('api'
|
|
281
|
+
if (resolvedOptions.includeApi) include.push('api');
|
|
281
282
|
const references = createReferences(packageDir, resolvedOptions.references ?? []);
|
|
282
283
|
const tsconfig = {
|
|
283
284
|
extends: `${relativeRootFor(packageDir)}/tsconfig.base.json`,
|
|
@@ -306,6 +307,18 @@ function createAppTsConfig(app, remotes = []) {
|
|
|
306
307
|
references
|
|
307
308
|
});
|
|
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
|
+
}
|
|
309
322
|
function createSharedPackageTsConfig(packageDir) {
|
|
310
323
|
return createPackageTsConfig(packageDir, {
|
|
311
324
|
include: [
|
|
@@ -398,4 +411,4 @@ function createSharedPackage(scope, id, description) {
|
|
|
398
411
|
function createSharedContractsIndex() {
|
|
399
412
|
return readFileTemplate('packages/shared-contracts-index.ts');
|
|
400
413
|
}
|
|
401
|
-
export { appDependencies, appDevDependencies, createAppPackage, createAppTsConfig, createEffectTsgoTypecheckCommand, createPackageTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase, createZephyrDependencies, effectDiagnostics };
|
|
414
|
+
export { appDependencies, appDevDependencies, createAppMfTypesTsConfig, createAppPackage, createAppTsConfig, createEffectTsgoTypecheckCommand, createPackageTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase, createZephyrDependencies, effectDiagnostics };
|
|
@@ -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";
|
|
10
|
+
import { createAppModernConfig, createRemoteModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule, createUltramodernBuildReexportModule } from "./module-federation.js";
|
|
11
11
|
import { assertUniqueTailwindPrefixes, toPackageScope } from "./naming.js";
|
|
12
12
|
import { runCodeSmithOverlays } from "./overlays.js";
|
|
13
|
-
import { createAppPackage, createAppTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, 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";
|
|
@@ -23,8 +23,10 @@ function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes
|
|
|
23
23
|
};
|
|
24
24
|
writeJson(targetDir, `${resolvedApp.directory}/package.json`, createAppPackage(scope, resolvedApp, packageSource, enableTailwind, remotes));
|
|
25
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`,
|
|
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);
|
|
@@ -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, createAppTsConfig, createRootPackageJson, createRootTsConfig } 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";
|
|
@@ -87,6 +87,7 @@ function rewriteShellAppFiles(workspaceRoot, scope, packageSource, enableTailwin
|
|
|
87
87
|
const publicWeb = createPublicWebAppArtifacts(shellHost);
|
|
88
88
|
writeJsonFile(node_path.join(workspaceRoot, `${shellApp.directory}/package.json`), createAppPackage(scope, shellHost, packageSource, enableTailwind, remotes));
|
|
89
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));
|
|
90
91
|
writeFileReplacing(workspaceRoot, `${shellApp.directory}/src/modern-app-env.d.ts`, createAppEnvDts(shellHost, remotes));
|
|
91
92
|
writeFileReplacing(workspaceRoot, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
|
|
92
93
|
writeFileReplacing(workspaceRoot, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
|
|
@@ -437,6 +438,11 @@ function createDryRunJsonMutations(preflight, manifestUrl) {
|
|
|
437
438
|
pointer: '/references',
|
|
438
439
|
description: `Add ${vertical.id} to the shell TS-Go project references`
|
|
439
440
|
},
|
|
441
|
+
{
|
|
442
|
+
path: `${shellApp.directory}/tsconfig.mf-types.json`,
|
|
443
|
+
pointer: '/include',
|
|
444
|
+
description: 'Keep shell Module Federation DTS compilation scoped'
|
|
445
|
+
},
|
|
440
446
|
{
|
|
441
447
|
path: GENERATED_CONTRACT_PATH,
|
|
442
448
|
pointer: '/apps',
|
|
@@ -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
|
-
|
|
550
|
+
tsConfigPath: './tsconfig.mf-types.json'
|
|
550
551
|
},
|
|
551
552
|
browserSafeExposesOnly: true,
|
|
552
553
|
zephyrRspackPlugin: ZEPHYR_RSPACK_PLUGIN_VERSION
|
|
@@ -86,10 +86,12 @@ const createRemoteFallback = (specifier: string) =>
|
|
|
86
86
|
({ error }: { error: Error }) => {
|
|
87
87
|
const { t } = useModernI18n();
|
|
88
88
|
const classification = classifyModuleFederationFallback(error);
|
|
89
|
+
const telemetryEntry =
|
|
90
|
+
typeof window === 'undefined' ? undefined : window.location.href;
|
|
89
91
|
const telemetry = createModuleFederationFallbackTelemetry({
|
|
90
92
|
appName: '${shellApp.id}',
|
|
91
93
|
classification,
|
|
92
|
-
|
|
94
|
+
...(telemetryEntry === undefined ? {} : { entry: telemetryEntry }),
|
|
93
95
|
error,
|
|
94
96
|
eventName: 'mf.client.remote.fallback',
|
|
95
97
|
exportName: 'default',
|
|
@@ -102,7 +104,7 @@ const createRemoteFallback = (specifier: string) =>
|
|
|
102
104
|
void emitModuleFederationFallbackTelemetry({
|
|
103
105
|
appName: telemetry.appName,
|
|
104
106
|
classification,
|
|
105
|
-
entry: telemetry.entry,
|
|
107
|
+
...(telemetry.entry === undefined ? {} : { entry: telemetry.entry }),
|
|
106
108
|
error,
|
|
107
109
|
eventName: telemetry.eventName,
|
|
108
110
|
exportName: 'default',
|
|
@@ -45,7 +45,7 @@ export interface CheckoutCartLine {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export interface CheckoutCart {
|
|
48
|
-
readonly lines:
|
|
48
|
+
readonly lines: readonly CheckoutCartLine[];
|
|
49
49
|
readonly subtotalCents: number;
|
|
50
50
|
readonly totalQuantity: number;
|
|
51
51
|
}
|
|
@@ -61,27 +61,27 @@ export interface CheckoutRemoveCartItemPayload {
|
|
|
61
61
|
readonly sku: string;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export const checkoutCartLineSchema: Schema.
|
|
64
|
+
export const checkoutCartLineSchema: Schema.Codec<CheckoutCartLine> = Schema.Struct({
|
|
65
65
|
sku: Schema.String,
|
|
66
66
|
name: Schema.String,
|
|
67
67
|
quantity: Schema.Finite,
|
|
68
68
|
unitPriceCents: Schema.Finite,
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
export const checkoutCartSchema: Schema.
|
|
71
|
+
export const checkoutCartSchema: Schema.Codec<CheckoutCart> = Schema.Struct({
|
|
72
72
|
lines: Schema.Array(checkoutCartLineSchema),
|
|
73
73
|
subtotalCents: Schema.Finite,
|
|
74
74
|
totalQuantity: Schema.Finite,
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
export const checkoutAddCartItemPayloadSchema: Schema.
|
|
77
|
+
export const checkoutAddCartItemPayloadSchema: Schema.Codec<CheckoutAddCartItemPayload> = Schema.Struct({
|
|
78
78
|
sku: Schema.String,
|
|
79
79
|
name: Schema.optional(Schema.String),
|
|
80
80
|
quantity: Schema.Finite,
|
|
81
81
|
unitPriceCents: Schema.optional(Schema.Finite),
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
export const checkoutRemoveCartItemPayloadSchema: Schema.
|
|
84
|
+
export const checkoutRemoveCartItemPayloadSchema: Schema.Codec<CheckoutRemoveCartItemPayload> = Schema.Struct({
|
|
85
85
|
sku: Schema.String,
|
|
86
86
|
});
|
|
87
87
|
`;
|
|
@@ -372,7 +372,7 @@ export interface ${createPayloadType} {
|
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
export interface ${listResponseType} {
|
|
375
|
-
readonly items:
|
|
375
|
+
readonly items: readonly ${itemType}[];
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
export interface ${createResponseType} {
|
|
@@ -384,7 +384,7 @@ export interface ${notFoundErrorExport} {
|
|
|
384
384
|
readonly id: string;
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
export const ${markerSchemaExport}: Schema.
|
|
387
|
+
export const ${markerSchemaExport}: Schema.Codec<${markerType}> = Schema.Struct({
|
|
388
388
|
appId: Schema.String,
|
|
389
389
|
build: Schema.String,
|
|
390
390
|
deployProfile: Schema.String,
|
|
@@ -393,13 +393,13 @@ export const ${markerSchemaExport}: Schema.Schema<${markerType}> = Schema.Struct
|
|
|
393
393
|
version: Schema.String,
|
|
394
394
|
});
|
|
395
395
|
|
|
396
|
-
export const ${schemaExport}: Schema.
|
|
396
|
+
export const ${schemaExport}: Schema.Codec<${itemType}> = Schema.Struct({
|
|
397
397
|
id: Schema.String,
|
|
398
398
|
marker: ${markerSchemaExport},
|
|
399
399
|
title: Schema.String,
|
|
400
400
|
});
|
|
401
401
|
|
|
402
|
-
export const ${readinessSchemaExport}: Schema.
|
|
402
|
+
export const ${readinessSchemaExport}: Schema.Codec<${readinessType}> = Schema.Struct({
|
|
403
403
|
checks: Schema.Struct({
|
|
404
404
|
effectBff: Schema.Literal('ready'),
|
|
405
405
|
moduleFederation: Schema.Literal('ready'),
|
|
@@ -411,11 +411,11 @@ export const ${readinessSchemaExport}: Schema.Schema<${readinessType}> = Schema.
|
|
|
411
411
|
versionSkew: Schema.Literal('none'),
|
|
412
412
|
});
|
|
413
413
|
|
|
414
|
-
export const ${createPayloadSchemaExport}: Schema.
|
|
414
|
+
export const ${createPayloadSchemaExport}: Schema.Codec<${createPayloadType}> = Schema.Struct({
|
|
415
415
|
title: Schema.String,
|
|
416
416
|
});
|
|
417
417
|
|
|
418
|
-
${checkoutCartSharedSchemaSection}export const ${notFoundSchemaExport}: Schema.
|
|
418
|
+
${checkoutCartSharedSchemaSection}export const ${notFoundSchemaExport}: Schema.Codec<${notFoundErrorExport}> = Schema.TaggedStruct('${notFoundErrorExport}', {
|
|
419
419
|
id: Schema.String,
|
|
420
420
|
}).pipe(
|
|
421
421
|
HttpApiSchema.status(404),
|
|
@@ -526,7 +526,7 @@ import type {
|
|
|
526
526
|
EffectBffRuntime,
|
|
527
527
|
EffectRuntimeLayer,
|
|
528
528
|
} from '@modern-js/plugin-bff/effect-edge';
|
|
529
|
-
import { ultramodernApiMarker } from '../../
|
|
529
|
+
import { ultramodernApiMarker } from '../../shared/ultramodern-build.ts';
|
|
530
530
|
import {
|
|
531
531
|
${apiExport},
|
|
532
532
|
${groupName}OperationContexts,
|
|
@@ -357,6 +357,7 @@ const moduleFederationConfig: Parameters<
|
|
|
357
357
|
generateTypes: {
|
|
358
358
|
compilerInstance: 'tsgo',
|
|
359
359
|
},
|
|
360
|
+
tsConfigPath: './tsconfig.mf-types.json',
|
|
360
361
|
},
|
|
361
362
|
filename: 'remoteEntry.js',
|
|
362
363
|
name: '${shellApp.mfName}',
|
|
@@ -390,6 +391,14 @@ export const ultramodernApiMarker = {
|
|
|
390
391
|
} as const;
|
|
391
392
|
`;
|
|
392
393
|
}
|
|
394
|
+
function createUltramodernBuildReexportModule() {
|
|
395
|
+
return `export {
|
|
396
|
+
ultramodernApiMarker,
|
|
397
|
+
ultramodernUiMarker,
|
|
398
|
+
ultramodernVerticalIdentity,
|
|
399
|
+
} from '../shared/ultramodern-build';
|
|
400
|
+
`;
|
|
401
|
+
}
|
|
393
402
|
function createRemoteModuleFederationConfig(scope, app, remotes = []) {
|
|
394
403
|
const exposes = formatTsObjectLiteral(app.exposes ?? {});
|
|
395
404
|
return `// @effect-diagnostics nodeBuiltinImport:off
|
|
@@ -419,6 +428,7 @@ const moduleFederationConfig: Parameters<
|
|
|
419
428
|
generateTypes: {
|
|
420
429
|
compilerInstance: 'tsgo',
|
|
421
430
|
},
|
|
431
|
+
tsConfigPath: './tsconfig.mf-types.json',
|
|
422
432
|
},
|
|
423
433
|
exposes: ${exposes},
|
|
424
434
|
filename: 'remoteEntry.js',
|
|
@@ -430,4 +440,4 @@ ${createModuleFederationRemotesConfig(scope, app, remotes)}${createSharedModuleF
|
|
|
430
440
|
export default moduleFederationConfig;
|
|
431
441
|
`;
|
|
432
442
|
}
|
|
433
|
-
export { createAppModernConfig, createBuildMarker, createModuleFederationRemoteUrlHelpers, createModuleFederationRemotesConfig, createRemoteModuleFederationConfig, createSharedModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule, formatTsObjectLiteral };
|
|
443
|
+
export { createAppModernConfig, createBuildMarker, createModuleFederationRemoteUrlHelpers, createModuleFederationRemotesConfig, createRemoteModuleFederationConfig, createSharedModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule, createUltramodernBuildReexportModule, formatTsObjectLiteral };
|
|
@@ -276,9 +276,10 @@ function createPackageTsConfig(packageDir, options = {}) {
|
|
|
276
276
|
'locales/**/*.json',
|
|
277
277
|
'modern.config.ts',
|
|
278
278
|
'module-federation.config.ts',
|
|
279
|
-
'package.json'
|
|
279
|
+
'package.json',
|
|
280
|
+
'shared'
|
|
280
281
|
];
|
|
281
|
-
if (resolvedOptions.includeApi) include.push('api'
|
|
282
|
+
if (resolvedOptions.includeApi) include.push('api');
|
|
282
283
|
const references = createReferences(packageDir, resolvedOptions.references ?? []);
|
|
283
284
|
const tsconfig = {
|
|
284
285
|
extends: `${relativeRootFor(packageDir)}/tsconfig.base.json`,
|
|
@@ -307,6 +308,18 @@ function createAppTsConfig(app, remotes = []) {
|
|
|
307
308
|
references
|
|
308
309
|
});
|
|
309
310
|
}
|
|
311
|
+
function createAppMfTypesTsConfig(app) {
|
|
312
|
+
const exposedFiles = Object.values(app.exposes ?? {}).map((exposePath)=>exposePath.replace(/^\.\//u, ''));
|
|
313
|
+
return {
|
|
314
|
+
extends: './tsconfig.json',
|
|
315
|
+
include: [
|
|
316
|
+
...new Set([
|
|
317
|
+
...exposedFiles,
|
|
318
|
+
'src/modern-app-env.d.ts'
|
|
319
|
+
])
|
|
320
|
+
]
|
|
321
|
+
};
|
|
322
|
+
}
|
|
310
323
|
function createSharedPackageTsConfig(packageDir) {
|
|
311
324
|
return createPackageTsConfig(packageDir, {
|
|
312
325
|
include: [
|
|
@@ -399,4 +412,4 @@ function createSharedPackage(scope, id, description) {
|
|
|
399
412
|
function createSharedContractsIndex() {
|
|
400
413
|
return readFileTemplate('packages/shared-contracts-index.ts');
|
|
401
414
|
}
|
|
402
|
-
export { appDependencies, appDevDependencies, createAppPackage, createAppTsConfig, createEffectTsgoTypecheckCommand, createPackageTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase, createZephyrDependencies, effectDiagnostics };
|
|
415
|
+
export { appDependencies, appDevDependencies, createAppMfTypesTsConfig, createAppPackage, createAppTsConfig, createEffectTsgoTypecheckCommand, createPackageTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase, createZephyrDependencies, effectDiagnostics };
|
|
@@ -8,10 +8,10 @@ import { createEffectClient, createEffectServiceEntry, createEffectSharedApi, cr
|
|
|
8
8
|
import { copyRootTemplate, writeFile, writeJson } from "./fs-io.js";
|
|
9
9
|
import { createFileSnapshot, createGenerationResult, diffFileSnapshots } from "./generation-result.js";
|
|
10
10
|
import { createAppPublicLocaleMessages } from "./locales.js";
|
|
11
|
-
import { createAppModernConfig, createRemoteModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule } from "./module-federation.js";
|
|
11
|
+
import { createAppModernConfig, createRemoteModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule, createUltramodernBuildReexportModule } from "./module-federation.js";
|
|
12
12
|
import { assertUniqueTailwindPrefixes, toPackageScope } from "./naming.js";
|
|
13
13
|
import { runCodeSmithOverlays } from "./overlays.js";
|
|
14
|
-
import { createAppPackage, createAppTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase } from "./package-json.js";
|
|
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
17
|
import { NODE_FETCH_VERSION, NODE_VERSION, PNPM_VERSION, TANSTACK_ROUTER_VERSION, TYPESCRIPT_VERSION } from "./versions.js";
|
|
@@ -24,8 +24,10 @@ function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes
|
|
|
24
24
|
};
|
|
25
25
|
writeJson(targetDir, `${resolvedApp.directory}/package.json`, createAppPackage(scope, resolvedApp, packageSource, enableTailwind, remotes));
|
|
26
26
|
writeJson(targetDir, `${resolvedApp.directory}/tsconfig.json`, createAppTsConfig(resolvedApp, remotes));
|
|
27
|
+
writeJson(targetDir, `${resolvedApp.directory}/tsconfig.mf-types.json`, createAppMfTypesTsConfig(resolvedApp));
|
|
27
28
|
writeFile(targetDir, `${resolvedApp.directory}/src/modern-app-env.d.ts`, createAppEnvDts(resolvedApp, remotes));
|
|
28
|
-
writeFile(targetDir, `${resolvedApp.directory}/src/ultramodern-build.ts`,
|
|
29
|
+
writeFile(targetDir, `${resolvedApp.directory}/src/ultramodern-build.ts`, createUltramodernBuildReexportModule());
|
|
30
|
+
writeFile(targetDir, `${resolvedApp.directory}/shared/ultramodern-build.ts`, createUltramodernBuildModule(scope, resolvedApp));
|
|
29
31
|
writeFile(targetDir, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
|
|
30
32
|
writeFile(targetDir, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
|
|
31
33
|
writeFile(targetDir, publicWeb.routeHeadFile.path, publicWeb.routeHeadFile.content);
|
|
@@ -13,4 +13,5 @@ export declare function createUltramodernBuildModule(scope: string, app: {
|
|
|
13
13
|
id: string;
|
|
14
14
|
packageSuffix: string;
|
|
15
15
|
}): string;
|
|
16
|
+
export declare function createUltramodernBuildReexportModule(): string;
|
|
16
17
|
export declare function createRemoteModuleFederationConfig(scope: string, app: WorkspaceApp, remotes?: WorkspaceApp[]): string;
|
|
@@ -13,6 +13,7 @@ type CreatePackageTsConfigOptions = {
|
|
|
13
13
|
};
|
|
14
14
|
export declare function createPackageTsConfig(packageDir: string, options?: CreatePackageTsConfigOptions | boolean): JsonValue;
|
|
15
15
|
export declare function createAppTsConfig(app: WorkspaceApp, remotes?: WorkspaceApp[]): JsonValue;
|
|
16
|
+
export declare function createAppMfTypesTsConfig(app: WorkspaceApp): JsonValue;
|
|
16
17
|
export declare function createSharedPackageTsConfig(packageDir: string): JsonValue;
|
|
17
18
|
export declare function createRootTsConfig(apps?: WorkspaceApp[]): JsonValue;
|
|
18
19
|
export declare function createAppPackage(scope: string, app: WorkspaceApp, packageSource: ResolvedPackageSource, enableTailwind: boolean, remotes?: WorkspaceApp[]): JsonValue;
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20"
|
|
23
23
|
},
|
|
24
|
-
"version": "3.4.0-ultramodern.
|
|
24
|
+
"version": "3.4.0-ultramodern.6",
|
|
25
25
|
"types": "./dist/types/index.d.ts",
|
|
26
26
|
"main": "./dist/esm-node/index.js",
|
|
27
27
|
"bin": {
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
],
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@modern-js/codesmith": "2.6.9",
|
|
78
|
-
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.4.0-ultramodern.
|
|
78
|
+
"@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.4.0-ultramodern.6"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@rslib/core": "0.23.0",
|
|
@@ -97,6 +97,6 @@
|
|
|
97
97
|
"test": "rm -rf dist && rslib build -c rslibconfig.mts && rstest --passWithNoTests"
|
|
98
98
|
},
|
|
99
99
|
"ultramodern": {
|
|
100
|
-
"frameworkVersion": "3.4.0-ultramodern.
|
|
100
|
+
"frameworkVersion": "3.4.0-ultramodern.6"
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -48,6 +48,15 @@ for (const appDir of appDirs) {
|
|
|
48
48
|
`Module Federation DTS must use the workspace TypeScript compiler: ${appDir}`,
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
|
+
if (
|
|
52
|
+
contractEntry &&
|
|
53
|
+
contractEntry.moduleFederation?.dts?.tsConfigPath !==
|
|
54
|
+
'./tsconfig.mf-types.json'
|
|
55
|
+
) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`Module Federation DTS must use the dedicated public-surface tsconfig: ${appDir}`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
51
60
|
|
|
52
61
|
if (contractEntry && contractEntry.moduleFederation?.exposes?.length === 0) {
|
|
53
62
|
continue;
|
|
@@ -92,6 +92,7 @@ const expectedRemoteSubsetsForRefs = refs =>
|
|
|
92
92
|
const requiredMicroVerticalPaths = vertical => [
|
|
93
93
|
`${vertical.path}/package.json`,
|
|
94
94
|
`${vertical.path}/tsconfig.json`,
|
|
95
|
+
`${vertical.path}/tsconfig.mf-types.json`,
|
|
95
96
|
`${vertical.path}/modern.config.ts`,
|
|
96
97
|
`${vertical.path}/module-federation.config.ts`,
|
|
97
98
|
`${vertical.path}/api/effect/index.ts`,
|
|
@@ -419,6 +420,9 @@ const assertProjectReferenceEmitConfig = (tsConfig, packagePath) => {
|
|
|
419
420
|
const assertTsConfigReferenceGraph = () => {
|
|
420
421
|
const rootTsConfig = readJson('tsconfig.json');
|
|
421
422
|
const shellTsConfig = readJson('apps/shell-super-app/tsconfig.json');
|
|
423
|
+
const shellMfTypesTsConfig = readJson(
|
|
424
|
+
'apps/shell-super-app/tsconfig.mf-types.json',
|
|
425
|
+
);
|
|
422
426
|
const expectedRootReferences = [
|
|
423
427
|
...sharedPackagePaths,
|
|
424
428
|
'apps/shell-super-app',
|
|
@@ -453,6 +457,15 @@ const assertTsConfigReferenceGraph = () => {
|
|
|
453
457
|
shellTsConfig,
|
|
454
458
|
'apps/shell-super-app',
|
|
455
459
|
);
|
|
460
|
+
assertSameJson(
|
|
461
|
+
shellMfTypesTsConfig,
|
|
462
|
+
{
|
|
463
|
+
extends: './tsconfig.json',
|
|
464
|
+
include: ['src/modern-app-env.d.ts'],
|
|
465
|
+
},
|
|
466
|
+
'apps/shell-super-app/tsconfig.mf-types.json',
|
|
467
|
+
'restore the generated shell Module Federation DTS boundary',
|
|
468
|
+
);
|
|
456
469
|
for (const sharedPackagePath of sharedPackagePaths) {
|
|
457
470
|
assertProjectReferenceEmitConfig(
|
|
458
471
|
readJson(`${sharedPackagePath}/tsconfig.json`),
|
|
@@ -462,6 +475,9 @@ const assertTsConfigReferenceGraph = () => {
|
|
|
462
475
|
|
|
463
476
|
for (const vertical of fullStackVerticals) {
|
|
464
477
|
const verticalTsConfig = readJson(`${vertical.path}/tsconfig.json`);
|
|
478
|
+
const verticalMfTypesTsConfig = readJson(
|
|
479
|
+
`${vertical.path}/tsconfig.mf-types.json`,
|
|
480
|
+
);
|
|
465
481
|
const expectedVerticalReferences = [
|
|
466
482
|
...sharedPackagePaths,
|
|
467
483
|
...(vertical.verticalRefs ?? [])
|
|
@@ -478,6 +494,21 @@ const assertTsConfigReferenceGraph = () => {
|
|
|
478
494
|
'restore the generated MicroVertical project-reference graph',
|
|
479
495
|
);
|
|
480
496
|
assertProjectReferenceEmitConfig(verticalTsConfig, vertical.path);
|
|
497
|
+
assertSameJson(
|
|
498
|
+
verticalMfTypesTsConfig,
|
|
499
|
+
{
|
|
500
|
+
extends: './tsconfig.json',
|
|
501
|
+
include: [
|
|
502
|
+
'src/federation-entry.tsx',
|
|
503
|
+
...vertical.componentPaths.map(componentPath =>
|
|
504
|
+
componentPath.replace(`${vertical.path}/`, ''),
|
|
505
|
+
),
|
|
506
|
+
'src/modern-app-env.d.ts',
|
|
507
|
+
],
|
|
508
|
+
},
|
|
509
|
+
`${vertical.path}/tsconfig.mf-types.json`,
|
|
510
|
+
'restore the generated MicroVertical Module Federation DTS boundary',
|
|
511
|
+
);
|
|
481
512
|
}
|
|
482
513
|
};
|
|
483
514
|
const packageJsonFiles = startDir => {
|
|
@@ -759,6 +790,7 @@ const requiredPaths = [
|
|
|
759
790
|
'scripts/ultramodern-typecheck.mjs',
|
|
760
791
|
'apps/shell-super-app/package.json',
|
|
761
792
|
'apps/shell-super-app/tsconfig.json',
|
|
793
|
+
'apps/shell-super-app/tsconfig.mf-types.json',
|
|
762
794
|
'apps/shell-super-app/modern.config.ts',
|
|
763
795
|
'apps/shell-super-app/module-federation.config.ts',
|
|
764
796
|
'apps/shell-super-app/src/modern-app-env.d.ts',
|
|
@@ -966,6 +998,7 @@ assert(generatedContract.performanceReadiness?.optOut?.env === 'ULTRAMODERN_PERF
|
|
|
966
998
|
assert(JSON.stringify(generatedContract.performanceReadiness?.signals?.map(signal => signal.id)) === JSON.stringify(expectedPerformanceReadinessSignals), 'Performance readiness signal ids are incorrect');
|
|
967
999
|
|
|
968
1000
|
const shellModernConfig = readText('apps/shell-super-app/modern.config.ts');
|
|
1001
|
+
const shellModuleFederationConfig = readText('apps/shell-super-app/module-federation.config.ts');
|
|
969
1002
|
const shellRouteHead = readText('apps/shell-super-app/src/routes/ultramodern-route-head.tsx');
|
|
970
1003
|
const shellRouteMetadata = readText('apps/shell-super-app/src/routes/ultramodern-route-metadata.ts');
|
|
971
1004
|
assert(shellRouteMetadata.includes('@generated by @modern-js/create'), 'Shell route metadata compatibility manifest must be marked generated');
|
|
@@ -1017,6 +1050,9 @@ assert(shellContract?.config?.performance?.readinessDiagnostics?.optOut?.env ===
|
|
|
1017
1050
|
assert(JSON.stringify(shellContract?.config?.source?.siteUrl?.envFallbackOrder) === JSON.stringify(['MODERN_PUBLIC_SITE_URL', 'ULTRAMODERN_PUBLIC_URL_SHELL_SUPER_APP', 'ULTRAMODERN_CLOUDFLARE_WORKERS_DEV_SUBDOMAIN', 'SHELL_SUPER_APP_PORT']), 'Shell site URL env fallback order is incorrect');
|
|
1018
1051
|
assert(shellContract?.config?.rspack?.output?.uniqueName === 'shellSuperApp', 'Shell Rspack uniqueName is incorrect');
|
|
1019
1052
|
assert(shellContract?.config?.rspack?.output?.chunkLoadingGlobal === expectedChunkLoadingGlobal('shellSuperApp'), 'Shell Rspack chunkLoadingGlobal is incorrect');
|
|
1053
|
+
assert(shellContract?.moduleFederation?.dts?.compilerInstance === 'tsgo', 'Shell must keep mandatory DTS compiler');
|
|
1054
|
+
assert(shellContract?.moduleFederation?.dts?.tsConfigPath === './tsconfig.mf-types.json', 'Shell must keep dedicated Module Federation DTS tsconfig');
|
|
1055
|
+
assert(shellModuleFederationConfig.includes("tsConfigPath: './tsconfig.mf-types.json'"), 'Shell Module Federation config must use the dedicated DTS tsconfig');
|
|
1020
1056
|
assert(topology.shell?.cloudflare?.workerName === expectedWorkerName('shell-super-app'), 'Shell topology Cloudflare workerName is incorrect');
|
|
1021
1057
|
assert(shellContract?.styling?.federation?.owner?.id === 'shell-super-app', 'Shell CSS federation owner is missing');
|
|
1022
1058
|
assert(shellContract?.styling?.federation?.role === 'shell-base-overlay', 'Shell must own base and overlay CSS');
|
|
@@ -1051,6 +1087,7 @@ assert(!('effectServices' in topology), 'Default APIs must be vertical-owned, no
|
|
|
1051
1087
|
for (const vertical of fullStackVerticals) {
|
|
1052
1088
|
const packageJson = readJson(`${vertical.path}/package.json`);
|
|
1053
1089
|
const modernConfig = readText(`${vertical.path}/modern.config.ts`);
|
|
1090
|
+
const moduleFederationConfig = readText(`${vertical.path}/module-federation.config.ts`);
|
|
1054
1091
|
const routeHead = readText(`${vertical.path}/src/routes/ultramodern-route-head.tsx`);
|
|
1055
1092
|
const routeMetadata = readText(`${vertical.path}/src/routes/ultramodern-route-metadata.ts`);
|
|
1056
1093
|
assert(routeMetadata.includes('@generated by @modern-js/create'), `${vertical.id} route metadata compatibility manifest must be marked generated`);
|
|
@@ -1115,6 +1152,8 @@ for (const vertical of fullStackVerticals) {
|
|
|
1115
1152
|
assert(contractEntry?.moduleFederation?.name === vertical.mfName, `${vertical.id} MF name is incorrect`);
|
|
1116
1153
|
assert(JSON.stringify(contractEntry?.moduleFederation?.exposes) === JSON.stringify(vertical.exposes), `${vertical.id} MF exposes are incorrect`);
|
|
1117
1154
|
assert(contractEntry?.moduleFederation?.dts?.compilerInstance === 'tsgo', `${vertical.id} must keep mandatory DTS compiler`);
|
|
1155
|
+
assert(contractEntry?.moduleFederation?.dts?.tsConfigPath === './tsconfig.mf-types.json', `${vertical.id} must keep dedicated Module Federation DTS tsconfig`);
|
|
1156
|
+
assert(moduleFederationConfig.includes("tsConfigPath: './tsconfig.mf-types.json'"), `${vertical.id} Module Federation config must use the dedicated DTS tsconfig`);
|
|
1118
1157
|
assert(JSON.stringify(contractEntry?.moduleFederation?.verticalRefs ?? []) === JSON.stringify(vertical.verticalRefs), `${vertical.id} MF verticalRefs are incorrect`);
|
|
1119
1158
|
assert(
|
|
1120
1159
|
JSON.stringify((contractEntry?.moduleFederation?.remotes ?? []).map(remote => remote.id)) ===
|