@open-mercato/cli 0.11.1-develop.8593.1.50784dae35 → 0.11.1-develop.8687.1.adb16f62b3
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 +6 -2
- package/AGENTS.md +2 -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 +11067 -7122
- package/dist/agentic/guides/module-facts.v2.json +11055 -7094
- 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/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/workers.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/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/currencies/di-registrations-rich.md +1 -1
- package/dist/agentic/guides/modules/currencies/di-service-tokens.md +1 -1
- package/dist/agentic/guides/modules/currencies/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/currencies/index.md +3 -2
- 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/ledger/acl-features.md +16 -0
- package/dist/agentic/guides/modules/ledger/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/ledger/backend-pages.md +21 -0
- package/dist/agentic/guides/modules/ledger/domain-commands.md +22 -0
- package/dist/agentic/guides/modules/ledger/encryption.md +11 -0
- package/dist/agentic/guides/modules/ledger/entities.md +17 -0
- package/dist/agentic/guides/modules/ledger/events.md +19 -0
- package/dist/agentic/guides/modules/ledger/exact-override-targets.md +30 -0
- package/dist/agentic/guides/modules/ledger/index.md +22 -0
- package/dist/agentic/guides/modules/ledger/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/ledger/setup.md +11 -0
- package/dist/agentic/guides/modules/ledger/umes-hosts.md +26 -0
- 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/active-extension-bindings.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 +12 -16
- 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-watch-plan.js +4 -0
- package/dist/lib/generate-watch-plan.js.map +2 -2
- package/dist/lib/generate-watch-runner.js +1 -0
- package/dist/lib/generate-watch-runner.js.map +2 -2
- package/dist/lib/generate-watch-structure.js +2 -0
- package/dist/lib/generate-watch-structure.js.map +2 -2
- 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/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 +75 -3
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/generators/openapi.js +27 -17
- package/dist/lib/generators/openapi.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/scaffold/field-dsl.js +393 -0
- package/dist/lib/scaffold/field-dsl.js.map +7 -0
- package/dist/lib/scaffold/index.js +412 -0
- package/dist/lib/scaffold/index.js.map +7 -0
- package/dist/lib/scaffold/targets.js +42 -0
- package/dist/lib/scaffold/targets.js.map +7 -0
- package/dist/lib/scaffold/templates/create-page.js +52 -0
- package/dist/lib/scaffold/templates/create-page.js.map +7 -0
- package/dist/lib/scaffold/templates/detail-page.js +186 -0
- package/dist/lib/scaffold/templates/detail-page.js.map +7 -0
- package/dist/lib/scaffold/templates/form-config.js +42 -0
- package/dist/lib/scaffold/templates/form-config.js.map +7 -0
- package/dist/lib/scaffold/templates/index.js +27 -0
- package/dist/lib/scaffold/templates/index.js.map +7 -0
- package/dist/lib/scaffold/templates/list-page.js +190 -0
- package/dist/lib/scaffold/templates/list-page.js.map +7 -0
- package/dist/lib/scaffold/templates/metas.js +47 -0
- package/dist/lib/scaffold/templates/metas.js.map +7 -0
- package/dist/lib/scaffold/templates/module-files.js +85 -0
- package/dist/lib/scaffold/templates/module-files.js.map +7 -0
- package/dist/lib/single-instance-strategy-guard.js +26 -3
- package/dist/lib/single-instance-strategy-guard.js.map +2 -2
- package/dist/lib/testing/integration-discovery.js +32 -3
- package/dist/lib/testing/integration-discovery.js.map +2 -2
- package/dist/lib/testing/integration.js +232 -8
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +40 -7
- 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__/agentic-workflows-ownership.test.ts +79 -0
- package/src/lib/__tests__/cache-provider-manifest.test.ts +76 -0
- package/src/lib/__tests__/generate-watch-plan.test.ts +3 -2
- package/src/lib/__tests__/generate-watch-runner.test.ts +13 -1
- package/src/lib/__tests__/generate-watch-structure.test.ts +34 -0
- 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-watch-plan.ts +6 -3
- package/src/lib/generate-watch-runner.ts +1 -0
- package/src/lib/generate-watch-structure.ts +5 -1
- 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__/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 +60 -13
- package/src/lib/generators/__tests__/structural-contracts.test.ts +2 -2
- package/src/lib/generators/ast/writers.ts +6 -1
- package/src/lib/generators/cache-providers.ts +111 -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 +80 -4
- package/src/lib/generators/openapi.ts +31 -20
- package/src/lib/post-generate-invalidation.ts +28 -1
- package/src/lib/resolver.ts +218 -0
- package/src/lib/scaffold/__tests__/__snapshots__/scaffold-golden.test.ts.snap +1742 -0
- package/src/lib/scaffold/__tests__/helpers.ts +75 -0
- package/src/lib/scaffold/__tests__/scaffold-ds-contract.test.ts +248 -0
- package/src/lib/scaffold/__tests__/scaffold-golden.test.ts +267 -0
- package/src/lib/scaffold/__tests__/scaffold-runtime.test.tsx +193 -0
- package/src/lib/scaffold/field-dsl.ts +491 -0
- package/src/lib/scaffold/index.ts +531 -0
- package/src/lib/scaffold/targets.ts +68 -0
- package/src/lib/scaffold/templates/create-page.ts +52 -0
- package/src/lib/scaffold/templates/detail-page.ts +190 -0
- package/src/lib/scaffold/templates/form-config.ts +42 -0
- package/src/lib/scaffold/templates/index.ts +27 -0
- package/src/lib/scaffold/templates/list-page.ts +190 -0
- package/src/lib/scaffold/templates/metas.ts +48 -0
- package/src/lib/scaffold/templates/module-files.ts +87 -0
- package/src/lib/single-instance-strategy-guard.ts +51 -1
- package/src/lib/testing/__tests__/integration-app-only-playwright.test.ts +225 -0
- package/src/lib/testing/__tests__/integration-app-only.test.ts +320 -0
- package/src/lib/testing/__tests__/integration-discovery.test.ts +45 -1
- package/src/lib/testing/integration-discovery.ts +32 -2
- package/src/lib/testing/integration.ts +293 -11
- package/src/mercato.ts +39 -5
- package/dist/agentic/guides/modules/dashboards/incoming-installed-contributions.md +0 -11
package/dist/lib/resolver.js
CHANGED
|
@@ -23,13 +23,87 @@ function pkgRootFor(rootDir, from, isMonorepo = true, appDir = rootDir) {
|
|
|
23
23
|
}
|
|
24
24
|
return resolveInstalledPackageRootWithRequire(packageName, appDir) ?? path.join(rootDir, "node_modules", packageName);
|
|
25
25
|
}
|
|
26
|
+
function staticFormSectionOverrides(expression) {
|
|
27
|
+
const initializers = /* @__PURE__ */ new Map();
|
|
28
|
+
for (const statement of expression.getSourceFile().statements) {
|
|
29
|
+
if (!ts.isVariableStatement(statement) || !(statement.declarationList.flags & ts.NodeFlags.Const)) continue;
|
|
30
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
31
|
+
if (ts.isIdentifier(declaration.name) && declaration.initializer) initializers.set(declaration.name.text, declaration.initializer);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function unwrap(value) {
|
|
35
|
+
const visited = /* @__PURE__ */ new Set();
|
|
36
|
+
while (true) {
|
|
37
|
+
if (ts.isAsExpression(value) || ts.isSatisfiesExpression(value) || ts.isParenthesizedExpression(value)) {
|
|
38
|
+
value = value.expression;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (!ts.isIdentifier(value) || visited.has(value.text)) return value;
|
|
42
|
+
const resolved = initializers.get(value.text);
|
|
43
|
+
if (!resolved) return value;
|
|
44
|
+
visited.add(value.text);
|
|
45
|
+
value = resolved;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function fields(value, visited = /* @__PURE__ */ new Set()) {
|
|
49
|
+
if (!value) return /* @__PURE__ */ new Map();
|
|
50
|
+
const node = unwrap(value);
|
|
51
|
+
if (!ts.isObjectLiteralExpression(node) || visited.has(node)) return /* @__PURE__ */ new Map();
|
|
52
|
+
const next = /* @__PURE__ */ new Set([...visited, node]);
|
|
53
|
+
const output = /* @__PURE__ */ new Map();
|
|
54
|
+
for (const property of node.properties) {
|
|
55
|
+
if (ts.isSpreadAssignment(property)) for (const [key, entry] of fields(property.expression, next)) output.set(key, entry);
|
|
56
|
+
else if (ts.isShorthandPropertyAssignment(property)) output.set(property.name.text, property.name);
|
|
57
|
+
else if (ts.isPropertyAssignment(property) && (ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name))) {
|
|
58
|
+
output.set(property.name.text, property.initializer);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return output;
|
|
62
|
+
}
|
|
63
|
+
const entries = fields(fields(fields(expression).get("forms")).get("sections"));
|
|
64
|
+
const result = /* @__PURE__ */ new Map();
|
|
65
|
+
function text(input) {
|
|
66
|
+
const node = input ? unwrap(input) : void 0;
|
|
67
|
+
return node && ts.isStringLiteralLike(node) ? node.text : void 0;
|
|
68
|
+
}
|
|
69
|
+
for (const [key, value] of entries) {
|
|
70
|
+
if (unwrap(value).kind === ts.SyntaxKind.NullKeyword) {
|
|
71
|
+
result.set(key, null);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const options = fields(value);
|
|
75
|
+
const operation = text(options.get("operation"));
|
|
76
|
+
const contributionId = text(options.get("contributionId"));
|
|
77
|
+
if (!contributionId || operation !== "add" && operation !== "hide" && operation !== "replace") continue;
|
|
78
|
+
if (operation !== "add") {
|
|
79
|
+
result.set(key, { operation, contributionId });
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const placement = fields(options.get("placement"));
|
|
83
|
+
const rawPosition = placement.get("position");
|
|
84
|
+
const positionNode = rawPosition ? unwrap(rawPosition) : void 0;
|
|
85
|
+
const position = positionNode && ts.isPropertyAccessExpression(positionNode) && ts.isIdentifier(positionNode.expression) && positionNode.expression.text === "InjectionPosition" && ["First", "Last", "Before", "After"].includes(positionNode.name.text) ? positionNode.name.text.toLowerCase() : text(rawPosition);
|
|
86
|
+
const relativeTo = text(placement.get("relativeTo"));
|
|
87
|
+
const allowed = /* @__PURE__ */ new Set(["first", "last", "before", "after"]);
|
|
88
|
+
if (placement.size && (!position || !allowed.has(position))) continue;
|
|
89
|
+
result.set(key, { operation, contributionId, ...position ? {
|
|
90
|
+
placement: { position, relativeTo }
|
|
91
|
+
} : {} });
|
|
92
|
+
}
|
|
93
|
+
return result.size ? Object.fromEntries(result) : void 0;
|
|
94
|
+
}
|
|
26
95
|
function parseModuleEntryFromObjectLiteral(node) {
|
|
27
96
|
let id = null;
|
|
28
97
|
let from = null;
|
|
29
98
|
let locator;
|
|
30
99
|
let packageName;
|
|
31
100
|
let devSupervisorRequiresFullBootstrap = false;
|
|
101
|
+
let formSectionOverrides;
|
|
32
102
|
for (const property of node.properties) {
|
|
103
|
+
if (ts.isShorthandPropertyAssignment(property) && property.name.text === "overrides") {
|
|
104
|
+
formSectionOverrides = staticFormSectionOverrides(property.name);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
33
107
|
if (!ts.isPropertyAssignment(property)) continue;
|
|
34
108
|
const key = ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name) ? property.name.text : null;
|
|
35
109
|
if (key === "id" && ts.isStringLiteralLike(property.initializer)) {
|
|
@@ -45,6 +119,7 @@ function parseModuleEntryFromObjectLiteral(node) {
|
|
|
45
119
|
locator = property.initializer.text;
|
|
46
120
|
}
|
|
47
121
|
if (key === "overrides") {
|
|
122
|
+
formSectionOverrides = staticFormSectionOverrides(property.initializer);
|
|
48
123
|
if (!ts.isObjectLiteralExpression(property.initializer)) {
|
|
49
124
|
devSupervisorRequiresFullBootstrap = true;
|
|
50
125
|
continue;
|
|
@@ -69,7 +144,8 @@ function parseModuleEntryFromObjectLiteral(node) {
|
|
|
69
144
|
from: from ?? "@open-mercato/core",
|
|
70
145
|
...locator ? { locator } : {},
|
|
71
146
|
...packageName ? { packageName } : {},
|
|
72
|
-
...devSupervisorRequiresFullBootstrap ? { devSupervisorRequiresFullBootstrap: true } : {}
|
|
147
|
+
...devSupervisorRequiresFullBootstrap ? { devSupervisorRequiresFullBootstrap: true } : {},
|
|
148
|
+
...formSectionOverrides ? { formSectionOverrides } : {}
|
|
73
149
|
};
|
|
74
150
|
}
|
|
75
151
|
function parseProcessEnvAccess(node, env) {
|
|
@@ -184,10 +260,128 @@ function collectPushEntriesFromStatement(statement, env, targetVariableName, sco
|
|
|
184
260
|
return entry ? [entry] : [];
|
|
185
261
|
});
|
|
186
262
|
}
|
|
263
|
+
function validateFormSectionGates(sourceFile, targetVariableName) {
|
|
264
|
+
const initializers = /* @__PURE__ */ new Map();
|
|
265
|
+
for (const statement of sourceFile.statements) {
|
|
266
|
+
if (!ts.isVariableStatement(statement)) continue;
|
|
267
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
268
|
+
let mapBinding2 = function(binding, value) {
|
|
269
|
+
if (ts.isIdentifier(binding)) initializers.set(binding.text, value);
|
|
270
|
+
else for (const element of binding.elements) if (ts.isBindingElement(element)) mapBinding2(element.name, value);
|
|
271
|
+
};
|
|
272
|
+
var mapBinding = mapBinding2;
|
|
273
|
+
const initializer = declaration.initializer;
|
|
274
|
+
if (!initializer) continue;
|
|
275
|
+
mapBinding2(declaration.name, initializer);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function serverEnvironmentReads(expression) {
|
|
279
|
+
const found = /* @__PURE__ */ new Set();
|
|
280
|
+
const seen = /* @__PURE__ */ new Set();
|
|
281
|
+
function visit(node) {
|
|
282
|
+
if (ts.isIdentifier(node) && !seen.has(node.text)) {
|
|
283
|
+
seen.add(node.text);
|
|
284
|
+
const initializer = initializers.get(node.text);
|
|
285
|
+
if (initializer && node.text !== targetVariableName) visit(initializer);
|
|
286
|
+
}
|
|
287
|
+
if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "process" && node.name.text === "env") {
|
|
288
|
+
found.add("<dynamic process.env>");
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {
|
|
292
|
+
const target = node.expression;
|
|
293
|
+
if (ts.isPropertyAccessExpression(target) && target.name.text === "env" && ts.isIdentifier(target.expression) && target.expression.text === "process") {
|
|
294
|
+
const environmentKey = ts.isPropertyAccessExpression(node) ? node.name.text : ts.isStringLiteralLike(node.argumentExpression) ? node.argumentExpression.text : "<dynamic process.env>";
|
|
295
|
+
if (!environmentKey.startsWith("NEXT_PUBLIC_")) found.add(environmentKey);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
ts.forEachChild(node, visit);
|
|
300
|
+
}
|
|
301
|
+
visit(expression);
|
|
302
|
+
return [...found].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
303
|
+
}
|
|
304
|
+
function assertGates(gates) {
|
|
305
|
+
const serverKeys = [...new Set(gates.flatMap(serverEnvironmentReads))].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
306
|
+
if (serverKeys.length) {
|
|
307
|
+
throw new Error(`[resolver] forms.sections in src/modules.ts requires browser-visible module gating; server-only: ${serverKeys.join(", ")}`);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function inspectOverride(node, keys, gates, seen = /* @__PURE__ */ new Set()) {
|
|
311
|
+
if (ts.isParenthesizedExpression(node) || ts.isSatisfiesExpression(node) || ts.isAsExpression(node)) {
|
|
312
|
+
inspectOverride(node.expression, keys, gates, seen);
|
|
313
|
+
} else if (ts.isConditionalExpression(node)) {
|
|
314
|
+
inspectOverride(node.whenTrue, keys, [...gates, node.condition], seen);
|
|
315
|
+
inspectOverride(node.whenFalse, keys, [...gates, node.condition], seen);
|
|
316
|
+
} else if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
317
|
+
inspectOverride(node.right, keys, [...gates, node.left], seen);
|
|
318
|
+
} else if (ts.isIdentifier(node) && !seen.has(node.text) && initializers.has(node.text)) {
|
|
319
|
+
const initializer = initializers.get(node.text);
|
|
320
|
+
if (initializer) inspectOverride(initializer, keys, gates, /* @__PURE__ */ new Set([...seen, node.text]));
|
|
321
|
+
} else if (!keys.length) {
|
|
322
|
+
assertGates([...gates, node]);
|
|
323
|
+
} else if (ts.isObjectLiteralExpression(node)) {
|
|
324
|
+
for (const property of node.properties) {
|
|
325
|
+
if (ts.isSpreadAssignment(property)) inspectOverride(property.expression, keys, gates, seen);
|
|
326
|
+
if (ts.isShorthandPropertyAssignment(property) && property.name.text === keys[0]) {
|
|
327
|
+
inspectOverride(property.name, keys.slice(1), gates, seen);
|
|
328
|
+
}
|
|
329
|
+
if (ts.isPropertyAssignment(property) && (ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name)) && property.name.text === keys[0]) {
|
|
330
|
+
inspectOverride(property.initializer, keys.slice(1), gates, seen);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function inspectModules(node, gates, seen = /* @__PURE__ */ new Set()) {
|
|
336
|
+
if (ts.isIdentifier(node) && !seen.has(node.text)) {
|
|
337
|
+
const initializer = initializers.get(node.text);
|
|
338
|
+
if (initializer && node.text !== targetVariableName) inspectModules(initializer, gates, /* @__PURE__ */ new Set([...seen, node.text]));
|
|
339
|
+
} else if (ts.isObjectLiteralExpression(node)) {
|
|
340
|
+
inspectOverride(node, ["overrides", "forms", "sections"], gates);
|
|
341
|
+
} else if (ts.isConditionalExpression(node)) {
|
|
342
|
+
inspectModules(node.whenTrue, [...gates, node.condition], seen);
|
|
343
|
+
inspectModules(node.whenFalse, [...gates, node.condition], seen);
|
|
344
|
+
} else {
|
|
345
|
+
ts.forEachChild(node, (child) => inspectModules(child, gates, seen));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function inspectStatement(statement, gates) {
|
|
349
|
+
if (ts.isBlock(statement)) {
|
|
350
|
+
for (const child of statement.statements) inspectStatement(child, gates);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
if (ts.isIfStatement(statement)) {
|
|
354
|
+
const branchGates = [...gates, statement.expression];
|
|
355
|
+
inspectStatement(statement.thenStatement, branchGates);
|
|
356
|
+
if (statement.elseStatement) inspectStatement(statement.elseStatement, branchGates);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
if (ts.isExpressionStatement(statement)) inspectPush(statement.expression, gates);
|
|
360
|
+
}
|
|
361
|
+
function inspectPush(node, gates) {
|
|
362
|
+
if (ts.isParenthesizedExpression(node)) inspectPush(node.expression, gates);
|
|
363
|
+
if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {
|
|
364
|
+
inspectPush(node.right, [...gates, node.left]);
|
|
365
|
+
}
|
|
366
|
+
if (ts.isConditionalExpression(node)) {
|
|
367
|
+
inspectPush(node.whenTrue, [...gates, node.condition]);
|
|
368
|
+
inspectPush(node.whenFalse, [...gates, node.condition]);
|
|
369
|
+
}
|
|
370
|
+
if (!ts.isCallExpression(node)) return;
|
|
371
|
+
const { expression, arguments: entries } = node;
|
|
372
|
+
if (ts.isPropertyAccessExpression(expression) && expression.name.text === "push" && ts.isIdentifier(expression.expression) && expression.expression.text === targetVariableName) {
|
|
373
|
+
for (const entry of entries) inspectModules(entry, gates);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
const enabled = initializers.get(targetVariableName);
|
|
377
|
+
if (enabled) inspectModules(enabled, []);
|
|
378
|
+
for (const statement of sourceFile.statements) inspectStatement(statement, []);
|
|
379
|
+
}
|
|
187
380
|
function parseModulesFromSource(source, env = process.env) {
|
|
188
381
|
const sourceFile = ts.createSourceFile("modules.ts", source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
189
382
|
const modules = [];
|
|
190
383
|
const variableName = "enabledModules";
|
|
384
|
+
validateFormSectionGates(sourceFile, variableName);
|
|
191
385
|
const scope = /* @__PURE__ */ new Map();
|
|
192
386
|
let foundDeclaration = false;
|
|
193
387
|
for (const statement of sourceFile.statements) {
|
package/dist/lib/resolver.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/lib/resolver.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'node:path'\nimport fs from 'node:fs'\nimport ts from 'typescript-js'\nimport { parseBooleanWithDefault } from '@open-mercato/shared/lib/boolean'\nimport { resolveInstalledPackageRootWithRequire } from './module-package'\n\n/**\n * Resolved execution environment for the CLI.\n * Produced once by resolveEnvironment() and consumed by all subsystems.\n * Eliminates per-subsystem isMonorepo() branching and hardcoded path segments.\n */\nexport type CliEnvironment = {\n /** Whether the CLI is running inside a Yarn/npm workspace monorepo. */\n mode: 'monorepo' | 'standalone'\n /** Workspace or project root (where package.json / node_modules live). */\n rootDir: string\n /** Next.js application directory (contains src/, package.json, next.config.*). */\n appDir: string\n /**\n * Resolve the root directory of an installed @open-mercato package.\n * Monorepo: packages/<pkg>/ Standalone: node_modules/<pkg>/\n */\n packageRoot: (packageName: string) => string\n}\n\nexport type ModuleEntry = {\n id: string\n from?: '@open-mercato/core' | '@app' | string\n locator?: string\n packageName?: string\n devSupervisorRequiresFullBootstrap?: boolean\n}\n\nexport type PackageInfo = {\n name: string\n version?: string | null\n path: string\n modulesPath: string\n}\n\nexport interface PackageResolver {\n isMonorepo(): boolean\n getRootDir(): string\n getAppDir(): string\n getOutputDir(): string\n getModulesConfigPath(): string\n discoverPackages(): PackageInfo[]\n loadEnabledModules(): ModuleEntry[]\n getModulePaths(entry: ModuleEntry): { appBase: string; pkgBase: string }\n getModuleImportBase(entry: ModuleEntry): { appBase: string; pkgBase: string }\n getPackageOutputDir(packageName: string): string\n getPackageRoot(from?: string): string\n}\n\nfunction pkgDirFor(rootDir: string, from?: string, isMonorepo = true, appDir = rootDir): string {\n const packageRoot = pkgRootFor(rootDir, from, isMonorepo, appDir)\n const sourceModules = path.join(packageRoot, 'src', 'modules')\n const distModules = path.join(packageRoot, 'dist', 'modules')\n const workspacePackage = isMonorepo && packageRoot.startsWith(path.join(rootDir, 'packages') + path.sep)\n if (workspacePackage && fs.existsSync(sourceModules)) return sourceModules\n if (fs.existsSync(distModules)) return distModules\n return sourceModules\n}\n\nfunction pkgRootFor(rootDir: string, from?: string, isMonorepo = true, appDir = rootDir): string {\n const packageName = from || '@open-mercato/core'\n if (isMonorepo) {\n const workspaceMatch = packageName.match(/^@open-mercato\\/(.+)$/)\n if (workspaceMatch) {\n const workspaceRoot = path.join(rootDir, 'packages', workspaceMatch[1])\n if (fs.existsSync(workspaceRoot)) return workspaceRoot\n }\n }\n return resolveInstalledPackageRootWithRequire(packageName, appDir) ?? path.join(rootDir, 'node_modules', packageName)\n}\n\nfunction parseModuleEntryFromObjectLiteral(node: ts.ObjectLiteralExpression): ModuleEntry | null {\n let id: string | null = null\n let from: string | null = null\n let locator: string | undefined\n let packageName: string | undefined\n let devSupervisorRequiresFullBootstrap = false\n for (const property of node.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const key = ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name)\n ? property.name.text\n : null\n if (key === 'id' && ts.isStringLiteralLike(property.initializer)) {\n id = property.initializer.text\n }\n if (key === 'from' && ts.isStringLiteralLike(property.initializer)) {\n from = property.initializer.text\n }\n if (key === 'packageName' && ts.isStringLiteralLike(property.initializer)) {\n packageName = property.initializer.text\n }\n if (key === 'locator' && ts.isStringLiteralLike(property.initializer)) {\n locator = property.initializer.text\n }\n if (key === 'overrides') {\n if (!ts.isObjectLiteralExpression(property.initializer)) {\n devSupervisorRequiresFullBootstrap = true\n continue\n }\n for (const overrideProperty of property.initializer.properties) {\n if (ts.isSpreadAssignment(overrideProperty)) {\n devSupervisorRequiresFullBootstrap = true\n break\n }\n if (!ts.isPropertyAssignment(overrideProperty)) continue\n const overrideKey = ts.isIdentifier(overrideProperty.name) || ts.isStringLiteralLike(overrideProperty.name)\n ? overrideProperty.name.text\n : null\n if (overrideKey === 'workers' || overrideKey === 'cli') {\n devSupervisorRequiresFullBootstrap = true\n break\n }\n }\n }\n }\n if (!id) return null\n return {\n id,\n from: from ?? '@open-mercato/core',\n ...(locator ? { locator } : {}),\n ...(packageName ? { packageName } : {}),\n ...(devSupervisorRequiresFullBootstrap ? { devSupervisorRequiresFullBootstrap: true } : {}),\n }\n}\n\nfunction parseProcessEnvAccess(\n node: ts.Expression,\n env: NodeJS.ProcessEnv,\n): { matched: boolean; value: string | undefined } {\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name)) {\n const target = node.expression\n if (\n ts.isPropertyAccessExpression(target)\n && ts.isIdentifier(target.expression)\n && target.expression.text === 'process'\n && target.name.text === 'env'\n ) {\n return { matched: true, value: env[node.name.text] }\n }\n }\n if (\n ts.isElementAccessExpression(node)\n && ts.isPropertyAccessExpression(node.expression)\n && ts.isIdentifier(node.expression.expression)\n && node.expression.expression.text === 'process'\n && node.expression.name.text === 'env'\n && ts.isStringLiteralLike(node.argumentExpression)\n ) {\n return { matched: true, value: env[node.argumentExpression.text] }\n }\n return { matched: false, value: undefined }\n}\n\nfunction evaluateStaticExpression(node: ts.Expression, env: NodeJS.ProcessEnv): unknown {\n return evaluateStaticExpressionWithScope(node, env, new Map())\n}\n\nfunction evaluateStaticExpressionWithScope(\n node: ts.Expression,\n env: NodeJS.ProcessEnv,\n scope: Map<string, unknown>,\n): unknown {\n if (ts.isParenthesizedExpression(node)) return evaluateStaticExpressionWithScope(node.expression, env, scope)\n if (ts.isIdentifier(node)) {\n return scope.get(node.text)\n }\n if (ts.isStringLiteralLike(node) || ts.isNoSubstitutionTemplateLiteral(node)) return node.text\n if (ts.isNumericLiteral(node)) return Number(node.text)\n if (node.kind === ts.SyntaxKind.TrueKeyword) return true\n if (node.kind === ts.SyntaxKind.FalseKeyword) return false\n if (node.kind === ts.SyntaxKind.NullKeyword) return null\n\n const envAccess = parseProcessEnvAccess(node, env)\n if (envAccess.matched) return envAccess.value\n\n if (ts.isPropertyAccessExpression(node)) {\n const target = evaluateStaticExpressionWithScope(node.expression, env, scope)\n if (target && typeof target === 'object' && node.name.text in target) {\n return (target as Record<string, unknown>)[node.name.text]\n }\n return undefined\n }\n\n if (ts.isPrefixUnaryExpression(node) && node.operator === ts.SyntaxKind.ExclamationToken) {\n return !Boolean(evaluateStaticExpressionWithScope(node.operand, env, scope))\n }\n\n if (ts.isBinaryExpression(node)) {\n if (node.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {\n return Boolean(evaluateStaticExpressionWithScope(node.left, env, scope))\n && Boolean(evaluateStaticExpressionWithScope(node.right, env, scope))\n }\n if (node.operatorToken.kind === ts.SyntaxKind.BarBarToken) {\n return Boolean(evaluateStaticExpressionWithScope(node.left, env, scope))\n || Boolean(evaluateStaticExpressionWithScope(node.right, env, scope))\n }\n if (node.operatorToken.kind === ts.SyntaxKind.EqualsEqualsEqualsToken) {\n return evaluateStaticExpressionWithScope(node.left, env, scope) === evaluateStaticExpressionWithScope(node.right, env, scope)\n }\n if (node.operatorToken.kind === ts.SyntaxKind.ExclamationEqualsEqualsToken) {\n return evaluateStaticExpressionWithScope(node.left, env, scope) !== evaluateStaticExpressionWithScope(node.right, env, scope)\n }\n }\n\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === 'parseBooleanWithDefault') {\n const rawValueNode = node.arguments[0]\n const fallbackNode = node.arguments[1]\n const rawValue = rawValueNode ? evaluateStaticExpressionWithScope(rawValueNode, env, scope) : undefined\n const fallbackValue = fallbackNode ? evaluateStaticExpressionWithScope(fallbackNode, env, scope) : false\n return parseBooleanWithDefault(typeof rawValue === 'string' ? rawValue : undefined, Boolean(fallbackValue))\n }\n\n if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === 'some') {\n const target = evaluateStaticExpressionWithScope(node.expression.expression, env, scope)\n const predicate = node.arguments[0]\n if (!Array.isArray(target) || !predicate) return undefined\n\n return target.some((entry) => {\n if (!ts.isArrowFunction(predicate) && !ts.isFunctionExpression(predicate)) return false\n\n const localScope = new Map(scope)\n const parameter = predicate.parameters[0]\n if (parameter && ts.isIdentifier(parameter.name)) {\n localScope.set(parameter.name.text, entry)\n }\n\n if (ts.isBlock(predicate.body)) {\n const returnStatement = predicate.body.statements.find((statement): statement is ts.ReturnStatement =>\n ts.isReturnStatement(statement),\n )\n if (!returnStatement?.expression) return false\n return Boolean(evaluateStaticExpressionWithScope(returnStatement.expression, env, localScope))\n }\n\n return Boolean(evaluateStaticExpressionWithScope(predicate.body, env, localScope))\n })\n }\n\n return undefined\n}\n\nfunction evaluateStaticCondition(\n node: ts.Expression,\n env: NodeJS.ProcessEnv,\n scope: Map<string, unknown>,\n): boolean {\n const evaluated = evaluateStaticExpressionWithScope(node, env, scope)\n return Boolean(evaluated)\n}\n\nfunction collectPushEntriesFromStatement(\n statement: ts.Statement,\n env: NodeJS.ProcessEnv,\n targetVariableName: string,\n scope: Map<string, unknown>,\n): ModuleEntry[] {\n if (ts.isBlock(statement)) {\n return statement.statements.flatMap((child) => collectPushEntriesFromStatement(child, env, targetVariableName, scope))\n }\n\n if (ts.isIfStatement(statement)) {\n if (evaluateStaticCondition(statement.expression, env, scope)) {\n return collectPushEntriesFromStatement(statement.thenStatement, env, targetVariableName, scope)\n }\n if (statement.elseStatement) {\n return collectPushEntriesFromStatement(statement.elseStatement, env, targetVariableName, scope)\n }\n return []\n }\n\n if (!ts.isExpressionStatement(statement)) return []\n const expression = statement.expression\n if (!ts.isCallExpression(expression)) return []\n if (!ts.isPropertyAccessExpression(expression.expression)) return []\n const pushTarget = expression.expression.expression\n const pushMethod = expression.expression.name\n if (!ts.isIdentifier(pushTarget) || pushTarget.text !== targetVariableName) return []\n if (pushMethod.text !== 'push') return []\n\n return expression.arguments.flatMap((argument) => {\n if (!ts.isObjectLiteralExpression(argument)) return []\n const entry = parseModuleEntryFromObjectLiteral(argument)\n return entry ? [entry] : []\n })\n}\n\nfunction parseModulesFromSource(source: string, env: NodeJS.ProcessEnv = process.env): ModuleEntry[] {\n const sourceFile = ts.createSourceFile('modules.ts', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS)\n const modules: ModuleEntry[] = []\n const variableName = 'enabledModules'\n const scope = new Map<string, unknown>()\n let foundDeclaration = false\n\n for (const statement of sourceFile.statements) {\n if (ts.isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name)) continue\n if (declaration.name.text === variableName) {\n if (!declaration.initializer || !ts.isArrayLiteralExpression(declaration.initializer)) continue\n const fromArray = declaration.initializer.elements.flatMap((element) => {\n if (!ts.isObjectLiteralExpression(element)) return []\n const entry = parseModuleEntryFromObjectLiteral(element)\n return entry ? [entry] : []\n })\n modules.push(...fromArray)\n scope.set(variableName, [...modules])\n foundDeclaration = true\n continue\n }\n if (!declaration.initializer) continue\n scope.set(\n declaration.name.text,\n evaluateStaticExpressionWithScope(declaration.initializer, env, scope),\n )\n }\n continue\n }\n if (!foundDeclaration) continue\n const pushedEntries = collectPushEntriesFromStatement(statement, env, variableName, scope)\n if (pushedEntries.length > 0) {\n modules.push(...pushedEntries)\n scope.set(variableName, [...modules])\n }\n }\n\n return dedupeModulesById(modules)\n}\n\nconst reportedDuplicateModuleIds = new Set<string>()\n\nfunction dedupeModulesById(modules: ModuleEntry[]): ModuleEntry[] {\n const seen = new Map<string, ModuleEntry>()\n for (const entry of modules) {\n const existing = seen.get(entry.id)\n if (!existing) {\n seen.set(entry.id, entry)\n continue\n }\n if (entry.devSupervisorRequiresFullBootstrap && !existing.devSupervisorRequiresFullBootstrap) {\n seen.set(entry.id, { ...existing, devSupervisorRequiresFullBootstrap: true })\n }\n if (reportedDuplicateModuleIds.has(entry.id)) continue\n reportedDuplicateModuleIds.add(entry.id)\n console.warn(\n `[resolver] Module \"${entry.id}\" is registered more than once in src/modules.ts (from \"${existing.from ?? '@open-mercato/core'}\" and \"${entry.from ?? '@open-mercato/core'}\"). Keeping the first registration; remove the duplicate entry.`,\n )\n }\n return Array.from(seen.values())\n}\n\nexport function readEnabledModulesFromConfig(cfgPath: string): ModuleEntry[] {\n const source = fs.readFileSync(cfgPath, 'utf8')\n return parseModulesFromSource(source)\n}\n\nfunction loadEnabledModulesFromConfig(appDir: string): ModuleEntry[] {\n const cfgPath = path.resolve(appDir, 'src/modules.ts')\n if (fs.existsSync(cfgPath)) {\n try {\n return readEnabledModulesFromConfig(cfgPath)\n } catch (error) {\n console.warn(\n '[resolver] Failed to read enabled modules from src/modules.ts, falling back to src/modules scan:',\n error,\n )\n }\n }\n // Fallback: scan src/modules/* to keep backward compatibility\n const modulesRoot = path.resolve(appDir, 'src/modules')\n if (!fs.existsSync(modulesRoot)) return []\n const scannedModules = fs\n .readdirSync(modulesRoot, { withFileTypes: true })\n .filter((e) => e.isDirectory() && !e.name.startsWith('.'))\n .map((e) => ({ id: e.name, from: '@app' as const }))\n\n return scannedModules\n}\n\nfunction discoverPackagesInMonorepo(rootDir: string): PackageInfo[] {\n const packagesDir = path.join(rootDir, 'packages')\n if (!fs.existsSync(packagesDir)) return []\n\n const packages: PackageInfo[] = []\n const entries = fs.readdirSync(packagesDir, { withFileTypes: true })\n\n for (const entry of entries) {\n if (!entry.isDirectory()) continue\n const pkgPath = path.join(packagesDir, entry.name)\n const pkgJsonPath = path.join(pkgPath, 'package.json')\n\n if (!fs.existsSync(pkgJsonPath)) continue\n\n try {\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'))\n // Read from src/modules (TypeScript source)\n const modulesPath = path.join(pkgPath, 'src', 'modules')\n\n if (fs.existsSync(modulesPath)) {\n packages.push({\n name: pkgJson.name || `@open-mercato/${entry.name}`,\n version: typeof pkgJson.version === 'string' ? pkgJson.version : null,\n path: pkgPath,\n modulesPath,\n })\n }\n } catch {\n // Skip invalid packages\n }\n }\n\n return packages\n}\n\nfunction discoverPackagesInNodeModules(rootDir: string): PackageInfo[] {\n const nodeModulesPath = path.join(rootDir, 'node_modules', '@open-mercato')\n if (!fs.existsSync(nodeModulesPath)) return []\n\n const packages: PackageInfo[] = []\n const entries = fs.readdirSync(nodeModulesPath, { withFileTypes: true })\n\n for (const entry of entries) {\n if (!entry.isDirectory()) continue\n const pkgPath = path.join(nodeModulesPath, entry.name)\n const pkgJsonPath = path.join(pkgPath, 'package.json')\n\n if (!fs.existsSync(pkgJsonPath)) continue\n\n try {\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'))\n const distModulesPath = path.join(pkgPath, 'dist', 'modules')\n const srcModulesPath = path.join(pkgPath, 'src', 'modules')\n const modulesPath = fs.existsSync(distModulesPath) ? distModulesPath : srcModulesPath\n\n if (fs.existsSync(modulesPath)) {\n packages.push({\n name: pkgJson.name || `@open-mercato/${entry.name}`,\n version: typeof pkgJson.version === 'string' ? pkgJson.version : null,\n path: pkgPath,\n modulesPath,\n })\n }\n } catch {\n // Skip invalid packages\n }\n }\n\n return packages\n}\n\nfunction detectAppDir(rootDir: string, isMonorepo: boolean): string {\n if (!isMonorepo) {\n // Production mode: app is at root\n return rootDir\n }\n\n // Monorepo mode: look for app in apps/mercato/ or apps/app/\n const mercatoApp = path.join(rootDir, 'apps', 'mercato')\n if (fs.existsSync(mercatoApp)) {\n return mercatoApp\n }\n\n const defaultApp = path.join(rootDir, 'apps', 'app')\n if (fs.existsSync(defaultApp)) {\n return defaultApp\n }\n\n // Fallback: check if apps directory exists and has any app\n const appsDir = path.join(rootDir, 'apps')\n if (fs.existsSync(appsDir)) {\n const entries = fs.readdirSync(appsDir, { withFileTypes: true })\n const appEntry = entries.find(\n (e) => e.isDirectory() && !e.name.startsWith('.') && e.name !== 'docs'\n )\n if (appEntry) {\n return path.join(appsDir, appEntry.name)\n }\n }\n\n // Final fallback for legacy structure: root is the app\n return rootDir\n}\n\nfunction findNodeModulesRoot(startDir: string): string | null {\n // Walk up to find node_modules/@open-mercato/core\n let dir = startDir\n while (dir !== path.dirname(dir)) {\n const corePkgPath = path.join(dir, 'node_modules', '@open-mercato', 'core')\n if (fs.existsSync(corePkgPath)) {\n return dir\n }\n dir = path.dirname(dir)\n }\n return null\n}\n\nfunction detectMonorepoFromNodeModules(appDir: string): { isMonorepo: boolean; monorepoRoot: string | null; nodeModulesRoot: string | null } {\n // Find where node_modules/@open-mercato/core is located (may be hoisted)\n const nodeModulesRoot = findNodeModulesRoot(appDir)\n if (!nodeModulesRoot) {\n return { isMonorepo: false, monorepoRoot: null, nodeModulesRoot: null }\n }\n\n const corePkgPath = path.join(nodeModulesRoot, 'node_modules', '@open-mercato', 'core')\n\n const workspaceCoreModules = path.join(nodeModulesRoot, 'packages', 'core', 'src', 'modules')\n if (fs.existsSync(workspaceCoreModules)) {\n return { isMonorepo: true, monorepoRoot: nodeModulesRoot, nodeModulesRoot }\n }\n\n try {\n const stat = fs.lstatSync(corePkgPath)\n if (stat.isSymbolicLink()) {\n // It's a symlink - we're in monorepo dev mode\n // Resolve the symlink to find the monorepo root\n const realPath = fs.realpathSync(corePkgPath)\n // realPath is something like /path/to/monorepo/packages/core\n // monorepo root is 2 levels up\n const monorepoRoot = path.dirname(path.dirname(realPath))\n return { isMonorepo: true, monorepoRoot, nodeModulesRoot }\n }\n // It's a real directory - production mode\n return { isMonorepo: false, monorepoRoot: null, nodeModulesRoot }\n } catch {\n // Package doesn't exist yet or error reading - assume production mode\n return { isMonorepo: false, monorepoRoot: null, nodeModulesRoot }\n }\n}\n\nexport function createResolver(cwd: string = process.cwd()): PackageResolver {\n // First detect if we're in a monorepo by checking if node_modules packages are symlinks\n const { isMonorepo: _isMonorepo, monorepoRoot, nodeModulesRoot } = detectMonorepoFromNodeModules(cwd)\n // In workspaces with hoisted real directories, package sources live under the discovered node_modules root.\n const rootDir = monorepoRoot ?? nodeModulesRoot ?? cwd\n\n // shouldResolveAppFromRoot: true when we have a workspace/install root that differs from cwd\n // (monorepo symlinks detected, or node_modules root found above cwd)\n const shouldResolveAppFromRoot =\n _isMonorepo || (nodeModulesRoot !== null && path.resolve(nodeModulesRoot) !== path.resolve(cwd))\n\n // The app directory depends on context:\n // - In monorepo: use detectAppDir to find apps/mercato or similar\n // - When symlinks not detected (e.g. Docker volume node_modules): still use apps/mercato if present at rootDir\n // - Otherwise: app is at cwd\n const candidateAppDir = shouldResolveAppFromRoot ? detectAppDir(rootDir, true) : rootDir\n const appDir =\n _isMonorepo\n ? candidateAppDir\n : shouldResolveAppFromRoot && candidateAppDir !== rootDir && fs.existsSync(candidateAppDir)\n ? candidateAppDir\n : cwd\n\n return {\n isMonorepo: () => _isMonorepo,\n\n getRootDir: () => rootDir,\n\n getAppDir: () => appDir,\n\n getOutputDir: () => {\n // Output is ALWAYS .mercato/generated relative to app directory\n return path.join(appDir, '.mercato', 'generated')\n },\n\n getModulesConfigPath: () => path.join(appDir, 'src', 'modules.ts'),\n\n discoverPackages: () => {\n return _isMonorepo\n ? discoverPackagesInMonorepo(rootDir)\n : discoverPackagesInNodeModules(rootDir)\n },\n\n loadEnabledModules: () => loadEnabledModulesFromConfig(appDir),\n\n getModulePaths: (entry: ModuleEntry) => {\n const appBase = path.resolve(appDir, 'src/modules', entry.id)\n const pkgModulesRoot = pkgDirFor(rootDir, entry.from, _isMonorepo, appDir)\n const pkgBase = path.join(pkgModulesRoot, entry.id)\n return { appBase, pkgBase }\n },\n\n getModuleImportBase: (entry: ModuleEntry) => {\n // Prefer @app overrides at import-time; fall back to provided package alias\n const from = entry.from || '@open-mercato/core'\n return {\n appBase: `@/modules/${entry.id}`,\n pkgBase: `${from}/modules/${entry.id}`,\n }\n },\n\n getPackageOutputDir: (packageName: string) => {\n if (packageName === '@app') {\n // App output goes to .mercato/generated\n return path.join(appDir, '.mercato', 'generated')\n }\n const pkgRoot = pkgRootFor(rootDir, packageName, _isMonorepo, appDir)\n return path.join(pkgRoot, 'generated')\n },\n\n getPackageRoot: (from?: string) => {\n return pkgRootFor(rootDir, from, _isMonorepo, appDir)\n },\n }\n}\n\n/**\n * Resolve the CLI execution environment as a plain value-object.\n * Call once at subsystem init; use the returned object for all path decisions.\n */\nexport function resolveEnvironment(cwd: string = process.cwd()): CliEnvironment {\n const resolver = createResolver(cwd)\n const _isMonorepo = resolver.isMonorepo()\n const rootDir = resolver.getRootDir()\n const appDir = resolver.getAppDir()\n return {\n mode: _isMonorepo ? 'monorepo' : 'standalone',\n rootDir,\n appDir,\n packageRoot: (packageName: string) => pkgRootFor(rootDir, packageName, _isMonorepo, appDir),\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,SAAS,+BAA+B;AACxC,SAAS,8CAA8C;AAkDvD,SAAS,UAAU,SAAiB,MAAe,aAAa,MAAM,SAAS,SA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A,IAE7D,gBAAgB,CAAC,UAAuB;AACtC,YAAM,UAAU,KAAK,QAAQ,QAAQ,eAAe,MAAM,EAAE;AAC5D,YAAM,iBAAiB,UAAU,SAAS,MAAM,MAAM,aAAa,MAAM;AACzE,YAAM,UAAU,KAAK,KAAK,gBAAgB,MAAM,EAAE;AAClD,aAAO,EAAE,SAAS,QAAQ;AAAA,IAC5B;AAAA,IAEA,qBAAqB,CAAC,UAAuB;AAE3C,YAAM,OAAO,MAAM,QAAQ;AAC3B,aAAO;AAAA,QACL,SAAS,aAAa,MAAM,EAAE;AAAA,QAC9B,SAAS,GAAG,IAAI,YAAY,MAAM,EAAE;AAAA,MACtC;AAAA,IACF;AAAA,IAEA,qBAAqB,CAAC,gBAAwB;AAC5C,UAAI,gBAAgB,QAAQ;AAE1B,eAAO,KAAK,KAAK,QAAQ,YAAY,WAAW;AAAA,MAClD;AACA,YAAM,UAAU,WAAW,SAAS,aAAa,aAAa,MAAM;AACpE,aAAO,KAAK,KAAK,SAAS,WAAW;AAAA,IACvC;AAAA,IAEA,gBAAgB,CAAC,SAAkB;AACjC,aAAO,WAAW,SAAS,MAAM,aAAa,MAAM;AAAA,IACtD;AAAA,EACF;AACF;AAMO,SAAS,mBAAmB,MAAc,QAAQ,IAAI,GAAmB;AAC9E,QAAM,WAAW,eAAe,GAAG;AACnC,QAAM,cAAc,SAAS,WAAW;AACxC,QAAM,UAAU,SAAS,WAAW;AACpC,QAAM,SAAS,SAAS,UAAU;AAClC,SAAO;AAAA,IACL,MAAM,cAAc,aAAa;AAAA,IACjC;AAAA,IACA;AAAA,IACA,aAAa,CAAC,gBAAwB,WAAW,SAAS,aAAa,aAAa,MAAM;AAAA,EAC5F;AACF;",
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import type { FormSectionOverridesMap, FormSectionOverride } from '@open-mercato/shared/modules/overrides'\nimport path from 'node:path'\nimport fs from 'node:fs'\nimport ts from 'typescript-js'\nimport { parseBooleanWithDefault } from '@open-mercato/shared/lib/boolean'\nimport { resolveInstalledPackageRootWithRequire } from './module-package'\n\n/**\n * Resolved execution environment for the CLI.\n * Produced once by resolveEnvironment() and consumed by all subsystems.\n * Eliminates per-subsystem isMonorepo() branching and hardcoded path segments.\n */\nexport type CliEnvironment = {\n /** Whether the CLI is running inside a Yarn/npm workspace monorepo. */\n mode: 'monorepo' | 'standalone'\n /** Workspace or project root (where package.json / node_modules live). */\n rootDir: string\n /** Next.js application directory (contains src/, package.json, next.config.*). */\n appDir: string\n /**\n * Resolve the root directory of an installed @open-mercato package.\n * Monorepo: packages/<pkg>/ Standalone: node_modules/<pkg>/\n */\n packageRoot: (packageName: string) => string\n}\n\nexport type ModuleEntry = {\n id: string\n from?: '@open-mercato/core' | '@app' | string\n locator?: string\n packageName?: string\n devSupervisorRequiresFullBootstrap?: boolean\n formSectionOverrides?: Readonly<FormSectionOverridesMap>\n}\n\nexport type PackageInfo = {\n name: string\n version?: string | null\n path: string\n modulesPath: string\n}\n\nexport interface PackageResolver {\n isMonorepo(): boolean\n getRootDir(): string\n getAppDir(): string\n getOutputDir(): string\n getModulesConfigPath(): string\n discoverPackages(): PackageInfo[]\n loadEnabledModules(): ModuleEntry[]\n getModulePaths(entry: ModuleEntry): { appBase: string; pkgBase: string }\n getModuleImportBase(entry: ModuleEntry): { appBase: string; pkgBase: string }\n getPackageOutputDir(packageName: string): string\n getPackageRoot(from?: string): string\n}\n\nfunction pkgDirFor(rootDir: string, from?: string, isMonorepo = true, appDir = rootDir): string {\n const packageRoot = pkgRootFor(rootDir, from, isMonorepo, appDir)\n const sourceModules = path.join(packageRoot, 'src', 'modules')\n const distModules = path.join(packageRoot, 'dist', 'modules')\n const workspacePackage = isMonorepo && packageRoot.startsWith(path.join(rootDir, 'packages') + path.sep)\n if (workspacePackage && fs.existsSync(sourceModules)) return sourceModules\n if (fs.existsSync(distModules)) return distModules\n return sourceModules\n}\n\nfunction pkgRootFor(rootDir: string, from?: string, isMonorepo = true, appDir = rootDir): string {\n const packageName = from || '@open-mercato/core'\n if (isMonorepo) {\n const workspaceMatch = packageName.match(/^@open-mercato\\/(.+)$/)\n if (workspaceMatch) {\n const workspaceRoot = path.join(rootDir, 'packages', workspaceMatch[1])\n if (fs.existsSync(workspaceRoot)) return workspaceRoot\n }\n }\n return resolveInstalledPackageRootWithRequire(packageName, appDir) ?? path.join(rootDir, 'node_modules', packageName)\n}\n\nfunction staticFormSectionOverrides(expression: ts.Expression): FormSectionOverridesMap | undefined {\n const initializers = new Map<string, ts.Expression>()\n for (const statement of expression.getSourceFile().statements) {\n if (!ts.isVariableStatement(statement) || !(statement.declarationList.flags & ts.NodeFlags.Const)) continue\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name) && declaration.initializer) initializers.set(declaration.name.text, declaration.initializer)\n }\n }\n function unwrap(value: ts.Expression): ts.Expression {\n const visited = new Set<string>()\n while (true) {\n if (ts.isAsExpression(value) || ts.isSatisfiesExpression(value) || ts.isParenthesizedExpression(value)) {\n value = value.expression\n continue\n }\n if (!ts.isIdentifier(value) || visited.has(value.text)) return value\n const resolved = initializers.get(value.text)\n if (!resolved) return value\n visited.add(value.text)\n value = resolved\n }\n }\n function fields(value: ts.Expression | undefined, visited: ReadonlySet<ts.Expression> = new Set()): Map<string, ts.Expression> {\n if (!value) return new Map()\n const node = unwrap(value)\n if (!ts.isObjectLiteralExpression(node) || visited.has(node)) return new Map()\n const next = new Set([...visited, node])\n const output = new Map<string, ts.Expression>()\n for (const property of node.properties) {\n if (ts.isSpreadAssignment(property)) for (const [key, entry] of fields(property.expression, next)) output.set(key, entry)\n else if (ts.isShorthandPropertyAssignment(property)) output.set(property.name.text, property.name)\n else if (ts.isPropertyAssignment(property) && (ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name))) {\n output.set(property.name.text, property.initializer)\n }\n }\n return output\n }\n const entries = fields(fields(fields(expression).get('forms')).get('sections'))\n const result = new Map<string, FormSectionOverride | null>()\n function text(input: ts.Expression | undefined): string | undefined {\n const node = input ? unwrap(input) : undefined\n return node && ts.isStringLiteralLike(node) ? node.text : undefined\n }\n for (const [key, value] of entries) {\n if (unwrap(value).kind === ts.SyntaxKind.NullKeyword) {\n result.set(key, null)\n continue\n }\n const options = fields(value)\n const operation = text(options.get('operation'))\n const contributionId = text(options.get('contributionId'))\n if (!contributionId || (operation !== 'add' && operation !== 'hide' && operation !== 'replace')) continue\n if (operation !== 'add') {\n result.set(key, { operation, contributionId })\n continue\n }\n const placement = fields(options.get('placement'))\n const rawPosition = placement.get('position')\n const positionNode = rawPosition ? unwrap(rawPosition) : undefined\n const position = positionNode && ts.isPropertyAccessExpression(positionNode)\n && ts.isIdentifier(positionNode.expression) && positionNode.expression.text === 'InjectionPosition'\n && ['First', 'Last', 'Before', 'After'].includes(positionNode.name.text)\n ? positionNode.name.text.toLowerCase() : text(rawPosition)\n const relativeTo = text(placement.get('relativeTo'))\n const allowed: ReadonlySet<string> = new Set(['first', 'last', 'before', 'after'])\n if (placement.size && (!position || !allowed.has(position))) continue\n result.set(key, { operation, contributionId, ...(position ? {\n placement: { position: position as NonNullable<Extract<FormSectionOverride, { operation: 'add' }>['placement']>['position'], relativeTo },\n } : {}) })\n }\n return result.size ? Object.fromEntries(result) : undefined\n}\n\nfunction parseModuleEntryFromObjectLiteral(node: ts.ObjectLiteralExpression): ModuleEntry | null {\n let id: string | null = null\n let from: string | null = null\n let locator: string | undefined\n let packageName: string | undefined\n let devSupervisorRequiresFullBootstrap = false\n let formSectionOverrides: FormSectionOverridesMap | undefined\n for (const property of node.properties) {\n if (ts.isShorthandPropertyAssignment(property) && property.name.text === 'overrides') {\n formSectionOverrides = staticFormSectionOverrides(property.name)\n continue\n }\n if (!ts.isPropertyAssignment(property)) continue\n const key = ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name)\n ? property.name.text\n : null\n if (key === 'id' && ts.isStringLiteralLike(property.initializer)) {\n id = property.initializer.text\n }\n if (key === 'from' && ts.isStringLiteralLike(property.initializer)) {\n from = property.initializer.text\n }\n if (key === 'packageName' && ts.isStringLiteralLike(property.initializer)) {\n packageName = property.initializer.text\n }\n if (key === 'locator' && ts.isStringLiteralLike(property.initializer)) {\n locator = property.initializer.text\n }\n if (key === 'overrides') {\n formSectionOverrides = staticFormSectionOverrides(property.initializer)\n if (!ts.isObjectLiteralExpression(property.initializer)) {\n devSupervisorRequiresFullBootstrap = true\n continue\n }\n for (const overrideProperty of property.initializer.properties) {\n if (ts.isSpreadAssignment(overrideProperty)) {\n devSupervisorRequiresFullBootstrap = true\n break\n }\n if (!ts.isPropertyAssignment(overrideProperty)) continue\n const overrideKey = ts.isIdentifier(overrideProperty.name) || ts.isStringLiteralLike(overrideProperty.name)\n ? overrideProperty.name.text\n : null\n if (overrideKey === 'workers' || overrideKey === 'cli') {\n devSupervisorRequiresFullBootstrap = true\n break\n }\n }\n }\n }\n if (!id) return null\n return {\n id,\n from: from ?? '@open-mercato/core',\n ...(locator ? { locator } : {}),\n ...(packageName ? { packageName } : {}),\n ...(devSupervisorRequiresFullBootstrap ? { devSupervisorRequiresFullBootstrap: true } : {}),\n ...(formSectionOverrides ? { formSectionOverrides } : {}),\n }\n}\n\nfunction parseProcessEnvAccess(\n node: ts.Expression,\n env: NodeJS.ProcessEnv,\n): { matched: boolean; value: string | undefined } {\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name)) {\n const target = node.expression\n if (\n ts.isPropertyAccessExpression(target)\n && ts.isIdentifier(target.expression)\n && target.expression.text === 'process'\n && target.name.text === 'env'\n ) {\n return { matched: true, value: env[node.name.text] }\n }\n }\n if (\n ts.isElementAccessExpression(node)\n && ts.isPropertyAccessExpression(node.expression)\n && ts.isIdentifier(node.expression.expression)\n && node.expression.expression.text === 'process'\n && node.expression.name.text === 'env'\n && ts.isStringLiteralLike(node.argumentExpression)\n ) {\n return { matched: true, value: env[node.argumentExpression.text] }\n }\n return { matched: false, value: undefined }\n}\n\nfunction evaluateStaticExpression(node: ts.Expression, env: NodeJS.ProcessEnv): unknown {\n return evaluateStaticExpressionWithScope(node, env, new Map())\n}\n\nfunction evaluateStaticExpressionWithScope(\n node: ts.Expression,\n env: NodeJS.ProcessEnv,\n scope: Map<string, unknown>,\n): unknown {\n if (ts.isParenthesizedExpression(node)) return evaluateStaticExpressionWithScope(node.expression, env, scope)\n if (ts.isIdentifier(node)) {\n return scope.get(node.text)\n }\n if (ts.isStringLiteralLike(node) || ts.isNoSubstitutionTemplateLiteral(node)) return node.text\n if (ts.isNumericLiteral(node)) return Number(node.text)\n if (node.kind === ts.SyntaxKind.TrueKeyword) return true\n if (node.kind === ts.SyntaxKind.FalseKeyword) return false\n if (node.kind === ts.SyntaxKind.NullKeyword) return null\n\n const envAccess = parseProcessEnvAccess(node, env)\n if (envAccess.matched) return envAccess.value\n\n if (ts.isPropertyAccessExpression(node)) {\n const target = evaluateStaticExpressionWithScope(node.expression, env, scope)\n if (target && typeof target === 'object' && node.name.text in target) {\n return (target as Record<string, unknown>)[node.name.text]\n }\n return undefined\n }\n\n if (ts.isPrefixUnaryExpression(node) && node.operator === ts.SyntaxKind.ExclamationToken) {\n return !Boolean(evaluateStaticExpressionWithScope(node.operand, env, scope))\n }\n\n if (ts.isBinaryExpression(node)) {\n if (node.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {\n return Boolean(evaluateStaticExpressionWithScope(node.left, env, scope))\n && Boolean(evaluateStaticExpressionWithScope(node.right, env, scope))\n }\n if (node.operatorToken.kind === ts.SyntaxKind.BarBarToken) {\n return Boolean(evaluateStaticExpressionWithScope(node.left, env, scope))\n || Boolean(evaluateStaticExpressionWithScope(node.right, env, scope))\n }\n if (node.operatorToken.kind === ts.SyntaxKind.EqualsEqualsEqualsToken) {\n return evaluateStaticExpressionWithScope(node.left, env, scope) === evaluateStaticExpressionWithScope(node.right, env, scope)\n }\n if (node.operatorToken.kind === ts.SyntaxKind.ExclamationEqualsEqualsToken) {\n return evaluateStaticExpressionWithScope(node.left, env, scope) !== evaluateStaticExpressionWithScope(node.right, env, scope)\n }\n }\n\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === 'parseBooleanWithDefault') {\n const rawValueNode = node.arguments[0]\n const fallbackNode = node.arguments[1]\n const rawValue = rawValueNode ? evaluateStaticExpressionWithScope(rawValueNode, env, scope) : undefined\n const fallbackValue = fallbackNode ? evaluateStaticExpressionWithScope(fallbackNode, env, scope) : false\n return parseBooleanWithDefault(typeof rawValue === 'string' ? rawValue : undefined, Boolean(fallbackValue))\n }\n\n if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && node.expression.name.text === 'some') {\n const target = evaluateStaticExpressionWithScope(node.expression.expression, env, scope)\n const predicate = node.arguments[0]\n if (!Array.isArray(target) || !predicate) return undefined\n\n return target.some((entry) => {\n if (!ts.isArrowFunction(predicate) && !ts.isFunctionExpression(predicate)) return false\n\n const localScope = new Map(scope)\n const parameter = predicate.parameters[0]\n if (parameter && ts.isIdentifier(parameter.name)) {\n localScope.set(parameter.name.text, entry)\n }\n\n if (ts.isBlock(predicate.body)) {\n const returnStatement = predicate.body.statements.find((statement): statement is ts.ReturnStatement =>\n ts.isReturnStatement(statement),\n )\n if (!returnStatement?.expression) return false\n return Boolean(evaluateStaticExpressionWithScope(returnStatement.expression, env, localScope))\n }\n\n return Boolean(evaluateStaticExpressionWithScope(predicate.body, env, localScope))\n })\n }\n\n return undefined\n}\n\nfunction evaluateStaticCondition(\n node: ts.Expression,\n env: NodeJS.ProcessEnv,\n scope: Map<string, unknown>,\n): boolean {\n const evaluated = evaluateStaticExpressionWithScope(node, env, scope)\n return Boolean(evaluated)\n}\n\nfunction collectPushEntriesFromStatement(\n statement: ts.Statement,\n env: NodeJS.ProcessEnv,\n targetVariableName: string,\n scope: Map<string, unknown>,\n): ModuleEntry[] {\n if (ts.isBlock(statement)) {\n return statement.statements.flatMap((child) => collectPushEntriesFromStatement(child, env, targetVariableName, scope))\n }\n\n if (ts.isIfStatement(statement)) {\n if (evaluateStaticCondition(statement.expression, env, scope)) {\n return collectPushEntriesFromStatement(statement.thenStatement, env, targetVariableName, scope)\n }\n if (statement.elseStatement) {\n return collectPushEntriesFromStatement(statement.elseStatement, env, targetVariableName, scope)\n }\n return []\n }\n\n if (!ts.isExpressionStatement(statement)) return []\n const expression = statement.expression\n if (!ts.isCallExpression(expression)) return []\n if (!ts.isPropertyAccessExpression(expression.expression)) return []\n const pushTarget = expression.expression.expression\n const pushMethod = expression.expression.name\n if (!ts.isIdentifier(pushTarget) || pushTarget.text !== targetVariableName) return []\n if (pushMethod.text !== 'push') return []\n\n return expression.arguments.flatMap((argument) => {\n if (!ts.isObjectLiteralExpression(argument)) return []\n const entry = parseModuleEntryFromObjectLiteral(argument)\n return entry ? [entry] : []\n })\n}\n\nfunction validateFormSectionGates(sourceFile: ts.SourceFile, targetVariableName: string): void {\n const initializers = new Map<string, ts.Expression>()\n for (const statement of sourceFile.statements) {\n if (!ts.isVariableStatement(statement)) continue\n for (const declaration of statement.declarationList.declarations) {\n const initializer = declaration.initializer\n if (!initializer) continue\n function mapBinding(binding: ts.BindingName, value: ts.Expression): void {\n if (ts.isIdentifier(binding)) initializers.set(binding.text, value)\n else for (const element of binding.elements) if (ts.isBindingElement(element)) mapBinding(element.name, value)\n }\n mapBinding(declaration.name, initializer)\n }\n }\n\n function serverEnvironmentReads(expression: ts.Expression): string[] {\n const found = new Set<string>()\n const seen = new Set<string>()\n function visit(node: ts.Node): void {\n if (ts.isIdentifier(node) && !seen.has(node.text)) {\n seen.add(node.text)\n const initializer = initializers.get(node.text)\n if (initializer && node.text !== targetVariableName) visit(initializer)\n }\n if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression)\n && node.expression.text === 'process' && node.name.text === 'env') {\n found.add('<dynamic process.env>')\n return\n }\n if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {\n const target = node.expression\n if (ts.isPropertyAccessExpression(target) && target.name.text === 'env'\n && ts.isIdentifier(target.expression) && target.expression.text === 'process') {\n const environmentKey = ts.isPropertyAccessExpression(node) ? node.name.text\n : ts.isStringLiteralLike(node.argumentExpression) ? node.argumentExpression.text : '<dynamic process.env>'\n if (!environmentKey.startsWith('NEXT_PUBLIC_')) found.add(environmentKey)\n return\n }\n }\n ts.forEachChild(node, visit)\n }\n visit(expression)\n return [...found].sort((left, right) => left < right ? -1 : left > right ? 1 : 0)\n }\n\n function assertGates(gates: readonly ts.Expression[]): void {\n const serverKeys = [...new Set(gates.flatMap(serverEnvironmentReads))].sort((left, right) => left < right ? -1 : left > right ? 1 : 0)\n if (serverKeys.length) {\n throw new Error(`[resolver] forms.sections in src/modules.ts requires browser-visible module gating; server-only: ${serverKeys.join(', ')}`)\n }\n }\n\n function inspectOverride(\n node: ts.Expression,\n keys: readonly string[],\n gates: readonly ts.Expression[],\n seen: ReadonlySet<string> = new Set(),\n ): void {\n if (ts.isParenthesizedExpression(node) || ts.isSatisfiesExpression(node) || ts.isAsExpression(node)) {\n inspectOverride(node.expression, keys, gates, seen)\n } else if (ts.isConditionalExpression(node)) {\n inspectOverride(node.whenTrue, keys, [...gates, node.condition], seen)\n inspectOverride(node.whenFalse, keys, [...gates, node.condition], seen)\n } else if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {\n inspectOverride(node.right, keys, [...gates, node.left], seen)\n } else if (ts.isIdentifier(node) && !seen.has(node.text) && initializers.has(node.text)) {\n const initializer = initializers.get(node.text)\n if (initializer) inspectOverride(initializer, keys, gates, new Set([...seen, node.text]))\n } else if (!keys.length) {\n assertGates([...gates, node])\n } else if (ts.isObjectLiteralExpression(node)) {\n for (const property of node.properties) {\n if (ts.isSpreadAssignment(property)) inspectOverride(property.expression, keys, gates, seen)\n if (ts.isShorthandPropertyAssignment(property) && property.name.text === keys[0]) {\n inspectOverride(property.name, keys.slice(1), gates, seen)\n }\n if (ts.isPropertyAssignment(property)\n && (ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name))\n && property.name.text === keys[0]) {\n inspectOverride(property.initializer, keys.slice(1), gates, seen)\n }\n }\n }\n }\n\n function inspectModules(node: ts.Node, gates: readonly ts.Expression[], seen: ReadonlySet<string> = new Set()): void {\n if (ts.isIdentifier(node) && !seen.has(node.text)) {\n const initializer = initializers.get(node.text)\n if (initializer && node.text !== targetVariableName) inspectModules(initializer, gates, new Set([...seen, node.text]))\n } else if (ts.isObjectLiteralExpression(node)) {\n inspectOverride(node, ['overrides', 'forms', 'sections'], gates)\n } else if (ts.isConditionalExpression(node)) {\n inspectModules(node.whenTrue, [...gates, node.condition], seen)\n inspectModules(node.whenFalse, [...gates, node.condition], seen)\n } else {\n ts.forEachChild(node, (child) => inspectModules(child, gates, seen))\n }\n }\n\n function inspectStatement(statement: ts.Statement, gates: readonly ts.Expression[]): void {\n if (ts.isBlock(statement)) {\n for (const child of statement.statements) inspectStatement(child, gates)\n return\n }\n if (ts.isIfStatement(statement)) {\n const branchGates = [...gates, statement.expression]\n inspectStatement(statement.thenStatement, branchGates)\n if (statement.elseStatement) inspectStatement(statement.elseStatement, branchGates)\n return\n }\n if (ts.isExpressionStatement(statement)) inspectPush(statement.expression, gates)\n }\n\n function inspectPush(node: ts.Expression, gates: readonly ts.Expression[]): void {\n if (ts.isParenthesizedExpression(node)) inspectPush(node.expression, gates)\n if (ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) {\n inspectPush(node.right, [...gates, node.left])\n }\n if (ts.isConditionalExpression(node)) {\n inspectPush(node.whenTrue, [...gates, node.condition])\n inspectPush(node.whenFalse, [...gates, node.condition])\n }\n if (!ts.isCallExpression(node)) return\n const { expression, arguments: entries } = node\n if (ts.isPropertyAccessExpression(expression) && expression.name.text === 'push'\n && ts.isIdentifier(expression.expression) && expression.expression.text === targetVariableName) {\n for (const entry of entries) inspectModules(entry, gates)\n }\n }\n\n const enabled = initializers.get(targetVariableName)\n if (enabled) inspectModules(enabled, [])\n for (const statement of sourceFile.statements) inspectStatement(statement, [])\n}\n\nfunction parseModulesFromSource(source: string, env: NodeJS.ProcessEnv = process.env): ModuleEntry[] {\n const sourceFile = ts.createSourceFile('modules.ts', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS)\n const modules: ModuleEntry[] = []\n const variableName = 'enabledModules'\n validateFormSectionGates(sourceFile, variableName)\n const scope = new Map<string, unknown>()\n let foundDeclaration = false\n\n for (const statement of sourceFile.statements) {\n if (ts.isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name)) continue\n if (declaration.name.text === variableName) {\n if (!declaration.initializer || !ts.isArrayLiteralExpression(declaration.initializer)) continue\n const fromArray = declaration.initializer.elements.flatMap((element) => {\n if (!ts.isObjectLiteralExpression(element)) return []\n const entry = parseModuleEntryFromObjectLiteral(element)\n return entry ? [entry] : []\n })\n modules.push(...fromArray)\n scope.set(variableName, [...modules])\n foundDeclaration = true\n continue\n }\n if (!declaration.initializer) continue\n scope.set(\n declaration.name.text,\n evaluateStaticExpressionWithScope(declaration.initializer, env, scope),\n )\n }\n continue\n }\n if (!foundDeclaration) continue\n const pushedEntries = collectPushEntriesFromStatement(statement, env, variableName, scope)\n if (pushedEntries.length > 0) {\n modules.push(...pushedEntries)\n scope.set(variableName, [...modules])\n }\n }\n\n return dedupeModulesById(modules)\n}\n\nconst reportedDuplicateModuleIds = new Set<string>()\n\nfunction dedupeModulesById(modules: ModuleEntry[]): ModuleEntry[] {\n const seen = new Map<string, ModuleEntry>()\n for (const entry of modules) {\n const existing = seen.get(entry.id)\n if (!existing) {\n seen.set(entry.id, entry)\n continue\n }\n if (entry.devSupervisorRequiresFullBootstrap && !existing.devSupervisorRequiresFullBootstrap) {\n seen.set(entry.id, { ...existing, devSupervisorRequiresFullBootstrap: true })\n }\n if (reportedDuplicateModuleIds.has(entry.id)) continue\n reportedDuplicateModuleIds.add(entry.id)\n console.warn(\n `[resolver] Module \"${entry.id}\" is registered more than once in src/modules.ts (from \"${existing.from ?? '@open-mercato/core'}\" and \"${entry.from ?? '@open-mercato/core'}\"). Keeping the first registration; remove the duplicate entry.`,\n )\n }\n return Array.from(seen.values())\n}\n\nexport function readEnabledModulesFromConfig(cfgPath: string): ModuleEntry[] {\n const source = fs.readFileSync(cfgPath, 'utf8')\n return parseModulesFromSource(source)\n}\n\nfunction loadEnabledModulesFromConfig(appDir: string): ModuleEntry[] {\n const cfgPath = path.resolve(appDir, 'src/modules.ts')\n if (fs.existsSync(cfgPath)) {\n try {\n return readEnabledModulesFromConfig(cfgPath)\n } catch (error) {\n console.warn(\n '[resolver] Failed to read enabled modules from src/modules.ts, falling back to src/modules scan:',\n error,\n )\n }\n }\n // Fallback: scan src/modules/* to keep backward compatibility\n const modulesRoot = path.resolve(appDir, 'src/modules')\n if (!fs.existsSync(modulesRoot)) return []\n const scannedModules = fs\n .readdirSync(modulesRoot, { withFileTypes: true })\n .filter((e) => e.isDirectory() && !e.name.startsWith('.'))\n .map((e) => ({ id: e.name, from: '@app' as const }))\n\n return scannedModules\n}\n\nfunction discoverPackagesInMonorepo(rootDir: string): PackageInfo[] {\n const packagesDir = path.join(rootDir, 'packages')\n if (!fs.existsSync(packagesDir)) return []\n\n const packages: PackageInfo[] = []\n const entries = fs.readdirSync(packagesDir, { withFileTypes: true })\n\n for (const entry of entries) {\n if (!entry.isDirectory()) continue\n const pkgPath = path.join(packagesDir, entry.name)\n const pkgJsonPath = path.join(pkgPath, 'package.json')\n\n if (!fs.existsSync(pkgJsonPath)) continue\n\n try {\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'))\n // Read from src/modules (TypeScript source)\n const modulesPath = path.join(pkgPath, 'src', 'modules')\n\n if (fs.existsSync(modulesPath)) {\n packages.push({\n name: pkgJson.name || `@open-mercato/${entry.name}`,\n version: typeof pkgJson.version === 'string' ? pkgJson.version : null,\n path: pkgPath,\n modulesPath,\n })\n }\n } catch {\n // Skip invalid packages\n }\n }\n\n return packages\n}\n\nfunction discoverPackagesInNodeModules(rootDir: string): PackageInfo[] {\n const nodeModulesPath = path.join(rootDir, 'node_modules', '@open-mercato')\n if (!fs.existsSync(nodeModulesPath)) return []\n\n const packages: PackageInfo[] = []\n const entries = fs.readdirSync(nodeModulesPath, { withFileTypes: true })\n\n for (const entry of entries) {\n if (!entry.isDirectory()) continue\n const pkgPath = path.join(nodeModulesPath, entry.name)\n const pkgJsonPath = path.join(pkgPath, 'package.json')\n\n if (!fs.existsSync(pkgJsonPath)) continue\n\n try {\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'))\n const distModulesPath = path.join(pkgPath, 'dist', 'modules')\n const srcModulesPath = path.join(pkgPath, 'src', 'modules')\n const modulesPath = fs.existsSync(distModulesPath) ? distModulesPath : srcModulesPath\n\n if (fs.existsSync(modulesPath)) {\n packages.push({\n name: pkgJson.name || `@open-mercato/${entry.name}`,\n version: typeof pkgJson.version === 'string' ? pkgJson.version : null,\n path: pkgPath,\n modulesPath,\n })\n }\n } catch {\n // Skip invalid packages\n }\n }\n\n return packages\n}\n\nfunction detectAppDir(rootDir: string, isMonorepo: boolean): string {\n if (!isMonorepo) {\n // Production mode: app is at root\n return rootDir\n }\n\n // Monorepo mode: look for app in apps/mercato/ or apps/app/\n const mercatoApp = path.join(rootDir, 'apps', 'mercato')\n if (fs.existsSync(mercatoApp)) {\n return mercatoApp\n }\n\n const defaultApp = path.join(rootDir, 'apps', 'app')\n if (fs.existsSync(defaultApp)) {\n return defaultApp\n }\n\n // Fallback: check if apps directory exists and has any app\n const appsDir = path.join(rootDir, 'apps')\n if (fs.existsSync(appsDir)) {\n const entries = fs.readdirSync(appsDir, { withFileTypes: true })\n const appEntry = entries.find(\n (e) => e.isDirectory() && !e.name.startsWith('.') && e.name !== 'docs'\n )\n if (appEntry) {\n return path.join(appsDir, appEntry.name)\n }\n }\n\n // Final fallback for legacy structure: root is the app\n return rootDir\n}\n\nfunction findNodeModulesRoot(startDir: string): string | null {\n // Walk up to find node_modules/@open-mercato/core\n let dir = startDir\n while (dir !== path.dirname(dir)) {\n const corePkgPath = path.join(dir, 'node_modules', '@open-mercato', 'core')\n if (fs.existsSync(corePkgPath)) {\n return dir\n }\n dir = path.dirname(dir)\n }\n return null\n}\n\nfunction detectMonorepoFromNodeModules(appDir: string): { isMonorepo: boolean; monorepoRoot: string | null; nodeModulesRoot: string | null } {\n // Find where node_modules/@open-mercato/core is located (may be hoisted)\n const nodeModulesRoot = findNodeModulesRoot(appDir)\n if (!nodeModulesRoot) {\n return { isMonorepo: false, monorepoRoot: null, nodeModulesRoot: null }\n }\n\n const corePkgPath = path.join(nodeModulesRoot, 'node_modules', '@open-mercato', 'core')\n\n const workspaceCoreModules = path.join(nodeModulesRoot, 'packages', 'core', 'src', 'modules')\n if (fs.existsSync(workspaceCoreModules)) {\n return { isMonorepo: true, monorepoRoot: nodeModulesRoot, nodeModulesRoot }\n }\n\n try {\n const stat = fs.lstatSync(corePkgPath)\n if (stat.isSymbolicLink()) {\n // It's a symlink - we're in monorepo dev mode\n // Resolve the symlink to find the monorepo root\n const realPath = fs.realpathSync(corePkgPath)\n // realPath is something like /path/to/monorepo/packages/core\n // monorepo root is 2 levels up\n const monorepoRoot = path.dirname(path.dirname(realPath))\n return { isMonorepo: true, monorepoRoot, nodeModulesRoot }\n }\n // It's a real directory - production mode\n return { isMonorepo: false, monorepoRoot: null, nodeModulesRoot }\n } catch {\n // Package doesn't exist yet or error reading - assume production mode\n return { isMonorepo: false, monorepoRoot: null, nodeModulesRoot }\n }\n}\n\nexport function createResolver(cwd: string = process.cwd()): PackageResolver {\n // First detect if we're in a monorepo by checking if node_modules packages are symlinks\n const { isMonorepo: _isMonorepo, monorepoRoot, nodeModulesRoot } = detectMonorepoFromNodeModules(cwd)\n // In workspaces with hoisted real directories, package sources live under the discovered node_modules root.\n const rootDir = monorepoRoot ?? nodeModulesRoot ?? cwd\n\n // shouldResolveAppFromRoot: true when we have a workspace/install root that differs from cwd\n // (monorepo symlinks detected, or node_modules root found above cwd)\n const shouldResolveAppFromRoot =\n _isMonorepo || (nodeModulesRoot !== null && path.resolve(nodeModulesRoot) !== path.resolve(cwd))\n\n // The app directory depends on context:\n // - In monorepo: use detectAppDir to find apps/mercato or similar\n // - When symlinks not detected (e.g. Docker volume node_modules): still use apps/mercato if present at rootDir\n // - Otherwise: app is at cwd\n const candidateAppDir = shouldResolveAppFromRoot ? detectAppDir(rootDir, true) : rootDir\n const appDir =\n _isMonorepo\n ? candidateAppDir\n : shouldResolveAppFromRoot && candidateAppDir !== rootDir && fs.existsSync(candidateAppDir)\n ? candidateAppDir\n : cwd\n\n return {\n isMonorepo: () => _isMonorepo,\n\n getRootDir: () => rootDir,\n\n getAppDir: () => appDir,\n\n getOutputDir: () => {\n // Output is ALWAYS .mercato/generated relative to app directory\n return path.join(appDir, '.mercato', 'generated')\n },\n\n getModulesConfigPath: () => path.join(appDir, 'src', 'modules.ts'),\n\n discoverPackages: () => {\n return _isMonorepo\n ? discoverPackagesInMonorepo(rootDir)\n : discoverPackagesInNodeModules(rootDir)\n },\n\n loadEnabledModules: () => loadEnabledModulesFromConfig(appDir),\n\n getModulePaths: (entry: ModuleEntry) => {\n const appBase = path.resolve(appDir, 'src/modules', entry.id)\n const pkgModulesRoot = pkgDirFor(rootDir, entry.from, _isMonorepo, appDir)\n const pkgBase = path.join(pkgModulesRoot, entry.id)\n return { appBase, pkgBase }\n },\n\n getModuleImportBase: (entry: ModuleEntry) => {\n // Prefer @app overrides at import-time; fall back to provided package alias\n const from = entry.from || '@open-mercato/core'\n return {\n appBase: `@/modules/${entry.id}`,\n pkgBase: `${from}/modules/${entry.id}`,\n }\n },\n\n getPackageOutputDir: (packageName: string) => {\n if (packageName === '@app') {\n // App output goes to .mercato/generated\n return path.join(appDir, '.mercato', 'generated')\n }\n const pkgRoot = pkgRootFor(rootDir, packageName, _isMonorepo, appDir)\n return path.join(pkgRoot, 'generated')\n },\n\n getPackageRoot: (from?: string) => {\n return pkgRootFor(rootDir, from, _isMonorepo, appDir)\n },\n }\n}\n\n/**\n * Resolve the CLI execution environment as a plain value-object.\n * Call once at subsystem init; use the returned object for all path decisions.\n */\nexport function resolveEnvironment(cwd: string = process.cwd()): CliEnvironment {\n const resolver = createResolver(cwd)\n const _isMonorepo = resolver.isMonorepo()\n const rootDir = resolver.getRootDir()\n const appDir = resolver.getAppDir()\n return {\n mode: _isMonorepo ? 'monorepo' : 'standalone',\n rootDir,\n appDir,\n packageRoot: (packageName: string) => pkgRootFor(rootDir, packageName, _isMonorepo, appDir),\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,SAAS,+BAA+B;AACxC,SAAS,8CAA8C;AAmDvD,SAAS,UAAU,SAAiB,MAAe,aAAa,MAAM,SAAS,SAAiB;AAC9F,QAAM,cAAc,WAAW,SAAS,MAAM,YAAY,MAAM;AAChE,QAAM,gBAAgB,KAAK,KAAK,aAAa,OAAO,SAAS;AAC7D,QAAM,cAAc,KAAK,KAAK,aAAa,QAAQ,SAAS;AAC5D,QAAM,mBAAmB,cAAc,YAAY,WAAW,KAAK,KAAK,SAAS,UAAU,IAAI,KAAK,GAAG;AACvG,MAAI,oBAAoB,GAAG,WAAW,aAAa,EAAG,QAAO;AAC7D,MAAI,GAAG,WAAW,WAAW,EAAG,QAAO;AACvC,SAAO;AACT;AAEA,SAAS,WAAW,SAAiB,MAAe,aAAa,MAAM,SAAS,SAAiB;AAC/F,QAAM,cAAc,QAAQ;AAC5B,MAAI,YAAY;AACd,UAAM,iBAAiB,YAAY,MAAM,uBAAuB;AAChE,QAAI,gBAAgB;AAClB,YAAM,gBAAgB,KAAK,KAAK,SAAS,YAAY,eAAe,CAAC,CAAC;AACtE,UAAI,GAAG,WAAW,aAAa,EAAG,QAAO;AAAA,IAC3C;AAAA,EACF;AACA,SAAO,uCAAuC,aAAa,MAAM,KAAK,KAAK,KAAK,SAAS,gBAAgB,WAAW;AACtH;AAEA,SAAS,2B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