@open-mercato/cli 0.8.1-develop.7241.1.fad7b2ce2a → 0.8.1-develop.7261.1.5d42353f61
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 +158 -152
- package/dist/agentic/guides/module-facts.v2.json +158 -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/di-registrations-rich.md +2 -2
- 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/di-registrations-rich.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/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/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/gateway_stripe/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/di-registrations-rich.md +3 -3
- package/dist/agentic/guides/modules/record_locks/di-service-tokens.md +2 -2
- package/dist/agentic/guides/modules/record_locks/exact-override-targets.md +2 -2
- 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/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/reference-module-facts.json +1 -1
- package/dist/agentic/guides/upstream/manifest.json +1 -1
- package/dist/lib/generate-watch-events.js +19 -1
- package/dist/lib/generate-watch-events.js.map +2 -2
- package/dist/lib/generators/module-package-sources.js +17 -4
- package/dist/lib/generators/module-package-sources.js.map +2 -2
- package/dist/mercato.js +11 -16
- package/dist/mercato.js.map +2 -2
- package/package.json +6 -6
- package/src/lib/__tests__/generate-watch-events.test.ts +137 -0
- package/src/lib/generate-watch-events.ts +31 -0
- package/src/lib/generators/__tests__/module-package-sources.test.ts +89 -6
- package/src/lib/generators/module-package-sources.ts +17 -5
- package/src/mercato.ts +16 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# storage_s3 — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/storage-s3 0.8.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/storage-s3 0.8.1-develop.7261.1.5d42353f61; core 0.8.1-develop.7261.1.5d42353f61 — R1 staleness stamp -->
|
|
3
3
|
Source root: node_modules/@open-mercato/storage-s3/src/modules/storage_s3
|
|
4
4
|
|
|
5
5
|
## Sections
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# sync_akeneo — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/sync-akeneo 0.8.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/sync-akeneo 0.8.1-develop.7261.1.5d42353f61; core 0.8.1-develop.7261.1.5d42353f61 — R1 staleness stamp -->
|
|
3
3
|
Source root: node_modules/@open-mercato/sync-akeneo/src/modules/sync_akeneo
|
|
4
4
|
|
|
5
5
|
## Sections
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# sync_excel — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/core 0.8.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.8.1-develop.7261.1.5d42353f61; core 0.8.1-develop.7261.1.5d42353f61 — R1 staleness stamp -->
|
|
3
3
|
Source root: node_modules/@open-mercato/core/src/modules/sync_excel
|
|
4
4
|
|
|
5
5
|
## Sections
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# system_status_overlays — module facts (generated, do not edit)
|
|
2
|
-
<!-- generated from @open-mercato/enterprise 0.8.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/enterprise 0.8.1-develop.7261.1.5d42353f61; core 0.8.1-develop.7261.1.5d42353f61 — R1 staleness stamp -->
|
|
3
3
|
Source root: node_modules/@open-mercato/enterprise/src/modules/system_status_overlays
|
|
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.8.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/tillio 0.8.1-develop.7261.1.5d42353f61; core 0.8.1-develop.7261.1.5d42353f61 — 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.8.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.8.1-develop.7261.1.5d42353f61; core 0.8.1-develop.7261.1.5d42353f61 — 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.8.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.8.1-develop.7261.1.5d42353f61; core 0.8.1-develop.7261.1.5d42353f61 — 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.8.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/webhooks 0.8.1-develop.7261.1.5d42353f61; core 0.8.1-develop.7261.1.5d42353f61 — 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.8.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.8.1-develop.7261.1.5d42353f61; core 0.8.1-develop.7261.1.5d42353f61 — 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.8.1-develop.
|
|
2
|
+
<!-- generated from @open-mercato/core 0.8.1-develop.7261.1.5d42353f61; core 0.8.1-develop.7261.1.5d42353f61 — 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.8.1-develop.
|
|
1188
|
+
"coreVersion": "0.8.1-develop.7261.1.5d42353f61",
|
|
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.8.1-develop.
|
|
3
|
+
"generator": "@open-mercato/cli@0.8.1-develop.7261.1.5d42353f61",
|
|
4
4
|
"files": {
|
|
5
5
|
"AGENTS.md": "9fdaca247f55c64f5966cc103265cfb03233e0532f58f14aff538ae18aa3555d",
|
|
6
6
|
"BACKWARD_COMPATIBILITY.md": "b2f4286c289e203b5b22a4c2eb44ffe94b1b92cdb384815b311ce456399983a0"
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
function resolveGenerateWatchTargets(options) {
|
|
4
|
+
const targets = [{
|
|
5
|
+
directory: path.dirname(options.modulesFile),
|
|
6
|
+
recursive: false,
|
|
7
|
+
fileName: path.basename(options.modulesFile)
|
|
8
|
+
}];
|
|
9
|
+
for (const roots of options.moduleRoots) {
|
|
10
|
+
targets.push({ directory: path.dirname(roots.appBase), recursive: true });
|
|
11
|
+
if (!roots.watchPackageBase) continue;
|
|
12
|
+
targets.push({ directory: path.dirname(roots.pkgBase), recursive: true });
|
|
13
|
+
const sourceMirror = options.resolveSourceMirrorBase(roots.pkgBase);
|
|
14
|
+
if (sourceMirror) {
|
|
15
|
+
targets.push({ directory: path.dirname(sourceMirror), recursive: true });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return targets;
|
|
19
|
+
}
|
|
3
20
|
function targetKey(target) {
|
|
4
21
|
return JSON.stringify([
|
|
5
22
|
path.resolve(target.directory),
|
|
@@ -116,6 +133,7 @@ function createGenerateWatchChangeSignal(options) {
|
|
|
116
133
|
};
|
|
117
134
|
}
|
|
118
135
|
export {
|
|
119
|
-
createGenerateWatchChangeSignal
|
|
136
|
+
createGenerateWatchChangeSignal,
|
|
137
|
+
resolveGenerateWatchTargets
|
|
120
138
|
};
|
|
121
139
|
//# sourceMappingURL=generate-watch-events.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/lib/generate-watch-events.ts"],
|
|
4
|
-
"sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport type { GenerateWatcherChangeSignal } from './in-process-generate-watcher'\n\nexport type GenerateWatchTarget = {\n directory: string\n recursive: boolean\n fileName?: string\n}\n\ntype WatchHandle = {\n close(): void\n}\n\ntype WatchDirectory = (\n target: GenerateWatchTarget,\n onChange: (fileName?: string) => void,\n onError: () => void,\n) => WatchHandle\n\nexport type GenerateWatchChangeSignalOptions = {\n getWatchTargets: () => Promise<GenerateWatchTarget[]> | GenerateWatchTarget[]\n watchDirectory?: WatchDirectory\n directoryExists?: (directory: string) => boolean\n onSkippedDirectory?: (directory: string) => void\n}\n\nfunction targetKey(target: GenerateWatchTarget): string {\n return JSON.stringify([\n path.resolve(target.directory),\n target.recursive,\n target.fileName ?? '',\n ])\n}\n\nconst defaultWatchDirectory: WatchDirectory = (target, onChange, onError) => {\n const watcher = fs.watch(\n target.directory,\n { recursive: target.recursive },\n (_eventType, fileName) => {\n const normalizedName = String(fileName ?? '')\n if (target.fileName && normalizedName && normalizedName !== target.fileName) return\n onChange(normalizedName || undefined)\n },\n )\n watcher.on('error', onError)\n return watcher\n}\n\nexport function createGenerateWatchChangeSignal(\n options: GenerateWatchChangeSignalOptions,\n): GenerateWatcherChangeSignal {\n const watchDirectory = options.watchDirectory ?? defaultWatchDirectory\n const directoryExists = options.directoryExists ?? fs.existsSync\n const watchers = new Map<string, WatchHandle>()\n let skippedDirectories = new Set<string>()\n let version = 0\n let pollingFallback = false\n let closed = false\n\n const closeWatchers = () => {\n for (const watcher of watchers.values()) {\n try { watcher.close() } catch {}\n }\n watchers.clear()\n }\n\n const enterPollingFallback = () => {\n if (pollingFallback) return\n pollingFallback = true\n version += 1\n closeWatchers()\n }\n\n return {\n currentVersion: () => version,\n hasSkippedTargets: () => skippedDirectories.size > 0,\n usesPollingFallback: () => pollingFallback,\n refresh: async () => {\n if (closed || pollingFallback) return\n\n let targets: GenerateWatchTarget[]\n try {\n targets = await options.getWatchTargets()\n } catch {\n enterPollingFallback()\n return\n }\n\n const normalizedTargets = new Map<string, GenerateWatchTarget>()\n const nextSkippedDirectories = new Set<string>()\n for (const target of targets) {\n const normalized: GenerateWatchTarget = {\n ...target,\n directory: path.resolve(target.directory),\n }\n if (!directoryExists(normalized.directory)) {\n nextSkippedDirectories.add(normalized.directory)\n if (!skippedDirectories.has(normalized.directory)) {\n try { options.onSkippedDirectory?.(normalized.directory) } catch {}\n }\n continue\n }\n normalizedTargets.set(targetKey(normalized), normalized)\n }\n skippedDirectories = nextSkippedDirectories\n\n for (const [key, watcher] of watchers) {\n if (normalizedTargets.has(key)) continue\n try { watcher.close() } catch {}\n watchers.delete(key)\n }\n\n for (const [key, target] of normalizedTargets) {\n if (watchers.has(key)) continue\n try {\n const watcher = watchDirectory(\n target,\n () => { version += 1 },\n enterPollingFallback,\n )\n if (closed || pollingFallback) {\n try { watcher.close() } catch {}\n continue\n }\n watchers.set(key, watcher)\n } catch {\n enterPollingFallback()\n return\n }\n }\n },\n close: () => {\n if (closed) return\n closed = true\n closeWatchers()\n },\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;
|
|
4
|
+
"sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport type { GenerateWatcherChangeSignal } from './in-process-generate-watcher'\n\nexport type GenerateWatchTarget = {\n directory: string\n recursive: boolean\n fileName?: string\n}\n\ntype WatchHandle = {\n close(): void\n}\n\ntype WatchDirectory = (\n target: GenerateWatchTarget,\n onChange: (fileName?: string) => void,\n onError: () => void,\n) => WatchHandle\n\nexport type GenerateWatchChangeSignalOptions = {\n getWatchTargets: () => Promise<GenerateWatchTarget[]> | GenerateWatchTarget[]\n watchDirectory?: WatchDirectory\n directoryExists?: (directory: string) => boolean\n onSkippedDirectory?: (directory: string) => void\n}\n\nexport type GenerateWatchModuleTarget = {\n appBase: string\n pkgBase: string\n watchPackageBase: boolean\n}\n\nexport function resolveGenerateWatchTargets(options: {\n modulesFile: string\n moduleRoots: GenerateWatchModuleTarget[]\n resolveSourceMirrorBase: (packageBase: string) => string | null\n}): GenerateWatchTarget[] {\n const targets: GenerateWatchTarget[] = [{\n directory: path.dirname(options.modulesFile),\n recursive: false,\n fileName: path.basename(options.modulesFile),\n }]\n\n for (const roots of options.moduleRoots) {\n targets.push({ directory: path.dirname(roots.appBase), recursive: true })\n if (!roots.watchPackageBase) continue\n\n targets.push({ directory: path.dirname(roots.pkgBase), recursive: true })\n const sourceMirror = options.resolveSourceMirrorBase(roots.pkgBase)\n if (sourceMirror) {\n targets.push({ directory: path.dirname(sourceMirror), recursive: true })\n }\n }\n\n return targets\n}\n\nfunction targetKey(target: GenerateWatchTarget): string {\n return JSON.stringify([\n path.resolve(target.directory),\n target.recursive,\n target.fileName ?? '',\n ])\n}\n\nconst defaultWatchDirectory: WatchDirectory = (target, onChange, onError) => {\n const watcher = fs.watch(\n target.directory,\n { recursive: target.recursive },\n (_eventType, fileName) => {\n const normalizedName = String(fileName ?? '')\n if (target.fileName && normalizedName && normalizedName !== target.fileName) return\n onChange(normalizedName || undefined)\n },\n )\n watcher.on('error', onError)\n return watcher\n}\n\nexport function createGenerateWatchChangeSignal(\n options: GenerateWatchChangeSignalOptions,\n): GenerateWatcherChangeSignal {\n const watchDirectory = options.watchDirectory ?? defaultWatchDirectory\n const directoryExists = options.directoryExists ?? fs.existsSync\n const watchers = new Map<string, WatchHandle>()\n let skippedDirectories = new Set<string>()\n let version = 0\n let pollingFallback = false\n let closed = false\n\n const closeWatchers = () => {\n for (const watcher of watchers.values()) {\n try { watcher.close() } catch {}\n }\n watchers.clear()\n }\n\n const enterPollingFallback = () => {\n if (pollingFallback) return\n pollingFallback = true\n version += 1\n closeWatchers()\n }\n\n return {\n currentVersion: () => version,\n hasSkippedTargets: () => skippedDirectories.size > 0,\n usesPollingFallback: () => pollingFallback,\n refresh: async () => {\n if (closed || pollingFallback) return\n\n let targets: GenerateWatchTarget[]\n try {\n targets = await options.getWatchTargets()\n } catch {\n enterPollingFallback()\n return\n }\n\n const normalizedTargets = new Map<string, GenerateWatchTarget>()\n const nextSkippedDirectories = new Set<string>()\n for (const target of targets) {\n const normalized: GenerateWatchTarget = {\n ...target,\n directory: path.resolve(target.directory),\n }\n if (!directoryExists(normalized.directory)) {\n nextSkippedDirectories.add(normalized.directory)\n if (!skippedDirectories.has(normalized.directory)) {\n try { options.onSkippedDirectory?.(normalized.directory) } catch {}\n }\n continue\n }\n normalizedTargets.set(targetKey(normalized), normalized)\n }\n skippedDirectories = nextSkippedDirectories\n\n for (const [key, watcher] of watchers) {\n if (normalizedTargets.has(key)) continue\n try { watcher.close() } catch {}\n watchers.delete(key)\n }\n\n for (const [key, target] of normalizedTargets) {\n if (watchers.has(key)) continue\n try {\n const watcher = watchDirectory(\n target,\n () => { version += 1 },\n enterPollingFallback,\n )\n if (closed || pollingFallback) {\n try { watcher.close() } catch {}\n continue\n }\n watchers.set(key, watcher)\n } catch {\n enterPollingFallback()\n return\n }\n }\n },\n close: () => {\n if (closed) return\n closed = true\n closeWatchers()\n },\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AACf,OAA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AAE,QAAQ;AAAA,QAAC;AAC/B,iBAAS,OAAO,GAAG;AAAA,MACrB;AAEA,iBAAW,CAAC,KAAK,MAAM,KAAK,mBAAmB;AAC7C,YAAI,SAAS,IAAI,GAAG,EAAG;AACvB,YAAI;AACF,gBAAM,UAAU;AAAA,YACd;AAAA,YACA,MAAM;AAAE,yBAAW;AAAA,YAAE;AAAA,YACrB;AAAA,UACF;AACA,cAAI,UAAU,iBAAiB;AAC7B,gBAAI;AAAE,sBAAQ,MAAM;AAAA,YAAE,QAAQ;AAAA,YAAC;AAC/B;AAAA,UACF;AACA,mBAAS,IAAI,KAAK,OAAO;AAAA,QAC3B,QAAQ;AACN,+BAAqB;AACrB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,OAAO,MAAM;AACX,UAAI,OAAQ;AACZ,eAAS;AACT,oBAAc;AAAA,IAChB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { readOfficialModulePackageFromRoot, resolveInstalledPackageRoot } from "../module-package.js";
|
|
3
|
-
import {
|
|
3
|
+
import { calculateChecksum, createGeneratorResult, writeGeneratedFile } from "../utils.js";
|
|
4
4
|
function normalizeCssSourcePath(value) {
|
|
5
5
|
const normalized = value.split(path.sep).join("/");
|
|
6
6
|
return normalized.startsWith(".") ? normalized : `./${normalized}`;
|
|
@@ -12,11 +12,10 @@ async function generateModulePackageSources(options) {
|
|
|
12
12
|
const outFile = path.join(outputDir, "module-package-sources.css");
|
|
13
13
|
const checksumFile = path.join(outputDir, "module-package-sources.checksum");
|
|
14
14
|
const sourcePaths = /* @__PURE__ */ new Set();
|
|
15
|
-
const
|
|
15
|
+
const checksumInputs = /* @__PURE__ */ new Set();
|
|
16
16
|
for (const entry of resolver.loadEnabledModules()) {
|
|
17
17
|
if (!entry.from || entry.from === "@app" || entry.from === "@open-mercato/core") continue;
|
|
18
18
|
const packageRoot = resolveInstalledPackageRoot(resolver, entry.from);
|
|
19
|
-
checksumTargets.push(packageRoot);
|
|
20
19
|
let modulePackage;
|
|
21
20
|
try {
|
|
22
21
|
modulePackage = readOfficialModulePackageFromRoot(packageRoot, entry.from, entry.id);
|
|
@@ -24,11 +23,25 @@ async function generateModulePackageSources(options) {
|
|
|
24
23
|
continue;
|
|
25
24
|
}
|
|
26
25
|
const packageSourceRoot = path.join(modulePackage.packageRoot, "src");
|
|
26
|
+
checksumInputs.add(JSON.stringify({
|
|
27
|
+
entry: {
|
|
28
|
+
from: entry.from,
|
|
29
|
+
id: entry.id
|
|
30
|
+
},
|
|
31
|
+
packageName: modulePackage.packageName,
|
|
32
|
+
packageRoot: path.resolve(modulePackage.packageRoot),
|
|
33
|
+
packageJson: modulePackage.packageJson,
|
|
34
|
+
packageSourceRoot,
|
|
35
|
+
sourceModuleDir: path.resolve(modulePackage.sourceModuleDir),
|
|
36
|
+
distModuleDir: path.resolve(modulePackage.distModuleDir)
|
|
37
|
+
}));
|
|
27
38
|
const relativeSourcePath = normalizeCssSourcePath(path.relative(path.dirname(outFile), packageSourceRoot));
|
|
28
39
|
sourcePaths.add(`@source "${relativeSourcePath}/**/*.{ts,tsx}";`);
|
|
29
40
|
}
|
|
30
41
|
const content = `${Array.from(sourcePaths).sort((left, right) => left.localeCompare(right)).join("\n")}${sourcePaths.size > 0 ? "\n" : ""}`;
|
|
31
|
-
const structureChecksum =
|
|
42
|
+
const structureChecksum = calculateChecksum(
|
|
43
|
+
Array.from(checksumInputs).sort((left, right) => left.localeCompare(right)).join("\n")
|
|
44
|
+
);
|
|
32
45
|
writeGeneratedFile({
|
|
33
46
|
outFile,
|
|
34
47
|
checksumFile,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/generators/module-package-sources.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import path from 'node:path'\nimport { readOfficialModulePackageFromRoot, resolveInstalledPackageRoot } from '../module-package'\nimport type { PackageResolver } from '../resolver'\nimport { calculateChecksum, createGeneratorResult, type GeneratorResult, writeGeneratedFile } from '../utils'\n\nexport interface ModulePackageSourcesOptions {\n resolver: PackageResolver\n quiet?: boolean\n}\n\nfunction normalizeCssSourcePath(value: string): string {\n const normalized = value.split(path.sep).join('/')\n return normalized.startsWith('.') ? normalized : `./${normalized}`\n}\n\nexport async function generateModulePackageSources(\n options: ModulePackageSourcesOptions,\n): Promise<GeneratorResult> {\n const { resolver, quiet } = options\n const result = createGeneratorResult()\n const outputDir = resolver.getOutputDir()\n const outFile = path.join(outputDir, 'module-package-sources.css')\n const checksumFile = path.join(outputDir, 'module-package-sources.checksum')\n const sourcePaths = new Set<string>()\n const checksumInputs = new Set<string>()\n\n for (const entry of resolver.loadEnabledModules()) {\n if (!entry.from || entry.from === '@app' || entry.from === '@open-mercato/core') continue\n\n const packageRoot = resolveInstalledPackageRoot(resolver, entry.from)\n\n let modulePackage\n try {\n modulePackage = readOfficialModulePackageFromRoot(packageRoot, entry.from, entry.id)\n } catch {\n continue\n }\n\n const packageSourceRoot = path.join(modulePackage.packageRoot, 'src')\n checksumInputs.add(JSON.stringify({\n entry: {\n from: entry.from,\n id: entry.id,\n },\n packageName: modulePackage.packageName,\n packageRoot: path.resolve(modulePackage.packageRoot),\n packageJson: modulePackage.packageJson,\n packageSourceRoot,\n sourceModuleDir: path.resolve(modulePackage.sourceModuleDir),\n distModuleDir: path.resolve(modulePackage.distModuleDir),\n }))\n const relativeSourcePath = normalizeCssSourcePath(path.relative(path.dirname(outFile), packageSourceRoot))\n sourcePaths.add(`@source \"${relativeSourcePath}/**/*.{ts,tsx}\";`)\n }\n\n const content = `${Array.from(sourcePaths).sort((left, right) => left.localeCompare(right)).join('\\n')}${sourcePaths.size > 0 ? '\\n' : ''}`\n const structureChecksum = calculateChecksum(\n Array.from(checksumInputs).sort((left, right) => left.localeCompare(right)).join('\\n'),\n )\n\n writeGeneratedFile({\n outFile,\n checksumFile,\n content,\n structureChecksum,\n result,\n quiet,\n })\n\n return result\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,UAAU;AACjB,SAAS,mCAAmC,mCAAmC;AAE/E,SAAS,mBAAmB,uBAA6C,0BAA0B;AAOnG,SAAS,uBAAuB,OAAuB;AACrD,QAAM,aAAa,MAAM,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG;AACjD,SAAO,WAAW,WAAW,GAAG,IAAI,aAAa,KAAK,UAAU;AAClE;AAEA,eAAsB,6BACpB,SAC0B;AAC1B,QAAM,EAAE,UAAU,MAAM,IAAI;AAC5B,QAAM,SAAS,sBAAsB;AACrC,QAAM,YAAY,SAAS,aAAa;AACxC,QAAM,UAAU,KAAK,KAAK,WAAW,4BAA4B;AACjE,QAAM,eAAe,KAAK,KAAK,WAAW,iCAAiC;AAC3E,QAAM,cAAc,oBAAI,IAAY;AACpC,QAAM,iBAAiB,oBAAI,IAAY;AAEvC,aAAW,SAAS,SAAS,mBAAmB,GAAG;AACjD,QAAI,CAAC,MAAM,QAAQ,MAAM,SAAS,UAAU,MAAM,SAAS,qBAAsB;AAEjF,UAAM,cAAc,4BAA4B,UAAU,MAAM,IAAI;AAEpE,QAAI;AACJ,QAAI;AACF,sBAAgB,kCAAkC,aAAa,MAAM,MAAM,MAAM,EAAE;AAAA,IACrF,QAAQ;AACN;AAAA,IACF;AAEA,UAAM,oBAAoB,KAAK,KAAK,cAAc,aAAa,KAAK;AACpE,mBAAe,IAAI,KAAK,UAAU;AAAA,MAChC,OAAO;AAAA,QACL,MAAM,MAAM;AAAA,QACZ,IAAI,MAAM;AAAA,MACZ;AAAA,MACA,aAAa,cAAc;AAAA,MAC3B,aAAa,KAAK,QAAQ,cAAc,WAAW;AAAA,MACnD,aAAa,cAAc;AAAA,MAC3B;AAAA,MACA,iBAAiB,KAAK,QAAQ,cAAc,eAAe;AAAA,MAC3D,eAAe,KAAK,QAAQ,cAAc,aAAa;AAAA,IACzD,CAAC,CAAC;AACF,UAAM,qBAAqB,uBAAuB,KAAK,SAAS,KAAK,QAAQ,OAAO,GAAG,iBAAiB,CAAC;AACzG,gBAAY,IAAI,YAAY,kBAAkB,kBAAkB;AAAA,EAClE;AAEA,QAAM,UAAU,GAAG,MAAM,KAAK,WAAW,EAAE,KAAK,CAAC,MAAM,UAAU,KAAK,cAAc,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,GAAG,YAAY,OAAO,IAAI,OAAO,EAAE;AACzI,QAAM,oBAAoB;AAAA,IACxB,MAAM,KAAK,cAAc,EAAE,KAAK,CAAC,MAAM,UAAU,KAAK,cAAc,KAAK,CAAC,EAAE,KAAK,IAAI;AAAA,EACvF;AAEA,qBAAmB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/mercato.js
CHANGED
|
@@ -602,7 +602,7 @@ async function createGenerateWatchRuntime(quiet = false) {
|
|
|
602
602
|
const [
|
|
603
603
|
{ createResolver },
|
|
604
604
|
{ calculateGenerateWatchStructureChecksum },
|
|
605
|
-
{ createGenerateWatchChangeSignal },
|
|
605
|
+
{ createGenerateWatchChangeSignal, resolveGenerateWatchTargets },
|
|
606
606
|
{ resolveStandaloneSourceMirrorBase }
|
|
607
607
|
] = await Promise.all([
|
|
608
608
|
import("./lib/resolver.js"),
|
|
@@ -613,9 +613,13 @@ async function createGenerateWatchRuntime(quiet = false) {
|
|
|
613
613
|
const collectWatchState = () => {
|
|
614
614
|
const resolver = createResolver();
|
|
615
615
|
const moduleRoots = [];
|
|
616
|
+
const watchAppPackageFallbacks = resolver.isMonorepo();
|
|
616
617
|
for (const entry of resolver.loadEnabledModules()) {
|
|
617
618
|
const roots = resolver.getModulePaths(entry);
|
|
618
|
-
moduleRoots.push({
|
|
619
|
+
moduleRoots.push({
|
|
620
|
+
...roots,
|
|
621
|
+
watchPackageBase: entry.from !== "@app" || watchAppPackageFallbacks
|
|
622
|
+
});
|
|
619
623
|
}
|
|
620
624
|
return {
|
|
621
625
|
modulesFile: resolver.getModulesConfigPath(),
|
|
@@ -630,20 +634,11 @@ async function createGenerateWatchRuntime(quiet = false) {
|
|
|
630
634
|
onSkippedDirectory: quiet ? void 0 : (directory) => console.log(`[generate:watch] Skipping missing watch directory: ${directory}`),
|
|
631
635
|
getWatchTargets: () => {
|
|
632
636
|
const state = collectWatchState();
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}
|
|
638
|
-
for (const roots of state.moduleRoots) {
|
|
639
|
-
targets.push({ directory: path.dirname(roots.appBase), recursive: true });
|
|
640
|
-
targets.push({ directory: path.dirname(roots.pkgBase), recursive: true });
|
|
641
|
-
const sourceMirror = resolveStandaloneSourceMirrorBase(roots.pkgBase);
|
|
642
|
-
if (sourceMirror) {
|
|
643
|
-
targets.push({ directory: path.dirname(sourceMirror), recursive: true });
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
return targets;
|
|
637
|
+
return resolveGenerateWatchTargets({
|
|
638
|
+
modulesFile: state.modulesFile,
|
|
639
|
+
moduleRoots: state.moduleRoots,
|
|
640
|
+
resolveSourceMirrorBase: resolveStandaloneSourceMirrorBase
|
|
641
|
+
});
|
|
647
642
|
}
|
|
648
643
|
})
|
|
649
644
|
};
|