@bleedingdev/modern-js-create 3.4.0-ultramodern.3 → 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.
@@ -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
- entry: typeof window === 'undefined' ? undefined : window.location.href,
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',
@@ -149,7 +151,7 @@ const createRemoteFallback = (specifier: string) =>
149
151
  remote: specifier,
150
152
  status: 'degraded',
151
153
  });
152
- }, [classification, error, specifier, telemetry]);
154
+ }, [classification, error, telemetry]);
153
155
 
154
156
  return <div className="${tw('rounded-xl border border-red-900/20 bg-red-50 px-4 py-3 text-sm font-semibold text-red-900')}" data-remote-error={error.name} {...toModuleFederationFallbackAttributes(telemetry)}>{t('shell.remoteUnavailable')}</div>;
155
157
  };
@@ -88,27 +88,51 @@ function serviceHasCheckoutCartState(service) {
88
88
  function createCheckoutCartSharedSchemas(service) {
89
89
  if (!serviceHasCheckoutCartState(service)) return '';
90
90
  return `
91
- export const checkoutCartLineSchema = Schema.Struct({
91
+ export interface CheckoutCartLine {
92
+ readonly sku: string;
93
+ readonly name: string;
94
+ readonly quantity: number;
95
+ readonly unitPriceCents: number;
96
+ }
97
+
98
+ export interface CheckoutCart {
99
+ readonly lines: readonly CheckoutCartLine[];
100
+ readonly subtotalCents: number;
101
+ readonly totalQuantity: number;
102
+ }
103
+
104
+ export interface CheckoutAddCartItemPayload {
105
+ readonly sku: string;
106
+ readonly name?: string;
107
+ readonly quantity: number;
108
+ readonly unitPriceCents?: number;
109
+ }
110
+
111
+ export interface CheckoutRemoveCartItemPayload {
112
+ readonly sku: string;
113
+ }
114
+
115
+ export const checkoutCartLineSchema: Schema.Codec<CheckoutCartLine> = Schema.Struct({
92
116
  sku: Schema.String,
93
117
  name: Schema.String,
94
118
  quantity: Schema.Finite,
95
119
  unitPriceCents: Schema.Finite,
96
120
  });
97
121
 
98
- export const checkoutCartSchema = Schema.Struct({
122
+ export const checkoutCartSchema: Schema.Codec<CheckoutCart> = Schema.Struct({
99
123
  lines: Schema.Array(checkoutCartLineSchema),
100
124
  subtotalCents: Schema.Finite,
101
125
  totalQuantity: Schema.Finite,
102
126
  });
103
127
 
104
- export const checkoutAddCartItemPayloadSchema = Schema.Struct({
128
+ export const checkoutAddCartItemPayloadSchema: Schema.Codec<CheckoutAddCartItemPayload> = Schema.Struct({
105
129
  sku: Schema.String,
106
130
  name: Schema.optional(Schema.String),
107
131
  quantity: Schema.Finite,
108
132
  unitPriceCents: Schema.optional(Schema.Finite),
109
133
  });
110
134
 
111
- export const checkoutRemoveCartItemPayloadSchema = Schema.Struct({
135
+ export const checkoutRemoveCartItemPayloadSchema: Schema.Codec<CheckoutRemoveCartItemPayload> = Schema.Struct({
112
136
  sku: Schema.String,
113
137
  });
114
138
  `;
@@ -261,6 +285,7 @@ function createCheckoutCartClientExports(service) {
261
285
  const pascalStem = (0, external_naming_cjs_namespaceObject.toPascalCase)(stem);
262
286
  const clientOptionsName = `${pascalStem}ClientOptions`;
263
287
  const createClientName = `create${pascalStem}Client`;
288
+ const clientEffectTypeName = `${pascalStem}ClientEffect`;
264
289
  return `
265
290
  export interface CheckoutCartLine {
266
291
  sku: string;
@@ -284,7 +309,7 @@ export interface CheckoutAddCartItemInput {
284
309
 
285
310
  export const getCheckoutCart = (
286
311
  options: ${clientOptionsName} = {},
287
- ) =>
312
+ ): ${clientEffectTypeName}<CheckoutCart> =>
288
313
  ${createClientName}({
289
314
  ...options,
290
315
  operationContext:
@@ -296,7 +321,7 @@ export const getCheckoutCart = (
296
321
  export const addCheckoutCartItem = (
297
322
  payload: CheckoutAddCartItemInput,
298
323
  options: ${clientOptionsName} = {},
299
- ) =>
324
+ ): ${clientEffectTypeName}<CheckoutCart> =>
300
325
  ${createClientName}({
301
326
  ...options,
302
327
  operationContext:
@@ -310,7 +335,7 @@ export const addCheckoutCartItem = (
310
335
  export const removeCheckoutCartItem = (
311
336
  sku: string,
312
337
  options: ${clientOptionsName} = {},
313
- ) =>
338
+ ): ${clientEffectTypeName}<CheckoutCart> =>
314
339
  ${createClientName}({
315
340
  ...options,
316
341
  operationContext:
@@ -323,7 +348,7 @@ export const removeCheckoutCartItem = (
323
348
 
324
349
  export const clearCheckoutCart = (
325
350
  options: ${clientOptionsName} = {},
326
- ) =>
351
+ ): ${clientEffectTypeName}<CheckoutCart> =>
327
352
  ${createClientName}({
328
353
  ...options,
329
354
  operationContext:
@@ -354,12 +379,63 @@ function createEffectSharedApiContract(service) {
354
379
  const apiName = verticalEffectApiName(service);
355
380
  const groupName = verticalEffectGroupName(service);
356
381
  const stem = (0, external_descriptors_cjs_namespaceObject.effectApiStem)(service);
382
+ const pascalStem = (0, external_naming_cjs_namespaceObject.toPascalCase)(stem);
383
+ const markerType = `${pascalStem}Marker`;
384
+ const itemType = `${pascalStem}Item`;
385
+ const readinessType = `${pascalStem}Readiness`;
386
+ const createPayloadType = `${pascalStem}CreatePayload`;
387
+ const createResponseType = `${pascalStem}CreateResponse`;
388
+ const listResponseType = `${pascalStem}ListResponse`;
357
389
  const apiPrefix = (0, external_descriptors_cjs_namespaceObject.effectApiPrefix)(service);
358
390
  const checkoutCartSharedSchemas = createCheckoutCartSharedSchemas(service);
359
391
  const checkoutCartSharedSchemaSection = '' === checkoutCartSharedSchemas ? '' : `${checkoutCartSharedSchemas}\n`;
360
392
  const checkoutCartOperationContexts = createCheckoutCartOperationContexts(service).trimStart();
361
393
  const checkoutCartOperationContextEntries = '' === checkoutCartOperationContexts ? '' : `${checkoutCartOperationContexts}\n`;
362
- return `export const ${markerSchemaExport} = Schema.Struct({
394
+ return `export interface ${markerType} {
395
+ readonly appId: string;
396
+ readonly build: string;
397
+ readonly deployProfile: string;
398
+ readonly packageName: string;
399
+ readonly surface: string;
400
+ readonly version: string;
401
+ }
402
+
403
+ export interface ${itemType} {
404
+ readonly id: string;
405
+ readonly marker: ${markerType};
406
+ readonly title: string;
407
+ }
408
+
409
+ export interface ${readinessType} {
410
+ readonly checks: {
411
+ readonly effectBff: 'ready';
412
+ readonly moduleFederation: 'ready';
413
+ readonly ssr: 'ready';
414
+ readonly translations: 'ready';
415
+ };
416
+ readonly marker: ${markerType};
417
+ readonly status: 'ready';
418
+ readonly versionSkew: 'none';
419
+ }
420
+
421
+ export interface ${createPayloadType} {
422
+ readonly title: string;
423
+ }
424
+
425
+ export interface ${listResponseType} {
426
+ readonly items: readonly ${itemType}[];
427
+ }
428
+
429
+ export interface ${createResponseType} {
430
+ readonly item: ${itemType};
431
+ }
432
+
433
+ export interface ${notFoundErrorExport} {
434
+ readonly _tag: '${notFoundErrorExport}';
435
+ readonly id: string;
436
+ }
437
+
438
+ export const ${markerSchemaExport}: Schema.Codec<${markerType}> = Schema.Struct({
363
439
  appId: Schema.String,
364
440
  build: Schema.String,
365
441
  deployProfile: Schema.String,
@@ -368,13 +444,13 @@ function createEffectSharedApiContract(service) {
368
444
  version: Schema.String,
369
445
  });
370
446
 
371
- export const ${schemaExport} = Schema.Struct({
447
+ export const ${schemaExport}: Schema.Codec<${itemType}> = Schema.Struct({
372
448
  id: Schema.String,
373
449
  marker: ${markerSchemaExport},
374
450
  title: Schema.String,
375
451
  });
376
452
 
377
- export const ${readinessSchemaExport} = Schema.Struct({
453
+ export const ${readinessSchemaExport}: Schema.Codec<${readinessType}> = Schema.Struct({
378
454
  checks: Schema.Struct({
379
455
  effectBff: Schema.Literal('ready'),
380
456
  moduleFederation: Schema.Literal('ready'),
@@ -386,18 +462,13 @@ export const ${readinessSchemaExport} = Schema.Struct({
386
462
  versionSkew: Schema.Literal('none'),
387
463
  });
388
464
 
389
- export const ${createPayloadSchemaExport} = Schema.Struct({
465
+ export const ${createPayloadSchemaExport}: Schema.Codec<${createPayloadType}> = Schema.Struct({
390
466
  title: Schema.String,
391
467
  });
392
468
 
393
- ${checkoutCartSharedSchemaSection}export class ${notFoundErrorExport} extends Schema.TaggedErrorClass<${notFoundErrorExport}>()(
394
- '${notFoundErrorExport}',
395
- {
396
- id: Schema.String,
397
- },
398
- ) {}
399
-
400
- export const ${notFoundSchemaExport} = ${notFoundErrorExport}.pipe(
469
+ ${checkoutCartSharedSchemaSection}export const ${notFoundSchemaExport}: Schema.Codec<${notFoundErrorExport}> = Schema.TaggedStruct('${notFoundErrorExport}', {
470
+ id: Schema.String,
471
+ }).pipe(
401
472
  HttpApiSchema.status(404),
402
473
  );
403
474
 
@@ -501,13 +572,20 @@ function createEffectServiceEntry(service, contractImportPath) {
501
572
  HttpApiBuilder,
502
573
  Layer,
503
574
  } from '@modern-js/plugin-bff/effect-edge';
504
- import { ultramodernApiMarker } from '../../src/ultramodern-build.ts';
575
+ import type {
576
+ EffectBffDefinition,
577
+ EffectBffRuntime,
578
+ EffectRuntimeLayer,
579
+ } from '@modern-js/plugin-bff/effect-edge';
580
+ import { ultramodernApiMarker } from '../../shared/ultramodern-build.ts';
505
581
  import {
506
582
  ${apiExport},
507
583
  ${groupName}OperationContexts,
584
+ } from '${contractImportPath}';
585
+ import type {
508
586
  ${notFoundErrorExport},
587
+ OperationContext,
509
588
  } from '${contractImportPath}';
510
- import type { OperationContext } from '${contractImportPath}';
511
589
 
512
590
  const ${groupName}Items = [
513
591
  {
@@ -568,9 +646,13 @@ const ${groupName}Layer = HttpApiBuilder.group(
568
646
  const matchedItem = ${groupName}Items.find(
569
647
  candidate => candidate.id === params.id,
570
648
  );
649
+ const notFound: ${notFoundErrorExport} = {
650
+ _tag: '${notFoundErrorExport}',
651
+ id: params.id,
652
+ };
571
653
  const result =
572
654
  matchedItem === undefined
573
- ? Effect.fail(new ${notFoundErrorExport}({ id: params.id }))
655
+ ? Effect.fail(notFound)
574
656
  : Effect.succeed(matchedItem);
575
657
 
576
658
  return result.pipe(
@@ -601,12 +683,15 @@ const ${groupName}Layer = HttpApiBuilder.group(
601
683
 
602
684
  const layer = HttpApiBuilder.layer(${apiExport}).pipe(
603
685
  Layer.provide(${groupName}Layer),
604
- );
686
+ ) satisfies EffectRuntimeLayer;
605
687
 
606
- export default defineEffectBff({
688
+ const effectBff: EffectBffDefinition<typeof ${apiExport}, EffectRuntimeLayer> &
689
+ EffectBffRuntime<typeof ${apiExport}, EffectRuntimeLayer> = defineEffectBff({
607
690
  api: ${apiExport},
608
691
  layer,
609
692
  });
693
+
694
+ export default effectBff;
610
695
  `;
611
696
  }
612
697
  function createEffectClient(service, contractImportPath) {
@@ -617,25 +702,71 @@ function createEffectClient(service, contractImportPath) {
617
702
  const singular = verticalEffectErrorStem(service);
618
703
  const clientOptionsName = `${(0, external_naming_cjs_namespaceObject.toPascalCase)(stem)}ClientOptions`;
619
704
  const createClientName = `create${(0, external_naming_cjs_namespaceObject.toPascalCase)(stem)}Client`;
705
+ const clientTypeName = `${(0, external_naming_cjs_namespaceObject.toPascalCase)(stem)}Client`;
706
+ const clientEffectTypeName = `${(0, external_naming_cjs_namespaceObject.toPascalCase)(stem)}ClientEffect`;
620
707
  const listName = `list${(0, external_naming_cjs_namespaceObject.toPascalCase)(stem)}`;
621
708
  const readinessName = `get${(0, external_naming_cjs_namespaceObject.toPascalCase)(stem)}Readiness`;
622
709
  const getName = `get${(0, external_naming_cjs_namespaceObject.toPascalCase)(singular)}`;
623
710
  const createName = `create${(0, external_naming_cjs_namespaceObject.toPascalCase)(singular)}`;
711
+ const notFoundErrorExport = verticalEffectNotFoundErrorExport(service);
712
+ const pascalStem = (0, external_naming_cjs_namespaceObject.toPascalCase)(stem);
713
+ const itemType = `${pascalStem}Item`;
714
+ const readinessType = `${pascalStem}Readiness`;
715
+ const createResponseType = `${pascalStem}CreateResponse`;
716
+ const listResponseType = `${pascalStem}ListResponse`;
624
717
  const checkoutCartClientExports = createCheckoutCartClientExports(service);
625
718
  return `import {
626
719
  Effect,
627
720
  makeEffectHttpApiClient,
628
721
  runEffectRequest,
629
722
  } from '@modern-js/plugin-bff/effect-client';
723
+ import type {
724
+ HttpClientError,
725
+ HttpApi,
726
+ HttpApiClient,
727
+ HttpApiGroup,
728
+ Schema,
729
+ } from '@modern-js/plugin-bff/effect-client';
630
730
  import {
631
731
  ${contractExport}ApiContract,
632
732
  ${apiExport},
633
733
  ${groupName}OperationContexts,
634
734
  } from '${contractImportPath}';
635
- import type { OperationContext } from '${contractImportPath}';
735
+ import type {
736
+ ${createResponseType},
737
+ ${itemType},
738
+ ${listResponseType},
739
+ ${notFoundErrorExport},
740
+ OperationContext,
741
+ ${readinessType},
742
+ } from '${contractImportPath}';
636
743
 
637
744
  export { Effect, runEffectRequest };
638
745
 
746
+ type ${pascalStem}EffectGroups = typeof ${apiExport} extends HttpApi.HttpApi<
747
+ infer _ApiId,
748
+ infer Groups
749
+ >
750
+ ? Groups
751
+ : never;
752
+
753
+ export type ${clientTypeName} = HttpApiClient.Client<
754
+ Extract<${pascalStem}EffectGroups, HttpApiGroup.Any>,
755
+ never,
756
+ never
757
+ >;
758
+
759
+ export type ${pascalStem}ClientError =
760
+ | ${notFoundErrorExport}
761
+ | HttpClientError.HttpClientError
762
+ | Schema.SchemaError;
763
+
764
+ export type ${clientEffectTypeName}<Success> = Effect.Effect<
765
+ Success,
766
+ ${pascalStem}ClientError,
767
+ never
768
+ >;
769
+
639
770
  export interface ${clientOptionsName} {
640
771
  baseUrl?: string | URL;
641
772
  locale?: string;
@@ -645,7 +776,7 @@ export interface ${clientOptionsName} {
645
776
 
646
777
  export const ${createClientName} = (
647
778
  options: ${clientOptionsName} = {},
648
- ) =>
779
+ ): ${clientEffectTypeName}<${clientTypeName}> =>
649
780
  makeEffectHttpApiClient(${apiExport}, {
650
781
  baseUrl: options.baseUrl ?? ${contractExport}ApiContract.apiPrefix,
651
782
  requestContext: {
@@ -661,7 +792,7 @@ export const ${createClientName} = (
661
792
 
662
793
  export const ${listName} = (
663
794
  options: ${clientOptionsName} & { limit?: number } = {},
664
- ) =>
795
+ ): ${clientEffectTypeName}<${listResponseType}> =>
665
796
  ${createClientName}({
666
797
  ...options,
667
798
  operationContext:
@@ -674,7 +805,7 @@ export const ${listName} = (
674
805
 
675
806
  export const ${readinessName} = (
676
807
  options: ${clientOptionsName} = {},
677
- ) =>
808
+ ): ${clientEffectTypeName}<${readinessType}> =>
678
809
  ${createClientName}({
679
810
  ...options,
680
811
  operationContext:
@@ -686,7 +817,7 @@ export const ${readinessName} = (
686
817
  export const ${getName} = (
687
818
  id: string,
688
819
  options: ${clientOptionsName} = {},
689
- ) =>
820
+ ): ${clientEffectTypeName}<${itemType}> =>
690
821
  ${createClientName}({
691
822
  ...options,
692
823
  operationContext:
@@ -698,7 +829,7 @@ export const ${getName} = (
698
829
  export const ${createName} = (
699
830
  title: string,
700
831
  options: ${clientOptionsName} = {},
701
- ) =>
832
+ ): ${clientEffectTypeName}<${createResponseType}> =>
702
833
  ${createClientName}({
703
834
  ...options,
704
835
  operationContext:
@@ -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");
@@ -267,12 +268,12 @@ ${bffPluginEntry} moduleFederationPlugin(),
267
268
  }
268
269
  function createSharedModuleFederationConfig() {
269
270
  return ` shared: {
270
- '@modern-js/plugin-i18n/runtime/no-react-i18next': {
271
+ '@modern-js/plugin-i18n/runtime': {
271
272
  requiredVersion: pluginI18nVersion,
272
273
  singleton: true,
273
274
  treeShaking: false,
274
275
  },
275
- '@modern-js/plugin-i18n/runtime': {
276
+ '@modern-js/plugin-i18n/runtime/no-react-i18next': {
276
277
  requiredVersion: pluginI18nVersion,
277
278
  singleton: true,
278
279
  treeShaking: false,
@@ -392,7 +393,9 @@ const reactVersion = (require('react/package.json') as { version: string }).vers
392
393
  const reactDomVersion = (require('react-dom/package.json') as { version: string }).version;
393
394
 
394
395
  ${createModuleFederationRemoteUrlHelpers(shellHost, remotes)}
395
- export default createModuleFederationConfig({
396
+ const moduleFederationConfig: Parameters<
397
+ typeof createModuleFederationConfig
398
+ >[0] = createModuleFederationConfig({
396
399
  bridge: {
397
400
  enableBridgeRouter: false,
398
401
  },
@@ -410,6 +413,8 @@ export default createModuleFederationConfig({
410
413
  ${createModuleFederationRemotesConfig(scope, shellHost, remotes)}${createSharedModuleFederationConfig()},
411
414
  treeShakingSharedExcludePlugins: ['RspackModuleFederationPlugin'],
412
415
  });
416
+
417
+ export default moduleFederationConfig;
413
418
  `;
414
419
  }
415
420
  function createBuildMarker(scope, app) {
@@ -435,6 +440,14 @@ export const ultramodernApiMarker = {
435
440
  } as const;
436
441
  `;
437
442
  }
443
+ function createUltramodernBuildReexportModule() {
444
+ return `export {
445
+ ultramodernApiMarker,
446
+ ultramodernUiMarker,
447
+ ultramodernVerticalIdentity,
448
+ } from '../shared/ultramodern-build';
449
+ `;
450
+ }
438
451
  function createRemoteModuleFederationConfig(scope, app, remotes = []) {
439
452
  const exposes = formatTsObjectLiteral(app.exposes ?? {});
440
453
  return `// @effect-diagnostics nodeBuiltinImport:off
@@ -450,7 +463,9 @@ const reactVersion = (require('react/package.json') as { version: string }).vers
450
463
  const reactDomVersion = (require('react-dom/package.json') as { version: string }).version;
451
464
 
452
465
  ${createModuleFederationRemoteUrlHelpers(app, remotes)}
453
- export default createModuleFederationConfig({
466
+ const moduleFederationConfig: Parameters<
467
+ typeof createModuleFederationConfig
468
+ >[0] = createModuleFederationConfig({
454
469
  bridge: {
455
470
  enableBridgeRouter: false,
456
471
  },
@@ -469,6 +484,8 @@ export default createModuleFederationConfig({
469
484
  ${createModuleFederationRemotesConfig(scope, app, remotes)}${createSharedModuleFederationConfig()},
470
485
  treeShakingSharedExcludePlugins: ['RspackModuleFederationPlugin'],
471
486
  });
487
+
488
+ export default moduleFederationConfig;
472
489
  `;
473
490
  }
474
491
  exports.createAppModernConfig = __webpack_exports__.createAppModernConfig;
@@ -479,6 +496,7 @@ exports.createRemoteModuleFederationConfig = __webpack_exports__.createRemoteMod
479
496
  exports.createSharedModuleFederationConfig = __webpack_exports__.createSharedModuleFederationConfig;
480
497
  exports.createShellModuleFederationConfig = __webpack_exports__.createShellModuleFederationConfig;
481
498
  exports.createUltramodernBuildModule = __webpack_exports__.createUltramodernBuildModule;
499
+ exports.createUltramodernBuildReexportModule = __webpack_exports__.createUltramodernBuildReexportModule;
482
500
  exports.formatTsObjectLiteral = __webpack_exports__.formatTsObjectLiteral;
483
501
  for(var __rspack_i in __webpack_exports__)if (-1 === [
484
502
  "createAppModernConfig",
@@ -489,6 +507,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
489
507
  "createSharedModuleFederationConfig",
490
508
  "createShellModuleFederationConfig",
491
509
  "createUltramodernBuildModule",
510
+ "createUltramodernBuildReexportModule",
492
511
  "formatTsObjectLiteral"
493
512
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
494
513
  Object.defineProperty(exports, '__esModule', {
@@ -300,6 +300,10 @@ function createTsBuildInfoFile(packageDir) {
300
300
  const cacheKey = packageDir.replace(/[^a-zA-Z0-9._-]+/gu, '__');
301
301
  return `${(0, external_naming_cjs_namespaceObject.relativeRootFor)(packageDir)}/node_modules/.cache/tsgo/${cacheKey}.tsbuildinfo`;
302
302
  }
303
+ function createTsDeclarationOutDir(packageDir) {
304
+ const cacheKey = packageDir.replace(/[^a-zA-Z0-9._-]+/gu, '__');
305
+ return `${(0, external_naming_cjs_namespaceObject.relativeRootFor)(packageDir)}/node_modules/.cache/tsgo/declarations/${cacheKey}`;
306
+ }
303
307
  function createReferences(packageDir, references) {
304
308
  return [
305
309
  ...new Set(references)
@@ -313,16 +317,24 @@ function createPackageTsConfig(packageDir, options = {}) {
313
317
  } : options;
314
318
  const include = resolvedOptions.include ?? [
315
319
  'src',
320
+ 'locales/**/*.json',
316
321
  'modern.config.ts',
317
- 'module-federation.config.ts'
322
+ 'module-federation.config.ts',
323
+ 'package.json',
324
+ 'shared'
318
325
  ];
319
- if (resolvedOptions.includeApi) include.push('api', 'shared');
326
+ if (resolvedOptions.includeApi) include.push('api');
320
327
  const references = createReferences(packageDir, resolvedOptions.references ?? []);
321
328
  const tsconfig = {
322
329
  extends: `${(0, external_naming_cjs_namespaceObject.relativeRootFor)(packageDir)}/tsconfig.base.json`,
323
330
  compilerOptions: {
324
331
  composite: true,
332
+ declaration: true,
333
+ declarationMap: false,
334
+ emitDeclarationOnly: true,
325
335
  incremental: true,
336
+ noEmit: false,
337
+ outDir: createTsDeclarationOutDir(packageDir),
326
338
  tsBuildInfoFile: createTsBuildInfoFile(packageDir)
327
339
  },
328
340
  include
@@ -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.createUltramodernBuildModule)(scope, resolvedApp));
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
- entry: typeof window === 'undefined' ? undefined : window.location.href,
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',
@@ -110,7 +112,7 @@ const createRemoteFallback = (specifier: string) =>
110
112
  remote: specifier,
111
113
  status: 'degraded',
112
114
  });
113
- }, [classification, error, specifier, telemetry]);
115
+ }, [classification, error, telemetry]);
114
116
 
115
117
  return <div className="${tw('rounded-xl border border-red-900/20 bg-red-50 px-4 py-3 text-sm font-semibold text-red-900')}" data-remote-error={error.name} {...toModuleFederationFallbackAttributes(telemetry)}>{t('shell.remoteUnavailable')}</div>;
116
118
  };