@open-mercato/cli 0.11.1-develop.8883.1.78d3645a50 → 0.11.1-develop.8920.1.d3c2cc4681
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 +7 -1
- package/dist/agentic/guides/integrations.md +1 -1
- package/dist/agentic/guides/module-facts.json +2106 -181
- package/dist/agentic/guides/module-facts.v2.json +2106 -181
- 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/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/backups/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
- package/dist/agentic/guides/modules/cart/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/acl-features.md +3 -1
- package/dist/agentic/guides/modules/catalog/backend-pages.md +3 -0
- package/dist/agentic/guides/modules/catalog/contribution-resolutions.md +4 -0
- package/dist/agentic/guides/modules/catalog/custom-entities.md +1 -0
- package/dist/agentic/guides/modules/catalog/domain-commands.md +3 -1
- package/dist/agentic/guides/modules/catalog/entities.md +3 -0
- package/dist/agentic/guides/modules/catalog/events.md +4 -1
- package/dist/agentic/guides/modules/catalog/exact-override-targets.md +5 -0
- package/dist/agentic/guides/modules/catalog/host-extension-points.md +1 -1
- package/dist/agentic/guides/modules/catalog/index.md +6 -6
- package/dist/agentic/guides/modules/catalog/search-entities.md +1 -0
- package/dist/agentic/guides/modules/catalog/umes-contributions.md +4 -0
- package/dist/agentic/guides/modules/catalog/umes-hosts.md +8 -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_ms365/acl-features.md +12 -0
- package/dist/agentic/guides/modules/channel_ms365/contribution-resolutions.md +12 -0
- package/dist/agentic/guides/modules/channel_ms365/di-registrations-rich.md +12 -0
- package/dist/agentic/guides/modules/channel_ms365/exact-override-targets.md +17 -0
- package/dist/agentic/guides/modules/channel_ms365/index.md +18 -0
- package/dist/agentic/guides/modules/channel_ms365/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/channel_ms365/setup.md +11 -0
- package/dist/agentic/guides/modules/channel_ms365/umes-contributions.md +12 -0
- 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/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/workers.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/incoming-installed-contributions.md +1 -0
- package/dist/agentic/guides/modules/communication_channels/index.md +2 -2
- package/dist/agentic/guides/modules/configs/acl-features.md +3 -1
- package/dist/agentic/guides/modules/configs/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/configs/exact-override-targets.md +3 -0
- package/dist/agentic/guides/modules/configs/index.md +3 -3
- package/dist/agentic/guides/modules/configs/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/configs/umes-hosts.md +1 -0
- 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/incoming-installed-contributions.md +1 -0
- package/dist/agentic/guides/modules/customers/index.md +1 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/index.md +1 -1
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
- package/dist/agentic/guides/modules/entities/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/gus_regon/acl-features.md +11 -0
- package/dist/agentic/guides/modules/gus_regon/cli-commands.md +12 -0
- package/dist/agentic/guides/modules/gus_regon/contribution-resolutions.md +11 -0
- package/dist/agentic/guides/modules/gus_regon/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/gus_regon/exact-override-targets.md +17 -0
- package/dist/agentic/guides/modules/gus_regon/index.md +19 -0
- package/dist/agentic/guides/modules/gus_regon/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/gus_regon/setup.md +11 -0
- package/dist/agentic/guides/modules/gus_regon/umes-contributions.md +11 -0
- 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/ledger/index.md +1 -1
- package/dist/agentic/guides/modules/maintenance/index.md +1 -1
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/index.md +1 -1
- package/dist/agentic/guides/modules/promotions/index.md +1 -1
- package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/sales/index.md +1 -1
- package/dist/agentic/guides/modules/sales_invoices_gl_posting/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/sync_shopify/acl-features.md +12 -0
- package/dist/agentic/guides/modules/sync_shopify/cli-commands.md +12 -0
- package/dist/agentic/guides/modules/sync_shopify/contribution-resolutions.md +11 -0
- package/dist/agentic/guides/modules/sync_shopify/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/sync_shopify/exact-override-targets.md +17 -0
- package/dist/agentic/guides/modules/sync_shopify/index.md +19 -0
- package/dist/agentic/guides/modules/sync_shopify/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/sync_shopify/setup.md +11 -0
- package/dist/agentic/guides/modules/sync_shopify/umes-contributions.md +11 -0
- 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/upgrade_actions/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 +2 -2
- package/dist/agentic/guides/reference-modules/example/index.md +1 -1
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +18 -0
- package/dist/agentic/guides/upstream/manifest.json +2 -2
- package/dist/agentic/shared/ai/harness/cases.json +4 -3
- package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +1 -1
- package/dist/lib/init-secrets.js +1 -1
- package/dist/lib/init-secrets.js.map +2 -2
- package/dist/lib/server-start-lock.js +120 -21
- package/dist/lib/server-start-lock.js.map +2 -2
- package/dist/lib/testing/integration-discovery.js +13 -0
- package/dist/lib/testing/integration-discovery.js.map +2 -2
- package/dist/lib/testing/integration.js +286 -26
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +9 -2
- package/dist/mercato.js.map +2 -2
- package/package.json +7 -7
- package/src/__tests__/mercato.test.ts +68 -0
- package/src/lib/__tests__/init-secrets.test.ts +11 -2
- package/src/lib/__tests__/server-start-lock.test.ts +400 -0
- package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +2 -0
- package/src/lib/init-secrets.ts +1 -1
- package/src/lib/server-start-lock.ts +170 -19
- package/src/lib/testing/__tests__/integration-prebuilt-artifacts.test.ts +486 -0
- package/src/lib/testing/__tests__/integration.test.ts +27 -0
- package/src/lib/testing/integration-discovery.ts +16 -0
- package/src/lib/testing/integration.ts +366 -27
- package/src/mercato.ts +9 -2
|
@@ -1,8 +1,25 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
|
-
|
|
4
|
+
const BOOT_ID_PATH = "/proc/sys/kernel/random/boot_id";
|
|
5
|
+
const STAT_FIRST_FIELD_AFTER_COMMAND = 3;
|
|
6
|
+
const STAT_START_TIME_FIELD = 22;
|
|
7
|
+
const TAKEOVER_BUSY_WAIT_MS = 25;
|
|
8
|
+
const MAX_TAKEOVER_ATTEMPTS = 400;
|
|
9
|
+
function readOptionalString(value) {
|
|
10
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
11
|
+
}
|
|
12
|
+
function readRawFile(filePath) {
|
|
13
|
+
try {
|
|
14
|
+
return fs.readFileSync(filePath, "utf8");
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (error.code === "ENOENT") return null;
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function parseServerStartLock(raw) {
|
|
21
|
+
if (raw === null) return null;
|
|
4
22
|
try {
|
|
5
|
-
const raw = fs.readFileSync(lockPath, "utf8");
|
|
6
23
|
const parsed = JSON.parse(raw);
|
|
7
24
|
if (typeof parsed.pid !== "number" || !Number.isInteger(parsed.pid) || parsed.pid <= 0) {
|
|
8
25
|
return null;
|
|
@@ -10,12 +27,34 @@ function readServerStartLock(lockPath) {
|
|
|
10
27
|
return {
|
|
11
28
|
pid: parsed.pid,
|
|
12
29
|
port: typeof parsed.port === "string" && parsed.port.trim().length > 0 ? parsed.port : null,
|
|
13
|
-
startedAt: typeof parsed.startedAt === "string" ? parsed.startedAt : ""
|
|
30
|
+
startedAt: typeof parsed.startedAt === "string" ? parsed.startedAt : "",
|
|
31
|
+
processStartTime: readOptionalString(parsed.processStartTime),
|
|
32
|
+
bootId: readOptionalString(parsed.bootId),
|
|
33
|
+
token: readOptionalString(parsed.token)
|
|
14
34
|
};
|
|
15
35
|
} catch {
|
|
16
36
|
return null;
|
|
17
37
|
}
|
|
18
38
|
}
|
|
39
|
+
function readProcessStartTime(pid) {
|
|
40
|
+
try {
|
|
41
|
+
const stat = fs.readFileSync(`/proc/${pid}/stat`, "utf8");
|
|
42
|
+
const commandEnd = stat.lastIndexOf(")");
|
|
43
|
+
if (commandEnd < 0) return null;
|
|
44
|
+
const fields = stat.slice(commandEnd + 1).trim().split(/\s+/);
|
|
45
|
+
const startTime = fields[STAT_START_TIME_FIELD - STAT_FIRST_FIELD_AFTER_COMMAND];
|
|
46
|
+
return startTime && /^\d+$/.test(startTime) ? startTime : null;
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function readBootId() {
|
|
52
|
+
try {
|
|
53
|
+
return readOptionalString(fs.readFileSync(BOOT_ID_PATH, "utf8"));
|
|
54
|
+
} catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
19
58
|
function isProcessAlive(pid) {
|
|
20
59
|
try {
|
|
21
60
|
process.kill(pid, 0);
|
|
@@ -24,6 +63,61 @@ function isProcessAlive(pid) {
|
|
|
24
63
|
return error.code === "EPERM";
|
|
25
64
|
}
|
|
26
65
|
}
|
|
66
|
+
function isLockOwnerAlive(lock) {
|
|
67
|
+
if (!isProcessAlive(lock.pid)) return false;
|
|
68
|
+
if (lock.bootId) {
|
|
69
|
+
const currentBootId = readBootId();
|
|
70
|
+
if (currentBootId && currentBootId !== lock.bootId) return false;
|
|
71
|
+
}
|
|
72
|
+
if (lock.processStartTime) {
|
|
73
|
+
const currentStartTime = readProcessStartTime(lock.pid);
|
|
74
|
+
if (currentStartTime && currentStartTime !== lock.processStartTime) return false;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
function isHeldByAnotherLiveProcess(record) {
|
|
79
|
+
return record !== null && record.pid !== process.pid && isLockOwnerAlive(record);
|
|
80
|
+
}
|
|
81
|
+
function publishExclusive(target, content) {
|
|
82
|
+
const tempPath = `${target}.${process.pid}.${randomUUID()}.tmp`;
|
|
83
|
+
fs.writeFileSync(tempPath, content, { encoding: "utf8", flag: "wx" });
|
|
84
|
+
try {
|
|
85
|
+
fs.linkSync(tempPath, target);
|
|
86
|
+
return true;
|
|
87
|
+
} catch (error) {
|
|
88
|
+
if (error.code === "EEXIST") return false;
|
|
89
|
+
throw error;
|
|
90
|
+
} finally {
|
|
91
|
+
fs.rmSync(tempPath, { force: true });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function sleepSync(ms) {
|
|
95
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
96
|
+
}
|
|
97
|
+
function removeStaleGeneration(lockPath, staleRaw, ownRaw) {
|
|
98
|
+
const generation = createHash("sha256").update(staleRaw).digest("hex").slice(0, 16);
|
|
99
|
+
const skippedGuards = [];
|
|
100
|
+
let ownedGuard = null;
|
|
101
|
+
try {
|
|
102
|
+
for (let slot = 0; ; slot += 1) {
|
|
103
|
+
const guardPath = `${lockPath}.${generation}.${slot}.takeover`;
|
|
104
|
+
if (publishExclusive(guardPath, ownRaw)) {
|
|
105
|
+
ownedGuard = guardPath;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
const guardRaw = readRawFile(guardPath);
|
|
109
|
+
if (guardRaw === null || isHeldByAnotherLiveProcess(parseServerStartLock(guardRaw))) return false;
|
|
110
|
+
skippedGuards.push(guardPath);
|
|
111
|
+
}
|
|
112
|
+
if (readRawFile(lockPath) === staleRaw) {
|
|
113
|
+
fs.rmSync(lockPath, { force: true });
|
|
114
|
+
}
|
|
115
|
+
for (const guardPath of skippedGuards) fs.rmSync(guardPath, { force: true });
|
|
116
|
+
return true;
|
|
117
|
+
} finally {
|
|
118
|
+
if (ownedGuard !== null) fs.rmSync(ownedGuard, { force: true });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
27
121
|
function getServerStartLockPath(appDir) {
|
|
28
122
|
return path.join(appDir, ".mercato", "server-start.lock");
|
|
29
123
|
}
|
|
@@ -32,34 +126,38 @@ function acquireServerStartLock(appDir, options = {}) {
|
|
|
32
126
|
const lockRecord = {
|
|
33
127
|
pid: process.pid,
|
|
34
128
|
port: typeof options.port === "string" && options.port.trim().length > 0 ? options.port.trim() : null,
|
|
35
|
-
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
129
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
130
|
+
processStartTime: readProcessStartTime(process.pid),
|
|
131
|
+
bootId: readBootId(),
|
|
132
|
+
token: randomUUID()
|
|
36
133
|
};
|
|
134
|
+
const ownRaw = JSON.stringify(lockRecord);
|
|
37
135
|
fs.mkdirSync(path.dirname(lockPath), { recursive: true });
|
|
38
|
-
for (; ; ) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
136
|
+
for (let attempt = 0; !publishExclusive(lockPath, ownRaw); attempt += 1) {
|
|
137
|
+
const existingRaw = readRawFile(lockPath);
|
|
138
|
+
if (existingRaw === null) continue;
|
|
139
|
+
const existingLock = parseServerStartLock(existingRaw);
|
|
140
|
+
if (isHeldByAnotherLiveProcess(existingLock)) {
|
|
141
|
+
const portSuffix = existingLock.port ? ` on port ${existingLock.port}` : "";
|
|
142
|
+
throw new Error(
|
|
143
|
+
`[server] Another Open Mercato production server is already running for ${appDir} (pid ${existingLock.pid}${portSuffix}). Stop it before starting another instance.`
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
if (!removeStaleGeneration(lockPath, existingRaw, ownRaw)) {
|
|
147
|
+
if (attempt >= MAX_TAKEOVER_ATTEMPTS) {
|
|
50
148
|
throw new Error(
|
|
51
|
-
`[server] Another
|
|
149
|
+
`[server] Another process is still replacing the stale server start lock for ${appDir}. Try again.`
|
|
52
150
|
);
|
|
53
151
|
}
|
|
54
|
-
|
|
152
|
+
sleepSync(TAKEOVER_BUSY_WAIT_MS);
|
|
55
153
|
}
|
|
56
154
|
}
|
|
57
155
|
let released = false;
|
|
58
156
|
const release = () => {
|
|
59
157
|
if (released) return;
|
|
60
158
|
released = true;
|
|
61
|
-
const currentLock =
|
|
62
|
-
if (currentLock?.
|
|
159
|
+
const currentLock = parseServerStartLock(readRawFile(lockPath));
|
|
160
|
+
if (currentLock?.token === lockRecord.token) {
|
|
63
161
|
fs.rmSync(lockPath, { force: true });
|
|
64
162
|
}
|
|
65
163
|
};
|
|
@@ -71,6 +169,7 @@ function acquireServerStartLock(appDir, options = {}) {
|
|
|
71
169
|
}
|
|
72
170
|
export {
|
|
73
171
|
acquireServerStartLock,
|
|
74
|
-
getServerStartLockPath
|
|
172
|
+
getServerStartLockPath,
|
|
173
|
+
readProcessStartTime
|
|
75
174
|
};
|
|
76
175
|
//# sourceMappingURL=server-start-lock.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/lib/server-start-lock.ts"],
|
|
4
|
-
"sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\n\ntype ServerStartLockRecord = {\n pid: number\n port: string | null\n startedAt: string\n}\n\nexport type ServerStartLockHandle = {\n lockPath: string\n release: () => void\n}\n\nfunction
|
|
5
|
-
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;
|
|
4
|
+
"sourcesContent": ["import { createHash, randomUUID } from 'node:crypto'\nimport fs from 'node:fs'\nimport path from 'node:path'\n\ntype ServerStartLockRecord = {\n pid: number\n port: string | null\n startedAt: string\n processStartTime: string | null\n bootId: string | null\n token: string | null\n}\n\nexport type ServerStartLockHandle = {\n lockPath: string\n release: () => void\n}\n\nconst BOOT_ID_PATH = '/proc/sys/kernel/random/boot_id'\nconst STAT_FIRST_FIELD_AFTER_COMMAND = 3\nconst STAT_START_TIME_FIELD = 22\nconst TAKEOVER_BUSY_WAIT_MS = 25\nconst MAX_TAKEOVER_ATTEMPTS = 400\n\nfunction readOptionalString(value: unknown): string | null {\n return typeof value === 'string' && value.trim().length > 0 ? value.trim() : null\n}\n\nfunction readRawFile(filePath: string): string | null {\n try {\n return fs.readFileSync(filePath, 'utf8')\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return null\n throw error\n }\n}\n\nfunction parseServerStartLock(raw: string | null): ServerStartLockRecord | null {\n if (raw === null) return null\n try {\n const parsed = JSON.parse(raw) as Partial<ServerStartLockRecord>\n if (typeof parsed.pid !== 'number' || !Number.isInteger(parsed.pid) || parsed.pid <= 0) {\n return null\n }\n return {\n pid: parsed.pid,\n port: typeof parsed.port === 'string' && parsed.port.trim().length > 0 ? parsed.port : null,\n startedAt: typeof parsed.startedAt === 'string' ? parsed.startedAt : '',\n processStartTime: readOptionalString(parsed.processStartTime),\n bootId: readOptionalString(parsed.bootId),\n token: readOptionalString(parsed.token),\n }\n } catch {\n return null\n }\n}\n\n/**\n * Reads the start time of `pid` (field 22 of `/proc/<pid>/stat`). The command name\n * in field 2 may contain spaces or parentheses, so only the text after the last `)`\n * is split. Returns `null` when the platform has no `/proc` (macOS, Windows) or the\n * entry cannot be read or parsed.\n */\nexport function readProcessStartTime(pid: number): string | null {\n try {\n const stat = fs.readFileSync(`/proc/${pid}/stat`, 'utf8')\n const commandEnd = stat.lastIndexOf(')')\n if (commandEnd < 0) return null\n const fields = stat.slice(commandEnd + 1).trim().split(/\\s+/)\n const startTime = fields[STAT_START_TIME_FIELD - STAT_FIRST_FIELD_AFTER_COMMAND]\n return startTime && /^\\d+$/.test(startTime) ? startTime : null\n } catch {\n return null\n }\n}\n\nfunction readBootId(): string | null {\n try {\n return readOptionalString(fs.readFileSync(BOOT_ID_PATH, 'utf8'))\n } catch {\n return null\n }\n}\n\nfunction isProcessAlive(pid: number): boolean {\n try {\n process.kill(pid, 0)\n return true\n } catch (error) {\n return (error as NodeJS.ErrnoException).code === 'EPERM'\n }\n}\n\n/**\n * A lock is held only while the process that wrote it is still running. A live pid\n * alone is not enough: the lock file sits in the app directory and survives a\n * container restart, while pid numbering starts again, so the recorded pid soon\n * belongs to an unrelated process. When the lock carries the boot id and the\n * process start time, both must still match. When either side cannot be read\n * (old lock format, no `/proc`), the pid check alone decides, as before.\n */\nfunction isLockOwnerAlive(lock: ServerStartLockRecord): boolean {\n if (!isProcessAlive(lock.pid)) return false\n\n if (lock.bootId) {\n const currentBootId = readBootId()\n if (currentBootId && currentBootId !== lock.bootId) return false\n }\n\n if (lock.processStartTime) {\n const currentStartTime = readProcessStartTime(lock.pid)\n if (currentStartTime && currentStartTime !== lock.processStartTime) return false\n }\n\n return true\n}\n\n/**\n * Treats a record written by this very pid as dead: this process never holds a\n * lock or a takeover guard while it inspects one, so a matching pid can only come\n * from a previous run (pid numbering restarts with the container).\n */\nfunction isHeldByAnotherLiveProcess(record: ServerStartLockRecord | null): record is ServerStartLockRecord {\n return record !== null && record.pid !== process.pid && isLockOwnerAlive(record)\n}\n\n/**\n * Creates `target` with `content` only if it does not exist yet. The content is\n * written to a private temporary file first and hard-linked into place, so other\n * processes never observe a half-written file. Returns `false` when `target`\n * already exists.\n */\nfunction publishExclusive(target: string, content: string): boolean {\n const tempPath = `${target}.${process.pid}.${randomUUID()}.tmp`\n fs.writeFileSync(tempPath, content, { encoding: 'utf8', flag: 'wx' })\n try {\n fs.linkSync(tempPath, target)\n return true\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'EEXIST') return false\n throw error\n } finally {\n fs.rmSync(tempPath, { force: true })\n }\n}\n\nfunction sleepSync(ms: number): void {\n Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms)\n}\n\n/**\n * Removes the stale lock generation `staleRaw` unless another process has already\n * replaced it. Several starts can inspect the same stale lock at once, and a plain\n * unlink would let a late one delete the lock a faster one has just written. Only\n * the process that exclusively creates the takeover guard for this generation may\n * remove it, and it re-reads the lock under the guard first. A guard left behind\n * by a process that died mid-takeover is skipped in favour of the next slot.\n *\n * Returns `false` when a live process holds the guard and the caller must retry.\n */\nfunction removeStaleGeneration(lockPath: string, staleRaw: string, ownRaw: string): boolean {\n const generation = createHash('sha256').update(staleRaw).digest('hex').slice(0, 16)\n const skippedGuards: string[] = []\n let ownedGuard: string | null = null\n try {\n for (let slot = 0; ; slot += 1) {\n const guardPath = `${lockPath}.${generation}.${slot}.takeover`\n if (publishExclusive(guardPath, ownRaw)) {\n ownedGuard = guardPath\n break\n }\n const guardRaw = readRawFile(guardPath)\n if (guardRaw === null || isHeldByAnotherLiveProcess(parseServerStartLock(guardRaw))) return false\n skippedGuards.push(guardPath)\n }\n if (readRawFile(lockPath) === staleRaw) {\n fs.rmSync(lockPath, { force: true })\n }\n for (const guardPath of skippedGuards) fs.rmSync(guardPath, { force: true })\n return true\n } finally {\n if (ownedGuard !== null) fs.rmSync(ownedGuard, { force: true })\n }\n}\n\nexport function getServerStartLockPath(appDir: string): string {\n return path.join(appDir, '.mercato', 'server-start.lock')\n}\n\nexport function acquireServerStartLock(\n appDir: string,\n options: { port?: string | null } = {},\n): ServerStartLockHandle {\n const lockPath = getServerStartLockPath(appDir)\n const lockRecord: ServerStartLockRecord = {\n pid: process.pid,\n port: typeof options.port === 'string' && options.port.trim().length > 0 ? options.port.trim() : null,\n startedAt: new Date().toISOString(),\n processStartTime: readProcessStartTime(process.pid),\n bootId: readBootId(),\n token: randomUUID(),\n }\n const ownRaw = JSON.stringify(lockRecord)\n\n fs.mkdirSync(path.dirname(lockPath), { recursive: true })\n\n for (let attempt = 0; !publishExclusive(lockPath, ownRaw); attempt += 1) {\n const existingRaw = readRawFile(lockPath)\n if (existingRaw === null) continue\n\n const existingLock = parseServerStartLock(existingRaw)\n if (isHeldByAnotherLiveProcess(existingLock)) {\n const portSuffix = existingLock.port ? ` on port ${existingLock.port}` : ''\n throw new Error(\n `[server] Another Open Mercato production server is already running for ${appDir} (pid ${existingLock.pid}${portSuffix}). Stop it before starting another instance.`,\n )\n }\n\n if (!removeStaleGeneration(lockPath, existingRaw, ownRaw)) {\n if (attempt >= MAX_TAKEOVER_ATTEMPTS) {\n throw new Error(\n `[server] Another process is still replacing the stale server start lock for ${appDir}. Try again.`,\n )\n }\n sleepSync(TAKEOVER_BUSY_WAIT_MS)\n }\n }\n\n let released = false\n const release = () => {\n if (released) return\n released = true\n\n // Compare the token, not the pid: after a takeover the file belongs to\n // another process even if it reuses this pid in a later container run.\n const currentLock = parseServerStartLock(readRawFile(lockPath))\n if (currentLock?.token === lockRecord.token) {\n fs.rmSync(lockPath, { force: true })\n }\n }\n\n process.once('exit', release)\n\n return {\n lockPath,\n release,\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY,kBAAkB;AACvC,OAAO,QAAQ;AACf,OAAO,UAAU;AAgBjB,MAAM,eAAe;AACrB,MAAM,iCAAiC;AACvC,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAE9B,SAAS,mBAAmB,OAA+B;AACzD,SAAO,OAAO,UAAU,YAAY,MAAM,KAAK,EAAE,SAAS,IAAI,MAAM,KAAK,IAAI;AAC/E;AAEA,SAAS,YAAY,UAAiC;AACpD,MAAI;AACF,WAAO,GAAG,aAAa,UAAU,MAAM;AAAA,EACzC,SAAS,OAAO;AACd,QAAK,MAAgC,SAAS,SAAU,QAAO;AAC/D,UAAM;AAAA,EACR;AACF;AAEA,SAAS,qBAAqB,KAAkD;AAC9E,MAAI,QAAQ,KAAM,QAAO;AACzB,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,GAAG;AAC7B,QAAI,OAAO,OAAO,QAAQ,YAAY,CAAC,OAAO,UAAU,OAAO,GAAG,KAAK,OAAO,OAAO,GAAG;AACtF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M,IAAI;AAAA,UACR,+EAA+E,MAAM;AAAA,QACvF;AAAA,MACF;AACA,gBAAU,qBAAqB;AAAA,IACjC;AAAA,EACF;AAEA,MAAI,WAAW;AACf,QAAM,UAAU,MAAM;AACpB,QAAI,SAAU;AACd,eAAW;AAIX,UAAM,cAAc,qBAAqB,YAAY,QAAQ,CAAC;AAC9D,QAAI,aAAa,UAAU,WAAW,OAAO;AAC3C,SAAG,OAAO,UAAU,EAAE,OAAO,KAAK,CAAC;AAAA,IACrC;AAAA,EACF;AAEA,UAAQ,KAAK,QAAQ,OAAO;AAE5B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -32,6 +32,17 @@ function normalizePath(filePath) {
|
|
|
32
32
|
function normalizeModuleId(moduleId) {
|
|
33
33
|
return moduleId.trim().toLowerCase();
|
|
34
34
|
}
|
|
35
|
+
function parseIntegrationModuleList(value) {
|
|
36
|
+
return new Set((value ?? "").split(",").map(normalizeModuleId).filter(Boolean));
|
|
37
|
+
}
|
|
38
|
+
function filterIntegrationSpecsForModules(specs, modules) {
|
|
39
|
+
if (modules.size === 0) return specs;
|
|
40
|
+
return specs.filter((spec) => {
|
|
41
|
+
if (spec.moduleName === null) return true;
|
|
42
|
+
if (modules.has(normalizeModuleId(spec.moduleName))) return true;
|
|
43
|
+
return spec.requiredModules.some((moduleId) => modules.has(normalizeModuleId(moduleId)));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
35
46
|
function isEnterpriseModulesEnabled() {
|
|
36
47
|
const rawValue = process.env.OM_ENABLE_ENTERPRISE_MODULES?.trim().toLowerCase();
|
|
37
48
|
return rawValue === "true" || rawValue === "1" || rawValue === "yes" || rawValue === "on";
|
|
@@ -455,8 +466,10 @@ export {
|
|
|
455
466
|
DISCOVERY_SELECTION_REPORT_INTEGRATION_ENV_VAR,
|
|
456
467
|
SKIP_METADATA_FILTERS_INTEGRATION_ENV_VAR,
|
|
457
468
|
discoverIntegrationSpecFiles,
|
|
469
|
+
filterIntegrationSpecsForModules,
|
|
458
470
|
isAppOwnedIntegrationSpecPath,
|
|
459
471
|
normalizePath,
|
|
472
|
+
parseIntegrationModuleList,
|
|
460
473
|
resolveModuleDependenciesForSpec
|
|
461
474
|
};
|
|
462
475
|
//# sourceMappingURL=integration-discovery.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/testing/integration-discovery.ts"],
|
|
4
|
-
"sourcesContent": ["import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs'\nimport path from 'node:path'\nimport ts from 'typescript-js'\n\nexport type IntegrationSpecDiscoveryItem = {\n path: string\n moduleName: string | null\n isOverlay: boolean\n requiredModules: string[]\n requiredEnvVars: string[]\n requiredAnyEnvVars: string[]\n}\n\nconst MODULE_INTEGRATION_DIRECTORY_NAME = '__integration__'\nconst DISCOVERY_IGNORED_DIRS = new Set([\n 'node_modules',\n '.git',\n '.next',\n 'dist',\n '.turbo',\n 'coverage',\n 'test-results',\n '.yarn',\n '.cache',\n 'tmp',\n 'temp',\n '.claude',\n '.codex',\n])\nconst INTEGRATION_META_FILE_NAMES = ['meta.ts', 'index.ts'] as const\nconst INTEGRATION_META_DEPENDENCY_KEYS = ['dependsOnModules', 'requiredModules', 'requiresModules'] as const\nconst INTEGRATION_META_ALL_DEPENDENCY_KEYS = [...INTEGRATION_META_DEPENDENCY_KEYS, 'optionalModules'] as const\nconst INTEGRATION_META_REQUIRED_ENV_KEYS = ['requiredEnvVars', 'requiresEnvVars'] as const\nconst INTEGRATION_META_REQUIRED_ANY_ENV_KEYS = ['requiredAnyEnvVars', 'requiresAnyEnvVars'] as const\nconst DEFAULT_OVERLAY_ROOT = 'packages/enterprise'\nexport const APP_ONLY_INTEGRATION_ENV_VAR = 'OM_INTEGRATION_APP_ONLY'\nexport const SKIP_METADATA_FILTERS_INTEGRATION_ENV_VAR = 'OM_INTEGRATION_SKIP_METADATA_FILTERS'\nexport const DISCOVERY_SELECTION_REPORT_INTEGRATION_ENV_VAR = 'OM_INTEGRATION_DISCOVERY_SELECTION_REPORT'\n\nexport function normalizePath(filePath: string): string {\n return filePath.split(path.sep).join('/')\n}\n\nfunction normalizeModuleId(moduleId: string): string {\n return moduleId.trim().toLowerCase()\n}\n\nfunction isEnterpriseModulesEnabled(): boolean {\n const rawValue = process.env.OM_ENABLE_ENTERPRISE_MODULES?.trim().toLowerCase()\n return rawValue === 'true' || rawValue === '1' || rawValue === 'yes' || rawValue === 'on'\n}\n\nfunction isAppOnlyDiscoveryEnabled(): boolean {\n const rawValue = process.env[APP_ONLY_INTEGRATION_ENV_VAR]?.trim().toLowerCase()\n return rawValue === 'true' || rawValue === '1' || rawValue === 'yes' || rawValue === 'on'\n}\n\nfunction isMetadataFilteringDisabled(): boolean {\n const rawValue = process.env[SKIP_METADATA_FILTERS_INTEGRATION_ENV_VAR]?.trim().toLowerCase()\n return rawValue === 'true' || rawValue === '1' || rawValue === 'yes' || rawValue === 'on'\n}\n\nexport function isAppOwnedIntegrationSpecPath(relativePath: string): boolean {\n return !normalizePath(relativePath).split('/').includes('node_modules')\n}\n\nfunction writeDiscoverySelectionReport(projectRoot: string, files: readonly IntegrationSpecDiscoveryItem[]): void {\n const reportFile = process.env[DISCOVERY_SELECTION_REPORT_INTEGRATION_ENV_VAR]?.trim()\n if (!reportFile) return\n writeFileSync(reportFile, JSON.stringify({ projectRoot, paths: files.map((file) => file.path) }))\n}\n\nfunction collectNamedDirectories(rootPath: string, directoryName: string): string[] {\n let entries\n try {\n entries = readdirSync(rootPath, { withFileTypes: true, encoding: 'utf8' })\n } catch {\n return []\n }\n\n const collected: string[] = []\n for (const entry of entries) {\n if (!entry.isDirectory()) continue\n if (DISCOVERY_IGNORED_DIRS.has(entry.name)) continue\n const absolutePath = path.join(rootPath, entry.name)\n if (entry.name === directoryName) {\n collected.push(absolutePath)\n }\n collected.push(...collectNamedDirectories(absolutePath, directoryName))\n }\n return collected\n}\n\nfunction collectSpecFilesFromDirectory(directoryPath: string): string[] {\n let entries\n try {\n entries = readdirSync(directoryPath, { withFileTypes: true, encoding: 'utf8' })\n } catch {\n return []\n }\n\n const collected: string[] = []\n for (const entry of entries) {\n const absolutePath = path.join(directoryPath, entry.name)\n if (entry.isDirectory()) {\n collected.push(...collectSpecFilesFromDirectory(absolutePath))\n continue\n }\n if (entry.isFile() && entry.name.endsWith('.spec.ts')) {\n collected.push(absolutePath)\n }\n }\n return collected\n}\n\nfunction collectDirectDirectoryNames(directoryPath: string): string[] {\n let entries\n try {\n entries = readdirSync(directoryPath, { withFileTypes: true, encoding: 'utf8' })\n } catch {\n return []\n }\n return entries\n .filter((entry) => entry.isDirectory() && !entry.name.startsWith('.'))\n .map((entry) => entry.name)\n}\n\nfunction collectModuleIdsFromModulesRoot(modulesRoot: string, enabledModules: Set<string>): void {\n for (const moduleName of collectDirectDirectoryNames(modulesRoot)) {\n enabledModules.add(normalizeModuleId(moduleName))\n }\n}\n\nfunction readModuleEntryId(element: ts.Expression): string[] {\n if (!ts.isObjectLiteralExpression(element)) return []\n const idProperty = element.properties.find((property): property is ts.PropertyAssignment =>\n ts.isPropertyAssignment(property)\n && (\n (ts.isIdentifier(property.name) && property.name.text === 'id')\n || (ts.isStringLiteralLike(property.name) && property.name.text === 'id')\n ),\n )\n return idProperty && ts.isStringLiteralLike(idProperty.initializer)\n ? [idProperty.initializer.text]\n : []\n}\n\nfunction isPushOntoVariable(node: ts.Node, variableName: string): node is ts.CallExpression {\n return ts.isCallExpression(node)\n && ts.isPropertyAccessExpression(node.expression)\n && node.expression.name.text === 'push'\n && ts.isIdentifier(node.expression.expression)\n && node.expression.expression.text === variableName\n}\n\n/**\n * Module ids a registry file declares for `variableName`: the entries of its array\n * literal initializer and, with `includePushes`, every `variableName.push({ id })` call.\n * Pushes are usually conditional (enterprise or env-gated modules), so including them\n * yields an upper bound of what the app can register, never narrower than the runtime set.\n */\nfunction readDeclaredModuleIdsFromConfig(\n registryPath: string,\n options: { variableName?: string; includePushes?: boolean; optional?: boolean } = {},\n): string[] {\n const variableName = options.variableName ?? 'enabledModules'\n if (options.optional && !existsSync(registryPath)) return []\n const source = readFileSync(registryPath, 'utf8')\n const sourceFile = ts.createSourceFile(\n registryPath,\n source,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS,\n )\n\n const declared: string[] = []\n const visit = (node: ts.Node): void => {\n if (\n ts.isVariableDeclaration(node)\n && ts.isVariableStatement(node.parent.parent)\n && node.parent.parent.parent === sourceFile\n && ts.isIdentifier(node.name)\n && node.name.text === variableName\n && node.initializer\n && ts.isArrayLiteralExpression(node.initializer)\n ) {\n declared.push(...node.initializer.elements.flatMap(readModuleEntryId))\n }\n if (options.includePushes && isPushOntoVariable(node, variableName)) {\n declared.push(...node.arguments.flatMap(readModuleEntryId))\n }\n ts.forEachChild(node, visit)\n }\n visit(sourceFile)\n return declared\n}\n\nfunction resolveTestAppRoot(): string | null {\n const configuredTestAppRoot = process.env.OM_TEST_APP_ROOT?.trim()\n return configuredTestAppRoot ? path.resolve(configuredTestAppRoot) : null\n}\n\n/**\n * Every module a standalone test app may register: its `enabledModules` literal, its\n * conditional `enabledModules.push(...)` entries, and its official-module activations.\n * Used to skip specs whose owning module the app does not ship at all.\n */\nfunction resolvePossiblyEnabledTestAppModuleIds(testAppRoot: string): Set<string> {\n return new Set(\n [\n ...readDeclaredModuleIdsFromConfig(path.join(testAppRoot, 'src', 'modules.ts'), { includePushes: true }),\n ...readDeclaredModuleIdsFromConfig(\n path.join(testAppRoot, 'src', 'official-modules.generated.ts'),\n { variableName: 'officialModuleEntries', includePushes: true, optional: true },\n ),\n ].map(normalizeModuleId),\n )\n}\n\nfunction resolveEnabledModuleIds(projectRoot: string): Set<string> {\n const testAppRoot = resolveTestAppRoot()\n if (testAppRoot) {\n return new Set(\n readDeclaredModuleIdsFromConfig(path.join(testAppRoot, 'src', 'modules.ts')).map(normalizeModuleId),\n )\n }\n\n const enabledModules = new Set<string>()\n const appModulesRoot = path.join(projectRoot, 'src', 'modules')\n const appsRoot = path.join(projectRoot, 'apps')\n const packagesRoot = path.join(projectRoot, 'packages')\n const installedPackagesRoot = path.join(projectRoot, 'node_modules', '@open-mercato')\n const enterpriseEnabled = isEnterpriseModulesEnabled()\n\n // Standalone app: src/modules at project root\n collectModuleIdsFromModulesRoot(appModulesRoot, enabledModules)\n\n for (const appName of collectDirectDirectoryNames(appsRoot)) {\n const moduleRoot = path.join(appsRoot, appName, 'src', 'modules')\n collectModuleIdsFromModulesRoot(moduleRoot, enabledModules)\n }\n for (const packageName of collectDirectDirectoryNames(packagesRoot)) {\n if (packageName === 'enterprise' && !enterpriseEnabled) {\n continue\n }\n const moduleRoot = path.join(packagesRoot, packageName, 'src', 'modules')\n collectModuleIdsFromModulesRoot(moduleRoot, enabledModules)\n }\n // Standalone app: installed @open-mercato packages in node_modules\n for (const packageName of collectDirectDirectoryNames(installedPackagesRoot)) {\n if (packageName === 'enterprise' && !enterpriseEnabled) {\n continue\n }\n const moduleRoot = path.join(installedPackagesRoot, packageName, 'src', 'modules')\n collectModuleIdsFromModulesRoot(moduleRoot, enabledModules)\n }\n const createAppTemplateModulesRoot = path.join(projectRoot, 'packages', 'create-app', 'template', 'src', 'modules')\n collectModuleIdsFromModulesRoot(createAppTemplateModulesRoot, enabledModules)\n\n return enabledModules\n}\n\nfunction extractModuleNameFromIntegrationPath(relativePath: string): string | null {\n const segments = normalizePath(relativePath).split('/')\n const integrationDirectoryIndex = segments.indexOf(MODULE_INTEGRATION_DIRECTORY_NAME)\n if (integrationDirectoryIndex <= 0) {\n return null\n }\n const moduleSegment = segments[integrationDirectoryIndex - 1]\n return moduleSegment && moduleSegment.length > 0 ? moduleSegment : null\n}\n\n/**\n * The module a spec belongs to: the directory directly under the closest `modules/`\n * ancestor of `__integration__`, provided that directory is a real module (it ships an\n * `index.ts`/`index.js`). Returns null for specs outside a module, e.g. `packages/ui`.\n */\nfunction resolveOwningModuleId(projectRoot: string, relativeSpecPath: string): string | null {\n const segments = normalizePath(relativeSpecPath).split('/')\n const integrationDirectoryIndex = segments.indexOf(MODULE_INTEGRATION_DIRECTORY_NAME)\n if (integrationDirectoryIndex <= 0) return null\n const modulesSegmentIndex = segments.lastIndexOf('modules', integrationDirectoryIndex - 1)\n if (modulesSegmentIndex === -1 || modulesSegmentIndex + 1 >= integrationDirectoryIndex) return null\n const moduleRoot = path.join(projectRoot, ...segments.slice(0, modulesSegmentIndex + 2))\n const isRealModule = ['index.ts', 'index.js'].some((fileName) => existsSync(path.join(moduleRoot, fileName)))\n return isRealModule ? normalizeModuleId(segments[modulesSegmentIndex + 1]) : null\n}\n\nfunction resolveOverlayRootPath(): string {\n const configured = process.env.OM_INTEGRATION_OVERLAY_ROOT?.trim()\n if (!configured) {\n return DEFAULT_OVERLAY_ROOT\n }\n return configured.replace(/\\/+$/, '')\n}\n\nfunction isOverlayIntegrationPath(relativePath: string, overlayRoot: string): boolean {\n return normalizePath(relativePath).startsWith(`${normalizePath(overlayRoot)}/`)\n}\n\nfunction extractStringArrayFromSource(source: string, keys: readonly string[]): string[] {\n const collected = new Set<string>()\n for (const key of keys) {\n const keyPattern = new RegExp(`${key}\\\\s*:\\\\s*\\\\[([\\\\s\\\\S]*?)\\\\]`, 'm')\n const keyMatch = source.match(keyPattern)\n if (!keyMatch?.[1]) continue\n const valuesPattern = /['\"`]([a-zA-Z0-9_.-]+)['\"`]/g\n for (const valueMatch of keyMatch[1].matchAll(valuesPattern)) {\n const value = String(valueMatch[1] ?? '').trim()\n if (value) {\n collected.add(value)\n }\n }\n }\n return Array.from(collected)\n}\n\nfunction extractDependencyListFromSource(source: string, includeOptional: boolean): string[] {\n const keys = includeOptional ? INTEGRATION_META_ALL_DEPENDENCY_KEYS : INTEGRATION_META_DEPENDENCY_KEYS\n return extractStringArrayFromSource(source, keys).map(normalizeModuleId)\n}\n\nfunction extractRequiredEnvVarsFromSource(source: string): string[] {\n return extractStringArrayFromSource(source, INTEGRATION_META_REQUIRED_ENV_KEYS)\n}\n\nfunction extractRequiredAnyEnvVarsFromSource(source: string): string[] {\n return extractStringArrayFromSource(source, INTEGRATION_META_REQUIRED_ANY_ENV_KEYS)\n}\n\nfunction readDependenciesFromMetadataFile(absolutePath: string, includeOptional: boolean): string[] {\n try {\n return extractDependencyListFromSource(readFileSync(absolutePath, 'utf8'), includeOptional)\n } catch {\n return []\n }\n}\n\nfunction readRequiredEnvVarsFromMetadataFile(absolutePath: string): string[] {\n try {\n return extractRequiredEnvVarsFromSource(readFileSync(absolutePath, 'utf8'))\n } catch {\n return []\n }\n}\n\nfunction readRequiredAnyEnvVarsFromMetadataFile(absolutePath: string): string[] {\n try {\n return extractRequiredAnyEnvVarsFromSource(readFileSync(absolutePath, 'utf8'))\n } catch {\n return []\n }\n}\n\nfunction resolveIntegrationRootDirectory(relativeSpecPath: string): string | null {\n const segments = normalizePath(relativeSpecPath).split('/')\n const integrationDirectoryIndex = segments.indexOf(MODULE_INTEGRATION_DIRECTORY_NAME)\n if (integrationDirectoryIndex === -1) {\n return null\n }\n return segments.slice(0, integrationDirectoryIndex + 1).join('/')\n}\n\nexport function resolveModuleDependenciesForSpec(\n projectRoot: string,\n relativeSpecPath: string,\n { includeOptional = false }: { includeOptional?: boolean } = {},\n): string[] {\n const requiredModules = new Set<string>()\n const normalizedSpecPath = normalizePath(relativeSpecPath)\n const absoluteSpecPath = path.join(projectRoot, normalizedSpecPath)\n const integrationRoot = resolveIntegrationRootDirectory(normalizedSpecPath)\n\n if (integrationRoot) {\n const relativeDirectory = normalizePath(path.dirname(normalizedSpecPath))\n const integrationRootAbsolute = path.join(projectRoot, integrationRoot)\n const directoryAbsolute = path.join(projectRoot, relativeDirectory)\n const relativeFromIntegrationRoot = normalizePath(path.relative(integrationRootAbsolute, directoryAbsolute))\n const pathSegments = relativeFromIntegrationRoot === '.'\n ? []\n : relativeFromIntegrationRoot.split('/').filter(Boolean)\n\n let currentDirectory = integrationRootAbsolute\n const traversal = [currentDirectory, ...pathSegments.map((segment) => {\n currentDirectory = path.join(currentDirectory, segment)\n return currentDirectory\n })]\n\n for (const directoryPath of traversal) {\n for (const metadataFileName of INTEGRATION_META_FILE_NAMES) {\n const metadataPath = path.join(directoryPath, metadataFileName)\n readDependenciesFromMetadataFile(metadataPath, includeOptional).forEach((dependency) => requiredModules.add(dependency))\n }\n }\n }\n\n readDependenciesFromMetadataFile(absoluteSpecPath, includeOptional).forEach((dependency) => requiredModules.add(dependency))\n const specFileName = path.basename(normalizedSpecPath, '.spec.ts')\n const perTestMetadataPath = path.join(path.dirname(absoluteSpecPath), `${specFileName}.meta.ts`)\n readDependenciesFromMetadataFile(perTestMetadataPath, includeOptional).forEach((dependency) => requiredModules.add(dependency))\n\n return Array.from(requiredModules)\n}\n\nfunction resolveRequiredEnvVarsForSpec(projectRoot: string, relativeSpecPath: string): string[] {\n const requiredEnvVars = new Set<string>()\n const normalizedSpecPath = normalizePath(relativeSpecPath)\n const absoluteSpecPath = path.join(projectRoot, normalizedSpecPath)\n const integrationRoot = resolveIntegrationRootDirectory(normalizedSpecPath)\n\n if (integrationRoot) {\n const relativeDirectory = normalizePath(path.dirname(normalizedSpecPath))\n const integrationRootAbsolute = path.join(projectRoot, integrationRoot)\n const directoryAbsolute = path.join(projectRoot, relativeDirectory)\n const relativeFromIntegrationRoot = normalizePath(path.relative(integrationRootAbsolute, directoryAbsolute))\n const pathSegments = relativeFromIntegrationRoot === '.'\n ? []\n : relativeFromIntegrationRoot.split('/').filter(Boolean)\n\n let currentDirectory = integrationRootAbsolute\n const traversal = [currentDirectory, ...pathSegments.map((segment) => {\n currentDirectory = path.join(currentDirectory, segment)\n return currentDirectory\n })]\n\n for (const directoryPath of traversal) {\n for (const metadataFileName of INTEGRATION_META_FILE_NAMES) {\n const metadataPath = path.join(directoryPath, metadataFileName)\n readRequiredEnvVarsFromMetadataFile(metadataPath).forEach((envVar) => requiredEnvVars.add(envVar))\n }\n }\n }\n\n readRequiredEnvVarsFromMetadataFile(absoluteSpecPath).forEach((envVar) => requiredEnvVars.add(envVar))\n const specFileName = path.basename(normalizedSpecPath, '.spec.ts')\n const perTestMetadataPath = path.join(path.dirname(absoluteSpecPath), `${specFileName}.meta.ts`)\n readRequiredEnvVarsFromMetadataFile(perTestMetadataPath).forEach((envVar) => requiredEnvVars.add(envVar))\n\n return Array.from(requiredEnvVars)\n}\n\nfunction resolveRequiredAnyEnvVarsForSpec(projectRoot: string, relativeSpecPath: string): string[] {\n const requiredAnyEnvVars = new Set<string>()\n const normalizedSpecPath = normalizePath(relativeSpecPath)\n const absoluteSpecPath = path.join(projectRoot, normalizedSpecPath)\n const integrationRoot = resolveIntegrationRootDirectory(normalizedSpecPath)\n\n if (integrationRoot) {\n const relativeDirectory = normalizePath(path.dirname(normalizedSpecPath))\n const integrationRootAbsolute = path.join(projectRoot, integrationRoot)\n const directoryAbsolute = path.join(projectRoot, relativeDirectory)\n const relativeFromIntegrationRoot = normalizePath(path.relative(integrationRootAbsolute, directoryAbsolute))\n const pathSegments = relativeFromIntegrationRoot === '.'\n ? []\n : relativeFromIntegrationRoot.split('/').filter(Boolean)\n\n let currentDirectory = integrationRootAbsolute\n const traversal = [currentDirectory, ...pathSegments.map((segment) => {\n currentDirectory = path.join(currentDirectory, segment)\n return currentDirectory\n })]\n\n for (const directoryPath of traversal) {\n for (const metadataFileName of INTEGRATION_META_FILE_NAMES) {\n const metadataPath = path.join(directoryPath, metadataFileName)\n readRequiredAnyEnvVarsFromMetadataFile(metadataPath).forEach((envVar) => requiredAnyEnvVars.add(envVar))\n }\n }\n }\n\n readRequiredAnyEnvVarsFromMetadataFile(absoluteSpecPath).forEach((envVar) => requiredAnyEnvVars.add(envVar))\n const specFileName = path.basename(normalizedSpecPath, '.spec.ts')\n const perTestMetadataPath = path.join(path.dirname(absoluteSpecPath), `${specFileName}.meta.ts`)\n readRequiredAnyEnvVarsFromMetadataFile(perTestMetadataPath).forEach((envVar) => requiredAnyEnvVars.add(envVar))\n\n return Array.from(requiredAnyEnvVars)\n}\n\nfunction isEnvironmentVariableConfigured(name: string): boolean {\n const value = process.env[name]\n return typeof value === 'string' && value.trim().length > 0\n}\n\nexport function discoverIntegrationSpecFiles(projectRoot: string, legacyIntegrationRoot: string): IntegrationSpecDiscoveryItem[] {\n const discoveredByPath = new Map<string, IntegrationSpecDiscoveryItem>()\n const overlayRoot = resolveOverlayRootPath()\n const enterpriseEnabled = isEnterpriseModulesEnabled()\n const appOnly = isAppOnlyDiscoveryEnabled()\n const discoveryRoots = [\n path.join(projectRoot, 'src', 'modules'),\n path.join(projectRoot, 'apps'),\n path.join(projectRoot, 'packages'),\n ...(appOnly ? [] : [path.join(projectRoot, 'node_modules', '@open-mercato')]),\n ]\n\n for (const specFile of collectSpecFilesFromDirectory(legacyIntegrationRoot)) {\n const relativePath = normalizePath(path.relative(projectRoot, specFile))\n discoveredByPath.set(relativePath, {\n path: relativePath,\n moduleName: extractModuleNameFromIntegrationPath(relativePath),\n isOverlay: isOverlayIntegrationPath(relativePath, overlayRoot),\n requiredModules: resolveModuleDependenciesForSpec(projectRoot, relativePath),\n requiredEnvVars: resolveRequiredEnvVarsForSpec(projectRoot, relativePath),\n requiredAnyEnvVars: resolveRequiredAnyEnvVarsForSpec(projectRoot, relativePath),\n })\n }\n\n for (const root of discoveryRoots) {\n for (const integrationDirectory of collectNamedDirectories(root, MODULE_INTEGRATION_DIRECTORY_NAME)) {\n for (const specFile of collectSpecFilesFromDirectory(integrationDirectory)) {\n const relativePath = normalizePath(path.relative(projectRoot, specFile))\n discoveredByPath.set(relativePath, {\n path: relativePath,\n moduleName: extractModuleNameFromIntegrationPath(relativePath),\n isOverlay: isOverlayIntegrationPath(relativePath, overlayRoot),\n requiredModules: resolveModuleDependenciesForSpec(projectRoot, relativePath),\n requiredEnvVars: resolveRequiredEnvVarsForSpec(projectRoot, relativePath),\n requiredAnyEnvVars: resolveRequiredAnyEnvVarsForSpec(projectRoot, relativePath),\n })\n }\n }\n }\n\n const discovered = Array.from(discoveredByPath.values())\n .filter((file) => !appOnly || isAppOwnedIntegrationSpecPath(file.path))\n if (isMetadataFilteringDisabled()) {\n const selected = discovered.sort((left, right) => left.path.localeCompare(right.path))\n writeDiscoverySelectionReport(projectRoot, selected)\n return selected\n }\n const enabledModules = resolveEnabledModuleIds(projectRoot)\n const testAppRoot = resolveTestAppRoot()\n const testAppModules = testAppRoot ? resolvePossiblyEnabledTestAppModuleIds(testAppRoot) : null\n const enabledModuleNames = new Set<string>()\n for (const file of discovered) {\n if (!file.isOverlay && file.moduleName) {\n enabledModuleNames.add(file.moduleName)\n }\n }\n\n const selected = discovered\n .filter((file) => {\n if (file.requiredModules.some((moduleId) => !enabledModules.has(normalizeModuleId(moduleId)))) {\n return false\n }\n if (testAppModules && !file.isOverlay) {\n const owningModuleId = resolveOwningModuleId(projectRoot, file.path)\n if (owningModuleId && !testAppModules.has(owningModuleId)) {\n return false\n }\n }\n if (file.requiredEnvVars.some((envVar) => !isEnvironmentVariableConfigured(envVar))) {\n return false\n }\n if (\n file.requiredAnyEnvVars.length > 0 &&\n !file.requiredAnyEnvVars.some((envVar) => isEnvironmentVariableConfigured(envVar))\n ) {\n return false\n }\n if (!file.isOverlay) {\n return true\n }\n if (!enterpriseEnabled) {\n return false\n }\n if (!file.moduleName) {\n return true\n }\n if (enabledModuleNames.has(file.moduleName)) {\n return true\n }\n return enabledModules.has(normalizeModuleId(file.moduleName))\n })\n .sort((left, right) => left.path.localeCompare(right.path))\n writeDiscoverySelectionReport(projectRoot, selected)\n return selected\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAAY,cAAc,aAAa,qBAAqB;AACrE,OAAO,UAAU;AACjB,OAAO,QAAQ;AAWf,MAAM,oCAAoC;AAC1C,MAAM,yBAAyB,oBAAI,IAAI;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AA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,KAAK,UAAU;AAAA,IACxC;AAAA,EACF;AAEA,QAAM,WAAW,WACd,OAAO,CAAC,SAAS;AAChB,QAAI,KAAK,gBAAgB,KAAK,CAAC,aAAa,CAAC,eAAe,IAAI,kBAAkB,QAAQ,CAAC,CAAC,GAAG;AAC7F,aAAO;AAAA,IACT;AACA,QAAI,kBAAkB,CAAC,KAAK,WAAW;AACrC,YAAM,iBAAiB,sBAAsB,aAAa,KAAK,IAAI;AACnE,UAAI,kBAAkB,CAAC,eAAe,IAAI,cAAc,GAAG;AACzD,eAAO;AAAA,MACT;AAAA,IACF;AACA,QAAI,KAAK,gBAAgB,KAAK,CAAC,WAAW,CAAC,gCAAgC,MAAM,CAAC,GAAG;AACnF,aAAO;AAAA,IACT;AACA,QACE,KAAK,mBAAmB,SAAS,KACjC,CAAC,KAAK,mBAAmB,KAAK,CAAC,WAAW,gCAAgC,MAAM,CAAC,GACjF;AACA,aAAO;AAAA,IACT;AACA,QAAI,CAAC,KAAK,WAAW;AACnB,aAAO;AAAA,IACT;AACA,QAAI,CAAC,mBAAmB;AACtB,aAAO;AAAA,IACT;AACA,QAAI,CAAC,KAAK,YAAY;AACpB,aAAO;AAAA,IACT;AACA,QAAI,mBAAmB,IAAI,KAAK,UAAU,GAAG;AAC3C,aAAO;AAAA,IACT;AACA,WAAO,eAAe,IAAI,kBAAkB,KAAK,UAAU,CAAC;AAAA,EAC9D,CAAC,EACA,KAAK,CAAC,MAAM,UAAU,KAAK,KAAK,cAAc,MAAM,IAAI,CAAC;AAC5D,gCAA8B,aAAa,QAAQ;AACnD,SAAO;AACT;",
|
|
4
|
+
"sourcesContent": ["import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs'\nimport path from 'node:path'\nimport ts from 'typescript-js'\n\nexport type IntegrationSpecDiscoveryItem = {\n path: string\n moduleName: string | null\n isOverlay: boolean\n requiredModules: string[]\n requiredEnvVars: string[]\n requiredAnyEnvVars: string[]\n}\n\nconst MODULE_INTEGRATION_DIRECTORY_NAME = '__integration__'\nconst DISCOVERY_IGNORED_DIRS = new Set([\n 'node_modules',\n '.git',\n '.next',\n 'dist',\n '.turbo',\n 'coverage',\n 'test-results',\n '.yarn',\n '.cache',\n 'tmp',\n 'temp',\n '.claude',\n '.codex',\n])\nconst INTEGRATION_META_FILE_NAMES = ['meta.ts', 'index.ts'] as const\nconst INTEGRATION_META_DEPENDENCY_KEYS = ['dependsOnModules', 'requiredModules', 'requiresModules'] as const\nconst INTEGRATION_META_ALL_DEPENDENCY_KEYS = [...INTEGRATION_META_DEPENDENCY_KEYS, 'optionalModules'] as const\nconst INTEGRATION_META_REQUIRED_ENV_KEYS = ['requiredEnvVars', 'requiresEnvVars'] as const\nconst INTEGRATION_META_REQUIRED_ANY_ENV_KEYS = ['requiredAnyEnvVars', 'requiresAnyEnvVars'] as const\nconst DEFAULT_OVERLAY_ROOT = 'packages/enterprise'\nexport const APP_ONLY_INTEGRATION_ENV_VAR = 'OM_INTEGRATION_APP_ONLY'\nexport const SKIP_METADATA_FILTERS_INTEGRATION_ENV_VAR = 'OM_INTEGRATION_SKIP_METADATA_FILTERS'\nexport const DISCOVERY_SELECTION_REPORT_INTEGRATION_ENV_VAR = 'OM_INTEGRATION_DISCOVERY_SELECTION_REPORT'\n\nexport function normalizePath(filePath: string): string {\n return filePath.split(path.sep).join('/')\n}\n\nfunction normalizeModuleId(moduleId: string): string {\n return moduleId.trim().toLowerCase()\n}\n\nexport function parseIntegrationModuleList(value: string | undefined): Set<string> {\n return new Set((value ?? '').split(',').map(normalizeModuleId).filter(Boolean))\n}\n\nexport function filterIntegrationSpecsForModules<T extends Pick<IntegrationSpecDiscoveryItem, 'moduleName' | 'requiredModules'>>(\n specs: T[],\n modules: Set<string>,\n): T[] {\n if (modules.size === 0) return specs\n return specs.filter((spec) => {\n if (spec.moduleName === null) return true\n if (modules.has(normalizeModuleId(spec.moduleName))) return true\n return spec.requiredModules.some((moduleId) => modules.has(normalizeModuleId(moduleId)))\n })\n}\n\nfunction isEnterpriseModulesEnabled(): boolean {\n const rawValue = process.env.OM_ENABLE_ENTERPRISE_MODULES?.trim().toLowerCase()\n return rawValue === 'true' || rawValue === '1' || rawValue === 'yes' || rawValue === 'on'\n}\n\nfunction isAppOnlyDiscoveryEnabled(): boolean {\n const rawValue = process.env[APP_ONLY_INTEGRATION_ENV_VAR]?.trim().toLowerCase()\n return rawValue === 'true' || rawValue === '1' || rawValue === 'yes' || rawValue === 'on'\n}\n\nfunction isMetadataFilteringDisabled(): boolean {\n const rawValue = process.env[SKIP_METADATA_FILTERS_INTEGRATION_ENV_VAR]?.trim().toLowerCase()\n return rawValue === 'true' || rawValue === '1' || rawValue === 'yes' || rawValue === 'on'\n}\n\nexport function isAppOwnedIntegrationSpecPath(relativePath: string): boolean {\n return !normalizePath(relativePath).split('/').includes('node_modules')\n}\n\nfunction writeDiscoverySelectionReport(projectRoot: string, files: readonly IntegrationSpecDiscoveryItem[]): void {\n const reportFile = process.env[DISCOVERY_SELECTION_REPORT_INTEGRATION_ENV_VAR]?.trim()\n if (!reportFile) return\n writeFileSync(reportFile, JSON.stringify({ projectRoot, paths: files.map((file) => file.path) }))\n}\n\nfunction collectNamedDirectories(rootPath: string, directoryName: string): string[] {\n let entries\n try {\n entries = readdirSync(rootPath, { withFileTypes: true, encoding: 'utf8' })\n } catch {\n return []\n }\n\n const collected: string[] = []\n for (const entry of entries) {\n if (!entry.isDirectory()) continue\n if (DISCOVERY_IGNORED_DIRS.has(entry.name)) continue\n const absolutePath = path.join(rootPath, entry.name)\n if (entry.name === directoryName) {\n collected.push(absolutePath)\n }\n collected.push(...collectNamedDirectories(absolutePath, directoryName))\n }\n return collected\n}\n\nfunction collectSpecFilesFromDirectory(directoryPath: string): string[] {\n let entries\n try {\n entries = readdirSync(directoryPath, { withFileTypes: true, encoding: 'utf8' })\n } catch {\n return []\n }\n\n const collected: string[] = []\n for (const entry of entries) {\n const absolutePath = path.join(directoryPath, entry.name)\n if (entry.isDirectory()) {\n collected.push(...collectSpecFilesFromDirectory(absolutePath))\n continue\n }\n if (entry.isFile() && entry.name.endsWith('.spec.ts')) {\n collected.push(absolutePath)\n }\n }\n return collected\n}\n\nfunction collectDirectDirectoryNames(directoryPath: string): string[] {\n let entries\n try {\n entries = readdirSync(directoryPath, { withFileTypes: true, encoding: 'utf8' })\n } catch {\n return []\n }\n return entries\n .filter((entry) => entry.isDirectory() && !entry.name.startsWith('.'))\n .map((entry) => entry.name)\n}\n\nfunction collectModuleIdsFromModulesRoot(modulesRoot: string, enabledModules: Set<string>): void {\n for (const moduleName of collectDirectDirectoryNames(modulesRoot)) {\n enabledModules.add(normalizeModuleId(moduleName))\n }\n}\n\nfunction readModuleEntryId(element: ts.Expression): string[] {\n if (!ts.isObjectLiteralExpression(element)) return []\n const idProperty = element.properties.find((property): property is ts.PropertyAssignment =>\n ts.isPropertyAssignment(property)\n && (\n (ts.isIdentifier(property.name) && property.name.text === 'id')\n || (ts.isStringLiteralLike(property.name) && property.name.text === 'id')\n ),\n )\n return idProperty && ts.isStringLiteralLike(idProperty.initializer)\n ? [idProperty.initializer.text]\n : []\n}\n\nfunction isPushOntoVariable(node: ts.Node, variableName: string): node is ts.CallExpression {\n return ts.isCallExpression(node)\n && ts.isPropertyAccessExpression(node.expression)\n && node.expression.name.text === 'push'\n && ts.isIdentifier(node.expression.expression)\n && node.expression.expression.text === variableName\n}\n\n/**\n * Module ids a registry file declares for `variableName`: the entries of its array\n * literal initializer and, with `includePushes`, every `variableName.push({ id })` call.\n * Pushes are usually conditional (enterprise or env-gated modules), so including them\n * yields an upper bound of what the app can register, never narrower than the runtime set.\n */\nfunction readDeclaredModuleIdsFromConfig(\n registryPath: string,\n options: { variableName?: string; includePushes?: boolean; optional?: boolean } = {},\n): string[] {\n const variableName = options.variableName ?? 'enabledModules'\n if (options.optional && !existsSync(registryPath)) return []\n const source = readFileSync(registryPath, 'utf8')\n const sourceFile = ts.createSourceFile(\n registryPath,\n source,\n ts.ScriptTarget.Latest,\n true,\n ts.ScriptKind.TS,\n )\n\n const declared: string[] = []\n const visit = (node: ts.Node): void => {\n if (\n ts.isVariableDeclaration(node)\n && ts.isVariableStatement(node.parent.parent)\n && node.parent.parent.parent === sourceFile\n && ts.isIdentifier(node.name)\n && node.name.text === variableName\n && node.initializer\n && ts.isArrayLiteralExpression(node.initializer)\n ) {\n declared.push(...node.initializer.elements.flatMap(readModuleEntryId))\n }\n if (options.includePushes && isPushOntoVariable(node, variableName)) {\n declared.push(...node.arguments.flatMap(readModuleEntryId))\n }\n ts.forEachChild(node, visit)\n }\n visit(sourceFile)\n return declared\n}\n\nfunction resolveTestAppRoot(): string | null {\n const configuredTestAppRoot = process.env.OM_TEST_APP_ROOT?.trim()\n return configuredTestAppRoot ? path.resolve(configuredTestAppRoot) : null\n}\n\n/**\n * Every module a standalone test app may register: its `enabledModules` literal, its\n * conditional `enabledModules.push(...)` entries, and its official-module activations.\n * Used to skip specs whose owning module the app does not ship at all.\n */\nfunction resolvePossiblyEnabledTestAppModuleIds(testAppRoot: string): Set<string> {\n return new Set(\n [\n ...readDeclaredModuleIdsFromConfig(path.join(testAppRoot, 'src', 'modules.ts'), { includePushes: true }),\n ...readDeclaredModuleIdsFromConfig(\n path.join(testAppRoot, 'src', 'official-modules.generated.ts'),\n { variableName: 'officialModuleEntries', includePushes: true, optional: true },\n ),\n ].map(normalizeModuleId),\n )\n}\n\nfunction resolveEnabledModuleIds(projectRoot: string): Set<string> {\n const testAppRoot = resolveTestAppRoot()\n if (testAppRoot) {\n return new Set(\n readDeclaredModuleIdsFromConfig(path.join(testAppRoot, 'src', 'modules.ts')).map(normalizeModuleId),\n )\n }\n\n const enabledModules = new Set<string>()\n const appModulesRoot = path.join(projectRoot, 'src', 'modules')\n const appsRoot = path.join(projectRoot, 'apps')\n const packagesRoot = path.join(projectRoot, 'packages')\n const installedPackagesRoot = path.join(projectRoot, 'node_modules', '@open-mercato')\n const enterpriseEnabled = isEnterpriseModulesEnabled()\n\n // Standalone app: src/modules at project root\n collectModuleIdsFromModulesRoot(appModulesRoot, enabledModules)\n\n for (const appName of collectDirectDirectoryNames(appsRoot)) {\n const moduleRoot = path.join(appsRoot, appName, 'src', 'modules')\n collectModuleIdsFromModulesRoot(moduleRoot, enabledModules)\n }\n for (const packageName of collectDirectDirectoryNames(packagesRoot)) {\n if (packageName === 'enterprise' && !enterpriseEnabled) {\n continue\n }\n const moduleRoot = path.join(packagesRoot, packageName, 'src', 'modules')\n collectModuleIdsFromModulesRoot(moduleRoot, enabledModules)\n }\n // Standalone app: installed @open-mercato packages in node_modules\n for (const packageName of collectDirectDirectoryNames(installedPackagesRoot)) {\n if (packageName === 'enterprise' && !enterpriseEnabled) {\n continue\n }\n const moduleRoot = path.join(installedPackagesRoot, packageName, 'src', 'modules')\n collectModuleIdsFromModulesRoot(moduleRoot, enabledModules)\n }\n const createAppTemplateModulesRoot = path.join(projectRoot, 'packages', 'create-app', 'template', 'src', 'modules')\n collectModuleIdsFromModulesRoot(createAppTemplateModulesRoot, enabledModules)\n\n return enabledModules\n}\n\nfunction extractModuleNameFromIntegrationPath(relativePath: string): string | null {\n const segments = normalizePath(relativePath).split('/')\n const integrationDirectoryIndex = segments.indexOf(MODULE_INTEGRATION_DIRECTORY_NAME)\n if (integrationDirectoryIndex <= 0) {\n return null\n }\n const moduleSegment = segments[integrationDirectoryIndex - 1]\n return moduleSegment && moduleSegment.length > 0 ? moduleSegment : null\n}\n\n/**\n * The module a spec belongs to: the directory directly under the closest `modules/`\n * ancestor of `__integration__`, provided that directory is a real module (it ships an\n * `index.ts`/`index.js`). Returns null for specs outside a module, e.g. `packages/ui`.\n */\nfunction resolveOwningModuleId(projectRoot: string, relativeSpecPath: string): string | null {\n const segments = normalizePath(relativeSpecPath).split('/')\n const integrationDirectoryIndex = segments.indexOf(MODULE_INTEGRATION_DIRECTORY_NAME)\n if (integrationDirectoryIndex <= 0) return null\n const modulesSegmentIndex = segments.lastIndexOf('modules', integrationDirectoryIndex - 1)\n if (modulesSegmentIndex === -1 || modulesSegmentIndex + 1 >= integrationDirectoryIndex) return null\n const moduleRoot = path.join(projectRoot, ...segments.slice(0, modulesSegmentIndex + 2))\n const isRealModule = ['index.ts', 'index.js'].some((fileName) => existsSync(path.join(moduleRoot, fileName)))\n return isRealModule ? normalizeModuleId(segments[modulesSegmentIndex + 1]) : null\n}\n\nfunction resolveOverlayRootPath(): string {\n const configured = process.env.OM_INTEGRATION_OVERLAY_ROOT?.trim()\n if (!configured) {\n return DEFAULT_OVERLAY_ROOT\n }\n return configured.replace(/\\/+$/, '')\n}\n\nfunction isOverlayIntegrationPath(relativePath: string, overlayRoot: string): boolean {\n return normalizePath(relativePath).startsWith(`${normalizePath(overlayRoot)}/`)\n}\n\nfunction extractStringArrayFromSource(source: string, keys: readonly string[]): string[] {\n const collected = new Set<string>()\n for (const key of keys) {\n const keyPattern = new RegExp(`${key}\\\\s*:\\\\s*\\\\[([\\\\s\\\\S]*?)\\\\]`, 'm')\n const keyMatch = source.match(keyPattern)\n if (!keyMatch?.[1]) continue\n const valuesPattern = /['\"`]([a-zA-Z0-9_.-]+)['\"`]/g\n for (const valueMatch of keyMatch[1].matchAll(valuesPattern)) {\n const value = String(valueMatch[1] ?? '').trim()\n if (value) {\n collected.add(value)\n }\n }\n }\n return Array.from(collected)\n}\n\nfunction extractDependencyListFromSource(source: string, includeOptional: boolean): string[] {\n const keys = includeOptional ? INTEGRATION_META_ALL_DEPENDENCY_KEYS : INTEGRATION_META_DEPENDENCY_KEYS\n return extractStringArrayFromSource(source, keys).map(normalizeModuleId)\n}\n\nfunction extractRequiredEnvVarsFromSource(source: string): string[] {\n return extractStringArrayFromSource(source, INTEGRATION_META_REQUIRED_ENV_KEYS)\n}\n\nfunction extractRequiredAnyEnvVarsFromSource(source: string): string[] {\n return extractStringArrayFromSource(source, INTEGRATION_META_REQUIRED_ANY_ENV_KEYS)\n}\n\nfunction readDependenciesFromMetadataFile(absolutePath: string, includeOptional: boolean): string[] {\n try {\n return extractDependencyListFromSource(readFileSync(absolutePath, 'utf8'), includeOptional)\n } catch {\n return []\n }\n}\n\nfunction readRequiredEnvVarsFromMetadataFile(absolutePath: string): string[] {\n try {\n return extractRequiredEnvVarsFromSource(readFileSync(absolutePath, 'utf8'))\n } catch {\n return []\n }\n}\n\nfunction readRequiredAnyEnvVarsFromMetadataFile(absolutePath: string): string[] {\n try {\n return extractRequiredAnyEnvVarsFromSource(readFileSync(absolutePath, 'utf8'))\n } catch {\n return []\n }\n}\n\nfunction resolveIntegrationRootDirectory(relativeSpecPath: string): string | null {\n const segments = normalizePath(relativeSpecPath).split('/')\n const integrationDirectoryIndex = segments.indexOf(MODULE_INTEGRATION_DIRECTORY_NAME)\n if (integrationDirectoryIndex === -1) {\n return null\n }\n return segments.slice(0, integrationDirectoryIndex + 1).join('/')\n}\n\nexport function resolveModuleDependenciesForSpec(\n projectRoot: string,\n relativeSpecPath: string,\n { includeOptional = false }: { includeOptional?: boolean } = {},\n): string[] {\n const requiredModules = new Set<string>()\n const normalizedSpecPath = normalizePath(relativeSpecPath)\n const absoluteSpecPath = path.join(projectRoot, normalizedSpecPath)\n const integrationRoot = resolveIntegrationRootDirectory(normalizedSpecPath)\n\n if (integrationRoot) {\n const relativeDirectory = normalizePath(path.dirname(normalizedSpecPath))\n const integrationRootAbsolute = path.join(projectRoot, integrationRoot)\n const directoryAbsolute = path.join(projectRoot, relativeDirectory)\n const relativeFromIntegrationRoot = normalizePath(path.relative(integrationRootAbsolute, directoryAbsolute))\n const pathSegments = relativeFromIntegrationRoot === '.'\n ? []\n : relativeFromIntegrationRoot.split('/').filter(Boolean)\n\n let currentDirectory = integrationRootAbsolute\n const traversal = [currentDirectory, ...pathSegments.map((segment) => {\n currentDirectory = path.join(currentDirectory, segment)\n return currentDirectory\n })]\n\n for (const directoryPath of traversal) {\n for (const metadataFileName of INTEGRATION_META_FILE_NAMES) {\n const metadataPath = path.join(directoryPath, metadataFileName)\n readDependenciesFromMetadataFile(metadataPath, includeOptional).forEach((dependency) => requiredModules.add(dependency))\n }\n }\n }\n\n readDependenciesFromMetadataFile(absoluteSpecPath, includeOptional).forEach((dependency) => requiredModules.add(dependency))\n const specFileName = path.basename(normalizedSpecPath, '.spec.ts')\n const perTestMetadataPath = path.join(path.dirname(absoluteSpecPath), `${specFileName}.meta.ts`)\n readDependenciesFromMetadataFile(perTestMetadataPath, includeOptional).forEach((dependency) => requiredModules.add(dependency))\n\n return Array.from(requiredModules)\n}\n\nfunction resolveRequiredEnvVarsForSpec(projectRoot: string, relativeSpecPath: string): string[] {\n const requiredEnvVars = new Set<string>()\n const normalizedSpecPath = normalizePath(relativeSpecPath)\n const absoluteSpecPath = path.join(projectRoot, normalizedSpecPath)\n const integrationRoot = resolveIntegrationRootDirectory(normalizedSpecPath)\n\n if (integrationRoot) {\n const relativeDirectory = normalizePath(path.dirname(normalizedSpecPath))\n const integrationRootAbsolute = path.join(projectRoot, integrationRoot)\n const directoryAbsolute = path.join(projectRoot, relativeDirectory)\n const relativeFromIntegrationRoot = normalizePath(path.relative(integrationRootAbsolute, directoryAbsolute))\n const pathSegments = relativeFromIntegrationRoot === '.'\n ? []\n : relativeFromIntegrationRoot.split('/').filter(Boolean)\n\n let currentDirectory = integrationRootAbsolute\n const traversal = [currentDirectory, ...pathSegments.map((segment) => {\n currentDirectory = path.join(currentDirectory, segment)\n return currentDirectory\n })]\n\n for (const directoryPath of traversal) {\n for (const metadataFileName of INTEGRATION_META_FILE_NAMES) {\n const metadataPath = path.join(directoryPath, metadataFileName)\n readRequiredEnvVarsFromMetadataFile(metadataPath).forEach((envVar) => requiredEnvVars.add(envVar))\n }\n }\n }\n\n readRequiredEnvVarsFromMetadataFile(absoluteSpecPath).forEach((envVar) => requiredEnvVars.add(envVar))\n const specFileName = path.basename(normalizedSpecPath, '.spec.ts')\n const perTestMetadataPath = path.join(path.dirname(absoluteSpecPath), `${specFileName}.meta.ts`)\n readRequiredEnvVarsFromMetadataFile(perTestMetadataPath).forEach((envVar) => requiredEnvVars.add(envVar))\n\n return Array.from(requiredEnvVars)\n}\n\nfunction resolveRequiredAnyEnvVarsForSpec(projectRoot: string, relativeSpecPath: string): string[] {\n const requiredAnyEnvVars = new Set<string>()\n const normalizedSpecPath = normalizePath(relativeSpecPath)\n const absoluteSpecPath = path.join(projectRoot, normalizedSpecPath)\n const integrationRoot = resolveIntegrationRootDirectory(normalizedSpecPath)\n\n if (integrationRoot) {\n const relativeDirectory = normalizePath(path.dirname(normalizedSpecPath))\n const integrationRootAbsolute = path.join(projectRoot, integrationRoot)\n const directoryAbsolute = path.join(projectRoot, relativeDirectory)\n const relativeFromIntegrationRoot = normalizePath(path.relative(integrationRootAbsolute, directoryAbsolute))\n const pathSegments = relativeFromIntegrationRoot === '.'\n ? []\n : relativeFromIntegrationRoot.split('/').filter(Boolean)\n\n let currentDirectory = integrationRootAbsolute\n const traversal = [currentDirectory, ...pathSegments.map((segment) => {\n currentDirectory = path.join(currentDirectory, segment)\n return currentDirectory\n })]\n\n for (const directoryPath of traversal) {\n for (const metadataFileName of INTEGRATION_META_FILE_NAMES) {\n const metadataPath = path.join(directoryPath, metadataFileName)\n readRequiredAnyEnvVarsFromMetadataFile(metadataPath).forEach((envVar) => requiredAnyEnvVars.add(envVar))\n }\n }\n }\n\n readRequiredAnyEnvVarsFromMetadataFile(absoluteSpecPath).forEach((envVar) => requiredAnyEnvVars.add(envVar))\n const specFileName = path.basename(normalizedSpecPath, '.spec.ts')\n const perTestMetadataPath = path.join(path.dirname(absoluteSpecPath), `${specFileName}.meta.ts`)\n readRequiredAnyEnvVarsFromMetadataFile(perTestMetadataPath).forEach((envVar) => requiredAnyEnvVars.add(envVar))\n\n return Array.from(requiredAnyEnvVars)\n}\n\nfunction isEnvironmentVariableConfigured(name: string): boolean {\n const value = process.env[name]\n return typeof value === 'string' && value.trim().length > 0\n}\n\nexport function discoverIntegrationSpecFiles(projectRoot: string, legacyIntegrationRoot: string): IntegrationSpecDiscoveryItem[] {\n const discoveredByPath = new Map<string, IntegrationSpecDiscoveryItem>()\n const overlayRoot = resolveOverlayRootPath()\n const enterpriseEnabled = isEnterpriseModulesEnabled()\n const appOnly = isAppOnlyDiscoveryEnabled()\n const discoveryRoots = [\n path.join(projectRoot, 'src', 'modules'),\n path.join(projectRoot, 'apps'),\n path.join(projectRoot, 'packages'),\n ...(appOnly ? [] : [path.join(projectRoot, 'node_modules', '@open-mercato')]),\n ]\n\n for (const specFile of collectSpecFilesFromDirectory(legacyIntegrationRoot)) {\n const relativePath = normalizePath(path.relative(projectRoot, specFile))\n discoveredByPath.set(relativePath, {\n path: relativePath,\n moduleName: extractModuleNameFromIntegrationPath(relativePath),\n isOverlay: isOverlayIntegrationPath(relativePath, overlayRoot),\n requiredModules: resolveModuleDependenciesForSpec(projectRoot, relativePath),\n requiredEnvVars: resolveRequiredEnvVarsForSpec(projectRoot, relativePath),\n requiredAnyEnvVars: resolveRequiredAnyEnvVarsForSpec(projectRoot, relativePath),\n })\n }\n\n for (const root of discoveryRoots) {\n for (const integrationDirectory of collectNamedDirectories(root, MODULE_INTEGRATION_DIRECTORY_NAME)) {\n for (const specFile of collectSpecFilesFromDirectory(integrationDirectory)) {\n const relativePath = normalizePath(path.relative(projectRoot, specFile))\n discoveredByPath.set(relativePath, {\n path: relativePath,\n moduleName: extractModuleNameFromIntegrationPath(relativePath),\n isOverlay: isOverlayIntegrationPath(relativePath, overlayRoot),\n requiredModules: resolveModuleDependenciesForSpec(projectRoot, relativePath),\n requiredEnvVars: resolveRequiredEnvVarsForSpec(projectRoot, relativePath),\n requiredAnyEnvVars: resolveRequiredAnyEnvVarsForSpec(projectRoot, relativePath),\n })\n }\n }\n }\n\n const discovered = Array.from(discoveredByPath.values())\n .filter((file) => !appOnly || isAppOwnedIntegrationSpecPath(file.path))\n if (isMetadataFilteringDisabled()) {\n const selected = discovered.sort((left, right) => left.path.localeCompare(right.path))\n writeDiscoverySelectionReport(projectRoot, selected)\n return selected\n }\n const enabledModules = resolveEnabledModuleIds(projectRoot)\n const testAppRoot = resolveTestAppRoot()\n const testAppModules = testAppRoot ? resolvePossiblyEnabledTestAppModuleIds(testAppRoot) : null\n const enabledModuleNames = new Set<string>()\n for (const file of discovered) {\n if (!file.isOverlay && file.moduleName) {\n enabledModuleNames.add(file.moduleName)\n }\n }\n\n const selected = discovered\n .filter((file) => {\n if (file.requiredModules.some((moduleId) => !enabledModules.has(normalizeModuleId(moduleId)))) {\n return false\n }\n if (testAppModules && !file.isOverlay) {\n const owningModuleId = resolveOwningModuleId(projectRoot, file.path)\n if (owningModuleId && !testAppModules.has(owningModuleId)) {\n return false\n }\n }\n if (file.requiredEnvVars.some((envVar) => !isEnvironmentVariableConfigured(envVar))) {\n return false\n }\n if (\n file.requiredAnyEnvVars.length > 0 &&\n !file.requiredAnyEnvVars.some((envVar) => isEnvironmentVariableConfigured(envVar))\n ) {\n return false\n }\n if (!file.isOverlay) {\n return true\n }\n if (!enterpriseEnabled) {\n return false\n }\n if (!file.moduleName) {\n return true\n }\n if (enabledModuleNames.has(file.moduleName)) {\n return true\n }\n return enabledModules.has(normalizeModuleId(file.moduleName))\n })\n .sort((left, right) => left.path.localeCompare(right.path))\n writeDiscoverySelectionReport(projectRoot, selected)\n return selected\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY,cAAc,aAAa,qBAAqB;AACrE,OAAO,UAAU;AACjB,OAAO,QAAQ;AAWf,MAAM,oCAAoC;AAC1C,MAAM,yBAAyB,oBAAI,IAAI;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AACD,MAAM,8BAA8B,CAAC,WAAW,UAAU;AAC1D,MAAM,mCAAmC,CAAC,oBAAoB,mBAAmB,iBAAiB;AAClG,MAAM,uCAAuC,CAAC,GAAG,kCAAkC,iBAAiB;AACpG,MAAM,qCAAqC,CAAC,mBAAmB,iBAAiB;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