@open-mercato/cli 0.6.8-develop.7099.1.7ba2771d06 → 0.7.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/.turbo/turbo-build.log +1 -7
- package/dist/agentic/guides/module-facts.json +598 -5508
- package/dist/agentic/guides/module-facts.v2.json +598 -5594
- 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/exact-override-targets.md +0 -1
- package/dist/agentic/guides/modules/api_keys/index.md +2 -4
- package/dist/agentic/guides/modules/attachments/di-registrations-rich.md +5 -6
- package/dist/agentic/guides/modules/attachments/di-service-tokens.md +4 -5
- package/dist/agentic/guides/modules/attachments/exact-override-targets.md +5 -6
- package/dist/agentic/guides/modules/attachments/index.md +2 -2
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/di-registrations-rich.md +2 -3
- package/dist/agentic/guides/modules/auth/di-service-tokens.md +2 -3
- package/dist/agentic/guides/modules/auth/exact-override-targets.md +2 -3
- 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/incoming-installed-contributions.md +0 -3
- package/dist/agentic/guides/modules/catalog/index.md +2 -2
- package/dist/agentic/guides/modules/channel_apns/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/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/di-registrations-rich.md +8 -9
- package/dist/agentic/guides/modules/communication_channels/exact-override-targets.md +8 -9
- package/dist/agentic/guides/modules/communication_channels/incoming-installed-contributions.md +0 -2
- package/dist/agentic/guides/modules/communication_channels/index.md +3 -3
- 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/active-extension-bindings.md +3 -6
- package/dist/agentic/guides/modules/customers/contribution-resolutions.md +0 -1
- package/dist/agentic/guides/modules/customers/events.md +1 -2
- package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +0 -7
- package/dist/agentic/guides/modules/customers/index.md +4 -4
- package/dist/agentic/guides/modules/customers/umes-contributions.md +0 -1
- package/dist/agentic/guides/modules/customers/umes-hosts.md +0 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/exact-override-targets.md +2 -2
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/workers.md +2 -2
- 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/exact-override-targets.md +0 -2
- package/dist/agentic/guides/modules/directory/index.md +3 -5
- 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/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/workers.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/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/active-extension-bindings.md +0 -1
- package/dist/agentic/guides/modules/sales/contribution-resolutions.md +0 -1
- package/dist/agentic/guides/modules/sales/exact-override-targets.md +4 -5
- package/dist/agentic/guides/modules/sales/host-extension-points.md +1 -1
- package/dist/agentic/guides/modules/sales/incoming-installed-contributions.md +0 -2
- package/dist/agentic/guides/modules/sales/index.md +3 -3
- package/dist/agentic/guides/modules/sales/setup.md +1 -1
- package/dist/agentic/guides/modules/sales/umes-contributions.md +0 -1
- package/dist/agentic/guides/modules/sales/umes-diagnostics.md +0 -1
- package/dist/agentic/guides/modules/sales/umes-hosts.md +0 -9
- package/dist/agentic/guides/modules/scheduler/cli-commands.md +0 -1
- package/dist/agentic/guides/modules/scheduler/exact-override-targets.md +1 -3
- package/dist/agentic/guides/modules/scheduler/index.md +2 -2
- package/dist/agentic/guides/modules/scheduler/workers.md +1 -2
- 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/security/owned-contract-module-metadata.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/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/AGENTS.md.template +3 -3
- package/dist/agentic/shared/ai/harness/README.md +2 -2
- package/dist/agentic/shared/ai/harness/RELEASE.md +6 -8
- package/dist/agentic/shared/ai/harness/cases.json +0 -83
- package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
- package/dist/agentic/shared/ai/harness/validators.json +1 -1
- package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.6.7-to-0.7.0/SKILL.md +12 -3
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +11 -37
- package/dist/lib/generators/ast/index.js +1 -4
- package/dist/lib/generators/ast/index.js.map +2 -2
- package/dist/lib/generators/ast/source-file.js +1 -8
- package/dist/lib/generators/ast/source-file.js.map +2 -2
- package/dist/lib/generators/ast/writers.js +1 -9
- package/dist/lib/generators/ast/writers.js.map +2 -2
- package/dist/lib/generators/module-registry.js +189 -424
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/generators/route-manifest-shards.js +1 -4
- package/dist/lib/generators/route-manifest-shards.js.map +2 -2
- package/dist/lib/spawn.js +2 -3
- package/dist/lib/spawn.js.map +2 -2
- package/dist/lib/testing/integration.js +24 -162
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +0 -14
- package/dist/mercato.js.map +2 -2
- package/package.json +7 -8
- package/src/lib/__tests__/spawn.test.ts +0 -23
- package/src/lib/generators/__tests__/metadata-extraction.test.ts +0 -44
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +8 -32
- package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +1 -4
- package/src/lib/generators/__tests__/module-facts.extension-hosts.test.ts +1 -1
- package/src/lib/generators/__tests__/module-subset.test.ts +72 -96
- package/src/lib/generators/__tests__/output-snapshots.test.ts +1 -1
- package/src/lib/generators/__tests__/route-manifest-shards.test.ts +0 -15
- package/src/lib/generators/__tests__/structural-contracts.test.ts +3 -7
- package/src/lib/generators/ast/index.ts +1 -2
- package/src/lib/generators/ast/source-file.ts +0 -13
- package/src/lib/generators/ast/writers.ts +1 -26
- package/src/lib/generators/module-registry.ts +227 -534
- package/src/lib/generators/route-manifest-shards.ts +1 -8
- package/src/lib/spawn.ts +4 -5
- package/src/lib/testing/__tests__/integration.test.ts +0 -435
- package/src/lib/testing/integration.ts +32 -254
- package/src/mercato.ts +0 -27
- package/dist/agentic/guides/modules/api_keys/di-registrations-rich.md +0 -11
- package/dist/agentic/guides/modules/api_keys/di-service-tokens.md +0 -11
- package/dist/agentic/guides/modules/channel_discord/acl-features.md +0 -13
- package/dist/agentic/guides/modules/channel_discord/ai-agents.md +0 -11
- package/dist/agentic/guides/modules/channel_discord/backend-pages.md +0 -11
- package/dist/agentic/guides/modules/channel_discord/cli-commands.md +0 -13
- package/dist/agentic/guides/modules/channel_discord/contribution-resolutions.md +0 -14
- package/dist/agentic/guides/modules/channel_discord/di-registrations-rich.md +0 -12
- package/dist/agentic/guides/modules/channel_discord/exact-override-targets.md +0 -26
- package/dist/agentic/guides/modules/channel_discord/index.md +0 -22
- package/dist/agentic/guides/modules/channel_discord/owned-contract-module-metadata.md +0 -11
- package/dist/agentic/guides/modules/channel_discord/setup.md +0 -11
- package/dist/agentic/guides/modules/channel_discord/umes-contributions.md +0 -14
- package/dist/agentic/guides/modules/channel_discord/workers.md +0 -12
- package/dist/agentic/guides/modules/directory/di-registrations-rich.md +0 -12
- package/dist/agentic/guides/modules/directory/di-service-tokens.md +0 -12
- package/dist/agentic/guides/modules/documents/acl-features.md +0 -17
- package/dist/agentic/guides/modules/documents/backend-pages.md +0 -13
- package/dist/agentic/guides/modules/documents/contribution-resolutions.md +0 -27
- package/dist/agentic/guides/modules/documents/di-registrations-rich.md +0 -21
- package/dist/agentic/guides/modules/documents/domain-commands.md +0 -37
- package/dist/agentic/guides/modules/documents/encryption.md +0 -11
- package/dist/agentic/guides/modules/documents/entities.md +0 -21
- package/dist/agentic/guides/modules/documents/events.md +0 -25
- package/dist/agentic/guides/modules/documents/exact-override-targets.md +0 -39
- package/dist/agentic/guides/modules/documents/index.md +0 -25
- package/dist/agentic/guides/modules/documents/notifications.md +0 -13
- package/dist/agentic/guides/modules/documents/owned-contract-module-metadata.md +0 -11
- package/dist/agentic/guides/modules/documents/setup.md +0 -11
- package/dist/agentic/guides/modules/documents/umes-contributions.md +0 -27
- package/dist/agentic/guides/modules/documents/umes-hosts.md +0 -36
- package/src/__tests__/resolve-queue-abandon-hook.test.ts +0 -39
- package/src/lib/generators/__tests__/__snapshots__/bootstrap-registrations.test.ts.snap +0 -14
- package/src/lib/generators/__tests__/__snapshots__/command-loaders.test.ts.snap +0 -23
- package/src/lib/generators/__tests__/ast-writers-escaping.test.ts +0 -64
- package/src/lib/generators/__tests__/bootstrap-registrations.test.ts +0 -176
- package/src/lib/generators/__tests__/command-loaders.test.ts +0 -239
- package/src/lib/generators/__tests__/generated-registry-imports.test.ts +0 -128
- package/src/lib/generators/__tests__/registry-variant-parity.test.ts +0 -258
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
conditionalExpression,
|
|
29
29
|
createGeneratedSourceFile,
|
|
30
30
|
elementAccess,
|
|
31
|
-
escapeGeneratedJsonLiteral,
|
|
32
31
|
returnStatement,
|
|
33
32
|
getSourceText,
|
|
34
33
|
identifier,
|
|
@@ -41,7 +40,6 @@ import {
|
|
|
41
40
|
optionalPropertyAccess,
|
|
42
41
|
parenthesized,
|
|
43
42
|
propertyAccess,
|
|
44
|
-
renderGeneratedValue,
|
|
45
43
|
spreadExpression,
|
|
46
44
|
variableStatement,
|
|
47
45
|
writeArrayLiteral,
|
|
@@ -322,38 +320,6 @@ function extractObjectPropertiesFromAst(sourceFile, exportName) {
|
|
|
322
320
|
}
|
|
323
321
|
return Object.keys(result).length > 0 ? result : null;
|
|
324
322
|
}
|
|
325
|
-
function namedObjectLiteralDeclaresProperty(sourceFile, exportName, propertyName) {
|
|
326
|
-
let source = "";
|
|
327
|
-
try {
|
|
328
|
-
source = fs.readFileSync(sourceFile, "utf8");
|
|
329
|
-
} catch {
|
|
330
|
-
return false;
|
|
331
|
-
}
|
|
332
|
-
const parsed = ts.createSourceFile(sourceFile, source, ts.ScriptTarget.Latest, true, inferScriptKind(sourceFile));
|
|
333
|
-
const exportedNames = /* @__PURE__ */ new Set();
|
|
334
|
-
for (const statement of parsed.statements) {
|
|
335
|
-
if (ts.isExportDeclaration(statement) && statement.exportClause && ts.isNamedExports(statement.exportClause) && !statement.moduleSpecifier) {
|
|
336
|
-
for (const element of statement.exportClause.elements) exportedNames.add(element.name.text);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
for (const statement of parsed.statements) {
|
|
340
|
-
if (!ts.isVariableStatement(statement)) continue;
|
|
341
|
-
const exportsDirectly = (ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : void 0)?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword);
|
|
342
|
-
for (const declaration of statement.declarationList.declarations) {
|
|
343
|
-
if (!ts.isIdentifier(declaration.name) || declaration.name.text !== exportName) continue;
|
|
344
|
-
if (!exportsDirectly && !exportedNames.has(exportName)) continue;
|
|
345
|
-
const objectLiteral2 = unwrapObjectLiteralExpression(declaration.initializer);
|
|
346
|
-
if (!objectLiteral2) return false;
|
|
347
|
-
return objectLiteral2.properties.some((property) => {
|
|
348
|
-
const name = property.name;
|
|
349
|
-
if (!name) return false;
|
|
350
|
-
const key = ts.isIdentifier(name) ? name.text : ts.isStringLiteral(name) ? name.text : null;
|
|
351
|
-
return key === propertyName;
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
323
|
function extractNamedObjectLiteralExport(sourceFile, exportName) {
|
|
358
324
|
const literal = extractNamedObjectLiteralSource(sourceFile, exportName);
|
|
359
325
|
if (literal) {
|
|
@@ -777,7 +743,7 @@ function requiresRuntimePageMetadataFromSourceFile(sourceFile) {
|
|
|
777
743
|
return !/^['"`]/.test(iconMatch[1].trim());
|
|
778
744
|
}
|
|
779
745
|
function toLiteral(value) {
|
|
780
|
-
return
|
|
746
|
+
return JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
781
747
|
}
|
|
782
748
|
const GENERATED_MODULE_RELATIVE_PREFIXES = ["@/", "../../src/modules/", "./"];
|
|
783
749
|
const GENERATED_MODULE_SPECIFIER_SEGMENT = /^[A-Za-z0-9_.\-[\]()']+$/;
|
|
@@ -966,66 +932,28 @@ function collectCommandLoaderEntries(roots, imps, modId, quiet = false) {
|
|
|
966
932
|
}
|
|
967
933
|
function renderCommandLoadersFile(entries) {
|
|
968
934
|
const seenCommandIds = /* @__PURE__ */ new Map();
|
|
969
|
-
const
|
|
935
|
+
const rendered = [];
|
|
970
936
|
for (const entry of entries) {
|
|
971
|
-
const
|
|
972
|
-
body: importExpression(sanitizeGeneratedModuleSpecifier(entry.importPath))
|
|
973
|
-
});
|
|
937
|
+
const loadExpr = `() => ${buildDynamicImportExpression(entry.importPath)}`;
|
|
974
938
|
for (const id of entry.ids) {
|
|
975
939
|
const previous = seenCommandIds.get(id);
|
|
976
940
|
if (previous && previous !== entry.key) {
|
|
977
941
|
throw new Error(`[generate] Duplicate command id "${id}" discovered in "${previous}" and "${entry.key}"`);
|
|
978
942
|
}
|
|
979
943
|
seenCommandIds.set(id, entry.key);
|
|
980
|
-
|
|
981
|
-
{ name: "moduleId", value: entry.moduleId },
|
|
982
|
-
{ name: "id", value: id },
|
|
983
|
-
{ name: "key", value: entry.key },
|
|
984
|
-
{ name: "load", value: loadValue }
|
|
985
|
-
]));
|
|
944
|
+
rendered.push(` { moduleId: ${toLiteral(entry.moduleId)}, id: ${toLiteral(id)}, key: ${toLiteral(entry.key)}, load: ${loadExpr} },`);
|
|
986
945
|
}
|
|
987
|
-
|
|
988
|
-
{ name: "moduleId", value: entry.moduleId },
|
|
989
|
-
{ name: "key", value: entry.key },
|
|
990
|
-
{ name: "load", value: loadValue }
|
|
991
|
-
]));
|
|
946
|
+
rendered.push(` { moduleId: ${toLiteral(entry.moduleId)}, key: ${toLiteral(entry.key)}, load: ${loadExpr} },`);
|
|
992
947
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
isExported: true,
|
|
1003
|
-
declarations: [
|
|
1004
|
-
{
|
|
1005
|
-
name: "commandLoaderEntries",
|
|
1006
|
-
type: "CommandLoader[]",
|
|
1007
|
-
initializer: arrayLiteral(loaderEntries, writeValue)
|
|
1008
|
-
}
|
|
1009
|
-
]
|
|
1010
|
-
});
|
|
1011
|
-
sourceFile.addExportAssignment({
|
|
1012
|
-
isExportEquals: false,
|
|
1013
|
-
expression: "commandLoaderEntries"
|
|
1014
|
-
});
|
|
1015
|
-
return getSourceText(sourceFile);
|
|
1016
|
-
}
|
|
1017
|
-
function renderBootstrapRegistrationsFile(options) {
|
|
1018
|
-
const uniqueImports = [.../* @__PURE__ */ new Set([...options.entryImports, ...options.registrationImports])];
|
|
1019
|
-
const sourceFile = createGeneratedSourceFile("bootstrap-registrations.generated.ts");
|
|
1020
|
-
addAutoGeneratedComment(sourceFile, "registry");
|
|
1021
|
-
addImportStatements(sourceFile, uniqueImports);
|
|
1022
|
-
sourceFile.addFunction({
|
|
1023
|
-
name: "runBootstrapRegistrations",
|
|
1024
|
-
isExported: true,
|
|
1025
|
-
returnType: "void",
|
|
1026
|
-
statements: options.calls
|
|
1027
|
-
});
|
|
1028
|
-
return getSourceText(sourceFile);
|
|
948
|
+
return `// AUTO-GENERATED by mercato generate command-loaders
|
|
949
|
+
import type { CommandLoader } from '@open-mercato/shared/lib/commands'
|
|
950
|
+
|
|
951
|
+
export const commandLoaderEntries: CommandLoader[] = [
|
|
952
|
+
${rendered.join("\n")}
|
|
953
|
+
]
|
|
954
|
+
|
|
955
|
+
export default commandLoaderEntries
|
|
956
|
+
`;
|
|
1029
957
|
}
|
|
1030
958
|
function serializeGeneratedImport(statement) {
|
|
1031
959
|
if (typeof statement === "string") {
|
|
@@ -1208,35 +1136,7 @@ function buildPageRouteProps(metaExpr, routePath) {
|
|
|
1208
1136
|
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`;
|
|
1209
1137
|
}
|
|
1210
1138
|
function buildPageRouteManifestSpread(metaExpr, routePath) {
|
|
1211
|
-
return
|
|
1212
|
-
}
|
|
1213
|
-
function buildManifestRouteLoader(importPath) {
|
|
1214
|
-
return arrowFunction({
|
|
1215
|
-
async: true,
|
|
1216
|
-
body: block((writer) => {
|
|
1217
|
-
writeStatements(writer, [
|
|
1218
|
-
variableStatement({
|
|
1219
|
-
name: "mod",
|
|
1220
|
-
initializer: awaitExpression(importExpression(sanitizeGeneratedModuleSpecifier(importPath)))
|
|
1221
|
-
}),
|
|
1222
|
-
returnStatement(
|
|
1223
|
-
asExpression(
|
|
1224
|
-
parenthesized(nullishCoalesce([
|
|
1225
|
-
propertyAccess(identifier("mod"), "default"),
|
|
1226
|
-
identifier("mod")
|
|
1227
|
-
])),
|
|
1228
|
-
"any"
|
|
1229
|
-
)
|
|
1230
|
-
)
|
|
1231
|
-
]);
|
|
1232
|
-
})
|
|
1233
|
-
});
|
|
1234
|
-
}
|
|
1235
|
-
function buildManifestApiLoader(importPath) {
|
|
1236
|
-
return arrowFunction({
|
|
1237
|
-
async: true,
|
|
1238
|
-
body: importExpression(sanitizeGeneratedModuleSpecifier(importPath))
|
|
1239
|
-
});
|
|
1139
|
+
return `...resolvePageRouteMetadata(${toLiteral(routePath || "/")}, ${metaExpr})`;
|
|
1240
1140
|
}
|
|
1241
1141
|
function normalizeBreadcrumb(raw) {
|
|
1242
1142
|
if (!Array.isArray(raw)) return void 0;
|
|
@@ -1338,14 +1238,6 @@ function normalizeWorkerMetadata(raw) {
|
|
|
1338
1238
|
if (typeof source.concurrency === "number") normalized.concurrency = source.concurrency;
|
|
1339
1239
|
if (typeof source.lockDuration === "number") normalized.lockDuration = source.lockDuration;
|
|
1340
1240
|
if (typeof source.maxStalledCount === "number") normalized.maxStalledCount = source.maxStalledCount;
|
|
1341
|
-
if (typeof source.onJobAbandoned === "function") normalized.hasJobAbandonedHook = true;
|
|
1342
|
-
if (source.schedulerSafe === true) normalized.schedulerSafe = true;
|
|
1343
|
-
if (Array.isArray(source.schedulerRequiredFeatures)) {
|
|
1344
|
-
const features = source.schedulerRequiredFeatures.filter(
|
|
1345
|
-
(feature) => typeof feature === "string" && feature.length > 0
|
|
1346
|
-
);
|
|
1347
|
-
if (features.length > 0) normalized.schedulerRequiredFeatures = features;
|
|
1348
|
-
}
|
|
1349
1241
|
return Object.keys(normalized).length > 0 ? normalized : null;
|
|
1350
1242
|
}
|
|
1351
1243
|
async function loadSubscriberMetadata(sourceFile) {
|
|
@@ -1354,12 +1246,7 @@ async function loadSubscriberMetadata(sourceFile) {
|
|
|
1354
1246
|
}
|
|
1355
1247
|
async function loadWorkerMetadata(sourceFile) {
|
|
1356
1248
|
const sourceModule = await loadModuleExportsFromSource(sourceFile);
|
|
1357
|
-
|
|
1358
|
-
if (!metadata) return null;
|
|
1359
|
-
if (!metadata.hasJobAbandonedHook && namedObjectLiteralDeclaresProperty(sourceFile, "metadata", "onJobAbandoned")) {
|
|
1360
|
-
metadata.hasJobAbandonedHook = true;
|
|
1361
|
-
}
|
|
1362
|
-
return metadata;
|
|
1249
|
+
return normalizeWorkerMetadata(sourceModule?.metadata) ?? normalizeWorkerMetadata(extractNamedObjectLiteralExport(sourceFile, "metadata"));
|
|
1363
1250
|
}
|
|
1364
1251
|
async function discoverSubscribers(roots, imps, modId) {
|
|
1365
1252
|
const subscribers = [];
|
|
@@ -1570,25 +1457,18 @@ async function processPageFiles(options) {
|
|
|
1570
1457
|
const manifestBaseProps = buildPageRouteManifestSpread(manifestMetaExpr, routePath);
|
|
1571
1458
|
eagerRoutes.push(`{ ${baseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`);
|
|
1572
1459
|
runtimeRoutes.push(`{ ${runtimeBaseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`);
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
];
|
|
1577
|
-
const manifestEntry = objectLiteral([
|
|
1578
|
-
...metadataEntries,
|
|
1579
|
-
{ name: "load", value: buildManifestRouteLoader(importPath) }
|
|
1580
|
-
]);
|
|
1581
|
-
const shardImports = manifestImportStatement ? [manifestImportStatement] : [];
|
|
1582
|
-
manifestRoutes.push(manifestEntry);
|
|
1460
|
+
const metadataDeclaration = `{ moduleId: ${toLiteral(modId)}, ${manifestBaseProps} }`;
|
|
1461
|
+
const manifestDeclaration = `{ moduleId: ${toLiteral(modId)}, ${manifestBaseProps}, load: async () => { const mod = await ${buildDynamicImportExpression(importPath)}; return (mod.default ?? mod) as any } }`;
|
|
1462
|
+
manifestRoutes.push(manifestDeclaration);
|
|
1583
1463
|
manifestShardRoutes.push({
|
|
1584
1464
|
path: routePath,
|
|
1585
|
-
declaration:
|
|
1586
|
-
imports:
|
|
1465
|
+
declaration: manifestDeclaration,
|
|
1466
|
+
imports: manifestImportStatement ? [manifestImportStatement] : []
|
|
1587
1467
|
});
|
|
1588
1468
|
metadataRoutes.push({
|
|
1589
1469
|
path: routePath,
|
|
1590
|
-
declaration:
|
|
1591
|
-
imports:
|
|
1470
|
+
declaration: metadataDeclaration,
|
|
1471
|
+
imports: manifestImportStatement ? [manifestImportStatement] : []
|
|
1592
1472
|
});
|
|
1593
1473
|
routePatterns.push(routePath);
|
|
1594
1474
|
}
|
|
@@ -1662,25 +1542,18 @@ async function processPageFiles(options) {
|
|
|
1662
1542
|
const manifestBaseProps = buildPageRouteManifestSpread(manifestMetaExpr, routePath);
|
|
1663
1543
|
eagerRoutes.push(`{ ${baseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`);
|
|
1664
1544
|
runtimeRoutes.push(`{ ${runtimeBaseProps}, Component: ${buildLazyRouteComponentExpression(importPath)} }`);
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
];
|
|
1669
|
-
const manifestEntry = objectLiteral([
|
|
1670
|
-
...metadataEntries,
|
|
1671
|
-
{ name: "load", value: buildManifestRouteLoader(importPath) }
|
|
1672
|
-
]);
|
|
1673
|
-
const shardImports = manifestImportStatement ? [manifestImportStatement] : [];
|
|
1674
|
-
manifestRoutes.push(manifestEntry);
|
|
1545
|
+
const metadataDeclaration = `{ moduleId: ${toLiteral(modId)}, ${manifestBaseProps} }`;
|
|
1546
|
+
const manifestDeclaration = `{ moduleId: ${toLiteral(modId)}, ${manifestBaseProps}, load: async () => { const mod = await ${buildDynamicImportExpression(importPath)}; return (mod.default ?? mod) as any } }`;
|
|
1547
|
+
manifestRoutes.push(manifestDeclaration);
|
|
1675
1548
|
manifestShardRoutes.push({
|
|
1676
1549
|
path: routePath,
|
|
1677
|
-
declaration:
|
|
1678
|
-
imports:
|
|
1550
|
+
declaration: manifestDeclaration,
|
|
1551
|
+
imports: manifestImportStatement ? [manifestImportStatement] : []
|
|
1679
1552
|
});
|
|
1680
1553
|
metadataRoutes.push({
|
|
1681
1554
|
path: routePath,
|
|
1682
|
-
declaration:
|
|
1683
|
-
imports:
|
|
1555
|
+
declaration: metadataDeclaration,
|
|
1556
|
+
imports: manifestImportStatement ? [manifestImportStatement] : []
|
|
1684
1557
|
});
|
|
1685
1558
|
routePatterns.push(routePath);
|
|
1686
1559
|
}
|
|
@@ -1733,19 +1606,11 @@ async function processApiRoutes(options) {
|
|
|
1733
1606
|
eagerImports.push(buildImportStatement(`* as ${importName}`, importPath));
|
|
1734
1607
|
eagerApis.push(`{ path: ((${importName} as any).metadata?.path ?? ${toLiteral(routePath)}), metadata: (${importName} as any).metadata, handlers: ${importName} as any${docsPart} }`);
|
|
1735
1608
|
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(", ")} } }`);
|
|
1736
|
-
const
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
];
|
|
1742
|
-
const manifestEntry = objectLiteral([
|
|
1743
|
-
...metadataEntries,
|
|
1744
|
-
{ name: "load", value: buildManifestApiLoader(importPath) }
|
|
1745
|
-
]);
|
|
1746
|
-
manifestApis.push(manifestEntry);
|
|
1747
|
-
manifestShardApis.push({ path: resolvedPath, declaration: renderGeneratedValue(manifestEntry) });
|
|
1748
|
-
metadataApis.push({ path: resolvedPath, declaration: renderGeneratedValue(objectLiteral(metadataEntries)) });
|
|
1609
|
+
const metadataDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("route-file")}, path: ${toLiteral(resolvedPath)}, methods: [${exportedMethods.map((method) => toLiteral(method)).join(", ")}] }`;
|
|
1610
|
+
const manifestDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("route-file")}, path: ${toLiteral(resolvedPath)}, methods: [${exportedMethods.map((method) => toLiteral(method)).join(", ")}], load: async () => ${buildDynamicImportExpression(importPath)} }`;
|
|
1611
|
+
manifestApis.push(manifestDeclaration);
|
|
1612
|
+
manifestShardApis.push({ path: resolvedPath, declaration: manifestDeclaration });
|
|
1613
|
+
metadataApis.push({ path: resolvedPath, declaration: metadataDeclaration });
|
|
1749
1614
|
}
|
|
1750
1615
|
const plainFiles = scanModuleDir(roots, SCAN_CONFIGS.apiPlainFiles);
|
|
1751
1616
|
for (const { relPath, fromApp } of plainFiles) {
|
|
@@ -1775,19 +1640,11 @@ async function processApiRoutes(options) {
|
|
|
1775
1640
|
eagerImports.push(buildImportStatement(`* as ${importName}`, importPath));
|
|
1776
1641
|
eagerApis.push(`{ path: ((${importName} as any).metadata?.path ?? ${toLiteral(routePath)}), metadata: (${importName} as any).metadata, handlers: ${importName} as any${docsPart} }`);
|
|
1777
1642
|
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(", ")} } }`);
|
|
1778
|
-
const
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
];
|
|
1784
|
-
const manifestEntry = objectLiteral([
|
|
1785
|
-
...metadataEntries,
|
|
1786
|
-
{ name: "load", value: buildManifestApiLoader(importPath) }
|
|
1787
|
-
]);
|
|
1788
|
-
manifestApis.push(manifestEntry);
|
|
1789
|
-
manifestShardApis.push({ path: resolvedPath, declaration: renderGeneratedValue(manifestEntry) });
|
|
1790
|
-
metadataApis.push({ path: resolvedPath, declaration: renderGeneratedValue(objectLiteral(metadataEntries)) });
|
|
1643
|
+
const metadataDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("route-file")}, path: ${toLiteral(resolvedPath)}, methods: [${exportedMethods.map((entryMethod) => toLiteral(entryMethod)).join(", ")}] }`;
|
|
1644
|
+
const manifestDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("route-file")}, path: ${toLiteral(resolvedPath)}, methods: [${exportedMethods.map((entryMethod) => toLiteral(entryMethod)).join(", ")}], load: async () => ${buildDynamicImportExpression(importPath)} }`;
|
|
1645
|
+
manifestApis.push(manifestDeclaration);
|
|
1646
|
+
manifestShardApis.push({ path: resolvedPath, declaration: manifestDeclaration });
|
|
1647
|
+
metadataApis.push({ path: resolvedPath, declaration: metadataDeclaration });
|
|
1791
1648
|
}
|
|
1792
1649
|
const methods = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
1793
1650
|
for (const method of methods) {
|
|
@@ -1826,20 +1683,11 @@ async function processApiRoutes(options) {
|
|
|
1826
1683
|
eagerImports.push(buildImportStatement(`${importName}, * as ${metaName}`, importPath));
|
|
1827
1684
|
eagerApis.push(`{ method: ${toLiteral(method)}, path: (${metaName}.metadata?.path ?? ${toLiteral(routePath)}), handler: ${importName}, metadata: ${metaName}.metadata${docsPart} }`);
|
|
1828
1685
|
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} }`);
|
|
1829
|
-
const
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
{ name: "methods", value: arrayLiteral([method], writeValue) }
|
|
1835
|
-
];
|
|
1836
|
-
const manifestEntry = objectLiteral([
|
|
1837
|
-
...metadataEntries,
|
|
1838
|
-
{ name: "load", value: buildManifestApiLoader(importPath) }
|
|
1839
|
-
]);
|
|
1840
|
-
manifestApis.push(manifestEntry);
|
|
1841
|
-
manifestShardApis.push({ path: resolvedPath, declaration: renderGeneratedValue(manifestEntry) });
|
|
1842
|
-
metadataApis.push({ path: resolvedPath, declaration: renderGeneratedValue(objectLiteral(metadataEntries)) });
|
|
1686
|
+
const metadataDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("legacy")}, method: ${toLiteral(method)}, path: ${toLiteral(resolvedPath)}, methods: [${toLiteral(method)}] }`;
|
|
1687
|
+
const manifestDeclaration = `{ moduleId: ${toLiteral(modId)}, kind: ${toLiteral("legacy")}, method: ${toLiteral(method)}, path: ${toLiteral(resolvedPath)}, methods: [${toLiteral(method)}], load: async () => ${buildDynamicImportExpression(importPath)} }`;
|
|
1688
|
+
manifestApis.push(manifestDeclaration);
|
|
1689
|
+
manifestShardApis.push({ path: resolvedPath, declaration: manifestDeclaration });
|
|
1690
|
+
metadataApis.push({ path: resolvedPath, declaration: metadataDeclaration });
|
|
1843
1691
|
}
|
|
1844
1692
|
}
|
|
1845
1693
|
return {
|
|
@@ -1850,9 +1698,53 @@ async function processApiRoutes(options) {
|
|
|
1850
1698
|
metadataApis
|
|
1851
1699
|
};
|
|
1852
1700
|
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1701
|
+
function processSubscribers(discovered) {
|
|
1702
|
+
const subscribers = [];
|
|
1703
|
+
for (const { id, importPath, metadata } of discovered) {
|
|
1704
|
+
const subscriberId = metadata?.id ?? id;
|
|
1705
|
+
subscribers.push(
|
|
1706
|
+
`{ id: ${toLiteral(subscriberId)}, event: ${toLiteral(metadata?.event ?? "")}, persistent: ${metadata?.persistent === void 0 ? "undefined" : toLiteral(metadata.persistent)}, sync: ${metadata?.sync === void 0 ? "undefined" : toLiteral(metadata.sync)}, priority: ${metadata?.priority === void 0 ? "undefined" : toLiteral(metadata.priority)}, handler: createLazyModuleSubscriber(() => ${buildDynamicImportExpression(importPath)}, ${toLiteral(subscriberId)}) }`
|
|
1707
|
+
);
|
|
1708
|
+
}
|
|
1709
|
+
return subscribers;
|
|
1710
|
+
}
|
|
1711
|
+
function processWorkers(discovered) {
|
|
1712
|
+
const workers = [];
|
|
1713
|
+
for (const { id, importPath, metadata } of discovered) {
|
|
1714
|
+
const workerId = metadata.id ?? id;
|
|
1715
|
+
workers.push(
|
|
1716
|
+
`{ id: ${toLiteral(workerId)}, queue: ${toLiteral(metadata.queue)}, concurrency: ${toLiteral(metadata.concurrency ?? 1)}${metadata.lockDuration === void 0 ? "" : `, lockDuration: ${toLiteral(metadata.lockDuration)}`}${metadata.maxStalledCount === void 0 ? "" : `, maxStalledCount: ${toLiteral(metadata.maxStalledCount)}`}, handler: createLazyModuleWorker(() => ${buildDynamicImportExpression(importPath)}, ${toLiteral(workerId)}) }`
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
return workers;
|
|
1720
|
+
}
|
|
1721
|
+
function processTranslations(options) {
|
|
1722
|
+
const { discovered, modId, appImportBase, pkgImportBase, imports, extraImports } = options;
|
|
1723
|
+
const translations = [];
|
|
1724
|
+
for (const { locale, coreHas, appHas } of discovered) {
|
|
1725
|
+
if (coreHas && appHas) {
|
|
1726
|
+
const cName = `T_${toVar(modId)}_${toVar(locale)}_C`;
|
|
1727
|
+
const aName = `T_${toVar(modId)}_${toVar(locale)}_A`;
|
|
1728
|
+
imports.push(buildImportStatement(cName, `${pkgImportBase}/i18n/${locale}.json`));
|
|
1729
|
+
imports.push(buildImportStatement(aName, `${appImportBase}/i18n/${locale}.json`));
|
|
1730
|
+
extraImports?.push(buildImportStatement(cName, `${pkgImportBase}/i18n/${locale}.json`));
|
|
1731
|
+
extraImports?.push(buildImportStatement(aName, `${appImportBase}/i18n/${locale}.json`));
|
|
1732
|
+
translations.push(
|
|
1733
|
+
`'${locale}': { ...( ${cName} as unknown as Record<string,string> ), ...( ${aName} as unknown as Record<string,string> ) }`
|
|
1734
|
+
);
|
|
1735
|
+
} else if (appHas) {
|
|
1736
|
+
const aName = `T_${toVar(modId)}_${toVar(locale)}_A`;
|
|
1737
|
+
imports.push(buildImportStatement(aName, `${appImportBase}/i18n/${locale}.json`));
|
|
1738
|
+
extraImports?.push(buildImportStatement(aName, `${appImportBase}/i18n/${locale}.json`));
|
|
1739
|
+
translations.push(`'${locale}': ${aName} as unknown as Record<string,string>`);
|
|
1740
|
+
} else if (coreHas) {
|
|
1741
|
+
const cName = `T_${toVar(modId)}_${toVar(locale)}_C`;
|
|
1742
|
+
imports.push(buildImportStatement(cName, `${pkgImportBase}/i18n/${locale}.json`));
|
|
1743
|
+
extraImports?.push(buildImportStatement(cName, `${pkgImportBase}/i18n/${locale}.json`));
|
|
1744
|
+
translations.push(`'${locale}': ${cName} as unknown as Record<string,string>`);
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
return translations;
|
|
1856
1748
|
}
|
|
1857
1749
|
function processStandaloneConfig(options) {
|
|
1858
1750
|
const {
|
|
@@ -1978,37 +1870,6 @@ function buildModuleDashboardWidgetsValue(entries) {
|
|
|
1978
1870
|
writeValue
|
|
1979
1871
|
);
|
|
1980
1872
|
}
|
|
1981
|
-
function preRenderedExpressionList(expressions) {
|
|
1982
|
-
return arrayLiteral(expressions.map((expression) => identifier(expression)), writeValue);
|
|
1983
|
-
}
|
|
1984
|
-
function legacyNamespaceMemberFallback(importName, members) {
|
|
1985
|
-
return parenthesized(nullishCoalesce([
|
|
1986
|
-
propertyAccess(identifier(importName), members[0]),
|
|
1987
|
-
propertyAccess(identifier(importName), members[1])
|
|
1988
|
-
]));
|
|
1989
|
-
}
|
|
1990
|
-
function buildLegacyModuleListValue(options) {
|
|
1991
|
-
return logicalOr([
|
|
1992
|
-
asExpression(legacyNamespaceMemberFallback(options.importName, options.members), options.castType),
|
|
1993
|
-
emptyArray()
|
|
1994
|
-
]);
|
|
1995
|
-
}
|
|
1996
|
-
function buildLegacyModuleSetupValue(importName) {
|
|
1997
|
-
return logicalOr([
|
|
1998
|
-
legacyNamespaceMemberFallback(importName, ["default", "setup"]),
|
|
1999
|
-
identifier("undefined")
|
|
2000
|
-
]);
|
|
2001
|
-
}
|
|
2002
|
-
function buildLegacyIntegrationListValue(importName, pluralMember, singularMember, castType) {
|
|
2003
|
-
const singular = propertyAccess(identifier(importName), singularMember);
|
|
2004
|
-
return asExpression(
|
|
2005
|
-
parenthesized(nullishCoalesce([
|
|
2006
|
-
propertyAccess(identifier(importName), pluralMember),
|
|
2007
|
-
parenthesized(conditionalExpression(singular, arrayLiteral([singular], writeValue), emptyArray()))
|
|
2008
|
-
])),
|
|
2009
|
-
castType
|
|
2010
|
-
);
|
|
2011
|
-
}
|
|
2012
1873
|
function buildModuleIntegrationListValue(importName, pluralMember, singularMember, castType) {
|
|
2013
1874
|
const plural = namespaceLookup(importName, pluralMember);
|
|
2014
1875
|
const singular = namespaceLookup(importName, singularMember);
|
|
@@ -2059,11 +1920,10 @@ function renderAstModuleRegistryFile(options) {
|
|
|
2059
1920
|
namedImports: [
|
|
2060
1921
|
{ name: "createLazyModuleSubscriber" },
|
|
2061
1922
|
{ name: "createLazyModuleWorker" },
|
|
2062
|
-
...options.includeAbandonHookImport ? [{ name: ABANDON_HOOK_FACTORY }] : [],
|
|
2063
1923
|
{ name: "Module", isTypeOnly: true }
|
|
2064
1924
|
]
|
|
2065
1925
|
});
|
|
2066
|
-
addImportStatements(sourceFile, options.imports
|
|
1926
|
+
addImportStatements(sourceFile, options.imports);
|
|
2067
1927
|
sourceFile.addVariableStatement({
|
|
2068
1928
|
declarationKind: VariableDeclarationKind.Const,
|
|
2069
1929
|
isExported: true,
|
|
@@ -2091,39 +1951,6 @@ function renderAstModuleRegistryFile(options) {
|
|
|
2091
1951
|
});
|
|
2092
1952
|
return getSourceText(sourceFile);
|
|
2093
1953
|
}
|
|
2094
|
-
function renderAstManifestFile(options) {
|
|
2095
|
-
const sourceFile = createGeneratedSourceFile(options.fileName);
|
|
2096
|
-
addAutoGeneratedComment(sourceFile, "registry");
|
|
2097
|
-
const usesPageRouteMetadataHelper = options.typeName === "FrontendRouteManifestEntry" || options.typeName === "BackendRouteManifestEntry";
|
|
2098
|
-
addImportSpec(sourceFile, usesPageRouteMetadataHelper ? {
|
|
2099
|
-
moduleSpecifier: "@open-mercato/shared/modules/registry",
|
|
2100
|
-
namedImports: [
|
|
2101
|
-
{ name: "resolvePageRouteMetadata" },
|
|
2102
|
-
{ name: options.typeName, isTypeOnly: true }
|
|
2103
|
-
]
|
|
2104
|
-
} : {
|
|
2105
|
-
moduleSpecifier: "@open-mercato/shared/modules/registry",
|
|
2106
|
-
isTypeOnly: true,
|
|
2107
|
-
namedImports: [{ name: options.typeName }]
|
|
2108
|
-
});
|
|
2109
|
-
addImportStatements(sourceFile, options.imports ?? []);
|
|
2110
|
-
sourceFile.addVariableStatement({
|
|
2111
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
2112
|
-
isExported: true,
|
|
2113
|
-
declarations: [
|
|
2114
|
-
{
|
|
2115
|
-
name: options.exportName,
|
|
2116
|
-
type: `${options.typeName}[]`,
|
|
2117
|
-
initializer: arrayLiteral(options.entries, writeValue)
|
|
2118
|
-
}
|
|
2119
|
-
]
|
|
2120
|
-
});
|
|
2121
|
-
sourceFile.addExportAssignment({
|
|
2122
|
-
isExportEquals: false,
|
|
2123
|
-
expression: options.exportName
|
|
2124
|
-
});
|
|
2125
|
-
return getSourceText(sourceFile);
|
|
2126
|
-
}
|
|
2127
1954
|
function renderAstLegacyAliasFile(options) {
|
|
2128
1955
|
const sourceFile = createGeneratedSourceFile(options.fileName);
|
|
2129
1956
|
addAutoGeneratedComment(sourceFile, "registry");
|
|
@@ -2174,9 +2001,42 @@ function renderEnabledModuleIdsFile(moduleIds) {
|
|
|
2174
2001
|
});
|
|
2175
2002
|
return getSourceText(sourceFile);
|
|
2176
2003
|
}
|
|
2004
|
+
function renderLegacyCompatibleArray(entries) {
|
|
2005
|
+
return `[
|
|
2006
|
+
${entries.join(",\n ")}
|
|
2007
|
+
]`;
|
|
2008
|
+
}
|
|
2177
2009
|
function buildLazyRouteComponentExpression(importPath) {
|
|
2178
2010
|
return `async (props: any) => { const mod = await ${buildDynamicImportExpression(importPath)}; const Component = (mod.default ?? mod) as any; return createElement(Component, props) }`;
|
|
2179
2011
|
}
|
|
2012
|
+
function renderAstLegacyModuleRegistryOutput(options) {
|
|
2013
|
+
const importSection = [
|
|
2014
|
+
...options.includeCreateElementImport ? ["import { createElement } from 'react'"] : [],
|
|
2015
|
+
"import { createLazyModuleSubscriber, createLazyModuleWorker, type Module } from '@open-mercato/shared/modules/registry'",
|
|
2016
|
+
...options.imports.map((entry) => serializeGeneratedImport(entry))
|
|
2017
|
+
].join("\n");
|
|
2018
|
+
return `// AUTO-GENERATED by mercato generate registry
|
|
2019
|
+
${importSection}
|
|
2020
|
+
|
|
2021
|
+
export const modules: Module[] = ${renderLegacyCompatibleArray(options.moduleEntries)}
|
|
2022
|
+
export const modulesInfo = modules.map(m => ({ id: m.id, ...(m.info || {}) }))
|
|
2023
|
+
export default modules
|
|
2024
|
+
`;
|
|
2025
|
+
}
|
|
2026
|
+
function renderAstLegacyManifestOutput(options) {
|
|
2027
|
+
const usesPageRouteMetadataHelper = options.typeName === "FrontendRouteManifestEntry" || options.typeName === "BackendRouteManifestEntry";
|
|
2028
|
+
const importSection = [
|
|
2029
|
+
usesPageRouteMetadataHelper ? `import { resolvePageRouteMetadata, type ${options.typeName} } from '@open-mercato/shared/modules/registry'` : `import type { ${options.typeName} } from '@open-mercato/shared/modules/registry'`,
|
|
2030
|
+
...(options.imports ?? []).map((entry) => serializeGeneratedImport(entry))
|
|
2031
|
+
].join("\n");
|
|
2032
|
+
return `// AUTO-GENERATED by mercato generate registry
|
|
2033
|
+
${importSection}
|
|
2034
|
+
|
|
2035
|
+
export const ${options.exportName}: ${options.typeName}[] = ${renderLegacyCompatibleArray(options.entries)}
|
|
2036
|
+
|
|
2037
|
+
export default ${options.exportName}
|
|
2038
|
+
`;
|
|
2039
|
+
}
|
|
2180
2040
|
function buildRuntimeRouteComponent(importPath) {
|
|
2181
2041
|
return arrowFunction({
|
|
2182
2042
|
async: true,
|
|
@@ -2417,17 +2277,8 @@ function processWorkersAst(discovered) {
|
|
|
2417
2277
|
{ name: "id", value: workerId },
|
|
2418
2278
|
{ name: "queue", value: metadata.queue },
|
|
2419
2279
|
{ name: "concurrency", value: metadata.concurrency ?? 1 },
|
|
2420
|
-
...metadata.schedulerSafe === true ? [{ name: "schedulerSafe", value: true }] : [],
|
|
2421
|
-
...metadata.schedulerRequiredFeatures ? [{ name: "schedulerRequiredFeatures", value: arrayLiteral(metadata.schedulerRequiredFeatures, writeValue) }] : [],
|
|
2422
2280
|
...metadata.lockDuration === void 0 ? [] : [{ name: "lockDuration", value: metadata.lockDuration }],
|
|
2423
2281
|
...metadata.maxStalledCount === void 0 ? [] : [{ name: "maxStalledCount", value: metadata.maxStalledCount }],
|
|
2424
|
-
...metadata.hasJobAbandonedHook ? [{
|
|
2425
|
-
name: "onJobAbandoned",
|
|
2426
|
-
value: callExpression(identifier(ABANDON_HOOK_FACTORY), [
|
|
2427
|
-
arrowFunction({ body: importExpression(importPath) }),
|
|
2428
|
-
workerId
|
|
2429
|
-
])
|
|
2430
|
-
}] : [],
|
|
2431
2282
|
{
|
|
2432
2283
|
name: "handler",
|
|
2433
2284
|
value: callExpression(identifier("createLazyModuleWorker"), [
|
|
@@ -2737,7 +2588,6 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2737
2588
|
const requiresByModule = /* @__PURE__ */ new Map();
|
|
2738
2589
|
const commandLoaderEntries = [];
|
|
2739
2590
|
let hasRouteComponents = false;
|
|
2740
|
-
let hasAbandonHookWorkers = false;
|
|
2741
2591
|
const umesConflictSources = [];
|
|
2742
2592
|
const seenBackendRoutePatterns = /* @__PURE__ */ new Map();
|
|
2743
2593
|
for (const discovered of discovery.modules) {
|
|
@@ -2932,7 +2782,7 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2932
2782
|
cliImportName = importName;
|
|
2933
2783
|
}
|
|
2934
2784
|
}
|
|
2935
|
-
translations.push(...
|
|
2785
|
+
translations.push(...processTranslations({
|
|
2936
2786
|
discovered: discovered.translations,
|
|
2937
2787
|
modId,
|
|
2938
2788
|
appImportBase,
|
|
@@ -2940,10 +2790,8 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2940
2790
|
imports,
|
|
2941
2791
|
extraImports: runtimeImports
|
|
2942
2792
|
}));
|
|
2943
|
-
subscribers.push(...
|
|
2944
|
-
|
|
2945
|
-
if (workersDeclareAbandonHook(discoveredWorkersForModule)) hasAbandonHookWorkers = true;
|
|
2946
|
-
workers.push(...processWorkersAst(discoveredWorkersForModule));
|
|
2793
|
+
subscribers.push(...processSubscribers(await discovered.getSubscribers()));
|
|
2794
|
+
workers.push(...processWorkers(await discovered.getWorkers()));
|
|
2947
2795
|
{
|
|
2948
2796
|
const parts = [];
|
|
2949
2797
|
if (fieldsImportName)
|
|
@@ -2961,116 +2809,44 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2961
2809
|
);
|
|
2962
2810
|
}
|
|
2963
2811
|
}
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
}
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
})
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
value: buildLegacyModuleListValue({
|
|
3003
|
-
importName: customEntitiesImportName,
|
|
3004
|
-
members: ["default", "entities"],
|
|
3005
|
-
castType: "any"
|
|
3006
|
-
})
|
|
3007
|
-
});
|
|
3008
|
-
}
|
|
3009
|
-
const setupAndBeyondEntries = [];
|
|
3010
|
-
if (setupImportName) {
|
|
3011
|
-
setupAndBeyondEntries.push({ name: "setup", value: buildLegacyModuleSetupValue(setupImportName) });
|
|
3012
|
-
}
|
|
3013
|
-
if (encryptionImportName) {
|
|
3014
|
-
setupAndBeyondEntries.push({
|
|
3015
|
-
name: "defaultEncryptionMaps",
|
|
3016
|
-
value: buildLegacyModuleListValue({
|
|
3017
|
-
importName: encryptionImportName,
|
|
3018
|
-
members: ["default", "defaultEncryptionMaps"],
|
|
3019
|
-
castType: "import('@open-mercato/shared/modules/encryption').ModuleEncryptionMap[]"
|
|
3020
|
-
})
|
|
3021
|
-
});
|
|
3022
|
-
}
|
|
3023
|
-
if (integrationExports) {
|
|
3024
|
-
setupAndBeyondEntries.push({
|
|
3025
|
-
name: "integrations",
|
|
3026
|
-
value: buildLegacyIntegrationListValue(
|
|
3027
|
-
integrationExports,
|
|
3028
|
-
"integrations",
|
|
3029
|
-
"integration",
|
|
3030
|
-
"import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]"
|
|
3031
|
-
)
|
|
3032
|
-
});
|
|
3033
|
-
setupAndBeyondEntries.push({
|
|
3034
|
-
name: "bundles",
|
|
3035
|
-
value: buildLegacyIntegrationListValue(
|
|
3036
|
-
integrationExports,
|
|
3037
|
-
"bundles",
|
|
3038
|
-
"bundle",
|
|
3039
|
-
"import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]"
|
|
3040
|
-
)
|
|
3041
|
-
});
|
|
3042
|
-
}
|
|
3043
|
-
const eagerEntries = [...identityEntries];
|
|
3044
|
-
if (frontendRoutes.length > 0) {
|
|
3045
|
-
eagerEntries.push({ name: "frontendRoutes", value: preRenderedExpressionList(frontendRoutes) });
|
|
3046
|
-
}
|
|
3047
|
-
if (backendRoutes.length > 0) {
|
|
3048
|
-
eagerEntries.push({ name: "backendRoutes", value: preRenderedExpressionList(backendRoutes) });
|
|
3049
|
-
}
|
|
3050
|
-
if (apis.length > 0) {
|
|
3051
|
-
eagerEntries.push({ name: "apis", value: preRenderedExpressionList(apis) });
|
|
3052
|
-
}
|
|
3053
|
-
if (cliImportName) {
|
|
3054
|
-
eagerEntries.push({ name: "cli", value: identifier(cliImportName) });
|
|
3055
|
-
}
|
|
3056
|
-
eagerEntries.push(...sharedTailEntries);
|
|
3057
|
-
if (dashboardWidgets.length > 0) {
|
|
3058
|
-
eagerEntries.push({ name: "dashboardWidgets", value: preRenderedExpressionList(dashboardWidgets) });
|
|
3059
|
-
}
|
|
3060
|
-
eagerEntries.push(...setupAndBeyondEntries);
|
|
3061
|
-
moduleDecls.push(objectLiteral(eagerEntries));
|
|
3062
|
-
const runtimeEntries = [...identityEntries];
|
|
3063
|
-
if (runtimeFrontendRoutes.length > 0) {
|
|
3064
|
-
runtimeEntries.push({ name: "frontendRoutes", value: preRenderedExpressionList(runtimeFrontendRoutes) });
|
|
3065
|
-
}
|
|
3066
|
-
if (runtimeBackendRoutes.length > 0) {
|
|
3067
|
-
runtimeEntries.push({ name: "backendRoutes", value: preRenderedExpressionList(runtimeBackendRoutes) });
|
|
3068
|
-
}
|
|
3069
|
-
if (runtimeApis.length > 0) {
|
|
3070
|
-
runtimeEntries.push({ name: "apis", value: preRenderedExpressionList(runtimeApis) });
|
|
3071
|
-
}
|
|
3072
|
-
runtimeEntries.push(...sharedTailEntries, ...setupAndBeyondEntries);
|
|
3073
|
-
runtimeModuleDecls.push(objectLiteral(runtimeEntries));
|
|
2812
|
+
moduleDecls.push(`{
|
|
2813
|
+
id: ${toLiteral(modId)},
|
|
2814
|
+
${infoImportName ? `info: ${infoImportName}.metadata,` : ""}
|
|
2815
|
+
${frontendRoutes.length ? `frontendRoutes: [${frontendRoutes.join(", ")}],` : ""}
|
|
2816
|
+
${backendRoutes.length ? `backendRoutes: [${backendRoutes.join(", ")}],` : ""}
|
|
2817
|
+
${apis.length ? `apis: [${apis.join(", ")}],` : ""}
|
|
2818
|
+
${cliImportName ? `cli: ${cliImportName},` : ""}
|
|
2819
|
+
${translations.length ? `translations: { ${translations.join(", ")} },` : ""}
|
|
2820
|
+
${subscribers.length ? `subscribers: [${subscribers.join(", ")}],` : ""}
|
|
2821
|
+
${workers.length ? `workers: [${workers.join(", ")}],` : ""}
|
|
2822
|
+
${extensionsImportName ? `entityExtensions: ((${extensionsImportName}.default ?? ${extensionsImportName}.extensions) as import('@open-mercato/shared/modules/entities').EntityExtension[]) || [],` : ""}
|
|
2823
|
+
customFieldSets: ${customFieldSetsExpr},
|
|
2824
|
+
${featuresImportName ? `features: ((${featuresImportName}.default ?? ${featuresImportName}.features) as any) || [],` : ""}
|
|
2825
|
+
${customEntitiesImportName ? `customEntities: ((${customEntitiesImportName}.default ?? ${customEntitiesImportName}.entities) as any) || [],` : ""}
|
|
2826
|
+
${dashboardWidgets.length ? `dashboardWidgets: [${dashboardWidgets.join(", ")}],` : ""}
|
|
2827
|
+
${setupImportName ? `setup: (${setupImportName}.default ?? ${setupImportName}.setup) || undefined,` : ""}
|
|
2828
|
+
${encryptionImportName ? `defaultEncryptionMaps: ((${encryptionImportName}.default ?? ${encryptionImportName}.defaultEncryptionMaps) as import('@open-mercato/shared/modules/encryption').ModuleEncryptionMap[]) || [],` : ""}
|
|
2829
|
+
${integrationExports ? `integrations: ((${integrationExports}.integrations ?? (${integrationExports}.integration ? [${integrationExports}.integration] : [])) as import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]),` : ""}
|
|
2830
|
+
${integrationExports ? `bundles: ((${integrationExports}.bundles ?? (${integrationExports}.bundle ? [${integrationExports}.bundle] : [])) as import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]),` : ""}
|
|
2831
|
+
}`);
|
|
2832
|
+
runtimeModuleDecls.push(`{
|
|
2833
|
+
id: ${toLiteral(modId)},
|
|
2834
|
+
${infoImportName ? `info: ${infoImportName}.metadata,` : ""}
|
|
2835
|
+
${runtimeFrontendRoutes.length ? `frontendRoutes: [${runtimeFrontendRoutes.join(", ")}],` : ""}
|
|
2836
|
+
${runtimeBackendRoutes.length ? `backendRoutes: [${runtimeBackendRoutes.join(", ")}],` : ""}
|
|
2837
|
+
${runtimeApis.length ? `apis: [${runtimeApis.join(", ")}],` : ""}
|
|
2838
|
+
${translations.length ? `translations: { ${translations.join(", ")} },` : ""}
|
|
2839
|
+
${subscribers.length ? `subscribers: [${subscribers.join(", ")}],` : ""}
|
|
2840
|
+
${workers.length ? `workers: [${workers.join(", ")}],` : ""}
|
|
2841
|
+
${extensionsImportName ? `entityExtensions: ((${extensionsImportName}.default ?? ${extensionsImportName}.extensions) as import('@open-mercato/shared/modules/entities').EntityExtension[]) || [],` : ""}
|
|
2842
|
+
customFieldSets: ${customFieldSetsExpr},
|
|
2843
|
+
${featuresImportName ? `features: ((${featuresImportName}.default ?? ${featuresImportName}.features) as any) || [],` : ""}
|
|
2844
|
+
${customEntitiesImportName ? `customEntities: ((${customEntitiesImportName}.default ?? ${customEntitiesImportName}.entities) as any) || [],` : ""}
|
|
2845
|
+
${setupImportName ? `setup: (${setupImportName}.default ?? ${setupImportName}.setup) || undefined,` : ""}
|
|
2846
|
+
${encryptionImportName ? `defaultEncryptionMaps: ((${encryptionImportName}.default ?? ${encryptionImportName}.defaultEncryptionMaps) as import('@open-mercato/shared/modules/encryption').ModuleEncryptionMap[]) || [],` : ""}
|
|
2847
|
+
${integrationExports ? `integrations: ((${integrationExports}.integrations ?? (${integrationExports}.integration ? [${integrationExports}.integration] : [])) as import('@open-mercato/shared/modules/integrations/types').IntegrationDefinition[]),` : ""}
|
|
2848
|
+
${integrationExports ? `bundles: ((${integrationExports}.bundles ?? (${integrationExports}.bundle ? [${integrationExports}.bundle] : [])) as import('@open-mercato/shared/modules/integrations/types').IntegrationBundle[]),` : ""}
|
|
2849
|
+
}`);
|
|
3074
2850
|
}
|
|
3075
2851
|
{
|
|
3076
2852
|
const { detectConflicts } = await import("@open-mercato/shared/lib/umes/conflict-detection");
|
|
@@ -3163,37 +2939,33 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
3163
2939
|
);
|
|
3164
2940
|
}
|
|
3165
2941
|
}
|
|
3166
|
-
const output =
|
|
2942
|
+
const output = renderAstLegacyModuleRegistryOutput({
|
|
3167
2943
|
fileName: "modules.generated.ts",
|
|
3168
|
-
generator: "registry",
|
|
3169
2944
|
imports,
|
|
3170
2945
|
moduleEntries: moduleDecls,
|
|
3171
|
-
includeCreateElementImport: hasRouteComponents
|
|
3172
|
-
includeAbandonHookImport: hasAbandonHookWorkers
|
|
2946
|
+
includeCreateElementImport: hasRouteComponents
|
|
3173
2947
|
});
|
|
3174
|
-
const runtimeOutput =
|
|
2948
|
+
const runtimeOutput = renderAstLegacyModuleRegistryOutput({
|
|
3175
2949
|
fileName: "modules.runtime.generated.ts",
|
|
3176
|
-
generator: "registry",
|
|
3177
2950
|
imports: runtimeImports,
|
|
3178
2951
|
moduleEntries: runtimeModuleDecls,
|
|
3179
|
-
includeCreateElementImport: true
|
|
3180
|
-
includeAbandonHookImport: hasAbandonHookWorkers
|
|
2952
|
+
includeCreateElementImport: true
|
|
3181
2953
|
});
|
|
3182
|
-
const frontendRoutesOutput =
|
|
2954
|
+
const frontendRoutesOutput = renderAstLegacyManifestOutput({
|
|
3183
2955
|
fileName: "frontend-routes.generated.ts",
|
|
3184
2956
|
typeName: "FrontendRouteManifestEntry",
|
|
3185
2957
|
exportName: "frontendRoutes",
|
|
3186
2958
|
imports: frontendRouteManifestImports,
|
|
3187
2959
|
entries: frontendRouteManifestDecls
|
|
3188
2960
|
});
|
|
3189
|
-
const backendRoutesOutput =
|
|
2961
|
+
const backendRoutesOutput = renderAstLegacyManifestOutput({
|
|
3190
2962
|
fileName: "backend-routes.generated.ts",
|
|
3191
2963
|
typeName: "BackendRouteManifestEntry",
|
|
3192
2964
|
exportName: "backendRoutes",
|
|
3193
2965
|
imports: backendRouteManifestImports,
|
|
3194
2966
|
entries: backendRouteManifestDecls
|
|
3195
2967
|
});
|
|
3196
|
-
const apiRoutesOutput =
|
|
2968
|
+
const apiRoutesOutput = renderAstLegacyManifestOutput({
|
|
3197
2969
|
fileName: "api-routes.generated.ts",
|
|
3198
2970
|
typeName: "ApiRouteManifestEntry",
|
|
3199
2971
|
exportName: "apiRoutes",
|
|
@@ -3320,11 +3092,16 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
3320
3092
|
allRegImports.push(...reg.registrationImports);
|
|
3321
3093
|
allCalls.push(reg.buildCall(reg.entriesExportName));
|
|
3322
3094
|
}
|
|
3323
|
-
const
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3095
|
+
const uniqueImports = [.../* @__PURE__ */ new Set([...allEntryImports, ...allRegImports])];
|
|
3096
|
+
const importSection = uniqueImports.join("\n");
|
|
3097
|
+
const body = ` ${allCalls.join("\n ")}`;
|
|
3098
|
+
const bootstrapRegsOutput = `// AUTO-GENERATED by mercato generate registry
|
|
3099
|
+
${importSection ? `${importSection}
|
|
3100
|
+
` : ""}
|
|
3101
|
+
export function runBootstrapRegistrations(): void {
|
|
3102
|
+
${body}
|
|
3103
|
+
}
|
|
3104
|
+
`;
|
|
3328
3105
|
writeGeneratedFile({ outFile: bootstrapRegsOutFile, checksumFile: bootstrapRegsChecksumFile, content: bootstrapRegsOutput, structureChecksum, result, quiet });
|
|
3329
3106
|
}
|
|
3330
3107
|
return result;
|
|
@@ -3360,7 +3137,6 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
3360
3137
|
const requiresByModule = /* @__PURE__ */ new Map();
|
|
3361
3138
|
const commandLoaderEntries = [];
|
|
3362
3139
|
let hasRouteComponents = false;
|
|
3363
|
-
let hasAbandonHookWorkers = false;
|
|
3364
3140
|
const seenBackendRoutePatterns = /* @__PURE__ */ new Map();
|
|
3365
3141
|
for (const discovered of discovery.modules) {
|
|
3366
3142
|
const { modId, roots, imps, appImportBase } = discovered;
|
|
@@ -3506,9 +3282,7 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
3506
3282
|
i18nLocaleShards.set(locale, shard);
|
|
3507
3283
|
}
|
|
3508
3284
|
subscribers.push(...processSubscribersAst(await discovered.getSubscribers()));
|
|
3509
|
-
|
|
3510
|
-
if (workersDeclareAbandonHook(discoveredWorkersForModule)) hasAbandonHookWorkers = true;
|
|
3511
|
-
workers.push(...processWorkersAst(discoveredWorkersForModule));
|
|
3285
|
+
workers.push(...processWorkersAst(await discovered.getWorkers()));
|
|
3512
3286
|
{
|
|
3513
3287
|
dashboardWidgetsValue = buildModuleDashboardWidgetsValue(discovered.dashboardWidgetEntries);
|
|
3514
3288
|
}
|
|
@@ -3625,22 +3399,19 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
3625
3399
|
generator: "registry (app version)",
|
|
3626
3400
|
imports,
|
|
3627
3401
|
moduleEntries: moduleDecls,
|
|
3628
|
-
includeCreateElementImport: hasRouteComponents
|
|
3629
|
-
includeAbandonHookImport: hasAbandonHookWorkers
|
|
3402
|
+
includeCreateElementImport: hasRouteComponents
|
|
3630
3403
|
});
|
|
3631
3404
|
const bootstrapOutput = renderAstModuleRegistryFile({
|
|
3632
3405
|
fileName: "modules.bootstrap.generated.ts",
|
|
3633
3406
|
generator: "registry (bootstrap version)",
|
|
3634
3407
|
imports: bootstrapImports,
|
|
3635
|
-
moduleEntries: bootstrapModuleDecls
|
|
3636
|
-
includeAbandonHookImport: hasAbandonHookWorkers
|
|
3408
|
+
moduleEntries: bootstrapModuleDecls
|
|
3637
3409
|
});
|
|
3638
3410
|
const i18nOutput = renderAstModuleRegistryFile({
|
|
3639
3411
|
fileName: "modules.i18n.generated.ts",
|
|
3640
3412
|
generator: "registry (i18n version)",
|
|
3641
3413
|
imports: i18nImports,
|
|
3642
|
-
moduleEntries: i18nModuleDecls
|
|
3643
|
-
includeAbandonHookImport: hasAbandonHookWorkers
|
|
3414
|
+
moduleEntries: i18nModuleDecls
|
|
3644
3415
|
});
|
|
3645
3416
|
const legacyOutput = renderAstLegacyAliasFile({
|
|
3646
3417
|
fileName: "bootstrap-modules.generated.ts",
|
|
@@ -3715,7 +3486,6 @@ async function generateModuleRegistryAppFromDiscovery(options) {
|
|
|
3715
3486
|
return result;
|
|
3716
3487
|
}
|
|
3717
3488
|
async function generateModuleRegistryCliFromDiscovery(options) {
|
|
3718
|
-
let hasAbandonHookWorkers = false;
|
|
3719
3489
|
const { resolver, quiet = false } = options;
|
|
3720
3490
|
const { discovery } = options;
|
|
3721
3491
|
const result = createGeneratorResult();
|
|
@@ -3834,7 +3604,6 @@ async function generateModuleRegistryCliFromDiscovery(options) {
|
|
|
3834
3604
|
subscribers.push(...processSubscribersAst(await discovered.getSubscribers()));
|
|
3835
3605
|
const discoveredWorkers = await discovered.getWorkers();
|
|
3836
3606
|
const workerGenerationEntries = collectWorkerGenerationEntries(discoveredWorkers, modId);
|
|
3837
|
-
if (workersDeclareAbandonHook(discoveredWorkers)) hasAbandonHookWorkers = true;
|
|
3838
3607
|
workers.push(...processWorkersAst(discoveredWorkers));
|
|
3839
3608
|
devSupervisorWorkers.push(...workerGenerationEntries.map(({ importPath: _importPath, ...worker }) => worker));
|
|
3840
3609
|
{
|
|
@@ -3951,8 +3720,7 @@ async function generateModuleRegistryCliFromDiscovery(options) {
|
|
|
3951
3720
|
fileName: "modules.cli.generated.ts",
|
|
3952
3721
|
generator: "registry (CLI version)",
|
|
3953
3722
|
imports,
|
|
3954
|
-
moduleEntries: moduleDecls
|
|
3955
|
-
includeAbandonHookImport: hasAbandonHookWorkers
|
|
3723
|
+
moduleEntries: moduleDecls
|
|
3956
3724
|
});
|
|
3957
3725
|
const legacyOutput = renderAstLegacyAliasFile({
|
|
3958
3726
|
fileName: "cli-modules.generated.ts",
|
|
@@ -4038,9 +3806,6 @@ export {
|
|
|
4038
3806
|
generateModuleRegistryApp,
|
|
4039
3807
|
generateModuleRegistryCli,
|
|
4040
3808
|
hasNamedExport,
|
|
4041
|
-
namedObjectLiteralDeclaresProperty,
|
|
4042
|
-
renderBootstrapRegistrationsFile,
|
|
4043
|
-
renderCommandLoadersFile,
|
|
4044
3809
|
resetConventionWarnings,
|
|
4045
3810
|
resolveNamedObjectExport,
|
|
4046
3811
|
warnIfPageMetaMissingMetadataExport,
|