@open-mercato/cli 0.9.1-develop.7475.1.28ca93ed97 → 0.9.1-develop.7477.1.64ba865101
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/dist/agentic/guides/module-facts.json +152 -152
- package/dist/agentic/guides/module-facts.v2.json +152 -152
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/index.md +1 -1
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/index.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customers/index.md +1 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/index.md +1 -1
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
- package/dist/agentic/guides/modules/entities/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
- package/dist/agentic/guides/modules/integrations/index.md +1 -1
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/index.md +1 -1
- package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/sales/index.md +1 -1
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/security/index.md +1 -1
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/index.md +1 -1
- package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
- package/dist/agentic/guides/modules/telemetry/index.md +1 -1
- package/dist/agentic/guides/modules/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/reference-module-facts.json +1 -1
- package/dist/agentic/guides/upstream/manifest.json +1 -1
- package/dist/bin.js +2 -0
- package/dist/bin.js.map +2 -2
- package/package.json +7 -7
- package/src/bin.ts +5 -0
- package/src/lib/__tests__/bin-next-subpath-hook.test.ts +25 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# telemetry — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/telemetry 0.9.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/telemetry 0.9.1-develop.7477.1.64ba865101; core 0.9.1-develop.7477.1.64ba865101 — R1 staleness stamp -->
|
|
3
3
|
Source root: node_modules/@open-mercato/telemetry/src/modules/telemetry
|
|
4
4
|
|
|
5
5
|
## Sections
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# tillio — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/tillio 0.9.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/tillio 0.9.1-develop.7477.1.64ba865101; core 0.9.1-develop.7477.1.64ba865101 — R1 staleness stamp -->
|
|
3
3
|
Source root: node_modules/@open-mercato/tillio/src/modules/tillio
|
|
4
4
|
|
|
5
5
|
## Sections
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# translations — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/core 0.9.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.9.1-develop.7477.1.64ba865101; core 0.9.1-develop.7477.1.64ba865101 — R1 staleness stamp -->
|
|
3
3
|
Source root: node_modules/@open-mercato/core/src/modules/translations
|
|
4
4
|
|
|
5
5
|
## Sections
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# warranty_claims — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/core 0.9.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.9.1-develop.7477.1.64ba865101; core 0.9.1-develop.7477.1.64ba865101 — R1 staleness stamp -->
|
|
3
3
|
Source root: node_modules/@open-mercato/core/src/modules/warranty_claims
|
|
4
4
|
|
|
5
5
|
## Sections
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# webhooks — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/webhooks 0.9.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/webhooks 0.9.1-develop.7477.1.64ba865101; core 0.9.1-develop.7477.1.64ba865101 — R1 staleness stamp -->
|
|
3
3
|
Source root: node_modules/@open-mercato/webhooks/src/modules/webhooks
|
|
4
4
|
|
|
5
5
|
## Sections
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# wms — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/core 0.9.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.9.1-develop.7477.1.64ba865101; core 0.9.1-develop.7477.1.64ba865101 — R1 staleness stamp -->
|
|
3
3
|
Source root: node_modules/@open-mercato/core/src/modules/wms
|
|
4
4
|
|
|
5
5
|
## Sections
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# workflows — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/core 0.9.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.9.1-develop.7477.1.64ba865101; core 0.9.1-develop.7477.1.64ba865101 — R1 staleness stamp -->
|
|
3
3
|
Source root: node_modules/@open-mercato/core/src/modules/workflows
|
|
4
4
|
|
|
5
5
|
## Sections
|
|
@@ -1185,7 +1185,7 @@
|
|
|
1185
1185
|
"facts": {
|
|
1186
1186
|
"title": "Example Module",
|
|
1187
1187
|
"description": "Demonstrates pages, APIs, entities and DI.",
|
|
1188
|
-
"coreVersion": "0.9.1-develop.
|
|
1188
|
+
"coreVersion": "0.9.1-develop.7477.1.64ba865101",
|
|
1189
1189
|
"sourcePackage": null,
|
|
1190
1190
|
"sourceVersion": null,
|
|
1191
1191
|
"sourceRoot": "src/modules/example",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"generator": "@open-mercato/cli@0.9.1-develop.
|
|
3
|
+
"generator": "@open-mercato/cli@0.9.1-develop.7477.1.64ba865101",
|
|
4
4
|
"files": {
|
|
5
5
|
"AGENTS.md": "9fdaca247f55c64f5966cc103265cfb03233e0532f58f14aff538ae18aa3555d",
|
|
6
6
|
"BACKWARD_COMPATIBILITY.md": "4ed6dfe6a79217d169748d52b92856516ed7fadff0f785c6d4b1913555e2e933"
|
package/dist/bin.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { isTelemetryBackendEnabled } from "@open-mercato/shared/lib/telemetry/runtime";
|
|
3
|
+
import { installNextSubpathResolveHook } from "@open-mercato/shared/lib/bootstrap/next-subpath-resolve-hook";
|
|
3
4
|
import { resolveCliBootstrapMode } from "./lib/cli-bootstrap-mode.js";
|
|
4
5
|
import { flushBeforeExit } from "./lib/flush-before-exit.js";
|
|
5
6
|
function assertNode24Runtime() {
|
|
@@ -48,6 +49,7 @@ async function tryBootstrap(mode) {
|
|
|
48
49
|
}
|
|
49
50
|
async function main() {
|
|
50
51
|
assertNode24Runtime();
|
|
52
|
+
installNextSubpathResolveHook();
|
|
51
53
|
const bootstrapMode = resolveCliBootstrapMode(process.argv);
|
|
52
54
|
if (bootstrapMode !== "none") {
|
|
53
55
|
const { loadAppEnv } = await import("./lib/load-env.js");
|
package/dist/bin.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/bin.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * CLI binary entry point for @open-mercato/cli package.\n *\n * Called from within a Next.js app directory as: yarn mercato <command>\n * Uses dynamic app resolution to find generated files at .mercato/generated/\n */\nimport { isTelemetryBackendEnabled } from '@open-mercato/shared/lib/telemetry/runtime'\nimport { resolveCliBootstrapMode, type CliBootstrapMode } from './lib/cli-bootstrap-mode.js'\nimport { flushBeforeExit } from './lib/flush-before-exit.js'\n// `run` is imported dynamically inside `main()` so telemetry can initialize\n// before the mercato entry (and its Postgres driver) loads \u2014 see main().\n\nfunction assertNode24Runtime(): void {\n const detectedNodeVersion = process.versions.node\n const majorVersion = Number.parseInt(detectedNodeVersion.split('.')[0] ?? '0', 10)\n if (majorVersion >= 24) {\n return\n }\n throw new Error(\n [\n 'Unsupported Node.js runtime.',\n `Cause: Detected Node ${detectedNodeVersion}, but Open Mercato requires Node 24.x.`,\n 'What to do: switch your shell to Node 24 (for example `nvm use 24`), run `yarn install`, then retry.',\n ].join(' '),\n )\n}\n\nasync function tryBootstrap(mode: Exclude<CliBootstrapMode, 'none'>): Promise<boolean> {\n try {\n // Use the CLI resolver to find the app directory (handles monorepo detection)\n const { createResolver } = await import('./lib/resolver.js')\n const resolver = createResolver()\n const appDir = resolver.getAppDir()\n\n if (mode === 'dev-supervisor') {\n const {\n canUseLightweightDevSupervisor,\n loadDevSupervisorManifest,\n registerDevSupervisorManifest,\n } = await import(\n './lib/dev-supervisor-manifest.js'\n )\n const manifest = loadDevSupervisorManifest(appDir)\n if (canUseLightweightDevSupervisor(manifest)) {\n registerDevSupervisorManifest(manifest)\n return true\n }\n }\n\n const { bootstrapFromAppRoot } = await import('@open-mercato/shared/lib/bootstrap/dynamicLoader')\n const { registerCliModules } = await import('./mercato.js')\n const data = await bootstrapFromAppRoot(appDir)\n // Register CLI modules directly to avoid module resolution issues\n registerCliModules(data.modules)\n return true\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n // Check if the error is about missing generated files\n if (\n message.includes('dev-supervisor.generated.json') ||\n (\n message.includes('Cannot find module') &&\n (message.includes('/generated/') || message.includes('.generated') || message.includes('.mercato'))\n )\n ) {\n return false\n }\n // Re-throw other errors\n throw err\n }\n}\n\nasync function main(): Promise<void> {\n assertNode24Runtime()\n const bootstrapMode = resolveCliBootstrapMode(process.argv)\n\n if (bootstrapMode !== 'none') {\n // Load the app's `.env` BEFORE initTelemetry(): `run()` only dotenv-loads it\n // later (ensureEnvLoaded), which is too late \u2014 TELEMETRY_BACKEND set only in\n // `.env` would silently resolve to `noop` for worker/scheduler processes.\n // The loader touches only the resolver + dotenv (no `pg`), preserving the\n // instrumentation load-order guarantee below.\n const { loadAppEnv } = await import('./lib/load-env.js')\n await loadAppEnv()\n\n // Initialize telemetry BEFORE bootstrapping the app graph. Bootstrap and the\n // per-command handlers load MikroORM's Postgres driver \u2192 `pg`, and the\n // OpenTelemetry pg/undici auto-instrumentation only records spans for a\n // driver required AFTER the SDK has started. Registering here \u2014 ahead of any\n // app module \u2014 is what lets long-running worker/scheduler processes emit DB\n // spans (not just the bullmq-otel add/process envelope). The package itself\n // is not imported unless an explicit supported backend is selected.\n if (isTelemetryBackendEnabled()) {\n const { initTelemetry } = await import('@open-mercato/telemetry')\n await initTelemetry()\n }\n\n const bootstrapSucceeded = await tryBootstrap(bootstrapMode)\n if (!bootstrapSucceeded) {\n console.error('\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557')\n console.error('\u2551 Generated files not found! \u2551')\n console.error('\u2551 \u2551')\n console.error('\u2551 The CLI requires generated files to discover modules. \u2551')\n console.error('\u2551 Please run the following command first: \u2551')\n console.error('\u2551 \u2551')\n console.error('\u2551 yarn mercato generate \u2551')\n console.error('\u2551 \u2551')\n console.error('\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D')\n process.exit(1)\n }\n }\n\n // Dynamic import (not a top-level static import) so the mercato entry \u2014 and the\n // Postgres driver it pulls in \u2014 loads only after initTelemetry() above.\n const { run } = await import('./mercato.js')\n const code = await run(process.argv)\n // Flush the coalesced browser broadcasts, then spans/logs, for commands that\n // return (workers block forever and flush via their own shutdown handler instead).\n await flushBeforeExit()\n process.exit(code ?? 0)\n}\n\nmain().catch((error: unknown) => {\n if (error instanceof Error) {\n console.error(error.message)\n } else {\n console.error(error)\n }\n process.exit(1)\n})\n"],
|
|
5
|
-
"mappings": "AAMA,SAAS,iCAAiC;AAC1C,SAAS,+BAAsD;AAC/D,SAAS,uBAAuB;AAIhC,SAAS,sBAA4B;AACnC,QAAM,sBAAsB,QAAQ,SAAS;AAC7C,QAAM,eAAe,OAAO,SAAS,oBAAoB,MAAM,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE;AACjF,MAAI,gBAAgB,IAAI;AACtB;AAAA,EACF;AACA,QAAM,IAAI;AAAA,IACR;AAAA,MACE;AAAA,MACA,wBAAwB,mBAAmB;AAAA,MAC3C;AAAA,IACF,EAAE,KAAK,GAAG;AAAA,EACZ;AACF;AAEA,eAAe,aAAa,MAA2D;AACrF,MAAI;AAEF,UAAM,EAAE,eAAe,IAAI,MAAM,OAAO,mBAAmB;AAC3D,UAAM,WAAW,eAAe;AAChC,UAAM,SAAS,SAAS,UAAU;AAElC,QAAI,SAAS,kBAAkB;AAC7B,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,MACF,IAAI,MAAM,OACR,kCACF;AACA,YAAM,WAAW,0BAA0B,MAAM;AACjD,UAAI,+BAA+B,QAAQ,GAAG;AAC5C,sCAA8B,QAAQ;AACtC,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,kDAAkD;AAChG,UAAM,EAAE,mBAAmB,IAAI,MAAM,OAAO,cAAc;AAC1D,UAAM,OAAO,MAAM,qBAAqB,MAAM;AAE9C,uBAAmB,KAAK,OAAO;AAC/B,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,UAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAE/D,QACE,QAAQ,SAAS,+BAA+B,KAE9C,QAAQ,SAAS,oBAAoB,MACpC,QAAQ,SAAS,aAAa,KAAK,QAAQ,SAAS,YAAY,KAAK,QAAQ,SAAS,UAAU,IAEnG;AACA,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;AAEA,eAAe,OAAsB;AACnC,sBAAoB;
|
|
4
|
+
"sourcesContent": ["/**\n * CLI binary entry point for @open-mercato/cli package.\n *\n * Called from within a Next.js app directory as: yarn mercato <command>\n * Uses dynamic app resolution to find generated files at .mercato/generated/\n */\nimport { isTelemetryBackendEnabled } from '@open-mercato/shared/lib/telemetry/runtime'\nimport { installNextSubpathResolveHook } from '@open-mercato/shared/lib/bootstrap/next-subpath-resolve-hook'\nimport { resolveCliBootstrapMode, type CliBootstrapMode } from './lib/cli-bootstrap-mode.js'\nimport { flushBeforeExit } from './lib/flush-before-exit.js'\n// `run` is imported dynamically inside `main()` so telemetry can initialize\n// before the mercato entry (and its Postgres driver) loads \u2014 see main().\n\nfunction assertNode24Runtime(): void {\n const detectedNodeVersion = process.versions.node\n const majorVersion = Number.parseInt(detectedNodeVersion.split('.')[0] ?? '0', 10)\n if (majorVersion >= 24) {\n return\n }\n throw new Error(\n [\n 'Unsupported Node.js runtime.',\n `Cause: Detected Node ${detectedNodeVersion}, but Open Mercato requires Node 24.x.`,\n 'What to do: switch your shell to Node 24 (for example `nvm use 24`), run `yarn install`, then retry.',\n ].join(' '),\n )\n}\n\nasync function tryBootstrap(mode: Exclude<CliBootstrapMode, 'none'>): Promise<boolean> {\n try {\n // Use the CLI resolver to find the app directory (handles monorepo detection)\n const { createResolver } = await import('./lib/resolver.js')\n const resolver = createResolver()\n const appDir = resolver.getAppDir()\n\n if (mode === 'dev-supervisor') {\n const {\n canUseLightweightDevSupervisor,\n loadDevSupervisorManifest,\n registerDevSupervisorManifest,\n } = await import(\n './lib/dev-supervisor-manifest.js'\n )\n const manifest = loadDevSupervisorManifest(appDir)\n if (canUseLightweightDevSupervisor(manifest)) {\n registerDevSupervisorManifest(manifest)\n return true\n }\n }\n\n const { bootstrapFromAppRoot } = await import('@open-mercato/shared/lib/bootstrap/dynamicLoader')\n const { registerCliModules } = await import('./mercato.js')\n const data = await bootstrapFromAppRoot(appDir)\n // Register CLI modules directly to avoid module resolution issues\n registerCliModules(data.modules)\n return true\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n // Check if the error is about missing generated files\n if (\n message.includes('dev-supervisor.generated.json') ||\n (\n message.includes('Cannot find module') &&\n (message.includes('/generated/') || message.includes('.generated') || message.includes('.mercato'))\n )\n ) {\n return false\n }\n // Re-throw other errors\n throw err\n }\n}\n\nasync function main(): Promise<void> {\n assertNode24Runtime()\n // Commands and workers run in plain Node, where a bare `next/<subpath>` such\n // as `next/dynamic` or `next/link` does not resolve (#7102). Install the\n // retry-with-`.js` hook before any package dist can be imported.\n installNextSubpathResolveHook()\n const bootstrapMode = resolveCliBootstrapMode(process.argv)\n\n if (bootstrapMode !== 'none') {\n // Load the app's `.env` BEFORE initTelemetry(): `run()` only dotenv-loads it\n // later (ensureEnvLoaded), which is too late \u2014 TELEMETRY_BACKEND set only in\n // `.env` would silently resolve to `noop` for worker/scheduler processes.\n // The loader touches only the resolver + dotenv (no `pg`), preserving the\n // instrumentation load-order guarantee below.\n const { loadAppEnv } = await import('./lib/load-env.js')\n await loadAppEnv()\n\n // Initialize telemetry BEFORE bootstrapping the app graph. Bootstrap and the\n // per-command handlers load MikroORM's Postgres driver \u2192 `pg`, and the\n // OpenTelemetry pg/undici auto-instrumentation only records spans for a\n // driver required AFTER the SDK has started. Registering here \u2014 ahead of any\n // app module \u2014 is what lets long-running worker/scheduler processes emit DB\n // spans (not just the bullmq-otel add/process envelope). The package itself\n // is not imported unless an explicit supported backend is selected.\n if (isTelemetryBackendEnabled()) {\n const { initTelemetry } = await import('@open-mercato/telemetry')\n await initTelemetry()\n }\n\n const bootstrapSucceeded = await tryBootstrap(bootstrapMode)\n if (!bootstrapSucceeded) {\n console.error('\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557')\n console.error('\u2551 Generated files not found! \u2551')\n console.error('\u2551 \u2551')\n console.error('\u2551 The CLI requires generated files to discover modules. \u2551')\n console.error('\u2551 Please run the following command first: \u2551')\n console.error('\u2551 \u2551')\n console.error('\u2551 yarn mercato generate \u2551')\n console.error('\u2551 \u2551')\n console.error('\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D')\n process.exit(1)\n }\n }\n\n // Dynamic import (not a top-level static import) so the mercato entry \u2014 and the\n // Postgres driver it pulls in \u2014 loads only after initTelemetry() above.\n const { run } = await import('./mercato.js')\n const code = await run(process.argv)\n // Flush the coalesced browser broadcasts, then spans/logs, for commands that\n // return (workers block forever and flush via their own shutdown handler instead).\n await flushBeforeExit()\n process.exit(code ?? 0)\n}\n\nmain().catch((error: unknown) => {\n if (error instanceof Error) {\n console.error(error.message)\n } else {\n console.error(error)\n }\n process.exit(1)\n})\n"],
|
|
5
|
+
"mappings": "AAMA,SAAS,iCAAiC;AAC1C,SAAS,qCAAqC;AAC9C,SAAS,+BAAsD;AAC/D,SAAS,uBAAuB;AAIhC,SAAS,sBAA4B;AACnC,QAAM,sBAAsB,QAAQ,SAAS;AAC7C,QAAM,eAAe,OAAO,SAAS,oBAAoB,MAAM,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE;AACjF,MAAI,gBAAgB,IAAI;AACtB;AAAA,EACF;AACA,QAAM,IAAI;AAAA,IACR;AAAA,MACE;AAAA,MACA,wBAAwB,mBAAmB;AAAA,MAC3C;AAAA,IACF,EAAE,KAAK,GAAG;AAAA,EACZ;AACF;AAEA,eAAe,aAAa,MAA2D;AACrF,MAAI;AAEF,UAAM,EAAE,eAAe,IAAI,MAAM,OAAO,mBAAmB;AAC3D,UAAM,WAAW,eAAe;AAChC,UAAM,SAAS,SAAS,UAAU;AAElC,QAAI,SAAS,kBAAkB;AAC7B,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,MACF,IAAI,MAAM,OACR,kCACF;AACA,YAAM,WAAW,0BAA0B,MAAM;AACjD,UAAI,+BAA+B,QAAQ,GAAG;AAC5C,sCAA8B,QAAQ;AACtC,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,kDAAkD;AAChG,UAAM,EAAE,mBAAmB,IAAI,MAAM,OAAO,cAAc;AAC1D,UAAM,OAAO,MAAM,qBAAqB,MAAM;AAE9C,uBAAmB,KAAK,OAAO;AAC/B,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,UAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAE/D,QACE,QAAQ,SAAS,+BAA+B,KAE9C,QAAQ,SAAS,oBAAoB,MACpC,QAAQ,SAAS,aAAa,KAAK,QAAQ,SAAS,YAAY,KAAK,QAAQ,SAAS,UAAU,IAEnG;AACA,aAAO;AAAA,IACT;AAEA,UAAM;AAAA,EACR;AACF;AAEA,eAAe,OAAsB;AACnC,sBAAoB;AAIpB,gCAA8B;AAC9B,QAAM,gBAAgB,wBAAwB,QAAQ,IAAI;AAE1D,MAAI,kBAAkB,QAAQ;AAM5B,UAAM,EAAE,WAAW,IAAI,MAAM,OAAO,mBAAmB;AACvD,UAAM,WAAW;AASjB,QAAI,0BAA0B,GAAG;AAC/B,YAAM,EAAE,cAAc,IAAI,MAAM,OAAO,yBAAyB;AAChE,YAAM,cAAc;AAAA,IACtB;AAEA,UAAM,qBAAqB,MAAM,aAAa,aAAa;AAC3D,QAAI,CAAC,oBAAoB;AACvB,cAAQ,MAAM,gaAAuE;AACrF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,gFAAsE;AACpF,cAAQ,MAAM,gFAAsE;AACpF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,gFAAsE;AACpF,cAAQ,MAAM,iFAAuE;AACrF,cAAQ,MAAM,gaAAuE;AACrF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AAIA,QAAM,EAAE,IAAI,IAAI,MAAM,OAAO,cAAc;AAC3C,QAAM,OAAO,MAAM,IAAI,QAAQ,IAAI;AAGnC,QAAM,gBAAgB;AACtB,UAAQ,KAAK,QAAQ,CAAC;AACxB;AAEA,KAAK,EAAE,MAAM,CAAC,UAAmB;AAC/B,MAAI,iBAAiB,OAAO;AAC1B,YAAQ,MAAM,MAAM,OAAO;AAAA,EAC7B,OAAO;AACL,YAAQ,MAAM,KAAK;AAAA,EACrB;AACA,UAAQ,KAAK,CAAC;AAChB,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/cli",
|
|
3
|
-
"version": "0.9.1-develop.
|
|
3
|
+
"version": "0.9.1-develop.7477.1.64ba865101",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"@mikro-orm/decorators": "^7.1.14",
|
|
61
61
|
"@mikro-orm/migrations": "^7.1.14",
|
|
62
62
|
"@mikro-orm/postgresql": "^7.1.14",
|
|
63
|
-
"@open-mercato/events": "0.9.1-develop.
|
|
64
|
-
"@open-mercato/queue": "0.9.1-develop.
|
|
65
|
-
"@open-mercato/shared": "0.9.1-develop.
|
|
66
|
-
"@open-mercato/telemetry": "0.9.1-develop.
|
|
63
|
+
"@open-mercato/events": "0.9.1-develop.7477.1.64ba865101",
|
|
64
|
+
"@open-mercato/queue": "0.9.1-develop.7477.1.64ba865101",
|
|
65
|
+
"@open-mercato/shared": "0.9.1-develop.7477.1.64ba865101",
|
|
66
|
+
"@open-mercato/telemetry": "0.9.1-develop.7477.1.64ba865101",
|
|
67
67
|
"cross-spawn": "^7.0.6",
|
|
68
68
|
"pg": "8.23.0",
|
|
69
69
|
"semver": "^7.8.5",
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
"typescript-js": "npm:typescript@6.0.3"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@open-mercato/shared": "0.9.1-develop.
|
|
77
|
+
"@open-mercato/shared": "0.9.1-develop.7477.1.64ba865101"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@open-mercato/shared": "0.9.1-develop.
|
|
80
|
+
"@open-mercato/shared": "0.9.1-develop.7477.1.64ba865101",
|
|
81
81
|
"@types/jest": "^30.0.0",
|
|
82
82
|
"jest": "^30.4.2",
|
|
83
83
|
"ts-jest": "^29.4.12"
|
package/src/bin.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Uses dynamic app resolution to find generated files at .mercato/generated/
|
|
6
6
|
*/
|
|
7
7
|
import { isTelemetryBackendEnabled } from '@open-mercato/shared/lib/telemetry/runtime'
|
|
8
|
+
import { installNextSubpathResolveHook } from '@open-mercato/shared/lib/bootstrap/next-subpath-resolve-hook'
|
|
8
9
|
import { resolveCliBootstrapMode, type CliBootstrapMode } from './lib/cli-bootstrap-mode.js'
|
|
9
10
|
import { flushBeforeExit } from './lib/flush-before-exit.js'
|
|
10
11
|
// `run` is imported dynamically inside `main()` so telemetry can initialize
|
|
@@ -72,6 +73,10 @@ async function tryBootstrap(mode: Exclude<CliBootstrapMode, 'none'>): Promise<bo
|
|
|
72
73
|
|
|
73
74
|
async function main(): Promise<void> {
|
|
74
75
|
assertNode24Runtime()
|
|
76
|
+
// Commands and workers run in plain Node, where a bare `next/<subpath>` such
|
|
77
|
+
// as `next/dynamic` or `next/link` does not resolve (#7102). Install the
|
|
78
|
+
// retry-with-`.js` hook before any package dist can be imported.
|
|
79
|
+
installNextSubpathResolveHook()
|
|
75
80
|
const bootstrapMode = resolveCliBootstrapMode(process.argv)
|
|
76
81
|
|
|
77
82
|
if (bootstrapMode !== 'none') {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Regression (#7102): CLI commands and workers load package dists that import
|
|
6
|
+
* bare `next/dynamic`, `next/link`, … which plain Node ESM cannot resolve. The
|
|
7
|
+
* entry must install the resolve hook before anything can import such a dist.
|
|
8
|
+
*/
|
|
9
|
+
describe('bin.ts next/<subpath> resolve hook', () => {
|
|
10
|
+
const binSource = fs.readFileSync(path.resolve(__dirname, '../../bin.ts'), 'utf8')
|
|
11
|
+
|
|
12
|
+
it('imports the shared resolve hook', () => {
|
|
13
|
+
expect(binSource).toContain(
|
|
14
|
+
"import { installNextSubpathResolveHook } from '@open-mercato/shared/lib/bootstrap/next-subpath-resolve-hook'",
|
|
15
|
+
)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('installs the hook before bootstrapping or loading the mercato entry', () => {
|
|
19
|
+
const installCall = binSource.indexOf('installNextSubpathResolveHook()')
|
|
20
|
+
expect(installCall).toBeGreaterThan(-1)
|
|
21
|
+
expect(installCall).toBeLessThan(binSource.indexOf('await loadAppEnv()'))
|
|
22
|
+
expect(installCall).toBeLessThan(binSource.indexOf('await tryBootstrap(bootstrapMode)'))
|
|
23
|
+
expect(installCall).toBeLessThan(binSource.indexOf("const { run } = await import('./mercato.js')"))
|
|
24
|
+
})
|
|
25
|
+
})
|