@open-mercato/cli 0.7.1-develop.7203.1.9396450b78 → 0.8.0
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 +142 -142
- package/dist/agentic/guides/module-facts.v2.json +142 -142
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/index.md +1 -1
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/index.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
- package/dist/agentic/guides/modules/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/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 +2 -2
- package/dist/agentic/guides/reference-modules/example/index.md +1 -1
- package/dist/agentic/guides/upstream/manifest.json +1 -1
- package/dist/agentic/shared/ai/harness/cases.json +1 -1
- package/dist/agentic/shared/ai/harness/design-system-inventory.json +3309 -967
- package/dist/agentic/shared/ai/harness/source-link-inventory.json +249 -29
- package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.7.0-to-0.8.0/SKILL.md +93 -0
- package/dist/agentic/shared/ai/skills/tiers.json +2 -1
- package/dist/lib/generators/extensions/agent-files.js +37 -16
- package/dist/lib/generators/extensions/agent-files.js.map +2 -2
- package/dist/lib/generators/extensions/index.js +2 -2
- package/dist/lib/generators/extensions/index.js.map +2 -2
- package/dist/lib/generators/module-registry.js +1 -1
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/package.json +7 -8
- package/src/lib/generators/__tests__/agent-files-extension.test.ts +118 -0
- package/src/lib/generators/extensions/agent-files.ts +85 -15
- package/src/lib/generators/extensions/index.ts +8 -3
- package/src/lib/generators/module-registry.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/generators/module-registry.ts"],
|
|
4
|
-
"sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { VariableDeclarationKind, type WriterFunction } from 'ts-morph'\nimport ts from 'typescript-js'\nimport type { ModuleEntry, PackageResolver } from '../resolver'\nimport {\n DEV_SUPERVISOR_MANIFEST_FILE,\n DEV_SUPERVISOR_MANIFEST_VERSION,\n type DevSupervisorSchedulerStartStatus,\n type DevSupervisorWorkerDescriptor,\n} from '../dev-supervisor-manifest'\nimport {\n calculateStructureChecksum,\n toVar,\n moduleHasExport,\n type GeneratorResult,\n createGeneratorResult,\n writeGeneratedFile,\n} from '../utils'\nimport {\n addAutoGeneratedComment,\n addImportSpec,\n addImportStatements,\n arrayLiteral,\n awaitExpression,\n block,\n asExpression,\n arrowFunction,\n binaryExpression,\n callExpression,\n conditionalExpression,\n createGeneratedSourceFile,\n elementAccess,\n escapeGeneratedJsonLiteral,\n returnStatement,\n getSourceText,\n identifier,\n importExpression,\n logicalAnd,\n logicalOr,\n methodCall,\n nullishCoalesce,\n objectLiteral,\n optionalPropertyAccess,\n parenthesized,\n propertyAccess,\n renderGeneratedValue,\n spreadExpression,\n type GeneratedObjectEntry,\n variableStatement,\n writeArrayLiteral,\n writeValue,\n writeStatements,\n} from './ast'\nimport {\n emptyArray,\n emptyObject,\n namespaceFallback,\n namespaceImportSpec,\n} from './extensions/shared'\nimport { detectBackendRouteCollisions, type BackendRouteRegistration } from './route-collisions'\nimport {\n scanModuleDir,\n resolveModuleFile,\n resolveFirstModuleFile,\n SCAN_CONFIGS,\n MODULE_CODE_EXTENSIONS,\n type ModuleRoots,\n type ModuleImports,\n type ScannedFile,\n type ResolvedFile,\n stripModuleCodeExtension,\n isModulePageFile,\n resolveStandaloneSourceMirrorBase,\n} from './scanner'\nimport { loadGeneratorExtensions } from './extensions'\nimport type { ModuleScanContext, StandaloneConfigOptions } from './extension'\nimport {\n renderRouteManifestShardOutputs,\n renderRouteMetadataOutput,\n routeManifestShardFilePattern,\n type RouteManifestShardEntry,\n} from './route-manifest-shards'\n\ntype HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'\n\nexport interface ModuleRegistryOptions {\n resolver: PackageResolver\n quiet?: boolean\n}\n\ninterface ModuleRegistryDiscovery {\n enabled: ModuleEntry[]\n modules: ModuleRegistryDiscoveryEntry[]\n getStructureChecksum: () => string\n}\n\ntype DiscoveredSubscriber = {\n id: string\n importPath: string\n metadata: SerializableSubscriberMetadata | null\n}\n\ntype DiscoveredWorker = {\n id: string\n importPath: string\n metadata: SerializableWorkerMetadata\n}\n\ntype DiscoveredTranslation = {\n locale: string\n coreHas: boolean\n appHas: boolean\n}\n\ntype ModuleRegistryDiscoveryEntry = {\n modId: string\n roots: ModuleRoots\n imps: ModuleImports\n appImportBase: string\n isAppModule: boolean\n resolve: (relativePath: string) => ResolvedFile | null\n frontendFiles: ScannedFile[]\n backendFiles: ScannedFile[]\n commandLoaderEntries: CommandLoaderGenerationEntry[]\n getSubscribers: () => Promise<DiscoveredSubscriber[]>\n getWorkers: () => Promise<DiscoveredWorker[]>\n translations: DiscoveredTranslation[]\n dashboardWidgetEntries: DashboardWidgetEntry[]\n}\n\ntype DashboardWidgetEntry = {\n moduleId: string\n key: string\n source: 'app' | 'package'\n importPath: string\n}\n\nexport type CommandLoaderGenerationEntry = {\n moduleId: string\n key: string\n importPath: string\n ids: string[]\n}\n\ntype WorkerGenerationEntry = DevSupervisorWorkerDescriptor & {\n importPath: string\n}\n\ntype RuntimeApiMethodMetadata = {\n requireAuth?: boolean\n requireRoles?: string[]\n requireFeatures?: string[]\n rateLimit?: {\n points: number\n duration: number\n blockDuration?: number\n keyPrefix?: string\n }\n}\n\ntype PageRouteGenerationResult = {\n eagerRoutes: string[]\n runtimeRoutes: string[]\n manifestRoutes: WriterFunction[]\n manifestShardRoutes: RouteManifestShardEntry[]\n metadataRoutes: RouteManifestShardEntry[]\n routePatterns: string[]\n}\n\n// Fail loud when two modules generate the same backend URL. Folder-derived\n// patterns collide only when a page is left un-namespaced (e.g. `backend/[id]`\n// instead of `backend/<mod>/[id]`), silently shadowing another module at runtime.\n// Mirrors the existing duplicate-command-id guard.\ntype BackendRoutePatternOwner = { moduleId: string; isAppModule: boolean }\n\nfunction assertUniqueBackendRoutePattern(\n seen: Map<string, BackendRoutePatternOwner>,\n moduleId: string,\n pattern: string,\n isAppModule: boolean,\n): void {\n if (!pattern.startsWith('/backend/')) return\n const previous = seen.get(pattern)\n if (previous && previous.moduleId !== moduleId) {\n // An app-local module shadowing a package module's page is a supported\n // override \u2014 the app entry wins at runtime, which is the whole point of\n // putting a module in `apps/<app>/src/modules/`. Only a collision where\n // neither side can predictably win is fatal: package-vs-package (no\n // precedence between them) or app-vs-app (the same app twice).\n const isIntentionalAppShadow = previous.isAppModule !== isAppModule\n if (!isIntentionalAppShadow) {\n const message =\n `[generate] Duplicate backend route pattern \"${pattern}\" generated by modules ` +\n `\"${previous.moduleId}\" and \"${moduleId}\". Each backend page must resolve to a unique URL \u2014 ` +\n `nest the page under a module-specific folder (e.g. backend/${moduleId}/...) so it ` +\n `does not silently shadow another module.`\n // Print before throwing: this guard short-circuits the aggregate collision\n // sweep that would otherwise report the offending path and modules, and an\n // operator needs the detail whichever guard fires first.\n console.error(message)\n throw new Error(message)\n }\n }\n // The app module owns the pattern once it shadows, so a package module seen\n // afterwards is measured against the app entry rather than replacing it.\n if (!previous || isAppModule) seen.set(pattern, { moduleId, isAppModule })\n}\n\ntype ApiRouteGenerationResult = {\n eagerApis: string[]\n runtimeApis: string[]\n manifestApis: WriterFunction[]\n manifestShardApis: RouteManifestShardEntry[]\n metadataApis: RouteManifestShardEntry[]\n}\n\ntype SerializablePageMetadata = {\n requireAuth?: boolean\n requireRoles?: string[]\n requireFeatures?: string[]\n requireCustomerAuth?: boolean\n requireCustomerFeatures?: string[]\n title?: string\n titleKey?: string\n pageTitle?: string\n pageTitleKey?: string\n group?: string\n groupKey?: string\n pageGroup?: string\n pageGroupKey?: string\n order?: number\n pageOrder?: number\n priority?: number\n pagePriority?: number\n navHidden?: boolean\n breadcrumb?: Array<{ label: string; labelKey?: string; href?: string }>\n pageContext?: 'main' | 'admin' | 'settings' | 'profile'\n placement?: {\n section: string\n sectionLabel?: string\n sectionLabelKey?: string\n order?: number\n }\n nav?: {\n label: string\n labelKey?: string\n group?: 'main' | 'account'\n order?: number\n icon?: string\n }\n icon?: string\n}\n\ntype SerializableSubscriberMetadata = {\n id?: string\n event?: string\n persistent?: boolean\n sync?: boolean\n priority?: number\n}\n\ntype SerializableWorkerMetadata = {\n id?: string\n queue?: string\n concurrency?: number\n schedulerSafe?: boolean\n schedulerRequiredFeatures?: string[]\n lockDuration?: number\n maxStalledCount?: number\n /**\n * Whether the worker's metadata declares an `onJobAbandoned` callback.\n *\n * A function cannot be serialized into the registry the way the scalar options are, so the flag is\n * resolved here at build time and the callback itself is emitted as a lazy import beside the\n * handler. Recorded only when the source module could actually be loaded \u2014 the object-literal\n * fallback below cannot see whether a referenced identifier is a function.\n */\n hasJobAbandonedHook?: boolean\n}\n\ntype PageMetadataManifestLoadResult = {\n manifestExpr: string\n requiresRuntimeImport: boolean\n}\n\ntype GeneratedImportStatement =\n | string\n | {\n moduleSpecifier?: string\n defaultImport?: string\n namespaceImport?: string\n namedImports?: Array<string | { name: string; alias?: string; isTypeOnly?: boolean }>\n isTypeOnly?: boolean\n }\n\nfunction scanDashboardWidgetEntries(options: {\n modId: string\n roots: ModuleRoots\n appImportBase: string\n pkgImportBase: string\n}): DashboardWidgetEntry[] {\n const { modId, roots, appImportBase, pkgImportBase } = options\n const files = scanModuleDir(roots, SCAN_CONFIGS.dashboardWidgets)\n return files.map(({ relPath, fromApp }) => {\n const segs = relPath.split('/')\n const file = segs.pop()!\n const base = file.replace(/\\.(t|j)sx?$/, '')\n const importPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/widgets/dashboard/${[...segs, base].join('/')}`\n )\n const key = [modId, ...segs, base].filter(Boolean).join(':')\n const source = fromApp ? 'app' : 'package'\n return { moduleId: modId, key, source, importPath }\n })\n}\n\nasync function loadModuleExportsFromSource<T = Record<string, unknown>>(sourceFile: string): Promise<T | null> {\n try {\n return await import(buildCacheBustedSourceImportUrl(sourceFile)) as T\n } catch {\n return null\n }\n}\n\nfunction buildCacheBustedSourceImportUrl(sourceFile: string): string {\n const url = pathToFileURL(sourceFile)\n try {\n const stat = fs.statSync(sourceFile)\n url.searchParams.set('v', `${stat.mtimeMs}-${stat.size}`)\n } catch {}\n return url.href\n}\n\nfunction assertGeneratorPluginUsesTypeOnlyImports(sourceFile: string): void {\n const source = fs.readFileSync(sourceFile, 'utf8')\n const scriptKind = sourceFile.endsWith('.js') || sourceFile.endsWith('.mjs') || sourceFile.endsWith('.cjs')\n ? ts.ScriptKind.JS\n : ts.ScriptKind.TS\n const parsed = ts.createSourceFile(sourceFile, source, ts.ScriptTarget.Latest, true, scriptKind)\n const violations: string[] = []\n\n for (const statement of parsed.statements) {\n if (ts.isImportDeclaration(statement) && !statement.importClause?.isTypeOnly) {\n violations.push(statement.getText(parsed))\n }\n if (ts.isImportEqualsDeclaration(statement)) {\n violations.push(statement.getText(parsed))\n }\n if (ts.isExportDeclaration(statement) && statement.moduleSpecifier && !statement.isTypeOnly) {\n violations.push(statement.getText(parsed))\n }\n }\n\n const visit = (node: ts.Node): void => {\n if (\n ts.isCallExpression(node)\n && (node.expression.kind === ts.SyntaxKind.ImportKeyword\n || (ts.isIdentifier(node.expression) && node.expression.text === 'require'))\n ) {\n violations.push(node.getText(parsed))\n }\n ts.forEachChild(node, visit)\n }\n visit(parsed)\n\n if (violations.length > 0) {\n throw new Error(\n `Generator plugin ${sourceFile} contains runtime imports. generators.ts may use only \\`import type\\`: ${violations.join('; ')}`,\n )\n }\n}\n\nconst GENERATOR_PLUGIN_OUTPUT_MANIFEST = '.generator-plugin-outputs.json'\n\nfunction normalizeGeneratorPluginOutputFileName(pluginId: string, outputFileName: string): string {\n const normalized = outputFileName.replace(/\\\\/g, '/')\n if (\n path.isAbsolute(outputFileName)\n || outputFileName.includes('\\\\')\n || normalized.startsWith('/')\n || normalized.startsWith('../')\n || normalized.includes('/../')\n || !normalized.endsWith('.ts')\n ) {\n throw new Error(\n `Generator plugin '${pluginId}' has an invalid outputFileName '${outputFileName}'; expected a relative .ts path inside the generated directory.`,\n )\n }\n return normalized\n}\n\nfunction resolveGeneratorPluginOutputNames(\n plugins: ReadonlyMap<string, import('@open-mercato/shared/modules/generators').GeneratorPlugin>,\n): Map<string, string> {\n const outputNames = new Map<string, string>()\n const ownersByOutput = new Map<string, string>()\n for (const [pluginId, plugin] of plugins) {\n const outputName = normalizeGeneratorPluginOutputFileName(pluginId, plugin.outputFileName)\n const existingOwner = ownersByOutput.get(outputName)\n if (existingOwner) {\n throw new Error(\n `Generator plugins '${existingOwner}' and '${pluginId}' declare the same output file '${outputName}'.`,\n )\n }\n ownersByOutput.set(outputName, pluginId)\n outputNames.set(pluginId, outputName)\n }\n return outputNames\n}\n\nfunction reconcileGeneratorPluginOutputs(options: {\n outputDir: string\n outputNames: Iterable<string>\n result: GeneratorResult\n}): void {\n const manifestPath = path.join(options.outputDir, GENERATOR_PLUGIN_OUTPUT_MANIFEST)\n let previousOutputs: string[] = []\n if (fs.existsSync(manifestPath)) {\n const parsed = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as unknown\n if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== 'string')) {\n throw new Error(`Invalid generator plugin output manifest: ${manifestPath}`)\n }\n previousOutputs = parsed.map((entry) => normalizeGeneratorPluginOutputFileName('manifest', entry))\n }\n\n const currentOutputs = new Set(options.outputNames)\n for (const staleOutput of previousOutputs) {\n if (currentOutputs.has(staleOutput)) continue\n for (const stalePath of [\n path.join(options.outputDir, staleOutput),\n path.join(options.outputDir, staleOutput.replace(/\\.ts$/, '.checksum')),\n ]) {\n if (!fs.existsSync(stalePath)) continue\n fs.unlinkSync(stalePath)\n options.result.filesWritten.push(stalePath)\n }\n }\n\n if (currentOutputs.size === 0) {\n if (fs.existsSync(manifestPath)) {\n fs.unlinkSync(manifestPath)\n options.result.filesWritten.push(manifestPath)\n }\n return\n }\n\n const manifestContent = `${JSON.stringify(\n [...currentOutputs].sort((left, right) => left.localeCompare(right)),\n null,\n 2,\n )}\\n`\n if (!fs.existsSync(manifestPath) || fs.readFileSync(manifestPath, 'utf8') !== manifestContent) {\n fs.mkdirSync(path.dirname(manifestPath), { recursive: true })\n fs.writeFileSync(manifestPath, manifestContent)\n options.result.filesWritten.push(manifestPath)\n }\n}\n\nfunction unwrapObjectLiteralExpression(\n expression: ts.Expression | undefined,\n): ts.ObjectLiteralExpression | undefined {\n if (!expression) return undefined\n if (ts.isObjectLiteralExpression(expression)) return expression\n if (ts.isAsExpression(expression) || ts.isTypeAssertionExpression(expression)) {\n return unwrapObjectLiteralExpression(expression.expression)\n }\n if (ts.isParenthesizedExpression(expression)) {\n return unwrapObjectLiteralExpression(expression.expression)\n }\n return undefined\n}\n\nfunction extractNamedObjectLiteralSource(sourceFile: string, exportName: string): string | null {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return null\n }\n\n const parsed = ts.createSourceFile(\n sourceFile,\n source,\n ts.ScriptTarget.Latest,\n true,\n inferScriptKind(sourceFile),\n )\n\n const exportedNames = new Set<string>()\n for (const statement of parsed.statements) {\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n && !statement.moduleSpecifier\n ) {\n for (const element of statement.exportClause.elements) {\n exportedNames.add(element.name.text)\n }\n }\n }\n\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n\n const statementExportsNameDirectly = (ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined)\n ?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name) || declaration.name.text !== exportName) continue\n if (!statementExportsNameDirectly && !exportedNames.has(exportName)) continue\n\n const objectLiteral = unwrapObjectLiteralExpression(declaration.initializer)\n if (!objectLiteral) return null\n return source.slice(objectLiteral.getStart(parsed), objectLiteral.end)\n }\n }\n\n return null\n}\n\nfunction resolveLocalStringConstants(parsed: ts.SourceFile): Map<string, string> {\n const constants = new Map<string, string>()\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name)) continue\n if (!declaration.initializer) continue\n if (ts.isStringLiteral(declaration.initializer) || ts.isNoSubstitutionTemplateLiteral(declaration.initializer)) {\n constants.set(declaration.name.text, declaration.initializer.text)\n }\n }\n }\n return constants\n}\n\nfunction extractObjectPropertiesFromAst(sourceFile: string, exportName: string): Record<string, unknown> | null {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return null\n }\n\n const parsed = ts.createSourceFile(\n sourceFile,\n source,\n ts.ScriptTarget.Latest,\n true,\n inferScriptKind(sourceFile),\n )\n\n const exportedNames = new Set<string>()\n for (const statement of parsed.statements) {\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n && !statement.moduleSpecifier\n ) {\n for (const element of statement.exportClause.elements) {\n exportedNames.add(element.name.text)\n }\n }\n }\n\n let objectLiteral: ts.ObjectLiteralExpression | undefined\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n const statementExportsNameDirectly = (ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined)\n ?.some((modifier: ts.Modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name) || declaration.name.text !== exportName) continue\n if (!statementExportsNameDirectly && !exportedNames.has(exportName)) continue\n objectLiteral = unwrapObjectLiteralExpression(declaration.initializer)\n break\n }\n if (objectLiteral) break\n }\n\n if (!objectLiteral) return null\n\n const localConstants = resolveLocalStringConstants(parsed)\n const result: Record<string, unknown> = {}\n\n for (const property of objectLiteral.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const key = ts.isIdentifier(property.name) ? property.name.text\n : ts.isStringLiteral(property.name) ? property.name.text\n : null\n if (!key) continue\n\n const initializer = property.initializer\n if (ts.isStringLiteral(initializer) || ts.isNoSubstitutionTemplateLiteral(initializer)) {\n result[key] = initializer.text\n } else if (ts.isNumericLiteral(initializer)) {\n result[key] = Number(initializer.text)\n } else if (initializer.kind === ts.SyntaxKind.TrueKeyword) {\n result[key] = true\n } else if (initializer.kind === ts.SyntaxKind.FalseKeyword) {\n result[key] = false\n } else if (ts.isIdentifier(initializer) && localConstants.has(initializer.text)) {\n result[key] = localConstants.get(initializer.text)\n }\n }\n\n return Object.keys(result).length > 0 ? result : null\n}\n\n/**\n * Whether an exported object literal declares a property, regardless of what it evaluates to.\n *\n * Needed for callbacks: the value resolvers above can read literals and local constants, but a\n * property whose value is an imported function stays unresolvable, so \"did the author declare it\"\n * cannot be answered by inspecting the extracted value. Answering it from the syntax instead is what\n * lets the generator emit a lazy accessor for a hook it can see but cannot serialize.\n */\nexport function namedObjectLiteralDeclaresProperty(sourceFile: string, exportName: string, propertyName: string): boolean {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return false\n }\n\n const parsed = ts.createSourceFile(sourceFile, source, ts.ScriptTarget.Latest, true, inferScriptKind(sourceFile))\n const exportedNames = new Set<string>()\n for (const statement of parsed.statements) {\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n && !statement.moduleSpecifier\n ) {\n for (const element of statement.exportClause.elements) exportedNames.add(element.name.text)\n }\n }\n\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n const exportsDirectly = (ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined)\n ?.some((modifier: ts.Modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name) || declaration.name.text !== exportName) continue\n if (!exportsDirectly && !exportedNames.has(exportName)) continue\n const objectLiteral = unwrapObjectLiteralExpression(declaration.initializer)\n if (!objectLiteral) return false\n return objectLiteral.properties.some((property) => {\n const name = property.name\n if (!name) return false\n const key = ts.isIdentifier(name) ? name.text : ts.isStringLiteral(name) ? name.text : null\n return key === propertyName\n })\n }\n }\n return false\n}\n\nexport function extractNamedObjectLiteralExport(sourceFile: string, exportName: string): Record<string, unknown> | null {\n const literal = extractNamedObjectLiteralSource(sourceFile, exportName)\n if (literal) {\n try {\n const extracted = Function(`\"use strict\"; return (${literal});`)()\n if (extracted && typeof extracted === 'object') {\n return extracted as Record<string, unknown>\n }\n } catch {\n // fall through to AST-based resolver\n }\n }\n const resolved = resolveNamedObjectExport(sourceFile, exportName)\n if (resolved) return resolved\n return extractObjectPropertiesFromAst(sourceFile, exportName)\n}\n\nfunction unwrapExpression(expression: ts.Expression): ts.Expression {\n let current: ts.Expression = expression\n while (\n ts.isAsExpression(current)\n || ts.isTypeAssertionExpression(current)\n || ts.isParenthesizedExpression(current)\n || ts.isSatisfiesExpression?.(current)\n || ts.isNonNullExpression(current)\n ) {\n current = current.expression\n }\n return current\n}\n\nfunction collectLocalDeclarations(parsed: ts.SourceFile): Map<string, ts.Expression> {\n const locals = new Map<string, ts.Expression>()\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name) && declaration.initializer) {\n locals.set(declaration.name.text, declaration.initializer)\n }\n }\n }\n return locals\n}\n\ntype ImportedBinding =\n | {\n kind: 'named'\n sourceFile: string\n exportName: string\n }\n | {\n kind: 'default'\n sourceFile: string\n }\n | {\n kind: 'namespace'\n sourceFile: string\n }\n\ntype ParsedModuleResolutionContext = {\n sourceFile: string\n parsed: ts.SourceFile\n locals: Map<string, ts.Expression>\n exportedNames: Set<string>\n imports: Map<string, ImportedBinding>\n}\n\nfunction resolveImportedModuleFile(sourceFile: string, moduleSpecifier: string): string | null {\n if (!moduleSpecifier.startsWith('.')) return null\n return findExistingModuleFileByBaseNames(path.dirname(sourceFile), [\n moduleSpecifier,\n path.join(moduleSpecifier, 'index'),\n ])\n}\n\nfunction collectImportedBindings(\n parsed: ts.SourceFile,\n sourceFile: string,\n): Map<string, ImportedBinding> {\n const bindings = new Map<string, ImportedBinding>()\n\n for (const statement of parsed.statements) {\n if (!ts.isImportDeclaration(statement)) continue\n if (!ts.isStringLiteral(statement.moduleSpecifier)) continue\n\n const resolvedSourceFile = resolveImportedModuleFile(sourceFile, statement.moduleSpecifier.text)\n if (!resolvedSourceFile) continue\n\n const importClause = statement.importClause\n if (!importClause) continue\n\n if (importClause.name) {\n bindings.set(importClause.name.text, {\n kind: 'default',\n sourceFile: resolvedSourceFile,\n })\n }\n\n const namedBindings = importClause.namedBindings\n if (!namedBindings) continue\n\n if (ts.isNamespaceImport(namedBindings)) {\n bindings.set(namedBindings.name.text, {\n kind: 'namespace',\n sourceFile: resolvedSourceFile,\n })\n continue\n }\n\n for (const element of namedBindings.elements) {\n bindings.set(element.name.text, {\n kind: 'named',\n sourceFile: resolvedSourceFile,\n exportName: element.propertyName?.text ?? element.name.text,\n })\n }\n }\n\n return bindings\n}\n\nfunction collectReexportedNames(parsed: ts.SourceFile): Set<string> {\n const exportedNames = new Set<string>()\n for (const statement of parsed.statements) {\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n && !statement.moduleSpecifier\n ) {\n for (const element of statement.exportClause.elements) {\n exportedNames.add(element.name.text)\n }\n }\n }\n return exportedNames\n}\n\nfunction findExportedInitializer(\n parsed: ts.SourceFile,\n exportName: string,\n exportedNames: Set<string>,\n): ts.Expression | null {\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n const isExported = (ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined)\n ?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) ?? false\n for (const declaration of statement.declarationList.declarations) {\n if (!declaration.initializer) continue\n if (ts.isIdentifier(declaration.name)) {\n if (declaration.name.text !== exportName) continue\n if (!isExported && !exportedNames.has(exportName)) continue\n return declaration.initializer\n }\n if ((isExported || exportedNames.has(exportName)) && ts.isObjectBindingPattern(declaration.name)) {\n for (const element of declaration.name.elements) {\n const bindingName = ts.isIdentifier(element.name) ? element.name.text : null\n const propertyName = element.propertyName && ts.isIdentifier(element.propertyName)\n ? element.propertyName.text\n : null\n const targetKey = propertyName ?? bindingName\n if (targetKey !== exportName) continue\n const initializer = unwrapExpression(declaration.initializer)\n if (ts.isCallExpression(initializer) && initializer.arguments.length > 0) {\n const firstArg = unwrapExpression(initializer.arguments[0])\n if (ts.isObjectLiteralExpression(firstArg)) {\n for (const prop of firstArg.properties) {\n if (!ts.isPropertyAssignment(prop)) continue\n const key = ts.isIdentifier(prop.name) ? prop.name.text\n : ts.isStringLiteral(prop.name) ? prop.name.text\n : null\n if (key === exportName) return prop.initializer\n }\n }\n }\n return null\n }\n }\n }\n }\n return null\n}\n\nfunction findDefaultExportInitializer(parsed: ts.SourceFile): ts.Expression | null {\n for (const statement of parsed.statements) {\n if (ts.isExportAssignment(statement) && !statement.isExportEquals) {\n return statement.expression\n }\n\n if (!ts.isVariableStatement(statement)) continue\n const modifiers = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined\n const isDefaultExport = modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword) ?? false\n if (!isDefaultExport) continue\n\n for (const declaration of statement.declarationList.declarations) {\n if (declaration.initializer) return declaration.initializer\n }\n }\n\n return null\n}\n\nfunction loadParsedModuleResolutionContext(\n sourceFile: string,\n cache: Map<string, ParsedModuleResolutionContext | null>,\n): ParsedModuleResolutionContext | null {\n if (cache.has(sourceFile)) {\n return cache.get(sourceFile) ?? null\n }\n\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n cache.set(sourceFile, null)\n return null\n }\n\n const parsed = ts.createSourceFile(\n sourceFile,\n source,\n ts.ScriptTarget.Latest,\n true,\n inferScriptKind(sourceFile),\n )\n\n const context: ParsedModuleResolutionContext = {\n sourceFile,\n parsed,\n locals: collectLocalDeclarations(parsed),\n exportedNames: collectReexportedNames(parsed),\n imports: collectImportedBindings(parsed, sourceFile),\n }\n cache.set(sourceFile, context)\n return context\n}\n\nfunction resolveImportedBindingValue(\n binding: ImportedBinding,\n pathSegments: string[],\n visited: Set<string>,\n cache: Map<string, ParsedModuleResolutionContext | null>,\n): unknown {\n const importedContext = loadParsedModuleResolutionContext(binding.sourceFile, cache)\n if (!importedContext) return undefined\n\n if (binding.kind === 'namespace') {\n if (pathSegments.length === 0) return undefined\n const [exportName, ...restPath] = pathSegments\n const importKey = `${binding.sourceFile}::${exportName}`\n if (visited.has(importKey)) return undefined\n\n let initializer = findExportedInitializer(importedContext.parsed, exportName, importedContext.exportedNames)\n if (!initializer && importedContext.exportedNames.has(exportName)) {\n initializer = importedContext.locals.get(exportName) ?? null\n }\n if (!initializer) return undefined\n\n const nextVisited = new Set(visited)\n nextVisited.add(importKey)\n let value = resolveExpressionValue(initializer, importedContext, nextVisited, cache)\n for (const segment of restPath) {\n if (value && typeof value === 'object' && !Array.isArray(value) && segment in (value as Record<string, unknown>)) {\n value = (value as Record<string, unknown>)[segment]\n } else {\n return undefined\n }\n }\n return value\n }\n\n const importKey = binding.kind === 'default'\n ? `${binding.sourceFile}::default`\n : `${binding.sourceFile}::${binding.exportName}`\n if (visited.has(importKey)) return undefined\n\n let initializer = binding.kind === 'default'\n ? findDefaultExportInitializer(importedContext.parsed)\n : findExportedInitializer(importedContext.parsed, binding.exportName, importedContext.exportedNames)\n\n if (!initializer && binding.kind === 'named' && importedContext.exportedNames.has(binding.exportName)) {\n initializer = importedContext.locals.get(binding.exportName) ?? null\n }\n if (!initializer) return undefined\n\n const nextVisited = new Set(visited)\n nextVisited.add(importKey)\n let value = resolveExpressionValue(initializer, importedContext, nextVisited, cache)\n\n for (const segment of pathSegments) {\n if (value && typeof value === 'object' && !Array.isArray(value) && segment in (value as Record<string, unknown>)) {\n value = (value as Record<string, unknown>)[segment]\n } else {\n return undefined\n }\n }\n\n return value\n}\n\nfunction resolveExpressionValue(\n expression: ts.Expression,\n context: ParsedModuleResolutionContext,\n visited: Set<string>,\n cache: Map<string, ParsedModuleResolutionContext | null>,\n): unknown {\n const expr = unwrapExpression(expression)\n\n if (ts.isStringLiteral(expr) || ts.isNoSubstitutionTemplateLiteral(expr)) return expr.text\n if (ts.isNumericLiteral(expr)) return Number(expr.text)\n if (expr.kind === ts.SyntaxKind.TrueKeyword) return true\n if (expr.kind === ts.SyntaxKind.FalseKeyword) return false\n if (expr.kind === ts.SyntaxKind.NullKeyword) return null\n if (ts.isPrefixUnaryExpression(expr) && expr.operator === ts.SyntaxKind.MinusToken && ts.isNumericLiteral(expr.operand)) {\n return -Number(expr.operand.text)\n }\n\n if (ts.isObjectLiteralExpression(expr)) {\n const result: Record<string, unknown> = {}\n for (const property of expr.properties) {\n if (ts.isPropertyAssignment(property)) {\n const key = ts.isIdentifier(property.name) ? property.name.text\n : ts.isStringLiteral(property.name) ? property.name.text\n : null\n if (!key) continue\n const value = resolveExpressionValue(property.initializer, context, visited, cache)\n if (value !== undefined) result[key] = value\n } else if (ts.isShorthandPropertyAssignment(property)) {\n const key = property.name.text\n const initializer = context.locals.get(key)\n if (initializer && !visited.has(key)) {\n const nextVisited = new Set(visited)\n nextVisited.add(key)\n const value = resolveExpressionValue(initializer, context, nextVisited, cache)\n if (value !== undefined) result[key] = value\n }\n } else if (ts.isSpreadAssignment(property)) {\n const spread = resolveExpressionValue(property.expression, context, visited, cache)\n if (spread && typeof spread === 'object' && !Array.isArray(spread)) {\n Object.assign(result, spread)\n }\n }\n }\n return result\n }\n\n if (ts.isArrayLiteralExpression(expr)) {\n const result: unknown[] = []\n for (const element of expr.elements) {\n if (ts.isSpreadElement(element)) {\n const spread = resolveExpressionValue(element.expression, context, visited, cache)\n if (Array.isArray(spread)) result.push(...spread)\n continue\n }\n const value = resolveExpressionValue(element as ts.Expression, context, visited, cache)\n if (value !== undefined) result.push(value)\n }\n return result\n }\n\n if (ts.isIdentifier(expr)) {\n if (visited.has(expr.text)) return undefined\n const initializer = context.locals.get(expr.text)\n if (initializer) {\n const nextVisited = new Set(visited)\n nextVisited.add(expr.text)\n return resolveExpressionValue(initializer, context, nextVisited, cache)\n }\n\n const importBinding = context.imports.get(expr.text)\n if (!importBinding) return undefined\n return resolveImportedBindingValue(importBinding, [], visited, cache)\n }\n\n if (ts.isPropertyAccessExpression(expr)) {\n const pathSegments: string[] = []\n let cursor: ts.Expression = expr\n while (ts.isPropertyAccessExpression(cursor)) {\n if (!ts.isIdentifier(cursor.name)) return undefined\n pathSegments.unshift(cursor.name.text)\n cursor = cursor.expression\n }\n if (!ts.isIdentifier(cursor)) return undefined\n const rootName = cursor.text\n if (!visited.has(rootName)) {\n const rootInit = context.locals.get(rootName)\n if (rootInit) {\n const unwrappedRoot = unwrapExpression(rootInit)\n const nextVisited = new Set(visited)\n nextVisited.add(rootName)\n // Handle `const crud = makeCrudRoute({ metadata: routeMetadata, ... })`\n if (ts.isCallExpression(unwrappedRoot) && unwrappedRoot.arguments.length > 0) {\n const firstArg = unwrapExpression(unwrappedRoot.arguments[0])\n if (ts.isObjectLiteralExpression(firstArg)) {\n const argObject = resolveExpressionValue(firstArg, context, nextVisited, cache)\n if (argObject && typeof argObject === 'object' && !Array.isArray(argObject)) {\n let current: unknown = argObject\n for (const segment of pathSegments) {\n if (current && typeof current === 'object' && !Array.isArray(current) && segment in (current as Record<string, unknown>)) {\n current = (current as Record<string, unknown>)[segment]\n } else {\n current = undefined\n break\n }\n }\n if (current !== undefined) return current\n }\n }\n }\n let value = resolveExpressionValue(rootInit, context, nextVisited, cache)\n for (const segment of pathSegments) {\n if (value && typeof value === 'object' && !Array.isArray(value) && segment in (value as Record<string, unknown>)) {\n value = (value as Record<string, unknown>)[segment]\n } else {\n return undefined\n }\n }\n return value\n }\n }\n\n const importBinding = context.imports.get(rootName)\n if (!importBinding) return undefined\n return resolveImportedBindingValue(importBinding, pathSegments, visited, cache)\n }\n\n return undefined\n}\n\nexport function hasNamedExport(sourceFile: string, exportName: string): boolean {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return false\n }\n const parsed = ts.createSourceFile(\n sourceFile,\n source,\n ts.ScriptTarget.Latest,\n true,\n inferScriptKind(sourceFile),\n )\n for (const statement of parsed.statements) {\n if (ts.isVariableStatement(statement)) {\n const isExported = (ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined)\n ?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) ?? false\n if (!isExported) continue\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name) && declaration.name.text === exportName) return true\n if (ts.isObjectBindingPattern(declaration.name)) {\n for (const element of declaration.name.elements) {\n const bindingName = ts.isIdentifier(element.name) ? element.name.text : null\n const propertyName = element.propertyName && ts.isIdentifier(element.propertyName)\n ? element.propertyName.text\n : null\n if ((propertyName ?? bindingName) === exportName) return true\n }\n }\n }\n }\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n ) {\n for (const element of statement.exportClause.elements) {\n const exposedName = element.name.text\n const sourceName = element.propertyName?.text ?? exposedName\n if (exposedName === exportName || sourceName === exportName) return true\n }\n }\n }\n return false\n}\n\nexport function resolveNamedObjectExport(sourceFile: string, exportName: string): Record<string, unknown> | null {\n const cache = new Map<string, ParsedModuleResolutionContext | null>()\n const context = loadParsedModuleResolutionContext(sourceFile, cache)\n if (!context) return null\n\n let initializer = findExportedInitializer(context.parsed, exportName, context.exportedNames)\n if (!initializer && context.exportedNames.has(exportName)) {\n initializer = context.locals.get(exportName) ?? null\n }\n if (!initializer) return null\n const value = resolveExpressionValue(initializer, context, new Set<string>(), cache)\n if (!value || typeof value !== 'object' || Array.isArray(value)) return null\n const record = value as Record<string, unknown>\n return Object.keys(record).length > 0 ? record : null\n}\n\nfunction inferScriptKind(filePath: string): ts.ScriptKind {\n if (filePath.endsWith('.tsx')) return ts.ScriptKind.TSX\n if (filePath.endsWith('.jsx')) return ts.ScriptKind.JSX\n if (filePath.endsWith('.js')) return ts.ScriptKind.JS\n return ts.ScriptKind.TS\n}\n\nfunction hasDefaultExport(sourceFile: string): boolean {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return false\n }\n\n const parsed = ts.createSourceFile(\n sourceFile,\n source,\n ts.ScriptTarget.Latest,\n true,\n inferScriptKind(sourceFile),\n )\n\n for (const statement of parsed.statements) {\n if (ts.isExportAssignment(statement) && !statement.isExportEquals) {\n return true\n }\n\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n && statement.exportClause.elements.some(\n (element) => element.name.text === 'default' || element.propertyName?.text === 'default',\n )\n ) {\n return true\n }\n\n const modifiers = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined\n if (modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword)) {\n return true\n }\n }\n\n return false\n}\n\nfunction requiresRuntimePageMetadataFromSourceFile(sourceFile: string): boolean {\n const literal = extractNamedObjectLiteralSource(sourceFile, 'metadata')\n if (!literal) return false\n\n if (/\\b(?:visible|enabled)\\s*(?::|[,}])/.test(literal)) {\n return true\n }\n\n if (!/\\bicon\\s*(?::|[,}])/.test(literal)) {\n return false\n }\n\n const iconMatch = /\\bicon\\s*:\\s*([^,\\n}]+)/m.exec(literal)\n if (!iconMatch) return true\n\n return !/^['\"`]/.test(iconMatch[1].trim())\n}\n\nfunction toLiteral(value: unknown): string {\n return escapeGeneratedJsonLiteral(JSON.stringify(value))\n}\n\nconst GENERATED_MODULE_RELATIVE_PREFIXES = ['@/', '../../src/modules/', './'] as const\nconst GENERATED_MODULE_SPECIFIER_SEGMENT = /^[A-Za-z0-9_.\\-[\\]()']+$/\n// Lenient npm package name matcher. Accepts legacy uppercase packages and\n// tilde-prefixed names, bans leading \".\" / \"_\", and reserves \"@\" for scope\n// markers so the dispatcher below can split scope-vs-bare unambiguously.\nconst NPM_PACKAGE_NAME_SEGMENT = /^[A-Za-z0-9~][A-Za-z0-9_.~-]*$/\n\nfunction sanitizeGeneratedModuleSpecifierSegment(segment: string, importPath: string): string {\n const match = GENERATED_MODULE_SPECIFIER_SEGMENT.exec(segment)\n if (!match || segment === '.' || segment === '..') {\n throw new Error(`Unsafe generated module specifier: ${importPath}`)\n }\n return match[0]\n}\n\nfunction sanitizeNpmPackageNameSegment(segment: string, importPath: string): void {\n if (!NPM_PACKAGE_NAME_SEGMENT.test(segment) || segment === '.' || segment === '..') {\n throw new Error(`Unsafe generated module specifier: ${importPath}`)\n }\n}\n\nfunction sanitizeGeneratedModuleSpecifier(importPath: string): string {\n if (!importPath) {\n throw new Error(`Unsafe generated module specifier: ${importPath}`)\n }\n\n const relativePrefix = GENERATED_MODULE_RELATIVE_PREFIXES.find((candidate) =>\n importPath.startsWith(candidate),\n )\n if (relativePrefix) {\n const suffix = importPath.slice(relativePrefix.length)\n if (!suffix) {\n throw new Error(`Unsafe generated module specifier: ${importPath}`)\n }\n const segments = suffix\n .split('/')\n .map((segment) => sanitizeGeneratedModuleSpecifierSegment(segment, importPath))\n return `${relativePrefix}${segments.join('/')}`\n }\n\n if (importPath.startsWith('@')) {\n // Scoped npm package: @scope/name[/subpath]\n const firstSlash = importPath.indexOf('/')\n if (firstSlash < 2) {\n throw new Error(`Unsafe generated module specifier prefix: ${importPath}`)\n }\n const scope = importPath.slice(1, firstSlash)\n sanitizeNpmPackageNameSegment(scope, importPath)\n const rest = importPath.slice(firstSlash + 1)\n if (!rest) {\n throw new Error(`Unsafe generated module specifier: ${importPath}`)\n }\n const secondSlash = rest.indexOf('/')\n const name = secondSlash >= 0 ? rest.slice(0, secondSlash) : rest\n sanitizeNpmPackageNameSegment(name, importPath)\n const subpath = secondSlash >= 0 ? rest.slice(secondSlash + 1) : ''\n if (!subpath) {\n return `@${scope}/${name}`\n }\n const segments = subpath\n .split('/')\n .map((segment) => sanitizeGeneratedModuleSpecifierSegment(segment, importPath))\n return `@${scope}/${name}/${segments.join('/')}`\n }\n\n // Bare npm package: name[/subpath]\n const firstSlash = importPath.indexOf('/')\n const name = firstSlash >= 0 ? importPath.slice(0, firstSlash) : importPath\n sanitizeNpmPackageNameSegment(name, importPath)\n const subpath = firstSlash >= 0 ? importPath.slice(firstSlash + 1) : ''\n if (!subpath) {\n return name\n }\n const segments = subpath\n .split('/')\n .map((segment) => sanitizeGeneratedModuleSpecifierSegment(segment, importPath))\n return `${name}/${segments.join('/')}`\n}\n\n// Defense in depth: when src/modules.ts registers a module from a third-party\n// npm scope (anything outside @app / @open-mercato/*), verify the resolved\n// pkgBase directory exists. If it doesn't, the package referenced via `from:`\n// is almost certainly not an Open Mercato module (or the id is wrong), and\n// silently emitting an empty module registration would hide the misconfig.\nfunction verifyThirdPartyModuleShape(entry: { id: string; from?: string }, pkgBase: string): void {\n const from = entry.from\n if (!from || from === '@app' || from.startsWith('@open-mercato/')) return\n if (fs.existsSync(pkgBase)) return\n throw new Error(\n `Module '${entry.id}' is registered with from: '${from}' but no Open Mercato module shape was found at '${pkgBase}'. ` +\n `Ensure the package ships a 'modules/${entry.id}' subtree (either under 'dist/modules/' or 'src/modules/'), or correct the 'from' value in src/modules.ts.`,\n )\n}\n\nfunction buildImportStatement(importClause: string, importPath: string): string {\n return `import ${importClause} from ${toLiteral(sanitizeGeneratedModuleSpecifier(importPath))}`\n}\n\nfunction buildBareImportStatement(importPath: string): string {\n return `import ${toLiteral(sanitizeGeneratedModuleSpecifier(importPath))}`\n}\n\nfunction buildDynamicImportExpression(importPath: string): string {\n return `import(${toLiteral(sanitizeGeneratedModuleSpecifier(importPath))})`\n}\n\nconst COMMAND_SCAN_CONFIG = {\n folder: 'commands',\n include: (name: string) =>\n ['.ts', '.js', '.tsx', '.jsx'].some((extension) => name.endsWith(extension)) &&\n !name.endsWith('.d.ts') &&\n !/\\.(test|spec)\\.[jt]sx?$/.test(name) &&\n stripModuleCodeExtension(name) !== 'index',\n sort: (a: string, b: string) => a.localeCompare(b),\n}\n\nfunction getStaticStringExpression(\n expr: ts.Expression,\n stringConstants: Map<string, string> = new Map(),\n): string | null {\n const unwrapped = unwrapExpression(expr)\n if (ts.isStringLiteral(unwrapped) || ts.isNoSubstitutionTemplateLiteral(unwrapped)) return unwrapped.text\n if (ts.isIdentifier(unwrapped)) {\n const direct = stringConstants.get(unwrapped.text)\n if (direct) return direct\n }\n return null\n}\n\nfunction getPropertyNameText(name: ts.PropertyName): string | null {\n if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNumericLiteral(name)) return name.text\n return null\n}\n\nfunction getObjectStringProperty(\n object: ts.ObjectLiteralExpression,\n propertyName: string,\n stringConstants: Map<string, string> = new Map(),\n): string | null {\n for (const property of object.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const name = getPropertyNameText(property.name)\n if (name !== propertyName) continue\n return getStaticStringExpression(property.initializer, stringConstants)\n }\n return null\n}\n\nfunction collectStringArrayElements(expr: ts.Expression, stringConstants: Map<string, string> = new Map()): string[] {\n const unwrapped = unwrapExpression(expr)\n if (!ts.isArrayLiteralExpression(unwrapped)) return []\n const values: string[] = []\n for (const element of unwrapped.elements) {\n const value = getStaticStringExpression(element, stringConstants)\n if (value) values.push(value)\n }\n return values\n}\n\nexport function extractCommandIdsFromSource(sourcePath: string): string[] {\n const sourceText = fs.readFileSync(sourcePath, 'utf8')\n const sourceFile = ts.createSourceFile(sourcePath, sourceText, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX)\n const ids = new Set<string>()\n const stringConstants = new Map<string, string>()\n const variableCommandIds = new Map<string, string>()\n\n const collectVariables = (node: ts.Node): void => {\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer) {\n const stringValue = getStaticStringExpression(node.initializer, stringConstants)\n if (stringValue) {\n stringConstants.set(node.name.text, stringValue)\n }\n if (ts.isObjectLiteralExpression(node.initializer)) {\n const id = getObjectStringProperty(node.initializer, 'id', stringConstants)\n if (id) variableCommandIds.set(node.name.text, id)\n } else if (node.name.text === 'commandIds') {\n for (const id of collectStringArrayElements(node.initializer, stringConstants)) ids.add(id)\n }\n }\n ts.forEachChild(node, collectVariables)\n }\n\n const collectRegistrations = (node: ts.Node): void => {\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n const callName = node.expression.text\n const firstArg = node.arguments[0]\n if (callName === 'registerCommand' && firstArg) {\n if (ts.isIdentifier(firstArg)) {\n const id = variableCommandIds.get(firstArg.text)\n if (id) ids.add(id)\n } else if (ts.isObjectLiteralExpression(firstArg)) {\n const id = getObjectStringProperty(firstArg, 'id', stringConstants)\n if (id) ids.add(id)\n }\n }\n if (callName === 'registerDictionaryEntryCommands' && firstArg && ts.isObjectLiteralExpression(firstArg)) {\n const prefix = getObjectStringProperty(firstArg, 'commandPrefix', stringConstants)\n if (prefix) {\n ids.add(`${prefix}.create`)\n ids.add(`${prefix}.update`)\n ids.add(`${prefix}.delete`)\n }\n }\n }\n ts.forEachChild(node, collectRegistrations)\n }\n\n collectVariables(sourceFile)\n collectRegistrations(sourceFile)\n return Array.from(ids).sort((a, b) => a.localeCompare(b))\n}\n\nfunction collectCommandLoaderEntries(\n roots: ModuleRoots,\n imps: ModuleImports,\n modId: string,\n quiet = false,\n): CommandLoaderGenerationEntry[] {\n const files = scanModuleDir(roots, COMMAND_SCAN_CONFIG)\n const entries: CommandLoaderGenerationEntry[] = []\n for (const file of files) {\n const relPath = `commands/${file.relPath}`\n const resolved = resolveModuleFile(roots, imps, relPath)\n if (!resolved) continue\n const logicalKey = stripModuleCodeExtension(file.relPath)\n const basename = path.basename(logicalKey)\n if (basename === 'shared' || basename === 'factory') continue\n const ids = extractCommandIdsFromSource(resolved.absolutePath)\n if (ids.length > 0) warnIfRegisterCommandNotAtImportTime(resolved.absolutePath, quiet)\n entries.push({\n moduleId: modId,\n key: `${modId}:commands:${logicalKey}`,\n importPath: resolved.importPath,\n ids,\n })\n }\n return entries\n}\n\nexport function renderCommandLoadersFile(entries: CommandLoaderGenerationEntry[]): string {\n const seenCommandIds = new Map<string, string>()\n const loaderEntries: WriterFunction[] = []\n\n for (const entry of entries) {\n const loadValue = arrowFunction({\n body: importExpression(sanitizeGeneratedModuleSpecifier(entry.importPath)),\n })\n for (const id of entry.ids) {\n const previous = seenCommandIds.get(id)\n if (previous && previous !== entry.key) {\n throw new Error(`[generate] Duplicate command id \"${id}\" discovered in \"${previous}\" and \"${entry.key}\"`)\n }\n seenCommandIds.set(id, entry.key)\n loaderEntries.push(objectLiteral([\n { name: 'moduleId', value: entry.moduleId },\n { name: 'id', value: id },\n { name: 'key', value: entry.key },\n { name: 'load', value: loadValue },\n ]))\n }\n loaderEntries.push(objectLiteral([\n { name: 'moduleId', value: entry.moduleId },\n { name: 'key', value: entry.key },\n { name: 'load', value: loadValue },\n ]))\n }\n\n const sourceFile = createGeneratedSourceFile('command-loaders.generated.ts')\n addAutoGeneratedComment(sourceFile, 'command-loaders')\n\n addImportSpec(sourceFile, {\n moduleSpecifier: '@open-mercato/shared/lib/commands',\n isTypeOnly: true,\n namedImports: [{ name: 'CommandLoader' }],\n })\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'commandLoaderEntries',\n type: 'CommandLoader[]',\n initializer: arrayLiteral(loaderEntries, writeValue),\n },\n ],\n })\n sourceFile.addExportAssignment({\n isExportEquals: false,\n expression: 'commandLoaderEntries',\n })\n\n return getSourceText(sourceFile)\n}\n\nexport function renderBootstrapRegistrationsFile(options: {\n entryImports: string[]\n registrationImports: string[]\n calls: string[]\n}): string {\n const uniqueImports = [...new Set([...options.entryImports, ...options.registrationImports])]\n\n const sourceFile = createGeneratedSourceFile('bootstrap-registrations.generated.ts')\n addAutoGeneratedComment(sourceFile, 'registry')\n addImportStatements(sourceFile, uniqueImports)\n\n sourceFile.addFunction({\n name: 'runBootstrapRegistrations',\n isExported: true,\n returnType: 'void',\n statements: options.calls,\n })\n\n return getSourceText(sourceFile)\n}\n\nfunction serializeGeneratedImport(statement: GeneratedImportStatement): string {\n if (typeof statement === 'string') {\n return statement\n }\n\n const moduleSpecifier = statement.moduleSpecifier ?? ''\n const clauses: string[] = []\n\n if (statement.defaultImport) {\n clauses.push(statement.defaultImport)\n }\n\n if (statement.namespaceImport) {\n clauses.push(`* as ${statement.namespaceImport}`)\n }\n\n if (statement.namedImports && statement.namedImports.length > 0) {\n const namedImports = statement.namedImports.map((namedImport) => {\n if (typeof namedImport === 'string') {\n return namedImport\n }\n const prefix = namedImport.isTypeOnly ? 'type ' : ''\n const alias = namedImport.alias ? ` as ${namedImport.alias}` : ''\n return `${prefix}${namedImport.name}${alias}`\n })\n clauses.push(`{ ${namedImports.join(', ')} }`)\n }\n\n const typePrefix = statement.isTypeOnly ? 'type ' : ''\n if (clauses.length === 0) {\n return `import ${toLiteral(moduleSpecifier)}`\n }\n\n return `import ${typePrefix}${clauses.join(', ')} from ${toLiteral(moduleSpecifier)}`\n}\n\nfunction findExistingModuleFile(baseDir: string, relativePath: string): string | null {\n const directPath = path.join(baseDir, relativePath)\n if (fs.existsSync(directPath)) return directPath\n\n const stripped = stripModuleCodeExtension(relativePath)\n for (const extension of MODULE_CODE_EXTENSIONS) {\n const candidate = path.join(baseDir, `${stripped}${extension}`)\n if (fs.existsSync(candidate)) return candidate\n }\n\n return null\n}\n\nfunction findExistingModuleFileByBaseNames(baseDir: string, relativeBaseNames: string[]): string | null {\n for (const relativeBaseName of relativeBaseNames) {\n const resolved = findExistingModuleFile(baseDir, relativeBaseName)\n if (resolved) return resolved\n }\n return null\n}\n\nconst warnedConventionPaths = new Set<string>()\n\n/**\n * Clears the once-per-path warning ledger.\n *\n * A single `yarn generate` runs three registry emitters over one discovery, and each of them\n * walks the same frontend and backend page files, so an unguarded warning would print the\n * same line up to six times. A diagnostic that repeats is a diagnostic that gets skimmed\n * past, so each offending path is named once per run and the ledger resets when the run's\n * discovery is built.\n */\nexport function resetConventionWarnings(): void {\n warnedConventionPaths.clear()\n}\n\nfunction alreadyWarned(sourcePath: string): boolean {\n if (warnedConventionPaths.has(sourcePath)) return true\n warnedConventionPaths.add(sourcePath)\n return false\n}\n\n/**\n * Warns when a discovered page metadata file exports no `metadata` binding.\n *\n * Both page-route emitters read `<module>.metadata` off the imported file. When the author\n * named the export something else \u2014 `meta` is the common near-miss \u2014 that read yields\n * `undefined`, the route still generates, and every declaration in the file is dropped.\n * `requireAuth` and `requireFeatures` are among them, so the page ships with no\n * authorization gate and nothing in the build says so. The warning names that consequence\n * because the rule alone (\"export `metadata`\") does not convey why it matters.\n */\nexport function warnIfPageMetaMissingMetadataExport(metaPath: string | null, quiet = false): void {\n if (!metaPath || quiet) return\n if (hasNamedExport(metaPath, 'metadata')) return\n if (alreadyWarned(metaPath)) return\n console.warn(\n `[generate] \u26A0 Page metadata file exports no 'metadata' \u2014 page metadata is dropped, `\n + `including requireAuth/requireFeatures, so the page renders with NO authorization gate: ${metaPath}`,\n )\n}\n\n/**\n * Warns when a `commands/*.ts` file registers commands only from inside a function.\n *\n * Command discovery extracts ids statically and emits a lazy loader per file; the loader\n * resolves a command by importing that file and relying on `registerCommand(...)` running as\n * an import-time side effect. When every call sits inside a function body that nothing\n * invokes, the ids still appear in the generated manifest but the handlers never register,\n * so the command bus reports the command as unknown at runtime.\n *\n * Heuristic and deliberately conservative: it only fires when the file contains at least one\n * `registerCommand(` call and none of them is at top level (column 0), which is how every\n * correct module writes them.\n */\nexport function warnIfRegisterCommandNotAtImportTime(sourcePath: string, quiet = false): void {\n if (quiet) return\n let source = ''\n try {\n source = fs.readFileSync(sourcePath, 'utf8')\n } catch {\n return\n }\n if (!/\\bregisterCommand\\s*\\(/.test(source)) return\n const hasTopLevelCall = /^registerCommand\\s*\\(/m.test(source)\n if (hasTopLevelCall) return\n if (alreadyWarned(sourcePath)) return\n console.warn(\n `[generate] \u26A0 registerCommand(...) is never called at import time \u2014 these command ids will `\n + `appear in the manifest but the handlers will not register at runtime: ${sourcePath}`,\n )\n}\n\nfunction toModuleImportSubpath(filePath: string, baseDir: string): string {\n const relativePath = path.relative(baseDir, filePath).replace(/\\\\/g, '/')\n return stripModuleCodeExtension(relativePath)\n}\n\nfunction normalizeApiMethodMetadata(raw: unknown): RuntimeApiMethodMetadata | null {\n if (!raw || typeof raw !== 'object') return null\n const source = raw as Record<string, unknown>\n const normalized: RuntimeApiMethodMetadata = {}\n\n if (typeof source.requireAuth === 'boolean') {\n normalized.requireAuth = source.requireAuth\n }\n if (Array.isArray(source.requireRoles)) {\n normalized.requireRoles = source.requireRoles.filter((role): role is string => typeof role === 'string' && role.length > 0)\n }\n if (Array.isArray(source.requireFeatures)) {\n normalized.requireFeatures = source.requireFeatures.filter((feature): feature is string => typeof feature === 'string' && feature.length > 0)\n }\n if (source.rateLimit && typeof source.rateLimit === 'object') {\n const rateLimit = source.rateLimit as Record<string, unknown>\n if (typeof rateLimit.points === 'number' && typeof rateLimit.duration === 'number') {\n normalized.rateLimit = {\n points: rateLimit.points,\n duration: rateLimit.duration,\n blockDuration: typeof rateLimit.blockDuration === 'number' ? rateLimit.blockDuration : undefined,\n keyPrefix: typeof rateLimit.keyPrefix === 'string' ? rateLimit.keyPrefix : undefined,\n }\n }\n }\n\n return Object.keys(normalized).length > 0 ? normalized : null\n}\n\nfunction buildApiMetadataLiteral(metadata: unknown, method?: HttpMethod): string {\n if (!metadata || typeof metadata !== 'object') return 'undefined'\n const source = metadata as Record<string, unknown>\n const methods: HttpMethod[] = method ? [method] : ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']\n const normalized: Partial<Record<HttpMethod, RuntimeApiMethodMetadata>> = {}\n\n for (const entryMethod of methods) {\n const candidate = method ? source : source[entryMethod]\n const value = normalizeApiMethodMetadata(candidate)\n if (value) {\n normalized[entryMethod] = value\n }\n }\n\n return Object.keys(normalized).length > 0 ? toLiteral(normalized) : 'undefined'\n}\n\nfunction resolveApiPathFromMetadata(metadata: unknown, fallbackPath: string): string {\n if (!metadata || typeof metadata !== 'object') return fallbackPath\n const candidate = (metadata as Record<string, unknown>).path\n return typeof candidate === 'string' && candidate.length > 0 ? candidate : fallbackPath\n}\n\nfunction detectExportedHttpMethods(sourceFile: string): HttpMethod[] {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return []\n }\n\n const knownMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'] as HttpMethod[]\n const exportedMethods = new Set<HttpMethod>()\n const collectKnownMethods = (rawSpecifiers: string[], opts?: { useExportedAlias?: boolean; useDestructuredProperty?: boolean }) => {\n for (const specifier of rawSpecifiers) {\n const trimmed = specifier.trim()\n if (!trimmed) continue\n\n let candidate = trimmed\n if (opts?.useExportedAlias) {\n candidate = trimmed.split(/\\s+as\\s+/i).pop()?.trim() ?? trimmed\n }\n if (opts?.useDestructuredProperty) {\n candidate = trimmed.split(':')[0]?.trim() ?? trimmed\n }\n\n if (knownMethods.includes(candidate as HttpMethod)) {\n exportedMethods.add(candidate as HttpMethod)\n }\n }\n }\n\n for (const method of knownMethods) {\n const pattern = new RegExp(`export\\\\s+(?:async\\\\s+)?function\\\\s+${method}\\\\b|export\\\\s+(?:const|let|var)\\\\s+${method}\\\\b`)\n if (pattern.test(source)) {\n exportedMethods.add(method)\n }\n }\n\n const reExportPattern = /export\\s*{([^}]+)}/g\n for (const match of source.matchAll(reExportPattern)) {\n const exportBlock = match[1] ?? ''\n collectKnownMethods(\n exportBlock\n .split(',')\n .map((part) => part.trim())\n .filter((part) => part.length > 0),\n { useExportedAlias: true },\n )\n }\n\n const destructuredExportPattern = /export\\s+(?:const|let|var)\\s*{([^}]+)}/g\n for (const match of source.matchAll(destructuredExportPattern)) {\n const exportBlock = match[1] ?? ''\n collectKnownMethods(\n exportBlock\n .split(',')\n .map((part) => part.trim())\n .filter((part) => part.length > 0),\n { useDestructuredProperty: true },\n )\n }\n\n return knownMethods.filter((method) => exportedMethods.has(method))\n}\n\nfunction buildPageRouteProps(metaExpr: string, routePath: string): string {\n return `pattern: ${toLiteral(routePath || '/')}, requireAuth: (${metaExpr})?.requireAuth, requireRoles: (${metaExpr})?.requireRoles, requireFeatures: (${metaExpr})?.requireFeatures, requireCustomerAuth: (${metaExpr})?.requireCustomerAuth, requireCustomerFeatures: (${metaExpr})?.requireCustomerFeatures, nav: (${metaExpr})?.nav, title: (${metaExpr})?.pageTitle ?? (${metaExpr})?.title, titleKey: (${metaExpr})?.pageTitleKey ?? (${metaExpr})?.titleKey, group: (${metaExpr})?.pageGroup ?? (${metaExpr})?.group, groupKey: (${metaExpr})?.pageGroupKey ?? (${metaExpr})?.groupKey, icon: (${metaExpr})?.icon, order: (${metaExpr})?.pageOrder ?? (${metaExpr})?.order, priority: (${metaExpr})?.pagePriority ?? (${metaExpr})?.priority, navHidden: (${metaExpr})?.navHidden, visible: (${metaExpr})?.visible, enabled: (${metaExpr})?.enabled, breadcrumb: (${metaExpr})?.breadcrumb, pageContext: (${metaExpr})?.pageContext, placement: (${metaExpr})?.placement`\n}\n\nfunction buildPageRouteManifestSpread(metaExpr: string, routePath: string): WriterFunction {\n return callExpression(identifier('resolvePageRouteMetadata'), [routePath || '/', identifier(metaExpr)])\n}\n\nfunction buildManifestRouteLoader(importPath: string): WriterFunction {\n return arrowFunction({\n async: true,\n body: block((writer) => {\n writeStatements(writer, [\n variableStatement({\n name: 'mod',\n initializer: awaitExpression(importExpression(sanitizeGeneratedModuleSpecifier(importPath))),\n }),\n returnStatement(\n asExpression(\n parenthesized(nullishCoalesce([\n propertyAccess(identifier('mod'), 'default'),\n identifier('mod'),\n ])),\n 'any',\n ),\n ),\n ])\n }),\n })\n}\n\nfunction buildManifestApiLoader(importPath: string): WriterFunction {\n return arrowFunction({\n async: true,\n body: importExpression(sanitizeGeneratedModuleSpecifier(importPath)),\n })\n}\n\nfunction normalizeBreadcrumb(raw: unknown): SerializablePageMetadata['breadcrumb'] {\n if (!Array.isArray(raw)) return undefined\n const breadcrumb = raw\n .map((entry) => {\n if (!entry || typeof entry !== 'object') return null\n const source = entry as Record<string, unknown>\n if (typeof source.label !== 'string') return null\n return {\n label: source.label,\n labelKey: typeof source.labelKey === 'string' ? source.labelKey : undefined,\n href: typeof source.href === 'string' ? source.href : undefined,\n }\n })\n .filter((entry): entry is NonNullable<typeof entry> => entry !== null)\n return breadcrumb.length > 0 ? breadcrumb : undefined\n}\n\nfunction normalizePlacement(raw: unknown): SerializablePageMetadata['placement'] {\n if (!raw || typeof raw !== 'object') return undefined\n const source = raw as Record<string, unknown>\n if (typeof source.section !== 'string' || source.section.length === 0) return undefined\n return {\n section: source.section,\n sectionLabel: typeof source.sectionLabel === 'string' ? source.sectionLabel : undefined,\n sectionLabelKey: typeof source.sectionLabelKey === 'string' ? source.sectionLabelKey : undefined,\n order: typeof source.order === 'number' ? source.order : undefined,\n }\n}\n\nfunction normalizePortalNav(raw: unknown): SerializablePageMetadata['nav'] {\n if (!raw || typeof raw !== 'object') return undefined\n const source = raw as Record<string, unknown>\n if (typeof source.label !== 'string' || source.label.length === 0) return undefined\n const group = source.group === 'main' || source.group === 'account' ? source.group : undefined\n return {\n label: source.label,\n labelKey: typeof source.labelKey === 'string' ? source.labelKey : undefined,\n group,\n order: typeof source.order === 'number' ? source.order : undefined,\n icon: typeof source.icon === 'string' ? source.icon : undefined,\n }\n}\n\nfunction normalizePageMetadata(raw: unknown): SerializablePageMetadata | null {\n if (!raw || typeof raw !== 'object') return null\n const source = raw as Record<string, unknown>\n const normalized: SerializablePageMetadata = {}\n\n if (typeof source.requireAuth === 'boolean') normalized.requireAuth = source.requireAuth\n if (Array.isArray(source.requireRoles)) normalized.requireRoles = source.requireRoles.filter((role): role is string => typeof role === 'string' && role.length > 0)\n if (Array.isArray(source.requireFeatures)) normalized.requireFeatures = source.requireFeatures.filter((feature): feature is string => typeof feature === 'string' && feature.length > 0)\n if (typeof source.requireCustomerAuth === 'boolean') normalized.requireCustomerAuth = source.requireCustomerAuth\n if (Array.isArray(source.requireCustomerFeatures)) normalized.requireCustomerFeatures = source.requireCustomerFeatures.filter((feature): feature is string => typeof feature === 'string' && feature.length > 0)\n if (typeof source.title === 'string') normalized.title = source.title\n if (typeof source.titleKey === 'string') normalized.titleKey = source.titleKey\n if (typeof source.pageTitle === 'string') normalized.pageTitle = source.pageTitle\n if (typeof source.pageTitleKey === 'string') normalized.pageTitleKey = source.pageTitleKey\n if (typeof source.group === 'string') normalized.group = source.group\n if (typeof source.groupKey === 'string') normalized.groupKey = source.groupKey\n if (typeof source.pageGroup === 'string') normalized.pageGroup = source.pageGroup\n if (typeof source.pageGroupKey === 'string') normalized.pageGroupKey = source.pageGroupKey\n if (typeof source.order === 'number') normalized.order = source.order\n if (typeof source.pageOrder === 'number') normalized.pageOrder = source.pageOrder\n if (typeof source.priority === 'number') normalized.priority = source.priority\n if (typeof source.pagePriority === 'number') normalized.pagePriority = source.pagePriority\n if (typeof source.navHidden === 'boolean') normalized.navHidden = source.navHidden\n if (typeof source.pageContext === 'string' && ['main', 'admin', 'settings', 'profile'].includes(source.pageContext)) {\n normalized.pageContext = source.pageContext as SerializablePageMetadata['pageContext']\n }\n const breadcrumb = normalizeBreadcrumb(source.breadcrumb)\n if (breadcrumb) normalized.breadcrumb = breadcrumb\n const placement = normalizePlacement(source.placement)\n if (placement) normalized.placement = placement\n const nav = normalizePortalNav(source.nav)\n if (nav) normalized.nav = nav\n if (typeof source.icon === 'string') normalized.icon = source.icon\n\n return Object.keys(normalized).length > 0 ? normalized : null\n}\n\nfunction requiresRuntimePageMetadata(raw: unknown): boolean {\n if (!raw || typeof raw !== 'object') return false\n const source = raw as Record<string, unknown>\n if (typeof source.visible === 'function' || typeof source.enabled === 'function') {\n return true\n }\n return source.icon != null && typeof source.icon !== 'string'\n}\n\nfunction normalizeSubscriberMetadata(raw: unknown): SerializableSubscriberMetadata | null {\n if (!raw || typeof raw !== 'object') return null\n const source = raw as Record<string, unknown>\n const normalized: SerializableSubscriberMetadata = {}\n if (typeof source.id === 'string' && source.id.length > 0) normalized.id = source.id\n if (typeof source.event === 'string' && source.event.length > 0) normalized.event = source.event\n if (typeof source.persistent === 'boolean') normalized.persistent = source.persistent\n if (typeof source.sync === 'boolean') normalized.sync = source.sync\n if (typeof source.priority === 'number') normalized.priority = source.priority\n return Object.keys(normalized).length > 0 ? normalized : null\n}\n\nfunction normalizeWorkerMetadata(raw: unknown): SerializableWorkerMetadata | null {\n if (!raw || typeof raw !== 'object') return null\n const source = raw as Record<string, unknown>\n const normalized: SerializableWorkerMetadata = {}\n if (typeof source.id === 'string' && source.id.length > 0) normalized.id = source.id\n if (typeof source.queue === 'string' && source.queue.length > 0) normalized.queue = source.queue\n if (typeof source.concurrency === 'number') normalized.concurrency = source.concurrency\n if (typeof source.lockDuration === 'number') normalized.lockDuration = source.lockDuration\n if (typeof source.maxStalledCount === 'number') normalized.maxStalledCount = source.maxStalledCount\n if (typeof source.onJobAbandoned === 'function') normalized.hasJobAbandonedHook = true\n if (source.schedulerSafe === true) normalized.schedulerSafe = true\n if (Array.isArray(source.schedulerRequiredFeatures)) {\n const features = source.schedulerRequiredFeatures.filter(\n (feature): feature is string => typeof feature === 'string' && feature.length > 0,\n )\n if (features.length > 0) normalized.schedulerRequiredFeatures = features\n }\n return Object.keys(normalized).length > 0 ? normalized : null\n}\n\nasync function loadSubscriberMetadata(sourceFile: string): Promise<SerializableSubscriberMetadata | null> {\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(sourceFile)\n return normalizeSubscriberMetadata(sourceModule?.metadata)\n ?? normalizeSubscriberMetadata(extractNamedObjectLiteralExport(sourceFile, 'metadata'))\n}\n\nasync function loadWorkerMetadata(sourceFile: string): Promise<SerializableWorkerMetadata | null> {\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(sourceFile)\n const metadata = normalizeWorkerMetadata(sourceModule?.metadata)\n ?? normalizeWorkerMetadata(extractNamedObjectLiteralExport(sourceFile, 'metadata'))\n if (!metadata) return null\n // Resolved from the syntax, not the extracted value: a worker module that cannot be imported at\n // build time falls back to the literal extractor, which cannot tell an imported function from an\n // unresolvable identifier. Missing this is silent \u2014 the hook is simply never installed.\n if (!metadata.hasJobAbandonedHook && namedObjectLiteralDeclaresProperty(sourceFile, 'metadata', 'onJobAbandoned')) {\n metadata.hasJobAbandonedHook = true\n }\n return metadata\n}\n\nasync function discoverSubscribers(\n roots: ModuleRoots,\n imps: ModuleImports,\n modId: string,\n): Promise<DiscoveredSubscriber[]> {\n const subscribers: DiscoveredSubscriber[] = []\n for (const { relPath } of scanModuleDir(roots, SCAN_CONFIGS.subscribers)) {\n const resolved = resolveModuleFile(\n roots,\n imps,\n path.posix.join('subscribers', relPath.replace(/\\\\/g, '/')),\n )\n if (!resolved) continue\n const segs = relPath.split('/')\n const file = segs.pop()!\n const name = stripModuleCodeExtension(file)\n subscribers.push({\n id: [modId, ...segs, name].filter(Boolean).join(':'),\n importPath: sanitizeGeneratedModuleSpecifier(resolved.importPath),\n metadata: await loadSubscriberMetadata(resolved.absolutePath),\n })\n }\n return subscribers\n}\n\nasync function discoverWorkers(\n roots: ModuleRoots,\n imps: ModuleImports,\n modId: string,\n): Promise<DiscoveredWorker[]> {\n const workers: DiscoveredWorker[] = []\n for (const { relPath } of scanModuleDir(roots, SCAN_CONFIGS.workers)) {\n const resolved = resolveModuleFile(\n roots,\n imps,\n path.posix.join('workers', relPath.replace(/\\\\/g, '/')),\n )\n if (!resolved) continue\n const metadata = await loadWorkerMetadata(resolved.absolutePath)\n if (!metadata?.queue) continue\n const segs = relPath.split('/')\n const file = segs.pop()!\n const name = stripModuleCodeExtension(file)\n workers.push({\n id: [modId, 'workers', ...segs, name].filter(Boolean).join(':'),\n importPath: sanitizeGeneratedModuleSpecifier(resolved.importPath),\n metadata,\n })\n }\n return workers\n}\n\nfunction discoverTranslations(roots: ModuleRoots): DiscoveredTranslation[] {\n const i18nApp = path.join(roots.appBase, 'i18n')\n const pkgI18nBase = resolveStandaloneSourceMirrorBase(roots.pkgBase) ?? roots.pkgBase\n const i18nCore = path.join(pkgI18nBase, 'i18n')\n const locales = new Set<string>()\n if (fs.existsSync(i18nCore)) {\n for (const entry of fs.readdirSync(i18nCore, { withFileTypes: true })) {\n if (entry.isFile() && /^[a-zA-Z0-9][a-zA-Z0-9_-]*\\.json$/.test(entry.name)) {\n locales.add(entry.name.replace(/\\.json$/, ''))\n }\n }\n }\n if (fs.existsSync(i18nApp)) {\n for (const entry of fs.readdirSync(i18nApp, { withFileTypes: true })) {\n if (entry.isFile() && /^[a-zA-Z0-9][a-zA-Z0-9_-]*\\.json$/.test(entry.name)) {\n locales.add(entry.name.replace(/\\.json$/, ''))\n }\n }\n }\n return Array.from(locales, (locale) => ({\n locale,\n coreHas: fs.existsSync(path.join(i18nCore, `${locale}.json`)),\n appHas: fs.existsSync(path.join(i18nApp, `${locale}.json`)),\n }))\n}\n\nasync function createModuleRegistryDiscovery(\n resolver: PackageResolver,\n quiet = false,\n): Promise<ModuleRegistryDiscovery> {\n resetConventionWarnings()\n const enabled = resolver.loadEnabledModules()\n const modules: ModuleRegistryDiscoveryEntry[] = []\n const trackedRoots = new Set<string>()\n\n for (const entry of enabled) {\n const modId = entry.id\n const roots = resolver.getModulePaths(entry)\n verifyThirdPartyModuleShape(entry, roots.pkgBase)\n const rawImps = resolver.getModuleImportBase(entry)\n const appImportBase = entry.from === '@app' ? `../../src/modules/${modId}` : rawImps.appBase\n const imps: ModuleImports = { appBase: appImportBase, pkgBase: rawImps.pkgBase }\n trackedRoots.add(roots.appBase)\n trackedRoots.add(roots.pkgBase)\n\n let subscribers: Promise<DiscoveredSubscriber[]> | undefined\n let workers: Promise<DiscoveredWorker[]> | undefined\n const resolvedFiles = new Map<string, ResolvedFile | null>()\n const resolve = (relativePath: string): ResolvedFile | null => {\n if (!resolvedFiles.has(relativePath)) {\n resolvedFiles.set(relativePath, resolveModuleFile(roots, imps, relativePath))\n }\n return resolvedFiles.get(relativePath) ?? null\n }\n modules.push({\n modId,\n roots,\n imps,\n appImportBase,\n isAppModule: entry.from === '@app',\n resolve,\n frontendFiles: scanModuleDir(roots, SCAN_CONFIGS.frontendPages),\n backendFiles: scanModuleDir(roots, SCAN_CONFIGS.backendPages),\n commandLoaderEntries: collectCommandLoaderEntries(roots, imps, modId, quiet),\n getSubscribers: () => subscribers ??= discoverSubscribers(roots, imps, modId),\n getWorkers: () => workers ??= discoverWorkers(roots, imps, modId),\n translations: discoverTranslations(roots),\n dashboardWidgetEntries: scanDashboardWidgetEntries({\n modId,\n roots,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n }),\n })\n }\n\n let structureChecksum: string | undefined\n return {\n enabled,\n modules,\n getStructureChecksum: () => structureChecksum ??= calculateStructureChecksum(Array.from(trackedRoots)),\n }\n}\n\nasync function loadPageMetadataForManifest(options: {\n sourceFile: string\n metaPath?: string\n runtimeExpr: string\n allowRuntimeFallback?: boolean\n}): Promise<PageMetadataManifestLoadResult> {\n const metadataModule = options.metaPath ?? options.sourceFile\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(metadataModule)\n const runtimeMetadata = sourceModule?.metadata\n\n if (\n options.allowRuntimeFallback\n && (requiresRuntimePageMetadata(runtimeMetadata) || requiresRuntimePageMetadataFromSourceFile(metadataModule))\n ) {\n return {\n manifestExpr: options.runtimeExpr,\n requiresRuntimeImport: true,\n }\n }\n\n const normalized = normalizePageMetadata(runtimeMetadata)\n ?? normalizePageMetadata(extractNamedObjectLiteralExport(metadataModule, 'metadata'))\n\n return {\n manifestExpr: normalized ? `(${toLiteral(normalized)} as any)` : '(undefined as any)',\n requiresRuntimeImport: false,\n }\n}\n\nasync function processPageFiles(options: {\n files: Array<{ relPath: string; fromApp: boolean }>\n type: 'frontend' | 'backend'\n modId: string\n appDir: string\n pkgDir: string\n appImportBase: string\n pkgImportBase: string\n eagerImports: string[]\n runtimeImports: string[]\n manifestImports?: string[]\n importIdRef: { value: number }\n collectRoute?: (registration: { routePath: string; fromApp: boolean }) => void\n quiet?: boolean\n}): Promise<PageRouteGenerationResult> {\n const { files, type, modId, appDir, pkgDir, appImportBase, pkgImportBase, eagerImports, runtimeImports, manifestImports, importIdRef, collectRoute, quiet } = options\n const metaPrefix = type === 'frontend' ? 'M' : 'BM'\n const eagerRoutes: string[] = []\n const runtimeRoutes: string[] = []\n const manifestRoutes: WriterFunction[] = []\n const manifestShardRoutes: RouteManifestShardEntry[] = []\n const metadataRoutes: RouteManifestShardEntry[] = []\n const routePatterns: string[] = []\n\n // Next-style page.* files\n for (const { relPath, fromApp } of files.filter(({ relPath: f }) => isModulePageFile(path.basename(f)))) {\n const segs = relPath.split('/')\n const pageFile = segs.pop()!\n const pageBaseName = stripModuleCodeExtension(pageFile)\n importIdRef.value++\n importIdRef.value++\n const runtimeMetaName = `${metaPrefix}Runtime${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n const sub = segs.length ? `${segs.join('/')}/${pageBaseName}` : pageBaseName\n const importPath = sanitizeGeneratedModuleSpecifier(`${fromApp ? appImportBase : pkgImportBase}/${type}/${sub}`)\n const routePath = type === 'frontend'\n ? '/' + (segs.join('/') || '')\n : '/backend/' + (segs.join('/') || modId)\n const moduleBaseDir = path.join(fromApp ? appDir : pkgDir, ...segs)\n const sourceFile = findExistingModuleFile(moduleBaseDir, pageFile)\n if (!sourceFile || !hasDefaultExport(sourceFile)) continue\n collectRoute?.({ routePath, fromApp })\n const metaPath = findExistingModuleFileByBaseNames(moduleBaseDir, ['page.meta', 'meta'])\n warnIfPageMetaMissingMetadataExport(metaPath, quiet)\n let metaExpr = 'undefined'\n let runtimeMetaExpr = 'undefined'\n let manifestMetaExpr = 'undefined'\n let manifestImportStatement: string | null = null\n if (metaPath) {\n const metaImportName = `${metaPrefix}${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n const metaImportPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${toModuleImportSubpath(metaPath, fromApp ? appDir : pkgDir)}`\n )\n const manifestMetaImportName = `${metaPrefix}Manifest${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n eagerImports.push(buildImportStatement(`* as ${metaImportName}`, metaImportPath))\n runtimeImports.push(buildImportStatement(`* as ${runtimeMetaName}`, metaImportPath))\n metaExpr = `(${metaImportName}.metadata as any)`\n runtimeMetaExpr = `(((${runtimeMetaName} as any).metadata) as any)`\n const manifestMetadata = await loadPageMetadataForManifest({\n sourceFile: metaPath,\n metaPath,\n runtimeExpr: `(((${manifestMetaImportName} as any).metadata) as any)`,\n allowRuntimeFallback: true,\n })\n manifestMetaExpr = manifestMetadata.manifestExpr\n if (manifestMetadata.requiresRuntimeImport) {\n manifestImportStatement = buildImportStatement(`* as ${manifestMetaImportName}`, metaImportPath)\n }\n } else {\n runtimeMetaExpr = `(((${runtimeMetaName} as any).metadata) as any)`\n const staticMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: '(undefined as any)',\n allowRuntimeFallback: false,\n })\n metaExpr = staticMetadata.manifestExpr\n const manifestMetaImportName = `${metaPrefix}Manifest${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n const manifestMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: `(((${manifestMetaImportName} as any).metadata) as any)`,\n allowRuntimeFallback: true,\n })\n manifestMetaExpr = manifestMetadata.manifestExpr\n if (manifestMetadata.requiresRuntimeImport) {\n manifestImportStatement = buildImportStatement(`* as ${manifestMetaImportName}`, importPath)\n }\n runtimeImports.push(buildImportStatement(`* as ${runtimeMetaName}`, importPath))\n }\n if (manifestImportStatement) {\n manifestImports?.push(manifestImportStatement)\n }\n const baseProps = buildPageRouteProps(metaExpr, routePath)\n const runtimeBaseProps = buildPageRouteProps(runtimeMetaExpr, routePath)\n const manifestBaseProps = buildPageRouteManifestSpread(manifestMetaExpr, routePath)\n eagerRoutes.push(`{ ${baseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`)\n runtimeRoutes.push(`{ ${runtimeBaseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`)\n const metadataEntries: GeneratedObjectEntry[] = [\n { name: 'moduleId', value: modId },\n { kind: 'spread', value: manifestBaseProps },\n ]\n const manifestEntry = objectLiteral([\n ...metadataEntries,\n { name: 'load', value: buildManifestRouteLoader(importPath) },\n ])\n const shardImports = manifestImportStatement ? [manifestImportStatement] : []\n manifestRoutes.push(manifestEntry)\n manifestShardRoutes.push({\n path: routePath,\n declaration: renderGeneratedValue(manifestEntry),\n imports: shardImports,\n })\n metadataRoutes.push({\n path: routePath,\n declaration: renderGeneratedValue(objectLiteral(metadataEntries)),\n imports: shardImports,\n })\n routePatterns.push(routePath)\n }\n\n // Back-compat direct files (old-style pages like login.tsx instead of login/page.tsx)\n for (const { relPath, fromApp } of files.filter(({ relPath: f }) => !isModulePageFile(path.basename(f)))) {\n const segs = relPath.split('/')\n const file = segs.pop()!\n const name = stripModuleCodeExtension(file)\n const routeSegs = [...segs, name].filter(Boolean)\n importIdRef.value++\n importIdRef.value++\n const runtimeMetaName = `${metaPrefix}Runtime${importIdRef.value++}_${toVar(modId)}_${toVar(routeSegs.join('_') || 'index')}`\n const importPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${[...segs, name].join('/')}`\n )\n const routePath = type === 'frontend'\n ? '/' + (routeSegs.join('/') || '')\n : '/backend/' + (segs[0] === modId\n ? [...segs, name].filter(Boolean).join('/')\n : [modId, ...segs, name].filter(Boolean).join('/'))\n const moduleBaseDir = path.join(fromApp ? appDir : pkgDir, ...segs)\n const sourceFile = findExistingModuleFile(moduleBaseDir, file)\n if (!sourceFile || !hasDefaultExport(sourceFile)) continue\n collectRoute?.({ routePath, fromApp })\n const metaPath = findExistingModuleFileByBaseNames(moduleBaseDir, [`${name}.meta`, 'meta'])\n let metaExpr = 'undefined'\n let runtimeMetaExpr = 'undefined'\n let manifestMetaExpr = 'undefined'\n let manifestImportStatement: string | null = null\n if (metaPath) {\n const metaImportName = `${metaPrefix}${importIdRef.value++}_${toVar(modId)}_${toVar(routeSegs.join('_') || 'index')}`\n const metaBase = path.basename(metaPath)\n const metaImportSub = stripModuleCodeExtension(metaBase) === 'meta' ? 'meta' : `${name}.meta`\n const metaImportPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${[...segs, metaImportSub].join('/')}`\n )\n const manifestMetaImportName = `${metaPrefix}Manifest${importIdRef.value++}_${toVar(modId)}_${toVar(routeSegs.join('_') || 'index')}`\n eagerImports.push(buildImportStatement(`* as ${metaImportName}`, metaImportPath))\n runtimeImports.push(buildImportStatement(`* as ${runtimeMetaName}`, metaImportPath))\n metaExpr = type === 'frontend' ? `(${metaImportName}.metadata as any)` : `${metaImportName}.metadata`\n runtimeMetaExpr = `(((${runtimeMetaName} as any).metadata) as any)`\n const manifestMetadata = await loadPageMetadataForManifest({\n sourceFile: metaPath,\n metaPath,\n runtimeExpr: `(((${manifestMetaImportName} as any).metadata) as any)`,\n allowRuntimeFallback: false,\n })\n manifestMetaExpr = manifestMetadata.manifestExpr\n if (manifestMetadata.requiresRuntimeImport) {\n manifestImportStatement = buildImportStatement(`* as ${manifestMetaImportName}`, metaImportPath)\n }\n } else {\n runtimeMetaExpr = `(((${runtimeMetaName} as any).metadata) as any)`\n const staticMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: '(undefined as any)',\n allowRuntimeFallback: false,\n })\n metaExpr = staticMetadata.manifestExpr\n const manifestMetaImportName = `${metaPrefix}Manifest${importIdRef.value++}_${toVar(modId)}_${toVar(routeSegs.join('_') || 'index')}`\n const manifestMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: `(((${manifestMetaImportName} as any).metadata) as any)`,\n allowRuntimeFallback: false,\n })\n manifestMetaExpr = manifestMetadata.manifestExpr\n if (manifestMetadata.requiresRuntimeImport) {\n manifestImportStatement = buildImportStatement(`* as ${manifestMetaImportName}`, importPath)\n }\n runtimeImports.push(buildImportStatement(`* as ${runtimeMetaName}`, importPath))\n }\n if (manifestImportStatement) {\n manifestImports?.push(manifestImportStatement)\n }\n const baseProps = buildPageRouteProps(metaExpr, routePath)\n const runtimeBaseProps = buildPageRouteProps(runtimeMetaExpr, routePath)\n const manifestBaseProps = buildPageRouteManifestSpread(manifestMetaExpr, routePath)\n eagerRoutes.push(`{ ${baseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`)\n runtimeRoutes.push(`{ ${runtimeBaseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`)\n const metadataEntries: GeneratedObjectEntry[] = [\n { name: 'moduleId', value: modId },\n { kind: 'spread', value: manifestBaseProps },\n ]\n const manifestEntry = objectLiteral([\n ...metadataEntries,\n { name: 'load', value: buildManifestRouteLoader(importPath) },\n ])\n const shardImports = manifestImportStatement ? [manifestImportStatement] : []\n manifestRoutes.push(manifestEntry)\n manifestShardRoutes.push({\n path: routePath,\n declaration: renderGeneratedValue(manifestEntry),\n imports: shardImports,\n })\n metadataRoutes.push({\n path: routePath,\n declaration: renderGeneratedValue(objectLiteral(metadataEntries)),\n imports: shardImports,\n })\n routePatterns.push(routePath)\n }\n\n return {\n eagerRoutes,\n runtimeRoutes,\n manifestRoutes,\n manifestShardRoutes,\n metadataRoutes,\n routePatterns,\n }\n}\n\nasync function processApiRoutes(options: {\n roots: ModuleRoots\n modId: string\n appImportBase: string\n pkgImportBase: string\n eagerImports: string[]\n importIdRef: { value: number }\n}): Promise<ApiRouteGenerationResult> {\n const { roots, modId, appImportBase, pkgImportBase, eagerImports, importIdRef } = options\n const apiApp = path.join(roots.appBase, 'api')\n const apiPkg = path.join(roots.pkgBase, 'api')\n if (!fs.existsSync(apiApp) && !fs.existsSync(apiPkg)) {\n return { eagerApis: [], runtimeApis: [], manifestApis: [], manifestShardApis: [], metadataApis: [] }\n }\n\n const eagerApis: string[] = []\n const runtimeApis: string[] = []\n const manifestApis: WriterFunction[] = []\n const manifestShardApis: RouteManifestShardEntry[] = []\n const metadataApis: RouteManifestShardEntry[] = []\n\n // route.* aggregations\n const routeFiles = scanModuleDir(roots, SCAN_CONFIGS.apiRoutes)\n for (const { relPath, fromApp } of routeFiles) {\n const segs = relPath.split('/')\n const routeFile = segs.pop()!\n const reqSegs = [modId, ...segs]\n const importName = `R${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n const sourceDir = fromApp ? apiApp : apiPkg\n const sourceFile = findExistingModuleFile(path.join(sourceDir, ...segs), routeFile)\n if (!sourceFile) continue\n const apiSegPath = segs.join('/')\n const importPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/api${apiSegPath ? `/${apiSegPath}` : ''}/${stripModuleCodeExtension(routeFile)}`\n )\n const routePath = '/' + reqSegs.filter(Boolean).join('/')\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(sourceFile)\n const metadata = sourceModule?.metadata ?? extractNamedObjectLiteralExport(sourceFile, 'metadata')\n const resolvedPath = resolveApiPathFromMetadata(metadata, routePath)\n const exportedMethods = detectExportedHttpMethods(sourceFile)\n if (exportedMethods.length === 0) continue\n if (!metadata && !hasNamedExport(sourceFile, 'metadata')) {\n console.warn(`[generate] \u26A0 Route file exports handlers but no metadata \u2014 auth will default to required: ${sourceFile}`)\n }\n const metadataLiteral = buildApiMetadataLiteral(metadata)\n const hasOpenApi = await moduleHasExport(sourceFile, 'openApi')\n const docsPart = hasOpenApi ? `, docs: ((${importName} as any).openApi as any)` : ''\n eagerImports.push(buildImportStatement(`* as ${importName}`, importPath))\n eagerApis.push(`{ path: ((${importName} as any).metadata?.path ?? ${toLiteral(routePath)}), metadata: (${importName} as any).metadata, handlers: ${importName} as any${docsPart} }`)\n runtimeApis.push(`{ path: ${toLiteral(resolvedPath)}, metadata: ${metadataLiteral}, handlers: { ${exportedMethods.map((method) => `${method}: async (req: Request, ctx?: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; return (mod as any).${method}(req, ctx) }`).join(', ')} } }`)\n const metadataEntries: GeneratedObjectEntry[] = [\n { name: 'moduleId', value: modId },\n { name: 'kind', value: 'route-file' },\n { name: 'path', value: resolvedPath },\n { name: 'methods', value: arrayLiteral(exportedMethods, writeValue) },\n ]\n const manifestEntry = objectLiteral([\n ...metadataEntries,\n { name: 'load', value: buildManifestApiLoader(importPath) },\n ])\n manifestApis.push(manifestEntry)\n manifestShardApis.push({ path: resolvedPath, declaration: renderGeneratedValue(manifestEntry) })\n metadataApis.push({ path: resolvedPath, declaration: renderGeneratedValue(objectLiteral(metadataEntries)) })\n }\n\n // Single files (plain scripts, not route.*, not tests, skip method dirs)\n const plainFiles = scanModuleDir(roots, SCAN_CONFIGS.apiPlainFiles)\n for (const { relPath, fromApp } of plainFiles) {\n const segs = relPath.split('/')\n const file = segs.pop()!\n const pathWithoutExt = stripModuleCodeExtension(file)\n const fullSegs = [...segs, pathWithoutExt]\n const routePath = '/' + [modId, ...fullSegs].filter(Boolean).join('/')\n const importName = `R${importIdRef.value++}_${toVar(modId)}_${toVar(fullSegs.join('_') || 'index')}`\n const plainSegPath = fullSegs.join('/')\n const importPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/api${plainSegPath ? `/${plainSegPath}` : ''}`\n )\n const sourceFile = findExistingModuleFile(fromApp ? apiApp : apiPkg, relPath)\n if (!sourceFile) continue\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(sourceFile)\n const metadata = sourceModule?.metadata ?? extractNamedObjectLiteralExport(sourceFile, 'metadata')\n const resolvedPath = resolveApiPathFromMetadata(metadata, routePath)\n const exportedMethods = detectExportedHttpMethods(sourceFile)\n if (exportedMethods.length === 0) continue\n if (!metadata && !hasNamedExport(sourceFile, 'metadata')) {\n console.warn(`[generate] \u26A0 Route file exports handlers but no metadata \u2014 auth will default to required: ${sourceFile}`)\n }\n const metadataLiteral = buildApiMetadataLiteral(metadata)\n const hasOpenApi = await moduleHasExport(sourceFile, 'openApi')\n const docsPart = hasOpenApi ? `, docs: ((${importName} as any).openApi as any)` : ''\n eagerImports.push(buildImportStatement(`* as ${importName}`, importPath))\n eagerApis.push(`{ path: ((${importName} as any).metadata?.path ?? ${toLiteral(routePath)}), metadata: (${importName} as any).metadata, handlers: ${importName} as any${docsPart} }`)\n runtimeApis.push(`{ path: ${toLiteral(resolvedPath)}, metadata: ${metadataLiteral}, handlers: { ${exportedMethods.map((entryMethod) => `${entryMethod}: async (req: Request, ctx?: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; return (mod as any).${entryMethod}(req, ctx) }`).join(', ')} } }`)\n const metadataEntries: GeneratedObjectEntry[] = [\n { name: 'moduleId', value: modId },\n { name: 'kind', value: 'route-file' },\n { name: 'path', value: resolvedPath },\n { name: 'methods', value: arrayLiteral(exportedMethods, writeValue) },\n ]\n const manifestEntry = objectLiteral([\n ...metadataEntries,\n { name: 'load', value: buildManifestApiLoader(importPath) },\n ])\n manifestApis.push(manifestEntry)\n manifestShardApis.push({ path: resolvedPath, declaration: renderGeneratedValue(manifestEntry) })\n metadataApis.push({ path: resolvedPath, declaration: renderGeneratedValue(objectLiteral(metadataEntries)) })\n }\n\n // Legacy per-method\n const methods: HttpMethod[] = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']\n for (const method of methods) {\n const methodDirSegment = path.posix.join('api', method.toLowerCase())\n const methodRoots: ModuleRoots = {\n appBase: path.join(roots.appBase, 'api', method.toLowerCase()),\n pkgBase: path.join(roots.pkgBase, 'api', method.toLowerCase()),\n }\n const methodConfig = {\n folder: '',\n include: (name: string) => ['.ts', '.js'].some((extension) => name.endsWith(extension)) && !/\\.(test|spec)\\.[jt]s$/.test(name),\n }\n const apiFiles = scanModuleDir(methodRoots, methodConfig)\n for (const { relPath } of apiFiles) {\n const resolved = resolveModuleFile(\n roots,\n { appBase: appImportBase, pkgBase: pkgImportBase },\n path.posix.join(methodDirSegment, relPath.replace(/\\\\/g, '/')),\n )\n if (!resolved) continue\n\n const segs = relPath.split('/')\n const file = segs.pop()!\n const pathWithoutExt = stripModuleCodeExtension(file)\n const fullSegs = [...segs, pathWithoutExt]\n const routePath = '/' + [modId, ...fullSegs].filter(Boolean).join('/')\n const importName = `H${importIdRef.value++}_${toVar(modId)}_${toVar(method)}_${toVar(fullSegs.join('_'))}`\n const importPath = sanitizeGeneratedModuleSpecifier(resolved.importPath)\n const metaName = `RM${importIdRef.value++}_${toVar(modId)}_${toVar(method)}_${toVar(fullSegs.join('_'))}`\n const sourceFile = resolved.absolutePath\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(sourceFile)\n const metadata = sourceModule?.metadata ?? extractNamedObjectLiteralExport(sourceFile, 'metadata')\n const resolvedPath = resolveApiPathFromMetadata(metadata, routePath)\n const metadataLiteral = buildApiMetadataLiteral(metadata, method)\n const hasOpenApi = await moduleHasExport(sourceFile, 'openApi')\n const docsPart = hasOpenApi ? `, docs: ((${metaName} as any).openApi as any)` : ''\n eagerImports.push(buildImportStatement(`${importName}, * as ${metaName}`, importPath))\n eagerApis.push(`{ method: ${toLiteral(method)}, path: (${metaName}.metadata?.path ?? ${toLiteral(routePath)}), handler: ${importName}, metadata: ${metaName}.metadata${docsPart} }`)\n runtimeApis.push(`{ method: ${toLiteral(method)}, path: ${toLiteral(resolvedPath)}, handler: async (req: Request, ctx?: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; const handler = ((mod as any).default ?? (mod as any).${method} ?? (mod as any).handler) as any; return handler(req, ctx) }, metadata: ${metadataLiteral} }`)\n const metadataEntries: GeneratedObjectEntry[] = [\n { name: 'moduleId', value: modId },\n { name: 'kind', value: 'legacy' },\n { name: 'method', value: method },\n { name: 'path', value: resolvedPath },\n { name: 'methods', value: arrayLiteral([method], writeValue) },\n ]\n const manifestEntry = objectLiteral([\n ...metadataEntries,\n { name: 'load', value: buildManifestApiLoader(importPath) },\n ])\n manifestApis.push(manifestEntry)\n manifestShardApis.push({ path: resolvedPath, declaration: renderGeneratedValue(manifestEntry) })\n metadataApis.push({ path: resolvedPath, declaration: renderGeneratedValue(objectLiteral(metadataEntries)) })\n }\n }\n\n return {\n eagerApis,\n runtimeApis,\n manifestApis,\n manifestShardApis,\n metadataApis,\n }\n}\n\n/**\n * Registry helper emitted for a worker that declares `metadata.onJobAbandoned`.\n *\n * Named once because two things must stay in step: the call the worker entry renders, and the import\n * the file needs for it. A generated file that references this without importing it type-checks\n * nowhere, and only fails at `build:app` \u2014 see `generated-registry-imports.test.ts`.\n */\nconst ABANDON_HOOK_FACTORY = 'createLazyModuleWorkerAbandonHook'\n\nfunction workersDeclareAbandonHook(discovered: DiscoveredWorker[]): boolean {\n return discovered.some(({ metadata }) => metadata.hasJobAbandonedHook === true)\n}\n\n/**\n * Resolves a convention file and pushes its import + config entry to standalone arrays.\n * Used for files that produce their own generated output (notifications, AI tools, events, analytics, enrichers, etc.).\n *\n * @returns The generated import name, or null if the file was not found.\n */\nfunction processStandaloneConfig(options: StandaloneConfigOptions): string | null {\n const {\n roots,\n imps,\n modId,\n relativePath,\n prefix,\n importIdRef,\n standaloneImports,\n standaloneEntries,\n writeConfig,\n standaloneConfigs,\n configExpr,\n sharedImports,\n } = options\n const resolved = resolveModuleFile(roots, imps, relativePath)\n if (!resolved) return null\n const importName = `${prefix}_${toVar(modId)}_${importIdRef.value++}`\n const importPath = sanitizeGeneratedModuleSpecifier(resolved.importPath)\n if (standaloneEntries && writeConfig) {\n const importSpec = {\n namespaceImport: importName,\n moduleSpecifier: importPath,\n }\n ;(standaloneImports as Array<{ namespaceImport: string; moduleSpecifier: string }>).push(importSpec)\n if (sharedImports) {\n ;(sharedImports as Array<{ namespaceImport: string; moduleSpecifier: string }>).push(importSpec)\n }\n standaloneEntries.push(writeConfig({ importName, moduleId: modId }))\n return importName\n }\n\n if (!standaloneConfigs || !configExpr) {\n throw new Error(`Invalid standalone generator configuration for ${relativePath}`)\n }\n\n const importStmt = buildImportStatement(`* as ${importName}`, importPath)\n ;(standaloneImports as string[]).push(importStmt)\n if (sharedImports) (sharedImports as string[]).push(importStmt)\n standaloneConfigs.push(configExpr(importName, modId))\n return importName\n}\n\nfunction namespaceLookup(importName: string, memberName: string): WriterFunction {\n return elementAccess(\n asExpression(identifier(importName), 'Record<string, unknown>'),\n memberName,\n )\n}\n\nfunction buildModuleCustomFieldSetsValue(options: {\n fieldsImportName?: string | null\n customEntitiesImportName?: string | null\n moduleId: string\n}): WriterFunction {\n const parts: WriterFunction[] = []\n\n if (options.fieldsImportName) {\n parts.push(\n spreadExpression(\n namespaceFallback({\n importName: options.fieldsImportName,\n members: ['default', 'fieldSets'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n ),\n )\n }\n\n if (options.customEntitiesImportName) {\n const entities = namespaceFallback({\n importName: options.customEntitiesImportName,\n members: ['default', 'entities'],\n fallback: emptyArray(),\n castType: 'any[]',\n })\n\n const mappedEntities = methodCall(\n methodCall(entities, 'filter', [\n arrowFunction({\n parameters: ['e'],\n body: logicalAnd([\n callExpression(propertyAccess(identifier('Array'), 'isArray'), [\n propertyAccess(identifier('e'), 'fields'),\n ]),\n propertyAccess(propertyAccess(identifier('e'), 'fields'), 'length'),\n ]),\n }),\n ]),\n 'map',\n [\n arrowFunction({\n parameters: ['e'],\n body: parenthesized(\n objectLiteral([\n { name: 'entity', value: propertyAccess(identifier('e'), 'id') },\n { name: 'fields', value: propertyAccess(identifier('e'), 'fields') },\n { name: 'source', value: options.moduleId },\n ]),\n ),\n }),\n ],\n )\n\n parts.push(spreadExpression(mappedEntities))\n }\n\n return arrayLiteral(parts, writeValue)\n}\n\nfunction buildModuleDashboardWidgetsValue(entries: DashboardWidgetEntry[]): WriterFunction {\n return arrayLiteral(\n entries.map((entry) =>\n objectLiteral([\n { name: 'moduleId', value: entry.moduleId },\n { name: 'key', value: entry.key },\n { name: 'source', value: entry.source },\n {\n name: 'loader',\n value: arrowFunction({\n body: methodCall(importExpression(entry.importPath), 'then', [\n arrowFunction({\n parameters: ['mod'],\n body: nullishCoalesce([\n propertyAccess(identifier('mod'), 'default'),\n identifier('mod'),\n ]),\n }),\n ]),\n }),\n },\n ]),\n ),\n writeValue,\n )\n}\n\n/**\n * Wraps expressions that are still produced as pre-rendered strings by collaborators this\n * change does not convert (page routes, api handlers, dashboard widgets) so they can sit\n * inside an AST-built array without being re-quoted as string literals. It disappears once\n * those producers emit writers themselves \u2014 see the follow-up noted in the spec's Non-Goals.\n */\nfunction preRenderedExpressionList(expressions: readonly string[]): WriterFunction {\n return arrayLiteral(expressions.map((expression) => identifier(expression)), writeValue)\n}\n\n/**\n * `(X.<first> ?? X.<second>)` \u2014 the member-fallback shape the main registry path emits.\n * It is deliberately not `namespaceFallback`, which the app path uses: that helper walks\n * the members in an IIFE and treats only `!= null` as present, which is a different\n * expression. Converging the two is a behaviour change, not a formatting one.\n */\nfunction legacyNamespaceMemberFallback(importName: string, members: readonly [string, string]): WriterFunction {\n return parenthesized(nullishCoalesce([\n propertyAccess(identifier(importName), members[0]),\n propertyAccess(identifier(importName), members[1]),\n ]))\n}\n\nfunction buildLegacyModuleListValue(options: {\n importName: string\n members: readonly [string, string]\n castType: string\n}): WriterFunction {\n return logicalOr([\n asExpression(legacyNamespaceMemberFallback(options.importName, options.members), options.castType),\n emptyArray(),\n ])\n}\n\nfunction buildLegacyModuleSetupValue(importName: string): WriterFunction {\n return logicalOr([\n legacyNamespaceMemberFallback(importName, ['default', 'setup']),\n identifier('undefined'),\n ])\n}\n\nfunction buildLegacyModuleRuntimeValue(importName: string): WriterFunction {\n return logicalOr([\n legacyNamespaceMemberFallback(importName, ['default', 'runtime']),\n identifier('undefined'),\n ])\n}\n\nfunction buildLegacyIntegrationListValue(\n importName: string,\n pluralMember: string,\n singularMember: string,\n castType: string,\n): WriterFunction {\n const singular = propertyAccess(identifier(importName), singularMember)\n\n return asExpression(\n parenthesized(nullishCoalesce([\n propertyAccess(identifier(importName), pluralMember),\n parenthesized(conditionalExpression(singular, arrayLiteral([singular], writeValue), emptyArray())),\n ])),\n castType,\n )\n}\n\nfunction buildModuleIntegrationListValue(\n importName: string,\n pluralMember: string,\n singularMember: string,\n castType: string,\n): WriterFunction {\n const plural = namespaceLookup(importName, pluralMember)\n const singular = namespaceLookup(importName, singularMember)\n\n return nullishCoalesce([\n asExpression(plural, castType),\n asExpression(\n parenthesized(\n conditionalExpression(\n binaryExpression(singular, '!=', null),\n arrayLiteral([singular], writeValue),\n emptyArray(),\n ),\n ),\n castType,\n ),\n ])\n}\n\nfunction buildModulesInfoExpression(): WriterFunction {\n return methodCall(identifier('modules'), 'map', [\n arrowFunction({\n parameters: ['m'],\n body: parenthesized(\n objectLiteral([\n { name: 'id', value: propertyAccess(identifier('m'), 'id') },\n {\n kind: 'spread',\n value: logicalOr([\n propertyAccess(identifier('m'), 'info'),\n emptyObject(),\n ]),\n },\n ]),\n ),\n }),\n ])\n}\n\nfunction renderAstModuleRegistryFile(options: {\n fileName: string\n generator: string\n /**\n * Import statements, or the structured specs generator extensions push onto the shared\n * import array via `processStandaloneConfig`. Both shapes reach this emitter at runtime,\n * so both are normalised here rather than at each call site.\n */\n imports: GeneratedImportStatement[]\n moduleEntries: WriterFunction[]\n includeCreateElementImport?: boolean\n includeAbandonHookImport?: boolean\n}): string {\n const sourceFile = createGeneratedSourceFile(options.fileName)\n addAutoGeneratedComment(sourceFile, options.generator)\n\n if (options.includeCreateElementImport) {\n addImportSpec(sourceFile, {\n moduleSpecifier: 'react',\n namedImports: [{ name: 'createElement' }],\n })\n }\n addImportSpec(sourceFile, {\n moduleSpecifier: '@open-mercato/shared/modules/registry',\n namedImports: [\n { name: 'createLazyModuleSubscriber' },\n { name: 'createLazyModuleWorker' },\n ...(options.includeAbandonHookImport ? [{ name: ABANDON_HOOK_FACTORY }] : []),\n { name: 'Module', isTypeOnly: true },\n ],\n })\n addImportStatements(sourceFile, options.imports.map((entry) => serializeGeneratedImport(entry)))\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'modules',\n type: 'Module[]',\n initializer: arrayLiteral(options.moduleEntries, writeValue),\n },\n ],\n })\n sourceFile.addExportAssignment({\n isExportEquals: false,\n expression: 'modules',\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'modulesInfo',\n initializer: buildModulesInfoExpression(),\n },\n ],\n })\n\n return getSourceText(sourceFile)\n}\n\nfunction renderAstManifestFile(options: {\n fileName: string\n typeName: string\n exportName: string\n imports?: string[]\n entries: WriterFunction[]\n}): string {\n const sourceFile = createGeneratedSourceFile(options.fileName)\n addAutoGeneratedComment(sourceFile, 'registry')\n\n const usesPageRouteMetadataHelper = options.typeName === 'FrontendRouteManifestEntry'\n || options.typeName === 'BackendRouteManifestEntry'\n addImportSpec(sourceFile, usesPageRouteMetadataHelper\n ? {\n moduleSpecifier: '@open-mercato/shared/modules/registry',\n namedImports: [\n { name: 'resolvePageRouteMetadata' },\n { name: options.typeName, isTypeOnly: true },\n ],\n }\n : {\n moduleSpecifier: '@open-mercato/shared/modules/registry',\n isTypeOnly: true,\n namedImports: [{ name: options.typeName }],\n })\n addImportStatements(sourceFile, options.imports ?? [])\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: options.exportName,\n type: `${options.typeName}[]`,\n initializer: arrayLiteral(options.entries, writeValue),\n },\n ],\n })\n sourceFile.addExportAssignment({\n isExportEquals: false,\n expression: options.exportName,\n })\n\n return getSourceText(sourceFile)\n}\n\nfunction renderAstLegacyAliasFile(options: {\n fileName: string\n exportName: string\n exportType: string\n sourceFileName: string\n initializer: WriterFunction\n}): string {\n const sourceFile = createGeneratedSourceFile(options.fileName)\n addAutoGeneratedComment(sourceFile, 'registry')\n\n addImportSpec(sourceFile, {\n moduleSpecifier: '@open-mercato/shared/modules/registry',\n namedImports: [{ name: 'Module', isTypeOnly: true }],\n })\n addImportSpec(sourceFile, {\n moduleSpecifier: `./${options.sourceFileName.replace(/\\.ts$/, '')}`,\n namedImports: [{ name: 'modules' }],\n })\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: options.exportName,\n type: options.exportType,\n initializer: options.initializer,\n },\n ],\n })\n\n return getSourceText(sourceFile)\n}\n\nfunction renderEnabledModuleIdsFile(moduleIds: readonly string[]): string {\n const sourceFile = createGeneratedSourceFile('enabled-module-ids.generated.ts')\n addAutoGeneratedComment(sourceFile, 'registry (enabled-module-ids version)')\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n leadingTrivia: (writer) => {\n writer.newLine()\n writer.writeLine('// This file lists every enabled module ID without importing module runtime')\n writer.writeLine('// surfaces. It is safe to import from client bundles (no node:* dependencies).')\n },\n declarations: [\n {\n name: 'enabledModuleIds',\n type: 'readonly string[]',\n initializer: (writer) => {\n writeArrayLiteral(writer, moduleIds, (w, id) => {\n w.write(JSON.stringify(id))\n })\n writer.write(' as const')\n },\n },\n ],\n })\n\n return getSourceText(sourceFile)\n}\n\nfunction buildLazyRouteComponentExpression(importPath: string): string {\n return `async (props: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; const Component = (mod.default ?? mod) as any; return createElement(Component, props) }`\n}\n\nfunction buildRuntimeRouteComponent(importPath: string): WriterFunction {\n return arrowFunction({\n async: true,\n parameters: ['props: any'],\n body: block((writer) => {\n writeStatements(writer, [\n variableStatement({\n name: 'mod',\n initializer: awaitExpression(importExpression(importPath)),\n }),\n variableStatement({\n name: 'Component',\n type: 'any',\n initializer: asExpression(\n nullishCoalesce([\n propertyAccess(identifier('mod'), 'default'),\n identifier('mod'),\n ]),\n 'any',\n ),\n }),\n returnStatement(\n callExpression(identifier('createElement'), [\n identifier('Component'),\n identifier('props'),\n ]),\n ),\n ])\n }),\n })\n}\n\nfunction rawExpression(source: string): WriterFunction {\n return (writer) => writer.write(source)\n}\n\nfunction buildPageRouteEntries(metaExpr: WriterFunction, routePath: string): GeneratedObjectEntry[] {\n const meta = parenthesized(metaExpr)\n return [\n { name: 'pattern', value: routePath || '/' },\n { name: 'requireAuth', value: optionalPropertyAccess(meta, 'requireAuth') },\n { name: 'requireRoles', value: optionalPropertyAccess(meta, 'requireRoles') },\n { name: 'requireFeatures', value: optionalPropertyAccess(meta, 'requireFeatures') },\n { name: 'requireCustomerAuth', value: optionalPropertyAccess(meta, 'requireCustomerAuth') },\n { name: 'requireCustomerFeatures', value: optionalPropertyAccess(meta, 'requireCustomerFeatures') },\n { name: 'nav', value: optionalPropertyAccess(meta, 'nav') },\n {\n name: 'title',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pageTitle'),\n optionalPropertyAccess(meta, 'title'),\n ]),\n },\n {\n name: 'titleKey',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pageTitleKey'),\n optionalPropertyAccess(meta, 'titleKey'),\n ]),\n },\n {\n name: 'group',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pageGroup'),\n optionalPropertyAccess(meta, 'group'),\n ]),\n },\n {\n name: 'groupKey',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pageGroupKey'),\n optionalPropertyAccess(meta, 'groupKey'),\n ]),\n },\n { name: 'icon', value: optionalPropertyAccess(meta, 'icon') },\n {\n name: 'order',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pageOrder'),\n optionalPropertyAccess(meta, 'order'),\n ]),\n },\n {\n name: 'priority',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pagePriority'),\n optionalPropertyAccess(meta, 'priority'),\n ]),\n },\n { name: 'navHidden', value: optionalPropertyAccess(meta, 'navHidden') },\n { name: 'visible', value: optionalPropertyAccess(meta, 'visible') },\n { name: 'enabled', value: optionalPropertyAccess(meta, 'enabled') },\n { name: 'breadcrumb', value: optionalPropertyAccess(meta, 'breadcrumb') },\n { name: 'pageContext', value: optionalPropertyAccess(meta, 'pageContext') },\n { name: 'placement', value: optionalPropertyAccess(meta, 'placement') },\n ]\n}\n\nasync function processPageFilesAst(options: {\n files: Array<{ relPath: string; fromApp: boolean }>\n type: 'frontend' | 'backend'\n modId: string\n appDir: string\n pkgDir: string\n appImportBase: string\n pkgImportBase: string\n imports: string[]\n importIdRef: { value: number }\n quiet?: boolean\n}): Promise<{ routes: WriterFunction[]; routePatterns: string[] }> {\n const {\n files,\n type,\n modId,\n appDir,\n pkgDir,\n appImportBase,\n pkgImportBase,\n imports,\n importIdRef,\n quiet,\n } = options\n const routes: WriterFunction[] = []\n const routePatterns: string[] = []\n const metaPrefix = type === 'frontend' ? 'MRuntime' : 'BMRuntime'\n\n const addRoute = (params: {\n importPath: string\n routePath: string\n metaExpr: WriterFunction\n }) => {\n routes.push(\n objectLiteral([\n ...buildPageRouteEntries(params.metaExpr, params.routePath),\n {\n name: 'Component',\n value: buildRuntimeRouteComponent(params.importPath),\n },\n ]),\n )\n routePatterns.push(params.routePath)\n }\n\n for (const { relPath, fromApp } of files.filter(({ relPath: filePath }) => isModulePageFile(path.basename(filePath)))) {\n const segs = relPath.split('/')\n const pageFile = segs.pop()!\n const pageBaseName = stripModuleCodeExtension(pageFile)\n const sub = segs.length ? `${segs.join('/')}/${pageBaseName}` : pageBaseName\n const importPath = sanitizeGeneratedModuleSpecifier(`${fromApp ? appImportBase : pkgImportBase}/${type}/${sub}`)\n const routePath = type === 'frontend'\n ? '/' + (segs.join('/') || '')\n : '/backend/' + (segs.join('/') || modId)\n const moduleBaseDir = path.join(fromApp ? appDir : pkgDir, ...segs)\n const sourceFile = findExistingModuleFile(moduleBaseDir, pageFile)\n if (!sourceFile || !hasDefaultExport(sourceFile)) continue\n\n const metaPath = findExistingModuleFileByBaseNames(moduleBaseDir, ['page.meta', 'meta'])\n warnIfPageMetaMissingMetadataExport(metaPath, quiet)\n if (metaPath) {\n const metaImportName = `${metaPrefix}${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n const metaImportPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${toModuleImportSubpath(metaPath, fromApp ? appDir : pkgDir)}`,\n )\n imports.push(buildImportStatement(`* as ${metaImportName}`, metaImportPath))\n addRoute({\n importPath,\n routePath,\n metaExpr: asExpression(\n propertyAccess(asExpression(identifier(metaImportName), 'any'), 'metadata'),\n 'any',\n ),\n })\n continue\n }\n\n const staticMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: '(undefined as any)',\n allowRuntimeFallback: false,\n })\n addRoute({\n importPath,\n routePath,\n metaExpr: rawExpression(staticMetadata.manifestExpr),\n })\n }\n\n for (const { relPath, fromApp } of files.filter(({ relPath: filePath }) => !isModulePageFile(path.basename(filePath)))) {\n const segs = relPath.split('/')\n const file = segs.pop()!\n const name = stripModuleCodeExtension(file)\n const routeSegs = [...segs, name].filter(Boolean)\n const importPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${[...segs, name].join('/')}`,\n )\n const routePath = type === 'frontend'\n ? '/' + (routeSegs.join('/') || '')\n : '/backend/' + (segs[0] === modId\n ? [...segs, name].filter(Boolean).join('/')\n : [modId, ...segs, name].filter(Boolean).join('/'))\n const moduleBaseDir = path.join(fromApp ? appDir : pkgDir, ...segs)\n const sourceFile = findExistingModuleFile(moduleBaseDir, file)\n if (!sourceFile || !hasDefaultExport(sourceFile)) continue\n\n const metaPath = findExistingModuleFileByBaseNames(moduleBaseDir, [`${name}.meta`, 'meta'])\n if (metaPath) {\n const metaImportName = `${metaPrefix}${importIdRef.value++}_${toVar(modId)}_${toVar(routeSegs.join('_') || 'index')}`\n const metaBase = path.basename(metaPath)\n const metaImportSub = stripModuleCodeExtension(metaBase) === 'meta' ? 'meta' : `${name}.meta`\n const metaImportPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${[...segs, metaImportSub].join('/')}`,\n )\n imports.push(buildImportStatement(`* as ${metaImportName}`, metaImportPath))\n addRoute({\n importPath,\n routePath,\n metaExpr: asExpression(\n propertyAccess(asExpression(identifier(metaImportName), 'any'), 'metadata'),\n 'any',\n ),\n })\n continue\n }\n\n const staticMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: '(undefined as any)',\n allowRuntimeFallback: false,\n })\n addRoute({\n importPath,\n routePath,\n metaExpr: rawExpression(staticMetadata.manifestExpr),\n })\n }\n\n return { routes, routePatterns }\n}\n\nfunction processSubscribersAst(discovered: DiscoveredSubscriber[]): WriterFunction[] {\n const subscribers: WriterFunction[] = []\n for (const { id, importPath, metadata } of discovered) {\n const subscriberId = metadata?.id ?? id\n subscribers.push(\n objectLiteral([\n { name: 'id', value: subscriberId },\n { name: 'event', value: metadata?.event ?? '' },\n { name: 'persistent', value: metadata?.persistent },\n { name: 'sync', value: metadata?.sync },\n { name: 'priority', value: metadata?.priority },\n {\n name: 'handler',\n value: callExpression(identifier('createLazyModuleSubscriber'), [\n arrowFunction({\n body: importExpression(importPath),\n }),\n subscriberId,\n ]),\n },\n ]),\n )\n }\n return subscribers\n}\n\nfunction processWorkersAst(discovered: DiscoveredWorker[]): WriterFunction[] {\n const workers: WriterFunction[] = []\n for (const { id, importPath, metadata } of discovered) {\n const workerId = metadata.id ?? id\n workers.push(\n objectLiteral([\n { name: 'id', value: workerId },\n { name: 'queue', value: metadata.queue },\n { name: 'concurrency', value: metadata.concurrency ?? 1 },\n ...(metadata.schedulerSafe === true ? [{ name: 'schedulerSafe', value: true }] : []),\n ...(metadata.schedulerRequiredFeatures\n ? [{ name: 'schedulerRequiredFeatures', value: arrayLiteral(metadata.schedulerRequiredFeatures, writeValue) }]\n : []),\n ...(metadata.lockDuration === undefined ? [] : [{ name: 'lockDuration', value: metadata.lockDuration }]),\n ...(metadata.maxStalledCount === undefined ? [] : [{ name: 'maxStalledCount', value: metadata.maxStalledCount }]),\n ...(metadata.hasJobAbandonedHook\n ? [{\n name: 'onJobAbandoned',\n value: callExpression(identifier(ABANDON_HOOK_FACTORY), [\n arrowFunction({ body: importExpression(importPath) }),\n workerId,\n ]),\n }]\n : []),\n {\n name: 'handler',\n value: callExpression(identifier('createLazyModuleWorker'), [\n arrowFunction({\n body: importExpression(importPath),\n }),\n workerId,\n ]),\n },\n ]),\n )\n }\n return workers\n}\n\nfunction collectWorkerGenerationEntries(\n discovered: DiscoveredWorker[],\n moduleId: string,\n): WorkerGenerationEntry[] {\n const workers: WorkerGenerationEntry[] = []\n for (const { id, importPath, metadata } of discovered) {\n if (!metadata.queue) continue\n workers.push({\n id: metadata.id ?? id,\n moduleId,\n queue: metadata.queue,\n concurrency: metadata.concurrency ?? 1,\n importPath,\n })\n }\n return workers\n}\n\nfunction processTranslationsAst(options: {\n discovered: DiscoveredTranslation[]\n modId: string\n appImportBase: string\n pkgImportBase: string\n imports: string[]\n extraImports?: string[]\n localeOutputs?: Map<string, { imports: string[]; value: WriterFunction }>\n}): GeneratedObjectEntry[] {\n const { discovered, modId, appImportBase, pkgImportBase, imports, extraImports, localeOutputs } = options\n\n const translations: GeneratedObjectEntry[] = []\n\n for (const { locale, coreHas, appHas } of discovered) {\n\n if (coreHas && appHas) {\n const coreName = `T_${toVar(modId)}_${toVar(locale)}_C`\n const appName = `T_${toVar(modId)}_${toVar(locale)}_A`\n const localeImports = [\n buildImportStatement(coreName, `${pkgImportBase}/i18n/${locale}.json`),\n buildImportStatement(appName, `${appImportBase}/i18n/${locale}.json`),\n ]\n imports.push(...localeImports)\n extraImports?.push(...localeImports)\n const value = objectLiteral([\n { kind: 'spread', value: asExpression(identifier(coreName), 'unknown as Record<string, string>') },\n { kind: 'spread', value: asExpression(identifier(appName), 'unknown as Record<string, string>') },\n ])\n translations.push({\n name: JSON.stringify(locale),\n value,\n })\n localeOutputs?.set(locale, { imports: localeImports, value })\n continue\n }\n\n if (appHas) {\n const appName = `T_${toVar(modId)}_${toVar(locale)}_A`\n const localeImports = [buildImportStatement(appName, `${appImportBase}/i18n/${locale}.json`)]\n imports.push(...localeImports)\n extraImports?.push(...localeImports)\n const value = asExpression(identifier(appName), 'unknown as Record<string, string>')\n translations.push({\n name: JSON.stringify(locale),\n value,\n })\n localeOutputs?.set(locale, { imports: localeImports, value })\n continue\n }\n\n if (coreHas) {\n const coreName = `T_${toVar(modId)}_${toVar(locale)}_C`\n const localeImports = [buildImportStatement(coreName, `${pkgImportBase}/i18n/${locale}.json`)]\n imports.push(...localeImports)\n extraImports?.push(...localeImports)\n const value = asExpression(identifier(coreName), 'unknown as Record<string, string>')\n translations.push({\n name: JSON.stringify(locale),\n value,\n })\n localeOutputs?.set(locale, { imports: localeImports, value })\n }\n }\n\n return translations\n}\n\nfunction sourceDeclaresCliCommand(filePath: string, commandName: string): boolean {\n let sourceText: string\n try {\n sourceText = fs.readFileSync(filePath, 'utf8')\n } catch {\n return false\n }\n const sourceFile = ts.createSourceFile(filePath, sourceText, ts.ScriptTarget.Latest, true)\n const declarations = new Map<string, ts.Expression>()\n for (const statement of sourceFile.statements) {\n if (!ts.isVariableStatement(statement)) continue\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name) && declaration.initializer) {\n declarations.set(declaration.name.text, declaration.initializer)\n }\n }\n }\n\n const expressionDeclaresCommand = (expression: ts.Expression, seen = new Set<string>()): boolean => {\n if (ts.isParenthesizedExpression(expression) || ts.isAsExpression(expression) || ts.isSatisfiesExpression(expression)) {\n return expressionDeclaresCommand(expression.expression, seen)\n }\n if (ts.isIdentifier(expression)) {\n if (seen.has(expression.text)) return false\n const initializer = declarations.get(expression.text)\n if (!initializer) return false\n const nextSeen = new Set(seen)\n nextSeen.add(expression.text)\n return expressionDeclaresCommand(initializer, nextSeen)\n }\n if (ts.isArrayLiteralExpression(expression)) {\n return expression.elements.some((element) => (\n ts.isSpreadElement(element)\n ? expressionDeclaresCommand(element.expression, seen)\n : expressionDeclaresCommand(element, seen)\n ))\n }\n if (!ts.isObjectLiteralExpression(expression)) return false\n return expression.properties.some((property) => {\n if (!ts.isPropertyAssignment(property)) return false\n const propertyName = ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name)\n ? property.name.text\n : null\n return propertyName === 'command'\n && (ts.isStringLiteralLike(property.initializer) || ts.isNoSubstitutionTemplateLiteral(property.initializer))\n && property.initializer.text === commandName\n })\n }\n\n return sourceFile.statements.some((statement) => (\n ts.isExportAssignment(statement)\n && !statement.isExportEquals\n && expressionDeclaresCommand(statement.expression)\n ))\n}\n\nfunction appDeclaresProgrammaticDevSupervisorOverrides(appDir: string): boolean {\n const srcDir = path.join(appDir, 'src')\n const pending = [srcDir]\n while (pending.length > 0) {\n const current = pending.pop()!\n let entries: fs.Dirent[]\n try {\n entries = fs.readdirSync(current, { withFileTypes: true })\n } catch {\n continue\n }\n for (const entry of entries) {\n const entryPath = path.join(current, entry.name)\n if (entry.isDirectory()) {\n if (entry.name !== '__tests__' && entry.name !== 'node_modules') pending.push(entryPath)\n continue\n }\n if (!/\\.[cm]?tsx?$/.test(entry.name) || /(?:^|\\.)test\\.[cm]?tsx?$/.test(entry.name)) continue\n\n let sourceText: string\n try {\n sourceText = fs.readFileSync(entryPath, 'utf8')\n } catch {\n continue\n }\n const sourceFile = ts.createSourceFile(entryPath, sourceText, ts.ScriptTarget.Latest, true)\n const directImports = new Set<string>()\n const namespaceImports = new Set<string>()\n for (const statement of sourceFile.statements) {\n if (\n !ts.isImportDeclaration(statement)\n || !ts.isStringLiteralLike(statement.moduleSpecifier)\n || statement.moduleSpecifier.text !== '@open-mercato/shared/modules/overrides'\n ) continue\n const bindings = statement.importClause?.namedBindings\n if (bindings && ts.isNamespaceImport(bindings)) namespaceImports.add(bindings.name.text)\n if (bindings && ts.isNamedImports(bindings)) {\n for (const element of bindings.elements) {\n const importedName = element.propertyName?.text ?? element.name.text\n if (importedName === 'applyWorkerOverrides' || importedName === 'applyCliOverrides') {\n directImports.add(element.name.text)\n }\n }\n }\n }\n let found = false\n const visit = (node: ts.Node): void => {\n if (found) return\n if (ts.isCallExpression(node)) {\n if (ts.isIdentifier(node.expression) && directImports.has(node.expression.text)) {\n found = true\n return\n }\n if (\n ts.isPropertyAccessExpression(node.expression)\n && ts.isIdentifier(node.expression.expression)\n && namespaceImports.has(node.expression.expression.text)\n && ['applyWorkerOverrides', 'applyCliOverrides'].includes(node.expression.name.text)\n ) {\n found = true\n return\n }\n }\n ts.forEachChild(node, visit)\n }\n visit(sourceFile)\n if (found) return true\n }\n }\n return false\n}\n\nfunction renderAstI18nLocaleRegistryFile(options: {\n fileName: string\n imports: string[]\n moduleEntries: WriterFunction[]\n}): string {\n const sourceFile = createGeneratedSourceFile(options.fileName)\n addAutoGeneratedComment(sourceFile, 'registry (locale-specific i18n version)')\n addImportSpec(sourceFile, {\n moduleSpecifier: '@open-mercato/shared/modules/registry',\n namedImports: [{ name: 'Module', isTypeOnly: true }],\n })\n addImportStatements(sourceFile, options.imports)\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [{\n name: 'modules',\n type: 'Module[]',\n initializer: arrayLiteral(options.moduleEntries, writeValue),\n }],\n })\n sourceFile.addExportAssignment({\n isExportEquals: false,\n expression: 'modules',\n })\n return getSourceText(sourceFile)\n}\n\nfunction buildI18nLocaleShardFileName(locale: string): string {\n const safeLocale = locale.replace(/[^a-zA-Z0-9_-]/g, '_')\n return `modules.i18n.${safeLocale}.generated.ts`\n}\n\nfunction renderI18nLocaleLoadersFile(locales: string[]): string {\n const cases = locales.map((locale) => {\n const moduleSpecifier = `./${buildI18nLocaleShardFileName(locale).replace(/\\.ts$/, '')}`\n return ` case ${JSON.stringify(locale)}:\\n return import(${JSON.stringify(moduleSpecifier)}).then((entry) => entry.modules)`\n }).join('\\n')\n\n return `// AUTO-GENERATED by mercato generate registry (locale-specific i18n loaders)\\nimport type { Module } from '@open-mercato/shared/modules/registry'\\n\\nexport async function loadI18nModules(locale: string): Promise<Module[]> {\\n switch (locale) {\\n${cases ? `${cases}\\n` : ''} default:\\n return []\\n }\\n}\\n`\n}\n\nfunction removeStaleI18nLocaleShards(outputDir: string, expectedFileNames: Set<string>): void {\n if (!fs.existsSync(outputDir)) return\n for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {\n if (!entry.isFile()) continue\n if (!/^modules\\.i18n\\..+\\.generated\\.(?:ts|checksum)$/.test(entry.name)) continue\n if (entry.name.startsWith('modules.i18n.loaders.generated.')) continue\n if (expectedFileNames.has(entry.name)) continue\n fs.unlinkSync(path.join(outputDir, entry.name))\n }\n}\n\nfunction resolveConventionFile(\n resolved: ResolvedFile | null,\n prefix: string,\n modId: string,\n importIdRef: { value: number },\n imports: string[],\n extraImports?: string[],\n importStyle: 'namespace' | 'default' = 'namespace'\n): { importName: string; importPath: string; fromApp: boolean } | null {\n if (!resolved) return null\n const importName = `${prefix}_${toVar(modId)}_${importIdRef.value++}`\n const importPath = sanitizeGeneratedModuleSpecifier(resolved.importPath)\n if (importStyle === 'default') {\n imports.push(buildImportStatement(importName, importPath))\n extraImports?.push(buildImportStatement(importName, importPath))\n } else {\n imports.push(buildImportStatement(`* as ${importName}`, importPath))\n extraImports?.push(buildImportStatement(`* as ${importName}`, importPath))\n }\n return { importName, importPath, fromApp: resolved.fromApp }\n}\n\ntype ModuleRegistryRenderOptions = ModuleRegistryOptions & {\n discovery: ModuleRegistryDiscovery\n}\n\nasync function generateModuleRegistryFromDiscovery(options: ModuleRegistryRenderOptions): Promise<GeneratorResult> {\n const { resolver, quiet = false } = options\n const { discovery } = options\n const result = createGeneratorResult()\n\n const outputDir = resolver.getOutputDir()\n const outFile = path.join(outputDir, 'modules.generated.ts')\n const checksumFile = path.join(outputDir, 'modules.generated.checksum')\n const runtimeOutFile = path.join(outputDir, 'modules.runtime.generated.ts')\n const runtimeChecksumFile = path.join(outputDir, 'modules.runtime.generated.checksum')\n const frontendRoutesOutFile = path.join(outputDir, 'frontend-routes.generated.ts')\n const frontendRoutesChecksumFile = path.join(outputDir, 'frontend-routes.generated.checksum')\n const backendRoutesOutFile = path.join(outputDir, 'backend-routes.generated.ts')\n const backendRoutesChecksumFile = path.join(outputDir, 'backend-routes.generated.checksum')\n const apiRoutesOutFile = path.join(outputDir, 'api-routes.generated.ts')\n const apiRoutesChecksumFile = path.join(outputDir, 'api-routes.generated.checksum')\n const bootstrapRegsOutFile = path.join(outputDir, 'bootstrap-registrations.generated.ts')\n const bootstrapRegsChecksumFile = path.join(outputDir, 'bootstrap-registrations.generated.checksum')\n const legacySubscribersOutFile = path.join(outputDir, 'subscribers.generated.ts')\n const legacySubscribersChecksumFile = path.join(outputDir, 'subscribers.generated.checksum')\n const commandLoadersOutFile = path.join(outputDir, 'command-loaders.generated.ts')\n const commandLoadersChecksumFile = path.join(outputDir, 'command-loaders.generated.checksum')\n\n const enabled = discovery.enabled\n const extensions = loadGeneratorExtensions()\n\n // Pre-pass: collect generator plugins from each enabled module's generators.ts\n const pluginRegistry = new Map<string, import('@open-mercato/shared/modules/generators').GeneratorPlugin>()\n const pluginState = new Map<string, { imports: string[]; configs: string[] }>()\n for (const discovered of discovery.modules) {\n const resolved = discovered.resolve('generators.ts')\n if (!resolved) continue\n assertGeneratorPluginUsesTypeOnlyImports(resolved.absolutePath)\n try {\n const pluginMod = await import(buildCacheBustedSourceImportUrl(resolved.absolutePath))\n const plugins: import('@open-mercato/shared/modules/generators').GeneratorPlugin[] =\n pluginMod.generatorPlugins ?? pluginMod.default ?? []\n for (const plugin of plugins) {\n if (!pluginRegistry.has(plugin.id)) {\n pluginRegistry.set(plugin.id, plugin)\n pluginState.set(plugin.id, { imports: [], configs: [] })\n }\n }\n } catch {}\n }\n\n const pluginOutputNames = resolveGeneratorPluginOutputNames(pluginRegistry)\n\n const imports: string[] = []\n const runtimeImports: string[] = []\n const frontendRouteManifestImports: string[] = []\n const backendRouteManifestImports: string[] = []\n const moduleDecls: WriterFunction[] = []\n const runtimeModuleDecls: WriterFunction[] = []\n const frontendRouteManifestDecls: WriterFunction[] = []\n const backendRouteManifestDecls: WriterFunction[] = []\n const apiRouteManifestDecls: WriterFunction[] = []\n const backendRouteShardEntries: RouteManifestShardEntry[] = []\n const backendRouteMetadataEntries: RouteManifestShardEntry[] = []\n const apiRouteShardEntries: RouteManifestShardEntry[] = []\n const apiRouteMetadataEntries: RouteManifestShardEntry[] = []\n // Mutable ref so extracted helper functions can increment the shared counter\n const importIdRef = { value: 0 }\n const requiresByModule = new Map<string, string[]>()\n const commandLoaderEntries: CommandLoaderGenerationEntry[] = []\n const backendRouteRegistrations: BackendRouteRegistration[] = []\n let hasRouteComponents = false\n let hasAbandonHookWorkers = false\n\n // UMES conflict detection: collect file paths during module processing\n const umesConflictSources: Array<{\n moduleId: string\n componentOverridesPath?: string\n interceptorsPath?: string\n aclPath?: string\n }> = []\n\n const seenBackendRoutePatterns = new Map<string, BackendRoutePatternOwner>()\n\n for (const discovered of discovery.modules) {\n const { modId, roots, imps, appImportBase, isAppModule } = discovered\n commandLoaderEntries.push(...discovered.commandLoaderEntries)\n\n const frontendRoutes: string[] = []\n const backendRoutes: string[] = []\n const apis: string[] = []\n const runtimeFrontendRoutes: string[] = []\n const runtimeBackendRoutes: string[] = []\n const runtimeApis: string[] = []\n let cliImportName: string | null = null\n const translations: GeneratedObjectEntry[] = []\n const subscribers: WriterFunction[] = []\n const workers: WriterFunction[] = []\n let infoImportName: string | null = null\n let extensionsImportName: string | null = null\n let fieldsImportName: string | null = null\n let featuresImportName: string | null = null\n let customEntitiesImportName: string | null = null\n let customFieldSetsExpr: string = '[]'\n const dashboardWidgets: string[] = []\n let setupImportName: string | null = null\n let moduleRuntimeImportName: string | null = null\n let encryptionImportName: string | null = null\n let integrationImportName: string | null = null\n\n // === Processing order MUST match original import ID sequence ===\n\n // 1. Module metadata: index.ts (overrideable)\n const indexResolved = discovered.resolve('index.ts')\n if (indexResolved) {\n infoImportName = `I${importIdRef.value++}_${toVar(modId)}`\n const importPath = sanitizeGeneratedModuleSpecifier(indexResolved.importPath)\n imports.push(buildImportStatement(`* as ${infoImportName}`, importPath))\n runtimeImports.push(buildImportStatement(`* as ${infoImportName}`, importPath))\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const mod = require(indexResolved.absolutePath)\n const reqs: string[] | undefined =\n mod?.metadata && Array.isArray(mod.metadata.requires) ? mod.metadata.requires : undefined\n if (reqs && reqs.length) requiresByModule.set(modId, reqs)\n } catch {}\n }\n\n // 2. Pages: frontend\n {\n const feApp = path.join(roots.appBase, 'frontend')\n const fePkg = path.join(roots.pkgBase, 'frontend')\n const feFiles = discovered.frontendFiles\n if (feFiles.length) {\n const generatedFrontendRoutes = await processPageFiles({\n files: feFiles,\n type: 'frontend',\n modId,\n appDir: feApp,\n pkgDir: fePkg,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n eagerImports: imports,\n runtimeImports,\n manifestImports: frontendRouteManifestImports,\n importIdRef,\n quiet,\n })\n frontendRoutes.push(...generatedFrontendRoutes.eagerRoutes)\n runtimeFrontendRoutes.push(...generatedFrontendRoutes.runtimeRoutes)\n frontendRouteManifestDecls.push(...generatedFrontendRoutes.manifestRoutes)\n hasRouteComponents = true\n }\n }\n\n // 3. Entity extensions: data/extensions.ts\n {\n const ext = resolveConventionFile(discovered.resolve('data/extensions.ts'), 'X', modId, importIdRef, imports, runtimeImports)\n if (ext) extensionsImportName = ext.importName\n }\n\n // 4. RBAC: acl.ts\n {\n const aclResolved = discovered.resolve('acl.ts')\n if (aclResolved) {\n const importName = `ACL_${toVar(modId)}_${importIdRef.value++}`\n const importPath = sanitizeGeneratedModuleSpecifier(aclResolved.importPath)\n imports.push(buildImportStatement(`* as ${importName}`, importPath))\n runtimeImports.push(buildImportStatement(`* as ${importName}`, importPath))\n featuresImportName = importName\n }\n }\n\n // 5. Custom entities: ce.ts\n {\n const ce = resolveConventionFile(discovered.resolve('ce.ts'), 'CE', modId, importIdRef, imports, runtimeImports)\n if (ce) customEntitiesImportName = ce.importName\n }\n\n const extensionContext: ModuleScanContext = {\n moduleId: modId,\n roots,\n imps,\n importIdRef,\n sharedImports: imports,\n resolveModuleFile,\n resolveFirstModuleFile,\n processStandaloneConfig,\n sanitizeGeneratedModuleSpecifier,\n }\n for (const extension of extensions) {\n extension.scanModule(extensionContext)\n }\n\n // Track file paths for UMES conflict detection\n {\n const compOverridesFile = discovered.resolve('widgets/components.ts')\n const interceptorsFile = discovered.resolve('api/interceptors.ts')\n const aclFile = discovered.resolve('acl.ts')\n umesConflictSources.push({\n moduleId: modId,\n componentOverridesPath: compOverridesFile?.absolutePath,\n interceptorsPath: interceptorsFile?.absolutePath,\n aclPath: aclFile?.absolutePath,\n })\n }\n\n // Generator plugins: process each registered plugin's convention file\n for (const plugin of pluginRegistry.values()) {\n processStandaloneConfig({\n roots, imps, modId, importIdRef,\n relativePath: plugin.conventionFile,\n prefix: plugin.importPrefix,\n standaloneImports: pluginState.get(plugin.id)!.imports,\n standaloneConfigs: pluginState.get(plugin.id)!.configs,\n configExpr: plugin.configExpr,\n })\n }\n\n // 11. Setup: setup.ts\n {\n const setup = resolveConventionFile(discovered.resolve('setup.ts'), 'SETUP', modId, importIdRef, imports, runtimeImports)\n if (setup) setupImportName = setup.importName\n }\n\n // 11a. Encryption defaults: encryption.ts\n {\n const encryption = resolveConventionFile(discovered.resolve('encryption.ts'), 'ENCRYPTION', modId, importIdRef, imports, runtimeImports)\n if (encryption) encryptionImportName = encryption.importName\n }\n\n // 11b. Integration manifest: integration.ts\n {\n const resolved = discovered.resolve('integration.ts')\n if (resolved) {\n const importName = `INTEGRATION_${toVar(modId)}_${importIdRef.value++}`\n imports.push(buildImportStatement(`* as ${importName}`, resolved.importPath))\n runtimeImports.push(buildImportStatement(`* as ${importName}`, resolved.importPath))\n integrationImportName = importName\n }\n }\n\n // 11c. Module runtime: runtime.ts (SPEC-072)\n {\n const moduleRuntime = resolveConventionFile(discovered.resolve('runtime.ts'), 'RUNTIME', modId, importIdRef, imports, runtimeImports)\n if (moduleRuntime) moduleRuntimeImportName = moduleRuntime.importName\n }\n\n // 12. Custom fields: data/fields.ts\n {\n const fields = resolveConventionFile(discovered.resolve('data/fields.ts'), 'F', modId, importIdRef, imports, runtimeImports)\n if (fields) fieldsImportName = fields.importName\n }\n\n const integrationExports = integrationImportName\n ? `(${integrationImportName} as unknown as { integrations?: import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]; integration?: import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition; bundles?: import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]; bundle?: import('@open-mercato/shared/modules/integrations/types').IntegrationBundle })`\n : null\n\n // 13. Pages: backend\n {\n const beApp = path.join(roots.appBase, 'backend')\n const bePkg = path.join(roots.pkgBase, 'backend')\n const beFiles = discovered.backendFiles\n if (beFiles.length) {\n const generatedBackendRoutes = await processPageFiles({\n files: beFiles,\n type: 'backend',\n modId,\n appDir: beApp,\n pkgDir: bePkg,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n eagerImports: imports,\n runtimeImports,\n manifestImports: backendRouteManifestImports,\n importIdRef,\n collectRoute: ({ routePath, fromApp }) => {\n backendRouteRegistrations.push({\n routePath,\n moduleId: modId,\n packageSourced: !fromApp && !isAppModule,\n })\n },\n quiet,\n })\n backendRoutes.push(...generatedBackendRoutes.eagerRoutes)\n runtimeBackendRoutes.push(...generatedBackendRoutes.runtimeRoutes)\n backendRouteManifestDecls.push(...generatedBackendRoutes.manifestRoutes)\n backendRouteShardEntries.push(...generatedBackendRoutes.manifestShardRoutes)\n backendRouteMetadataEntries.push(...generatedBackendRoutes.metadataRoutes)\n for (const pattern of generatedBackendRoutes.routePatterns) {\n assertUniqueBackendRoutePattern(seenBackendRoutePatterns, modId, pattern, isAppModule)\n }\n hasRouteComponents = true\n }\n }\n\n // 14. API routes\n {\n const generatedApis = await processApiRoutes({\n roots,\n modId,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n eagerImports: imports,\n importIdRef,\n })\n apis.push(...generatedApis.eagerApis)\n runtimeApis.push(...generatedApis.runtimeApis)\n apiRouteManifestDecls.push(...generatedApis.manifestApis)\n apiRouteShardEntries.push(...generatedApis.manifestShardApis)\n apiRouteMetadataEntries.push(...generatedApis.metadataApis)\n }\n\n // 15. CLI\n {\n const cliResolved = discovered.resolve('cli.ts')\n if (cliResolved) {\n const importName = `CLI_${toVar(modId)}`\n imports.push(buildImportStatement(importName, sanitizeGeneratedModuleSpecifier(cliResolved.importPath)))\n cliImportName = importName\n }\n }\n\n // 16. Translations\n translations.push(...processTranslationsAst({\n discovered: discovered.translations,\n modId,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n imports,\n extraImports: runtimeImports,\n }))\n\n // 17. Subscribers\n subscribers.push(...processSubscribersAst(await discovered.getSubscribers()))\n\n // 18. Workers\n const discoveredWorkersForModule = await discovered.getWorkers()\n if (workersDeclareAbandonHook(discoveredWorkersForModule)) hasAbandonHookWorkers = true\n workers.push(...processWorkersAst(discoveredWorkersForModule))\n\n // Build combined customFieldSets expression\n {\n const parts: string[] = []\n if (fieldsImportName)\n parts.push(`(( ${fieldsImportName}.default ?? ${fieldsImportName}.fieldSets) as any) || []`)\n if (customEntitiesImportName)\n parts.push(\n `((( ${customEntitiesImportName}.default ?? ${customEntitiesImportName}.entities) as any) || []).filter((e: any) => Array.isArray(e.fields) && e.fields.length).map((e: any) => ({ entity: e.id, fields: e.fields, source: ${toLiteral(modId)} }))`\n )\n customFieldSetsExpr = parts.length ? `[...${parts.join(', ...')}]` : '[]'\n }\n\n // 19. Dashboard widgets\n {\n for (const entry of discovered.dashboardWidgetEntries) {\n dashboardWidgets.push(\n `{ moduleId: ${toLiteral(entry.moduleId)}, key: ${toLiteral(entry.key)}, source: ${toLiteral(entry.source)}, loader: () => ${buildDynamicImportExpression(entry.importPath)}.then((mod) => mod.default ?? mod) }`\n )\n }\n }\n\n const identityEntries: GeneratedObjectEntry[] = [{ name: 'id', value: modId }]\n if (infoImportName) {\n identityEntries.push({ name: 'info', value: propertyAccess(identifier(infoImportName), 'metadata') })\n }\n\n const sharedTailEntries: GeneratedObjectEntry[] = []\n if (translations.length > 0) {\n sharedTailEntries.push({ name: 'translations', value: objectLiteral(translations) })\n }\n if (subscribers.length > 0) {\n sharedTailEntries.push({ name: 'subscribers', value: arrayLiteral(subscribers, writeValue) })\n }\n if (workers.length > 0) {\n sharedTailEntries.push({ name: 'workers', value: arrayLiteral(workers, writeValue) })\n }\n if (extensionsImportName) {\n sharedTailEntries.push({\n name: 'entityExtensions',\n value: buildLegacyModuleListValue({\n importName: extensionsImportName,\n members: ['default', 'extensions'],\n castType: \"import('@open-mercato/shared/modules/entities').EntityExtension[]\",\n }),\n })\n }\n sharedTailEntries.push({ name: 'customFieldSets', value: identifier(customFieldSetsExpr) })\n if (featuresImportName) {\n sharedTailEntries.push({\n name: 'features',\n value: buildLegacyModuleListValue({\n importName: featuresImportName,\n members: ['default', 'features'],\n castType: 'any',\n }),\n })\n }\n if (customEntitiesImportName) {\n sharedTailEntries.push({\n name: 'customEntities',\n value: buildLegacyModuleListValue({\n importName: customEntitiesImportName,\n members: ['default', 'entities'],\n castType: 'any',\n }),\n })\n }\n\n const setupAndBeyondEntries: GeneratedObjectEntry[] = []\n if (setupImportName) {\n setupAndBeyondEntries.push({ name: 'setup', value: buildLegacyModuleSetupValue(setupImportName) })\n }\n if (moduleRuntimeImportName) {\n setupAndBeyondEntries.push({ name: 'runtime', value: buildLegacyModuleRuntimeValue(moduleRuntimeImportName) })\n }\n if (encryptionImportName) {\n setupAndBeyondEntries.push({\n name: 'defaultEncryptionMaps',\n value: buildLegacyModuleListValue({\n importName: encryptionImportName,\n members: ['default', 'defaultEncryptionMaps'],\n castType: \"import('@open-mercato/shared/modules/encryption').ModuleEncryptionMap[]\",\n }),\n })\n }\n if (integrationExports) {\n setupAndBeyondEntries.push({\n name: 'integrations',\n value: buildLegacyIntegrationListValue(\n integrationExports,\n 'integrations',\n 'integration',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]\",\n ),\n })\n setupAndBeyondEntries.push({\n name: 'bundles',\n value: buildLegacyIntegrationListValue(\n integrationExports,\n 'bundles',\n 'bundle',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]\",\n ),\n })\n }\n\n const eagerEntries: GeneratedObjectEntry[] = [...identityEntries]\n if (frontendRoutes.length > 0) {\n eagerEntries.push({ name: 'frontendRoutes', value: preRenderedExpressionList(frontendRoutes) })\n }\n if (backendRoutes.length > 0) {\n eagerEntries.push({ name: 'backendRoutes', value: preRenderedExpressionList(backendRoutes) })\n }\n if (apis.length > 0) {\n eagerEntries.push({ name: 'apis', value: preRenderedExpressionList(apis) })\n }\n if (cliImportName) {\n eagerEntries.push({ name: 'cli', value: identifier(cliImportName) })\n }\n eagerEntries.push(...sharedTailEntries)\n if (dashboardWidgets.length > 0) {\n eagerEntries.push({ name: 'dashboardWidgets', value: preRenderedExpressionList(dashboardWidgets) })\n }\n eagerEntries.push(...setupAndBeyondEntries)\n moduleDecls.push(objectLiteral(eagerEntries))\n\n const runtimeEntries: GeneratedObjectEntry[] = [...identityEntries]\n if (runtimeFrontendRoutes.length > 0) {\n runtimeEntries.push({ name: 'frontendRoutes', value: preRenderedExpressionList(runtimeFrontendRoutes) })\n }\n if (runtimeBackendRoutes.length > 0) {\n runtimeEntries.push({ name: 'backendRoutes', value: preRenderedExpressionList(runtimeBackendRoutes) })\n }\n if (runtimeApis.length > 0) {\n runtimeEntries.push({ name: 'apis', value: preRenderedExpressionList(runtimeApis) })\n }\n runtimeEntries.push(...sharedTailEntries, ...setupAndBeyondEntries)\n runtimeModuleDecls.push(objectLiteral(runtimeEntries))\n }\n\n // === UMES Conflict Detection ===\n {\n const { detectConflicts } = await import('@open-mercato/shared/lib/umes/conflict-detection')\n const componentOverrideInputs: Array<{ moduleId: string; componentId: string; priority: number }> = []\n const interceptorInputs: Array<{ moduleId: string; id: string; targetRoute: string; methods: string[]; priority: number }> = []\n const declaredFeatures = new Set<string>()\n const gatedExtensions: Array<{ moduleId: string; extensionId: string; features: string[] }> = []\n\n for (const source of umesConflictSources) {\n // Collect declared features from acl.ts\n if (source.aclPath) {\n try {\n const aclMod = await import(buildCacheBustedSourceImportUrl(source.aclPath))\n const features = aclMod.features ?? aclMod.default ?? []\n if (Array.isArray(features)) {\n for (const feat of features) {\n if (typeof feat === 'string') declaredFeatures.add(feat)\n else if (feat?.id) declaredFeatures.add(feat.id)\n }\n }\n } catch {}\n }\n\n // Collect component overrides\n if (source.componentOverridesPath) {\n try {\n const overridesMod = await import(buildCacheBustedSourceImportUrl(source.componentOverridesPath))\n const overrides = overridesMod.componentOverrides ?? overridesMod.default ?? []\n if (Array.isArray(overrides)) {\n for (const override of overrides) {\n const componentId = override?.target?.componentId\n const priority = override?.priority ?? 0\n if (componentId) {\n componentOverrideInputs.push({ moduleId: source.moduleId, componentId, priority })\n }\n const features = override?.features\n if (Array.isArray(features) && features.length > 0) {\n gatedExtensions.push({\n moduleId: source.moduleId,\n extensionId: `component-override:${componentId}`,\n features,\n })\n }\n }\n }\n } catch {}\n }\n\n // Collect interceptors\n if (source.interceptorsPath) {\n try {\n const interceptorsMod = await import(buildCacheBustedSourceImportUrl(source.interceptorsPath))\n const interceptors = interceptorsMod.interceptors ?? interceptorsMod.default ?? []\n if (Array.isArray(interceptors)) {\n for (const interceptor of interceptors) {\n if (interceptor?.id && interceptor?.targetRoute) {\n interceptorInputs.push({\n moduleId: source.moduleId,\n id: interceptor.id,\n targetRoute: interceptor.targetRoute,\n methods: interceptor.methods ?? [],\n priority: interceptor.priority ?? 0,\n })\n }\n const features = interceptor?.features\n if (Array.isArray(features) && features.length > 0) {\n gatedExtensions.push({\n moduleId: source.moduleId,\n extensionId: `interceptor:${interceptor.id}`,\n features,\n })\n }\n }\n }\n } catch {}\n }\n }\n\n const conflictResult = detectConflicts({\n componentOverrides: componentOverrideInputs,\n interceptors: interceptorInputs,\n gatedExtensions,\n declaredFeatures,\n })\n\n for (const warning of conflictResult.warnings) {\n console.warn(`\\x1b[33m[UMES Warning]\\x1b[0m ${warning.message}`)\n }\n for (const error of conflictResult.errors) {\n console.error(`\\x1b[31m[UMES Error]\\x1b[0m ${error.message}`)\n }\n if (conflictResult.errors.length > 0) {\n throw new Error(\n `UMES conflict detection found ${conflictResult.errors.length} error(s). Fix conflicts before proceeding.`\n )\n }\n }\n\n // Backend route collision detection: duplicate paths between package modules are\n // always a bug (one silently shadows the other at runtime); app-module shadowing\n // of a package page is the supported override mechanism and only logs a note.\n {\n const collisionResult = detectBackendRouteCollisions(backendRouteRegistrations)\n for (const note of collisionResult.notes) {\n if (!quiet) console.log(`[Route Shadow] ${note}`)\n }\n if (collisionResult.errors.length > 0) {\n for (const error of collisionResult.errors) {\n console.error(`\\x1b[31m[Route Collision]\\x1b[0m ${error}`)\n }\n throw new Error(\n `Backend route collision detection found ${collisionResult.errors.length} duplicate path(s) registered by multiple package modules. Rename the colliding page directories before proceeding.`\n )\n }\n }\n\n const output = renderAstModuleRegistryFile({\n fileName: 'modules.generated.ts',\n generator: 'registry',\n imports,\n moduleEntries: moduleDecls,\n includeCreateElementImport: hasRouteComponents,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const runtimeOutput = renderAstModuleRegistryFile({\n fileName: 'modules.runtime.generated.ts',\n generator: 'registry',\n imports: runtimeImports,\n moduleEntries: runtimeModuleDecls,\n includeCreateElementImport: true,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const frontendRoutesOutput = renderAstManifestFile({\n fileName: 'frontend-routes.generated.ts',\n typeName: 'FrontendRouteManifestEntry',\n exportName: 'frontendRoutes',\n imports: frontendRouteManifestImports,\n entries: frontendRouteManifestDecls,\n })\n const backendRoutesOutput = renderAstManifestFile({\n fileName: 'backend-routes.generated.ts',\n typeName: 'BackendRouteManifestEntry',\n exportName: 'backendRoutes',\n imports: backendRouteManifestImports,\n entries: backendRouteManifestDecls,\n })\n const apiRoutesOutput = renderAstManifestFile({\n fileName: 'api-routes.generated.ts',\n typeName: 'ApiRouteManifestEntry',\n exportName: 'apiRoutes',\n entries: apiRouteManifestDecls,\n })\n const routeManifestOutputs = [\n ...renderRouteManifestShardOutputs('backend', backendRouteShardEntries),\n ...renderRouteManifestShardOutputs('api', apiRouteShardEntries),\n renderRouteMetadataOutput('backend', backendRouteMetadataEntries),\n renderRouteMetadataOutput('api', apiRouteMetadataEntries),\n ]\n const legacySubscribersOutput = renderAstLegacyAliasFile({\n fileName: 'subscribers.generated.ts',\n exportName: 'moduleSubscribers',\n exportType: \"NonNullable<Module['subscribers']>\",\n sourceFileName: 'modules.runtime.generated.ts',\n initializer: methodCall(identifier('modules'), 'flatMap', [\n arrowFunction({\n parameters: ['module'],\n body: parenthesized(\n nullishCoalesce([\n propertyAccess(identifier('module'), 'subscribers'),\n emptyArray(),\n ]),\n ),\n }),\n ]),\n })\n // Validate module dependencies declared via ModuleInfo.requires\n {\n const enabledIds = new Set(enabled.map((e) => e.id))\n const problems: string[] = []\n for (const [modId, reqs] of requiresByModule.entries()) {\n const missing = reqs.filter((r) => !enabledIds.has(r))\n if (missing.length) {\n problems.push(`- Module \"${modId}\" requires: ${missing.join(', ')}`)\n }\n }\n if (problems.length) {\n console.error('\\nModule dependency check failed:')\n for (const p of problems) console.error(p)\n console.error('\\nFix: Enable required module(s) in src/modules.ts. Example:')\n console.error(\n ' export const enabledModules = [ { id: \\'' +\n Array.from(new Set(requiresByModule.values()).values()).join(\"' }, { id: '\") +\n \"' } ]\"\n )\n process.exit(1)\n }\n }\n\n const structureChecksum = discovery.getStructureChecksum()\n\n writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: runtimeOutFile, checksumFile: runtimeChecksumFile, content: runtimeOutput, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: frontendRoutesOutFile, checksumFile: frontendRoutesChecksumFile, content: frontendRoutesOutput, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: backendRoutesOutFile, checksumFile: backendRoutesChecksumFile, content: backendRoutesOutput, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: apiRoutesOutFile, checksumFile: apiRoutesChecksumFile, content: apiRoutesOutput, structureChecksum, result, quiet })\n const expectedRouteManifestFiles = new Set(routeManifestOutputs.flatMap(({ fileName }) => [\n fileName,\n fileName.replace(/\\.ts$/, '.checksum'),\n ]))\n if (fs.existsSync(outputDir)) {\n for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {\n if (!entry.isFile() || !routeManifestShardFilePattern.test(entry.name)) continue\n if (expectedRouteManifestFiles.has(entry.name)) continue\n const stalePath = path.join(outputDir, entry.name)\n fs.unlinkSync(stalePath)\n result.filesWritten.push(stalePath)\n }\n }\n for (const routeOutput of routeManifestOutputs) {\n writeGeneratedFile({\n outFile: path.join(outputDir, routeOutput.fileName),\n checksumFile: path.join(outputDir, routeOutput.fileName.replace(/\\.ts$/, '.checksum')),\n content: routeOutput.content,\n structureChecksum,\n result,\n quiet,\n })\n }\n writeGeneratedFile({ outFile: legacySubscribersOutFile, checksumFile: legacySubscribersChecksumFile, content: legacySubscribersOutput, structureChecksum, result, quiet })\n const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries)\n writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet })\n\n for (const extension of extensions) {\n const outputs = extension.generateOutput()\n for (const [fileName, content] of outputs) {\n writeGeneratedFile({\n outFile: path.join(outputDir, fileName),\n checksumFile: path.join(outputDir, fileName.replace('.ts', '.checksum')),\n content,\n structureChecksum,\n result,\n quiet,\n })\n }\n }\n\n // Generator plugin outputs (registered via modules' generators.ts)\n for (const [pluginId, plugin] of pluginRegistry) {\n const state = pluginState.get(pluginId)!\n const importSection = state.imports.join('\\n')\n const entriesLiteral = state.configs.join(',\\n ')\n const content = plugin.buildOutput({ importSection, entriesLiteral })\n const outFile = path.join(outputDir, pluginOutputNames.get(pluginId)!)\n const checksumFile = outFile.replace(/\\.ts$/, '.checksum')\n writeGeneratedFile({ outFile, checksumFile, content, structureChecksum, result, quiet })\n }\n reconcileGeneratorPluginOutputs({\n outputDir,\n outputNames: pluginOutputNames.values(),\n result,\n })\n\n // Bootstrap registrations: aggregate core registrations + plugin bootstrap-registration hooks\n // into one file. Always written (with at least the core backend route registration) so bootstrap.ts\n // can unconditionally import it and every runtime consumer sees a populated route manifest\n // regardless of Next.js server bundle isolation.\n {\n const bootstrapPlugins = [...pluginRegistry.values()].filter((p) => p.bootstrapRegistration)\n const allEntryImports: string[] = [\n buildImportStatement(`{ backendRouteFacades }`, `./backend-route-shards.generated`),\n buildImportStatement(`{ frontendRoutes }`, `./frontend-routes.generated`),\n ]\n const allRegImports: string[] = [\n `import { registerBackendRouteManifests, registerFrontendRouteManifests } from '@open-mercato/shared/modules/registry'`,\n ]\n const allCalls: string[] = [\n `registerBackendRouteManifests(backendRouteFacades)`,\n `registerFrontendRouteManifests(frontendRoutes)`,\n ]\n for (const plugin of bootstrapPlugins) {\n const reg = plugin.bootstrapRegistration!\n const outputBase = plugin.outputFileName.replace('.ts', '')\n allEntryImports.push(buildImportStatement(`{ ${reg.entriesExportName} }`, `./${outputBase}`))\n allRegImports.push(...reg.registrationImports)\n allCalls.push(reg.buildCall(reg.entriesExportName))\n }\n const bootstrapRegsOutput = renderBootstrapRegistrationsFile({\n entryImports: allEntryImports,\n registrationImports: allRegImports,\n calls: allCalls,\n })\n writeGeneratedFile({ outFile: bootstrapRegsOutFile, checksumFile: bootstrapRegsChecksumFile, content: bootstrapRegsOutput, structureChecksum, result, quiet })\n }\n\n return result\n}\n\nasync function generateModuleRegistryAppFromDiscovery(options: ModuleRegistryRenderOptions): Promise<GeneratorResult> {\n const { resolver, quiet = false } = options\n const { discovery } = options\n const result = createGeneratorResult()\n\n const outputDir = resolver.getOutputDir()\n const outFile = path.join(outputDir, 'modules.app.generated.ts')\n const checksumFile = path.join(outputDir, 'modules.app.generated.checksum')\n const bootstrapOutFile = path.join(outputDir, 'modules.bootstrap.generated.ts')\n const bootstrapChecksumFile = path.join(outputDir, 'modules.bootstrap.generated.checksum')\n const i18nOutFile = path.join(outputDir, 'modules.i18n.generated.ts')\n const i18nChecksumFile = path.join(outputDir, 'modules.i18n.generated.checksum')\n const i18nLoadersOutFile = path.join(outputDir, 'modules.i18n.loaders.generated.ts')\n const i18nLoadersChecksumFile = path.join(outputDir, 'modules.i18n.loaders.generated.checksum')\n const legacyOutFile = path.join(outputDir, 'bootstrap-modules.generated.ts')\n const legacyChecksumFile = path.join(outputDir, 'bootstrap-modules.generated.checksum')\n const enabledIdsOutFile = path.join(outputDir, 'enabled-module-ids.generated.ts')\n const enabledIdsChecksumFile = path.join(outputDir, 'enabled-module-ids.generated.checksum')\n const commandLoadersOutFile = path.join(outputDir, 'command-loaders.generated.ts')\n const commandLoadersChecksumFile = path.join(outputDir, 'command-loaders.generated.checksum')\n\n const enabled = discovery.enabled\n const imports: string[] = []\n const bootstrapImports: string[] = []\n const i18nImports: string[] = []\n const moduleDecls: WriterFunction[] = []\n const bootstrapModuleDecls: WriterFunction[] = []\n const i18nModuleDecls: WriterFunction[] = []\n const i18nLocaleShards = new Map<string, { imports: string[]; moduleDecls: WriterFunction[] }>()\n const importIdRef = { value: 0 }\n const requiresByModule = new Map<string, string[]>()\n const commandLoaderEntries: CommandLoaderGenerationEntry[] = []\n let hasRouteComponents = false\n let hasAbandonHookWorkers = false\n const seenBackendRoutePatterns = new Map<string, BackendRoutePatternOwner>()\n\n for (const discovered of discovery.modules) {\n const { modId, roots, imps, appImportBase, isAppModule } = discovered\n commandLoaderEntries.push(...discovered.commandLoaderEntries)\n\n const frontendRoutes: WriterFunction[] = []\n const backendRoutes: WriterFunction[] = []\n const translations: GeneratedObjectEntry[] = []\n const localeTranslations = new Map<string, { imports: string[]; value: WriterFunction }>()\n const subscribers: WriterFunction[] = []\n const workers: WriterFunction[] = []\n let infoImportName: string | null = null\n let extensionsImportName: string | null = null\n let fieldsImportName: string | null = null\n let featuresImportName: string | null = null\n let customEntitiesImportName: string | null = null\n let dashboardWidgetsValue: WriterFunction = emptyArray()\n let setupImportName: string | null = null\n let moduleRuntimeImportName: string | null = null\n let encryptionImportName: string | null = null\n let integrationImportName: string | null = null\n\n const indexResolved = discovered.resolve('index.ts')\n if (indexResolved) {\n infoImportName = `I${importIdRef.value++}_${toVar(modId)}`\n const importPath = sanitizeGeneratedModuleSpecifier(indexResolved.importPath)\n imports.push(buildImportStatement(`* as ${infoImportName}`, importPath))\n bootstrapImports.push(buildImportStatement(`* as ${infoImportName}`, importPath))\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const mod = require(indexResolved.absolutePath)\n const reqs: string[] | undefined =\n mod?.metadata && Array.isArray(mod.metadata.requires) ? mod.metadata.requires : undefined\n if (reqs && reqs.length) requiresByModule.set(modId, reqs)\n } catch {}\n }\n\n {\n const setup = resolveConventionFile(discovered.resolve('setup.ts'), 'SETUP', modId, importIdRef, imports)\n if (setup) bootstrapImports.push(buildImportStatement(`* as ${setup.importName}`, setup.importPath))\n if (setup) setupImportName = setup.importName\n }\n\n // Module runtime: runtime.ts (SPEC-072)\n {\n const moduleRuntime = resolveConventionFile(discovered.resolve('runtime.ts'), 'RUNTIME', modId, importIdRef, imports)\n if (moduleRuntime) bootstrapImports.push(buildImportStatement(`* as ${moduleRuntime.importName}`, moduleRuntime.importPath))\n if (moduleRuntime) moduleRuntimeImportName = moduleRuntime.importName\n }\n\n {\n const encryption = resolveConventionFile(discovered.resolve('encryption.ts'), 'ENCRYPTION', modId, importIdRef, imports)\n if (encryption) bootstrapImports.push(buildImportStatement(`* as ${encryption.importName}`, encryption.importPath))\n if (encryption) encryptionImportName = encryption.importName\n }\n\n {\n const resolved = discovered.resolve('integration.ts')\n if (resolved) {\n const importName = `INTEGRATION_${toVar(modId)}_${importIdRef.value++}`\n imports.push(buildImportStatement(`* as ${importName}`, resolved.importPath))\n bootstrapImports.push(buildImportStatement(`* as ${importName}`, resolved.importPath))\n integrationImportName = importName\n }\n }\n\n {\n const ext = resolveConventionFile(discovered.resolve('data/extensions.ts'), 'X', modId, importIdRef, imports, bootstrapImports)\n if (ext) extensionsImportName = ext.importName\n }\n\n {\n const aclResolved = discovered.resolve('acl.ts')\n if (aclResolved) {\n const importName = `ACL_${toVar(modId)}_${importIdRef.value++}`\n const importPath = sanitizeGeneratedModuleSpecifier(aclResolved.importPath)\n imports.push(buildImportStatement(`* as ${importName}`, importPath))\n bootstrapImports.push(buildImportStatement(`* as ${importName}`, importPath))\n featuresImportName = importName\n }\n }\n\n {\n const ce = resolveConventionFile(discovered.resolve('ce.ts'), 'CE', modId, importIdRef, imports, bootstrapImports)\n if (ce) customEntitiesImportName = ce.importName\n }\n\n {\n const fields = resolveConventionFile(discovered.resolve('data/fields.ts'), 'F', modId, importIdRef, imports, bootstrapImports)\n if (fields) fieldsImportName = fields.importName\n }\n\n {\n const feApp = path.join(roots.appBase, 'frontend')\n const fePkg = path.join(roots.pkgBase, 'frontend')\n const feFiles = discovered.frontendFiles\n if (feFiles.length > 0) {\n const feAst = await processPageFilesAst({\n files: feFiles,\n type: 'frontend',\n modId,\n appDir: feApp,\n pkgDir: fePkg,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n imports,\n importIdRef,\n quiet,\n })\n frontendRoutes.push(...feAst.routes)\n hasRouteComponents = true\n }\n }\n\n {\n const beApp = path.join(roots.appBase, 'backend')\n const bePkg = path.join(roots.pkgBase, 'backend')\n const beFiles = discovered.backendFiles\n if (beFiles.length > 0) {\n const beAst = await processPageFilesAst({\n files: beFiles,\n type: 'backend',\n modId,\n appDir: beApp,\n pkgDir: bePkg,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n imports,\n importIdRef,\n quiet,\n })\n backendRoutes.push(...beAst.routes)\n for (const pattern of beAst.routePatterns) {\n assertUniqueBackendRoutePattern(seenBackendRoutePatterns, modId, pattern, isAppModule)\n }\n hasRouteComponents = true\n }\n }\n\n const translationImports: string[] = []\n translations.push(...processTranslationsAst({\n discovered: discovered.translations,\n modId,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n imports,\n extraImports: translationImports,\n localeOutputs: localeTranslations,\n }))\n i18nImports.push(...translationImports)\n for (const [locale, localeTranslation] of localeTranslations) {\n const shard = i18nLocaleShards.get(locale) ?? { imports: [], moduleDecls: [] }\n shard.imports.push(...localeTranslation.imports)\n shard.moduleDecls.push(objectLiteral([\n { name: 'id', value: modId },\n {\n name: 'translations',\n value: objectLiteral([{\n name: JSON.stringify(locale),\n value: localeTranslation.value,\n }]),\n },\n ]))\n i18nLocaleShards.set(locale, shard)\n }\n\n subscribers.push(...processSubscribersAst(await discovered.getSubscribers()))\n\n const discoveredWorkersForModule = await discovered.getWorkers()\n if (workersDeclareAbandonHook(discoveredWorkersForModule)) hasAbandonHookWorkers = true\n workers.push(...processWorkersAst(discoveredWorkersForModule))\n\n {\n dashboardWidgetsValue = buildModuleDashboardWidgetsValue(discovered.dashboardWidgetEntries)\n }\n\n const moduleEntries: GeneratedObjectEntry[] = [\n { name: 'id', value: modId },\n { name: 'customFieldSets', value: buildModuleCustomFieldSetsValue({ fieldsImportName, customEntitiesImportName, moduleId: modId }) },\n ]\n const i18nModuleEntries: GeneratedObjectEntry[] = [\n { name: 'id', value: modId },\n ]\n\n if (infoImportName) {\n moduleEntries.push({ name: 'info', value: propertyAccess(identifier(infoImportName), 'metadata') })\n }\n if (translations.length > 0) {\n moduleEntries.push({ name: 'translations', value: objectLiteral(translations) })\n i18nModuleEntries.push({ name: 'translations', value: objectLiteral(translations) })\n }\n if (subscribers.length > 0) {\n moduleEntries.push({ name: 'subscribers', value: arrayLiteral(subscribers, writeValue) })\n }\n if (workers.length > 0) {\n moduleEntries.push({ name: 'workers', value: arrayLiteral(workers, writeValue) })\n }\n if (extensionsImportName) {\n moduleEntries.push({\n name: 'entityExtensions',\n value: namespaceFallback({\n importName: extensionsImportName,\n members: ['default', 'extensions'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n if (featuresImportName) {\n moduleEntries.push({\n name: 'features',\n value: namespaceFallback({\n importName: featuresImportName,\n members: ['default', 'features'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n if (customEntitiesImportName) {\n moduleEntries.push({\n name: 'customEntities',\n value: namespaceFallback({\n importName: customEntitiesImportName,\n members: ['default', 'entities'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n moduleEntries.push({ name: 'dashboardWidgets', value: dashboardWidgetsValue })\n if (setupImportName) {\n moduleEntries.push({\n name: 'setup',\n value: namespaceFallback({\n importName: setupImportName,\n members: ['default', 'setup'],\n fallback: identifier('undefined'),\n }),\n })\n }\n if (moduleRuntimeImportName) {\n moduleEntries.push({\n name: 'runtime',\n value: namespaceFallback({\n importName: moduleRuntimeImportName,\n members: ['default', 'runtime'],\n fallback: identifier('undefined'),\n }),\n })\n }\n if (encryptionImportName) {\n moduleEntries.push({\n name: 'defaultEncryptionMaps',\n value: namespaceFallback({\n importName: encryptionImportName,\n members: ['default', 'defaultEncryptionMaps'],\n fallback: emptyArray(),\n castType: \"Module['defaultEncryptionMaps']\",\n }),\n })\n }\n if (integrationImportName) {\n moduleEntries.push({\n name: 'integrations',\n value: buildModuleIntegrationListValue(\n integrationImportName,\n 'integrations',\n 'integration',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]\",\n ),\n })\n moduleEntries.push({\n name: 'bundles',\n value: buildModuleIntegrationListValue(\n integrationImportName,\n 'bundles',\n 'bundle',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]\",\n ),\n })\n }\n\n const routeAwareModuleEntries = [...moduleEntries]\n if (frontendRoutes.length > 0) {\n routeAwareModuleEntries.push({ name: 'frontendRoutes', value: arrayLiteral(frontendRoutes, writeValue) })\n }\n if (backendRoutes.length > 0) {\n routeAwareModuleEntries.push({ name: 'backendRoutes', value: arrayLiteral(backendRoutes, writeValue) })\n }\n\n moduleDecls.push(objectLiteral(routeAwareModuleEntries))\n bootstrapModuleDecls.push(objectLiteral(moduleEntries.filter(\n (entry) => entry.kind === 'spread' || entry.name !== 'translations',\n )))\n i18nModuleDecls.push(objectLiteral(i18nModuleEntries))\n }\n\n const output = renderAstModuleRegistryFile({\n fileName: 'modules.app.generated.ts',\n generator: 'registry (app version)',\n imports,\n moduleEntries: moduleDecls,\n includeCreateElementImport: hasRouteComponents,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const bootstrapOutput = renderAstModuleRegistryFile({\n fileName: 'modules.bootstrap.generated.ts',\n generator: 'registry (bootstrap version)',\n imports: bootstrapImports,\n moduleEntries: bootstrapModuleDecls,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const i18nOutput = renderAstModuleRegistryFile({\n fileName: 'modules.i18n.generated.ts',\n generator: 'registry (i18n version)',\n imports: i18nImports,\n moduleEntries: i18nModuleDecls,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const legacyOutput = renderAstLegacyAliasFile({\n fileName: 'bootstrap-modules.generated.ts',\n exportName: 'bootstrapModules',\n exportType: 'Module[]',\n sourceFileName: 'modules.bootstrap.generated.ts',\n initializer: identifier('modules'),\n })\n\n {\n const enabledIds = new Set(enabled.map((e) => e.id))\n const problems: string[] = []\n for (const [modId, reqs] of requiresByModule.entries()) {\n const missing = reqs.filter((r) => !enabledIds.has(r))\n if (missing.length) {\n problems.push(`- Module \"${modId}\" requires: ${missing.join(', ')}`)\n }\n }\n if (problems.length) {\n console.error('\\nModule dependency check failed:')\n for (const p of problems) console.error(p)\n console.error('\\nFix: Enable required module(s) in src/modules.ts. Example:')\n console.error(\n ' export const enabledModules = [ { id: \\'' +\n Array.from(new Set(requiresByModule.values()).values()).join(\"' }, { id: '\") +\n \"' } ]\"\n )\n process.exit(1)\n }\n }\n\n const structureChecksum = discovery.getStructureChecksum()\n writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: bootstrapOutFile, checksumFile: bootstrapChecksumFile, content: bootstrapOutput, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: i18nOutFile, checksumFile: i18nChecksumFile, content: i18nOutput, structureChecksum, result, quiet })\n const i18nLocales = [...i18nLocaleShards.keys()].sort((a, b) => a.localeCompare(b))\n const shardFileNames = new Set<string>()\n const expectedShardArtifacts = new Set<string>()\n for (const locale of i18nLocales) {\n const fileName = buildI18nLocaleShardFileName(locale)\n if (shardFileNames.has(fileName)) {\n throw new Error(`Locale names produce the same generated i18n shard file: ${locale}`)\n }\n shardFileNames.add(fileName)\n expectedShardArtifacts.add(fileName)\n expectedShardArtifacts.add(fileName.replace(/\\.ts$/, '.checksum'))\n const shard = i18nLocaleShards.get(locale)!\n const content = renderAstI18nLocaleRegistryFile({\n fileName,\n imports: shard.imports,\n moduleEntries: shard.moduleDecls,\n })\n writeGeneratedFile({\n outFile: path.join(outputDir, fileName),\n checksumFile: path.join(outputDir, fileName.replace(/\\.ts$/, '.checksum')),\n content,\n structureChecksum,\n result,\n quiet,\n })\n }\n removeStaleI18nLocaleShards(outputDir, expectedShardArtifacts)\n writeGeneratedFile({\n outFile: i18nLoadersOutFile,\n checksumFile: i18nLoadersChecksumFile,\n content: renderI18nLocaleLoadersFile(i18nLocales),\n structureChecksum,\n result,\n quiet,\n })\n writeGeneratedFile({ outFile: legacyOutFile, checksumFile: legacyChecksumFile, content: legacyOutput, structureChecksum, result, quiet })\n\n const enabledIdsOutput = renderEnabledModuleIdsFile(enabled.map((entry) => entry.id))\n writeGeneratedFile({ outFile: enabledIdsOutFile, checksumFile: enabledIdsChecksumFile, content: enabledIdsOutput, structureChecksum, result, quiet })\n\n const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries)\n writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet })\n\n return result\n}\n\n/**\n * Generate a CLI-specific module registry that excludes Next.js dependent code.\n * This produces modules.cli.generated.ts which can be loaded without Next.js runtime.\n *\n * Includes: module metadata, CLI commands, translations, subscribers, workers, entity extensions,\n * features/ACL, custom entities, vector config, custom fields, dashboard widgets\n * Excludes: frontend routes, backend routes, API handlers, injection widgets\n */\nasync function generateModuleRegistryCliFromDiscovery(options: ModuleRegistryRenderOptions): Promise<GeneratorResult> {\n let hasAbandonHookWorkers = false\n const { resolver, quiet = false } = options\n const { discovery } = options\n const result = createGeneratorResult()\n\n const outputDir = resolver.getOutputDir()\n const outFile = path.join(outputDir, 'modules.cli.generated.ts')\n const checksumFile = path.join(outputDir, 'modules.cli.generated.checksum')\n const legacyOutFile = path.join(outputDir, 'cli-modules.generated.ts')\n const legacyChecksumFile = path.join(outputDir, 'cli-modules.generated.checksum')\n const commandLoadersOutFile = path.join(outputDir, 'command-loaders.generated.ts')\n const commandLoadersChecksumFile = path.join(outputDir, 'command-loaders.generated.checksum')\n const devSupervisorOutFile = path.join(outputDir, DEV_SUPERVISOR_MANIFEST_FILE)\n const devSupervisorChecksumFile = path.join(outputDir, 'dev-supervisor.generated.checksum')\n\n const enabled = discovery.enabled\n const imports: string[] = []\n const moduleDecls: WriterFunction[] = []\n // Mutable ref so extracted helper functions can increment the shared counter\n const importIdRef = { value: 0 }\n const requiresByModule = new Map<string, string[]>()\n const commandLoaderEntries: CommandLoaderGenerationEntry[] = []\n const devSupervisorWorkers: DevSupervisorWorkerDescriptor[] = []\n let schedulerStartStatus: DevSupervisorSchedulerStartStatus = 'missing-module'\n let requiresFullBootstrap = enabled.some((entry) => entry.devSupervisorRequiresFullBootstrap === true)\n || appDeclaresProgrammaticDevSupervisorOverrides(resolver.getAppDir())\n\n for (const discovered of discovery.modules) {\n const { modId, imps, appImportBase } = discovered\n commandLoaderEntries.push(...discovered.commandLoaderEntries)\n\n let cliImportName: string | null = null\n const translations: GeneratedObjectEntry[] = []\n const subscribers: WriterFunction[] = []\n const workers: WriterFunction[] = []\n let infoImportName: string | null = null\n let extensionsImportName: string | null = null\n let fieldsImportName: string | null = null\n let featuresImportName: string | null = null\n let customEntitiesImportName: string | null = null\n let vectorImportName: string | null = null\n let dashboardWidgetsValue: WriterFunction = emptyArray()\n let setupImportName: string | null = null\n let moduleRuntimeImportName: string | null = null\n let encryptionImportName: string | null = null\n let integrationImportName: string | null = null\n\n // Module metadata: index.ts (overrideable)\n const indexResolved = discovered.resolve('index.ts')\n if (indexResolved) {\n infoImportName = `I${importIdRef.value++}_${toVar(modId)}`\n const importPath = sanitizeGeneratedModuleSpecifier(indexResolved.importPath)\n imports.push(buildImportStatement(`* as ${infoImportName}`, importPath))\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const mod = require(indexResolved.absolutePath)\n const reqs: string[] | undefined =\n mod?.metadata && Array.isArray(mod.metadata.requires) ? mod.metadata.requires : undefined\n if (reqs && reqs.length) requiresByModule.set(modId, reqs)\n } catch {}\n }\n\n // Module setup configuration: setup.ts\n {\n const setup = resolveConventionFile(discovered.resolve('setup.ts'), 'SETUP', modId, importIdRef, imports)\n if (setup) setupImportName = setup.importName\n }\n\n // Module runtime: runtime.ts (SPEC-072)\n {\n const moduleRuntime = resolveConventionFile(discovered.resolve('runtime.ts'), 'RUNTIME', modId, importIdRef, imports)\n if (moduleRuntime) moduleRuntimeImportName = moduleRuntime.importName\n }\n\n // Module encryption defaults: encryption.ts\n {\n const encryption = resolveConventionFile(discovered.resolve('encryption.ts'), 'ENCRYPTION', modId, importIdRef, imports)\n if (encryption) encryptionImportName = encryption.importName\n }\n\n // Integration manifest: integration.ts\n {\n const resolved = discovered.resolve('integration.ts')\n if (resolved) {\n const importName = `INTEGRATION_${toVar(modId)}_${importIdRef.value++}`\n imports.push(buildImportStatement(`* as ${importName}`, resolved.importPath))\n integrationImportName = importName\n }\n }\n\n // Entity extensions: data/extensions.ts\n {\n const ext = resolveConventionFile(discovered.resolve('data/extensions.ts'), 'X', modId, importIdRef, imports)\n if (ext) extensionsImportName = ext.importName\n }\n\n // RBAC: acl.ts\n {\n const aclResolved = discovered.resolve('acl.ts')\n if (aclResolved) {\n const importName = `ACL_${toVar(modId)}_${importIdRef.value++}`\n const importPath = sanitizeGeneratedModuleSpecifier(aclResolved.importPath)\n imports.push(buildImportStatement(`* as ${importName}`, importPath))\n featuresImportName = importName\n }\n }\n\n // Custom entities: ce.ts\n {\n const ce = resolveConventionFile(discovered.resolve('ce.ts'), 'CE', modId, importIdRef, imports)\n if (ce) customEntitiesImportName = ce.importName\n }\n\n // Vector search configuration: vector.ts\n {\n const vec = resolveConventionFile(discovered.resolve('vector.ts'), 'VECTOR', modId, importIdRef, imports)\n if (vec) vectorImportName = vec.importName\n }\n\n // Custom fields: data/fields.ts\n {\n const fields = resolveConventionFile(discovered.resolve('data/fields.ts'), 'F', modId, importIdRef, imports)\n if (fields) fieldsImportName = fields.importName\n }\n\n // CLI\n {\n if (modId === 'scheduler') schedulerStartStatus = 'missing-cli'\n const cliResolved = discovered.resolve('cli.ts')\n if (cliResolved) {\n const importName = `CLI_${toVar(modId)}`\n imports.push(buildImportStatement(importName, sanitizeGeneratedModuleSpecifier(cliResolved.importPath)))\n cliImportName = importName\n if (modId === 'scheduler') {\n if (sourceDeclaresCliCommand(cliResolved.absolutePath, 'start')) {\n schedulerStartStatus = 'ok'\n } else {\n schedulerStartStatus = 'missing-command'\n requiresFullBootstrap = true\n }\n }\n }\n }\n\n // Translations\n translations.push(...processTranslationsAst({\n discovered: discovered.translations,\n modId,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n imports,\n }))\n\n // Subscribers\n subscribers.push(...processSubscribersAst(await discovered.getSubscribers()))\n\n // Workers\n const discoveredWorkers = await discovered.getWorkers()\n const workerGenerationEntries = collectWorkerGenerationEntries(discoveredWorkers, modId)\n if (workersDeclareAbandonHook(discoveredWorkers)) hasAbandonHookWorkers = true\n workers.push(...processWorkersAst(discoveredWorkers))\n devSupervisorWorkers.push(...workerGenerationEntries.map(({ importPath: _importPath, ...worker }) => worker))\n\n // Dashboard widgets\n {\n dashboardWidgetsValue = buildModuleDashboardWidgetsValue(discovered.dashboardWidgetEntries)\n }\n\n const moduleEntries: GeneratedObjectEntry[] = [\n { name: 'id', value: modId },\n { name: 'customFieldSets', value: buildModuleCustomFieldSetsValue({ fieldsImportName, customEntitiesImportName, moduleId: modId }) },\n ]\n\n if (infoImportName) {\n moduleEntries.push({ name: 'info', value: propertyAccess(identifier(infoImportName), 'metadata') })\n }\n if (cliImportName) {\n moduleEntries.push({ name: 'cli', value: identifier(cliImportName) })\n }\n if (translations.length > 0) {\n moduleEntries.push({ name: 'translations', value: objectLiteral(translations) })\n }\n if (subscribers.length > 0) {\n moduleEntries.push({ name: 'subscribers', value: arrayLiteral(subscribers, writeValue) })\n }\n if (workers.length > 0) {\n moduleEntries.push({ name: 'workers', value: arrayLiteral(workers, writeValue) })\n }\n if (extensionsImportName) {\n moduleEntries.push({\n name: 'entityExtensions',\n value: namespaceFallback({\n importName: extensionsImportName,\n members: ['default', 'extensions'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n if (featuresImportName) {\n moduleEntries.push({\n name: 'features',\n value: namespaceFallback({\n importName: featuresImportName,\n members: ['default', 'features'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n if (customEntitiesImportName) {\n moduleEntries.push({\n name: 'customEntities',\n value: namespaceFallback({\n importName: customEntitiesImportName,\n members: ['default', 'entities'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n moduleEntries.push({ name: 'dashboardWidgets', value: dashboardWidgetsValue })\n if (vectorImportName) {\n moduleEntries.push({\n name: 'vector',\n value: namespaceFallback({\n importName: vectorImportName,\n members: ['default', 'vectorConfig', 'config'],\n fallback: identifier('undefined'),\n castType: \"Module['vector']\",\n }),\n })\n }\n if (setupImportName) {\n moduleEntries.push({\n name: 'setup',\n value: namespaceFallback({\n importName: setupImportName,\n members: ['default', 'setup'],\n fallback: identifier('undefined'),\n }),\n })\n }\n if (moduleRuntimeImportName) {\n moduleEntries.push({\n name: 'runtime',\n value: namespaceFallback({\n importName: moduleRuntimeImportName,\n members: ['default', 'runtime'],\n fallback: identifier('undefined'),\n }),\n })\n }\n if (encryptionImportName) {\n moduleEntries.push({\n name: 'defaultEncryptionMaps',\n value: namespaceFallback({\n importName: encryptionImportName,\n members: ['default', 'defaultEncryptionMaps'],\n fallback: emptyArray(),\n castType: \"Module['defaultEncryptionMaps']\",\n }),\n })\n }\n if (integrationImportName) {\n moduleEntries.push({\n name: 'integrations',\n value: buildModuleIntegrationListValue(\n integrationImportName,\n 'integrations',\n 'integration',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]\",\n ),\n })\n moduleEntries.push({\n name: 'bundles',\n value: buildModuleIntegrationListValue(\n integrationImportName,\n 'bundles',\n 'bundle',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]\",\n ),\n })\n }\n\n moduleDecls.push(objectLiteral(moduleEntries))\n }\n\n const output = renderAstModuleRegistryFile({\n fileName: 'modules.cli.generated.ts',\n generator: 'registry (CLI version)',\n imports,\n moduleEntries: moduleDecls,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const legacyOutput = renderAstLegacyAliasFile({\n fileName: 'cli-modules.generated.ts',\n exportName: 'cliModules',\n exportType: \"Pick<Module, 'id' | 'cli'>[]\",\n sourceFileName: 'modules.cli.generated.ts',\n initializer: methodCall(identifier('modules'), 'map', [\n arrowFunction({\n parameters: ['{ id, cli }'],\n body: parenthesized(objectLiteral([\n { name: 'id', value: identifier('id') },\n { name: 'cli', value: identifier('cli') },\n ])),\n }),\n ]),\n })\n\n // Validate module dependencies declared via ModuleInfo.requires\n {\n const enabledIds = new Set(enabled.map((e) => e.id))\n const problems: string[] = []\n for (const [modId, reqs] of requiresByModule.entries()) {\n const missing = reqs.filter((r) => !enabledIds.has(r))\n if (missing.length) {\n problems.push(`- Module \"${modId}\" requires: ${missing.join(', ')}`)\n }\n }\n if (problems.length) {\n console.error('\\nModule dependency check failed:')\n for (const p of problems) console.error(p)\n console.error('\\nFix: Enable required module(s) in src/modules.ts. Example:')\n console.error(\n ' export const enabledModules = [ { id: \\'' +\n Array.from(new Set(requiresByModule.values()).values()).join(\"' }, { id: '\") +\n \"' } ]\"\n )\n process.exit(1)\n }\n }\n\n const structureChecksum = discovery.getStructureChecksum()\n writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: legacyOutFile, checksumFile: legacyChecksumFile, content: legacyOutput, structureChecksum, result, quiet })\n const devSupervisorOutput = `${JSON.stringify({\n version: DEV_SUPERVISOR_MANIFEST_VERSION,\n workers: devSupervisorWorkers,\n schedulerStartStatus,\n requiresFullBootstrap,\n }, null, 2)}\\n`\n writeGeneratedFile({\n outFile: devSupervisorOutFile,\n checksumFile: devSupervisorChecksumFile,\n content: devSupervisorOutput,\n structureChecksum,\n result,\n quiet,\n })\n const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries)\n writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet })\n\n return result\n}\n\nexport async function generateModuleRegistry(options: ModuleRegistryOptions): Promise<GeneratorResult> {\n const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)\n return generateModuleRegistryFromDiscovery({ ...options, discovery })\n}\n\nexport async function generateModuleRegistryApp(options: ModuleRegistryOptions): Promise<GeneratorResult> {\n const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)\n return generateModuleRegistryAppFromDiscovery({ ...options, discovery })\n}\n\nexport async function generateModuleRegistryCli(options: ModuleRegistryOptions): Promise<GeneratorResult> {\n const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)\n return generateModuleRegistryCliFromDiscovery({ ...options, discovery })\n}\n\nexport async function generateModuleRegistries(options: ModuleRegistryOptions): Promise<GeneratorResult[]> {\n const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)\n return [\n await generateModuleRegistryFromDiscovery({ ...options, discovery }),\n await generateModuleRegistryAppFromDiscovery({ ...options, discovery }),\n await generateModuleRegistryCliFromDiscovery({ ...options, discovery }),\n ]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,+BAAoD;AAC7D,OAAO,QA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X,qBAAmB;AAAA,IACjB,SAAS;AAAA,IACT,cAAc;AAAA,IACd,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,uBAAuB,yBAAyB,oBAAoB;AAC1E,qBAAmB,EAAE,SAAS,uBAAuB,cAAc,4BAA4B,SAAS,sBAAsB,mBAAmB,QAAQ,MAAM,CAAC;AAEhK,SAAO;AACT;AAEA,eAAsB,uBAAuB,SAA0D;AACrG,QAAM,YAAY,MAAM,8BAA8B,QAAQ,UAAU,QAAQ,SAAS,KAAK;AAC9F,SAAO,oCAAoC,EAAE,GAAG,SAAS,UAAU,CAAC;AACtE;AAEA,eAAsB,0BAA0B,SAA0D;AACxG,QAAM,YAAY,MAAM,8BAA8B,QAAQ,UAAU,QAAQ,SAAS,KAAK;AAC9F,SAAO,uCAAuC,EAAE,GAAG,SAAS,UAAU,CAAC;AACzE;AAEA,eAAsB,0BAA0B,SAA0D;AACxG,QAAM,YAAY,MAAM,8BAA8B,QAAQ,UAAU,QAAQ,SAAS,KAAK;AAC9F,SAAO,uCAAuC,EAAE,GAAG,SAAS,UAAU,CAAC;AACzE;AAEA,eAAsB,yBAAyB,SAA4D;AACzG,QAAM,YAAY,MAAM,8BAA8B,QAAQ,UAAU,QAAQ,SAAS,KAAK;AAC9F,SAAO;AAAA,IACL,MAAM,oCAAoC,EAAE,GAAG,SAAS,UAAU,CAAC;AAAA,IACnE,MAAM,uCAAuC,EAAE,GAAG,SAAS,UAAU,CAAC;AAAA,IACtE,MAAM,uCAAuC,EAAE,GAAG,SAAS,UAAU,CAAC;AAAA,EACxE;AACF;",
|
|
4
|
+
"sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { VariableDeclarationKind, type WriterFunction } from 'ts-morph'\nimport ts from 'typescript-js'\nimport type { ModuleEntry, PackageResolver } from '../resolver'\nimport {\n DEV_SUPERVISOR_MANIFEST_FILE,\n DEV_SUPERVISOR_MANIFEST_VERSION,\n type DevSupervisorSchedulerStartStatus,\n type DevSupervisorWorkerDescriptor,\n} from '../dev-supervisor-manifest'\nimport {\n calculateStructureChecksum,\n toVar,\n moduleHasExport,\n type GeneratorResult,\n createGeneratorResult,\n writeGeneratedFile,\n} from '../utils'\nimport {\n addAutoGeneratedComment,\n addImportSpec,\n addImportStatements,\n arrayLiteral,\n awaitExpression,\n block,\n asExpression,\n arrowFunction,\n binaryExpression,\n callExpression,\n conditionalExpression,\n createGeneratedSourceFile,\n elementAccess,\n escapeGeneratedJsonLiteral,\n returnStatement,\n getSourceText,\n identifier,\n importExpression,\n logicalAnd,\n logicalOr,\n methodCall,\n nullishCoalesce,\n objectLiteral,\n optionalPropertyAccess,\n parenthesized,\n propertyAccess,\n renderGeneratedValue,\n spreadExpression,\n type GeneratedObjectEntry,\n variableStatement,\n writeArrayLiteral,\n writeValue,\n writeStatements,\n} from './ast'\nimport {\n emptyArray,\n emptyObject,\n namespaceFallback,\n namespaceImportSpec,\n} from './extensions/shared'\nimport { detectBackendRouteCollisions, type BackendRouteRegistration } from './route-collisions'\nimport {\n scanModuleDir,\n resolveModuleFile,\n resolveFirstModuleFile,\n SCAN_CONFIGS,\n MODULE_CODE_EXTENSIONS,\n type ModuleRoots,\n type ModuleImports,\n type ScannedFile,\n type ResolvedFile,\n stripModuleCodeExtension,\n isModulePageFile,\n resolveStandaloneSourceMirrorBase,\n} from './scanner'\nimport { loadGeneratorExtensions } from './extensions'\nimport type { ModuleScanContext, StandaloneConfigOptions } from './extension'\nimport {\n renderRouteManifestShardOutputs,\n renderRouteMetadataOutput,\n routeManifestShardFilePattern,\n type RouteManifestShardEntry,\n} from './route-manifest-shards'\n\ntype HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'\n\nexport interface ModuleRegistryOptions {\n resolver: PackageResolver\n quiet?: boolean\n}\n\ninterface ModuleRegistryDiscovery {\n enabled: ModuleEntry[]\n modules: ModuleRegistryDiscoveryEntry[]\n getStructureChecksum: () => string\n}\n\ntype DiscoveredSubscriber = {\n id: string\n importPath: string\n metadata: SerializableSubscriberMetadata | null\n}\n\ntype DiscoveredWorker = {\n id: string\n importPath: string\n metadata: SerializableWorkerMetadata\n}\n\ntype DiscoveredTranslation = {\n locale: string\n coreHas: boolean\n appHas: boolean\n}\n\ntype ModuleRegistryDiscoveryEntry = {\n modId: string\n roots: ModuleRoots\n imps: ModuleImports\n appImportBase: string\n isAppModule: boolean\n resolve: (relativePath: string) => ResolvedFile | null\n frontendFiles: ScannedFile[]\n backendFiles: ScannedFile[]\n commandLoaderEntries: CommandLoaderGenerationEntry[]\n getSubscribers: () => Promise<DiscoveredSubscriber[]>\n getWorkers: () => Promise<DiscoveredWorker[]>\n translations: DiscoveredTranslation[]\n dashboardWidgetEntries: DashboardWidgetEntry[]\n}\n\ntype DashboardWidgetEntry = {\n moduleId: string\n key: string\n source: 'app' | 'package'\n importPath: string\n}\n\nexport type CommandLoaderGenerationEntry = {\n moduleId: string\n key: string\n importPath: string\n ids: string[]\n}\n\ntype WorkerGenerationEntry = DevSupervisorWorkerDescriptor & {\n importPath: string\n}\n\ntype RuntimeApiMethodMetadata = {\n requireAuth?: boolean\n requireRoles?: string[]\n requireFeatures?: string[]\n rateLimit?: {\n points: number\n duration: number\n blockDuration?: number\n keyPrefix?: string\n }\n}\n\ntype PageRouteGenerationResult = {\n eagerRoutes: string[]\n runtimeRoutes: string[]\n manifestRoutes: WriterFunction[]\n manifestShardRoutes: RouteManifestShardEntry[]\n metadataRoutes: RouteManifestShardEntry[]\n routePatterns: string[]\n}\n\n// Fail loud when two modules generate the same backend URL. Folder-derived\n// patterns collide only when a page is left un-namespaced (e.g. `backend/[id]`\n// instead of `backend/<mod>/[id]`), silently shadowing another module at runtime.\n// Mirrors the existing duplicate-command-id guard.\ntype BackendRoutePatternOwner = { moduleId: string; isAppModule: boolean }\n\nfunction assertUniqueBackendRoutePattern(\n seen: Map<string, BackendRoutePatternOwner>,\n moduleId: string,\n pattern: string,\n isAppModule: boolean,\n): void {\n if (!pattern.startsWith('/backend/')) return\n const previous = seen.get(pattern)\n if (previous && previous.moduleId !== moduleId) {\n // An app-local module shadowing a package module's page is a supported\n // override \u2014 the app entry wins at runtime, which is the whole point of\n // putting a module in `apps/<app>/src/modules/`. Only a collision where\n // neither side can predictably win is fatal: package-vs-package (no\n // precedence between them) or app-vs-app (the same app twice).\n const isIntentionalAppShadow = previous.isAppModule !== isAppModule\n if (!isIntentionalAppShadow) {\n const message =\n `[generate] Duplicate backend route pattern \"${pattern}\" generated by modules ` +\n `\"${previous.moduleId}\" and \"${moduleId}\". Each backend page must resolve to a unique URL \u2014 ` +\n `nest the page under a module-specific folder (e.g. backend/${moduleId}/...) so it ` +\n `does not silently shadow another module.`\n // Print before throwing: this guard short-circuits the aggregate collision\n // sweep that would otherwise report the offending path and modules, and an\n // operator needs the detail whichever guard fires first.\n console.error(message)\n throw new Error(message)\n }\n }\n // The app module owns the pattern once it shadows, so a package module seen\n // afterwards is measured against the app entry rather than replacing it.\n if (!previous || isAppModule) seen.set(pattern, { moduleId, isAppModule })\n}\n\ntype ApiRouteGenerationResult = {\n eagerApis: string[]\n runtimeApis: string[]\n manifestApis: WriterFunction[]\n manifestShardApis: RouteManifestShardEntry[]\n metadataApis: RouteManifestShardEntry[]\n}\n\ntype SerializablePageMetadata = {\n requireAuth?: boolean\n requireRoles?: string[]\n requireFeatures?: string[]\n requireCustomerAuth?: boolean\n requireCustomerFeatures?: string[]\n title?: string\n titleKey?: string\n pageTitle?: string\n pageTitleKey?: string\n group?: string\n groupKey?: string\n pageGroup?: string\n pageGroupKey?: string\n order?: number\n pageOrder?: number\n priority?: number\n pagePriority?: number\n navHidden?: boolean\n breadcrumb?: Array<{ label: string; labelKey?: string; href?: string }>\n pageContext?: 'main' | 'admin' | 'settings' | 'profile'\n placement?: {\n section: string\n sectionLabel?: string\n sectionLabelKey?: string\n order?: number\n }\n nav?: {\n label: string\n labelKey?: string\n group?: 'main' | 'account'\n order?: number\n icon?: string\n }\n icon?: string\n}\n\ntype SerializableSubscriberMetadata = {\n id?: string\n event?: string\n persistent?: boolean\n sync?: boolean\n priority?: number\n}\n\ntype SerializableWorkerMetadata = {\n id?: string\n queue?: string\n concurrency?: number\n schedulerSafe?: boolean\n schedulerRequiredFeatures?: string[]\n lockDuration?: number\n maxStalledCount?: number\n /**\n * Whether the worker's metadata declares an `onJobAbandoned` callback.\n *\n * A function cannot be serialized into the registry the way the scalar options are, so the flag is\n * resolved here at build time and the callback itself is emitted as a lazy import beside the\n * handler. Recorded only when the source module could actually be loaded \u2014 the object-literal\n * fallback below cannot see whether a referenced identifier is a function.\n */\n hasJobAbandonedHook?: boolean\n}\n\ntype PageMetadataManifestLoadResult = {\n manifestExpr: string\n requiresRuntimeImport: boolean\n}\n\ntype GeneratedImportStatement =\n | string\n | {\n moduleSpecifier?: string\n defaultImport?: string\n namespaceImport?: string\n namedImports?: Array<string | { name: string; alias?: string; isTypeOnly?: boolean }>\n isTypeOnly?: boolean\n }\n\nfunction scanDashboardWidgetEntries(options: {\n modId: string\n roots: ModuleRoots\n appImportBase: string\n pkgImportBase: string\n}): DashboardWidgetEntry[] {\n const { modId, roots, appImportBase, pkgImportBase } = options\n const files = scanModuleDir(roots, SCAN_CONFIGS.dashboardWidgets)\n return files.map(({ relPath, fromApp }) => {\n const segs = relPath.split('/')\n const file = segs.pop()!\n const base = file.replace(/\\.(t|j)sx?$/, '')\n const importPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/widgets/dashboard/${[...segs, base].join('/')}`\n )\n const key = [modId, ...segs, base].filter(Boolean).join(':')\n const source = fromApp ? 'app' : 'package'\n return { moduleId: modId, key, source, importPath }\n })\n}\n\nasync function loadModuleExportsFromSource<T = Record<string, unknown>>(sourceFile: string): Promise<T | null> {\n try {\n return await import(buildCacheBustedSourceImportUrl(sourceFile)) as T\n } catch {\n return null\n }\n}\n\nfunction buildCacheBustedSourceImportUrl(sourceFile: string): string {\n const url = pathToFileURL(sourceFile)\n try {\n const stat = fs.statSync(sourceFile)\n url.searchParams.set('v', `${stat.mtimeMs}-${stat.size}`)\n } catch {}\n return url.href\n}\n\nfunction assertGeneratorPluginUsesTypeOnlyImports(sourceFile: string): void {\n const source = fs.readFileSync(sourceFile, 'utf8')\n const scriptKind = sourceFile.endsWith('.js') || sourceFile.endsWith('.mjs') || sourceFile.endsWith('.cjs')\n ? ts.ScriptKind.JS\n : ts.ScriptKind.TS\n const parsed = ts.createSourceFile(sourceFile, source, ts.ScriptTarget.Latest, true, scriptKind)\n const violations: string[] = []\n\n for (const statement of parsed.statements) {\n if (ts.isImportDeclaration(statement) && !statement.importClause?.isTypeOnly) {\n violations.push(statement.getText(parsed))\n }\n if (ts.isImportEqualsDeclaration(statement)) {\n violations.push(statement.getText(parsed))\n }\n if (ts.isExportDeclaration(statement) && statement.moduleSpecifier && !statement.isTypeOnly) {\n violations.push(statement.getText(parsed))\n }\n }\n\n const visit = (node: ts.Node): void => {\n if (\n ts.isCallExpression(node)\n && (node.expression.kind === ts.SyntaxKind.ImportKeyword\n || (ts.isIdentifier(node.expression) && node.expression.text === 'require'))\n ) {\n violations.push(node.getText(parsed))\n }\n ts.forEachChild(node, visit)\n }\n visit(parsed)\n\n if (violations.length > 0) {\n throw new Error(\n `Generator plugin ${sourceFile} contains runtime imports. generators.ts may use only \\`import type\\`: ${violations.join('; ')}`,\n )\n }\n}\n\nconst GENERATOR_PLUGIN_OUTPUT_MANIFEST = '.generator-plugin-outputs.json'\n\nfunction normalizeGeneratorPluginOutputFileName(pluginId: string, outputFileName: string): string {\n const normalized = outputFileName.replace(/\\\\/g, '/')\n if (\n path.isAbsolute(outputFileName)\n || outputFileName.includes('\\\\')\n || normalized.startsWith('/')\n || normalized.startsWith('../')\n || normalized.includes('/../')\n || !normalized.endsWith('.ts')\n ) {\n throw new Error(\n `Generator plugin '${pluginId}' has an invalid outputFileName '${outputFileName}'; expected a relative .ts path inside the generated directory.`,\n )\n }\n return normalized\n}\n\nfunction resolveGeneratorPluginOutputNames(\n plugins: ReadonlyMap<string, import('@open-mercato/shared/modules/generators').GeneratorPlugin>,\n): Map<string, string> {\n const outputNames = new Map<string, string>()\n const ownersByOutput = new Map<string, string>()\n for (const [pluginId, plugin] of plugins) {\n const outputName = normalizeGeneratorPluginOutputFileName(pluginId, plugin.outputFileName)\n const existingOwner = ownersByOutput.get(outputName)\n if (existingOwner) {\n throw new Error(\n `Generator plugins '${existingOwner}' and '${pluginId}' declare the same output file '${outputName}'.`,\n )\n }\n ownersByOutput.set(outputName, pluginId)\n outputNames.set(pluginId, outputName)\n }\n return outputNames\n}\n\nfunction reconcileGeneratorPluginOutputs(options: {\n outputDir: string\n outputNames: Iterable<string>\n result: GeneratorResult\n}): void {\n const manifestPath = path.join(options.outputDir, GENERATOR_PLUGIN_OUTPUT_MANIFEST)\n let previousOutputs: string[] = []\n if (fs.existsSync(manifestPath)) {\n const parsed = JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as unknown\n if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== 'string')) {\n throw new Error(`Invalid generator plugin output manifest: ${manifestPath}`)\n }\n previousOutputs = parsed.map((entry) => normalizeGeneratorPluginOutputFileName('manifest', entry))\n }\n\n const currentOutputs = new Set(options.outputNames)\n for (const staleOutput of previousOutputs) {\n if (currentOutputs.has(staleOutput)) continue\n for (const stalePath of [\n path.join(options.outputDir, staleOutput),\n path.join(options.outputDir, staleOutput.replace(/\\.ts$/, '.checksum')),\n ]) {\n if (!fs.existsSync(stalePath)) continue\n fs.unlinkSync(stalePath)\n options.result.filesWritten.push(stalePath)\n }\n }\n\n if (currentOutputs.size === 0) {\n if (fs.existsSync(manifestPath)) {\n fs.unlinkSync(manifestPath)\n options.result.filesWritten.push(manifestPath)\n }\n return\n }\n\n const manifestContent = `${JSON.stringify(\n [...currentOutputs].sort((left, right) => left.localeCompare(right)),\n null,\n 2,\n )}\\n`\n if (!fs.existsSync(manifestPath) || fs.readFileSync(manifestPath, 'utf8') !== manifestContent) {\n fs.mkdirSync(path.dirname(manifestPath), { recursive: true })\n fs.writeFileSync(manifestPath, manifestContent)\n options.result.filesWritten.push(manifestPath)\n }\n}\n\nfunction unwrapObjectLiteralExpression(\n expression: ts.Expression | undefined,\n): ts.ObjectLiteralExpression | undefined {\n if (!expression) return undefined\n if (ts.isObjectLiteralExpression(expression)) return expression\n if (ts.isAsExpression(expression) || ts.isTypeAssertionExpression(expression)) {\n return unwrapObjectLiteralExpression(expression.expression)\n }\n if (ts.isParenthesizedExpression(expression)) {\n return unwrapObjectLiteralExpression(expression.expression)\n }\n return undefined\n}\n\nfunction extractNamedObjectLiteralSource(sourceFile: string, exportName: string): string | null {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return null\n }\n\n const parsed = ts.createSourceFile(\n sourceFile,\n source,\n ts.ScriptTarget.Latest,\n true,\n inferScriptKind(sourceFile),\n )\n\n const exportedNames = new Set<string>()\n for (const statement of parsed.statements) {\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n && !statement.moduleSpecifier\n ) {\n for (const element of statement.exportClause.elements) {\n exportedNames.add(element.name.text)\n }\n }\n }\n\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n\n const statementExportsNameDirectly = (ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined)\n ?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name) || declaration.name.text !== exportName) continue\n if (!statementExportsNameDirectly && !exportedNames.has(exportName)) continue\n\n const objectLiteral = unwrapObjectLiteralExpression(declaration.initializer)\n if (!objectLiteral) return null\n return source.slice(objectLiteral.getStart(parsed), objectLiteral.end)\n }\n }\n\n return null\n}\n\nfunction resolveLocalStringConstants(parsed: ts.SourceFile): Map<string, string> {\n const constants = new Map<string, string>()\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name)) continue\n if (!declaration.initializer) continue\n if (ts.isStringLiteral(declaration.initializer) || ts.isNoSubstitutionTemplateLiteral(declaration.initializer)) {\n constants.set(declaration.name.text, declaration.initializer.text)\n }\n }\n }\n return constants\n}\n\nfunction extractObjectPropertiesFromAst(sourceFile: string, exportName: string): Record<string, unknown> | null {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return null\n }\n\n const parsed = ts.createSourceFile(\n sourceFile,\n source,\n ts.ScriptTarget.Latest,\n true,\n inferScriptKind(sourceFile),\n )\n\n const exportedNames = new Set<string>()\n for (const statement of parsed.statements) {\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n && !statement.moduleSpecifier\n ) {\n for (const element of statement.exportClause.elements) {\n exportedNames.add(element.name.text)\n }\n }\n }\n\n let objectLiteral: ts.ObjectLiteralExpression | undefined\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n const statementExportsNameDirectly = (ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined)\n ?.some((modifier: ts.Modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name) || declaration.name.text !== exportName) continue\n if (!statementExportsNameDirectly && !exportedNames.has(exportName)) continue\n objectLiteral = unwrapObjectLiteralExpression(declaration.initializer)\n break\n }\n if (objectLiteral) break\n }\n\n if (!objectLiteral) return null\n\n const localConstants = resolveLocalStringConstants(parsed)\n const result: Record<string, unknown> = {}\n\n for (const property of objectLiteral.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const key = ts.isIdentifier(property.name) ? property.name.text\n : ts.isStringLiteral(property.name) ? property.name.text\n : null\n if (!key) continue\n\n const initializer = property.initializer\n if (ts.isStringLiteral(initializer) || ts.isNoSubstitutionTemplateLiteral(initializer)) {\n result[key] = initializer.text\n } else if (ts.isNumericLiteral(initializer)) {\n result[key] = Number(initializer.text)\n } else if (initializer.kind === ts.SyntaxKind.TrueKeyword) {\n result[key] = true\n } else if (initializer.kind === ts.SyntaxKind.FalseKeyword) {\n result[key] = false\n } else if (ts.isIdentifier(initializer) && localConstants.has(initializer.text)) {\n result[key] = localConstants.get(initializer.text)\n }\n }\n\n return Object.keys(result).length > 0 ? result : null\n}\n\n/**\n * Whether an exported object literal declares a property, regardless of what it evaluates to.\n *\n * Needed for callbacks: the value resolvers above can read literals and local constants, but a\n * property whose value is an imported function stays unresolvable, so \"did the author declare it\"\n * cannot be answered by inspecting the extracted value. Answering it from the syntax instead is what\n * lets the generator emit a lazy accessor for a hook it can see but cannot serialize.\n */\nexport function namedObjectLiteralDeclaresProperty(sourceFile: string, exportName: string, propertyName: string): boolean {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return false\n }\n\n const parsed = ts.createSourceFile(sourceFile, source, ts.ScriptTarget.Latest, true, inferScriptKind(sourceFile))\n const exportedNames = new Set<string>()\n for (const statement of parsed.statements) {\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n && !statement.moduleSpecifier\n ) {\n for (const element of statement.exportClause.elements) exportedNames.add(element.name.text)\n }\n }\n\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n const exportsDirectly = (ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined)\n ?.some((modifier: ts.Modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name) || declaration.name.text !== exportName) continue\n if (!exportsDirectly && !exportedNames.has(exportName)) continue\n const objectLiteral = unwrapObjectLiteralExpression(declaration.initializer)\n if (!objectLiteral) return false\n return objectLiteral.properties.some((property) => {\n const name = property.name\n if (!name) return false\n const key = ts.isIdentifier(name) ? name.text : ts.isStringLiteral(name) ? name.text : null\n return key === propertyName\n })\n }\n }\n return false\n}\n\nexport function extractNamedObjectLiteralExport(sourceFile: string, exportName: string): Record<string, unknown> | null {\n const literal = extractNamedObjectLiteralSource(sourceFile, exportName)\n if (literal) {\n try {\n const extracted = Function(`\"use strict\"; return (${literal});`)()\n if (extracted && typeof extracted === 'object') {\n return extracted as Record<string, unknown>\n }\n } catch {\n // fall through to AST-based resolver\n }\n }\n const resolved = resolveNamedObjectExport(sourceFile, exportName)\n if (resolved) return resolved\n return extractObjectPropertiesFromAst(sourceFile, exportName)\n}\n\nfunction unwrapExpression(expression: ts.Expression): ts.Expression {\n let current: ts.Expression = expression\n while (\n ts.isAsExpression(current)\n || ts.isTypeAssertionExpression(current)\n || ts.isParenthesizedExpression(current)\n || ts.isSatisfiesExpression?.(current)\n || ts.isNonNullExpression(current)\n ) {\n current = current.expression\n }\n return current\n}\n\nfunction collectLocalDeclarations(parsed: ts.SourceFile): Map<string, ts.Expression> {\n const locals = new Map<string, ts.Expression>()\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name) && declaration.initializer) {\n locals.set(declaration.name.text, declaration.initializer)\n }\n }\n }\n return locals\n}\n\ntype ImportedBinding =\n | {\n kind: 'named'\n sourceFile: string\n exportName: string\n }\n | {\n kind: 'default'\n sourceFile: string\n }\n | {\n kind: 'namespace'\n sourceFile: string\n }\n\ntype ParsedModuleResolutionContext = {\n sourceFile: string\n parsed: ts.SourceFile\n locals: Map<string, ts.Expression>\n exportedNames: Set<string>\n imports: Map<string, ImportedBinding>\n}\n\nfunction resolveImportedModuleFile(sourceFile: string, moduleSpecifier: string): string | null {\n if (!moduleSpecifier.startsWith('.')) return null\n return findExistingModuleFileByBaseNames(path.dirname(sourceFile), [\n moduleSpecifier,\n path.join(moduleSpecifier, 'index'),\n ])\n}\n\nfunction collectImportedBindings(\n parsed: ts.SourceFile,\n sourceFile: string,\n): Map<string, ImportedBinding> {\n const bindings = new Map<string, ImportedBinding>()\n\n for (const statement of parsed.statements) {\n if (!ts.isImportDeclaration(statement)) continue\n if (!ts.isStringLiteral(statement.moduleSpecifier)) continue\n\n const resolvedSourceFile = resolveImportedModuleFile(sourceFile, statement.moduleSpecifier.text)\n if (!resolvedSourceFile) continue\n\n const importClause = statement.importClause\n if (!importClause) continue\n\n if (importClause.name) {\n bindings.set(importClause.name.text, {\n kind: 'default',\n sourceFile: resolvedSourceFile,\n })\n }\n\n const namedBindings = importClause.namedBindings\n if (!namedBindings) continue\n\n if (ts.isNamespaceImport(namedBindings)) {\n bindings.set(namedBindings.name.text, {\n kind: 'namespace',\n sourceFile: resolvedSourceFile,\n })\n continue\n }\n\n for (const element of namedBindings.elements) {\n bindings.set(element.name.text, {\n kind: 'named',\n sourceFile: resolvedSourceFile,\n exportName: element.propertyName?.text ?? element.name.text,\n })\n }\n }\n\n return bindings\n}\n\nfunction collectReexportedNames(parsed: ts.SourceFile): Set<string> {\n const exportedNames = new Set<string>()\n for (const statement of parsed.statements) {\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n && !statement.moduleSpecifier\n ) {\n for (const element of statement.exportClause.elements) {\n exportedNames.add(element.name.text)\n }\n }\n }\n return exportedNames\n}\n\nfunction findExportedInitializer(\n parsed: ts.SourceFile,\n exportName: string,\n exportedNames: Set<string>,\n): ts.Expression | null {\n for (const statement of parsed.statements) {\n if (!ts.isVariableStatement(statement)) continue\n const isExported = (ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined)\n ?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) ?? false\n for (const declaration of statement.declarationList.declarations) {\n if (!declaration.initializer) continue\n if (ts.isIdentifier(declaration.name)) {\n if (declaration.name.text !== exportName) continue\n if (!isExported && !exportedNames.has(exportName)) continue\n return declaration.initializer\n }\n if ((isExported || exportedNames.has(exportName)) && ts.isObjectBindingPattern(declaration.name)) {\n for (const element of declaration.name.elements) {\n const bindingName = ts.isIdentifier(element.name) ? element.name.text : null\n const propertyName = element.propertyName && ts.isIdentifier(element.propertyName)\n ? element.propertyName.text\n : null\n const targetKey = propertyName ?? bindingName\n if (targetKey !== exportName) continue\n const initializer = unwrapExpression(declaration.initializer)\n if (ts.isCallExpression(initializer) && initializer.arguments.length > 0) {\n const firstArg = unwrapExpression(initializer.arguments[0])\n if (ts.isObjectLiteralExpression(firstArg)) {\n for (const prop of firstArg.properties) {\n if (!ts.isPropertyAssignment(prop)) continue\n const key = ts.isIdentifier(prop.name) ? prop.name.text\n : ts.isStringLiteral(prop.name) ? prop.name.text\n : null\n if (key === exportName) return prop.initializer\n }\n }\n }\n return null\n }\n }\n }\n }\n return null\n}\n\nfunction findDefaultExportInitializer(parsed: ts.SourceFile): ts.Expression | null {\n for (const statement of parsed.statements) {\n if (ts.isExportAssignment(statement) && !statement.isExportEquals) {\n return statement.expression\n }\n\n if (!ts.isVariableStatement(statement)) continue\n const modifiers = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined\n const isDefaultExport = modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword) ?? false\n if (!isDefaultExport) continue\n\n for (const declaration of statement.declarationList.declarations) {\n if (declaration.initializer) return declaration.initializer\n }\n }\n\n return null\n}\n\nfunction loadParsedModuleResolutionContext(\n sourceFile: string,\n cache: Map<string, ParsedModuleResolutionContext | null>,\n): ParsedModuleResolutionContext | null {\n if (cache.has(sourceFile)) {\n return cache.get(sourceFile) ?? null\n }\n\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n cache.set(sourceFile, null)\n return null\n }\n\n const parsed = ts.createSourceFile(\n sourceFile,\n source,\n ts.ScriptTarget.Latest,\n true,\n inferScriptKind(sourceFile),\n )\n\n const context: ParsedModuleResolutionContext = {\n sourceFile,\n parsed,\n locals: collectLocalDeclarations(parsed),\n exportedNames: collectReexportedNames(parsed),\n imports: collectImportedBindings(parsed, sourceFile),\n }\n cache.set(sourceFile, context)\n return context\n}\n\nfunction resolveImportedBindingValue(\n binding: ImportedBinding,\n pathSegments: string[],\n visited: Set<string>,\n cache: Map<string, ParsedModuleResolutionContext | null>,\n): unknown {\n const importedContext = loadParsedModuleResolutionContext(binding.sourceFile, cache)\n if (!importedContext) return undefined\n\n if (binding.kind === 'namespace') {\n if (pathSegments.length === 0) return undefined\n const [exportName, ...restPath] = pathSegments\n const importKey = `${binding.sourceFile}::${exportName}`\n if (visited.has(importKey)) return undefined\n\n let initializer = findExportedInitializer(importedContext.parsed, exportName, importedContext.exportedNames)\n if (!initializer && importedContext.exportedNames.has(exportName)) {\n initializer = importedContext.locals.get(exportName) ?? null\n }\n if (!initializer) return undefined\n\n const nextVisited = new Set(visited)\n nextVisited.add(importKey)\n let value = resolveExpressionValue(initializer, importedContext, nextVisited, cache)\n for (const segment of restPath) {\n if (value && typeof value === 'object' && !Array.isArray(value) && segment in (value as Record<string, unknown>)) {\n value = (value as Record<string, unknown>)[segment]\n } else {\n return undefined\n }\n }\n return value\n }\n\n const importKey = binding.kind === 'default'\n ? `${binding.sourceFile}::default`\n : `${binding.sourceFile}::${binding.exportName}`\n if (visited.has(importKey)) return undefined\n\n let initializer = binding.kind === 'default'\n ? findDefaultExportInitializer(importedContext.parsed)\n : findExportedInitializer(importedContext.parsed, binding.exportName, importedContext.exportedNames)\n\n if (!initializer && binding.kind === 'named' && importedContext.exportedNames.has(binding.exportName)) {\n initializer = importedContext.locals.get(binding.exportName) ?? null\n }\n if (!initializer) return undefined\n\n const nextVisited = new Set(visited)\n nextVisited.add(importKey)\n let value = resolveExpressionValue(initializer, importedContext, nextVisited, cache)\n\n for (const segment of pathSegments) {\n if (value && typeof value === 'object' && !Array.isArray(value) && segment in (value as Record<string, unknown>)) {\n value = (value as Record<string, unknown>)[segment]\n } else {\n return undefined\n }\n }\n\n return value\n}\n\nfunction resolveExpressionValue(\n expression: ts.Expression,\n context: ParsedModuleResolutionContext,\n visited: Set<string>,\n cache: Map<string, ParsedModuleResolutionContext | null>,\n): unknown {\n const expr = unwrapExpression(expression)\n\n if (ts.isStringLiteral(expr) || ts.isNoSubstitutionTemplateLiteral(expr)) return expr.text\n if (ts.isNumericLiteral(expr)) return Number(expr.text)\n if (expr.kind === ts.SyntaxKind.TrueKeyword) return true\n if (expr.kind === ts.SyntaxKind.FalseKeyword) return false\n if (expr.kind === ts.SyntaxKind.NullKeyword) return null\n if (ts.isPrefixUnaryExpression(expr) && expr.operator === ts.SyntaxKind.MinusToken && ts.isNumericLiteral(expr.operand)) {\n return -Number(expr.operand.text)\n }\n\n if (ts.isObjectLiteralExpression(expr)) {\n const result: Record<string, unknown> = {}\n for (const property of expr.properties) {\n if (ts.isPropertyAssignment(property)) {\n const key = ts.isIdentifier(property.name) ? property.name.text\n : ts.isStringLiteral(property.name) ? property.name.text\n : null\n if (!key) continue\n const value = resolveExpressionValue(property.initializer, context, visited, cache)\n if (value !== undefined) result[key] = value\n } else if (ts.isShorthandPropertyAssignment(property)) {\n const key = property.name.text\n const initializer = context.locals.get(key)\n if (initializer && !visited.has(key)) {\n const nextVisited = new Set(visited)\n nextVisited.add(key)\n const value = resolveExpressionValue(initializer, context, nextVisited, cache)\n if (value !== undefined) result[key] = value\n }\n } else if (ts.isSpreadAssignment(property)) {\n const spread = resolveExpressionValue(property.expression, context, visited, cache)\n if (spread && typeof spread === 'object' && !Array.isArray(spread)) {\n Object.assign(result, spread)\n }\n }\n }\n return result\n }\n\n if (ts.isArrayLiteralExpression(expr)) {\n const result: unknown[] = []\n for (const element of expr.elements) {\n if (ts.isSpreadElement(element)) {\n const spread = resolveExpressionValue(element.expression, context, visited, cache)\n if (Array.isArray(spread)) result.push(...spread)\n continue\n }\n const value = resolveExpressionValue(element as ts.Expression, context, visited, cache)\n if (value !== undefined) result.push(value)\n }\n return result\n }\n\n if (ts.isIdentifier(expr)) {\n if (visited.has(expr.text)) return undefined\n const initializer = context.locals.get(expr.text)\n if (initializer) {\n const nextVisited = new Set(visited)\n nextVisited.add(expr.text)\n return resolveExpressionValue(initializer, context, nextVisited, cache)\n }\n\n const importBinding = context.imports.get(expr.text)\n if (!importBinding) return undefined\n return resolveImportedBindingValue(importBinding, [], visited, cache)\n }\n\n if (ts.isPropertyAccessExpression(expr)) {\n const pathSegments: string[] = []\n let cursor: ts.Expression = expr\n while (ts.isPropertyAccessExpression(cursor)) {\n if (!ts.isIdentifier(cursor.name)) return undefined\n pathSegments.unshift(cursor.name.text)\n cursor = cursor.expression\n }\n if (!ts.isIdentifier(cursor)) return undefined\n const rootName = cursor.text\n if (!visited.has(rootName)) {\n const rootInit = context.locals.get(rootName)\n if (rootInit) {\n const unwrappedRoot = unwrapExpression(rootInit)\n const nextVisited = new Set(visited)\n nextVisited.add(rootName)\n // Handle `const crud = makeCrudRoute({ metadata: routeMetadata, ... })`\n if (ts.isCallExpression(unwrappedRoot) && unwrappedRoot.arguments.length > 0) {\n const firstArg = unwrapExpression(unwrappedRoot.arguments[0])\n if (ts.isObjectLiteralExpression(firstArg)) {\n const argObject = resolveExpressionValue(firstArg, context, nextVisited, cache)\n if (argObject && typeof argObject === 'object' && !Array.isArray(argObject)) {\n let current: unknown = argObject\n for (const segment of pathSegments) {\n if (current && typeof current === 'object' && !Array.isArray(current) && segment in (current as Record<string, unknown>)) {\n current = (current as Record<string, unknown>)[segment]\n } else {\n current = undefined\n break\n }\n }\n if (current !== undefined) return current\n }\n }\n }\n let value = resolveExpressionValue(rootInit, context, nextVisited, cache)\n for (const segment of pathSegments) {\n if (value && typeof value === 'object' && !Array.isArray(value) && segment in (value as Record<string, unknown>)) {\n value = (value as Record<string, unknown>)[segment]\n } else {\n return undefined\n }\n }\n return value\n }\n }\n\n const importBinding = context.imports.get(rootName)\n if (!importBinding) return undefined\n return resolveImportedBindingValue(importBinding, pathSegments, visited, cache)\n }\n\n return undefined\n}\n\nexport function hasNamedExport(sourceFile: string, exportName: string): boolean {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return false\n }\n const parsed = ts.createSourceFile(\n sourceFile,\n source,\n ts.ScriptTarget.Latest,\n true,\n inferScriptKind(sourceFile),\n )\n for (const statement of parsed.statements) {\n if (ts.isVariableStatement(statement)) {\n const isExported = (ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined)\n ?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) ?? false\n if (!isExported) continue\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name) && declaration.name.text === exportName) return true\n if (ts.isObjectBindingPattern(declaration.name)) {\n for (const element of declaration.name.elements) {\n const bindingName = ts.isIdentifier(element.name) ? element.name.text : null\n const propertyName = element.propertyName && ts.isIdentifier(element.propertyName)\n ? element.propertyName.text\n : null\n if ((propertyName ?? bindingName) === exportName) return true\n }\n }\n }\n }\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n ) {\n for (const element of statement.exportClause.elements) {\n const exposedName = element.name.text\n const sourceName = element.propertyName?.text ?? exposedName\n if (exposedName === exportName || sourceName === exportName) return true\n }\n }\n }\n return false\n}\n\nexport function resolveNamedObjectExport(sourceFile: string, exportName: string): Record<string, unknown> | null {\n const cache = new Map<string, ParsedModuleResolutionContext | null>()\n const context = loadParsedModuleResolutionContext(sourceFile, cache)\n if (!context) return null\n\n let initializer = findExportedInitializer(context.parsed, exportName, context.exportedNames)\n if (!initializer && context.exportedNames.has(exportName)) {\n initializer = context.locals.get(exportName) ?? null\n }\n if (!initializer) return null\n const value = resolveExpressionValue(initializer, context, new Set<string>(), cache)\n if (!value || typeof value !== 'object' || Array.isArray(value)) return null\n const record = value as Record<string, unknown>\n return Object.keys(record).length > 0 ? record : null\n}\n\nfunction inferScriptKind(filePath: string): ts.ScriptKind {\n if (filePath.endsWith('.tsx')) return ts.ScriptKind.TSX\n if (filePath.endsWith('.jsx')) return ts.ScriptKind.JSX\n if (filePath.endsWith('.js')) return ts.ScriptKind.JS\n return ts.ScriptKind.TS\n}\n\nfunction hasDefaultExport(sourceFile: string): boolean {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return false\n }\n\n const parsed = ts.createSourceFile(\n sourceFile,\n source,\n ts.ScriptTarget.Latest,\n true,\n inferScriptKind(sourceFile),\n )\n\n for (const statement of parsed.statements) {\n if (ts.isExportAssignment(statement) && !statement.isExportEquals) {\n return true\n }\n\n if (\n ts.isExportDeclaration(statement)\n && statement.exportClause\n && ts.isNamedExports(statement.exportClause)\n && statement.exportClause.elements.some(\n (element) => element.name.text === 'default' || element.propertyName?.text === 'default',\n )\n ) {\n return true\n }\n\n const modifiers = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined\n if (modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword)) {\n return true\n }\n }\n\n return false\n}\n\nfunction requiresRuntimePageMetadataFromSourceFile(sourceFile: string): boolean {\n const literal = extractNamedObjectLiteralSource(sourceFile, 'metadata')\n if (!literal) return false\n\n if (/\\b(?:visible|enabled)\\s*(?::|[,}])/.test(literal)) {\n return true\n }\n\n if (!/\\bicon\\s*(?::|[,}])/.test(literal)) {\n return false\n }\n\n const iconMatch = /\\bicon\\s*:\\s*([^,\\n}]+)/m.exec(literal)\n if (!iconMatch) return true\n\n return !/^['\"`]/.test(iconMatch[1].trim())\n}\n\nfunction toLiteral(value: unknown): string {\n return escapeGeneratedJsonLiteral(JSON.stringify(value))\n}\n\nconst GENERATED_MODULE_RELATIVE_PREFIXES = ['@/', '../../src/modules/', './'] as const\nconst GENERATED_MODULE_SPECIFIER_SEGMENT = /^[A-Za-z0-9_.\\-[\\]()']+$/\n// Lenient npm package name matcher. Accepts legacy uppercase packages and\n// tilde-prefixed names, bans leading \".\" / \"_\", and reserves \"@\" for scope\n// markers so the dispatcher below can split scope-vs-bare unambiguously.\nconst NPM_PACKAGE_NAME_SEGMENT = /^[A-Za-z0-9~][A-Za-z0-9_.~-]*$/\n\nfunction sanitizeGeneratedModuleSpecifierSegment(segment: string, importPath: string): string {\n const match = GENERATED_MODULE_SPECIFIER_SEGMENT.exec(segment)\n if (!match || segment === '.' || segment === '..') {\n throw new Error(`Unsafe generated module specifier: ${importPath}`)\n }\n return match[0]\n}\n\nfunction sanitizeNpmPackageNameSegment(segment: string, importPath: string): void {\n if (!NPM_PACKAGE_NAME_SEGMENT.test(segment) || segment === '.' || segment === '..') {\n throw new Error(`Unsafe generated module specifier: ${importPath}`)\n }\n}\n\nfunction sanitizeGeneratedModuleSpecifier(importPath: string): string {\n if (!importPath) {\n throw new Error(`Unsafe generated module specifier: ${importPath}`)\n }\n\n const relativePrefix = GENERATED_MODULE_RELATIVE_PREFIXES.find((candidate) =>\n importPath.startsWith(candidate),\n )\n if (relativePrefix) {\n const suffix = importPath.slice(relativePrefix.length)\n if (!suffix) {\n throw new Error(`Unsafe generated module specifier: ${importPath}`)\n }\n const segments = suffix\n .split('/')\n .map((segment) => sanitizeGeneratedModuleSpecifierSegment(segment, importPath))\n return `${relativePrefix}${segments.join('/')}`\n }\n\n if (importPath.startsWith('@')) {\n // Scoped npm package: @scope/name[/subpath]\n const firstSlash = importPath.indexOf('/')\n if (firstSlash < 2) {\n throw new Error(`Unsafe generated module specifier prefix: ${importPath}`)\n }\n const scope = importPath.slice(1, firstSlash)\n sanitizeNpmPackageNameSegment(scope, importPath)\n const rest = importPath.slice(firstSlash + 1)\n if (!rest) {\n throw new Error(`Unsafe generated module specifier: ${importPath}`)\n }\n const secondSlash = rest.indexOf('/')\n const name = secondSlash >= 0 ? rest.slice(0, secondSlash) : rest\n sanitizeNpmPackageNameSegment(name, importPath)\n const subpath = secondSlash >= 0 ? rest.slice(secondSlash + 1) : ''\n if (!subpath) {\n return `@${scope}/${name}`\n }\n const segments = subpath\n .split('/')\n .map((segment) => sanitizeGeneratedModuleSpecifierSegment(segment, importPath))\n return `@${scope}/${name}/${segments.join('/')}`\n }\n\n // Bare npm package: name[/subpath]\n const firstSlash = importPath.indexOf('/')\n const name = firstSlash >= 0 ? importPath.slice(0, firstSlash) : importPath\n sanitizeNpmPackageNameSegment(name, importPath)\n const subpath = firstSlash >= 0 ? importPath.slice(firstSlash + 1) : ''\n if (!subpath) {\n return name\n }\n const segments = subpath\n .split('/')\n .map((segment) => sanitizeGeneratedModuleSpecifierSegment(segment, importPath))\n return `${name}/${segments.join('/')}`\n}\n\n// Defense in depth: when src/modules.ts registers a module from a third-party\n// npm scope (anything outside @app / @open-mercato/*), verify the resolved\n// pkgBase directory exists. If it doesn't, the package referenced via `from:`\n// is almost certainly not an Open Mercato module (or the id is wrong), and\n// silently emitting an empty module registration would hide the misconfig.\nfunction verifyThirdPartyModuleShape(entry: { id: string; from?: string }, pkgBase: string): void {\n const from = entry.from\n if (!from || from === '@app' || from.startsWith('@open-mercato/')) return\n if (fs.existsSync(pkgBase)) return\n throw new Error(\n `Module '${entry.id}' is registered with from: '${from}' but no Open Mercato module shape was found at '${pkgBase}'. ` +\n `Ensure the package ships a 'modules/${entry.id}' subtree (either under 'dist/modules/' or 'src/modules/'), or correct the 'from' value in src/modules.ts.`,\n )\n}\n\nfunction buildImportStatement(importClause: string, importPath: string): string {\n return `import ${importClause} from ${toLiteral(sanitizeGeneratedModuleSpecifier(importPath))}`\n}\n\nfunction buildBareImportStatement(importPath: string): string {\n return `import ${toLiteral(sanitizeGeneratedModuleSpecifier(importPath))}`\n}\n\nfunction buildDynamicImportExpression(importPath: string): string {\n return `import(${toLiteral(sanitizeGeneratedModuleSpecifier(importPath))})`\n}\n\nconst COMMAND_SCAN_CONFIG = {\n folder: 'commands',\n include: (name: string) =>\n ['.ts', '.js', '.tsx', '.jsx'].some((extension) => name.endsWith(extension)) &&\n !name.endsWith('.d.ts') &&\n !/\\.(test|spec)\\.[jt]sx?$/.test(name) &&\n stripModuleCodeExtension(name) !== 'index',\n sort: (a: string, b: string) => a.localeCompare(b),\n}\n\nfunction getStaticStringExpression(\n expr: ts.Expression,\n stringConstants: Map<string, string> = new Map(),\n): string | null {\n const unwrapped = unwrapExpression(expr)\n if (ts.isStringLiteral(unwrapped) || ts.isNoSubstitutionTemplateLiteral(unwrapped)) return unwrapped.text\n if (ts.isIdentifier(unwrapped)) {\n const direct = stringConstants.get(unwrapped.text)\n if (direct) return direct\n }\n return null\n}\n\nfunction getPropertyNameText(name: ts.PropertyName): string | null {\n if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNumericLiteral(name)) return name.text\n return null\n}\n\nfunction getObjectStringProperty(\n object: ts.ObjectLiteralExpression,\n propertyName: string,\n stringConstants: Map<string, string> = new Map(),\n): string | null {\n for (const property of object.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const name = getPropertyNameText(property.name)\n if (name !== propertyName) continue\n return getStaticStringExpression(property.initializer, stringConstants)\n }\n return null\n}\n\nfunction collectStringArrayElements(expr: ts.Expression, stringConstants: Map<string, string> = new Map()): string[] {\n const unwrapped = unwrapExpression(expr)\n if (!ts.isArrayLiteralExpression(unwrapped)) return []\n const values: string[] = []\n for (const element of unwrapped.elements) {\n const value = getStaticStringExpression(element, stringConstants)\n if (value) values.push(value)\n }\n return values\n}\n\nexport function extractCommandIdsFromSource(sourcePath: string): string[] {\n const sourceText = fs.readFileSync(sourcePath, 'utf8')\n const sourceFile = ts.createSourceFile(sourcePath, sourceText, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX)\n const ids = new Set<string>()\n const stringConstants = new Map<string, string>()\n const variableCommandIds = new Map<string, string>()\n\n const collectVariables = (node: ts.Node): void => {\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer) {\n const stringValue = getStaticStringExpression(node.initializer, stringConstants)\n if (stringValue) {\n stringConstants.set(node.name.text, stringValue)\n }\n if (ts.isObjectLiteralExpression(node.initializer)) {\n const id = getObjectStringProperty(node.initializer, 'id', stringConstants)\n if (id) variableCommandIds.set(node.name.text, id)\n } else if (node.name.text === 'commandIds') {\n for (const id of collectStringArrayElements(node.initializer, stringConstants)) ids.add(id)\n }\n }\n ts.forEachChild(node, collectVariables)\n }\n\n const collectRegistrations = (node: ts.Node): void => {\n if (ts.isCallExpression(node) && ts.isIdentifier(node.expression)) {\n const callName = node.expression.text\n const firstArg = node.arguments[0]\n if (callName === 'registerCommand' && firstArg) {\n if (ts.isIdentifier(firstArg)) {\n const id = variableCommandIds.get(firstArg.text)\n if (id) ids.add(id)\n } else if (ts.isObjectLiteralExpression(firstArg)) {\n const id = getObjectStringProperty(firstArg, 'id', stringConstants)\n if (id) ids.add(id)\n }\n }\n if (callName === 'registerDictionaryEntryCommands' && firstArg && ts.isObjectLiteralExpression(firstArg)) {\n const prefix = getObjectStringProperty(firstArg, 'commandPrefix', stringConstants)\n if (prefix) {\n ids.add(`${prefix}.create`)\n ids.add(`${prefix}.update`)\n ids.add(`${prefix}.delete`)\n }\n }\n }\n ts.forEachChild(node, collectRegistrations)\n }\n\n collectVariables(sourceFile)\n collectRegistrations(sourceFile)\n return Array.from(ids).sort((a, b) => a.localeCompare(b))\n}\n\nfunction collectCommandLoaderEntries(\n roots: ModuleRoots,\n imps: ModuleImports,\n modId: string,\n quiet = false,\n): CommandLoaderGenerationEntry[] {\n const files = scanModuleDir(roots, COMMAND_SCAN_CONFIG)\n const entries: CommandLoaderGenerationEntry[] = []\n for (const file of files) {\n const relPath = `commands/${file.relPath}`\n const resolved = resolveModuleFile(roots, imps, relPath)\n if (!resolved) continue\n const logicalKey = stripModuleCodeExtension(file.relPath)\n const basename = path.basename(logicalKey)\n if (basename === 'shared' || basename === 'factory') continue\n const ids = extractCommandIdsFromSource(resolved.absolutePath)\n if (ids.length > 0) warnIfRegisterCommandNotAtImportTime(resolved.absolutePath, quiet)\n entries.push({\n moduleId: modId,\n key: `${modId}:commands:${logicalKey}`,\n importPath: resolved.importPath,\n ids,\n })\n }\n return entries\n}\n\nexport function renderCommandLoadersFile(entries: CommandLoaderGenerationEntry[]): string {\n const seenCommandIds = new Map<string, string>()\n const loaderEntries: WriterFunction[] = []\n\n for (const entry of entries) {\n const loadValue = arrowFunction({\n body: importExpression(sanitizeGeneratedModuleSpecifier(entry.importPath)),\n })\n for (const id of entry.ids) {\n const previous = seenCommandIds.get(id)\n if (previous && previous !== entry.key) {\n throw new Error(`[generate] Duplicate command id \"${id}\" discovered in \"${previous}\" and \"${entry.key}\"`)\n }\n seenCommandIds.set(id, entry.key)\n loaderEntries.push(objectLiteral([\n { name: 'moduleId', value: entry.moduleId },\n { name: 'id', value: id },\n { name: 'key', value: entry.key },\n { name: 'load', value: loadValue },\n ]))\n }\n loaderEntries.push(objectLiteral([\n { name: 'moduleId', value: entry.moduleId },\n { name: 'key', value: entry.key },\n { name: 'load', value: loadValue },\n ]))\n }\n\n const sourceFile = createGeneratedSourceFile('command-loaders.generated.ts')\n addAutoGeneratedComment(sourceFile, 'command-loaders')\n\n addImportSpec(sourceFile, {\n moduleSpecifier: '@open-mercato/shared/lib/commands',\n isTypeOnly: true,\n namedImports: [{ name: 'CommandLoader' }],\n })\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'commandLoaderEntries',\n type: 'CommandLoader[]',\n initializer: arrayLiteral(loaderEntries, writeValue),\n },\n ],\n })\n sourceFile.addExportAssignment({\n isExportEquals: false,\n expression: 'commandLoaderEntries',\n })\n\n return getSourceText(sourceFile)\n}\n\nexport function renderBootstrapRegistrationsFile(options: {\n entryImports: string[]\n registrationImports: string[]\n calls: string[]\n}): string {\n const uniqueImports = [...new Set([...options.entryImports, ...options.registrationImports])]\n\n const sourceFile = createGeneratedSourceFile('bootstrap-registrations.generated.ts')\n addAutoGeneratedComment(sourceFile, 'registry')\n addImportStatements(sourceFile, uniqueImports)\n\n sourceFile.addFunction({\n name: 'runBootstrapRegistrations',\n isExported: true,\n returnType: 'void',\n statements: options.calls,\n })\n\n return getSourceText(sourceFile)\n}\n\nfunction serializeGeneratedImport(statement: GeneratedImportStatement): string {\n if (typeof statement === 'string') {\n return statement\n }\n\n const moduleSpecifier = statement.moduleSpecifier ?? ''\n const clauses: string[] = []\n\n if (statement.defaultImport) {\n clauses.push(statement.defaultImport)\n }\n\n if (statement.namespaceImport) {\n clauses.push(`* as ${statement.namespaceImport}`)\n }\n\n if (statement.namedImports && statement.namedImports.length > 0) {\n const namedImports = statement.namedImports.map((namedImport) => {\n if (typeof namedImport === 'string') {\n return namedImport\n }\n const prefix = namedImport.isTypeOnly ? 'type ' : ''\n const alias = namedImport.alias ? ` as ${namedImport.alias}` : ''\n return `${prefix}${namedImport.name}${alias}`\n })\n clauses.push(`{ ${namedImports.join(', ')} }`)\n }\n\n const typePrefix = statement.isTypeOnly ? 'type ' : ''\n if (clauses.length === 0) {\n return `import ${toLiteral(moduleSpecifier)}`\n }\n\n return `import ${typePrefix}${clauses.join(', ')} from ${toLiteral(moduleSpecifier)}`\n}\n\nfunction findExistingModuleFile(baseDir: string, relativePath: string): string | null {\n const directPath = path.join(baseDir, relativePath)\n if (fs.existsSync(directPath)) return directPath\n\n const stripped = stripModuleCodeExtension(relativePath)\n for (const extension of MODULE_CODE_EXTENSIONS) {\n const candidate = path.join(baseDir, `${stripped}${extension}`)\n if (fs.existsSync(candidate)) return candidate\n }\n\n return null\n}\n\nfunction findExistingModuleFileByBaseNames(baseDir: string, relativeBaseNames: string[]): string | null {\n for (const relativeBaseName of relativeBaseNames) {\n const resolved = findExistingModuleFile(baseDir, relativeBaseName)\n if (resolved) return resolved\n }\n return null\n}\n\nconst warnedConventionPaths = new Set<string>()\n\n/**\n * Clears the once-per-path warning ledger.\n *\n * A single `yarn generate` runs three registry emitters over one discovery, and each of them\n * walks the same frontend and backend page files, so an unguarded warning would print the\n * same line up to six times. A diagnostic that repeats is a diagnostic that gets skimmed\n * past, so each offending path is named once per run and the ledger resets when the run's\n * discovery is built.\n */\nexport function resetConventionWarnings(): void {\n warnedConventionPaths.clear()\n}\n\nfunction alreadyWarned(sourcePath: string): boolean {\n if (warnedConventionPaths.has(sourcePath)) return true\n warnedConventionPaths.add(sourcePath)\n return false\n}\n\n/**\n * Warns when a discovered page metadata file exports no `metadata` binding.\n *\n * Both page-route emitters read `<module>.metadata` off the imported file. When the author\n * named the export something else \u2014 `meta` is the common near-miss \u2014 that read yields\n * `undefined`, the route still generates, and every declaration in the file is dropped.\n * `requireAuth` and `requireFeatures` are among them, so the page ships with no\n * authorization gate and nothing in the build says so. The warning names that consequence\n * because the rule alone (\"export `metadata`\") does not convey why it matters.\n */\nexport function warnIfPageMetaMissingMetadataExport(metaPath: string | null, quiet = false): void {\n if (!metaPath || quiet) return\n if (hasNamedExport(metaPath, 'metadata')) return\n if (alreadyWarned(metaPath)) return\n console.warn(\n `[generate] \u26A0 Page metadata file exports no 'metadata' \u2014 page metadata is dropped, `\n + `including requireAuth/requireFeatures, so the page renders with NO authorization gate: ${metaPath}`,\n )\n}\n\n/**\n * Warns when a `commands/*.ts` file registers commands only from inside a function.\n *\n * Command discovery extracts ids statically and emits a lazy loader per file; the loader\n * resolves a command by importing that file and relying on `registerCommand(...)` running as\n * an import-time side effect. When every call sits inside a function body that nothing\n * invokes, the ids still appear in the generated manifest but the handlers never register,\n * so the command bus reports the command as unknown at runtime.\n *\n * Heuristic and deliberately conservative: it only fires when the file contains at least one\n * `registerCommand(` call and none of them is at top level (column 0), which is how every\n * correct module writes them.\n */\nexport function warnIfRegisterCommandNotAtImportTime(sourcePath: string, quiet = false): void {\n if (quiet) return\n let source = ''\n try {\n source = fs.readFileSync(sourcePath, 'utf8')\n } catch {\n return\n }\n if (!/\\bregisterCommand\\s*\\(/.test(source)) return\n const hasTopLevelCall = /^registerCommand\\s*\\(/m.test(source)\n if (hasTopLevelCall) return\n if (alreadyWarned(sourcePath)) return\n console.warn(\n `[generate] \u26A0 registerCommand(...) is never called at import time \u2014 these command ids will `\n + `appear in the manifest but the handlers will not register at runtime: ${sourcePath}`,\n )\n}\n\nfunction toModuleImportSubpath(filePath: string, baseDir: string): string {\n const relativePath = path.relative(baseDir, filePath).replace(/\\\\/g, '/')\n return stripModuleCodeExtension(relativePath)\n}\n\nfunction normalizeApiMethodMetadata(raw: unknown): RuntimeApiMethodMetadata | null {\n if (!raw || typeof raw !== 'object') return null\n const source = raw as Record<string, unknown>\n const normalized: RuntimeApiMethodMetadata = {}\n\n if (typeof source.requireAuth === 'boolean') {\n normalized.requireAuth = source.requireAuth\n }\n if (Array.isArray(source.requireRoles)) {\n normalized.requireRoles = source.requireRoles.filter((role): role is string => typeof role === 'string' && role.length > 0)\n }\n if (Array.isArray(source.requireFeatures)) {\n normalized.requireFeatures = source.requireFeatures.filter((feature): feature is string => typeof feature === 'string' && feature.length > 0)\n }\n if (source.rateLimit && typeof source.rateLimit === 'object') {\n const rateLimit = source.rateLimit as Record<string, unknown>\n if (typeof rateLimit.points === 'number' && typeof rateLimit.duration === 'number') {\n normalized.rateLimit = {\n points: rateLimit.points,\n duration: rateLimit.duration,\n blockDuration: typeof rateLimit.blockDuration === 'number' ? rateLimit.blockDuration : undefined,\n keyPrefix: typeof rateLimit.keyPrefix === 'string' ? rateLimit.keyPrefix : undefined,\n }\n }\n }\n\n return Object.keys(normalized).length > 0 ? normalized : null\n}\n\nfunction buildApiMetadataLiteral(metadata: unknown, method?: HttpMethod): string {\n if (!metadata || typeof metadata !== 'object') return 'undefined'\n const source = metadata as Record<string, unknown>\n const methods: HttpMethod[] = method ? [method] : ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']\n const normalized: Partial<Record<HttpMethod, RuntimeApiMethodMetadata>> = {}\n\n for (const entryMethod of methods) {\n const candidate = method ? source : source[entryMethod]\n const value = normalizeApiMethodMetadata(candidate)\n if (value) {\n normalized[entryMethod] = value\n }\n }\n\n return Object.keys(normalized).length > 0 ? toLiteral(normalized) : 'undefined'\n}\n\nfunction resolveApiPathFromMetadata(metadata: unknown, fallbackPath: string): string {\n if (!metadata || typeof metadata !== 'object') return fallbackPath\n const candidate = (metadata as Record<string, unknown>).path\n return typeof candidate === 'string' && candidate.length > 0 ? candidate : fallbackPath\n}\n\nfunction detectExportedHttpMethods(sourceFile: string): HttpMethod[] {\n let source = ''\n try {\n source = fs.readFileSync(sourceFile, 'utf8')\n } catch {\n return []\n }\n\n const knownMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'] as HttpMethod[]\n const exportedMethods = new Set<HttpMethod>()\n const collectKnownMethods = (rawSpecifiers: string[], opts?: { useExportedAlias?: boolean; useDestructuredProperty?: boolean }) => {\n for (const specifier of rawSpecifiers) {\n const trimmed = specifier.trim()\n if (!trimmed) continue\n\n let candidate = trimmed\n if (opts?.useExportedAlias) {\n candidate = trimmed.split(/\\s+as\\s+/i).pop()?.trim() ?? trimmed\n }\n if (opts?.useDestructuredProperty) {\n candidate = trimmed.split(':')[0]?.trim() ?? trimmed\n }\n\n if (knownMethods.includes(candidate as HttpMethod)) {\n exportedMethods.add(candidate as HttpMethod)\n }\n }\n }\n\n for (const method of knownMethods) {\n const pattern = new RegExp(`export\\\\s+(?:async\\\\s+)?function\\\\s+${method}\\\\b|export\\\\s+(?:const|let|var)\\\\s+${method}\\\\b`)\n if (pattern.test(source)) {\n exportedMethods.add(method)\n }\n }\n\n const reExportPattern = /export\\s*{([^}]+)}/g\n for (const match of source.matchAll(reExportPattern)) {\n const exportBlock = match[1] ?? ''\n collectKnownMethods(\n exportBlock\n .split(',')\n .map((part) => part.trim())\n .filter((part) => part.length > 0),\n { useExportedAlias: true },\n )\n }\n\n const destructuredExportPattern = /export\\s+(?:const|let|var)\\s*{([^}]+)}/g\n for (const match of source.matchAll(destructuredExportPattern)) {\n const exportBlock = match[1] ?? ''\n collectKnownMethods(\n exportBlock\n .split(',')\n .map((part) => part.trim())\n .filter((part) => part.length > 0),\n { useDestructuredProperty: true },\n )\n }\n\n return knownMethods.filter((method) => exportedMethods.has(method))\n}\n\nfunction buildPageRouteProps(metaExpr: string, routePath: string): string {\n return `pattern: ${toLiteral(routePath || '/')}, requireAuth: (${metaExpr})?.requireAuth, requireRoles: (${metaExpr})?.requireRoles, requireFeatures: (${metaExpr})?.requireFeatures, requireCustomerAuth: (${metaExpr})?.requireCustomerAuth, requireCustomerFeatures: (${metaExpr})?.requireCustomerFeatures, nav: (${metaExpr})?.nav, title: (${metaExpr})?.pageTitle ?? (${metaExpr})?.title, titleKey: (${metaExpr})?.pageTitleKey ?? (${metaExpr})?.titleKey, group: (${metaExpr})?.pageGroup ?? (${metaExpr})?.group, groupKey: (${metaExpr})?.pageGroupKey ?? (${metaExpr})?.groupKey, icon: (${metaExpr})?.icon, order: (${metaExpr})?.pageOrder ?? (${metaExpr})?.order, priority: (${metaExpr})?.pagePriority ?? (${metaExpr})?.priority, navHidden: (${metaExpr})?.navHidden, visible: (${metaExpr})?.visible, enabled: (${metaExpr})?.enabled, breadcrumb: (${metaExpr})?.breadcrumb, pageContext: (${metaExpr})?.pageContext, placement: (${metaExpr})?.placement`\n}\n\nfunction buildPageRouteManifestSpread(metaExpr: string, routePath: string): WriterFunction {\n return callExpression(identifier('resolvePageRouteMetadata'), [routePath || '/', identifier(metaExpr)])\n}\n\nfunction buildManifestRouteLoader(importPath: string): WriterFunction {\n return arrowFunction({\n async: true,\n body: block((writer) => {\n writeStatements(writer, [\n variableStatement({\n name: 'mod',\n initializer: awaitExpression(importExpression(sanitizeGeneratedModuleSpecifier(importPath))),\n }),\n returnStatement(\n asExpression(\n parenthesized(nullishCoalesce([\n propertyAccess(identifier('mod'), 'default'),\n identifier('mod'),\n ])),\n 'any',\n ),\n ),\n ])\n }),\n })\n}\n\nfunction buildManifestApiLoader(importPath: string): WriterFunction {\n return arrowFunction({\n async: true,\n body: importExpression(sanitizeGeneratedModuleSpecifier(importPath)),\n })\n}\n\nfunction normalizeBreadcrumb(raw: unknown): SerializablePageMetadata['breadcrumb'] {\n if (!Array.isArray(raw)) return undefined\n const breadcrumb = raw\n .map((entry) => {\n if (!entry || typeof entry !== 'object') return null\n const source = entry as Record<string, unknown>\n if (typeof source.label !== 'string') return null\n return {\n label: source.label,\n labelKey: typeof source.labelKey === 'string' ? source.labelKey : undefined,\n href: typeof source.href === 'string' ? source.href : undefined,\n }\n })\n .filter((entry): entry is NonNullable<typeof entry> => entry !== null)\n return breadcrumb.length > 0 ? breadcrumb : undefined\n}\n\nfunction normalizePlacement(raw: unknown): SerializablePageMetadata['placement'] {\n if (!raw || typeof raw !== 'object') return undefined\n const source = raw as Record<string, unknown>\n if (typeof source.section !== 'string' || source.section.length === 0) return undefined\n return {\n section: source.section,\n sectionLabel: typeof source.sectionLabel === 'string' ? source.sectionLabel : undefined,\n sectionLabelKey: typeof source.sectionLabelKey === 'string' ? source.sectionLabelKey : undefined,\n order: typeof source.order === 'number' ? source.order : undefined,\n }\n}\n\nfunction normalizePortalNav(raw: unknown): SerializablePageMetadata['nav'] {\n if (!raw || typeof raw !== 'object') return undefined\n const source = raw as Record<string, unknown>\n if (typeof source.label !== 'string' || source.label.length === 0) return undefined\n const group = source.group === 'main' || source.group === 'account' ? source.group : undefined\n return {\n label: source.label,\n labelKey: typeof source.labelKey === 'string' ? source.labelKey : undefined,\n group,\n order: typeof source.order === 'number' ? source.order : undefined,\n icon: typeof source.icon === 'string' ? source.icon : undefined,\n }\n}\n\nfunction normalizePageMetadata(raw: unknown): SerializablePageMetadata | null {\n if (!raw || typeof raw !== 'object') return null\n const source = raw as Record<string, unknown>\n const normalized: SerializablePageMetadata = {}\n\n if (typeof source.requireAuth === 'boolean') normalized.requireAuth = source.requireAuth\n if (Array.isArray(source.requireRoles)) normalized.requireRoles = source.requireRoles.filter((role): role is string => typeof role === 'string' && role.length > 0)\n if (Array.isArray(source.requireFeatures)) normalized.requireFeatures = source.requireFeatures.filter((feature): feature is string => typeof feature === 'string' && feature.length > 0)\n if (typeof source.requireCustomerAuth === 'boolean') normalized.requireCustomerAuth = source.requireCustomerAuth\n if (Array.isArray(source.requireCustomerFeatures)) normalized.requireCustomerFeatures = source.requireCustomerFeatures.filter((feature): feature is string => typeof feature === 'string' && feature.length > 0)\n if (typeof source.title === 'string') normalized.title = source.title\n if (typeof source.titleKey === 'string') normalized.titleKey = source.titleKey\n if (typeof source.pageTitle === 'string') normalized.pageTitle = source.pageTitle\n if (typeof source.pageTitleKey === 'string') normalized.pageTitleKey = source.pageTitleKey\n if (typeof source.group === 'string') normalized.group = source.group\n if (typeof source.groupKey === 'string') normalized.groupKey = source.groupKey\n if (typeof source.pageGroup === 'string') normalized.pageGroup = source.pageGroup\n if (typeof source.pageGroupKey === 'string') normalized.pageGroupKey = source.pageGroupKey\n if (typeof source.order === 'number') normalized.order = source.order\n if (typeof source.pageOrder === 'number') normalized.pageOrder = source.pageOrder\n if (typeof source.priority === 'number') normalized.priority = source.priority\n if (typeof source.pagePriority === 'number') normalized.pagePriority = source.pagePriority\n if (typeof source.navHidden === 'boolean') normalized.navHidden = source.navHidden\n if (typeof source.pageContext === 'string' && ['main', 'admin', 'settings', 'profile'].includes(source.pageContext)) {\n normalized.pageContext = source.pageContext as SerializablePageMetadata['pageContext']\n }\n const breadcrumb = normalizeBreadcrumb(source.breadcrumb)\n if (breadcrumb) normalized.breadcrumb = breadcrumb\n const placement = normalizePlacement(source.placement)\n if (placement) normalized.placement = placement\n const nav = normalizePortalNav(source.nav)\n if (nav) normalized.nav = nav\n if (typeof source.icon === 'string') normalized.icon = source.icon\n\n return Object.keys(normalized).length > 0 ? normalized : null\n}\n\nfunction requiresRuntimePageMetadata(raw: unknown): boolean {\n if (!raw || typeof raw !== 'object') return false\n const source = raw as Record<string, unknown>\n if (typeof source.visible === 'function' || typeof source.enabled === 'function') {\n return true\n }\n return source.icon != null && typeof source.icon !== 'string'\n}\n\nfunction normalizeSubscriberMetadata(raw: unknown): SerializableSubscriberMetadata | null {\n if (!raw || typeof raw !== 'object') return null\n const source = raw as Record<string, unknown>\n const normalized: SerializableSubscriberMetadata = {}\n if (typeof source.id === 'string' && source.id.length > 0) normalized.id = source.id\n if (typeof source.event === 'string' && source.event.length > 0) normalized.event = source.event\n if (typeof source.persistent === 'boolean') normalized.persistent = source.persistent\n if (typeof source.sync === 'boolean') normalized.sync = source.sync\n if (typeof source.priority === 'number') normalized.priority = source.priority\n return Object.keys(normalized).length > 0 ? normalized : null\n}\n\nfunction normalizeWorkerMetadata(raw: unknown): SerializableWorkerMetadata | null {\n if (!raw || typeof raw !== 'object') return null\n const source = raw as Record<string, unknown>\n const normalized: SerializableWorkerMetadata = {}\n if (typeof source.id === 'string' && source.id.length > 0) normalized.id = source.id\n if (typeof source.queue === 'string' && source.queue.length > 0) normalized.queue = source.queue\n if (typeof source.concurrency === 'number') normalized.concurrency = source.concurrency\n if (typeof source.lockDuration === 'number') normalized.lockDuration = source.lockDuration\n if (typeof source.maxStalledCount === 'number') normalized.maxStalledCount = source.maxStalledCount\n if (typeof source.onJobAbandoned === 'function') normalized.hasJobAbandonedHook = true\n if (source.schedulerSafe === true) normalized.schedulerSafe = true\n if (Array.isArray(source.schedulerRequiredFeatures)) {\n const features = source.schedulerRequiredFeatures.filter(\n (feature): feature is string => typeof feature === 'string' && feature.length > 0,\n )\n if (features.length > 0) normalized.schedulerRequiredFeatures = features\n }\n return Object.keys(normalized).length > 0 ? normalized : null\n}\n\nasync function loadSubscriberMetadata(sourceFile: string): Promise<SerializableSubscriberMetadata | null> {\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(sourceFile)\n return normalizeSubscriberMetadata(sourceModule?.metadata)\n ?? normalizeSubscriberMetadata(extractNamedObjectLiteralExport(sourceFile, 'metadata'))\n}\n\nasync function loadWorkerMetadata(sourceFile: string): Promise<SerializableWorkerMetadata | null> {\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(sourceFile)\n const metadata = normalizeWorkerMetadata(sourceModule?.metadata)\n ?? normalizeWorkerMetadata(extractNamedObjectLiteralExport(sourceFile, 'metadata'))\n if (!metadata) return null\n // Resolved from the syntax, not the extracted value: a worker module that cannot be imported at\n // build time falls back to the literal extractor, which cannot tell an imported function from an\n // unresolvable identifier. Missing this is silent \u2014 the hook is simply never installed.\n if (!metadata.hasJobAbandonedHook && namedObjectLiteralDeclaresProperty(sourceFile, 'metadata', 'onJobAbandoned')) {\n metadata.hasJobAbandonedHook = true\n }\n return metadata\n}\n\nasync function discoverSubscribers(\n roots: ModuleRoots,\n imps: ModuleImports,\n modId: string,\n): Promise<DiscoveredSubscriber[]> {\n const subscribers: DiscoveredSubscriber[] = []\n for (const { relPath } of scanModuleDir(roots, SCAN_CONFIGS.subscribers)) {\n const resolved = resolveModuleFile(\n roots,\n imps,\n path.posix.join('subscribers', relPath.replace(/\\\\/g, '/')),\n )\n if (!resolved) continue\n const segs = relPath.split('/')\n const file = segs.pop()!\n const name = stripModuleCodeExtension(file)\n subscribers.push({\n id: [modId, ...segs, name].filter(Boolean).join(':'),\n importPath: sanitizeGeneratedModuleSpecifier(resolved.importPath),\n metadata: await loadSubscriberMetadata(resolved.absolutePath),\n })\n }\n return subscribers\n}\n\nasync function discoverWorkers(\n roots: ModuleRoots,\n imps: ModuleImports,\n modId: string,\n): Promise<DiscoveredWorker[]> {\n const workers: DiscoveredWorker[] = []\n for (const { relPath } of scanModuleDir(roots, SCAN_CONFIGS.workers)) {\n const resolved = resolveModuleFile(\n roots,\n imps,\n path.posix.join('workers', relPath.replace(/\\\\/g, '/')),\n )\n if (!resolved) continue\n const metadata = await loadWorkerMetadata(resolved.absolutePath)\n if (!metadata?.queue) continue\n const segs = relPath.split('/')\n const file = segs.pop()!\n const name = stripModuleCodeExtension(file)\n workers.push({\n id: [modId, 'workers', ...segs, name].filter(Boolean).join(':'),\n importPath: sanitizeGeneratedModuleSpecifier(resolved.importPath),\n metadata,\n })\n }\n return workers\n}\n\nfunction discoverTranslations(roots: ModuleRoots): DiscoveredTranslation[] {\n const i18nApp = path.join(roots.appBase, 'i18n')\n const pkgI18nBase = resolveStandaloneSourceMirrorBase(roots.pkgBase) ?? roots.pkgBase\n const i18nCore = path.join(pkgI18nBase, 'i18n')\n const locales = new Set<string>()\n if (fs.existsSync(i18nCore)) {\n for (const entry of fs.readdirSync(i18nCore, { withFileTypes: true })) {\n if (entry.isFile() && /^[a-zA-Z0-9][a-zA-Z0-9_-]*\\.json$/.test(entry.name)) {\n locales.add(entry.name.replace(/\\.json$/, ''))\n }\n }\n }\n if (fs.existsSync(i18nApp)) {\n for (const entry of fs.readdirSync(i18nApp, { withFileTypes: true })) {\n if (entry.isFile() && /^[a-zA-Z0-9][a-zA-Z0-9_-]*\\.json$/.test(entry.name)) {\n locales.add(entry.name.replace(/\\.json$/, ''))\n }\n }\n }\n return Array.from(locales, (locale) => ({\n locale,\n coreHas: fs.existsSync(path.join(i18nCore, `${locale}.json`)),\n appHas: fs.existsSync(path.join(i18nApp, `${locale}.json`)),\n }))\n}\n\nasync function createModuleRegistryDiscovery(\n resolver: PackageResolver,\n quiet = false,\n): Promise<ModuleRegistryDiscovery> {\n resetConventionWarnings()\n const enabled = resolver.loadEnabledModules()\n const modules: ModuleRegistryDiscoveryEntry[] = []\n const trackedRoots = new Set<string>()\n\n for (const entry of enabled) {\n const modId = entry.id\n const roots = resolver.getModulePaths(entry)\n verifyThirdPartyModuleShape(entry, roots.pkgBase)\n const rawImps = resolver.getModuleImportBase(entry)\n const appImportBase = entry.from === '@app' ? `../../src/modules/${modId}` : rawImps.appBase\n const imps: ModuleImports = { appBase: appImportBase, pkgBase: rawImps.pkgBase }\n trackedRoots.add(roots.appBase)\n trackedRoots.add(roots.pkgBase)\n\n let subscribers: Promise<DiscoveredSubscriber[]> | undefined\n let workers: Promise<DiscoveredWorker[]> | undefined\n const resolvedFiles = new Map<string, ResolvedFile | null>()\n const resolve = (relativePath: string): ResolvedFile | null => {\n if (!resolvedFiles.has(relativePath)) {\n resolvedFiles.set(relativePath, resolveModuleFile(roots, imps, relativePath))\n }\n return resolvedFiles.get(relativePath) ?? null\n }\n modules.push({\n modId,\n roots,\n imps,\n appImportBase,\n isAppModule: entry.from === '@app',\n resolve,\n frontendFiles: scanModuleDir(roots, SCAN_CONFIGS.frontendPages),\n backendFiles: scanModuleDir(roots, SCAN_CONFIGS.backendPages),\n commandLoaderEntries: collectCommandLoaderEntries(roots, imps, modId, quiet),\n getSubscribers: () => subscribers ??= discoverSubscribers(roots, imps, modId),\n getWorkers: () => workers ??= discoverWorkers(roots, imps, modId),\n translations: discoverTranslations(roots),\n dashboardWidgetEntries: scanDashboardWidgetEntries({\n modId,\n roots,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n }),\n })\n }\n\n let structureChecksum: string | undefined\n return {\n enabled,\n modules,\n getStructureChecksum: () => structureChecksum ??= calculateStructureChecksum(Array.from(trackedRoots)),\n }\n}\n\nasync function loadPageMetadataForManifest(options: {\n sourceFile: string\n metaPath?: string\n runtimeExpr: string\n allowRuntimeFallback?: boolean\n}): Promise<PageMetadataManifestLoadResult> {\n const metadataModule = options.metaPath ?? options.sourceFile\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(metadataModule)\n const runtimeMetadata = sourceModule?.metadata\n\n if (\n options.allowRuntimeFallback\n && (requiresRuntimePageMetadata(runtimeMetadata) || requiresRuntimePageMetadataFromSourceFile(metadataModule))\n ) {\n return {\n manifestExpr: options.runtimeExpr,\n requiresRuntimeImport: true,\n }\n }\n\n const normalized = normalizePageMetadata(runtimeMetadata)\n ?? normalizePageMetadata(extractNamedObjectLiteralExport(metadataModule, 'metadata'))\n\n return {\n manifestExpr: normalized ? `(${toLiteral(normalized)} as any)` : '(undefined as any)',\n requiresRuntimeImport: false,\n }\n}\n\nasync function processPageFiles(options: {\n files: Array<{ relPath: string; fromApp: boolean }>\n type: 'frontend' | 'backend'\n modId: string\n appDir: string\n pkgDir: string\n appImportBase: string\n pkgImportBase: string\n eagerImports: string[]\n runtimeImports: string[]\n manifestImports?: string[]\n importIdRef: { value: number }\n collectRoute?: (registration: { routePath: string; fromApp: boolean }) => void\n quiet?: boolean\n}): Promise<PageRouteGenerationResult> {\n const { files, type, modId, appDir, pkgDir, appImportBase, pkgImportBase, eagerImports, runtimeImports, manifestImports, importIdRef, collectRoute, quiet } = options\n const metaPrefix = type === 'frontend' ? 'M' : 'BM'\n const eagerRoutes: string[] = []\n const runtimeRoutes: string[] = []\n const manifestRoutes: WriterFunction[] = []\n const manifestShardRoutes: RouteManifestShardEntry[] = []\n const metadataRoutes: RouteManifestShardEntry[] = []\n const routePatterns: string[] = []\n\n // Next-style page.* files\n for (const { relPath, fromApp } of files.filter(({ relPath: f }) => isModulePageFile(path.basename(f)))) {\n const segs = relPath.split('/')\n const pageFile = segs.pop()!\n const pageBaseName = stripModuleCodeExtension(pageFile)\n importIdRef.value++\n importIdRef.value++\n const runtimeMetaName = `${metaPrefix}Runtime${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n const sub = segs.length ? `${segs.join('/')}/${pageBaseName}` : pageBaseName\n const importPath = sanitizeGeneratedModuleSpecifier(`${fromApp ? appImportBase : pkgImportBase}/${type}/${sub}`)\n const routePath = type === 'frontend'\n ? '/' + (segs.join('/') || '')\n : '/backend/' + (segs.join('/') || modId)\n const moduleBaseDir = path.join(fromApp ? appDir : pkgDir, ...segs)\n const sourceFile = findExistingModuleFile(moduleBaseDir, pageFile)\n if (!sourceFile || !hasDefaultExport(sourceFile)) continue\n collectRoute?.({ routePath, fromApp })\n const metaPath = findExistingModuleFileByBaseNames(moduleBaseDir, ['page.meta', 'meta'])\n warnIfPageMetaMissingMetadataExport(metaPath, quiet)\n let metaExpr = 'undefined'\n let runtimeMetaExpr = 'undefined'\n let manifestMetaExpr = 'undefined'\n let manifestImportStatement: string | null = null\n if (metaPath) {\n const metaImportName = `${metaPrefix}${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n const metaImportPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${toModuleImportSubpath(metaPath, fromApp ? appDir : pkgDir)}`\n )\n const manifestMetaImportName = `${metaPrefix}Manifest${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n eagerImports.push(buildImportStatement(`* as ${metaImportName}`, metaImportPath))\n runtimeImports.push(buildImportStatement(`* as ${runtimeMetaName}`, metaImportPath))\n metaExpr = `(${metaImportName}.metadata as any)`\n runtimeMetaExpr = `(((${runtimeMetaName} as any).metadata) as any)`\n const manifestMetadata = await loadPageMetadataForManifest({\n sourceFile: metaPath,\n metaPath,\n runtimeExpr: `(((${manifestMetaImportName} as any).metadata) as any)`,\n allowRuntimeFallback: true,\n })\n manifestMetaExpr = manifestMetadata.manifestExpr\n if (manifestMetadata.requiresRuntimeImport) {\n manifestImportStatement = buildImportStatement(`* as ${manifestMetaImportName}`, metaImportPath)\n }\n } else {\n runtimeMetaExpr = `(((${runtimeMetaName} as any).metadata) as any)`\n const staticMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: '(undefined as any)',\n allowRuntimeFallback: false,\n })\n metaExpr = staticMetadata.manifestExpr\n const manifestMetaImportName = `${metaPrefix}Manifest${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n const manifestMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: `(((${manifestMetaImportName} as any).metadata) as any)`,\n allowRuntimeFallback: true,\n })\n manifestMetaExpr = manifestMetadata.manifestExpr\n if (manifestMetadata.requiresRuntimeImport) {\n manifestImportStatement = buildImportStatement(`* as ${manifestMetaImportName}`, importPath)\n }\n runtimeImports.push(buildImportStatement(`* as ${runtimeMetaName}`, importPath))\n }\n if (manifestImportStatement) {\n manifestImports?.push(manifestImportStatement)\n }\n const baseProps = buildPageRouteProps(metaExpr, routePath)\n const runtimeBaseProps = buildPageRouteProps(runtimeMetaExpr, routePath)\n const manifestBaseProps = buildPageRouteManifestSpread(manifestMetaExpr, routePath)\n eagerRoutes.push(`{ ${baseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`)\n runtimeRoutes.push(`{ ${runtimeBaseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`)\n const metadataEntries: GeneratedObjectEntry[] = [\n { name: 'moduleId', value: modId },\n { kind: 'spread', value: manifestBaseProps },\n ]\n const manifestEntry = objectLiteral([\n ...metadataEntries,\n { name: 'load', value: buildManifestRouteLoader(importPath) },\n ])\n const shardImports = manifestImportStatement ? [manifestImportStatement] : []\n manifestRoutes.push(manifestEntry)\n manifestShardRoutes.push({\n path: routePath,\n declaration: renderGeneratedValue(manifestEntry),\n imports: shardImports,\n })\n metadataRoutes.push({\n path: routePath,\n declaration: renderGeneratedValue(objectLiteral(metadataEntries)),\n imports: shardImports,\n })\n routePatterns.push(routePath)\n }\n\n // Back-compat direct files (old-style pages like login.tsx instead of login/page.tsx)\n for (const { relPath, fromApp } of files.filter(({ relPath: f }) => !isModulePageFile(path.basename(f)))) {\n const segs = relPath.split('/')\n const file = segs.pop()!\n const name = stripModuleCodeExtension(file)\n const routeSegs = [...segs, name].filter(Boolean)\n importIdRef.value++\n importIdRef.value++\n const runtimeMetaName = `${metaPrefix}Runtime${importIdRef.value++}_${toVar(modId)}_${toVar(routeSegs.join('_') || 'index')}`\n const importPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${[...segs, name].join('/')}`\n )\n const routePath = type === 'frontend'\n ? '/' + (routeSegs.join('/') || '')\n : '/backend/' + (segs[0] === modId\n ? [...segs, name].filter(Boolean).join('/')\n : [modId, ...segs, name].filter(Boolean).join('/'))\n const moduleBaseDir = path.join(fromApp ? appDir : pkgDir, ...segs)\n const sourceFile = findExistingModuleFile(moduleBaseDir, file)\n if (!sourceFile || !hasDefaultExport(sourceFile)) continue\n collectRoute?.({ routePath, fromApp })\n const metaPath = findExistingModuleFileByBaseNames(moduleBaseDir, [`${name}.meta`, 'meta'])\n let metaExpr = 'undefined'\n let runtimeMetaExpr = 'undefined'\n let manifestMetaExpr = 'undefined'\n let manifestImportStatement: string | null = null\n if (metaPath) {\n const metaImportName = `${metaPrefix}${importIdRef.value++}_${toVar(modId)}_${toVar(routeSegs.join('_') || 'index')}`\n const metaBase = path.basename(metaPath)\n const metaImportSub = stripModuleCodeExtension(metaBase) === 'meta' ? 'meta' : `${name}.meta`\n const metaImportPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${[...segs, metaImportSub].join('/')}`\n )\n const manifestMetaImportName = `${metaPrefix}Manifest${importIdRef.value++}_${toVar(modId)}_${toVar(routeSegs.join('_') || 'index')}`\n eagerImports.push(buildImportStatement(`* as ${metaImportName}`, metaImportPath))\n runtimeImports.push(buildImportStatement(`* as ${runtimeMetaName}`, metaImportPath))\n metaExpr = type === 'frontend' ? `(${metaImportName}.metadata as any)` : `${metaImportName}.metadata`\n runtimeMetaExpr = `(((${runtimeMetaName} as any).metadata) as any)`\n const manifestMetadata = await loadPageMetadataForManifest({\n sourceFile: metaPath,\n metaPath,\n runtimeExpr: `(((${manifestMetaImportName} as any).metadata) as any)`,\n allowRuntimeFallback: false,\n })\n manifestMetaExpr = manifestMetadata.manifestExpr\n if (manifestMetadata.requiresRuntimeImport) {\n manifestImportStatement = buildImportStatement(`* as ${manifestMetaImportName}`, metaImportPath)\n }\n } else {\n runtimeMetaExpr = `(((${runtimeMetaName} as any).metadata) as any)`\n const staticMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: '(undefined as any)',\n allowRuntimeFallback: false,\n })\n metaExpr = staticMetadata.manifestExpr\n const manifestMetaImportName = `${metaPrefix}Manifest${importIdRef.value++}_${toVar(modId)}_${toVar(routeSegs.join('_') || 'index')}`\n const manifestMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: `(((${manifestMetaImportName} as any).metadata) as any)`,\n allowRuntimeFallback: false,\n })\n manifestMetaExpr = manifestMetadata.manifestExpr\n if (manifestMetadata.requiresRuntimeImport) {\n manifestImportStatement = buildImportStatement(`* as ${manifestMetaImportName}`, importPath)\n }\n runtimeImports.push(buildImportStatement(`* as ${runtimeMetaName}`, importPath))\n }\n if (manifestImportStatement) {\n manifestImports?.push(manifestImportStatement)\n }\n const baseProps = buildPageRouteProps(metaExpr, routePath)\n const runtimeBaseProps = buildPageRouteProps(runtimeMetaExpr, routePath)\n const manifestBaseProps = buildPageRouteManifestSpread(manifestMetaExpr, routePath)\n eagerRoutes.push(`{ ${baseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`)\n runtimeRoutes.push(`{ ${runtimeBaseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`)\n const metadataEntries: GeneratedObjectEntry[] = [\n { name: 'moduleId', value: modId },\n { kind: 'spread', value: manifestBaseProps },\n ]\n const manifestEntry = objectLiteral([\n ...metadataEntries,\n { name: 'load', value: buildManifestRouteLoader(importPath) },\n ])\n const shardImports = manifestImportStatement ? [manifestImportStatement] : []\n manifestRoutes.push(manifestEntry)\n manifestShardRoutes.push({\n path: routePath,\n declaration: renderGeneratedValue(manifestEntry),\n imports: shardImports,\n })\n metadataRoutes.push({\n path: routePath,\n declaration: renderGeneratedValue(objectLiteral(metadataEntries)),\n imports: shardImports,\n })\n routePatterns.push(routePath)\n }\n\n return {\n eagerRoutes,\n runtimeRoutes,\n manifestRoutes,\n manifestShardRoutes,\n metadataRoutes,\n routePatterns,\n }\n}\n\nasync function processApiRoutes(options: {\n roots: ModuleRoots\n modId: string\n appImportBase: string\n pkgImportBase: string\n eagerImports: string[]\n importIdRef: { value: number }\n}): Promise<ApiRouteGenerationResult> {\n const { roots, modId, appImportBase, pkgImportBase, eagerImports, importIdRef } = options\n const apiApp = path.join(roots.appBase, 'api')\n const apiPkg = path.join(roots.pkgBase, 'api')\n if (!fs.existsSync(apiApp) && !fs.existsSync(apiPkg)) {\n return { eagerApis: [], runtimeApis: [], manifestApis: [], manifestShardApis: [], metadataApis: [] }\n }\n\n const eagerApis: string[] = []\n const runtimeApis: string[] = []\n const manifestApis: WriterFunction[] = []\n const manifestShardApis: RouteManifestShardEntry[] = []\n const metadataApis: RouteManifestShardEntry[] = []\n\n // route.* aggregations\n const routeFiles = scanModuleDir(roots, SCAN_CONFIGS.apiRoutes)\n for (const { relPath, fromApp } of routeFiles) {\n const segs = relPath.split('/')\n const routeFile = segs.pop()!\n const reqSegs = [modId, ...segs]\n const importName = `R${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n const sourceDir = fromApp ? apiApp : apiPkg\n const sourceFile = findExistingModuleFile(path.join(sourceDir, ...segs), routeFile)\n if (!sourceFile) continue\n const apiSegPath = segs.join('/')\n const importPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/api${apiSegPath ? `/${apiSegPath}` : ''}/${stripModuleCodeExtension(routeFile)}`\n )\n const routePath = '/' + reqSegs.filter(Boolean).join('/')\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(sourceFile)\n const metadata = sourceModule?.metadata ?? extractNamedObjectLiteralExport(sourceFile, 'metadata')\n const resolvedPath = resolveApiPathFromMetadata(metadata, routePath)\n const exportedMethods = detectExportedHttpMethods(sourceFile)\n if (exportedMethods.length === 0) continue\n if (!metadata && !hasNamedExport(sourceFile, 'metadata')) {\n console.warn(`[generate] \u26A0 Route file exports handlers but no metadata \u2014 auth will default to required: ${sourceFile}`)\n }\n const metadataLiteral = buildApiMetadataLiteral(metadata)\n const hasOpenApi = await moduleHasExport(sourceFile, 'openApi')\n const docsPart = hasOpenApi ? `, docs: ((${importName} as any).openApi as any)` : ''\n eagerImports.push(buildImportStatement(`* as ${importName}`, importPath))\n eagerApis.push(`{ path: ((${importName} as any).metadata?.path ?? ${toLiteral(routePath)}), metadata: (${importName} as any).metadata, handlers: ${importName} as any${docsPart} }`)\n runtimeApis.push(`{ path: ${toLiteral(resolvedPath)}, metadata: ${metadataLiteral}, handlers: { ${exportedMethods.map((method) => `${method}: async (req: Request, ctx?: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; return (mod as any).${method}(req, ctx) }`).join(', ')} } }`)\n const metadataEntries: GeneratedObjectEntry[] = [\n { name: 'moduleId', value: modId },\n { name: 'kind', value: 'route-file' },\n { name: 'path', value: resolvedPath },\n { name: 'methods', value: arrayLiteral(exportedMethods, writeValue) },\n ]\n const manifestEntry = objectLiteral([\n ...metadataEntries,\n { name: 'load', value: buildManifestApiLoader(importPath) },\n ])\n manifestApis.push(manifestEntry)\n manifestShardApis.push({ path: resolvedPath, declaration: renderGeneratedValue(manifestEntry) })\n metadataApis.push({ path: resolvedPath, declaration: renderGeneratedValue(objectLiteral(metadataEntries)) })\n }\n\n // Single files (plain scripts, not route.*, not tests, skip method dirs)\n const plainFiles = scanModuleDir(roots, SCAN_CONFIGS.apiPlainFiles)\n for (const { relPath, fromApp } of plainFiles) {\n const segs = relPath.split('/')\n const file = segs.pop()!\n const pathWithoutExt = stripModuleCodeExtension(file)\n const fullSegs = [...segs, pathWithoutExt]\n const routePath = '/' + [modId, ...fullSegs].filter(Boolean).join('/')\n const importName = `R${importIdRef.value++}_${toVar(modId)}_${toVar(fullSegs.join('_') || 'index')}`\n const plainSegPath = fullSegs.join('/')\n const importPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/api${plainSegPath ? `/${plainSegPath}` : ''}`\n )\n const sourceFile = findExistingModuleFile(fromApp ? apiApp : apiPkg, relPath)\n if (!sourceFile) continue\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(sourceFile)\n const metadata = sourceModule?.metadata ?? extractNamedObjectLiteralExport(sourceFile, 'metadata')\n const resolvedPath = resolveApiPathFromMetadata(metadata, routePath)\n const exportedMethods = detectExportedHttpMethods(sourceFile)\n if (exportedMethods.length === 0) continue\n if (!metadata && !hasNamedExport(sourceFile, 'metadata')) {\n console.warn(`[generate] \u26A0 Route file exports handlers but no metadata \u2014 auth will default to required: ${sourceFile}`)\n }\n const metadataLiteral = buildApiMetadataLiteral(metadata)\n const hasOpenApi = await moduleHasExport(sourceFile, 'openApi')\n const docsPart = hasOpenApi ? `, docs: ((${importName} as any).openApi as any)` : ''\n eagerImports.push(buildImportStatement(`* as ${importName}`, importPath))\n eagerApis.push(`{ path: ((${importName} as any).metadata?.path ?? ${toLiteral(routePath)}), metadata: (${importName} as any).metadata, handlers: ${importName} as any${docsPart} }`)\n runtimeApis.push(`{ path: ${toLiteral(resolvedPath)}, metadata: ${metadataLiteral}, handlers: { ${exportedMethods.map((entryMethod) => `${entryMethod}: async (req: Request, ctx?: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; return (mod as any).${entryMethod}(req, ctx) }`).join(', ')} } }`)\n const metadataEntries: GeneratedObjectEntry[] = [\n { name: 'moduleId', value: modId },\n { name: 'kind', value: 'route-file' },\n { name: 'path', value: resolvedPath },\n { name: 'methods', value: arrayLiteral(exportedMethods, writeValue) },\n ]\n const manifestEntry = objectLiteral([\n ...metadataEntries,\n { name: 'load', value: buildManifestApiLoader(importPath) },\n ])\n manifestApis.push(manifestEntry)\n manifestShardApis.push({ path: resolvedPath, declaration: renderGeneratedValue(manifestEntry) })\n metadataApis.push({ path: resolvedPath, declaration: renderGeneratedValue(objectLiteral(metadataEntries)) })\n }\n\n // Legacy per-method\n const methods: HttpMethod[] = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']\n for (const method of methods) {\n const methodDirSegment = path.posix.join('api', method.toLowerCase())\n const methodRoots: ModuleRoots = {\n appBase: path.join(roots.appBase, 'api', method.toLowerCase()),\n pkgBase: path.join(roots.pkgBase, 'api', method.toLowerCase()),\n }\n const methodConfig = {\n folder: '',\n include: (name: string) => ['.ts', '.js'].some((extension) => name.endsWith(extension)) && !/\\.(test|spec)\\.[jt]s$/.test(name),\n }\n const apiFiles = scanModuleDir(methodRoots, methodConfig)\n for (const { relPath } of apiFiles) {\n const resolved = resolveModuleFile(\n roots,\n { appBase: appImportBase, pkgBase: pkgImportBase },\n path.posix.join(methodDirSegment, relPath.replace(/\\\\/g, '/')),\n )\n if (!resolved) continue\n\n const segs = relPath.split('/')\n const file = segs.pop()!\n const pathWithoutExt = stripModuleCodeExtension(file)\n const fullSegs = [...segs, pathWithoutExt]\n const routePath = '/' + [modId, ...fullSegs].filter(Boolean).join('/')\n const importName = `H${importIdRef.value++}_${toVar(modId)}_${toVar(method)}_${toVar(fullSegs.join('_'))}`\n const importPath = sanitizeGeneratedModuleSpecifier(resolved.importPath)\n const metaName = `RM${importIdRef.value++}_${toVar(modId)}_${toVar(method)}_${toVar(fullSegs.join('_'))}`\n const sourceFile = resolved.absolutePath\n const sourceModule = await loadModuleExportsFromSource<Record<string, unknown>>(sourceFile)\n const metadata = sourceModule?.metadata ?? extractNamedObjectLiteralExport(sourceFile, 'metadata')\n const resolvedPath = resolveApiPathFromMetadata(metadata, routePath)\n const metadataLiteral = buildApiMetadataLiteral(metadata, method)\n const hasOpenApi = await moduleHasExport(sourceFile, 'openApi')\n const docsPart = hasOpenApi ? `, docs: ((${metaName} as any).openApi as any)` : ''\n eagerImports.push(buildImportStatement(`${importName}, * as ${metaName}`, importPath))\n eagerApis.push(`{ method: ${toLiteral(method)}, path: (${metaName}.metadata?.path ?? ${toLiteral(routePath)}), handler: ${importName}, metadata: ${metaName}.metadata${docsPart} }`)\n runtimeApis.push(`{ method: ${toLiteral(method)}, path: ${toLiteral(resolvedPath)}, handler: async (req: Request, ctx?: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; const handler = ((mod as any).default ?? (mod as any).${method} ?? (mod as any).handler) as any; return handler(req, ctx) }, metadata: ${metadataLiteral} }`)\n const metadataEntries: GeneratedObjectEntry[] = [\n { name: 'moduleId', value: modId },\n { name: 'kind', value: 'legacy' },\n { name: 'method', value: method },\n { name: 'path', value: resolvedPath },\n { name: 'methods', value: arrayLiteral([method], writeValue) },\n ]\n const manifestEntry = objectLiteral([\n ...metadataEntries,\n { name: 'load', value: buildManifestApiLoader(importPath) },\n ])\n manifestApis.push(manifestEntry)\n manifestShardApis.push({ path: resolvedPath, declaration: renderGeneratedValue(manifestEntry) })\n metadataApis.push({ path: resolvedPath, declaration: renderGeneratedValue(objectLiteral(metadataEntries)) })\n }\n }\n\n return {\n eagerApis,\n runtimeApis,\n manifestApis,\n manifestShardApis,\n metadataApis,\n }\n}\n\n/**\n * Registry helper emitted for a worker that declares `metadata.onJobAbandoned`.\n *\n * Named once because two things must stay in step: the call the worker entry renders, and the import\n * the file needs for it. A generated file that references this without importing it type-checks\n * nowhere, and only fails at `build:app` \u2014 see `generated-registry-imports.test.ts`.\n */\nconst ABANDON_HOOK_FACTORY = 'createLazyModuleWorkerAbandonHook'\n\nfunction workersDeclareAbandonHook(discovered: DiscoveredWorker[]): boolean {\n return discovered.some(({ metadata }) => metadata.hasJobAbandonedHook === true)\n}\n\n/**\n * Resolves a convention file and pushes its import + config entry to standalone arrays.\n * Used for files that produce their own generated output (notifications, AI tools, events, analytics, enrichers, etc.).\n *\n * @returns The generated import name, or null if the file was not found.\n */\nfunction processStandaloneConfig(options: StandaloneConfigOptions): string | null {\n const {\n roots,\n imps,\n modId,\n relativePath,\n prefix,\n importIdRef,\n standaloneImports,\n standaloneEntries,\n writeConfig,\n standaloneConfigs,\n configExpr,\n sharedImports,\n } = options\n const resolved = resolveModuleFile(roots, imps, relativePath)\n if (!resolved) return null\n const importName = `${prefix}_${toVar(modId)}_${importIdRef.value++}`\n const importPath = sanitizeGeneratedModuleSpecifier(resolved.importPath)\n if (standaloneEntries && writeConfig) {\n const importSpec = {\n namespaceImport: importName,\n moduleSpecifier: importPath,\n }\n ;(standaloneImports as Array<{ namespaceImport: string; moduleSpecifier: string }>).push(importSpec)\n if (sharedImports) {\n ;(sharedImports as Array<{ namespaceImport: string; moduleSpecifier: string }>).push(importSpec)\n }\n standaloneEntries.push(writeConfig({ importName, moduleId: modId }))\n return importName\n }\n\n if (!standaloneConfigs || !configExpr) {\n throw new Error(`Invalid standalone generator configuration for ${relativePath}`)\n }\n\n const importStmt = buildImportStatement(`* as ${importName}`, importPath)\n ;(standaloneImports as string[]).push(importStmt)\n if (sharedImports) (sharedImports as string[]).push(importStmt)\n standaloneConfigs.push(configExpr(importName, modId))\n return importName\n}\n\nfunction namespaceLookup(importName: string, memberName: string): WriterFunction {\n return elementAccess(\n asExpression(identifier(importName), 'Record<string, unknown>'),\n memberName,\n )\n}\n\nfunction buildModuleCustomFieldSetsValue(options: {\n fieldsImportName?: string | null\n customEntitiesImportName?: string | null\n moduleId: string\n}): WriterFunction {\n const parts: WriterFunction[] = []\n\n if (options.fieldsImportName) {\n parts.push(\n spreadExpression(\n namespaceFallback({\n importName: options.fieldsImportName,\n members: ['default', 'fieldSets'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n ),\n )\n }\n\n if (options.customEntitiesImportName) {\n const entities = namespaceFallback({\n importName: options.customEntitiesImportName,\n members: ['default', 'entities'],\n fallback: emptyArray(),\n castType: 'any[]',\n })\n\n const mappedEntities = methodCall(\n methodCall(entities, 'filter', [\n arrowFunction({\n parameters: ['e'],\n body: logicalAnd([\n callExpression(propertyAccess(identifier('Array'), 'isArray'), [\n propertyAccess(identifier('e'), 'fields'),\n ]),\n propertyAccess(propertyAccess(identifier('e'), 'fields'), 'length'),\n ]),\n }),\n ]),\n 'map',\n [\n arrowFunction({\n parameters: ['e'],\n body: parenthesized(\n objectLiteral([\n { name: 'entity', value: propertyAccess(identifier('e'), 'id') },\n { name: 'fields', value: propertyAccess(identifier('e'), 'fields') },\n { name: 'source', value: options.moduleId },\n ]),\n ),\n }),\n ],\n )\n\n parts.push(spreadExpression(mappedEntities))\n }\n\n return arrayLiteral(parts, writeValue)\n}\n\nfunction buildModuleDashboardWidgetsValue(entries: DashboardWidgetEntry[]): WriterFunction {\n return arrayLiteral(\n entries.map((entry) =>\n objectLiteral([\n { name: 'moduleId', value: entry.moduleId },\n { name: 'key', value: entry.key },\n { name: 'source', value: entry.source },\n {\n name: 'loader',\n value: arrowFunction({\n body: methodCall(importExpression(entry.importPath), 'then', [\n arrowFunction({\n parameters: ['mod'],\n body: nullishCoalesce([\n propertyAccess(identifier('mod'), 'default'),\n identifier('mod'),\n ]),\n }),\n ]),\n }),\n },\n ]),\n ),\n writeValue,\n )\n}\n\n/**\n * Wraps expressions that are still produced as pre-rendered strings by collaborators this\n * change does not convert (page routes, api handlers, dashboard widgets) so they can sit\n * inside an AST-built array without being re-quoted as string literals. It disappears once\n * those producers emit writers themselves \u2014 see the follow-up noted in the spec's Non-Goals.\n */\nfunction preRenderedExpressionList(expressions: readonly string[]): WriterFunction {\n return arrayLiteral(expressions.map((expression) => identifier(expression)), writeValue)\n}\n\n/**\n * `(X.<first> ?? X.<second>)` \u2014 the member-fallback shape the main registry path emits.\n * It is deliberately not `namespaceFallback`, which the app path uses: that helper walks\n * the members in an IIFE and treats only `!= null` as present, which is a different\n * expression. Converging the two is a behaviour change, not a formatting one.\n */\nfunction legacyNamespaceMemberFallback(importName: string, members: readonly [string, string]): WriterFunction {\n return parenthesized(nullishCoalesce([\n propertyAccess(identifier(importName), members[0]),\n propertyAccess(identifier(importName), members[1]),\n ]))\n}\n\nfunction buildLegacyModuleListValue(options: {\n importName: string\n members: readonly [string, string]\n castType: string\n}): WriterFunction {\n return logicalOr([\n asExpression(legacyNamespaceMemberFallback(options.importName, options.members), options.castType),\n emptyArray(),\n ])\n}\n\nfunction buildLegacyModuleSetupValue(importName: string): WriterFunction {\n return logicalOr([\n legacyNamespaceMemberFallback(importName, ['default', 'setup']),\n identifier('undefined'),\n ])\n}\n\nfunction buildLegacyModuleRuntimeValue(importName: string): WriterFunction {\n return logicalOr([\n legacyNamespaceMemberFallback(importName, ['default', 'runtime']),\n identifier('undefined'),\n ])\n}\n\nfunction buildLegacyIntegrationListValue(\n importName: string,\n pluralMember: string,\n singularMember: string,\n castType: string,\n): WriterFunction {\n const singular = propertyAccess(identifier(importName), singularMember)\n\n return asExpression(\n parenthesized(nullishCoalesce([\n propertyAccess(identifier(importName), pluralMember),\n parenthesized(conditionalExpression(singular, arrayLiteral([singular], writeValue), emptyArray())),\n ])),\n castType,\n )\n}\n\nfunction buildModuleIntegrationListValue(\n importName: string,\n pluralMember: string,\n singularMember: string,\n castType: string,\n): WriterFunction {\n const plural = namespaceLookup(importName, pluralMember)\n const singular = namespaceLookup(importName, singularMember)\n\n return nullishCoalesce([\n asExpression(plural, castType),\n asExpression(\n parenthesized(\n conditionalExpression(\n binaryExpression(singular, '!=', null),\n arrayLiteral([singular], writeValue),\n emptyArray(),\n ),\n ),\n castType,\n ),\n ])\n}\n\nfunction buildModulesInfoExpression(): WriterFunction {\n return methodCall(identifier('modules'), 'map', [\n arrowFunction({\n parameters: ['m'],\n body: parenthesized(\n objectLiteral([\n { name: 'id', value: propertyAccess(identifier('m'), 'id') },\n {\n kind: 'spread',\n value: logicalOr([\n propertyAccess(identifier('m'), 'info'),\n emptyObject(),\n ]),\n },\n ]),\n ),\n }),\n ])\n}\n\nfunction renderAstModuleRegistryFile(options: {\n fileName: string\n generator: string\n /**\n * Import statements, or the structured specs generator extensions push onto the shared\n * import array via `processStandaloneConfig`. Both shapes reach this emitter at runtime,\n * so both are normalised here rather than at each call site.\n */\n imports: GeneratedImportStatement[]\n moduleEntries: WriterFunction[]\n includeCreateElementImport?: boolean\n includeAbandonHookImport?: boolean\n}): string {\n const sourceFile = createGeneratedSourceFile(options.fileName)\n addAutoGeneratedComment(sourceFile, options.generator)\n\n if (options.includeCreateElementImport) {\n addImportSpec(sourceFile, {\n moduleSpecifier: 'react',\n namedImports: [{ name: 'createElement' }],\n })\n }\n addImportSpec(sourceFile, {\n moduleSpecifier: '@open-mercato/shared/modules/registry',\n namedImports: [\n { name: 'createLazyModuleSubscriber' },\n { name: 'createLazyModuleWorker' },\n ...(options.includeAbandonHookImport ? [{ name: ABANDON_HOOK_FACTORY }] : []),\n { name: 'Module', isTypeOnly: true },\n ],\n })\n addImportStatements(sourceFile, options.imports.map((entry) => serializeGeneratedImport(entry)))\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'modules',\n type: 'Module[]',\n initializer: arrayLiteral(options.moduleEntries, writeValue),\n },\n ],\n })\n sourceFile.addExportAssignment({\n isExportEquals: false,\n expression: 'modules',\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'modulesInfo',\n initializer: buildModulesInfoExpression(),\n },\n ],\n })\n\n return getSourceText(sourceFile)\n}\n\nfunction renderAstManifestFile(options: {\n fileName: string\n typeName: string\n exportName: string\n imports?: string[]\n entries: WriterFunction[]\n}): string {\n const sourceFile = createGeneratedSourceFile(options.fileName)\n addAutoGeneratedComment(sourceFile, 'registry')\n\n const usesPageRouteMetadataHelper = options.typeName === 'FrontendRouteManifestEntry'\n || options.typeName === 'BackendRouteManifestEntry'\n addImportSpec(sourceFile, usesPageRouteMetadataHelper\n ? {\n moduleSpecifier: '@open-mercato/shared/modules/registry',\n namedImports: [\n { name: 'resolvePageRouteMetadata' },\n { name: options.typeName, isTypeOnly: true },\n ],\n }\n : {\n moduleSpecifier: '@open-mercato/shared/modules/registry',\n isTypeOnly: true,\n namedImports: [{ name: options.typeName }],\n })\n addImportStatements(sourceFile, options.imports ?? [])\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: options.exportName,\n type: `${options.typeName}[]`,\n initializer: arrayLiteral(options.entries, writeValue),\n },\n ],\n })\n sourceFile.addExportAssignment({\n isExportEquals: false,\n expression: options.exportName,\n })\n\n return getSourceText(sourceFile)\n}\n\nfunction renderAstLegacyAliasFile(options: {\n fileName: string\n exportName: string\n exportType: string\n sourceFileName: string\n initializer: WriterFunction\n}): string {\n const sourceFile = createGeneratedSourceFile(options.fileName)\n addAutoGeneratedComment(sourceFile, 'registry')\n\n addImportSpec(sourceFile, {\n moduleSpecifier: '@open-mercato/shared/modules/registry',\n namedImports: [{ name: 'Module', isTypeOnly: true }],\n })\n addImportSpec(sourceFile, {\n moduleSpecifier: `./${options.sourceFileName.replace(/\\.ts$/, '')}`,\n namedImports: [{ name: 'modules' }],\n })\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: options.exportName,\n type: options.exportType,\n initializer: options.initializer,\n },\n ],\n })\n\n return getSourceText(sourceFile)\n}\n\nfunction renderEnabledModuleIdsFile(moduleIds: readonly string[]): string {\n const sourceFile = createGeneratedSourceFile('enabled-module-ids.generated.ts')\n addAutoGeneratedComment(sourceFile, 'registry (enabled-module-ids version)')\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n leadingTrivia: (writer) => {\n writer.newLine()\n writer.writeLine('// This file lists every enabled module ID without importing module runtime')\n writer.writeLine('// surfaces. It is safe to import from client bundles (no node:* dependencies).')\n },\n declarations: [\n {\n name: 'enabledModuleIds',\n type: 'readonly string[]',\n initializer: (writer) => {\n writeArrayLiteral(writer, moduleIds, (w, id) => {\n w.write(JSON.stringify(id))\n })\n writer.write(' as const')\n },\n },\n ],\n })\n\n return getSourceText(sourceFile)\n}\n\nfunction buildLazyRouteComponentExpression(importPath: string): string {\n return `async (props: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; const Component = (mod.default ?? mod) as any; return createElement(Component, props) }`\n}\n\nfunction buildRuntimeRouteComponent(importPath: string): WriterFunction {\n return arrowFunction({\n async: true,\n parameters: ['props: any'],\n body: block((writer) => {\n writeStatements(writer, [\n variableStatement({\n name: 'mod',\n initializer: awaitExpression(importExpression(importPath)),\n }),\n variableStatement({\n name: 'Component',\n type: 'any',\n initializer: asExpression(\n nullishCoalesce([\n propertyAccess(identifier('mod'), 'default'),\n identifier('mod'),\n ]),\n 'any',\n ),\n }),\n returnStatement(\n callExpression(identifier('createElement'), [\n identifier('Component'),\n identifier('props'),\n ]),\n ),\n ])\n }),\n })\n}\n\nfunction rawExpression(source: string): WriterFunction {\n return (writer) => writer.write(source)\n}\n\nfunction buildPageRouteEntries(metaExpr: WriterFunction, routePath: string): GeneratedObjectEntry[] {\n const meta = parenthesized(metaExpr)\n return [\n { name: 'pattern', value: routePath || '/' },\n { name: 'requireAuth', value: optionalPropertyAccess(meta, 'requireAuth') },\n { name: 'requireRoles', value: optionalPropertyAccess(meta, 'requireRoles') },\n { name: 'requireFeatures', value: optionalPropertyAccess(meta, 'requireFeatures') },\n { name: 'requireCustomerAuth', value: optionalPropertyAccess(meta, 'requireCustomerAuth') },\n { name: 'requireCustomerFeatures', value: optionalPropertyAccess(meta, 'requireCustomerFeatures') },\n { name: 'nav', value: optionalPropertyAccess(meta, 'nav') },\n {\n name: 'title',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pageTitle'),\n optionalPropertyAccess(meta, 'title'),\n ]),\n },\n {\n name: 'titleKey',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pageTitleKey'),\n optionalPropertyAccess(meta, 'titleKey'),\n ]),\n },\n {\n name: 'group',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pageGroup'),\n optionalPropertyAccess(meta, 'group'),\n ]),\n },\n {\n name: 'groupKey',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pageGroupKey'),\n optionalPropertyAccess(meta, 'groupKey'),\n ]),\n },\n { name: 'icon', value: optionalPropertyAccess(meta, 'icon') },\n {\n name: 'order',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pageOrder'),\n optionalPropertyAccess(meta, 'order'),\n ]),\n },\n {\n name: 'priority',\n value: nullishCoalesce([\n optionalPropertyAccess(meta, 'pagePriority'),\n optionalPropertyAccess(meta, 'priority'),\n ]),\n },\n { name: 'navHidden', value: optionalPropertyAccess(meta, 'navHidden') },\n { name: 'visible', value: optionalPropertyAccess(meta, 'visible') },\n { name: 'enabled', value: optionalPropertyAccess(meta, 'enabled') },\n { name: 'breadcrumb', value: optionalPropertyAccess(meta, 'breadcrumb') },\n { name: 'pageContext', value: optionalPropertyAccess(meta, 'pageContext') },\n { name: 'placement', value: optionalPropertyAccess(meta, 'placement') },\n ]\n}\n\nasync function processPageFilesAst(options: {\n files: Array<{ relPath: string; fromApp: boolean }>\n type: 'frontend' | 'backend'\n modId: string\n appDir: string\n pkgDir: string\n appImportBase: string\n pkgImportBase: string\n imports: string[]\n importIdRef: { value: number }\n quiet?: boolean\n}): Promise<{ routes: WriterFunction[]; routePatterns: string[] }> {\n const {\n files,\n type,\n modId,\n appDir,\n pkgDir,\n appImportBase,\n pkgImportBase,\n imports,\n importIdRef,\n quiet,\n } = options\n const routes: WriterFunction[] = []\n const routePatterns: string[] = []\n const metaPrefix = type === 'frontend' ? 'MRuntime' : 'BMRuntime'\n\n const addRoute = (params: {\n importPath: string\n routePath: string\n metaExpr: WriterFunction\n }) => {\n routes.push(\n objectLiteral([\n ...buildPageRouteEntries(params.metaExpr, params.routePath),\n {\n name: 'Component',\n value: buildRuntimeRouteComponent(params.importPath),\n },\n ]),\n )\n routePatterns.push(params.routePath)\n }\n\n for (const { relPath, fromApp } of files.filter(({ relPath: filePath }) => isModulePageFile(path.basename(filePath)))) {\n const segs = relPath.split('/')\n const pageFile = segs.pop()!\n const pageBaseName = stripModuleCodeExtension(pageFile)\n const sub = segs.length ? `${segs.join('/')}/${pageBaseName}` : pageBaseName\n const importPath = sanitizeGeneratedModuleSpecifier(`${fromApp ? appImportBase : pkgImportBase}/${type}/${sub}`)\n const routePath = type === 'frontend'\n ? '/' + (segs.join('/') || '')\n : '/backend/' + (segs.join('/') || modId)\n const moduleBaseDir = path.join(fromApp ? appDir : pkgDir, ...segs)\n const sourceFile = findExistingModuleFile(moduleBaseDir, pageFile)\n if (!sourceFile || !hasDefaultExport(sourceFile)) continue\n\n const metaPath = findExistingModuleFileByBaseNames(moduleBaseDir, ['page.meta', 'meta'])\n warnIfPageMetaMissingMetadataExport(metaPath, quiet)\n if (metaPath) {\n const metaImportName = `${metaPrefix}${importIdRef.value++}_${toVar(modId)}_${toVar(segs.join('_') || 'index')}`\n const metaImportPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${toModuleImportSubpath(metaPath, fromApp ? appDir : pkgDir)}`,\n )\n imports.push(buildImportStatement(`* as ${metaImportName}`, metaImportPath))\n addRoute({\n importPath,\n routePath,\n metaExpr: asExpression(\n propertyAccess(asExpression(identifier(metaImportName), 'any'), 'metadata'),\n 'any',\n ),\n })\n continue\n }\n\n const staticMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: '(undefined as any)',\n allowRuntimeFallback: false,\n })\n addRoute({\n importPath,\n routePath,\n metaExpr: rawExpression(staticMetadata.manifestExpr),\n })\n }\n\n for (const { relPath, fromApp } of files.filter(({ relPath: filePath }) => !isModulePageFile(path.basename(filePath)))) {\n const segs = relPath.split('/')\n const file = segs.pop()!\n const name = stripModuleCodeExtension(file)\n const routeSegs = [...segs, name].filter(Boolean)\n const importPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${[...segs, name].join('/')}`,\n )\n const routePath = type === 'frontend'\n ? '/' + (routeSegs.join('/') || '')\n : '/backend/' + (segs[0] === modId\n ? [...segs, name].filter(Boolean).join('/')\n : [modId, ...segs, name].filter(Boolean).join('/'))\n const moduleBaseDir = path.join(fromApp ? appDir : pkgDir, ...segs)\n const sourceFile = findExistingModuleFile(moduleBaseDir, file)\n if (!sourceFile || !hasDefaultExport(sourceFile)) continue\n\n const metaPath = findExistingModuleFileByBaseNames(moduleBaseDir, [`${name}.meta`, 'meta'])\n if (metaPath) {\n const metaImportName = `${metaPrefix}${importIdRef.value++}_${toVar(modId)}_${toVar(routeSegs.join('_') || 'index')}`\n const metaBase = path.basename(metaPath)\n const metaImportSub = stripModuleCodeExtension(metaBase) === 'meta' ? 'meta' : `${name}.meta`\n const metaImportPath = sanitizeGeneratedModuleSpecifier(\n `${fromApp ? appImportBase : pkgImportBase}/${type}/${[...segs, metaImportSub].join('/')}`,\n )\n imports.push(buildImportStatement(`* as ${metaImportName}`, metaImportPath))\n addRoute({\n importPath,\n routePath,\n metaExpr: asExpression(\n propertyAccess(asExpression(identifier(metaImportName), 'any'), 'metadata'),\n 'any',\n ),\n })\n continue\n }\n\n const staticMetadata = await loadPageMetadataForManifest({\n sourceFile,\n runtimeExpr: '(undefined as any)',\n allowRuntimeFallback: false,\n })\n addRoute({\n importPath,\n routePath,\n metaExpr: rawExpression(staticMetadata.manifestExpr),\n })\n }\n\n return { routes, routePatterns }\n}\n\nfunction processSubscribersAst(discovered: DiscoveredSubscriber[]): WriterFunction[] {\n const subscribers: WriterFunction[] = []\n for (const { id, importPath, metadata } of discovered) {\n const subscriberId = metadata?.id ?? id\n subscribers.push(\n objectLiteral([\n { name: 'id', value: subscriberId },\n { name: 'event', value: metadata?.event ?? '' },\n { name: 'persistent', value: metadata?.persistent },\n { name: 'sync', value: metadata?.sync },\n { name: 'priority', value: metadata?.priority },\n {\n name: 'handler',\n value: callExpression(identifier('createLazyModuleSubscriber'), [\n arrowFunction({\n body: importExpression(importPath),\n }),\n subscriberId,\n ]),\n },\n ]),\n )\n }\n return subscribers\n}\n\nfunction processWorkersAst(discovered: DiscoveredWorker[]): WriterFunction[] {\n const workers: WriterFunction[] = []\n for (const { id, importPath, metadata } of discovered) {\n const workerId = metadata.id ?? id\n workers.push(\n objectLiteral([\n { name: 'id', value: workerId },\n { name: 'queue', value: metadata.queue },\n { name: 'concurrency', value: metadata.concurrency ?? 1 },\n ...(metadata.schedulerSafe === true ? [{ name: 'schedulerSafe', value: true }] : []),\n ...(metadata.schedulerRequiredFeatures\n ? [{ name: 'schedulerRequiredFeatures', value: arrayLiteral(metadata.schedulerRequiredFeatures, writeValue) }]\n : []),\n ...(metadata.lockDuration === undefined ? [] : [{ name: 'lockDuration', value: metadata.lockDuration }]),\n ...(metadata.maxStalledCount === undefined ? [] : [{ name: 'maxStalledCount', value: metadata.maxStalledCount }]),\n ...(metadata.hasJobAbandonedHook\n ? [{\n name: 'onJobAbandoned',\n value: callExpression(identifier(ABANDON_HOOK_FACTORY), [\n arrowFunction({ body: importExpression(importPath) }),\n workerId,\n ]),\n }]\n : []),\n {\n name: 'handler',\n value: callExpression(identifier('createLazyModuleWorker'), [\n arrowFunction({\n body: importExpression(importPath),\n }),\n workerId,\n ]),\n },\n ]),\n )\n }\n return workers\n}\n\nfunction collectWorkerGenerationEntries(\n discovered: DiscoveredWorker[],\n moduleId: string,\n): WorkerGenerationEntry[] {\n const workers: WorkerGenerationEntry[] = []\n for (const { id, importPath, metadata } of discovered) {\n if (!metadata.queue) continue\n workers.push({\n id: metadata.id ?? id,\n moduleId,\n queue: metadata.queue,\n concurrency: metadata.concurrency ?? 1,\n importPath,\n })\n }\n return workers\n}\n\nfunction processTranslationsAst(options: {\n discovered: DiscoveredTranslation[]\n modId: string\n appImportBase: string\n pkgImportBase: string\n imports: string[]\n extraImports?: string[]\n localeOutputs?: Map<string, { imports: string[]; value: WriterFunction }>\n}): GeneratedObjectEntry[] {\n const { discovered, modId, appImportBase, pkgImportBase, imports, extraImports, localeOutputs } = options\n\n const translations: GeneratedObjectEntry[] = []\n\n for (const { locale, coreHas, appHas } of discovered) {\n\n if (coreHas && appHas) {\n const coreName = `T_${toVar(modId)}_${toVar(locale)}_C`\n const appName = `T_${toVar(modId)}_${toVar(locale)}_A`\n const localeImports = [\n buildImportStatement(coreName, `${pkgImportBase}/i18n/${locale}.json`),\n buildImportStatement(appName, `${appImportBase}/i18n/${locale}.json`),\n ]\n imports.push(...localeImports)\n extraImports?.push(...localeImports)\n const value = objectLiteral([\n { kind: 'spread', value: asExpression(identifier(coreName), 'unknown as Record<string, string>') },\n { kind: 'spread', value: asExpression(identifier(appName), 'unknown as Record<string, string>') },\n ])\n translations.push({\n name: JSON.stringify(locale),\n value,\n })\n localeOutputs?.set(locale, { imports: localeImports, value })\n continue\n }\n\n if (appHas) {\n const appName = `T_${toVar(modId)}_${toVar(locale)}_A`\n const localeImports = [buildImportStatement(appName, `${appImportBase}/i18n/${locale}.json`)]\n imports.push(...localeImports)\n extraImports?.push(...localeImports)\n const value = asExpression(identifier(appName), 'unknown as Record<string, string>')\n translations.push({\n name: JSON.stringify(locale),\n value,\n })\n localeOutputs?.set(locale, { imports: localeImports, value })\n continue\n }\n\n if (coreHas) {\n const coreName = `T_${toVar(modId)}_${toVar(locale)}_C`\n const localeImports = [buildImportStatement(coreName, `${pkgImportBase}/i18n/${locale}.json`)]\n imports.push(...localeImports)\n extraImports?.push(...localeImports)\n const value = asExpression(identifier(coreName), 'unknown as Record<string, string>')\n translations.push({\n name: JSON.stringify(locale),\n value,\n })\n localeOutputs?.set(locale, { imports: localeImports, value })\n }\n }\n\n return translations\n}\n\nfunction sourceDeclaresCliCommand(filePath: string, commandName: string): boolean {\n let sourceText: string\n try {\n sourceText = fs.readFileSync(filePath, 'utf8')\n } catch {\n return false\n }\n const sourceFile = ts.createSourceFile(filePath, sourceText, ts.ScriptTarget.Latest, true)\n const declarations = new Map<string, ts.Expression>()\n for (const statement of sourceFile.statements) {\n if (!ts.isVariableStatement(statement)) continue\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name) && declaration.initializer) {\n declarations.set(declaration.name.text, declaration.initializer)\n }\n }\n }\n\n const expressionDeclaresCommand = (expression: ts.Expression, seen = new Set<string>()): boolean => {\n if (ts.isParenthesizedExpression(expression) || ts.isAsExpression(expression) || ts.isSatisfiesExpression(expression)) {\n return expressionDeclaresCommand(expression.expression, seen)\n }\n if (ts.isIdentifier(expression)) {\n if (seen.has(expression.text)) return false\n const initializer = declarations.get(expression.text)\n if (!initializer) return false\n const nextSeen = new Set(seen)\n nextSeen.add(expression.text)\n return expressionDeclaresCommand(initializer, nextSeen)\n }\n if (ts.isArrayLiteralExpression(expression)) {\n return expression.elements.some((element) => (\n ts.isSpreadElement(element)\n ? expressionDeclaresCommand(element.expression, seen)\n : expressionDeclaresCommand(element, seen)\n ))\n }\n if (!ts.isObjectLiteralExpression(expression)) return false\n return expression.properties.some((property) => {\n if (!ts.isPropertyAssignment(property)) return false\n const propertyName = ts.isIdentifier(property.name) || ts.isStringLiteralLike(property.name)\n ? property.name.text\n : null\n return propertyName === 'command'\n && (ts.isStringLiteralLike(property.initializer) || ts.isNoSubstitutionTemplateLiteral(property.initializer))\n && property.initializer.text === commandName\n })\n }\n\n return sourceFile.statements.some((statement) => (\n ts.isExportAssignment(statement)\n && !statement.isExportEquals\n && expressionDeclaresCommand(statement.expression)\n ))\n}\n\nfunction appDeclaresProgrammaticDevSupervisorOverrides(appDir: string): boolean {\n const srcDir = path.join(appDir, 'src')\n const pending = [srcDir]\n while (pending.length > 0) {\n const current = pending.pop()!\n let entries: fs.Dirent[]\n try {\n entries = fs.readdirSync(current, { withFileTypes: true })\n } catch {\n continue\n }\n for (const entry of entries) {\n const entryPath = path.join(current, entry.name)\n if (entry.isDirectory()) {\n if (entry.name !== '__tests__' && entry.name !== 'node_modules') pending.push(entryPath)\n continue\n }\n if (!/\\.[cm]?tsx?$/.test(entry.name) || /(?:^|\\.)test\\.[cm]?tsx?$/.test(entry.name)) continue\n\n let sourceText: string\n try {\n sourceText = fs.readFileSync(entryPath, 'utf8')\n } catch {\n continue\n }\n const sourceFile = ts.createSourceFile(entryPath, sourceText, ts.ScriptTarget.Latest, true)\n const directImports = new Set<string>()\n const namespaceImports = new Set<string>()\n for (const statement of sourceFile.statements) {\n if (\n !ts.isImportDeclaration(statement)\n || !ts.isStringLiteralLike(statement.moduleSpecifier)\n || statement.moduleSpecifier.text !== '@open-mercato/shared/modules/overrides'\n ) continue\n const bindings = statement.importClause?.namedBindings\n if (bindings && ts.isNamespaceImport(bindings)) namespaceImports.add(bindings.name.text)\n if (bindings && ts.isNamedImports(bindings)) {\n for (const element of bindings.elements) {\n const importedName = element.propertyName?.text ?? element.name.text\n if (importedName === 'applyWorkerOverrides' || importedName === 'applyCliOverrides') {\n directImports.add(element.name.text)\n }\n }\n }\n }\n let found = false\n const visit = (node: ts.Node): void => {\n if (found) return\n if (ts.isCallExpression(node)) {\n if (ts.isIdentifier(node.expression) && directImports.has(node.expression.text)) {\n found = true\n return\n }\n if (\n ts.isPropertyAccessExpression(node.expression)\n && ts.isIdentifier(node.expression.expression)\n && namespaceImports.has(node.expression.expression.text)\n && ['applyWorkerOverrides', 'applyCliOverrides'].includes(node.expression.name.text)\n ) {\n found = true\n return\n }\n }\n ts.forEachChild(node, visit)\n }\n visit(sourceFile)\n if (found) return true\n }\n }\n return false\n}\n\nfunction renderAstI18nLocaleRegistryFile(options: {\n fileName: string\n imports: string[]\n moduleEntries: WriterFunction[]\n}): string {\n const sourceFile = createGeneratedSourceFile(options.fileName)\n addAutoGeneratedComment(sourceFile, 'registry (locale-specific i18n version)')\n addImportSpec(sourceFile, {\n moduleSpecifier: '@open-mercato/shared/modules/registry',\n namedImports: [{ name: 'Module', isTypeOnly: true }],\n })\n addImportStatements(sourceFile, options.imports)\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [{\n name: 'modules',\n type: 'Module[]',\n initializer: arrayLiteral(options.moduleEntries, writeValue),\n }],\n })\n sourceFile.addExportAssignment({\n isExportEquals: false,\n expression: 'modules',\n })\n return getSourceText(sourceFile)\n}\n\nfunction buildI18nLocaleShardFileName(locale: string): string {\n const safeLocale = locale.replace(/[^a-zA-Z0-9_-]/g, '_')\n return `modules.i18n.${safeLocale}.generated.ts`\n}\n\nfunction renderI18nLocaleLoadersFile(locales: string[]): string {\n const cases = locales.map((locale) => {\n const moduleSpecifier = `./${buildI18nLocaleShardFileName(locale).replace(/\\.ts$/, '')}`\n return ` case ${JSON.stringify(locale)}:\\n return import(${JSON.stringify(moduleSpecifier)}).then((entry) => entry.modules)`\n }).join('\\n')\n\n return `// AUTO-GENERATED by mercato generate registry (locale-specific i18n loaders)\\nimport type { Module } from '@open-mercato/shared/modules/registry'\\n\\nexport async function loadI18nModules(locale: string): Promise<Module[]> {\\n switch (locale) {\\n${cases ? `${cases}\\n` : ''} default:\\n return []\\n }\\n}\\n`\n}\n\nfunction removeStaleI18nLocaleShards(outputDir: string, expectedFileNames: Set<string>): void {\n if (!fs.existsSync(outputDir)) return\n for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {\n if (!entry.isFile()) continue\n if (!/^modules\\.i18n\\..+\\.generated\\.(?:ts|checksum)$/.test(entry.name)) continue\n if (entry.name.startsWith('modules.i18n.loaders.generated.')) continue\n if (expectedFileNames.has(entry.name)) continue\n fs.unlinkSync(path.join(outputDir, entry.name))\n }\n}\n\nfunction resolveConventionFile(\n resolved: ResolvedFile | null,\n prefix: string,\n modId: string,\n importIdRef: { value: number },\n imports: string[],\n extraImports?: string[],\n importStyle: 'namespace' | 'default' = 'namespace'\n): { importName: string; importPath: string; fromApp: boolean } | null {\n if (!resolved) return null\n const importName = `${prefix}_${toVar(modId)}_${importIdRef.value++}`\n const importPath = sanitizeGeneratedModuleSpecifier(resolved.importPath)\n if (importStyle === 'default') {\n imports.push(buildImportStatement(importName, importPath))\n extraImports?.push(buildImportStatement(importName, importPath))\n } else {\n imports.push(buildImportStatement(`* as ${importName}`, importPath))\n extraImports?.push(buildImportStatement(`* as ${importName}`, importPath))\n }\n return { importName, importPath, fromApp: resolved.fromApp }\n}\n\ntype ModuleRegistryRenderOptions = ModuleRegistryOptions & {\n discovery: ModuleRegistryDiscovery\n}\n\nasync function generateModuleRegistryFromDiscovery(options: ModuleRegistryRenderOptions): Promise<GeneratorResult> {\n const { resolver, quiet = false } = options\n const { discovery } = options\n const result = createGeneratorResult()\n\n const outputDir = resolver.getOutputDir()\n const outFile = path.join(outputDir, 'modules.generated.ts')\n const checksumFile = path.join(outputDir, 'modules.generated.checksum')\n const runtimeOutFile = path.join(outputDir, 'modules.runtime.generated.ts')\n const runtimeChecksumFile = path.join(outputDir, 'modules.runtime.generated.checksum')\n const frontendRoutesOutFile = path.join(outputDir, 'frontend-routes.generated.ts')\n const frontendRoutesChecksumFile = path.join(outputDir, 'frontend-routes.generated.checksum')\n const backendRoutesOutFile = path.join(outputDir, 'backend-routes.generated.ts')\n const backendRoutesChecksumFile = path.join(outputDir, 'backend-routes.generated.checksum')\n const apiRoutesOutFile = path.join(outputDir, 'api-routes.generated.ts')\n const apiRoutesChecksumFile = path.join(outputDir, 'api-routes.generated.checksum')\n const bootstrapRegsOutFile = path.join(outputDir, 'bootstrap-registrations.generated.ts')\n const bootstrapRegsChecksumFile = path.join(outputDir, 'bootstrap-registrations.generated.checksum')\n const legacySubscribersOutFile = path.join(outputDir, 'subscribers.generated.ts')\n const legacySubscribersChecksumFile = path.join(outputDir, 'subscribers.generated.checksum')\n const commandLoadersOutFile = path.join(outputDir, 'command-loaders.generated.ts')\n const commandLoadersChecksumFile = path.join(outputDir, 'command-loaders.generated.checksum')\n\n const enabled = discovery.enabled\n const extensions = loadGeneratorExtensions(resolver)\n\n // Pre-pass: collect generator plugins from each enabled module's generators.ts\n const pluginRegistry = new Map<string, import('@open-mercato/shared/modules/generators').GeneratorPlugin>()\n const pluginState = new Map<string, { imports: string[]; configs: string[] }>()\n for (const discovered of discovery.modules) {\n const resolved = discovered.resolve('generators.ts')\n if (!resolved) continue\n assertGeneratorPluginUsesTypeOnlyImports(resolved.absolutePath)\n try {\n const pluginMod = await import(buildCacheBustedSourceImportUrl(resolved.absolutePath))\n const plugins: import('@open-mercato/shared/modules/generators').GeneratorPlugin[] =\n pluginMod.generatorPlugins ?? pluginMod.default ?? []\n for (const plugin of plugins) {\n if (!pluginRegistry.has(plugin.id)) {\n pluginRegistry.set(plugin.id, plugin)\n pluginState.set(plugin.id, { imports: [], configs: [] })\n }\n }\n } catch {}\n }\n\n const pluginOutputNames = resolveGeneratorPluginOutputNames(pluginRegistry)\n\n const imports: string[] = []\n const runtimeImports: string[] = []\n const frontendRouteManifestImports: string[] = []\n const backendRouteManifestImports: string[] = []\n const moduleDecls: WriterFunction[] = []\n const runtimeModuleDecls: WriterFunction[] = []\n const frontendRouteManifestDecls: WriterFunction[] = []\n const backendRouteManifestDecls: WriterFunction[] = []\n const apiRouteManifestDecls: WriterFunction[] = []\n const backendRouteShardEntries: RouteManifestShardEntry[] = []\n const backendRouteMetadataEntries: RouteManifestShardEntry[] = []\n const apiRouteShardEntries: RouteManifestShardEntry[] = []\n const apiRouteMetadataEntries: RouteManifestShardEntry[] = []\n // Mutable ref so extracted helper functions can increment the shared counter\n const importIdRef = { value: 0 }\n const requiresByModule = new Map<string, string[]>()\n const commandLoaderEntries: CommandLoaderGenerationEntry[] = []\n const backendRouteRegistrations: BackendRouteRegistration[] = []\n let hasRouteComponents = false\n let hasAbandonHookWorkers = false\n\n // UMES conflict detection: collect file paths during module processing\n const umesConflictSources: Array<{\n moduleId: string\n componentOverridesPath?: string\n interceptorsPath?: string\n aclPath?: string\n }> = []\n\n const seenBackendRoutePatterns = new Map<string, BackendRoutePatternOwner>()\n\n for (const discovered of discovery.modules) {\n const { modId, roots, imps, appImportBase, isAppModule } = discovered\n commandLoaderEntries.push(...discovered.commandLoaderEntries)\n\n const frontendRoutes: string[] = []\n const backendRoutes: string[] = []\n const apis: string[] = []\n const runtimeFrontendRoutes: string[] = []\n const runtimeBackendRoutes: string[] = []\n const runtimeApis: string[] = []\n let cliImportName: string | null = null\n const translations: GeneratedObjectEntry[] = []\n const subscribers: WriterFunction[] = []\n const workers: WriterFunction[] = []\n let infoImportName: string | null = null\n let extensionsImportName: string | null = null\n let fieldsImportName: string | null = null\n let featuresImportName: string | null = null\n let customEntitiesImportName: string | null = null\n let customFieldSetsExpr: string = '[]'\n const dashboardWidgets: string[] = []\n let setupImportName: string | null = null\n let moduleRuntimeImportName: string | null = null\n let encryptionImportName: string | null = null\n let integrationImportName: string | null = null\n\n // === Processing order MUST match original import ID sequence ===\n\n // 1. Module metadata: index.ts (overrideable)\n const indexResolved = discovered.resolve('index.ts')\n if (indexResolved) {\n infoImportName = `I${importIdRef.value++}_${toVar(modId)}`\n const importPath = sanitizeGeneratedModuleSpecifier(indexResolved.importPath)\n imports.push(buildImportStatement(`* as ${infoImportName}`, importPath))\n runtimeImports.push(buildImportStatement(`* as ${infoImportName}`, importPath))\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const mod = require(indexResolved.absolutePath)\n const reqs: string[] | undefined =\n mod?.metadata && Array.isArray(mod.metadata.requires) ? mod.metadata.requires : undefined\n if (reqs && reqs.length) requiresByModule.set(modId, reqs)\n } catch {}\n }\n\n // 2. Pages: frontend\n {\n const feApp = path.join(roots.appBase, 'frontend')\n const fePkg = path.join(roots.pkgBase, 'frontend')\n const feFiles = discovered.frontendFiles\n if (feFiles.length) {\n const generatedFrontendRoutes = await processPageFiles({\n files: feFiles,\n type: 'frontend',\n modId,\n appDir: feApp,\n pkgDir: fePkg,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n eagerImports: imports,\n runtimeImports,\n manifestImports: frontendRouteManifestImports,\n importIdRef,\n quiet,\n })\n frontendRoutes.push(...generatedFrontendRoutes.eagerRoutes)\n runtimeFrontendRoutes.push(...generatedFrontendRoutes.runtimeRoutes)\n frontendRouteManifestDecls.push(...generatedFrontendRoutes.manifestRoutes)\n hasRouteComponents = true\n }\n }\n\n // 3. Entity extensions: data/extensions.ts\n {\n const ext = resolveConventionFile(discovered.resolve('data/extensions.ts'), 'X', modId, importIdRef, imports, runtimeImports)\n if (ext) extensionsImportName = ext.importName\n }\n\n // 4. RBAC: acl.ts\n {\n const aclResolved = discovered.resolve('acl.ts')\n if (aclResolved) {\n const importName = `ACL_${toVar(modId)}_${importIdRef.value++}`\n const importPath = sanitizeGeneratedModuleSpecifier(aclResolved.importPath)\n imports.push(buildImportStatement(`* as ${importName}`, importPath))\n runtimeImports.push(buildImportStatement(`* as ${importName}`, importPath))\n featuresImportName = importName\n }\n }\n\n // 5. Custom entities: ce.ts\n {\n const ce = resolveConventionFile(discovered.resolve('ce.ts'), 'CE', modId, importIdRef, imports, runtimeImports)\n if (ce) customEntitiesImportName = ce.importName\n }\n\n const extensionContext: ModuleScanContext = {\n moduleId: modId,\n roots,\n imps,\n importIdRef,\n sharedImports: imports,\n resolveModuleFile,\n resolveFirstModuleFile,\n processStandaloneConfig,\n sanitizeGeneratedModuleSpecifier,\n }\n for (const extension of extensions) {\n extension.scanModule(extensionContext)\n }\n\n // Track file paths for UMES conflict detection\n {\n const compOverridesFile = discovered.resolve('widgets/components.ts')\n const interceptorsFile = discovered.resolve('api/interceptors.ts')\n const aclFile = discovered.resolve('acl.ts')\n umesConflictSources.push({\n moduleId: modId,\n componentOverridesPath: compOverridesFile?.absolutePath,\n interceptorsPath: interceptorsFile?.absolutePath,\n aclPath: aclFile?.absolutePath,\n })\n }\n\n // Generator plugins: process each registered plugin's convention file\n for (const plugin of pluginRegistry.values()) {\n processStandaloneConfig({\n roots, imps, modId, importIdRef,\n relativePath: plugin.conventionFile,\n prefix: plugin.importPrefix,\n standaloneImports: pluginState.get(plugin.id)!.imports,\n standaloneConfigs: pluginState.get(plugin.id)!.configs,\n configExpr: plugin.configExpr,\n })\n }\n\n // 11. Setup: setup.ts\n {\n const setup = resolveConventionFile(discovered.resolve('setup.ts'), 'SETUP', modId, importIdRef, imports, runtimeImports)\n if (setup) setupImportName = setup.importName\n }\n\n // 11a. Encryption defaults: encryption.ts\n {\n const encryption = resolveConventionFile(discovered.resolve('encryption.ts'), 'ENCRYPTION', modId, importIdRef, imports, runtimeImports)\n if (encryption) encryptionImportName = encryption.importName\n }\n\n // 11b. Integration manifest: integration.ts\n {\n const resolved = discovered.resolve('integration.ts')\n if (resolved) {\n const importName = `INTEGRATION_${toVar(modId)}_${importIdRef.value++}`\n imports.push(buildImportStatement(`* as ${importName}`, resolved.importPath))\n runtimeImports.push(buildImportStatement(`* as ${importName}`, resolved.importPath))\n integrationImportName = importName\n }\n }\n\n // 11c. Module runtime: runtime.ts (SPEC-072)\n {\n const moduleRuntime = resolveConventionFile(discovered.resolve('runtime.ts'), 'RUNTIME', modId, importIdRef, imports, runtimeImports)\n if (moduleRuntime) moduleRuntimeImportName = moduleRuntime.importName\n }\n\n // 12. Custom fields: data/fields.ts\n {\n const fields = resolveConventionFile(discovered.resolve('data/fields.ts'), 'F', modId, importIdRef, imports, runtimeImports)\n if (fields) fieldsImportName = fields.importName\n }\n\n const integrationExports = integrationImportName\n ? `(${integrationImportName} as unknown as { integrations?: import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]; integration?: import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition; bundles?: import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]; bundle?: import('@open-mercato/shared/modules/integrations/types').IntegrationBundle })`\n : null\n\n // 13. Pages: backend\n {\n const beApp = path.join(roots.appBase, 'backend')\n const bePkg = path.join(roots.pkgBase, 'backend')\n const beFiles = discovered.backendFiles\n if (beFiles.length) {\n const generatedBackendRoutes = await processPageFiles({\n files: beFiles,\n type: 'backend',\n modId,\n appDir: beApp,\n pkgDir: bePkg,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n eagerImports: imports,\n runtimeImports,\n manifestImports: backendRouteManifestImports,\n importIdRef,\n collectRoute: ({ routePath, fromApp }) => {\n backendRouteRegistrations.push({\n routePath,\n moduleId: modId,\n packageSourced: !fromApp && !isAppModule,\n })\n },\n quiet,\n })\n backendRoutes.push(...generatedBackendRoutes.eagerRoutes)\n runtimeBackendRoutes.push(...generatedBackendRoutes.runtimeRoutes)\n backendRouteManifestDecls.push(...generatedBackendRoutes.manifestRoutes)\n backendRouteShardEntries.push(...generatedBackendRoutes.manifestShardRoutes)\n backendRouteMetadataEntries.push(...generatedBackendRoutes.metadataRoutes)\n for (const pattern of generatedBackendRoutes.routePatterns) {\n assertUniqueBackendRoutePattern(seenBackendRoutePatterns, modId, pattern, isAppModule)\n }\n hasRouteComponents = true\n }\n }\n\n // 14. API routes\n {\n const generatedApis = await processApiRoutes({\n roots,\n modId,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n eagerImports: imports,\n importIdRef,\n })\n apis.push(...generatedApis.eagerApis)\n runtimeApis.push(...generatedApis.runtimeApis)\n apiRouteManifestDecls.push(...generatedApis.manifestApis)\n apiRouteShardEntries.push(...generatedApis.manifestShardApis)\n apiRouteMetadataEntries.push(...generatedApis.metadataApis)\n }\n\n // 15. CLI\n {\n const cliResolved = discovered.resolve('cli.ts')\n if (cliResolved) {\n const importName = `CLI_${toVar(modId)}`\n imports.push(buildImportStatement(importName, sanitizeGeneratedModuleSpecifier(cliResolved.importPath)))\n cliImportName = importName\n }\n }\n\n // 16. Translations\n translations.push(...processTranslationsAst({\n discovered: discovered.translations,\n modId,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n imports,\n extraImports: runtimeImports,\n }))\n\n // 17. Subscribers\n subscribers.push(...processSubscribersAst(await discovered.getSubscribers()))\n\n // 18. Workers\n const discoveredWorkersForModule = await discovered.getWorkers()\n if (workersDeclareAbandonHook(discoveredWorkersForModule)) hasAbandonHookWorkers = true\n workers.push(...processWorkersAst(discoveredWorkersForModule))\n\n // Build combined customFieldSets expression\n {\n const parts: string[] = []\n if (fieldsImportName)\n parts.push(`(( ${fieldsImportName}.default ?? ${fieldsImportName}.fieldSets) as any) || []`)\n if (customEntitiesImportName)\n parts.push(\n `((( ${customEntitiesImportName}.default ?? ${customEntitiesImportName}.entities) as any) || []).filter((e: any) => Array.isArray(e.fields) && e.fields.length).map((e: any) => ({ entity: e.id, fields: e.fields, source: ${toLiteral(modId)} }))`\n )\n customFieldSetsExpr = parts.length ? `[...${parts.join(', ...')}]` : '[]'\n }\n\n // 19. Dashboard widgets\n {\n for (const entry of discovered.dashboardWidgetEntries) {\n dashboardWidgets.push(\n `{ moduleId: ${toLiteral(entry.moduleId)}, key: ${toLiteral(entry.key)}, source: ${toLiteral(entry.source)}, loader: () => ${buildDynamicImportExpression(entry.importPath)}.then((mod) => mod.default ?? mod) }`\n )\n }\n }\n\n const identityEntries: GeneratedObjectEntry[] = [{ name: 'id', value: modId }]\n if (infoImportName) {\n identityEntries.push({ name: 'info', value: propertyAccess(identifier(infoImportName), 'metadata') })\n }\n\n const sharedTailEntries: GeneratedObjectEntry[] = []\n if (translations.length > 0) {\n sharedTailEntries.push({ name: 'translations', value: objectLiteral(translations) })\n }\n if (subscribers.length > 0) {\n sharedTailEntries.push({ name: 'subscribers', value: arrayLiteral(subscribers, writeValue) })\n }\n if (workers.length > 0) {\n sharedTailEntries.push({ name: 'workers', value: arrayLiteral(workers, writeValue) })\n }\n if (extensionsImportName) {\n sharedTailEntries.push({\n name: 'entityExtensions',\n value: buildLegacyModuleListValue({\n importName: extensionsImportName,\n members: ['default', 'extensions'],\n castType: \"import('@open-mercato/shared/modules/entities').EntityExtension[]\",\n }),\n })\n }\n sharedTailEntries.push({ name: 'customFieldSets', value: identifier(customFieldSetsExpr) })\n if (featuresImportName) {\n sharedTailEntries.push({\n name: 'features',\n value: buildLegacyModuleListValue({\n importName: featuresImportName,\n members: ['default', 'features'],\n castType: 'any',\n }),\n })\n }\n if (customEntitiesImportName) {\n sharedTailEntries.push({\n name: 'customEntities',\n value: buildLegacyModuleListValue({\n importName: customEntitiesImportName,\n members: ['default', 'entities'],\n castType: 'any',\n }),\n })\n }\n\n const setupAndBeyondEntries: GeneratedObjectEntry[] = []\n if (setupImportName) {\n setupAndBeyondEntries.push({ name: 'setup', value: buildLegacyModuleSetupValue(setupImportName) })\n }\n if (moduleRuntimeImportName) {\n setupAndBeyondEntries.push({ name: 'runtime', value: buildLegacyModuleRuntimeValue(moduleRuntimeImportName) })\n }\n if (encryptionImportName) {\n setupAndBeyondEntries.push({\n name: 'defaultEncryptionMaps',\n value: buildLegacyModuleListValue({\n importName: encryptionImportName,\n members: ['default', 'defaultEncryptionMaps'],\n castType: \"import('@open-mercato/shared/modules/encryption').ModuleEncryptionMap[]\",\n }),\n })\n }\n if (integrationExports) {\n setupAndBeyondEntries.push({\n name: 'integrations',\n value: buildLegacyIntegrationListValue(\n integrationExports,\n 'integrations',\n 'integration',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]\",\n ),\n })\n setupAndBeyondEntries.push({\n name: 'bundles',\n value: buildLegacyIntegrationListValue(\n integrationExports,\n 'bundles',\n 'bundle',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]\",\n ),\n })\n }\n\n const eagerEntries: GeneratedObjectEntry[] = [...identityEntries]\n if (frontendRoutes.length > 0) {\n eagerEntries.push({ name: 'frontendRoutes', value: preRenderedExpressionList(frontendRoutes) })\n }\n if (backendRoutes.length > 0) {\n eagerEntries.push({ name: 'backendRoutes', value: preRenderedExpressionList(backendRoutes) })\n }\n if (apis.length > 0) {\n eagerEntries.push({ name: 'apis', value: preRenderedExpressionList(apis) })\n }\n if (cliImportName) {\n eagerEntries.push({ name: 'cli', value: identifier(cliImportName) })\n }\n eagerEntries.push(...sharedTailEntries)\n if (dashboardWidgets.length > 0) {\n eagerEntries.push({ name: 'dashboardWidgets', value: preRenderedExpressionList(dashboardWidgets) })\n }\n eagerEntries.push(...setupAndBeyondEntries)\n moduleDecls.push(objectLiteral(eagerEntries))\n\n const runtimeEntries: GeneratedObjectEntry[] = [...identityEntries]\n if (runtimeFrontendRoutes.length > 0) {\n runtimeEntries.push({ name: 'frontendRoutes', value: preRenderedExpressionList(runtimeFrontendRoutes) })\n }\n if (runtimeBackendRoutes.length > 0) {\n runtimeEntries.push({ name: 'backendRoutes', value: preRenderedExpressionList(runtimeBackendRoutes) })\n }\n if (runtimeApis.length > 0) {\n runtimeEntries.push({ name: 'apis', value: preRenderedExpressionList(runtimeApis) })\n }\n runtimeEntries.push(...sharedTailEntries, ...setupAndBeyondEntries)\n runtimeModuleDecls.push(objectLiteral(runtimeEntries))\n }\n\n // === UMES Conflict Detection ===\n {\n const { detectConflicts } = await import('@open-mercato/shared/lib/umes/conflict-detection')\n const componentOverrideInputs: Array<{ moduleId: string; componentId: string; priority: number }> = []\n const interceptorInputs: Array<{ moduleId: string; id: string; targetRoute: string; methods: string[]; priority: number }> = []\n const declaredFeatures = new Set<string>()\n const gatedExtensions: Array<{ moduleId: string; extensionId: string; features: string[] }> = []\n\n for (const source of umesConflictSources) {\n // Collect declared features from acl.ts\n if (source.aclPath) {\n try {\n const aclMod = await import(buildCacheBustedSourceImportUrl(source.aclPath))\n const features = aclMod.features ?? aclMod.default ?? []\n if (Array.isArray(features)) {\n for (const feat of features) {\n if (typeof feat === 'string') declaredFeatures.add(feat)\n else if (feat?.id) declaredFeatures.add(feat.id)\n }\n }\n } catch {}\n }\n\n // Collect component overrides\n if (source.componentOverridesPath) {\n try {\n const overridesMod = await import(buildCacheBustedSourceImportUrl(source.componentOverridesPath))\n const overrides = overridesMod.componentOverrides ?? overridesMod.default ?? []\n if (Array.isArray(overrides)) {\n for (const override of overrides) {\n const componentId = override?.target?.componentId\n const priority = override?.priority ?? 0\n if (componentId) {\n componentOverrideInputs.push({ moduleId: source.moduleId, componentId, priority })\n }\n const features = override?.features\n if (Array.isArray(features) && features.length > 0) {\n gatedExtensions.push({\n moduleId: source.moduleId,\n extensionId: `component-override:${componentId}`,\n features,\n })\n }\n }\n }\n } catch {}\n }\n\n // Collect interceptors\n if (source.interceptorsPath) {\n try {\n const interceptorsMod = await import(buildCacheBustedSourceImportUrl(source.interceptorsPath))\n const interceptors = interceptorsMod.interceptors ?? interceptorsMod.default ?? []\n if (Array.isArray(interceptors)) {\n for (const interceptor of interceptors) {\n if (interceptor?.id && interceptor?.targetRoute) {\n interceptorInputs.push({\n moduleId: source.moduleId,\n id: interceptor.id,\n targetRoute: interceptor.targetRoute,\n methods: interceptor.methods ?? [],\n priority: interceptor.priority ?? 0,\n })\n }\n const features = interceptor?.features\n if (Array.isArray(features) && features.length > 0) {\n gatedExtensions.push({\n moduleId: source.moduleId,\n extensionId: `interceptor:${interceptor.id}`,\n features,\n })\n }\n }\n }\n } catch {}\n }\n }\n\n const conflictResult = detectConflicts({\n componentOverrides: componentOverrideInputs,\n interceptors: interceptorInputs,\n gatedExtensions,\n declaredFeatures,\n })\n\n for (const warning of conflictResult.warnings) {\n console.warn(`\\x1b[33m[UMES Warning]\\x1b[0m ${warning.message}`)\n }\n for (const error of conflictResult.errors) {\n console.error(`\\x1b[31m[UMES Error]\\x1b[0m ${error.message}`)\n }\n if (conflictResult.errors.length > 0) {\n throw new Error(\n `UMES conflict detection found ${conflictResult.errors.length} error(s). Fix conflicts before proceeding.`\n )\n }\n }\n\n // Backend route collision detection: duplicate paths between package modules are\n // always a bug (one silently shadows the other at runtime); app-module shadowing\n // of a package page is the supported override mechanism and only logs a note.\n {\n const collisionResult = detectBackendRouteCollisions(backendRouteRegistrations)\n for (const note of collisionResult.notes) {\n if (!quiet) console.log(`[Route Shadow] ${note}`)\n }\n if (collisionResult.errors.length > 0) {\n for (const error of collisionResult.errors) {\n console.error(`\\x1b[31m[Route Collision]\\x1b[0m ${error}`)\n }\n throw new Error(\n `Backend route collision detection found ${collisionResult.errors.length} duplicate path(s) registered by multiple package modules. Rename the colliding page directories before proceeding.`\n )\n }\n }\n\n const output = renderAstModuleRegistryFile({\n fileName: 'modules.generated.ts',\n generator: 'registry',\n imports,\n moduleEntries: moduleDecls,\n includeCreateElementImport: hasRouteComponents,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const runtimeOutput = renderAstModuleRegistryFile({\n fileName: 'modules.runtime.generated.ts',\n generator: 'registry',\n imports: runtimeImports,\n moduleEntries: runtimeModuleDecls,\n includeCreateElementImport: true,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const frontendRoutesOutput = renderAstManifestFile({\n fileName: 'frontend-routes.generated.ts',\n typeName: 'FrontendRouteManifestEntry',\n exportName: 'frontendRoutes',\n imports: frontendRouteManifestImports,\n entries: frontendRouteManifestDecls,\n })\n const backendRoutesOutput = renderAstManifestFile({\n fileName: 'backend-routes.generated.ts',\n typeName: 'BackendRouteManifestEntry',\n exportName: 'backendRoutes',\n imports: backendRouteManifestImports,\n entries: backendRouteManifestDecls,\n })\n const apiRoutesOutput = renderAstManifestFile({\n fileName: 'api-routes.generated.ts',\n typeName: 'ApiRouteManifestEntry',\n exportName: 'apiRoutes',\n entries: apiRouteManifestDecls,\n })\n const routeManifestOutputs = [\n ...renderRouteManifestShardOutputs('backend', backendRouteShardEntries),\n ...renderRouteManifestShardOutputs('api', apiRouteShardEntries),\n renderRouteMetadataOutput('backend', backendRouteMetadataEntries),\n renderRouteMetadataOutput('api', apiRouteMetadataEntries),\n ]\n const legacySubscribersOutput = renderAstLegacyAliasFile({\n fileName: 'subscribers.generated.ts',\n exportName: 'moduleSubscribers',\n exportType: \"NonNullable<Module['subscribers']>\",\n sourceFileName: 'modules.runtime.generated.ts',\n initializer: methodCall(identifier('modules'), 'flatMap', [\n arrowFunction({\n parameters: ['module'],\n body: parenthesized(\n nullishCoalesce([\n propertyAccess(identifier('module'), 'subscribers'),\n emptyArray(),\n ]),\n ),\n }),\n ]),\n })\n // Validate module dependencies declared via ModuleInfo.requires\n {\n const enabledIds = new Set(enabled.map((e) => e.id))\n const problems: string[] = []\n for (const [modId, reqs] of requiresByModule.entries()) {\n const missing = reqs.filter((r) => !enabledIds.has(r))\n if (missing.length) {\n problems.push(`- Module \"${modId}\" requires: ${missing.join(', ')}`)\n }\n }\n if (problems.length) {\n console.error('\\nModule dependency check failed:')\n for (const p of problems) console.error(p)\n console.error('\\nFix: Enable required module(s) in src/modules.ts. Example:')\n console.error(\n ' export const enabledModules = [ { id: \\'' +\n Array.from(new Set(requiresByModule.values()).values()).join(\"' }, { id: '\") +\n \"' } ]\"\n )\n process.exit(1)\n }\n }\n\n const structureChecksum = discovery.getStructureChecksum()\n\n writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: runtimeOutFile, checksumFile: runtimeChecksumFile, content: runtimeOutput, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: frontendRoutesOutFile, checksumFile: frontendRoutesChecksumFile, content: frontendRoutesOutput, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: backendRoutesOutFile, checksumFile: backendRoutesChecksumFile, content: backendRoutesOutput, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: apiRoutesOutFile, checksumFile: apiRoutesChecksumFile, content: apiRoutesOutput, structureChecksum, result, quiet })\n const expectedRouteManifestFiles = new Set(routeManifestOutputs.flatMap(({ fileName }) => [\n fileName,\n fileName.replace(/\\.ts$/, '.checksum'),\n ]))\n if (fs.existsSync(outputDir)) {\n for (const entry of fs.readdirSync(outputDir, { withFileTypes: true })) {\n if (!entry.isFile() || !routeManifestShardFilePattern.test(entry.name)) continue\n if (expectedRouteManifestFiles.has(entry.name)) continue\n const stalePath = path.join(outputDir, entry.name)\n fs.unlinkSync(stalePath)\n result.filesWritten.push(stalePath)\n }\n }\n for (const routeOutput of routeManifestOutputs) {\n writeGeneratedFile({\n outFile: path.join(outputDir, routeOutput.fileName),\n checksumFile: path.join(outputDir, routeOutput.fileName.replace(/\\.ts$/, '.checksum')),\n content: routeOutput.content,\n structureChecksum,\n result,\n quiet,\n })\n }\n writeGeneratedFile({ outFile: legacySubscribersOutFile, checksumFile: legacySubscribersChecksumFile, content: legacySubscribersOutput, structureChecksum, result, quiet })\n const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries)\n writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet })\n\n for (const extension of extensions) {\n const outputs = extension.generateOutput()\n for (const [fileName, content] of outputs) {\n writeGeneratedFile({\n outFile: path.join(outputDir, fileName),\n checksumFile: path.join(outputDir, fileName.replace('.ts', '.checksum')),\n content,\n structureChecksum,\n result,\n quiet,\n })\n }\n }\n\n // Generator plugin outputs (registered via modules' generators.ts)\n for (const [pluginId, plugin] of pluginRegistry) {\n const state = pluginState.get(pluginId)!\n const importSection = state.imports.join('\\n')\n const entriesLiteral = state.configs.join(',\\n ')\n const content = plugin.buildOutput({ importSection, entriesLiteral })\n const outFile = path.join(outputDir, pluginOutputNames.get(pluginId)!)\n const checksumFile = outFile.replace(/\\.ts$/, '.checksum')\n writeGeneratedFile({ outFile, checksumFile, content, structureChecksum, result, quiet })\n }\n reconcileGeneratorPluginOutputs({\n outputDir,\n outputNames: pluginOutputNames.values(),\n result,\n })\n\n // Bootstrap registrations: aggregate core registrations + plugin bootstrap-registration hooks\n // into one file. Always written (with at least the core backend route registration) so bootstrap.ts\n // can unconditionally import it and every runtime consumer sees a populated route manifest\n // regardless of Next.js server bundle isolation.\n {\n const bootstrapPlugins = [...pluginRegistry.values()].filter((p) => p.bootstrapRegistration)\n const allEntryImports: string[] = [\n buildImportStatement(`{ backendRouteFacades }`, `./backend-route-shards.generated`),\n buildImportStatement(`{ frontendRoutes }`, `./frontend-routes.generated`),\n ]\n const allRegImports: string[] = [\n `import { registerBackendRouteManifests, registerFrontendRouteManifests } from '@open-mercato/shared/modules/registry'`,\n ]\n const allCalls: string[] = [\n `registerBackendRouteManifests(backendRouteFacades)`,\n `registerFrontendRouteManifests(frontendRoutes)`,\n ]\n for (const plugin of bootstrapPlugins) {\n const reg = plugin.bootstrapRegistration!\n const outputBase = plugin.outputFileName.replace('.ts', '')\n allEntryImports.push(buildImportStatement(`{ ${reg.entriesExportName} }`, `./${outputBase}`))\n allRegImports.push(...reg.registrationImports)\n allCalls.push(reg.buildCall(reg.entriesExportName))\n }\n const bootstrapRegsOutput = renderBootstrapRegistrationsFile({\n entryImports: allEntryImports,\n registrationImports: allRegImports,\n calls: allCalls,\n })\n writeGeneratedFile({ outFile: bootstrapRegsOutFile, checksumFile: bootstrapRegsChecksumFile, content: bootstrapRegsOutput, structureChecksum, result, quiet })\n }\n\n return result\n}\n\nasync function generateModuleRegistryAppFromDiscovery(options: ModuleRegistryRenderOptions): Promise<GeneratorResult> {\n const { resolver, quiet = false } = options\n const { discovery } = options\n const result = createGeneratorResult()\n\n const outputDir = resolver.getOutputDir()\n const outFile = path.join(outputDir, 'modules.app.generated.ts')\n const checksumFile = path.join(outputDir, 'modules.app.generated.checksum')\n const bootstrapOutFile = path.join(outputDir, 'modules.bootstrap.generated.ts')\n const bootstrapChecksumFile = path.join(outputDir, 'modules.bootstrap.generated.checksum')\n const i18nOutFile = path.join(outputDir, 'modules.i18n.generated.ts')\n const i18nChecksumFile = path.join(outputDir, 'modules.i18n.generated.checksum')\n const i18nLoadersOutFile = path.join(outputDir, 'modules.i18n.loaders.generated.ts')\n const i18nLoadersChecksumFile = path.join(outputDir, 'modules.i18n.loaders.generated.checksum')\n const legacyOutFile = path.join(outputDir, 'bootstrap-modules.generated.ts')\n const legacyChecksumFile = path.join(outputDir, 'bootstrap-modules.generated.checksum')\n const enabledIdsOutFile = path.join(outputDir, 'enabled-module-ids.generated.ts')\n const enabledIdsChecksumFile = path.join(outputDir, 'enabled-module-ids.generated.checksum')\n const commandLoadersOutFile = path.join(outputDir, 'command-loaders.generated.ts')\n const commandLoadersChecksumFile = path.join(outputDir, 'command-loaders.generated.checksum')\n\n const enabled = discovery.enabled\n const imports: string[] = []\n const bootstrapImports: string[] = []\n const i18nImports: string[] = []\n const moduleDecls: WriterFunction[] = []\n const bootstrapModuleDecls: WriterFunction[] = []\n const i18nModuleDecls: WriterFunction[] = []\n const i18nLocaleShards = new Map<string, { imports: string[]; moduleDecls: WriterFunction[] }>()\n const importIdRef = { value: 0 }\n const requiresByModule = new Map<string, string[]>()\n const commandLoaderEntries: CommandLoaderGenerationEntry[] = []\n let hasRouteComponents = false\n let hasAbandonHookWorkers = false\n const seenBackendRoutePatterns = new Map<string, BackendRoutePatternOwner>()\n\n for (const discovered of discovery.modules) {\n const { modId, roots, imps, appImportBase, isAppModule } = discovered\n commandLoaderEntries.push(...discovered.commandLoaderEntries)\n\n const frontendRoutes: WriterFunction[] = []\n const backendRoutes: WriterFunction[] = []\n const translations: GeneratedObjectEntry[] = []\n const localeTranslations = new Map<string, { imports: string[]; value: WriterFunction }>()\n const subscribers: WriterFunction[] = []\n const workers: WriterFunction[] = []\n let infoImportName: string | null = null\n let extensionsImportName: string | null = null\n let fieldsImportName: string | null = null\n let featuresImportName: string | null = null\n let customEntitiesImportName: string | null = null\n let dashboardWidgetsValue: WriterFunction = emptyArray()\n let setupImportName: string | null = null\n let moduleRuntimeImportName: string | null = null\n let encryptionImportName: string | null = null\n let integrationImportName: string | null = null\n\n const indexResolved = discovered.resolve('index.ts')\n if (indexResolved) {\n infoImportName = `I${importIdRef.value++}_${toVar(modId)}`\n const importPath = sanitizeGeneratedModuleSpecifier(indexResolved.importPath)\n imports.push(buildImportStatement(`* as ${infoImportName}`, importPath))\n bootstrapImports.push(buildImportStatement(`* as ${infoImportName}`, importPath))\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const mod = require(indexResolved.absolutePath)\n const reqs: string[] | undefined =\n mod?.metadata && Array.isArray(mod.metadata.requires) ? mod.metadata.requires : undefined\n if (reqs && reqs.length) requiresByModule.set(modId, reqs)\n } catch {}\n }\n\n {\n const setup = resolveConventionFile(discovered.resolve('setup.ts'), 'SETUP', modId, importIdRef, imports)\n if (setup) bootstrapImports.push(buildImportStatement(`* as ${setup.importName}`, setup.importPath))\n if (setup) setupImportName = setup.importName\n }\n\n // Module runtime: runtime.ts (SPEC-072)\n {\n const moduleRuntime = resolveConventionFile(discovered.resolve('runtime.ts'), 'RUNTIME', modId, importIdRef, imports)\n if (moduleRuntime) bootstrapImports.push(buildImportStatement(`* as ${moduleRuntime.importName}`, moduleRuntime.importPath))\n if (moduleRuntime) moduleRuntimeImportName = moduleRuntime.importName\n }\n\n {\n const encryption = resolveConventionFile(discovered.resolve('encryption.ts'), 'ENCRYPTION', modId, importIdRef, imports)\n if (encryption) bootstrapImports.push(buildImportStatement(`* as ${encryption.importName}`, encryption.importPath))\n if (encryption) encryptionImportName = encryption.importName\n }\n\n {\n const resolved = discovered.resolve('integration.ts')\n if (resolved) {\n const importName = `INTEGRATION_${toVar(modId)}_${importIdRef.value++}`\n imports.push(buildImportStatement(`* as ${importName}`, resolved.importPath))\n bootstrapImports.push(buildImportStatement(`* as ${importName}`, resolved.importPath))\n integrationImportName = importName\n }\n }\n\n {\n const ext = resolveConventionFile(discovered.resolve('data/extensions.ts'), 'X', modId, importIdRef, imports, bootstrapImports)\n if (ext) extensionsImportName = ext.importName\n }\n\n {\n const aclResolved = discovered.resolve('acl.ts')\n if (aclResolved) {\n const importName = `ACL_${toVar(modId)}_${importIdRef.value++}`\n const importPath = sanitizeGeneratedModuleSpecifier(aclResolved.importPath)\n imports.push(buildImportStatement(`* as ${importName}`, importPath))\n bootstrapImports.push(buildImportStatement(`* as ${importName}`, importPath))\n featuresImportName = importName\n }\n }\n\n {\n const ce = resolveConventionFile(discovered.resolve('ce.ts'), 'CE', modId, importIdRef, imports, bootstrapImports)\n if (ce) customEntitiesImportName = ce.importName\n }\n\n {\n const fields = resolveConventionFile(discovered.resolve('data/fields.ts'), 'F', modId, importIdRef, imports, bootstrapImports)\n if (fields) fieldsImportName = fields.importName\n }\n\n {\n const feApp = path.join(roots.appBase, 'frontend')\n const fePkg = path.join(roots.pkgBase, 'frontend')\n const feFiles = discovered.frontendFiles\n if (feFiles.length > 0) {\n const feAst = await processPageFilesAst({\n files: feFiles,\n type: 'frontend',\n modId,\n appDir: feApp,\n pkgDir: fePkg,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n imports,\n importIdRef,\n quiet,\n })\n frontendRoutes.push(...feAst.routes)\n hasRouteComponents = true\n }\n }\n\n {\n const beApp = path.join(roots.appBase, 'backend')\n const bePkg = path.join(roots.pkgBase, 'backend')\n const beFiles = discovered.backendFiles\n if (beFiles.length > 0) {\n const beAst = await processPageFilesAst({\n files: beFiles,\n type: 'backend',\n modId,\n appDir: beApp,\n pkgDir: bePkg,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n imports,\n importIdRef,\n quiet,\n })\n backendRoutes.push(...beAst.routes)\n for (const pattern of beAst.routePatterns) {\n assertUniqueBackendRoutePattern(seenBackendRoutePatterns, modId, pattern, isAppModule)\n }\n hasRouteComponents = true\n }\n }\n\n const translationImports: string[] = []\n translations.push(...processTranslationsAst({\n discovered: discovered.translations,\n modId,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n imports,\n extraImports: translationImports,\n localeOutputs: localeTranslations,\n }))\n i18nImports.push(...translationImports)\n for (const [locale, localeTranslation] of localeTranslations) {\n const shard = i18nLocaleShards.get(locale) ?? { imports: [], moduleDecls: [] }\n shard.imports.push(...localeTranslation.imports)\n shard.moduleDecls.push(objectLiteral([\n { name: 'id', value: modId },\n {\n name: 'translations',\n value: objectLiteral([{\n name: JSON.stringify(locale),\n value: localeTranslation.value,\n }]),\n },\n ]))\n i18nLocaleShards.set(locale, shard)\n }\n\n subscribers.push(...processSubscribersAst(await discovered.getSubscribers()))\n\n const discoveredWorkersForModule = await discovered.getWorkers()\n if (workersDeclareAbandonHook(discoveredWorkersForModule)) hasAbandonHookWorkers = true\n workers.push(...processWorkersAst(discoveredWorkersForModule))\n\n {\n dashboardWidgetsValue = buildModuleDashboardWidgetsValue(discovered.dashboardWidgetEntries)\n }\n\n const moduleEntries: GeneratedObjectEntry[] = [\n { name: 'id', value: modId },\n { name: 'customFieldSets', value: buildModuleCustomFieldSetsValue({ fieldsImportName, customEntitiesImportName, moduleId: modId }) },\n ]\n const i18nModuleEntries: GeneratedObjectEntry[] = [\n { name: 'id', value: modId },\n ]\n\n if (infoImportName) {\n moduleEntries.push({ name: 'info', value: propertyAccess(identifier(infoImportName), 'metadata') })\n }\n if (translations.length > 0) {\n moduleEntries.push({ name: 'translations', value: objectLiteral(translations) })\n i18nModuleEntries.push({ name: 'translations', value: objectLiteral(translations) })\n }\n if (subscribers.length > 0) {\n moduleEntries.push({ name: 'subscribers', value: arrayLiteral(subscribers, writeValue) })\n }\n if (workers.length > 0) {\n moduleEntries.push({ name: 'workers', value: arrayLiteral(workers, writeValue) })\n }\n if (extensionsImportName) {\n moduleEntries.push({\n name: 'entityExtensions',\n value: namespaceFallback({\n importName: extensionsImportName,\n members: ['default', 'extensions'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n if (featuresImportName) {\n moduleEntries.push({\n name: 'features',\n value: namespaceFallback({\n importName: featuresImportName,\n members: ['default', 'features'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n if (customEntitiesImportName) {\n moduleEntries.push({\n name: 'customEntities',\n value: namespaceFallback({\n importName: customEntitiesImportName,\n members: ['default', 'entities'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n moduleEntries.push({ name: 'dashboardWidgets', value: dashboardWidgetsValue })\n if (setupImportName) {\n moduleEntries.push({\n name: 'setup',\n value: namespaceFallback({\n importName: setupImportName,\n members: ['default', 'setup'],\n fallback: identifier('undefined'),\n }),\n })\n }\n if (moduleRuntimeImportName) {\n moduleEntries.push({\n name: 'runtime',\n value: namespaceFallback({\n importName: moduleRuntimeImportName,\n members: ['default', 'runtime'],\n fallback: identifier('undefined'),\n }),\n })\n }\n if (encryptionImportName) {\n moduleEntries.push({\n name: 'defaultEncryptionMaps',\n value: namespaceFallback({\n importName: encryptionImportName,\n members: ['default', 'defaultEncryptionMaps'],\n fallback: emptyArray(),\n castType: \"Module['defaultEncryptionMaps']\",\n }),\n })\n }\n if (integrationImportName) {\n moduleEntries.push({\n name: 'integrations',\n value: buildModuleIntegrationListValue(\n integrationImportName,\n 'integrations',\n 'integration',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]\",\n ),\n })\n moduleEntries.push({\n name: 'bundles',\n value: buildModuleIntegrationListValue(\n integrationImportName,\n 'bundles',\n 'bundle',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]\",\n ),\n })\n }\n\n const routeAwareModuleEntries = [...moduleEntries]\n if (frontendRoutes.length > 0) {\n routeAwareModuleEntries.push({ name: 'frontendRoutes', value: arrayLiteral(frontendRoutes, writeValue) })\n }\n if (backendRoutes.length > 0) {\n routeAwareModuleEntries.push({ name: 'backendRoutes', value: arrayLiteral(backendRoutes, writeValue) })\n }\n\n moduleDecls.push(objectLiteral(routeAwareModuleEntries))\n bootstrapModuleDecls.push(objectLiteral(moduleEntries.filter(\n (entry) => entry.kind === 'spread' || entry.name !== 'translations',\n )))\n i18nModuleDecls.push(objectLiteral(i18nModuleEntries))\n }\n\n const output = renderAstModuleRegistryFile({\n fileName: 'modules.app.generated.ts',\n generator: 'registry (app version)',\n imports,\n moduleEntries: moduleDecls,\n includeCreateElementImport: hasRouteComponents,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const bootstrapOutput = renderAstModuleRegistryFile({\n fileName: 'modules.bootstrap.generated.ts',\n generator: 'registry (bootstrap version)',\n imports: bootstrapImports,\n moduleEntries: bootstrapModuleDecls,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const i18nOutput = renderAstModuleRegistryFile({\n fileName: 'modules.i18n.generated.ts',\n generator: 'registry (i18n version)',\n imports: i18nImports,\n moduleEntries: i18nModuleDecls,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const legacyOutput = renderAstLegacyAliasFile({\n fileName: 'bootstrap-modules.generated.ts',\n exportName: 'bootstrapModules',\n exportType: 'Module[]',\n sourceFileName: 'modules.bootstrap.generated.ts',\n initializer: identifier('modules'),\n })\n\n {\n const enabledIds = new Set(enabled.map((e) => e.id))\n const problems: string[] = []\n for (const [modId, reqs] of requiresByModule.entries()) {\n const missing = reqs.filter((r) => !enabledIds.has(r))\n if (missing.length) {\n problems.push(`- Module \"${modId}\" requires: ${missing.join(', ')}`)\n }\n }\n if (problems.length) {\n console.error('\\nModule dependency check failed:')\n for (const p of problems) console.error(p)\n console.error('\\nFix: Enable required module(s) in src/modules.ts. Example:')\n console.error(\n ' export const enabledModules = [ { id: \\'' +\n Array.from(new Set(requiresByModule.values()).values()).join(\"' }, { id: '\") +\n \"' } ]\"\n )\n process.exit(1)\n }\n }\n\n const structureChecksum = discovery.getStructureChecksum()\n writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: bootstrapOutFile, checksumFile: bootstrapChecksumFile, content: bootstrapOutput, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: i18nOutFile, checksumFile: i18nChecksumFile, content: i18nOutput, structureChecksum, result, quiet })\n const i18nLocales = [...i18nLocaleShards.keys()].sort((a, b) => a.localeCompare(b))\n const shardFileNames = new Set<string>()\n const expectedShardArtifacts = new Set<string>()\n for (const locale of i18nLocales) {\n const fileName = buildI18nLocaleShardFileName(locale)\n if (shardFileNames.has(fileName)) {\n throw new Error(`Locale names produce the same generated i18n shard file: ${locale}`)\n }\n shardFileNames.add(fileName)\n expectedShardArtifacts.add(fileName)\n expectedShardArtifacts.add(fileName.replace(/\\.ts$/, '.checksum'))\n const shard = i18nLocaleShards.get(locale)!\n const content = renderAstI18nLocaleRegistryFile({\n fileName,\n imports: shard.imports,\n moduleEntries: shard.moduleDecls,\n })\n writeGeneratedFile({\n outFile: path.join(outputDir, fileName),\n checksumFile: path.join(outputDir, fileName.replace(/\\.ts$/, '.checksum')),\n content,\n structureChecksum,\n result,\n quiet,\n })\n }\n removeStaleI18nLocaleShards(outputDir, expectedShardArtifacts)\n writeGeneratedFile({\n outFile: i18nLoadersOutFile,\n checksumFile: i18nLoadersChecksumFile,\n content: renderI18nLocaleLoadersFile(i18nLocales),\n structureChecksum,\n result,\n quiet,\n })\n writeGeneratedFile({ outFile: legacyOutFile, checksumFile: legacyChecksumFile, content: legacyOutput, structureChecksum, result, quiet })\n\n const enabledIdsOutput = renderEnabledModuleIdsFile(enabled.map((entry) => entry.id))\n writeGeneratedFile({ outFile: enabledIdsOutFile, checksumFile: enabledIdsChecksumFile, content: enabledIdsOutput, structureChecksum, result, quiet })\n\n const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries)\n writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet })\n\n return result\n}\n\n/**\n * Generate a CLI-specific module registry that excludes Next.js dependent code.\n * This produces modules.cli.generated.ts which can be loaded without Next.js runtime.\n *\n * Includes: module metadata, CLI commands, translations, subscribers, workers, entity extensions,\n * features/ACL, custom entities, vector config, custom fields, dashboard widgets\n * Excludes: frontend routes, backend routes, API handlers, injection widgets\n */\nasync function generateModuleRegistryCliFromDiscovery(options: ModuleRegistryRenderOptions): Promise<GeneratorResult> {\n let hasAbandonHookWorkers = false\n const { resolver, quiet = false } = options\n const { discovery } = options\n const result = createGeneratorResult()\n\n const outputDir = resolver.getOutputDir()\n const outFile = path.join(outputDir, 'modules.cli.generated.ts')\n const checksumFile = path.join(outputDir, 'modules.cli.generated.checksum')\n const legacyOutFile = path.join(outputDir, 'cli-modules.generated.ts')\n const legacyChecksumFile = path.join(outputDir, 'cli-modules.generated.checksum')\n const commandLoadersOutFile = path.join(outputDir, 'command-loaders.generated.ts')\n const commandLoadersChecksumFile = path.join(outputDir, 'command-loaders.generated.checksum')\n const devSupervisorOutFile = path.join(outputDir, DEV_SUPERVISOR_MANIFEST_FILE)\n const devSupervisorChecksumFile = path.join(outputDir, 'dev-supervisor.generated.checksum')\n\n const enabled = discovery.enabled\n const imports: string[] = []\n const moduleDecls: WriterFunction[] = []\n // Mutable ref so extracted helper functions can increment the shared counter\n const importIdRef = { value: 0 }\n const requiresByModule = new Map<string, string[]>()\n const commandLoaderEntries: CommandLoaderGenerationEntry[] = []\n const devSupervisorWorkers: DevSupervisorWorkerDescriptor[] = []\n let schedulerStartStatus: DevSupervisorSchedulerStartStatus = 'missing-module'\n let requiresFullBootstrap = enabled.some((entry) => entry.devSupervisorRequiresFullBootstrap === true)\n || appDeclaresProgrammaticDevSupervisorOverrides(resolver.getAppDir())\n\n for (const discovered of discovery.modules) {\n const { modId, imps, appImportBase } = discovered\n commandLoaderEntries.push(...discovered.commandLoaderEntries)\n\n let cliImportName: string | null = null\n const translations: GeneratedObjectEntry[] = []\n const subscribers: WriterFunction[] = []\n const workers: WriterFunction[] = []\n let infoImportName: string | null = null\n let extensionsImportName: string | null = null\n let fieldsImportName: string | null = null\n let featuresImportName: string | null = null\n let customEntitiesImportName: string | null = null\n let vectorImportName: string | null = null\n let dashboardWidgetsValue: WriterFunction = emptyArray()\n let setupImportName: string | null = null\n let moduleRuntimeImportName: string | null = null\n let encryptionImportName: string | null = null\n let integrationImportName: string | null = null\n\n // Module metadata: index.ts (overrideable)\n const indexResolved = discovered.resolve('index.ts')\n if (indexResolved) {\n infoImportName = `I${importIdRef.value++}_${toVar(modId)}`\n const importPath = sanitizeGeneratedModuleSpecifier(indexResolved.importPath)\n imports.push(buildImportStatement(`* as ${infoImportName}`, importPath))\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const mod = require(indexResolved.absolutePath)\n const reqs: string[] | undefined =\n mod?.metadata && Array.isArray(mod.metadata.requires) ? mod.metadata.requires : undefined\n if (reqs && reqs.length) requiresByModule.set(modId, reqs)\n } catch {}\n }\n\n // Module setup configuration: setup.ts\n {\n const setup = resolveConventionFile(discovered.resolve('setup.ts'), 'SETUP', modId, importIdRef, imports)\n if (setup) setupImportName = setup.importName\n }\n\n // Module runtime: runtime.ts (SPEC-072)\n {\n const moduleRuntime = resolveConventionFile(discovered.resolve('runtime.ts'), 'RUNTIME', modId, importIdRef, imports)\n if (moduleRuntime) moduleRuntimeImportName = moduleRuntime.importName\n }\n\n // Module encryption defaults: encryption.ts\n {\n const encryption = resolveConventionFile(discovered.resolve('encryption.ts'), 'ENCRYPTION', modId, importIdRef, imports)\n if (encryption) encryptionImportName = encryption.importName\n }\n\n // Integration manifest: integration.ts\n {\n const resolved = discovered.resolve('integration.ts')\n if (resolved) {\n const importName = `INTEGRATION_${toVar(modId)}_${importIdRef.value++}`\n imports.push(buildImportStatement(`* as ${importName}`, resolved.importPath))\n integrationImportName = importName\n }\n }\n\n // Entity extensions: data/extensions.ts\n {\n const ext = resolveConventionFile(discovered.resolve('data/extensions.ts'), 'X', modId, importIdRef, imports)\n if (ext) extensionsImportName = ext.importName\n }\n\n // RBAC: acl.ts\n {\n const aclResolved = discovered.resolve('acl.ts')\n if (aclResolved) {\n const importName = `ACL_${toVar(modId)}_${importIdRef.value++}`\n const importPath = sanitizeGeneratedModuleSpecifier(aclResolved.importPath)\n imports.push(buildImportStatement(`* as ${importName}`, importPath))\n featuresImportName = importName\n }\n }\n\n // Custom entities: ce.ts\n {\n const ce = resolveConventionFile(discovered.resolve('ce.ts'), 'CE', modId, importIdRef, imports)\n if (ce) customEntitiesImportName = ce.importName\n }\n\n // Vector search configuration: vector.ts\n {\n const vec = resolveConventionFile(discovered.resolve('vector.ts'), 'VECTOR', modId, importIdRef, imports)\n if (vec) vectorImportName = vec.importName\n }\n\n // Custom fields: data/fields.ts\n {\n const fields = resolveConventionFile(discovered.resolve('data/fields.ts'), 'F', modId, importIdRef, imports)\n if (fields) fieldsImportName = fields.importName\n }\n\n // CLI\n {\n if (modId === 'scheduler') schedulerStartStatus = 'missing-cli'\n const cliResolved = discovered.resolve('cli.ts')\n if (cliResolved) {\n const importName = `CLI_${toVar(modId)}`\n imports.push(buildImportStatement(importName, sanitizeGeneratedModuleSpecifier(cliResolved.importPath)))\n cliImportName = importName\n if (modId === 'scheduler') {\n if (sourceDeclaresCliCommand(cliResolved.absolutePath, 'start')) {\n schedulerStartStatus = 'ok'\n } else {\n schedulerStartStatus = 'missing-command'\n requiresFullBootstrap = true\n }\n }\n }\n }\n\n // Translations\n translations.push(...processTranslationsAst({\n discovered: discovered.translations,\n modId,\n appImportBase,\n pkgImportBase: imps.pkgBase,\n imports,\n }))\n\n // Subscribers\n subscribers.push(...processSubscribersAst(await discovered.getSubscribers()))\n\n // Workers\n const discoveredWorkers = await discovered.getWorkers()\n const workerGenerationEntries = collectWorkerGenerationEntries(discoveredWorkers, modId)\n if (workersDeclareAbandonHook(discoveredWorkers)) hasAbandonHookWorkers = true\n workers.push(...processWorkersAst(discoveredWorkers))\n devSupervisorWorkers.push(...workerGenerationEntries.map(({ importPath: _importPath, ...worker }) => worker))\n\n // Dashboard widgets\n {\n dashboardWidgetsValue = buildModuleDashboardWidgetsValue(discovered.dashboardWidgetEntries)\n }\n\n const moduleEntries: GeneratedObjectEntry[] = [\n { name: 'id', value: modId },\n { name: 'customFieldSets', value: buildModuleCustomFieldSetsValue({ fieldsImportName, customEntitiesImportName, moduleId: modId }) },\n ]\n\n if (infoImportName) {\n moduleEntries.push({ name: 'info', value: propertyAccess(identifier(infoImportName), 'metadata') })\n }\n if (cliImportName) {\n moduleEntries.push({ name: 'cli', value: identifier(cliImportName) })\n }\n if (translations.length > 0) {\n moduleEntries.push({ name: 'translations', value: objectLiteral(translations) })\n }\n if (subscribers.length > 0) {\n moduleEntries.push({ name: 'subscribers', value: arrayLiteral(subscribers, writeValue) })\n }\n if (workers.length > 0) {\n moduleEntries.push({ name: 'workers', value: arrayLiteral(workers, writeValue) })\n }\n if (extensionsImportName) {\n moduleEntries.push({\n name: 'entityExtensions',\n value: namespaceFallback({\n importName: extensionsImportName,\n members: ['default', 'extensions'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n if (featuresImportName) {\n moduleEntries.push({\n name: 'features',\n value: namespaceFallback({\n importName: featuresImportName,\n members: ['default', 'features'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n if (customEntitiesImportName) {\n moduleEntries.push({\n name: 'customEntities',\n value: namespaceFallback({\n importName: customEntitiesImportName,\n members: ['default', 'entities'],\n fallback: emptyArray(),\n castType: 'any[]',\n }),\n })\n }\n moduleEntries.push({ name: 'dashboardWidgets', value: dashboardWidgetsValue })\n if (vectorImportName) {\n moduleEntries.push({\n name: 'vector',\n value: namespaceFallback({\n importName: vectorImportName,\n members: ['default', 'vectorConfig', 'config'],\n fallback: identifier('undefined'),\n castType: \"Module['vector']\",\n }),\n })\n }\n if (setupImportName) {\n moduleEntries.push({\n name: 'setup',\n value: namespaceFallback({\n importName: setupImportName,\n members: ['default', 'setup'],\n fallback: identifier('undefined'),\n }),\n })\n }\n if (moduleRuntimeImportName) {\n moduleEntries.push({\n name: 'runtime',\n value: namespaceFallback({\n importName: moduleRuntimeImportName,\n members: ['default', 'runtime'],\n fallback: identifier('undefined'),\n }),\n })\n }\n if (encryptionImportName) {\n moduleEntries.push({\n name: 'defaultEncryptionMaps',\n value: namespaceFallback({\n importName: encryptionImportName,\n members: ['default', 'defaultEncryptionMaps'],\n fallback: emptyArray(),\n castType: \"Module['defaultEncryptionMaps']\",\n }),\n })\n }\n if (integrationImportName) {\n moduleEntries.push({\n name: 'integrations',\n value: buildModuleIntegrationListValue(\n integrationImportName,\n 'integrations',\n 'integration',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]\",\n ),\n })\n moduleEntries.push({\n name: 'bundles',\n value: buildModuleIntegrationListValue(\n integrationImportName,\n 'bundles',\n 'bundle',\n \"import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]\",\n ),\n })\n }\n\n moduleDecls.push(objectLiteral(moduleEntries))\n }\n\n const output = renderAstModuleRegistryFile({\n fileName: 'modules.cli.generated.ts',\n generator: 'registry (CLI version)',\n imports,\n moduleEntries: moduleDecls,\n includeAbandonHookImport: hasAbandonHookWorkers,\n })\n const legacyOutput = renderAstLegacyAliasFile({\n fileName: 'cli-modules.generated.ts',\n exportName: 'cliModules',\n exportType: \"Pick<Module, 'id' | 'cli'>[]\",\n sourceFileName: 'modules.cli.generated.ts',\n initializer: methodCall(identifier('modules'), 'map', [\n arrowFunction({\n parameters: ['{ id, cli }'],\n body: parenthesized(objectLiteral([\n { name: 'id', value: identifier('id') },\n { name: 'cli', value: identifier('cli') },\n ])),\n }),\n ]),\n })\n\n // Validate module dependencies declared via ModuleInfo.requires\n {\n const enabledIds = new Set(enabled.map((e) => e.id))\n const problems: string[] = []\n for (const [modId, reqs] of requiresByModule.entries()) {\n const missing = reqs.filter((r) => !enabledIds.has(r))\n if (missing.length) {\n problems.push(`- Module \"${modId}\" requires: ${missing.join(', ')}`)\n }\n }\n if (problems.length) {\n console.error('\\nModule dependency check failed:')\n for (const p of problems) console.error(p)\n console.error('\\nFix: Enable required module(s) in src/modules.ts. Example:')\n console.error(\n ' export const enabledModules = [ { id: \\'' +\n Array.from(new Set(requiresByModule.values()).values()).join(\"' }, { id: '\") +\n \"' } ]\"\n )\n process.exit(1)\n }\n }\n\n const structureChecksum = discovery.getStructureChecksum()\n writeGeneratedFile({ outFile, checksumFile, content: output, structureChecksum, result, quiet })\n writeGeneratedFile({ outFile: legacyOutFile, checksumFile: legacyChecksumFile, content: legacyOutput, structureChecksum, result, quiet })\n const devSupervisorOutput = `${JSON.stringify({\n version: DEV_SUPERVISOR_MANIFEST_VERSION,\n workers: devSupervisorWorkers,\n schedulerStartStatus,\n requiresFullBootstrap,\n }, null, 2)}\\n`\n writeGeneratedFile({\n outFile: devSupervisorOutFile,\n checksumFile: devSupervisorChecksumFile,\n content: devSupervisorOutput,\n structureChecksum,\n result,\n quiet,\n })\n const commandLoadersOutput = renderCommandLoadersFile(commandLoaderEntries)\n writeGeneratedFile({ outFile: commandLoadersOutFile, checksumFile: commandLoadersChecksumFile, content: commandLoadersOutput, structureChecksum, result, quiet })\n\n return result\n}\n\nexport async function generateModuleRegistry(options: ModuleRegistryOptions): Promise<GeneratorResult> {\n const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)\n return generateModuleRegistryFromDiscovery({ ...options, discovery })\n}\n\nexport async function generateModuleRegistryApp(options: ModuleRegistryOptions): Promise<GeneratorResult> {\n const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)\n return generateModuleRegistryAppFromDiscovery({ ...options, discovery })\n}\n\nexport async function generateModuleRegistryCli(options: ModuleRegistryOptions): Promise<GeneratorResult> {\n const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)\n return generateModuleRegistryCliFromDiscovery({ ...options, discovery })\n}\n\nexport async function generateModuleRegistries(options: ModuleRegistryOptions): Promise<GeneratorResult[]> {\n const discovery = await createModuleRegistryDiscovery(options.resolver, options.quiet ?? false)\n return [\n await generateModuleRegistryFromDiscovery({ ...options, discovery }),\n await generateModuleRegistryAppFromDiscovery({ ...options, discovery }),\n await generateModuleRegistryCliFromDiscovery({ ...options, discovery }),\n ]\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,+BAAoD;AAC7D,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,CAAC;AAAA;AACX,qBAAmB;AAAA,IACjB,SAAS;AAAA,IACT,cAAc;AAAA,IACd,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,uBAAuB,yBAAyB,oBAAoB;AAC1E,qBAAmB,EAAE,SAAS,uBAAuB,cAAc,4BAA4B,SAAS,sBAAsB,mBAAmB,QAAQ,MAAM,CAAC;AAEhK,SAAO;AACT;AAEA,eAAsB,uBAAuB,SAA0D;AACrG,QAAM,YAAY,MAAM,8BAA8B,QAAQ,UAAU,QAAQ,SAAS,KAAK;AAC9F,SAAO,oCAAoC,EAAE,GAAG,SAAS,UAAU,CAAC;AACtE;AAEA,eAAsB,0BAA0B,SAA0D;AACxG,QAAM,YAAY,MAAM,8BAA8B,QAAQ,UAAU,QAAQ,SAAS,KAAK;AAC9F,SAAO,uCAAuC,EAAE,GAAG,SAAS,UAAU,CAAC;AACzE;AAEA,eAAsB,0BAA0B,SAA0D;AACxG,QAAM,YAAY,MAAM,8BAA8B,QAAQ,UAAU,QAAQ,SAAS,KAAK;AAC9F,SAAO,uCAAuC,EAAE,GAAG,SAAS,UAAU,CAAC;AACzE;AAEA,eAAsB,yBAAyB,SAA4D;AACzG,QAAM,YAAY,MAAM,8BAA8B,QAAQ,UAAU,QAAQ,SAAS,KAAK;AAC9F,SAAO;AAAA,IACL,MAAM,oCAAoC,EAAE,GAAG,SAAS,UAAU,CAAC;AAAA,IACnE,MAAM,uCAAuC,EAAE,GAAG,SAAS,UAAU,CAAC;AAAA,IACtE,MAAM,uCAAuC,EAAE,GAAG,SAAS,UAAU,CAAC;AAAA,EACxE;AACF;",
|
|
6
6
|
"names": ["objectLiteral", "importKey", "initializer", "nextVisited", "value", "segments", "firstSlash", "name", "subpath", "outFile", "checksumFile"]
|
|
7
7
|
}
|