@bleedingdev/modern-js-create 3.4.0-ultramodern.4 → 3.4.0-ultramodern.5
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/demo-components.cjs +4 -2
- package/dist/cjs/ultramodern-workspace/effect-api.cjs +12 -12
- package/dist/cjs/ultramodern-workspace/module-federation.cjs +11 -0
- package/dist/cjs/ultramodern-workspace/package-json.cjs +3 -2
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +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 +9 -1
- package/dist/esm/ultramodern-workspace/package-json.js +3 -2
- package/dist/esm/ultramodern-workspace/write-workspace.js +3 -2
- 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 +9 -1
- package/dist/esm-node/ultramodern-workspace/package-json.js +3 -2
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +3 -2
- package/dist/types/ultramodern-workspace/module-federation.d.ts +1 -0
- package/package.json +3 -3
|
@@ -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");
|
|
@@ -439,6 +440,14 @@ export const ultramodernApiMarker = {
|
|
|
439
440
|
} as const;
|
|
440
441
|
`;
|
|
441
442
|
}
|
|
443
|
+
function createUltramodernBuildReexportModule() {
|
|
444
|
+
return `export {
|
|
445
|
+
ultramodernApiMarker,
|
|
446
|
+
ultramodernUiMarker,
|
|
447
|
+
ultramodernVerticalIdentity,
|
|
448
|
+
} from '../shared/ultramodern-build';
|
|
449
|
+
`;
|
|
450
|
+
}
|
|
442
451
|
function createRemoteModuleFederationConfig(scope, app, remotes = []) {
|
|
443
452
|
const exposes = formatTsObjectLiteral(app.exposes ?? {});
|
|
444
453
|
return `// @effect-diagnostics nodeBuiltinImport:off
|
|
@@ -487,6 +496,7 @@ exports.createRemoteModuleFederationConfig = __webpack_exports__.createRemoteMod
|
|
|
487
496
|
exports.createSharedModuleFederationConfig = __webpack_exports__.createSharedModuleFederationConfig;
|
|
488
497
|
exports.createShellModuleFederationConfig = __webpack_exports__.createShellModuleFederationConfig;
|
|
489
498
|
exports.createUltramodernBuildModule = __webpack_exports__.createUltramodernBuildModule;
|
|
499
|
+
exports.createUltramodernBuildReexportModule = __webpack_exports__.createUltramodernBuildReexportModule;
|
|
490
500
|
exports.formatTsObjectLiteral = __webpack_exports__.formatTsObjectLiteral;
|
|
491
501
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
492
502
|
"createAppModernConfig",
|
|
@@ -497,6 +507,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
497
507
|
"createSharedModuleFederationConfig",
|
|
498
508
|
"createShellModuleFederationConfig",
|
|
499
509
|
"createUltramodernBuildModule",
|
|
510
|
+
"createUltramodernBuildReexportModule",
|
|
500
511
|
"formatTsObjectLiteral"
|
|
501
512
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
502
513
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -320,9 +320,10 @@ function createPackageTsConfig(packageDir, options = {}) {
|
|
|
320
320
|
'locales/**/*.json',
|
|
321
321
|
'modern.config.ts',
|
|
322
322
|
'module-federation.config.ts',
|
|
323
|
-
'package.json'
|
|
323
|
+
'package.json',
|
|
324
|
+
'shared'
|
|
324
325
|
];
|
|
325
|
-
if (resolvedOptions.includeApi) include.push('api'
|
|
326
|
+
if (resolvedOptions.includeApi) include.push('api');
|
|
326
327
|
const references = createReferences(packageDir, resolvedOptions.references ?? []);
|
|
327
328
|
const tsconfig = {
|
|
328
329
|
extends: `${(0, external_naming_cjs_namespaceObject.relativeRootFor)(packageDir)}/tsconfig.base.json`,
|
|
@@ -68,7 +68,8 @@ function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes
|
|
|
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
70
|
(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.
|
|
71
|
+
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, `${resolvedApp.directory}/src/ultramodern-build.ts`, (0, external_module_federation_cjs_namespaceObject.createUltramodernBuildReexportModule)());
|
|
72
|
+
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, `${resolvedApp.directory}/shared/ultramodern-build.ts`, (0, external_module_federation_cjs_namespaceObject.createUltramodernBuildModule)(scope, resolvedApp));
|
|
72
73
|
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
|
|
73
74
|
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
|
|
74
75
|
(0, external_fs_io_cjs_namespaceObject.writeFile)(targetDir, publicWeb.routeHeadFile.path, publicWeb.routeHeadFile.content);
|
|
@@ -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,
|
|
@@ -389,6 +389,14 @@ export const ultramodernApiMarker = {
|
|
|
389
389
|
} as const;
|
|
390
390
|
`;
|
|
391
391
|
}
|
|
392
|
+
function createUltramodernBuildReexportModule() {
|
|
393
|
+
return `export {
|
|
394
|
+
ultramodernApiMarker,
|
|
395
|
+
ultramodernUiMarker,
|
|
396
|
+
ultramodernVerticalIdentity,
|
|
397
|
+
} from '../shared/ultramodern-build';
|
|
398
|
+
`;
|
|
399
|
+
}
|
|
392
400
|
function createRemoteModuleFederationConfig(scope, app, remotes = []) {
|
|
393
401
|
const exposes = formatTsObjectLiteral(app.exposes ?? {});
|
|
394
402
|
return `// @effect-diagnostics nodeBuiltinImport:off
|
|
@@ -429,4 +437,4 @@ ${createModuleFederationRemotesConfig(scope, app, remotes)}${createSharedModuleF
|
|
|
429
437
|
export default moduleFederationConfig;
|
|
430
438
|
`;
|
|
431
439
|
}
|
|
432
|
-
export { createAppModernConfig, createBuildMarker, createModuleFederationRemoteUrlHelpers, createModuleFederationRemotesConfig, createRemoteModuleFederationConfig, createSharedModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule, formatTsObjectLiteral };
|
|
440
|
+
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`,
|
|
@@ -7,7 +7,7 @@ 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
13
|
import { createAppPackage, createAppTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase } from "./package-json.js";
|
|
@@ -24,7 +24,8 @@ function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes
|
|
|
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
26
|
writeFile(targetDir, `${resolvedApp.directory}/src/modern-app-env.d.ts`, createAppEnvDts(resolvedApp, remotes));
|
|
27
|
-
writeFile(targetDir, `${resolvedApp.directory}/src/ultramodern-build.ts`,
|
|
27
|
+
writeFile(targetDir, `${resolvedApp.directory}/src/ultramodern-build.ts`, createUltramodernBuildReexportModule());
|
|
28
|
+
writeFile(targetDir, `${resolvedApp.directory}/shared/ultramodern-build.ts`, createUltramodernBuildModule(scope, resolvedApp));
|
|
28
29
|
writeFile(targetDir, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
|
|
29
30
|
writeFile(targetDir, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
|
|
30
31
|
writeFile(targetDir, publicWeb.routeHeadFile.path, publicWeb.routeHeadFile.content);
|
|
@@ -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,
|
|
@@ -390,6 +390,14 @@ export const ultramodernApiMarker = {
|
|
|
390
390
|
} as const;
|
|
391
391
|
`;
|
|
392
392
|
}
|
|
393
|
+
function createUltramodernBuildReexportModule() {
|
|
394
|
+
return `export {
|
|
395
|
+
ultramodernApiMarker,
|
|
396
|
+
ultramodernUiMarker,
|
|
397
|
+
ultramodernVerticalIdentity,
|
|
398
|
+
} from '../shared/ultramodern-build';
|
|
399
|
+
`;
|
|
400
|
+
}
|
|
393
401
|
function createRemoteModuleFederationConfig(scope, app, remotes = []) {
|
|
394
402
|
const exposes = formatTsObjectLiteral(app.exposes ?? {});
|
|
395
403
|
return `// @effect-diagnostics nodeBuiltinImport:off
|
|
@@ -430,4 +438,4 @@ ${createModuleFederationRemotesConfig(scope, app, remotes)}${createSharedModuleF
|
|
|
430
438
|
export default moduleFederationConfig;
|
|
431
439
|
`;
|
|
432
440
|
}
|
|
433
|
-
export { createAppModernConfig, createBuildMarker, createModuleFederationRemoteUrlHelpers, createModuleFederationRemotesConfig, createRemoteModuleFederationConfig, createSharedModuleFederationConfig, createShellModuleFederationConfig, createUltramodernBuildModule, formatTsObjectLiteral };
|
|
441
|
+
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`,
|
|
@@ -8,7 +8,7 @@ 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
14
|
import { createAppPackage, createAppTsConfig, createRootPackageJson, createRootTsConfig, createSharedContractsIndex, createSharedPackage, createSharedPackageTsConfig, createTsConfigBase } from "./package-json.js";
|
|
@@ -25,7 +25,8 @@ function writeApp(targetDir, scope, app, packageSource, enableTailwind, remotes
|
|
|
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
27
|
writeFile(targetDir, `${resolvedApp.directory}/src/modern-app-env.d.ts`, createAppEnvDts(resolvedApp, remotes));
|
|
28
|
-
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));
|
|
29
30
|
writeFile(targetDir, publicWeb.jsonLdHelperFile.path, publicWeb.jsonLdHelperFile.content);
|
|
30
31
|
writeFile(targetDir, publicWeb.routeMetadataFile.path, publicWeb.routeMetadataFile.content);
|
|
31
32
|
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;
|
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.5",
|
|
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.5"
|
|
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.5"
|
|
101
101
|
}
|
|
102
102
|
}
|