@open-mercato/cli 0.11.1-develop.8589.1.db1a76ea60 → 0.11.1-develop.8665.1.2455b2503c
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 +4 -2
- package/AGENTS.md +3 -0
- package/dist/agentic/guides/architecture.md +2 -2
- package/dist/agentic/guides/extensions.md +7 -2
- package/dist/agentic/guides/framework-extension-points.md +1 -0
- package/dist/agentic/guides/infrastructure-providers.md +20 -0
- package/dist/agentic/guides/integrations.md +2 -2
- package/dist/agentic/guides/module-facts.json +2564 -265
- package/dist/agentic/guides/module-facts.v2.json +2580 -265
- 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/assisted_selling/acl-features.md +16 -0
- package/dist/agentic/guides/modules/assisted_selling/contribution-resolutions.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/domain-commands.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/entities.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/events.md +22 -0
- package/dist/agentic/guides/modules/assisted_selling/exact-override-targets.md +17 -0
- package/dist/agentic/guides/modules/assisted_selling/index.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/setup.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/umes-contributions.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/umes-hosts.md +23 -0
- package/dist/agentic/guides/modules/attachments/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/workers.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/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/backups/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/backups/exact-override-targets.md +11 -0
- package/dist/agentic/guides/modules/backups/index.md +5 -2
- 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/acl-features.md +2 -1
- package/dist/agentic/guides/modules/catalog/active-extension-bindings.md +2 -0
- package/dist/agentic/guides/modules/catalog/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/catalog/contribution-resolutions.md +5 -0
- package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +8 -7
- package/dist/agentic/guides/modules/catalog/di-service-tokens.md +5 -4
- package/dist/agentic/guides/modules/catalog/domain-commands.md +2 -0
- package/dist/agentic/guides/modules/catalog/entities.md +1 -0
- package/dist/agentic/guides/modules/catalog/events.md +4 -1
- package/dist/agentic/guides/modules/catalog/exact-override-targets.md +13 -7
- package/dist/agentic/guides/modules/catalog/index.md +9 -9
- package/dist/agentic/guides/modules/catalog/umes-contributions.md +5 -0
- package/dist/agentic/guides/modules/catalog/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/catalog/workers.md +1 -0
- 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/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +2 -0
- package/dist/agentic/guides/modules/customer_accounts/index.md +2 -2
- package/dist/agentic/guides/modules/customer_accounts/workers.md +2 -0
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customers/active-extension-bindings.md +2 -1
- package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +1 -0
- package/dist/agentic/guides/modules/customers/index.md +3 -3
- package/dist/agentic/guides/modules/customers/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/dashboards/active-extension-bindings.md +0 -1
- package/dist/agentic/guides/modules/dashboards/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/dashboards/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/dashboards/index.md +2 -3
- 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/di-registrations-rich.md +8 -8
- package/dist/agentic/guides/modules/integrations/di-service-tokens.md +4 -4
- package/dist/agentic/guides/modules/integrations/exact-override-targets.md +14 -12
- package/dist/agentic/guides/modules/integrations/index.md +2 -2
- package/dist/agentic/guides/modules/integrations/setup.md +1 -1
- package/dist/agentic/guides/modules/integrations/workers.md +3 -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/exact-override-targets.md +3 -3
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/resources/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/resources/setup.md +1 -1
- package/dist/agentic/guides/modules/sales/contribution-resolutions.md +1 -0
- package/dist/agentic/guides/modules/sales/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/sales/index.md +3 -3
- package/dist/agentic/guides/modules/sales/umes-contributions.md +1 -0
- 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/contribution-resolutions.md +1 -1
- package/dist/agentic/guides/modules/staff/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/staff/index.md +1 -1
- package/dist/agentic/guides/modules/staff/workers.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 +811 -21
- package/dist/agentic/guides/reference-modules/example/active-extension-bindings.md +1 -0
- package/dist/agentic/guides/reference-modules/example/backend-pages.md +2 -0
- package/dist/agentic/guides/reference-modules/example/contribution-resolutions.md +3 -1
- package/dist/agentic/guides/reference-modules/example/di-registrations-rich.md +3 -3
- package/dist/agentic/guides/reference-modules/example/di-service-tokens.md +1 -1
- package/dist/agentic/guides/reference-modules/example/entities.md +2 -0
- package/dist/agentic/guides/reference-modules/example/events.md +2 -1
- package/dist/agentic/guides/reference-modules/example/exact-override-targets.md +25 -8
- package/dist/agentic/guides/reference-modules/example/index.md +7 -7
- package/dist/agentic/guides/reference-modules/example/notifications.md +1 -0
- package/dist/agentic/guides/reference-modules/example/setup.md +1 -1
- package/dist/agentic/guides/reference-modules/example/umes-contributions.md +3 -1
- package/dist/agentic/guides/reference-modules/example/umes-hosts.md +4 -0
- package/dist/agentic/guides/upstream/AGENTS.md +5 -4
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +37 -20
- package/dist/agentic/guides/upstream/manifest.json +3 -3
- package/dist/agentic/shared/AGENTS.md.template +11 -15
- package/dist/agentic/shared/ai/harness/README.md +4 -2
- package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
- package/dist/agentic/shared/ai/harness/cases.json +1420 -41
- package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
- package/dist/agentic/shared/ai/harness/design-system-inventory.json +640 -142
- package/dist/agentic/shared/ai/harness/source-link-inventory.json +223 -16
- package/dist/agentic/shared/ai/harness/validators.json +1 -1
- package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +1 -1
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +25 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +1 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +2 -0
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +21 -1
- package/dist/lib/cache-provider-manifest.js +9 -0
- package/dist/lib/cache-provider-manifest.js.map +7 -0
- 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 +170 -0
- package/dist/lib/generate-watch-plan.js.map +7 -0
- package/dist/lib/generate-watch-runner.js +54 -0
- package/dist/lib/generate-watch-runner.js.map +7 -0
- package/dist/lib/generate-watch-structure.js +578 -203
- package/dist/lib/generate-watch-structure.js.map +3 -3
- package/dist/lib/generators/ast/writers.js +5 -1
- package/dist/lib/generators/ast/writers.js.map +2 -2
- package/dist/lib/generators/cache-providers.js +80 -0
- package/dist/lib/generators/cache-providers.js.map +7 -0
- 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/form-section-ast.js +156 -0
- package/dist/lib/generators/form-section-ast.js.map +7 -0
- package/dist/lib/generators/form-section-extension-compiler.js +568 -0
- package/dist/lib/generators/form-section-extension-compiler.js.map +7 -0
- package/dist/lib/generators/form-section-extension-source.js +245 -0
- package/dist/lib/generators/form-section-extension-source.js.map +7 -0
- package/dist/lib/generators/form-section-runtime-revisions.js +184 -0
- package/dist/lib/generators/form-section-runtime-revisions.js.map +7 -0
- package/dist/lib/generators/form-sections.js +773 -0
- package/dist/lib/generators/form-sections.js.map +7 -0
- package/dist/lib/generators/index.js +2 -0
- package/dist/lib/generators/index.js.map +2 -2
- package/dist/lib/generators/module-entities.js +21 -2
- package/dist/lib/generators/module-entities.js.map +2 -2
- package/dist/lib/generators/module-extension-facts.js +2 -1
- package/dist/lib/generators/module-extension-facts.js.map +2 -2
- package/dist/lib/generators/module-facts.js +30 -1
- package/dist/lib/generators/module-facts.js.map +2 -2
- package/dist/lib/generators/module-override-targets.js +24 -2
- package/dist/lib/generators/module-override-targets.js.map +2 -2
- package/dist/lib/generators/module-registry.js +223 -194
- package/dist/lib/generators/module-registry.js.map +3 -3
- package/dist/lib/generators/openapi.js +51 -18
- 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/lib/post-generate-invalidation.js +20 -1
- package/dist/lib/post-generate-invalidation.js.map +2 -2
- package/dist/lib/resolver.js +195 -1
- package/dist/lib/resolver.js.map +3 -3
- package/dist/lib/single-instance-strategy-guard.js +26 -3
- package/dist/lib/single-instance-strategy-guard.js.map +2 -2
- package/dist/mercato.js +106 -50
- package/dist/mercato.js.map +2 -2
- package/jest.config.cjs +2 -0
- package/package.json +7 -7
- package/src/__tests__/mercato.test.ts +18 -0
- package/src/__tests__/rotation-json-output.test.ts +52 -0
- package/src/lib/__tests__/cache-provider-manifest.test.ts +76 -0
- 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 +99 -0
- package/src/lib/__tests__/generate-watch-runner.test.ts +138 -0
- package/src/lib/__tests__/generate-watch-structure.test.ts +556 -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/__tests__/post-generate-invalidation.test.ts +108 -0
- package/src/lib/__tests__/resolver.form-section-gates.test.ts +82 -0
- package/src/lib/__tests__/single-instance-strategy-guard.test.ts +129 -0
- package/src/lib/cache-provider-manifest.ts +8 -0
- 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 +180 -0
- package/src/lib/generate-watch-runner.ts +63 -0
- package/src/lib/generate-watch-structure.ts +670 -227
- package/src/lib/generators/__tests__/cache-providers.test.ts +102 -0
- package/src/lib/generators/__tests__/derived-crud-route-collisions.test.ts +85 -0
- package/src/lib/generators/__tests__/form-section-outbox.test.ts +53 -0
- package/src/lib/generators/__tests__/form-sections.test.ts +896 -0
- package/src/lib/generators/__tests__/incremental-registry.test.ts +262 -0
- package/src/lib/generators/__tests__/module-extension-facts.test.ts +1 -0
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +8 -6
- package/src/lib/generators/__tests__/module-facts.example-fact-coverage.test.ts +37 -13
- package/src/lib/generators/__tests__/module-facts.local-reference.test.ts +13 -0
- package/src/lib/generators/__tests__/module-override-targets.test.ts +2 -3
- package/src/lib/generators/__tests__/module-subset.test.ts +1 -1
- package/src/lib/generators/__tests__/openapi.test.ts +147 -10
- package/src/lib/generators/__tests__/structural-contracts.test.ts +2 -2
- package/src/lib/generators/__tests__/web-research-adapters.test.ts +298 -87
- package/src/lib/generators/ast/writers.ts +6 -1
- package/src/lib/generators/cache-providers.ts +111 -0
- package/src/lib/generators/extension.ts +2 -0
- package/src/lib/generators/extensions/agent-files.ts +1 -0
- package/src/lib/generators/form-section-ast.ts +166 -0
- package/src/lib/generators/form-section-extension-compiler.ts +632 -0
- package/src/lib/generators/form-section-extension-source.ts +308 -0
- package/src/lib/generators/form-section-runtime-revisions.ts +211 -0
- package/src/lib/generators/form-sections.ts +896 -0
- package/src/lib/generators/index.ts +1 -0
- package/src/lib/generators/module-entities.ts +22 -4
- package/src/lib/generators/module-extension-facts.ts +1 -0
- package/src/lib/generators/module-facts.ts +40 -0
- package/src/lib/generators/module-override-targets.ts +19 -0
- package/src/lib/generators/module-registry.ts +246 -202
- package/src/lib/generators/openapi.ts +65 -20
- package/src/lib/generators/web-research-adapters.ts +76 -21
- package/src/lib/in-process-generate-watcher.ts +151 -96
- package/src/lib/post-generate-invalidation.ts +28 -1
- package/src/lib/resolver.ts +218 -0
- package/src/lib/single-instance-strategy-guard.ts +51 -1
- package/src/mercato.ts +117 -57
- package/dist/agentic/guides/modules/dashboards/incoming-installed-contributions.md +0 -11
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { matchRoutePattern } from '@open-mercato/shared/modules/registry'
|
|
1
2
|
import { sourceHasDefaultExport, sourceExportedHttpMethods } from './source-exports'
|
|
2
3
|
import fs from 'node:fs'
|
|
3
4
|
import path from 'node:path'
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
type DevSupervisorWorkerDescriptor,
|
|
15
16
|
} from '../dev-supervisor-manifest'
|
|
16
17
|
import {
|
|
18
|
+
calculateChecksum,
|
|
17
19
|
calculateStructureChecksum,
|
|
18
20
|
toVar,
|
|
19
21
|
moduleHasExport,
|
|
@@ -78,6 +80,7 @@ import {
|
|
|
78
80
|
resolveStandaloneSourceMirrorBase,
|
|
79
81
|
} from './scanner'
|
|
80
82
|
import { loadGeneratorExtensions } from './extensions'
|
|
83
|
+
import { prepareCrudFormSectionRegistries, writeCrudFormSectionRegistries, writeDerivedCrudFormSectionRoutes } from './form-sections'
|
|
81
84
|
import type { ModuleScanContext, StandaloneConfigOptions } from './extension'
|
|
82
85
|
import {
|
|
83
86
|
renderRouteManifestShardOutputs,
|
|
@@ -91,6 +94,8 @@ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
|
|
|
91
94
|
export interface ModuleRegistryOptions {
|
|
92
95
|
resolver: PackageResolver
|
|
93
96
|
quiet?: boolean
|
|
97
|
+
/** Undefined generates every output; an explicit list selects output families. */
|
|
98
|
+
outputGroups?: readonly string[]
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
interface ModuleRegistryDiscovery {
|
|
@@ -98,6 +103,7 @@ interface ModuleRegistryDiscovery {
|
|
|
98
103
|
modules: ModuleRegistryDiscoveryEntry[]
|
|
99
104
|
identities: ReturnType<typeof getEnabledModuleIdentities>
|
|
100
105
|
getStructureChecksum: () => string
|
|
106
|
+
getCrudFormSections: () => ReturnType<typeof prepareCrudFormSectionRegistries>
|
|
101
107
|
}
|
|
102
108
|
|
|
103
109
|
type DiscoveredSubscriber = {
|
|
@@ -124,6 +130,7 @@ type ModuleRegistryDiscoveryEntry = {
|
|
|
124
130
|
imps: ModuleImports
|
|
125
131
|
appImportBase: string
|
|
126
132
|
isAppModule: boolean
|
|
133
|
+
formSectionOverrides?: ModuleEntry['formSectionOverrides']
|
|
127
134
|
resolve: (relativePath: string) => ResolvedFile | null
|
|
128
135
|
frontendFiles: ScannedFile[]
|
|
129
136
|
backendFiles: ScannedFile[]
|
|
@@ -1920,6 +1927,7 @@ function buildManifestRouteLoader(importPath: string): WriterFunction {
|
|
|
1920
1927
|
function buildManifestApiLoader(importPath: string): WriterFunction {
|
|
1921
1928
|
return arrowFunction({
|
|
1922
1929
|
async: true,
|
|
1930
|
+
returnType: "ReturnType<ApiRouteManifestEntry['load']>",
|
|
1923
1931
|
body: importExpression(sanitizeGeneratedModuleSpecifier(importPath)),
|
|
1924
1932
|
})
|
|
1925
1933
|
}
|
|
@@ -2187,6 +2195,7 @@ async function createModuleRegistryDiscovery(
|
|
|
2187
2195
|
imps,
|
|
2188
2196
|
appImportBase,
|
|
2189
2197
|
isAppModule: entry.from === '@app',
|
|
2198
|
+
formSectionOverrides: entry.formSectionOverrides,
|
|
2190
2199
|
resolve,
|
|
2191
2200
|
frontendFiles: scanModuleDir(roots, SCAN_CONFIGS.frontendPages),
|
|
2192
2201
|
backendFiles: scanModuleDir(roots, SCAN_CONFIGS.backendPages),
|
|
@@ -2204,11 +2213,22 @@ async function createModuleRegistryDiscovery(
|
|
|
2204
2213
|
}
|
|
2205
2214
|
|
|
2206
2215
|
let structureChecksum: string | undefined
|
|
2216
|
+
let crudFormSections: ReturnType<typeof prepareCrudFormSectionRegistries> | undefined
|
|
2217
|
+
function getCrudFormSections() {
|
|
2218
|
+
if (crudFormSections) return crudFormSections
|
|
2219
|
+
const requiresByModule = new Map<string, string[]>()
|
|
2220
|
+
for (const module of modules) {
|
|
2221
|
+
const index = module.resolve('index.ts')
|
|
2222
|
+
if (index) collectDeclaredModuleRequires(module.modId, index.absolutePath, requiresByModule, quiet)
|
|
2223
|
+
}
|
|
2224
|
+
return crudFormSections = prepareCrudFormSectionRegistries({ modules, identities, requiresByModule })
|
|
2225
|
+
}
|
|
2207
2226
|
return {
|
|
2208
2227
|
enabled,
|
|
2209
2228
|
modules,
|
|
2210
2229
|
identities,
|
|
2211
2230
|
getStructureChecksum: () => structureChecksum ??= calculateStructureChecksum(Array.from(trackedRoots)),
|
|
2231
|
+
getCrudFormSections,
|
|
2212
2232
|
}
|
|
2213
2233
|
}
|
|
2214
2234
|
|
|
@@ -2715,6 +2735,7 @@ function buildModuleCustomFieldSetsValue(options: {
|
|
|
2715
2735
|
fieldsImportName?: string | null
|
|
2716
2736
|
customEntitiesImportName?: string | null
|
|
2717
2737
|
moduleId: string
|
|
2738
|
+
compiledFields?: readonly import('@open-mercato/shared/modules/entities').CustomFieldSet[]
|
|
2718
2739
|
}): WriterFunction {
|
|
2719
2740
|
const parts: WriterFunction[] = []
|
|
2720
2741
|
|
|
@@ -2769,9 +2790,14 @@ function buildModuleCustomFieldSetsValue(options: {
|
|
|
2769
2790
|
parts.push(spreadExpression(mappedEntities))
|
|
2770
2791
|
}
|
|
2771
2792
|
|
|
2793
|
+
if (options.compiledFields?.length) parts.push(spreadExpression(identifier(compiledFieldSetsExpression(options.compiledFields))))
|
|
2772
2794
|
return arrayLiteral(parts, writeValue)
|
|
2773
2795
|
}
|
|
2774
2796
|
|
|
2797
|
+
function compiledFieldSetsExpression(fields: readonly import('@open-mercato/shared/modules/entities').CustomFieldSet[]): string {
|
|
2798
|
+
return `(${JSON.stringify(fields)} satisfies import('@open-mercato/shared/modules/entities').CustomFieldSet[])`
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2775
2801
|
function buildModuleDashboardWidgetsValue(entries: DashboardWidgetEntry[]): WriterFunction {
|
|
2776
2802
|
return arrayLiteral(
|
|
2777
2803
|
entries.map((entry) =>
|
|
@@ -3652,14 +3678,16 @@ function renderI18nLocaleLoadersFile(locales: string[]): string {
|
|
|
3652
3678
|
return `// AUTO-GENERATED by mercato generate registry (locale-specific i18n loaders)\nimport type { Module } from '@open-mercato/shared/modules/registry'\n\nexport async function loadI18nModules(locale: string): Promise<Module[]> {\n switch (locale) {\n${cases ? `${cases}\n` : ''} default:\n return []\n }\n}\n`
|
|
3653
3679
|
}
|
|
3654
3680
|
|
|
3655
|
-
function removeStaleI18nLocaleShards(outputDir: string, expectedFileNames: Set<string
|
|
3681
|
+
function removeStaleI18nLocaleShards(outputDir: string, expectedFileNames: Set<string>, result: GeneratorResult): void {
|
|
3656
3682
|
if (!fs.existsSync(outputDir)) return
|
|
3657
3683
|
for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {
|
|
3658
3684
|
if (!entry.isFile()) continue
|
|
3659
3685
|
if (!/^modules\.i18n\..+\.generated\.(?:ts|checksum)$/.test(entry.name)) continue
|
|
3660
3686
|
if (entry.name.startsWith('modules.i18n.loaders.generated.')) continue
|
|
3661
3687
|
if (expectedFileNames.has(entry.name)) continue
|
|
3662
|
-
|
|
3688
|
+
const stalePath = path.join(outputDir, entry.name)
|
|
3689
|
+
fs.unlinkSync(stalePath)
|
|
3690
|
+
result.filesWritten.push(stalePath)
|
|
3663
3691
|
}
|
|
3664
3692
|
}
|
|
3665
3693
|
|
|
@@ -3687,30 +3715,44 @@ function resolveConventionFile(
|
|
|
3687
3715
|
|
|
3688
3716
|
type ModuleRegistryRenderOptions = ModuleRegistryOptions & {
|
|
3689
3717
|
discovery: ModuleRegistryDiscovery
|
|
3718
|
+
skipCommands?: boolean
|
|
3719
|
+
}
|
|
3720
|
+
|
|
3721
|
+
function selectsRegistryOutput(options: ModuleRegistryOptions, group: string): boolean {
|
|
3722
|
+
return options.outputGroups === undefined || options.outputGroups.includes(group)
|
|
3723
|
+
}
|
|
3724
|
+
|
|
3725
|
+
function createRegistryOutputWriter(options: ModuleRegistryRenderOptions, result: GeneratorResult) {
|
|
3726
|
+
const outputDir = options.resolver.getOutputDir()
|
|
3727
|
+
return (group: string, fileName: string, render: () => string): void => {
|
|
3728
|
+
if (!selectsRegistryOutput(options, group)) return
|
|
3729
|
+
const content = render()
|
|
3730
|
+
writeGeneratedFile({
|
|
3731
|
+
outFile: path.join(outputDir, fileName),
|
|
3732
|
+
checksumFile: path.join(outputDir, fileName.replace(/\.(ts|json)$/, '.checksum')),
|
|
3733
|
+
content,
|
|
3734
|
+
// Incremental output identity must not depend on unrelated module-root mtimes.
|
|
3735
|
+
// Keep the historical checksum format and value on the default full path.
|
|
3736
|
+
structureChecksum: options.outputGroups === undefined
|
|
3737
|
+
? options.discovery.getStructureChecksum()
|
|
3738
|
+
: calculateChecksum(content),
|
|
3739
|
+
result,
|
|
3740
|
+
quiet: options.quiet,
|
|
3741
|
+
})
|
|
3742
|
+
}
|
|
3690
3743
|
}
|
|
3691
3744
|
|
|
3692
3745
|
async function generateModuleRegistryFromDiscovery(options: ModuleRegistryRenderOptions): Promise<GeneratorResult> {
|
|
3693
3746
|
const { resolver, quiet = false } = options
|
|
3694
3747
|
const { discovery } = options
|
|
3695
3748
|
const result = createGeneratorResult()
|
|
3749
|
+
if (options.outputGroups !== undefined && !options.outputGroups.some((group) =>
|
|
3750
|
+
['main', 'runtime', 'frontend-routes', 'backend-routes', 'api-routes', 'commands', 'plugins', 'bootstrap-registrations'].includes(group)
|
|
3751
|
+
|| group.startsWith('registry.'),
|
|
3752
|
+
)) return result
|
|
3753
|
+
const writeOutput = createRegistryOutputWriter(options, result)
|
|
3696
3754
|
|
|
3697
3755
|
const outputDir = resolver.getOutputDir()
|
|
3698
|
-
const outFile = path.join(outputDir, 'modules.generated.ts')
|
|
3699
|
-
const checksumFile = path.join(outputDir, 'modules.generated.checksum')
|
|
3700
|
-
const runtimeOutFile = path.join(outputDir, 'modules.runtime.generated.ts')
|
|
3701
|
-
const runtimeChecksumFile = path.join(outputDir, 'modules.runtime.generated.checksum')
|
|
3702
|
-
const frontendRoutesOutFile = path.join(outputDir, 'frontend-routes.generated.ts')
|
|
3703
|
-
const frontendRoutesChecksumFile = path.join(outputDir, 'frontend-routes.generated.checksum')
|
|
3704
|
-
const backendRoutesOutFile = path.join(outputDir, 'backend-routes.generated.ts')
|
|
3705
|
-
const backendRoutesChecksumFile = path.join(outputDir, 'backend-routes.generated.checksum')
|
|
3706
|
-
const apiRoutesOutFile = path.join(outputDir, 'api-routes.generated.ts')
|
|
3707
|
-
const apiRoutesChecksumFile = path.join(outputDir, 'api-routes.generated.checksum')
|
|
3708
|
-
const bootstrapRegsOutFile = path.join(outputDir, 'bootstrap-registrations.generated.ts')
|
|
3709
|
-
const bootstrapRegsChecksumFile = path.join(outputDir, 'bootstrap-registrations.generated.checksum')
|
|
3710
|
-
const legacySubscribersOutFile = path.join(outputDir, 'subscribers.generated.ts')
|
|
3711
|
-
const legacySubscribersChecksumFile = path.join(outputDir, 'subscribers.generated.checksum')
|
|
3712
|
-
const commandLoadersOutFile = path.join(outputDir, 'command-loaders.generated.ts')
|
|
3713
|
-
const commandLoadersChecksumFile = path.join(outputDir, 'command-loaders.generated.checksum')
|
|
3714
3756
|
|
|
3715
3757
|
const enabled = discovery.enabled
|
|
3716
3758
|
const extensions = loadGeneratorExtensions(resolver)
|
|
@@ -3750,6 +3792,22 @@ async function generateModuleRegistryFromDiscovery(options: ModuleRegistryRender
|
|
|
3750
3792
|
const backendRouteMetadataEntries: RouteManifestShardEntry[] = []
|
|
3751
3793
|
const apiRouteShardEntries: RouteManifestShardEntry[] = []
|
|
3752
3794
|
const apiRouteMetadataEntries: RouteManifestShardEntry[] = []
|
|
3795
|
+
const needsDerivedRoutes = ['main', 'runtime', 'api-routes'].some((group) => selectsRegistryOutput(options, group))
|
|
3796
|
+
const derivedCrudRoutes = needsDerivedRoutes ? writeDerivedCrudFormSectionRoutes({
|
|
3797
|
+
modules: discovery.modules,
|
|
3798
|
+
identities: discovery.identities,
|
|
3799
|
+
requiresByModule: new Map(),
|
|
3800
|
+
outputDir,
|
|
3801
|
+
structureChecksum: discovery.getStructureChecksum(),
|
|
3802
|
+
result,
|
|
3803
|
+
quiet,
|
|
3804
|
+
}) : []
|
|
3805
|
+
for (const { routePath } of derivedCrudRoutes) {
|
|
3806
|
+
if (!/^(?:\/[A-Za-z0-9_.-]+)+$/.test(routePath) || routePath.split('/').some((segment) => segment === '.' || segment === '..')) {
|
|
3807
|
+
throw new Error(`[generate] Derived CrudForm route requires a literal API path without parameters: "${routePath}"`)
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3810
|
+
|
|
3753
3811
|
// Mutable ref so extracted helper functions can increment the shared counter
|
|
3754
3812
|
const importIdRef = { value: 0 }
|
|
3755
3813
|
const requiresByModule = new Map<string, string[]>()
|
|
@@ -3869,6 +3927,9 @@ async function generateModuleRegistryFromDiscovery(options: ModuleRegistryRender
|
|
|
3869
3927
|
sanitizeGeneratedModuleSpecifier,
|
|
3870
3928
|
}
|
|
3871
3929
|
for (const extension of extensions) {
|
|
3930
|
+
// Extensions with no shared import IDs can skip discovery as well as emission.
|
|
3931
|
+
// Other scans retain canonical full-generation numbering for selected outputs.
|
|
3932
|
+
if (extension.usesSharedImportIds === false && !selectsRegistryOutput(options, extension.id)) continue
|
|
3872
3933
|
extension.scanModule(extensionContext)
|
|
3873
3934
|
}
|
|
3874
3935
|
|
|
@@ -3990,6 +4051,25 @@ async function generateModuleRegistryFromDiscovery(options: ModuleRegistryRender
|
|
|
3990
4051
|
apiRouteManifestDecls.push(...generatedApis.manifestApis)
|
|
3991
4052
|
apiRouteShardEntries.push(...generatedApis.manifestShardApis)
|
|
3992
4053
|
apiRouteMetadataEntries.push(...generatedApis.metadataApis)
|
|
4054
|
+
for (const derived of derivedCrudRoutes.filter((route) => route.moduleId === modId)) {
|
|
4055
|
+
const importPath = `./${stripModuleCodeExtension(derived.fileName)}`
|
|
4056
|
+
const importName = `DERIVED_CRUD_${importIdRef.value++}`
|
|
4057
|
+
imports.push(buildImportStatement(`* as ${importName}`, importPath))
|
|
4058
|
+
runtimeImports.push(buildImportStatement(`* as ${importName}`, importPath))
|
|
4059
|
+
const entry = `{ path: ${toLiteral(derived.routePath)}, metadata: ${importName}.metadata, handlers: ${importName}, docs: ${importName}.openApi }`
|
|
4060
|
+
apis.push(entry)
|
|
4061
|
+
runtimeApis.push(entry)
|
|
4062
|
+
const entries: GeneratedObjectEntry[] = [
|
|
4063
|
+
{ name: 'moduleId', value: modId },
|
|
4064
|
+
{ name: 'kind', value: 'route-file' },
|
|
4065
|
+
{ name: 'path', value: derived.routePath },
|
|
4066
|
+
{ name: 'methods', value: arrayLiteral(derived.methods, writeValue) },
|
|
4067
|
+
]
|
|
4068
|
+
const manifestEntry = objectLiteral([...entries, { name: 'load', value: buildManifestApiLoader(importPath) }])
|
|
4069
|
+
apiRouteManifestDecls.push(manifestEntry)
|
|
4070
|
+
apiRouteShardEntries.push({ path: derived.routePath, declaration: renderGeneratedValue(manifestEntry) })
|
|
4071
|
+
apiRouteMetadataEntries.push({ path: derived.routePath, declaration: renderGeneratedValue(objectLiteral(entries)) })
|
|
4072
|
+
}
|
|
3993
4073
|
}
|
|
3994
4074
|
|
|
3995
4075
|
// 15. CLI
|
|
@@ -4029,6 +4109,8 @@ async function generateModuleRegistryFromDiscovery(options: ModuleRegistryRender
|
|
|
4029
4109
|
parts.push(
|
|
4030
4110
|
`((( ${customEntitiesImportName}.default ?? ${customEntitiesImportName}.entities) as any) || []).filter((e: any) => Array.isArray(e.fields) && e.fields.length).map((e: any) => ({ entity: e.id, fields: e.fields, source: ${toLiteral(modId)} }))`
|
|
4031
4111
|
)
|
|
4112
|
+
const compiledFields = discovery.getCrudFormSections().compiled.customFieldSetsByModule.get(modId)
|
|
4113
|
+
if (compiledFields?.length) parts.push(compiledFieldSetsExpression(compiledFields))
|
|
4032
4114
|
customFieldSetsExpr = parts.length ? `[...${parts.join(', ...')}]` : '[]'
|
|
4033
4115
|
}
|
|
4034
4116
|
|
|
@@ -4276,49 +4358,74 @@ async function generateModuleRegistryFromDiscovery(options: ModuleRegistryRender
|
|
|
4276
4358
|
}
|
|
4277
4359
|
}
|
|
4278
4360
|
|
|
4279
|
-
|
|
4361
|
+
exitOnMissingModuleRequires(discovery.identities, requiresByModule)
|
|
4362
|
+
|
|
4363
|
+
writeOutput('main', 'modules.generated.ts', () => renderAstModuleRegistryFile({
|
|
4280
4364
|
fileName: 'modules.generated.ts',
|
|
4281
4365
|
generator: 'registry',
|
|
4282
4366
|
imports,
|
|
4283
4367
|
moduleEntries: moduleDecls,
|
|
4284
4368
|
includeCreateElementImport: hasRouteComponents,
|
|
4285
4369
|
includeAbandonHookImport: hasAbandonHookWorkers,
|
|
4286
|
-
})
|
|
4287
|
-
|
|
4370
|
+
}))
|
|
4371
|
+
writeOutput('runtime', 'modules.runtime.generated.ts', () => renderAstModuleRegistryFile({
|
|
4288
4372
|
fileName: 'modules.runtime.generated.ts',
|
|
4289
4373
|
generator: 'registry',
|
|
4290
4374
|
imports: runtimeImports,
|
|
4291
4375
|
moduleEntries: runtimeModuleDecls,
|
|
4292
4376
|
includeCreateElementImport: true,
|
|
4293
4377
|
includeAbandonHookImport: hasAbandonHookWorkers,
|
|
4294
|
-
})
|
|
4295
|
-
|
|
4378
|
+
}))
|
|
4379
|
+
writeOutput('frontend-routes', 'frontend-routes.generated.ts', () => renderAstManifestFile({
|
|
4296
4380
|
fileName: 'frontend-routes.generated.ts',
|
|
4297
4381
|
typeName: 'FrontendRouteManifestEntry',
|
|
4298
4382
|
exportName: 'frontendRoutes',
|
|
4299
4383
|
imports: frontendRouteManifestImports,
|
|
4300
4384
|
entries: frontendRouteManifestDecls,
|
|
4301
|
-
})
|
|
4302
|
-
|
|
4385
|
+
}))
|
|
4386
|
+
writeOutput('backend-routes', 'backend-routes.generated.ts', () => renderAstManifestFile({
|
|
4303
4387
|
fileName: 'backend-routes.generated.ts',
|
|
4304
4388
|
typeName: 'BackendRouteManifestEntry',
|
|
4305
4389
|
exportName: 'backendRoutes',
|
|
4306
4390
|
imports: backendRouteManifestImports,
|
|
4307
4391
|
entries: backendRouteManifestDecls,
|
|
4308
|
-
})
|
|
4309
|
-
const
|
|
4392
|
+
}))
|
|
4393
|
+
for (const derived of derivedCrudRoutes) {
|
|
4394
|
+
if (apiRouteMetadataEntries.filter(({ path: routePath }) => matchRoutePattern(routePath, derived.routePath) !== undefined).length !== 1) {
|
|
4395
|
+
throw new Error(`[generate] Derived CrudForm route conflicts with an existing API route "${derived.routePath}"`)
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
writeOutput('api-routes', 'api-routes.generated.ts', () => renderAstManifestFile({
|
|
4310
4399
|
fileName: 'api-routes.generated.ts',
|
|
4311
4400
|
typeName: 'ApiRouteManifestEntry',
|
|
4312
4401
|
exportName: 'apiRoutes',
|
|
4313
4402
|
entries: apiRouteManifestDecls,
|
|
4314
|
-
})
|
|
4315
|
-
const
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4403
|
+
}))
|
|
4404
|
+
for (const kind of ['backend', 'api'] as const) {
|
|
4405
|
+
const group = `${kind}-routes`
|
|
4406
|
+
if (!selectsRegistryOutput(options, group)) continue
|
|
4407
|
+
const routeManifestOutputs = [
|
|
4408
|
+
...renderRouteManifestShardOutputs(kind, kind === 'backend' ? backendRouteShardEntries : apiRouteShardEntries),
|
|
4409
|
+
renderRouteMetadataOutput(kind, kind === 'backend' ? backendRouteMetadataEntries : apiRouteMetadataEntries),
|
|
4410
|
+
]
|
|
4411
|
+
const expectedRouteManifestFiles = new Set(routeManifestOutputs.flatMap(({ fileName }) => [
|
|
4412
|
+
fileName,
|
|
4413
|
+
fileName.replace(/\.ts$/, '.checksum'),
|
|
4414
|
+
]))
|
|
4415
|
+
if (fs.existsSync(outputDir)) {
|
|
4416
|
+
for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {
|
|
4417
|
+
if (!entry.isFile() || !entry.name.startsWith(`${kind}-route-shard.`) || !routeManifestShardFilePattern.test(entry.name)) continue
|
|
4418
|
+
if (expectedRouteManifestFiles.has(entry.name)) continue
|
|
4419
|
+
const stalePath = path.join(outputDir, entry.name)
|
|
4420
|
+
fs.unlinkSync(stalePath)
|
|
4421
|
+
result.filesWritten.push(stalePath)
|
|
4422
|
+
}
|
|
4423
|
+
}
|
|
4424
|
+
for (const routeOutput of routeManifestOutputs) {
|
|
4425
|
+
writeOutput(group, routeOutput.fileName, () => routeOutput.content)
|
|
4426
|
+
}
|
|
4427
|
+
}
|
|
4428
|
+
writeOutput('runtime', 'subscribers.generated.ts', () => renderAstLegacyAliasFile({
|
|
4322
4429
|
fileName: 'subscribers.generated.ts',
|
|
4323
4430
|
exportName: 'moduleSubscribers',
|
|
4324
4431
|
exportType: "NonNullable<Module['subscribers']>",
|
|
@@ -4334,78 +4441,41 @@ async function generateModuleRegistryFromDiscovery(options: ModuleRegistryRender
|
|
|
4334
4441
|
),
|
|
4335
4442
|
}),
|
|
4336
4443
|
]),
|
|
4337
|
-
})
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
const structureChecksum = discovery.getStructureChecksum()
|
|
4341
|
-
|
|
4342
|
-
writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet })
|
|
4343
|
-
writeGeneratedFile({ outFile: runtimeOutFile, checksumFile: runtimeChecksumFile, content: runtimeOutput, structureChecksum, result, quiet })
|
|
4344
|
-
writeGeneratedFile({ outFile: frontendRoutesOutFile, checksumFile: frontendRoutesChecksumFile, content: frontendRoutesOutput, structureChecksum, result, quiet })
|
|
4345
|
-
writeGeneratedFile({ outFile: backendRoutesOutFile, checksumFile: backendRoutesChecksumFile, content: backendRoutesOutput, structureChecksum, result, quiet })
|
|
4346
|
-
writeGeneratedFile({ outFile: apiRoutesOutFile, checksumFile: apiRoutesChecksumFile, content: apiRoutesOutput, structureChecksum, result, quiet })
|
|
4347
|
-
const expectedRouteManifestFiles = new Set(routeManifestOutputs.flatMap(({ fileName }) => [
|
|
4348
|
-
fileName,
|
|
4349
|
-
fileName.replace(/\.ts$/, '.checksum'),
|
|
4350
|
-
]))
|
|
4351
|
-
if (fs.existsSync(outputDir)) {
|
|
4352
|
-
for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {
|
|
4353
|
-
if (!entry.isFile() || !routeManifestShardFilePattern.test(entry.name)) continue
|
|
4354
|
-
if (expectedRouteManifestFiles.has(entry.name)) continue
|
|
4355
|
-
const stalePath = path.join(outputDir, entry.name)
|
|
4356
|
-
fs.unlinkSync(stalePath)
|
|
4357
|
-
result.filesWritten.push(stalePath)
|
|
4358
|
-
}
|
|
4359
|
-
}
|
|
4360
|
-
for (const routeOutput of routeManifestOutputs) {
|
|
4361
|
-
writeGeneratedFile({
|
|
4362
|
-
outFile: path.join(outputDir, routeOutput.fileName),
|
|
4363
|
-
checksumFile: path.join(outputDir, routeOutput.fileName.replace(/\.ts$/, '.checksum')),
|
|
4364
|
-
content: routeOutput.content,
|
|
4365
|
-
structureChecksum,
|
|
4366
|
-
result,
|
|
4367
|
-
quiet,
|
|
4368
|
-
})
|
|
4444
|
+
}))
|
|
4445
|
+
if (!options.skipCommands) {
|
|
4446
|
+
writeOutput('commands', 'command-loaders.generated.ts', () => renderCommandLoadersFile(commandLoaderEntries))
|
|
4369
4447
|
}
|
|
4370
|
-
writeGeneratedFile({ outFile: legacySubscribersOutFile, checksumFile: legacySubscribersChecksumFile, content: legacySubscribersOutput, structureChecksum, result, quiet })
|
|
4371
|
-
const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries)
|
|
4372
|
-
writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet })
|
|
4373
4448
|
|
|
4374
4449
|
for (const extension of extensions) {
|
|
4450
|
+
// generateOutput may write outside outputDir (notably file agents), so select before calling it.
|
|
4451
|
+
if (!selectsRegistryOutput(options, extension.id)) continue
|
|
4375
4452
|
const outputs = extension.generateOutput()
|
|
4376
4453
|
for (const [fileName, content] of outputs) {
|
|
4377
|
-
|
|
4378
|
-
outFile: path.join(outputDir, fileName),
|
|
4379
|
-
checksumFile: path.join(outputDir, fileName.replace('.ts', '.checksum')),
|
|
4380
|
-
content,
|
|
4381
|
-
structureChecksum,
|
|
4382
|
-
result,
|
|
4383
|
-
quiet,
|
|
4384
|
-
})
|
|
4454
|
+
writeOutput(extension.id, fileName, () => content)
|
|
4385
4455
|
}
|
|
4386
4456
|
}
|
|
4387
4457
|
|
|
4388
4458
|
// Generator plugin outputs (registered via modules' generators.ts)
|
|
4389
|
-
|
|
4390
|
-
const
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
}
|
|
4459
|
+
if (selectsRegistryOutput(options, 'plugins')) {
|
|
4460
|
+
for (const [pluginId, plugin] of pluginRegistry) {
|
|
4461
|
+
const state = pluginState.get(pluginId)!
|
|
4462
|
+
writeOutput('plugins', pluginOutputNames.get(pluginId)!, () => plugin.buildOutput({
|
|
4463
|
+
importSection: state.imports.join('\n'),
|
|
4464
|
+
entriesLiteral: state.configs.join(',\n '),
|
|
4465
|
+
}))
|
|
4466
|
+
}
|
|
4467
|
+
reconcileGeneratorPluginOutputs({
|
|
4468
|
+
outputDir,
|
|
4469
|
+
outputNames: pluginOutputNames.values(),
|
|
4470
|
+
result,
|
|
4471
|
+
})
|
|
4472
|
+
}
|
|
4403
4473
|
|
|
4404
4474
|
// Bootstrap registrations: aggregate core registrations + plugin bootstrap-registration hooks
|
|
4405
4475
|
// into one file. Always written (with at least the core backend route registration) so bootstrap.ts
|
|
4406
4476
|
// can unconditionally import it and every runtime consumer sees a populated route manifest
|
|
4407
4477
|
// regardless of Next.js server bundle isolation.
|
|
4408
|
-
{
|
|
4478
|
+
if (selectsRegistryOutput(options, 'bootstrap-registrations')) {
|
|
4409
4479
|
const bootstrapPlugins = [...pluginRegistry.values()].filter((p) => p.bootstrapRegistration)
|
|
4410
4480
|
const allEntryImports: string[] = [
|
|
4411
4481
|
buildImportStatement(`{ backendRouteFacades }`, `./backend-route-shards.generated`),
|
|
@@ -4425,12 +4495,11 @@ async function generateModuleRegistryFromDiscovery(options: ModuleRegistryRender
|
|
|
4425
4495
|
allRegImports.push(...reg.registrationImports)
|
|
4426
4496
|
allCalls.push(reg.buildCall(reg.entriesExportName))
|
|
4427
4497
|
}
|
|
4428
|
-
|
|
4498
|
+
writeOutput('bootstrap-registrations', 'bootstrap-registrations.generated.ts', () => renderBootstrapRegistrationsFile({
|
|
4429
4499
|
entryImports: allEntryImports,
|
|
4430
4500
|
registrationImports: allRegImports,
|
|
4431
4501
|
calls: allCalls,
|
|
4432
|
-
})
|
|
4433
|
-
writeGeneratedFile({ outFile: bootstrapRegsOutFile, checksumFile: bootstrapRegsChecksumFile, content: bootstrapRegsOutput, structureChecksum, result, quiet })
|
|
4502
|
+
}))
|
|
4434
4503
|
}
|
|
4435
4504
|
|
|
4436
4505
|
return result
|
|
@@ -4440,22 +4509,13 @@ async function generateModuleRegistryAppFromDiscovery(options: ModuleRegistryRen
|
|
|
4440
4509
|
const { resolver, quiet = false } = options
|
|
4441
4510
|
const { discovery } = options
|
|
4442
4511
|
const result = createGeneratorResult()
|
|
4512
|
+
if (options.outputGroups !== undefined && !options.outputGroups.some((group) =>
|
|
4513
|
+
['app', 'bootstrap', 'i18n', 'enabled-ids'].includes(group)
|
|
4514
|
+
|| (group === 'commands' && !options.skipCommands),
|
|
4515
|
+
)) return result
|
|
4516
|
+
const writeOutput = createRegistryOutputWriter(options, result)
|
|
4443
4517
|
|
|
4444
4518
|
const outputDir = resolver.getOutputDir()
|
|
4445
|
-
const outFile = path.join(outputDir, 'modules.app.generated.ts')
|
|
4446
|
-
const checksumFile = path.join(outputDir, 'modules.app.generated.checksum')
|
|
4447
|
-
const bootstrapOutFile = path.join(outputDir, 'modules.bootstrap.generated.ts')
|
|
4448
|
-
const bootstrapChecksumFile = path.join(outputDir, 'modules.bootstrap.generated.checksum')
|
|
4449
|
-
const i18nOutFile = path.join(outputDir, 'modules.i18n.generated.ts')
|
|
4450
|
-
const i18nChecksumFile = path.join(outputDir, 'modules.i18n.generated.checksum')
|
|
4451
|
-
const i18nLoadersOutFile = path.join(outputDir, 'modules.i18n.loaders.generated.ts')
|
|
4452
|
-
const i18nLoadersChecksumFile = path.join(outputDir, 'modules.i18n.loaders.generated.checksum')
|
|
4453
|
-
const legacyOutFile = path.join(outputDir, 'bootstrap-modules.generated.ts')
|
|
4454
|
-
const legacyChecksumFile = path.join(outputDir, 'bootstrap-modules.generated.checksum')
|
|
4455
|
-
const enabledIdsOutFile = path.join(outputDir, 'enabled-module-ids.generated.ts')
|
|
4456
|
-
const enabledIdsChecksumFile = path.join(outputDir, 'enabled-module-ids.generated.checksum')
|
|
4457
|
-
const commandLoadersOutFile = path.join(outputDir, 'command-loaders.generated.ts')
|
|
4458
|
-
const commandLoadersChecksumFile = path.join(outputDir, 'command-loaders.generated.checksum')
|
|
4459
4519
|
|
|
4460
4520
|
const enabled = discovery.enabled
|
|
4461
4521
|
const imports: string[] = []
|
|
@@ -4643,7 +4703,7 @@ async function generateModuleRegistryAppFromDiscovery(options: ModuleRegistryRen
|
|
|
4643
4703
|
|
|
4644
4704
|
const moduleEntries: GeneratedObjectEntry[] = [
|
|
4645
4705
|
{ name: 'id', value: modId },
|
|
4646
|
-
{ name: 'customFieldSets', value: buildModuleCustomFieldSetsValue({ fieldsImportName, customEntitiesImportName, moduleId: modId }) },
|
|
4706
|
+
{ name: 'customFieldSets', value: buildModuleCustomFieldSetsValue({ fieldsImportName, customEntitiesImportName, moduleId: modId, compiledFields: discovery.getCrudFormSections().compiled.customFieldSetsByModule.get(modId) }) },
|
|
4647
4707
|
]
|
|
4648
4708
|
const i18nModuleEntries: GeneratedObjectEntry[] = [
|
|
4649
4709
|
{ name: 'id', value: modId },
|
|
@@ -4764,84 +4824,76 @@ async function generateModuleRegistryAppFromDiscovery(options: ModuleRegistryRen
|
|
|
4764
4824
|
i18nModuleDecls.push(objectLiteral(i18nModuleEntries))
|
|
4765
4825
|
}
|
|
4766
4826
|
|
|
4767
|
-
|
|
4827
|
+
exitOnMissingModuleRequires(discovery.identities, requiresByModule)
|
|
4828
|
+
|
|
4829
|
+
if (selectsRegistryOutput(options, 'app')) {
|
|
4830
|
+
writeCrudFormSectionRegistries({
|
|
4831
|
+
prepared: discovery.getCrudFormSections(),
|
|
4832
|
+
modules: discovery.modules,
|
|
4833
|
+
identities: discovery.identities,
|
|
4834
|
+
requiresByModule,
|
|
4835
|
+
outputDir,
|
|
4836
|
+
structureChecksum: discovery.getStructureChecksum(),
|
|
4837
|
+
result,
|
|
4838
|
+
quiet,
|
|
4839
|
+
})
|
|
4840
|
+
}
|
|
4841
|
+
|
|
4842
|
+
writeOutput('app', 'modules.app.generated.ts', () => renderAstModuleRegistryFile({
|
|
4768
4843
|
fileName: 'modules.app.generated.ts',
|
|
4769
4844
|
generator: 'registry (app version)',
|
|
4770
4845
|
imports,
|
|
4771
4846
|
moduleEntries: moduleDecls,
|
|
4772
4847
|
includeCreateElementImport: hasRouteComponents,
|
|
4773
4848
|
includeAbandonHookImport: hasAbandonHookWorkers,
|
|
4774
|
-
})
|
|
4775
|
-
|
|
4849
|
+
}))
|
|
4850
|
+
writeOutput('bootstrap', 'modules.bootstrap.generated.ts', () => renderAstModuleRegistryFile({
|
|
4776
4851
|
fileName: 'modules.bootstrap.generated.ts',
|
|
4777
4852
|
generator: 'registry (bootstrap version)',
|
|
4778
4853
|
imports: bootstrapImports,
|
|
4779
4854
|
moduleEntries: bootstrapModuleDecls,
|
|
4780
4855
|
includeAbandonHookImport: hasAbandonHookWorkers,
|
|
4781
|
-
})
|
|
4782
|
-
|
|
4856
|
+
}))
|
|
4857
|
+
writeOutput('i18n', 'modules.i18n.generated.ts', () => renderAstModuleRegistryFile({
|
|
4783
4858
|
fileName: 'modules.i18n.generated.ts',
|
|
4784
4859
|
generator: 'registry (i18n version)',
|
|
4785
4860
|
imports: i18nImports,
|
|
4786
4861
|
moduleEntries: i18nModuleDecls,
|
|
4787
4862
|
includeAbandonHookImport: hasAbandonHookWorkers,
|
|
4788
|
-
})
|
|
4789
|
-
|
|
4863
|
+
}))
|
|
4864
|
+
if (selectsRegistryOutput(options, 'i18n')) {
|
|
4865
|
+
const i18nLocales = [...i18nLocaleShards.keys()].sort((a, b) => a.localeCompare(b))
|
|
4866
|
+
const shardFileNames = new Set<string>()
|
|
4867
|
+
const expectedShardArtifacts = new Set<string>()
|
|
4868
|
+
for (const locale of i18nLocales) {
|
|
4869
|
+
const fileName = buildI18nLocaleShardFileName(locale)
|
|
4870
|
+
if (shardFileNames.has(fileName)) {
|
|
4871
|
+
throw new Error(`Locale names produce the same generated i18n shard file: ${locale}`)
|
|
4872
|
+
}
|
|
4873
|
+
shardFileNames.add(fileName)
|
|
4874
|
+
expectedShardArtifacts.add(fileName)
|
|
4875
|
+
expectedShardArtifacts.add(fileName.replace(/\.ts$/, '.checksum'))
|
|
4876
|
+
const shard = i18nLocaleShards.get(locale)!
|
|
4877
|
+
writeOutput('i18n', fileName, () => renderAstI18nLocaleRegistryFile({
|
|
4878
|
+
fileName,
|
|
4879
|
+
imports: shard.imports,
|
|
4880
|
+
moduleEntries: shard.moduleDecls,
|
|
4881
|
+
}))
|
|
4882
|
+
}
|
|
4883
|
+
removeStaleI18nLocaleShards(outputDir, expectedShardArtifacts, result)
|
|
4884
|
+
writeOutput('i18n', 'modules.i18n.loaders.generated.ts', () => renderI18nLocaleLoadersFile(i18nLocales))
|
|
4885
|
+
}
|
|
4886
|
+
writeOutput('bootstrap', 'bootstrap-modules.generated.ts', () => renderAstLegacyAliasFile({
|
|
4790
4887
|
fileName: 'bootstrap-modules.generated.ts',
|
|
4791
4888
|
exportName: 'bootstrapModules',
|
|
4792
4889
|
exportType: 'Module[]',
|
|
4793
4890
|
sourceFileName: 'modules.bootstrap.generated.ts',
|
|
4794
4891
|
initializer: identifier('modules'),
|
|
4795
|
-
})
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
const structureChecksum = discovery.getStructureChecksum()
|
|
4800
|
-
writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet })
|
|
4801
|
-
writeGeneratedFile({ outFile: bootstrapOutFile, checksumFile: bootstrapChecksumFile, content: bootstrapOutput, structureChecksum, result, quiet })
|
|
4802
|
-
writeGeneratedFile({ outFile: i18nOutFile, checksumFile: i18nChecksumFile, content: i18nOutput, structureChecksum, result, quiet })
|
|
4803
|
-
const i18nLocales = [...i18nLocaleShards.keys()].sort((a, b) => a.localeCompare(b))
|
|
4804
|
-
const shardFileNames = new Set<string>()
|
|
4805
|
-
const expectedShardArtifacts = new Set<string>()
|
|
4806
|
-
for (const locale of i18nLocales) {
|
|
4807
|
-
const fileName = buildI18nLocaleShardFileName(locale)
|
|
4808
|
-
if (shardFileNames.has(fileName)) {
|
|
4809
|
-
throw new Error(`Locale names produce the same generated i18n shard file: ${locale}`)
|
|
4810
|
-
}
|
|
4811
|
-
shardFileNames.add(fileName)
|
|
4812
|
-
expectedShardArtifacts.add(fileName)
|
|
4813
|
-
expectedShardArtifacts.add(fileName.replace(/\.ts$/, '.checksum'))
|
|
4814
|
-
const shard = i18nLocaleShards.get(locale)!
|
|
4815
|
-
const content = renderAstI18nLocaleRegistryFile({
|
|
4816
|
-
fileName,
|
|
4817
|
-
imports: shard.imports,
|
|
4818
|
-
moduleEntries: shard.moduleDecls,
|
|
4819
|
-
})
|
|
4820
|
-
writeGeneratedFile({
|
|
4821
|
-
outFile: path.join(outputDir, fileName),
|
|
4822
|
-
checksumFile: path.join(outputDir, fileName.replace(/\.ts$/, '.checksum')),
|
|
4823
|
-
content,
|
|
4824
|
-
structureChecksum,
|
|
4825
|
-
result,
|
|
4826
|
-
quiet,
|
|
4827
|
-
})
|
|
4892
|
+
}))
|
|
4893
|
+
writeOutput('enabled-ids', 'enabled-module-ids.generated.ts', () => renderEnabledModuleIdsFile(enabled.map((entry) => entry.id)))
|
|
4894
|
+
if (!options.skipCommands) {
|
|
4895
|
+
writeOutput('commands', 'command-loaders.generated.ts', () => renderCommandLoadersFile(commandLoaderEntries))
|
|
4828
4896
|
}
|
|
4829
|
-
removeStaleI18nLocaleShards(outputDir, expectedShardArtifacts)
|
|
4830
|
-
writeGeneratedFile({
|
|
4831
|
-
outFile: i18nLoadersOutFile,
|
|
4832
|
-
checksumFile: i18nLoadersChecksumFile,
|
|
4833
|
-
content: renderI18nLocaleLoadersFile(i18nLocales),
|
|
4834
|
-
structureChecksum,
|
|
4835
|
-
result,
|
|
4836
|
-
quiet,
|
|
4837
|
-
})
|
|
4838
|
-
writeGeneratedFile({ outFile: legacyOutFile, checksumFile: legacyChecksumFile, content: legacyOutput, structureChecksum, result, quiet })
|
|
4839
|
-
|
|
4840
|
-
const enabledIdsOutput = renderEnabledModuleIdsFile(enabled.map((entry) => entry.id))
|
|
4841
|
-
writeGeneratedFile({ outFile: enabledIdsOutFile, checksumFile: enabledIdsChecksumFile, content: enabledIdsOutput, structureChecksum, result, quiet })
|
|
4842
|
-
|
|
4843
|
-
const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries)
|
|
4844
|
-
writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet })
|
|
4845
4897
|
|
|
4846
4898
|
return result
|
|
4847
4899
|
}
|
|
@@ -4859,16 +4911,11 @@ async function generateModuleRegistryCliFromDiscovery(options: ModuleRegistryRen
|
|
|
4859
4911
|
const { resolver, quiet = false } = options
|
|
4860
4912
|
const { discovery } = options
|
|
4861
4913
|
const result = createGeneratorResult()
|
|
4914
|
+
if (options.outputGroups !== undefined && !options.outputGroups.some((group) =>
|
|
4915
|
+
['cli', 'supervisor'].includes(group) || (group === 'commands' && !options.skipCommands),
|
|
4916
|
+
)) return result
|
|
4917
|
+
const writeOutput = createRegistryOutputWriter(options, result)
|
|
4862
4918
|
|
|
4863
|
-
const outputDir = resolver.getOutputDir()
|
|
4864
|
-
const outFile = path.join(outputDir, 'modules.cli.generated.ts')
|
|
4865
|
-
const checksumFile = path.join(outputDir, 'modules.cli.generated.checksum')
|
|
4866
|
-
const legacyOutFile = path.join(outputDir, 'cli-modules.generated.ts')
|
|
4867
|
-
const legacyChecksumFile = path.join(outputDir, 'cli-modules.generated.checksum')
|
|
4868
|
-
const commandLoadersOutFile = path.join(outputDir, 'command-loaders.generated.ts')
|
|
4869
|
-
const commandLoadersChecksumFile = path.join(outputDir, 'command-loaders.generated.checksum')
|
|
4870
|
-
const devSupervisorOutFile = path.join(outputDir, DEV_SUPERVISOR_MANIFEST_FILE)
|
|
4871
|
-
const devSupervisorChecksumFile = path.join(outputDir, 'dev-supervisor.generated.checksum')
|
|
4872
4919
|
|
|
4873
4920
|
const enabled = discovery.enabled
|
|
4874
4921
|
const imports: string[] = []
|
|
@@ -4879,8 +4926,10 @@ async function generateModuleRegistryCliFromDiscovery(options: ModuleRegistryRen
|
|
|
4879
4926
|
const commandLoaderEntries: CommandLoaderGenerationEntry[] = []
|
|
4880
4927
|
const devSupervisorWorkers: DevSupervisorWorkerDescriptor[] = []
|
|
4881
4928
|
let schedulerStartStatus: DevSupervisorSchedulerStartStatus = 'missing-module'
|
|
4882
|
-
let requiresFullBootstrap =
|
|
4929
|
+
let requiresFullBootstrap = selectsRegistryOutput(options, 'supervisor') && (
|
|
4930
|
+
enabled.some((entry) => entry.devSupervisorRequiresFullBootstrap === true)
|
|
4883
4931
|
|| appDeclaresProgrammaticDevSupervisorOverrides(resolver.getAppDir())
|
|
4932
|
+
)
|
|
4884
4933
|
|
|
4885
4934
|
for (const discovered of discovery.modules) {
|
|
4886
4935
|
const { modId, imps, appImportBase } = discovered
|
|
@@ -5019,7 +5068,7 @@ async function generateModuleRegistryCliFromDiscovery(options: ModuleRegistryRen
|
|
|
5019
5068
|
|
|
5020
5069
|
const moduleEntries: GeneratedObjectEntry[] = [
|
|
5021
5070
|
{ name: 'id', value: modId },
|
|
5022
|
-
{ name: 'customFieldSets', value: buildModuleCustomFieldSetsValue({ fieldsImportName, customEntitiesImportName, moduleId: modId }) },
|
|
5071
|
+
{ name: 'customFieldSets', value: buildModuleCustomFieldSetsValue({ fieldsImportName, customEntitiesImportName, moduleId: modId, compiledFields: discovery.getCrudFormSections().compiled.customFieldSetsByModule.get(modId) }) },
|
|
5023
5072
|
]
|
|
5024
5073
|
|
|
5025
5074
|
if (infoImportName) {
|
|
@@ -5138,14 +5187,16 @@ async function generateModuleRegistryCliFromDiscovery(options: ModuleRegistryRen
|
|
|
5138
5187
|
moduleDecls.push(objectLiteral(moduleEntries))
|
|
5139
5188
|
}
|
|
5140
5189
|
|
|
5141
|
-
|
|
5190
|
+
exitOnMissingModuleRequires(discovery.identities, requiresByModule)
|
|
5191
|
+
|
|
5192
|
+
writeOutput('cli', 'modules.cli.generated.ts', () => renderAstModuleRegistryFile({
|
|
5142
5193
|
fileName: 'modules.cli.generated.ts',
|
|
5143
5194
|
generator: 'registry (CLI version)',
|
|
5144
5195
|
imports,
|
|
5145
5196
|
moduleEntries: moduleDecls,
|
|
5146
5197
|
includeAbandonHookImport: hasAbandonHookWorkers,
|
|
5147
|
-
})
|
|
5148
|
-
|
|
5198
|
+
}))
|
|
5199
|
+
writeOutput('cli', 'cli-modules.generated.ts', () => renderAstLegacyAliasFile({
|
|
5149
5200
|
fileName: 'cli-modules.generated.ts',
|
|
5150
5201
|
exportName: 'cliModules',
|
|
5151
5202
|
exportType: "Pick<Module, 'id' | 'cli'>[]",
|
|
@@ -5159,53 +5210,46 @@ async function generateModuleRegistryCliFromDiscovery(options: ModuleRegistryRen
|
|
|
5159
5210
|
])),
|
|
5160
5211
|
}),
|
|
5161
5212
|
]),
|
|
5162
|
-
})
|
|
5163
|
-
|
|
5164
|
-
exitOnMissingModuleRequires(discovery.identities, requiresByModule)
|
|
5165
|
-
|
|
5166
|
-
const structureChecksum = discovery.getStructureChecksum()
|
|
5167
|
-
writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet })
|
|
5168
|
-
writeGeneratedFile({ outFile: legacyOutFile, checksumFile: legacyChecksumFile, content: legacyOutput, structureChecksum, result, quiet })
|
|
5169
|
-
const devSupervisorOutput = `${JSON.stringify({
|
|
5213
|
+
}))
|
|
5214
|
+
writeOutput('supervisor', DEV_SUPERVISOR_MANIFEST_FILE, () => `${JSON.stringify({
|
|
5170
5215
|
version: DEV_SUPERVISOR_MANIFEST_VERSION,
|
|
5171
5216
|
workers: devSupervisorWorkers,
|
|
5172
5217
|
schedulerStartStatus,
|
|
5173
5218
|
requiresFullBootstrap,
|
|
5174
|
-
}, null, 2)}\n`
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
content: devSupervisorOutput,
|
|
5179
|
-
structureChecksum,
|
|
5180
|
-
result,
|
|
5181
|
-
quiet,
|
|
5182
|
-
})
|
|
5183
|
-
const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries)
|
|
5184
|
-
writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet })
|
|
5219
|
+
}, null, 2)}\n`)
|
|
5220
|
+
if (!options.skipCommands) {
|
|
5221
|
+
writeOutput('commands', 'command-loaders.generated.ts', () => renderCommandLoadersFile(commandLoaderEntries))
|
|
5222
|
+
}
|
|
5185
5223
|
|
|
5186
5224
|
return result
|
|
5187
5225
|
}
|
|
5188
5226
|
|
|
5189
5227
|
export async function generateModuleRegistry(options: ModuleRegistryOptions): Promise<GeneratorResult> {
|
|
5228
|
+
if (options.outputGroups?.length === 0) return createGeneratorResult()
|
|
5190
5229
|
const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)
|
|
5191
5230
|
return generateModuleRegistryFromDiscovery({ ...options, discovery })
|
|
5192
5231
|
}
|
|
5193
5232
|
|
|
5194
5233
|
export async function generateModuleRegistryApp(options: ModuleRegistryOptions): Promise<GeneratorResult> {
|
|
5234
|
+
if (options.outputGroups?.length === 0) return createGeneratorResult()
|
|
5195
5235
|
const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)
|
|
5196
5236
|
return generateModuleRegistryAppFromDiscovery({ ...options, discovery })
|
|
5197
5237
|
}
|
|
5198
5238
|
|
|
5199
5239
|
export async function generateModuleRegistryCli(options: ModuleRegistryOptions): Promise<GeneratorResult> {
|
|
5240
|
+
if (options.outputGroups?.length === 0) return createGeneratorResult()
|
|
5200
5241
|
const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)
|
|
5201
5242
|
return generateModuleRegistryCliFromDiscovery({ ...options, discovery })
|
|
5202
5243
|
}
|
|
5203
5244
|
|
|
5204
5245
|
export async function generateModuleRegistries(options: ModuleRegistryOptions): Promise<GeneratorResult[]> {
|
|
5246
|
+
if (options.outputGroups?.length === 0) {
|
|
5247
|
+
return [createGeneratorResult(), createGeneratorResult(), createGeneratorResult()]
|
|
5248
|
+
}
|
|
5205
5249
|
const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)
|
|
5206
5250
|
return [
|
|
5207
5251
|
await generateModuleRegistryFromDiscovery({ ...options, discovery }),
|
|
5208
|
-
await generateModuleRegistryAppFromDiscovery({ ...options, discovery }),
|
|
5209
|
-
await generateModuleRegistryCliFromDiscovery({ ...options, discovery }),
|
|
5252
|
+
await generateModuleRegistryAppFromDiscovery({ ...options, discovery, skipCommands: true }),
|
|
5253
|
+
await generateModuleRegistryCliFromDiscovery({ ...options, discovery, skipCommands: true }),
|
|
5210
5254
|
]
|
|
5211
5255
|
}
|