@open-mercato/cli 0.6.1-develop.3187.1.4c96d17341 → 0.6.1-develop.3191.1.2511ae315f

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.
@@ -38,6 +38,7 @@ import {
38
38
  propertyAccess,
39
39
  spreadExpression,
40
40
  variableStatement,
41
+ writeArrayLiteral,
41
42
  writeValue,
42
43
  writeStatements
43
44
  } from "./ast/index.js";
@@ -1514,6 +1515,32 @@ function renderAstLegacyAliasFile(options) {
1514
1515
  });
1515
1516
  return getSourceText(sourceFile);
1516
1517
  }
1518
+ function renderEnabledModuleIdsFile(moduleIds) {
1519
+ const sourceFile = createGeneratedSourceFile("enabled-module-ids.generated.ts");
1520
+ addAutoGeneratedComment(sourceFile, "registry (enabled-module-ids version)");
1521
+ sourceFile.addVariableStatement({
1522
+ declarationKind: VariableDeclarationKind.Const,
1523
+ isExported: true,
1524
+ leadingTrivia: (writer) => {
1525
+ writer.newLine();
1526
+ writer.writeLine("// This file lists every enabled module ID without importing module runtime");
1527
+ writer.writeLine("// surfaces. It is safe to import from client bundles (no node:* dependencies).");
1528
+ },
1529
+ declarations: [
1530
+ {
1531
+ name: "enabledModuleIds",
1532
+ type: "readonly string[]",
1533
+ initializer: (writer) => {
1534
+ writeArrayLiteral(writer, moduleIds, (w, id) => {
1535
+ w.write(JSON.stringify(id));
1536
+ });
1537
+ writer.write(" as const");
1538
+ }
1539
+ }
1540
+ ]
1541
+ });
1542
+ return getSourceText(sourceFile);
1543
+ }
1517
1544
  function renderLegacyCompatibleArray(entries) {
1518
1545
  return `[
1519
1546
  ${entries.join(",\n ")}
@@ -2445,6 +2472,8 @@ async function generateModuleRegistryApp(options) {
2445
2472
  const checksumFile = path.join(outputDir, "modules.app.generated.checksum");
2446
2473
  const legacyOutFile = path.join(outputDir, "bootstrap-modules.generated.ts");
2447
2474
  const legacyChecksumFile = path.join(outputDir, "bootstrap-modules.generated.checksum");
2475
+ const enabledIdsOutFile = path.join(outputDir, "enabled-module-ids.generated.ts");
2476
+ const enabledIdsChecksumFile = path.join(outputDir, "enabled-module-ids.generated.checksum");
2448
2477
  const enabled = resolver.loadEnabledModules();
2449
2478
  const imports = [];
2450
2479
  const moduleDecls = [];
@@ -2725,6 +2754,8 @@ async function generateModuleRegistryApp(options) {
2725
2754
  const structureChecksum = calculateStructureChecksum(Array.from(trackedRoots));
2726
2755
  writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet });
2727
2756
  writeGeneratedFile({ outFile: legacyOutFile, checksumFile: legacyChecksumFile, content: legacyOutput, structureChecksum, result, quiet });
2757
+ const enabledIdsOutput = renderEnabledModuleIdsFile(enabled.map((entry) => entry.id));
2758
+ writeGeneratedFile({ outFile: enabledIdsOutFile, checksumFile: enabledIdsChecksumFile, content: enabledIdsOutput, structureChecksum, result, quiet });
2728
2759
  return result;
2729
2760
  }
2730
2761
  async function generateModuleRegistryCli(options) {