@open-mercato/cli 0.11.1-develop.8587.1.5952ba9ee6 → 0.11.1-develop.8593.1.50784dae35
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/.turbo/turbo-build.log +1 -1
- package/AGENTS.md +1 -0
- package/dist/agentic/guides/module-facts.json +164 -164
- package/dist/agentic/guides/module-facts.v2.json +164 -164
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/backups/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
- package/dist/agentic/guides/modules/cart/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/index.md +1 -1
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/index.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customers/index.md +1 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/index.md +1 -1
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
- package/dist/agentic/guides/modules/entities/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
- package/dist/agentic/guides/modules/integrations/index.md +1 -1
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/index.md +1 -1
- package/dist/agentic/guides/modules/promotions/index.md +1 -1
- package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/sales/index.md +1 -1
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/security/index.md +1 -1
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/index.md +1 -1
- package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
- package/dist/agentic/guides/modules/telemetry/index.md +1 -1
- package/dist/agentic/guides/modules/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/reference-module-facts.json +1 -1
- package/dist/agentic/guides/upstream/manifest.json +1 -1
- package/dist/lib/generate-child-process.js +21 -3
- package/dist/lib/generate-child-process.js.map +2 -2
- package/dist/lib/generate-watch-events.js +135 -19
- package/dist/lib/generate-watch-events.js.map +2 -2
- package/dist/lib/generate-watch-plan.js +166 -0
- package/dist/lib/generate-watch-plan.js.map +7 -0
- package/dist/lib/generate-watch-runner.js +53 -0
- package/dist/lib/generate-watch-runner.js.map +7 -0
- package/dist/lib/generate-watch-structure.js +576 -203
- package/dist/lib/generate-watch-structure.js.map +3 -3
- package/dist/lib/generators/extensions/agent-files.js +1 -0
- package/dist/lib/generators/extensions/agent-files.js.map +2 -2
- package/dist/lib/generators/module-registry.js +148 -191
- package/dist/lib/generators/module-registry.js.map +3 -3
- package/dist/lib/generators/openapi.js +24 -1
- package/dist/lib/generators/openapi.js.map +2 -2
- package/dist/lib/generators/web-research-adapters.js +54 -22
- package/dist/lib/generators/web-research-adapters.js.map +2 -2
- package/dist/lib/in-process-generate-watcher.js +98 -75
- package/dist/lib/in-process-generate-watcher.js.map +2 -2
- package/dist/mercato.js +74 -46
- package/dist/mercato.js.map +2 -2
- package/package.json +7 -7
- package/src/lib/__tests__/generate-child-process.test.ts +30 -0
- package/src/lib/__tests__/generate-watch-events.test.ts +377 -8
- package/src/lib/__tests__/generate-watch-plan.test.ts +98 -0
- package/src/lib/__tests__/generate-watch-runner.test.ts +126 -0
- package/src/lib/__tests__/generate-watch-structure.test.ts +522 -1
- package/src/lib/__tests__/in-process-generate-watcher.test.ts +393 -6
- package/src/lib/__tests__/module-inspection.test.ts +17 -11
- package/src/lib/generate-child-process.ts +26 -3
- package/src/lib/generate-watch-events.ts +189 -17
- package/src/lib/generate-watch-plan.ts +177 -0
- package/src/lib/generate-watch-runner.ts +62 -0
- package/src/lib/generate-watch-structure.ts +666 -227
- package/src/lib/generators/__tests__/incremental-registry.test.ts +262 -0
- package/src/lib/generators/__tests__/openapi.test.ts +91 -1
- package/src/lib/generators/__tests__/web-research-adapters.test.ts +298 -87
- package/src/lib/generators/extension.ts +2 -0
- package/src/lib/generators/extensions/agent-files.ts +1 -0
- package/src/lib/generators/module-registry.ts +168 -200
- package/src/lib/generators/openapi.ts +34 -0
- package/src/lib/generators/web-research-adapters.ts +76 -21
- package/src/lib/in-process-generate-watcher.ts +151 -96
- package/src/mercato.ts +85 -53
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
DEV_SUPERVISOR_MANIFEST_VERSION
|
|
12
12
|
} from "../dev-supervisor-manifest.js";
|
|
13
13
|
import {
|
|
14
|
+
calculateChecksum,
|
|
14
15
|
calculateStructureChecksum,
|
|
15
16
|
toVar,
|
|
16
17
|
moduleHasExport,
|
|
@@ -2748,14 +2749,16 @@ ${cases ? `${cases}
|
|
|
2748
2749
|
}
|
|
2749
2750
|
`;
|
|
2750
2751
|
}
|
|
2751
|
-
function removeStaleI18nLocaleShards(outputDir, expectedFileNames) {
|
|
2752
|
+
function removeStaleI18nLocaleShards(outputDir, expectedFileNames, result) {
|
|
2752
2753
|
if (!fs.existsSync(outputDir)) return;
|
|
2753
2754
|
for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {
|
|
2754
2755
|
if (!entry.isFile()) continue;
|
|
2755
2756
|
if (!/^modules\.i18n\..+\.generated\.(?:ts|checksum)$/.test(entry.name)) continue;
|
|
2756
2757
|
if (entry.name.startsWith("modules.i18n.loaders.generated.")) continue;
|
|
2757
2758
|
if (expectedFileNames.has(entry.name)) continue;
|
|
2758
|
-
|
|
2759
|
+
const stalePath = path.join(outputDir, entry.name);
|
|
2760
|
+
fs.unlinkSync(stalePath);
|
|
2761
|
+
result.filesWritten.push(stalePath);
|
|
2759
2762
|
}
|
|
2760
2763
|
}
|
|
2761
2764
|
function resolveConventionFile(resolved, prefix, modId, importIdRef, imports, extraImports, importStyle = "namespace") {
|
|
@@ -2771,27 +2774,35 @@ function resolveConventionFile(resolved, prefix, modId, importIdRef, imports, ex
|
|
|
2771
2774
|
}
|
|
2772
2775
|
return { importName, importPath, fromApp: resolved.fromApp };
|
|
2773
2776
|
}
|
|
2777
|
+
function selectsRegistryOutput(options, group) {
|
|
2778
|
+
return options.outputGroups === void 0 || options.outputGroups.includes(group);
|
|
2779
|
+
}
|
|
2780
|
+
function createRegistryOutputWriter(options, result) {
|
|
2781
|
+
const outputDir = options.resolver.getOutputDir();
|
|
2782
|
+
return (group, fileName, render) => {
|
|
2783
|
+
if (!selectsRegistryOutput(options, group)) return;
|
|
2784
|
+
const content = render();
|
|
2785
|
+
writeGeneratedFile({
|
|
2786
|
+
outFile: path.join(outputDir, fileName),
|
|
2787
|
+
checksumFile: path.join(outputDir, fileName.replace(/\.(ts|json)$/, ".checksum")),
|
|
2788
|
+
content,
|
|
2789
|
+
// Incremental output identity must not depend on unrelated module-root mtimes.
|
|
2790
|
+
// Keep the historical checksum format and value on the default full path.
|
|
2791
|
+
structureChecksum: options.outputGroups === void 0 ? options.discovery.getStructureChecksum() : calculateChecksum(content),
|
|
2792
|
+
result,
|
|
2793
|
+
quiet: options.quiet
|
|
2794
|
+
});
|
|
2795
|
+
};
|
|
2796
|
+
}
|
|
2774
2797
|
async function generateModuleRegistryFromDiscovery(options) {
|
|
2775
2798
|
const { resolver, quiet = false } = options;
|
|
2776
2799
|
const { discovery } = options;
|
|
2777
2800
|
const result = createGeneratorResult();
|
|
2801
|
+
if (options.outputGroups !== void 0 && !options.outputGroups.some(
|
|
2802
|
+
(group) => ["main", "runtime", "frontend-routes", "backend-routes", "api-routes", "commands", "plugins", "bootstrap-registrations"].includes(group) || group.startsWith("registry.")
|
|
2803
|
+
)) return result;
|
|
2804
|
+
const writeOutput = createRegistryOutputWriter(options, result);
|
|
2778
2805
|
const outputDir = resolver.getOutputDir();
|
|
2779
|
-
const outFile = path.join(outputDir, "modules.generated.ts");
|
|
2780
|
-
const checksumFile = path.join(outputDir, "modules.generated.checksum");
|
|
2781
|
-
const runtimeOutFile = path.join(outputDir, "modules.runtime.generated.ts");
|
|
2782
|
-
const runtimeChecksumFile = path.join(outputDir, "modules.runtime.generated.checksum");
|
|
2783
|
-
const frontendRoutesOutFile = path.join(outputDir, "frontend-routes.generated.ts");
|
|
2784
|
-
const frontendRoutesChecksumFile = path.join(outputDir, "frontend-routes.generated.checksum");
|
|
2785
|
-
const backendRoutesOutFile = path.join(outputDir, "backend-routes.generated.ts");
|
|
2786
|
-
const backendRoutesChecksumFile = path.join(outputDir, "backend-routes.generated.checksum");
|
|
2787
|
-
const apiRoutesOutFile = path.join(outputDir, "api-routes.generated.ts");
|
|
2788
|
-
const apiRoutesChecksumFile = path.join(outputDir, "api-routes.generated.checksum");
|
|
2789
|
-
const bootstrapRegsOutFile = path.join(outputDir, "bootstrap-registrations.generated.ts");
|
|
2790
|
-
const bootstrapRegsChecksumFile = path.join(outputDir, "bootstrap-registrations.generated.checksum");
|
|
2791
|
-
const legacySubscribersOutFile = path.join(outputDir, "subscribers.generated.ts");
|
|
2792
|
-
const legacySubscribersChecksumFile = path.join(outputDir, "subscribers.generated.checksum");
|
|
2793
|
-
const commandLoadersOutFile = path.join(outputDir, "command-loaders.generated.ts");
|
|
2794
|
-
const commandLoadersChecksumFile = path.join(outputDir, "command-loaders.generated.checksum");
|
|
2795
2806
|
const enabled = discovery.enabled;
|
|
2796
2807
|
const extensions = loadGeneratorExtensions(resolver);
|
|
2797
2808
|
const pluginRegistry = /* @__PURE__ */ new Map();
|
|
@@ -2921,6 +2932,7 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2921
2932
|
sanitizeGeneratedModuleSpecifier
|
|
2922
2933
|
};
|
|
2923
2934
|
for (const extension of extensions) {
|
|
2935
|
+
if (extension.usesSharedImportIds === false && !selectsRegistryOutput(options, extension.id)) continue;
|
|
2924
2936
|
extension.scanModule(extensionContext);
|
|
2925
2937
|
}
|
|
2926
2938
|
{
|
|
@@ -3281,49 +3293,68 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
3281
3293
|
);
|
|
3282
3294
|
}
|
|
3283
3295
|
}
|
|
3284
|
-
|
|
3296
|
+
exitOnMissingModuleRequires(discovery.identities, requiresByModule);
|
|
3297
|
+
writeOutput("main", "modules.generated.ts", () => renderAstModuleRegistryFile({
|
|
3285
3298
|
fileName: "modules.generated.ts",
|
|
3286
3299
|
generator: "registry",
|
|
3287
3300
|
imports,
|
|
3288
3301
|
moduleEntries: moduleDecls,
|
|
3289
3302
|
includeCreateElementImport: hasRouteComponents,
|
|
3290
3303
|
includeAbandonHookImport: hasAbandonHookWorkers
|
|
3291
|
-
});
|
|
3292
|
-
|
|
3304
|
+
}));
|
|
3305
|
+
writeOutput("runtime", "modules.runtime.generated.ts", () => renderAstModuleRegistryFile({
|
|
3293
3306
|
fileName: "modules.runtime.generated.ts",
|
|
3294
3307
|
generator: "registry",
|
|
3295
3308
|
imports: runtimeImports,
|
|
3296
3309
|
moduleEntries: runtimeModuleDecls,
|
|
3297
3310
|
includeCreateElementImport: true,
|
|
3298
3311
|
includeAbandonHookImport: hasAbandonHookWorkers
|
|
3299
|
-
});
|
|
3300
|
-
|
|
3312
|
+
}));
|
|
3313
|
+
writeOutput("frontend-routes", "frontend-routes.generated.ts", () => renderAstManifestFile({
|
|
3301
3314
|
fileName: "frontend-routes.generated.ts",
|
|
3302
3315
|
typeName: "FrontendRouteManifestEntry",
|
|
3303
3316
|
exportName: "frontendRoutes",
|
|
3304
3317
|
imports: frontendRouteManifestImports,
|
|
3305
3318
|
entries: frontendRouteManifestDecls
|
|
3306
|
-
});
|
|
3307
|
-
|
|
3319
|
+
}));
|
|
3320
|
+
writeOutput("backend-routes", "backend-routes.generated.ts", () => renderAstManifestFile({
|
|
3308
3321
|
fileName: "backend-routes.generated.ts",
|
|
3309
3322
|
typeName: "BackendRouteManifestEntry",
|
|
3310
3323
|
exportName: "backendRoutes",
|
|
3311
3324
|
imports: backendRouteManifestImports,
|
|
3312
3325
|
entries: backendRouteManifestDecls
|
|
3313
|
-
});
|
|
3314
|
-
|
|
3326
|
+
}));
|
|
3327
|
+
writeOutput("api-routes", "api-routes.generated.ts", () => renderAstManifestFile({
|
|
3315
3328
|
fileName: "api-routes.generated.ts",
|
|
3316
3329
|
typeName: "ApiRouteManifestEntry",
|
|
3317
3330
|
exportName: "apiRoutes",
|
|
3318
3331
|
entries: apiRouteManifestDecls
|
|
3319
|
-
});
|
|
3320
|
-
const
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3332
|
+
}));
|
|
3333
|
+
for (const kind of ["backend", "api"]) {
|
|
3334
|
+
const group = `${kind}-routes`;
|
|
3335
|
+
if (!selectsRegistryOutput(options, group)) continue;
|
|
3336
|
+
const routeManifestOutputs = [
|
|
3337
|
+
...renderRouteManifestShardOutputs(kind, kind === "backend" ? backendRouteShardEntries : apiRouteShardEntries),
|
|
3338
|
+
renderRouteMetadataOutput(kind, kind === "backend" ? backendRouteMetadataEntries : apiRouteMetadataEntries)
|
|
3339
|
+
];
|
|
3340
|
+
const expectedRouteManifestFiles = new Set(routeManifestOutputs.flatMap(({ fileName }) => [
|
|
3341
|
+
fileName,
|
|
3342
|
+
fileName.replace(/\.ts$/, ".checksum")
|
|
3343
|
+
]));
|
|
3344
|
+
if (fs.existsSync(outputDir)) {
|
|
3345
|
+
for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {
|
|
3346
|
+
if (!entry.isFile() || !entry.name.startsWith(`${kind}-route-shard.`) || !routeManifestShardFilePattern.test(entry.name)) continue;
|
|
3347
|
+
if (expectedRouteManifestFiles.has(entry.name)) continue;
|
|
3348
|
+
const stalePath = path.join(outputDir, entry.name);
|
|
3349
|
+
fs.unlinkSync(stalePath);
|
|
3350
|
+
result.filesWritten.push(stalePath);
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
3353
|
+
for (const routeOutput of routeManifestOutputs) {
|
|
3354
|
+
writeOutput(group, routeOutput.fileName, () => routeOutput.content);
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
writeOutput("runtime", "subscribers.generated.ts", () => renderAstLegacyAliasFile({
|
|
3327
3358
|
fileName: "subscribers.generated.ts",
|
|
3328
3359
|
exportName: "moduleSubscribers",
|
|
3329
3360
|
exportType: "NonNullable<Module['subscribers']>",
|
|
@@ -3339,68 +3370,32 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
3339
3370
|
)
|
|
3340
3371
|
})
|
|
3341
3372
|
])
|
|
3342
|
-
});
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet });
|
|
3346
|
-
writeGeneratedFile({ outFile: runtimeOutFile, checksumFile: runtimeChecksumFile, content: runtimeOutput, structureChecksum, result, quiet });
|
|
3347
|
-
writeGeneratedFile({ outFile: frontendRoutesOutFile, checksumFile: frontendRoutesChecksumFile, content: frontendRoutesOutput, structureChecksum, result, quiet });
|
|
3348
|
-
writeGeneratedFile({ outFile: backendRoutesOutFile, checksumFile: backendRoutesChecksumFile, content: backendRoutesOutput, structureChecksum, result, quiet });
|
|
3349
|
-
writeGeneratedFile({ outFile: apiRoutesOutFile, checksumFile: apiRoutesChecksumFile, content: apiRoutesOutput, structureChecksum, result, quiet });
|
|
3350
|
-
const expectedRouteManifestFiles = new Set(routeManifestOutputs.flatMap(({ fileName }) => [
|
|
3351
|
-
fileName,
|
|
3352
|
-
fileName.replace(/\.ts$/, ".checksum")
|
|
3353
|
-
]));
|
|
3354
|
-
if (fs.existsSync(outputDir)) {
|
|
3355
|
-
for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {
|
|
3356
|
-
if (!entry.isFile() || !routeManifestShardFilePattern.test(entry.name)) continue;
|
|
3357
|
-
if (expectedRouteManifestFiles.has(entry.name)) continue;
|
|
3358
|
-
const stalePath = path.join(outputDir, entry.name);
|
|
3359
|
-
fs.unlinkSync(stalePath);
|
|
3360
|
-
result.filesWritten.push(stalePath);
|
|
3361
|
-
}
|
|
3362
|
-
}
|
|
3363
|
-
for (const routeOutput of routeManifestOutputs) {
|
|
3364
|
-
writeGeneratedFile({
|
|
3365
|
-
outFile: path.join(outputDir, routeOutput.fileName),
|
|
3366
|
-
checksumFile: path.join(outputDir, routeOutput.fileName.replace(/\.ts$/, ".checksum")),
|
|
3367
|
-
content: routeOutput.content,
|
|
3368
|
-
structureChecksum,
|
|
3369
|
-
result,
|
|
3370
|
-
quiet
|
|
3371
|
-
});
|
|
3373
|
+
}));
|
|
3374
|
+
if (!options.skipCommands) {
|
|
3375
|
+
writeOutput("commands", "command-loaders.generated.ts", () => renderCommandLoadersFile(commandLoaderEntries));
|
|
3372
3376
|
}
|
|
3373
|
-
writeGeneratedFile({ outFile: legacySubscribersOutFile, checksumFile: legacySubscribersChecksumFile, content: legacySubscribersOutput, structureChecksum, result, quiet });
|
|
3374
|
-
const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries);
|
|
3375
|
-
writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet });
|
|
3376
3377
|
for (const extension of extensions) {
|
|
3378
|
+
if (!selectsRegistryOutput(options, extension.id)) continue;
|
|
3377
3379
|
const outputs = extension.generateOutput();
|
|
3378
3380
|
for (const [fileName, content] of outputs) {
|
|
3379
|
-
|
|
3380
|
-
outFile: path.join(outputDir, fileName),
|
|
3381
|
-
checksumFile: path.join(outputDir, fileName.replace(".ts", ".checksum")),
|
|
3382
|
-
content,
|
|
3383
|
-
structureChecksum,
|
|
3384
|
-
result,
|
|
3385
|
-
quiet
|
|
3386
|
-
});
|
|
3381
|
+
writeOutput(extension.id, fileName, () => content);
|
|
3387
3382
|
}
|
|
3388
3383
|
}
|
|
3389
|
-
|
|
3390
|
-
const
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3384
|
+
if (selectsRegistryOutput(options, "plugins")) {
|
|
3385
|
+
for (const [pluginId, plugin] of pluginRegistry) {
|
|
3386
|
+
const state = pluginState.get(pluginId);
|
|
3387
|
+
writeOutput("plugins", pluginOutputNames.get(pluginId), () => plugin.buildOutput({
|
|
3388
|
+
importSection: state.imports.join("\n"),
|
|
3389
|
+
entriesLiteral: state.configs.join(",\n ")
|
|
3390
|
+
}));
|
|
3391
|
+
}
|
|
3392
|
+
reconcileGeneratorPluginOutputs({
|
|
3393
|
+
outputDir,
|
|
3394
|
+
outputNames: pluginOutputNames.values(),
|
|
3395
|
+
result
|
|
3396
|
+
});
|
|
3397
3397
|
}
|
|
3398
|
-
|
|
3399
|
-
outputDir,
|
|
3400
|
-
outputNames: pluginOutputNames.values(),
|
|
3401
|
-
result
|
|
3402
|
-
});
|
|
3403
|
-
{
|
|
3398
|
+
if (selectsRegistryOutput(options, "bootstrap-registrations")) {
|
|
3404
3399
|
const bootstrapPlugins = [...pluginRegistry.values()].filter((p) => p.bootstrapRegistration);
|
|
3405
3400
|
const allEntryImports = [
|
|
3406
3401
|
buildImportStatement(`{ backendRouteFacades }`, `./backend-route-shards.generated`),
|
|
@@ -3420,12 +3415,11 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
3420
3415
|
allRegImports.push(...reg.registrationImports);
|
|
3421
3416
|
allCalls.push(reg.buildCall(reg.entriesExportName));
|
|
3422
3417
|
}
|
|
3423
|
-
|
|
3418
|
+
writeOutput("bootstrap-registrations", "bootstrap-registrations.generated.ts", () => renderBootstrapRegistrationsFile({
|
|
3424
3419
|
entryImports: allEntryImports,
|
|
3425
3420
|
registrationImports: allRegImports,
|
|
3426
3421
|
calls: allCalls
|
|
3427
|
-
});
|
|
3428
|
-
writeGeneratedFile({ outFile: bootstrapRegsOutFile, checksumFile: bootstrapRegsChecksumFile, content: bootstrapRegsOutput, structureChecksum, result, quiet });
|
|
3422
|
+
}));
|
|
3429
3423
|
}
|
|
3430
3424
|
return result;
|
|
3431
3425
|
}
|
|
@@ -3433,21 +3427,11 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
3433
3427
|
const { resolver, quiet = false } = options;
|
|
3434
3428
|
const { discovery } = options;
|
|
3435
3429
|
const result = createGeneratorResult();
|
|
3430
|
+
if (options.outputGroups !== void 0 && !options.outputGroups.some(
|
|
3431
|
+
(group) => ["app", "bootstrap", "i18n", "enabled-ids"].includes(group) || group === "commands" && !options.skipCommands
|
|
3432
|
+
)) return result;
|
|
3433
|
+
const writeOutput = createRegistryOutputWriter(options, result);
|
|
3436
3434
|
const outputDir = resolver.getOutputDir();
|
|
3437
|
-
const outFile = path.join(outputDir, "modules.app.generated.ts");
|
|
3438
|
-
const checksumFile = path.join(outputDir, "modules.app.generated.checksum");
|
|
3439
|
-
const bootstrapOutFile = path.join(outputDir, "modules.bootstrap.generated.ts");
|
|
3440
|
-
const bootstrapChecksumFile = path.join(outputDir, "modules.bootstrap.generated.checksum");
|
|
3441
|
-
const i18nOutFile = path.join(outputDir, "modules.i18n.generated.ts");
|
|
3442
|
-
const i18nChecksumFile = path.join(outputDir, "modules.i18n.generated.checksum");
|
|
3443
|
-
const i18nLoadersOutFile = path.join(outputDir, "modules.i18n.loaders.generated.ts");
|
|
3444
|
-
const i18nLoadersChecksumFile = path.join(outputDir, "modules.i18n.loaders.generated.checksum");
|
|
3445
|
-
const legacyOutFile = path.join(outputDir, "bootstrap-modules.generated.ts");
|
|
3446
|
-
const legacyChecksumFile = path.join(outputDir, "bootstrap-modules.generated.checksum");
|
|
3447
|
-
const enabledIdsOutFile = path.join(outputDir, "enabled-module-ids.generated.ts");
|
|
3448
|
-
const enabledIdsChecksumFile = path.join(outputDir, "enabled-module-ids.generated.checksum");
|
|
3449
|
-
const commandLoadersOutFile = path.join(outputDir, "command-loaders.generated.ts");
|
|
3450
|
-
const commandLoadersChecksumFile = path.join(outputDir, "command-loaders.generated.checksum");
|
|
3451
3435
|
const enabled = discovery.enabled;
|
|
3452
3436
|
const imports = [];
|
|
3453
3437
|
const bootstrapImports = [];
|
|
@@ -3732,80 +3716,62 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
3732
3716
|
)));
|
|
3733
3717
|
i18nModuleDecls.push(objectLiteral(i18nModuleEntries));
|
|
3734
3718
|
}
|
|
3735
|
-
|
|
3719
|
+
exitOnMissingModuleRequires(discovery.identities, requiresByModule);
|
|
3720
|
+
writeOutput("app", "modules.app.generated.ts", () => renderAstModuleRegistryFile({
|
|
3736
3721
|
fileName: "modules.app.generated.ts",
|
|
3737
3722
|
generator: "registry (app version)",
|
|
3738
3723
|
imports,
|
|
3739
3724
|
moduleEntries: moduleDecls,
|
|
3740
3725
|
includeCreateElementImport: hasRouteComponents,
|
|
3741
3726
|
includeAbandonHookImport: hasAbandonHookWorkers
|
|
3742
|
-
});
|
|
3743
|
-
|
|
3727
|
+
}));
|
|
3728
|
+
writeOutput("bootstrap", "modules.bootstrap.generated.ts", () => renderAstModuleRegistryFile({
|
|
3744
3729
|
fileName: "modules.bootstrap.generated.ts",
|
|
3745
3730
|
generator: "registry (bootstrap version)",
|
|
3746
3731
|
imports: bootstrapImports,
|
|
3747
3732
|
moduleEntries: bootstrapModuleDecls,
|
|
3748
3733
|
includeAbandonHookImport: hasAbandonHookWorkers
|
|
3749
|
-
});
|
|
3750
|
-
|
|
3734
|
+
}));
|
|
3735
|
+
writeOutput("i18n", "modules.i18n.generated.ts", () => renderAstModuleRegistryFile({
|
|
3751
3736
|
fileName: "modules.i18n.generated.ts",
|
|
3752
3737
|
generator: "registry (i18n version)",
|
|
3753
3738
|
imports: i18nImports,
|
|
3754
3739
|
moduleEntries: i18nModuleDecls,
|
|
3755
3740
|
includeAbandonHookImport: hasAbandonHookWorkers
|
|
3756
|
-
});
|
|
3757
|
-
|
|
3741
|
+
}));
|
|
3742
|
+
if (selectsRegistryOutput(options, "i18n")) {
|
|
3743
|
+
const i18nLocales = [...i18nLocaleShards.keys()].sort((a, b) => a.localeCompare(b));
|
|
3744
|
+
const shardFileNames = /* @__PURE__ */ new Set();
|
|
3745
|
+
const expectedShardArtifacts = /* @__PURE__ */ new Set();
|
|
3746
|
+
for (const locale of i18nLocales) {
|
|
3747
|
+
const fileName = buildI18nLocaleShardFileName(locale);
|
|
3748
|
+
if (shardFileNames.has(fileName)) {
|
|
3749
|
+
throw new Error(`Locale names produce the same generated i18n shard file: ${locale}`);
|
|
3750
|
+
}
|
|
3751
|
+
shardFileNames.add(fileName);
|
|
3752
|
+
expectedShardArtifacts.add(fileName);
|
|
3753
|
+
expectedShardArtifacts.add(fileName.replace(/\.ts$/, ".checksum"));
|
|
3754
|
+
const shard = i18nLocaleShards.get(locale);
|
|
3755
|
+
writeOutput("i18n", fileName, () => renderAstI18nLocaleRegistryFile({
|
|
3756
|
+
fileName,
|
|
3757
|
+
imports: shard.imports,
|
|
3758
|
+
moduleEntries: shard.moduleDecls
|
|
3759
|
+
}));
|
|
3760
|
+
}
|
|
3761
|
+
removeStaleI18nLocaleShards(outputDir, expectedShardArtifacts, result);
|
|
3762
|
+
writeOutput("i18n", "modules.i18n.loaders.generated.ts", () => renderI18nLocaleLoadersFile(i18nLocales));
|
|
3763
|
+
}
|
|
3764
|
+
writeOutput("bootstrap", "bootstrap-modules.generated.ts", () => renderAstLegacyAliasFile({
|
|
3758
3765
|
fileName: "bootstrap-modules.generated.ts",
|
|
3759
3766
|
exportName: "bootstrapModules",
|
|
3760
3767
|
exportType: "Module[]",
|
|
3761
3768
|
sourceFileName: "modules.bootstrap.generated.ts",
|
|
3762
3769
|
initializer: identifier("modules")
|
|
3763
|
-
});
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
writeGeneratedFile({ outFile: bootstrapOutFile, checksumFile: bootstrapChecksumFile, content: bootstrapOutput, structureChecksum, result, quiet });
|
|
3768
|
-
writeGeneratedFile({ outFile: i18nOutFile, checksumFile: i18nChecksumFile, content: i18nOutput, structureChecksum, result, quiet });
|
|
3769
|
-
const i18nLocales = [...i18nLocaleShards.keys()].sort((a, b) => a.localeCompare(b));
|
|
3770
|
-
const shardFileNames = /* @__PURE__ */ new Set();
|
|
3771
|
-
const expectedShardArtifacts = /* @__PURE__ */ new Set();
|
|
3772
|
-
for (const locale of i18nLocales) {
|
|
3773
|
-
const fileName = buildI18nLocaleShardFileName(locale);
|
|
3774
|
-
if (shardFileNames.has(fileName)) {
|
|
3775
|
-
throw new Error(`Locale names produce the same generated i18n shard file: ${locale}`);
|
|
3776
|
-
}
|
|
3777
|
-
shardFileNames.add(fileName);
|
|
3778
|
-
expectedShardArtifacts.add(fileName);
|
|
3779
|
-
expectedShardArtifacts.add(fileName.replace(/\.ts$/, ".checksum"));
|
|
3780
|
-
const shard = i18nLocaleShards.get(locale);
|
|
3781
|
-
const content = renderAstI18nLocaleRegistryFile({
|
|
3782
|
-
fileName,
|
|
3783
|
-
imports: shard.imports,
|
|
3784
|
-
moduleEntries: shard.moduleDecls
|
|
3785
|
-
});
|
|
3786
|
-
writeGeneratedFile({
|
|
3787
|
-
outFile: path.join(outputDir, fileName),
|
|
3788
|
-
checksumFile: path.join(outputDir, fileName.replace(/\.ts$/, ".checksum")),
|
|
3789
|
-
content,
|
|
3790
|
-
structureChecksum,
|
|
3791
|
-
result,
|
|
3792
|
-
quiet
|
|
3793
|
-
});
|
|
3770
|
+
}));
|
|
3771
|
+
writeOutput("enabled-ids", "enabled-module-ids.generated.ts", () => renderEnabledModuleIdsFile(enabled.map((entry) => entry.id)));
|
|
3772
|
+
if (!options.skipCommands) {
|
|
3773
|
+
writeOutput("commands", "command-loaders.generated.ts", () => renderCommandLoadersFile(commandLoaderEntries));
|
|
3794
3774
|
}
|
|
3795
|
-
removeStaleI18nLocaleShards(outputDir, expectedShardArtifacts);
|
|
3796
|
-
writeGeneratedFile({
|
|
3797
|
-
outFile: i18nLoadersOutFile,
|
|
3798
|
-
checksumFile: i18nLoadersChecksumFile,
|
|
3799
|
-
content: renderI18nLocaleLoadersFile(i18nLocales),
|
|
3800
|
-
structureChecksum,
|
|
3801
|
-
result,
|
|
3802
|
-
quiet
|
|
3803
|
-
});
|
|
3804
|
-
writeGeneratedFile({ outFile: legacyOutFile, checksumFile: legacyChecksumFile, content: legacyOutput, structureChecksum, result, quiet });
|
|
3805
|
-
const enabledIdsOutput = renderEnabledModuleIdsFile(enabled.map((entry) => entry.id));
|
|
3806
|
-
writeGeneratedFile({ outFile: enabledIdsOutFile, checksumFile: enabledIdsChecksumFile, content: enabledIdsOutput, structureChecksum, result, quiet });
|
|
3807
|
-
const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries);
|
|
3808
|
-
writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet });
|
|
3809
3775
|
return result;
|
|
3810
3776
|
}
|
|
3811
3777
|
async function generateModuleRegistryCliFromDiscovery(options) {
|
|
@@ -3813,15 +3779,10 @@ async function generateModuleRegistryCliFromDiscovery(options) {
|
|
|
3813
3779
|
const { resolver, quiet = false } = options;
|
|
3814
3780
|
const { discovery } = options;
|
|
3815
3781
|
const result = createGeneratorResult();
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
const
|
|
3820
|
-
const legacyChecksumFile = path.join(outputDir, "cli-modules.generated.checksum");
|
|
3821
|
-
const commandLoadersOutFile = path.join(outputDir, "command-loaders.generated.ts");
|
|
3822
|
-
const commandLoadersChecksumFile = path.join(outputDir, "command-loaders.generated.checksum");
|
|
3823
|
-
const devSupervisorOutFile = path.join(outputDir, DEV_SUPERVISOR_MANIFEST_FILE);
|
|
3824
|
-
const devSupervisorChecksumFile = path.join(outputDir, "dev-supervisor.generated.checksum");
|
|
3782
|
+
if (options.outputGroups !== void 0 && !options.outputGroups.some(
|
|
3783
|
+
(group) => ["cli", "supervisor"].includes(group) || group === "commands" && !options.skipCommands
|
|
3784
|
+
)) return result;
|
|
3785
|
+
const writeOutput = createRegistryOutputWriter(options, result);
|
|
3825
3786
|
const enabled = discovery.enabled;
|
|
3826
3787
|
const imports = [];
|
|
3827
3788
|
const moduleDecls = [];
|
|
@@ -3830,7 +3791,7 @@ async function generateModuleRegistryCliFromDiscovery(options) {
|
|
|
3830
3791
|
const commandLoaderEntries = [];
|
|
3831
3792
|
const devSupervisorWorkers = [];
|
|
3832
3793
|
let schedulerStartStatus = "missing-module";
|
|
3833
|
-
let requiresFullBootstrap = enabled.some((entry) => entry.devSupervisorRequiresFullBootstrap === true) || appDeclaresProgrammaticDevSupervisorOverrides(resolver.getAppDir());
|
|
3794
|
+
let requiresFullBootstrap = selectsRegistryOutput(options, "supervisor") && (enabled.some((entry) => entry.devSupervisorRequiresFullBootstrap === true) || appDeclaresProgrammaticDevSupervisorOverrides(resolver.getAppDir()));
|
|
3834
3795
|
for (const discovered of discovery.modules) {
|
|
3835
3796
|
const { modId, imps, appImportBase } = discovered;
|
|
3836
3797
|
commandLoaderEntries.push(...discovered.commandLoaderEntries);
|
|
@@ -4052,14 +4013,15 @@ async function generateModuleRegistryCliFromDiscovery(options) {
|
|
|
4052
4013
|
}
|
|
4053
4014
|
moduleDecls.push(objectLiteral(moduleEntries));
|
|
4054
4015
|
}
|
|
4055
|
-
|
|
4016
|
+
exitOnMissingModuleRequires(discovery.identities, requiresByModule);
|
|
4017
|
+
writeOutput("cli", "modules.cli.generated.ts", () => renderAstModuleRegistryFile({
|
|
4056
4018
|
fileName: "modules.cli.generated.ts",
|
|
4057
4019
|
generator: "registry (CLI version)",
|
|
4058
4020
|
imports,
|
|
4059
4021
|
moduleEntries: moduleDecls,
|
|
4060
4022
|
includeAbandonHookImport: hasAbandonHookWorkers
|
|
4061
|
-
});
|
|
4062
|
-
|
|
4023
|
+
}));
|
|
4024
|
+
writeOutput("cli", "cli-modules.generated.ts", () => renderAstLegacyAliasFile({
|
|
4063
4025
|
fileName: "cli-modules.generated.ts",
|
|
4064
4026
|
exportName: "cliModules",
|
|
4065
4027
|
exportType: "Pick<Module, 'id' | 'cli'>[]",
|
|
@@ -4073,48 +4035,43 @@ async function generateModuleRegistryCliFromDiscovery(options) {
|
|
|
4073
4035
|
]))
|
|
4074
4036
|
})
|
|
4075
4037
|
])
|
|
4076
|
-
});
|
|
4077
|
-
|
|
4078
|
-
const structureChecksum = discovery.getStructureChecksum();
|
|
4079
|
-
writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet });
|
|
4080
|
-
writeGeneratedFile({ outFile: legacyOutFile, checksumFile: legacyChecksumFile, content: legacyOutput, structureChecksum, result, quiet });
|
|
4081
|
-
const devSupervisorOutput = `${JSON.stringify({
|
|
4038
|
+
}));
|
|
4039
|
+
writeOutput("supervisor", DEV_SUPERVISOR_MANIFEST_FILE, () => `${JSON.stringify({
|
|
4082
4040
|
version: DEV_SUPERVISOR_MANIFEST_VERSION,
|
|
4083
4041
|
workers: devSupervisorWorkers,
|
|
4084
4042
|
schedulerStartStatus,
|
|
4085
4043
|
requiresFullBootstrap
|
|
4086
4044
|
}, null, 2)}
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
content: devSupervisorOutput,
|
|
4092
|
-
structureChecksum,
|
|
4093
|
-
result,
|
|
4094
|
-
quiet
|
|
4095
|
-
});
|
|
4096
|
-
const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries);
|
|
4097
|
-
writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet });
|
|
4045
|
+
`);
|
|
4046
|
+
if (!options.skipCommands) {
|
|
4047
|
+
writeOutput("commands", "command-loaders.generated.ts", () => renderCommandLoadersFile(commandLoaderEntries));
|
|
4048
|
+
}
|
|
4098
4049
|
return result;
|
|
4099
4050
|
}
|
|
4100
4051
|
async function generateModuleRegistry(options) {
|
|
4052
|
+
if (options.outputGroups?.length === 0) return createGeneratorResult();
|
|
4101
4053
|
const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false);
|
|
4102
4054
|
return generateModuleRegistryFromDiscovery({ ...options, discovery });
|
|
4103
4055
|
}
|
|
4104
4056
|
async function generateModuleRegistryApp(options) {
|
|
4057
|
+
if (options.outputGroups?.length === 0) return createGeneratorResult();
|
|
4105
4058
|
const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false);
|
|
4106
4059
|
return generateModuleRegistryAppFromDiscovery({ ...options, discovery });
|
|
4107
4060
|
}
|
|
4108
4061
|
async function generateModuleRegistryCli(options) {
|
|
4062
|
+
if (options.outputGroups?.length === 0) return createGeneratorResult();
|
|
4109
4063
|
const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false);
|
|
4110
4064
|
return generateModuleRegistryCliFromDiscovery({ ...options, discovery });
|
|
4111
4065
|
}
|
|
4112
4066
|
async function generateModuleRegistries(options) {
|
|
4067
|
+
if (options.outputGroups?.length === 0) {
|
|
4068
|
+
return [createGeneratorResult(), createGeneratorResult(), createGeneratorResult()];
|
|
4069
|
+
}
|
|
4113
4070
|
const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false);
|
|
4114
4071
|
return [
|
|
4115
4072
|
await generateModuleRegistryFromDiscovery({ ...options, discovery }),
|
|
4116
|
-
await generateModuleRegistryAppFromDiscovery({ ...options, discovery }),
|
|
4117
|
-
await generateModuleRegistryCliFromDiscovery({ ...options, discovery })
|
|
4073
|
+
await generateModuleRegistryAppFromDiscovery({ ...options, discovery, skipCommands: true }),
|
|
4074
|
+
await generateModuleRegistryCliFromDiscovery({ ...options, discovery, skipCommands: true })
|
|
4118
4075
|
];
|
|
4119
4076
|
}
|
|
4120
4077
|
export {
|