@xrystal/core 3.51.6 → 3.52.1

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.
Files changed (121) hide show
  1. package/README.md +35 -1
  2. package/package.json +2 -1
  3. package/x/bin/commands/create.mjs +44 -0
  4. package/x/bin/commands/projects.mjs +53 -0
  5. package/x/bin/commands/sync.mjs +49 -1
  6. package/x/bin/commands/tmp.mjs +1 -1
  7. package/x/bin/helpers/.generated/.generated-from +2 -0
  8. package/x/bin/helpers/.generated/seed-from-tmp.mjs +25 -31
  9. package/x/bin/helpers/.generated/tmp-schema.mjs +156 -96
  10. package/x/bin/helpers/.generated/workspace.mjs +402 -0
  11. package/x/bin/helpers/.generated/xrystal-home-registry.mjs +310 -0
  12. package/x/bin/helpers/build-config.mjs +3 -2
  13. package/x/bin/helpers/cli-help.mjs +3 -1
  14. package/x/bin/helpers/project-artifacts.mjs +10 -0
  15. package/x/bin/helpers/tmp-config.mjs +13 -12
  16. package/x/bin/helpers/tmp-layout.mjs +28 -52
  17. package/x/bin/helpers/tmp-schema.mjs +9 -3
  18. package/x/bin/helpers/workspace-resolve.mjs +11 -0
  19. package/x/bin/helpers/workspace-scaffold.mjs +23 -0
  20. package/x/bin/helpers/xrystal-registry.mjs +13 -0
  21. package/x/bin/main-cli.js +2 -0
  22. package/x/dist/index.js +5 -1
  23. package/x/dist/loader/clients/index.js +22 -1
  24. package/x/dist/loader/configs/index.js +97 -1
  25. package/x/dist/loader/controller/index.js +267 -1
  26. package/x/dist/loader/dto/index.js +92 -1
  27. package/x/dist/loader/events/index.js +39 -1
  28. package/x/dist/loader/index.js +13 -1
  29. package/x/dist/loader/kafka/index.js +142 -1
  30. package/x/dist/loader/kafka/resolve-ssl.js +23 -1
  31. package/x/dist/loader/localizations/index.js +46 -1
  32. package/x/dist/loader/logger/index.js +229 -2
  33. package/x/dist/loader/mongo/index.js +52 -1
  34. package/x/dist/loader/mongo/resolve-connect.js +16 -1
  35. package/x/dist/loader/redis/index.js +57 -1
  36. package/x/dist/loader/redis/resolve-socket.js +31 -1
  37. package/x/dist/loader/registry/index.js +1 -1
  38. package/x/dist/loader/service/index.js +7 -1
  39. package/x/dist/loader/system/index.js +26 -1
  40. package/x/dist/project/index.js +51 -1
  41. package/x/dist/utils/constants/defaults.json +3 -1
  42. package/x/dist/utils/constants/index.d.ts +1 -0
  43. package/x/dist/utils/constants/index.js +42 -1
  44. package/x/dist/utils/constants/package-root.js +6 -1
  45. package/x/dist/utils/helpers/configs/index.js +1 -1
  46. package/x/dist/utils/helpers/context/controller-store.js +12 -1
  47. package/x/dist/utils/helpers/context/index.js +24 -1
  48. package/x/dist/utils/helpers/core/handlebars-resolve.js +15 -1
  49. package/x/dist/utils/helpers/core/index.js +46 -1
  50. package/x/dist/utils/helpers/core/paths.js +78 -1
  51. package/x/dist/utils/helpers/core/tmp-layout.d.ts +4 -4
  52. package/x/dist/utils/helpers/core/tmp-layout.js +229 -1
  53. package/x/dist/utils/helpers/date/index.js +48 -1
  54. package/x/dist/utils/helpers/dispatch/index.js +53 -1
  55. package/x/dist/utils/helpers/dto/index.js +10 -1
  56. package/x/dist/utils/helpers/filters/index.js +44 -1
  57. package/x/dist/utils/helpers/framework/index.js +18 -1
  58. package/x/dist/utils/helpers/handlers/adapters.js +41 -1
  59. package/x/dist/utils/helpers/handlers/execute.js +82 -1
  60. package/x/dist/utils/helpers/handlers/index.js +31 -1
  61. package/x/dist/utils/helpers/hash/crypto.js +22 -1
  62. package/x/dist/utils/helpers/id/index.js +24 -1
  63. package/x/dist/utils/helpers/index.d.ts +1 -0
  64. package/x/dist/utils/helpers/index.js +28 -1
  65. package/x/dist/utils/helpers/ip/index.js +21 -1
  66. package/x/dist/utils/helpers/is/index.js +35 -1
  67. package/x/dist/utils/helpers/kafka-loader-options/index.js +14 -1
  68. package/x/dist/utils/helpers/locales/index.js +82 -1
  69. package/x/dist/utils/helpers/logger-layer/index.js +33 -1
  70. package/x/dist/utils/helpers/math/index.js +14 -1
  71. package/x/dist/utils/helpers/middleware/index.js +36 -1
  72. package/x/dist/utils/helpers/node-env/index.js +20 -1
  73. package/x/dist/utils/helpers/objects/index.js +55 -1
  74. package/x/dist/utils/helpers/path/index.js +5 -1
  75. package/x/dist/utils/helpers/path/resolve-alias-path.d.ts +1 -1
  76. package/x/dist/utils/helpers/path/resolve-alias-path.js +62 -1
  77. package/x/dist/utils/helpers/protocol/index.d.ts +1 -1
  78. package/x/dist/utils/helpers/protocol/index.js +100 -1
  79. package/x/dist/utils/helpers/protocol/options.js +13 -1
  80. package/x/dist/utils/helpers/regex/checkSpecialRegexControl.js +3 -1
  81. package/x/dist/utils/helpers/registry/index.js +103 -1
  82. package/x/dist/utils/helpers/runtime/dto-access.js +5 -1
  83. package/x/dist/utils/helpers/runtime/dto-types.js +1 -1
  84. package/x/dist/utils/helpers/runtime/index.js +2 -1
  85. package/x/dist/utils/helpers/runtime/shutdown.js +36 -1
  86. package/x/dist/utils/helpers/state/index.js +185 -1
  87. package/x/dist/utils/helpers/state/props-from-tmp.js +46 -1
  88. package/x/dist/utils/helpers/state/request-key-guard.js +43 -1
  89. package/x/dist/utils/helpers/state/scopes.js +69 -1
  90. package/x/dist/utils/helpers/string/index.js +9 -1
  91. package/x/dist/utils/helpers/timer/index.js +5 -1
  92. package/x/dist/utils/helpers/tmp/index.d.ts +2 -2
  93. package/x/dist/utils/helpers/tmp/index.js +8 -1
  94. package/x/dist/utils/helpers/tmp/loader-tmp-sync.js +14 -1
  95. package/x/dist/utils/helpers/tmp/path-normalize.js +27 -1
  96. package/x/dist/utils/helpers/tmp/runtime-tmp.js +42 -1
  97. package/x/dist/utils/helpers/tmp/seed-from-tmp.d.ts +2 -2
  98. package/x/dist/utils/helpers/tmp/seed-from-tmp.js +62 -1
  99. package/x/dist/utils/helpers/tmp/tmp-interpolate.js +22 -1
  100. package/x/dist/utils/helpers/tmp/tmp-loader.js +56 -1
  101. package/x/dist/utils/helpers/tmp/tmp-schema.d.ts +35 -23
  102. package/x/dist/utils/helpers/tmp/tmp-schema.js +211 -1
  103. package/x/dist/utils/helpers/tmp/tmp-watch.js +23 -1
  104. package/x/dist/utils/helpers/tmp/toolchain-heal.js +157 -2
  105. package/x/dist/utils/helpers/validates/index.js +20 -1
  106. package/x/dist/utils/helpers/workspace/index.d.ts +42 -0
  107. package/x/dist/utils/helpers/workspace/index.js +222 -0
  108. package/x/dist/utils/helpers/xrystal-home/registry.d.ts +32 -0
  109. package/x/dist/utils/helpers/xrystal-home/registry.js +92 -0
  110. package/x/dist/utils/index.js +3 -1
  111. package/x/dist/utils/models/classes/class.clients.js +142 -1
  112. package/x/dist/utils/models/classes/class.interfaces.js +10 -1
  113. package/x/dist/utils/models/classes/class.service-locator.js +16 -1
  114. package/x/dist/utils/models/classes/class.tmp-file-loader.js +61 -1
  115. package/x/dist/utils/models/classes/class.x.js +181 -1
  116. package/x/dist/utils/models/enums/index.d.ts +9 -1
  117. package/x/dist/utils/models/enums/index.js +169 -1
  118. package/x/dist/utils/models/index.js +9 -1
  119. package/x/dist/utils/models/types/index.js +2 -1
  120. package/x/templates/api-service/tmp.yml +59 -0
  121. package/x/tmp.yml +7 -50
@@ -9,6 +9,7 @@ var defaults_default = {
9
9
  cliBinFile: "main-cli.js",
10
10
  tmpBaseName: "tmp",
11
11
  tmpExtension: ".yml",
12
+ apiServiceTemplateRel: "x/templates/api-service/tmp.yml",
12
13
  templateRepoUri: "https://github.com/xdloper/api-gpt-svc",
13
14
  publicFolderName: "public",
14
15
  kafkaLogsTopic: "log",
@@ -56,9 +57,10 @@ var defaults_default = {
56
57
  maxIntervalMs: 1e4
57
58
  },
58
59
  buildDefaults: {
60
+ bundler: "auto",
59
61
  tsconfig: "tsconfig.json",
60
62
  typecheck: false,
61
- tscLenient: false,
63
+ tscLenient: true,
62
64
  declarations: false,
63
65
  sourcemap: false,
64
66
  minify: false
@@ -66,6 +68,12 @@ var defaults_default = {
66
68
  };
67
69
 
68
70
  // source/utils/models/enums/index.ts
71
+ var GlobalTypeEnum;
72
+ ((GlobalTypeEnum2) => {
73
+ GlobalTypeEnum2["WORKSPACE"] = "workspace";
74
+ GlobalTypeEnum2["API_SERVICE"] = "api-service";
75
+ GlobalTypeEnum2["FRONTEND"] = "frontend";
76
+ })(GlobalTypeEnum ||= {});
69
77
  var RuntimeEnum;
70
78
  ((RuntimeEnum2) => {
71
79
  RuntimeEnum2["BUN"] = "bun";
@@ -114,40 +122,27 @@ function normalizeLayoutPaths(special, fallback) {
114
122
 
115
123
  // source/utils/helpers/tmp/seed-from-tmp.ts
116
124
  var here = path.dirname(fileURLToPath(import.meta.url));
117
- var tmpFileName = `${defaults_default.tmpBaseName}${defaults_default.tmpExtension}`;
125
+ var templateRel = defaults_default.apiServiceTemplateRel ?? "x/templates/api-service/tmp.yml";
118
126
  function requireString(value, label) {
119
127
  if (typeof value !== "string" || !value.trim()) {
120
- throw new Error(`${defaults_default.packageName}: bundled tmp.yml missing ${label}`);
128
+ throw new Error(`${defaults_default.packageName}: bundled template missing ${label}`);
121
129
  }
122
130
  return value.trim();
123
131
  }
124
132
  function readLayoutFromSpecial(special) {
125
133
  const block = special && typeof special === "object" && !Array.isArray(special) ? special : {};
126
134
  return {
127
- tests: requireString(block.tests, "configs.service.paths.special.tests"),
128
- environments: requireString(block.environments, "configs.service.paths.special.environments"),
129
- dist: requireString(block.dist, "configs.service.paths.special.dist")
135
+ tests: requireString(block.tests, "configs.global.paths.special.tests"),
136
+ environments: requireString(block.environments, "configs.global.paths.special.environments"),
137
+ dist: requireString(block.dist, "configs.global.paths.special.dist")
130
138
  };
131
139
  }
132
- function safeProcessCwd() {
133
- try {
134
- return process.cwd();
135
- } catch {
136
- return null;
137
- }
138
- }
139
- function findBundledTmpFile(explicit) {
140
- if (explicit) {
141
- if (!fs.existsSync(explicit)) {
142
- throw new Error(`${defaults_default.packageName}: bundled tmp.yml missing at ${explicit}`);
143
- }
144
- return explicit;
145
- }
146
- const starts = [here, safeProcessCwd()].filter((value) => Boolean(value));
140
+ function findApiTemplate() {
141
+ const starts = [here, process.cwd()].map((value) => path.resolve(value));
147
142
  for (const start of starts) {
148
- let dir = path.resolve(start);
143
+ let dir = start;
149
144
  for (;; ) {
150
- const candidate = path.join(dir, defaults_default.packageRootFolder, tmpFileName);
145
+ const candidate = path.join(dir, templateRel);
151
146
  if (fs.existsSync(candidate))
152
147
  return candidate;
153
148
  const parent = path.dirname(dir);
@@ -156,20 +151,25 @@ function findBundledTmpFile(explicit) {
156
151
  dir = parent;
157
152
  }
158
153
  }
159
- throw new Error(`${defaults_default.packageName}: bundled ${defaults_default.packageRootFolder}/${tmpFileName} not found from ${here}`);
154
+ throw new Error(`${defaults_default.packageName}: api-service template not found (${templateRel})`);
160
155
  }
161
156
  function loadSeedFromBundledTmp(tmpFilePath) {
162
- const file = findBundledTmpFile(tmpFilePath);
157
+ const file = tmpFilePath ?? findApiTemplate();
163
158
  const doc = yaml.parse(fs.readFileSync(file, "utf8"));
164
159
  const configs = doc?.configs && typeof doc.configs === "object" ? doc.configs : {};
165
- const service = configs.service && typeof configs.service === "object" ? configs.service : {};
166
- const paths = service.paths && typeof service.paths === "object" ? service.paths : {};
167
- const sourceRaw = requireString(paths.source, "configs.service.paths.source");
160
+ const global = configs.global && typeof configs.global === "object" ? configs.global : {};
161
+ const paths = global.paths && typeof global.paths === "object" ? global.paths : {};
162
+ const special = paths.special;
163
+ const root = requireString(paths.root, "configs.global.paths.root");
164
+ const rootNorm = normalizeRootFolder(root, defaults_default.packageRootFolder).replace(/^\.\//, "");
165
+ const tmpName = typeof paths.tmp === "string" && paths.tmp.trim() ? paths.tmp.trim().replace(/^\.\//, "") : "tmp.yml";
166
+ const sourceRaw = requireString(paths.source, "configs.global.paths.source");
168
167
  return {
169
- rootFolder: normalizeRootFolder(paths.root, defaults_default.packageRootFolder),
168
+ rootFolder: rootNorm,
170
169
  sourceFolder: normalizeSourceFolder(sourceRaw, sourceRaw),
171
- framework: requireString(service.framework, "configs.service.framework"),
172
- layout: readLayoutFromSpecial(paths.special)
170
+ framework: requireString(global.framework, "configs.global.framework"),
171
+ layout: readLayoutFromSpecial(special),
172
+ tmpRelPath: `${rootNorm}/${tmpName}`.replace(/\/+/g, "/")
173
173
  };
174
174
  }
175
175
  var seedFromTmp = loadSeedFromBundledTmp();
@@ -202,11 +202,26 @@ function interpolateWithContext(value, context) {
202
202
  function isRecord2(value) {
203
203
  return typeof value === "object" && value !== null && !Array.isArray(value);
204
204
  }
205
+ function stripDotSlash(value) {
206
+ return value.replace(/^\.\//, "").replace(/\/$/, "");
207
+ }
205
208
  function readWatchIntervalValue(raw) {
206
209
  if (typeof raw === "number" || typeof raw === "string")
207
210
  return raw;
208
211
  return;
209
212
  }
213
+ function normalizeGlobalType(value) {
214
+ if (value === undefined || value === null || value === "")
215
+ return;
216
+ const raw = typeof value === "string" ? value.trim().toLowerCase() : "";
217
+ if (raw === "workspace" /* WORKSPACE */)
218
+ return "workspace" /* WORKSPACE */;
219
+ if (raw === "api-service" /* API_SERVICE */)
220
+ return "api-service" /* API_SERVICE */;
221
+ if (raw === "frontend" /* FRONTEND */)
222
+ return "frontend" /* FRONTEND */;
223
+ throw new Error(`${defaults_default.packageName}: configs.global.type must be one of ${Object.values(GlobalTypeEnum).join("|")} (got "${String(value)}")`);
224
+ }
210
225
  function normalizeRuntime(value) {
211
226
  const raw = typeof value === "string" ? value.trim().toLowerCase() : "";
212
227
  if (raw === "node" /* NODE */)
@@ -230,7 +245,7 @@ function normalizeBundler(value) {
230
245
  return "bun" /* BUN */;
231
246
  if (raw === "auto" /* AUTO */)
232
247
  return "auto" /* AUTO */;
233
- throw new Error(`${defaults_default.packageName}: unknown build.bundler "${String(value)}" (expected ${Object.values(BundlerEnum).join("|")})`);
248
+ throw new Error(`${defaults_default.packageName}: unknown configs.global.build.bundler "${String(value)}" (expected ${Object.values(BundlerEnum).join("|")})`);
234
249
  }
235
250
  function resolveEffectiveBundler(bundler, _runtime) {
236
251
  if (bundler !== "auto" /* AUTO */)
@@ -243,76 +258,98 @@ function normalizeRootFolder2(value) {
243
258
  function normalizeSourceFolder2(value) {
244
259
  return normalizeSourceFolder(value, seedFromTmp.sourceFolder);
245
260
  }
246
- function readTmpGlobalBlock(configs) {
261
+ function readTmpGlobalPathsBlock(configs) {
247
262
  const global = isRecord2(configs?.global) ? configs.global : {};
248
- const varsRaw = isRecord2(global.vars) ? global.vars : {};
263
+ const paths = isRecord2(global.paths) ? global.paths : {};
264
+ const special = isRecord2(paths.special) ? paths.special : {};
265
+ const root = typeof paths.root === "string" ? paths.root.trim() : "";
266
+ if (!root) {
267
+ throw new Error(`${defaults_default.packageName}: configs.global.paths.root is required`);
268
+ }
249
269
  return {
250
- runtime: normalizeRuntime(global.runtime),
251
- vars: { ...varsRaw }
270
+ root,
271
+ tmp: typeof paths.tmp === "string" ? paths.tmp : "tmp.yml",
272
+ source: typeof paths.source === "string" ? paths.source : seedFromTmp.sourceFolder,
273
+ special: {
274
+ tests: typeof special.tests === "string" ? special.tests : undefined,
275
+ environments: typeof special.environments === "string" ? special.environments : undefined,
276
+ dist: typeof special.dist === "string" ? special.dist : undefined
277
+ }
252
278
  };
253
279
  }
254
- function readTmpCoreBlock(configs) {
255
- const core = isRecord2(configs?.core) ? configs.core : {};
256
- const tmp = isRecord2(core.tmp) ? core.tmp : {};
280
+ function resolveMergedPaths(configs) {
281
+ const paths = readTmpGlobalPathsBlock(configs);
282
+ const root = stripDotSlash(normalizeRootFolder2(paths.root));
283
+ const tmpName = stripDotSlash(paths.tmp ?? "tmp.yml");
284
+ const source = stripDotSlash(normalizeSourceFolder2(paths.source));
285
+ const special = normalizeLayoutPaths(paths.special, seedFromTmp.layout);
257
286
  return {
258
- tmp: {
259
- fileWatchIntervalMs: readWatchIntervalValue(tmp.fileWatchIntervalMs)
260
- }
287
+ root,
288
+ source,
289
+ special,
290
+ tmpRelPath: `${root}/${tmpName}`.replace(/\/+/g, "/")
261
291
  };
262
292
  }
263
- function readTmpServiceBlock(configs) {
264
- const service = isRecord2(configs?.service) ? configs.service : {};
265
- const pathsRaw = isRecord2(service.paths) ? service.paths : {};
266
- const special = isRecord2(pathsRaw.special) ? pathsRaw.special : {};
267
- let loaders = isRecord2(service.loaders) ? { ...service.loaders } : undefined;
268
- let build = isRecord2(service.build) ? service.build : undefined;
269
- if (loaders && isRecord2(loaders.build)) {
270
- const { build: nestedBuild, ...rest } = loaders;
271
- loaders = rest;
272
- if (!build && isRecord2(nestedBuild)) {
273
- build = nestedBuild;
274
- }
293
+ function readTmpGlobalBlock(configs) {
294
+ const global = isRecord2(configs?.global) ? configs.global : {};
295
+ const varsRaw = isRecord2(global.vars) ? global.vars : {};
296
+ const typeRaw = global.type;
297
+ if (typeof global.framework !== "string" || !global.framework.trim()) {
298
+ throw new Error(`${defaults_default.packageName}: configs.global.framework is required`);
275
299
  }
276
300
  return {
277
- name: typeof service.name === "string" ? service.name : undefined,
278
- framework: typeof service.framework === "string" ? service.framework : undefined,
279
- paths: {
280
- root: typeof pathsRaw.root === "string" ? pathsRaw.root : undefined,
281
- source: typeof pathsRaw.source === "string" ? pathsRaw.source : undefined,
282
- special: {
283
- tests: typeof special.tests === "string" ? special.tests : undefined,
284
- environments: typeof special.environments === "string" ? special.environments : undefined,
285
- dist: typeof special.dist === "string" ? special.dist : undefined
286
- }
287
- },
288
- protocols: service.protocols,
289
- loaders,
290
- build
301
+ runtime: normalizeRuntime(global.runtime),
302
+ type: typeRaw !== undefined ? normalizeGlobalType(typeRaw) : undefined,
303
+ framework: global.framework.trim(),
304
+ paths: readTmpGlobalPathsBlock(configs),
305
+ vars: { ...varsRaw },
306
+ build: isRecord2(global.build) ? { ...global.build } : undefined,
307
+ options: isRecord2(global.options) ? {
308
+ fileWatchIntervalMs: readWatchIntervalValue(global.options.fileWatchIntervalMs)
309
+ } : undefined
291
310
  };
292
311
  }
293
- function resolveServiceLayoutPaths(service) {
294
- return normalizeLayoutPaths(service.paths?.special, seedFromTmp.layout);
312
+ function assertNoLegacyTmpKeys(configs) {
313
+ const depends = isRecord2(configs?.depends) ? configs.depends : {};
314
+ if ("build" in depends && depends.build !== undefined && depends.build !== null) {
315
+ throw new Error(`${defaults_default.packageName}: configs.depends.build removed — use configs.global.build`);
316
+ }
317
+ const loaders = isRecord2(depends.loaders) ? depends.loaders : {};
318
+ if ("build" in loaders && loaders.build !== undefined && loaders.build !== null) {
319
+ throw new Error(`${defaults_default.packageName}: configs.depends.loaders.build removed — use configs.global.build`);
320
+ }
321
+ if (isRecord2(configs?.cluster)) {
322
+ throw new Error(`${defaults_default.packageName}: configs.cluster removed — deployment name is project.name (CLI --deployment overrides)`);
323
+ }
324
+ const global = isRecord2(configs?.global) ? configs.global : {};
325
+ if ("fileWatchIntervalMs" in global && global.fileWatchIntervalMs !== undefined && global.fileWatchIntervalMs !== null) {
326
+ throw new Error(`${defaults_default.packageName}: configs.global.fileWatchIntervalMs removed — use configs.global.options.fileWatchIntervalMs`);
327
+ }
328
+ }
329
+ function readTmpBuildBlock(configs) {
330
+ assertNoLegacyTmpKeys(configs);
331
+ const global = isRecord2(configs?.global) ? configs.global : {};
332
+ return isRecord2(global.build) ? { ...global.build } : {};
295
333
  }
296
- function buildNormalizedService(service) {
297
- const layoutPaths = resolveServiceLayoutPaths(service);
334
+ function readTmpDependsBlock(configs) {
335
+ assertNoLegacyTmpKeys(configs);
336
+ const depends = isRecord2(configs?.depends) ? configs.depends : {};
337
+ const loaders = isRecord2(depends.loaders) ? { ...depends.loaders } : undefined;
298
338
  return {
299
- name: service.name,
300
- framework: service.framework ?? seedFromTmp.framework,
301
- paths: {
302
- root: service.paths?.root ?? defaults_default.packageRootFolder,
303
- source: service.paths?.source ?? seedFromTmp.sourceFolder,
304
- special: layoutPaths
305
- },
306
- protocols: service.protocols,
307
- loaders: service.loaders,
308
- build: service.build
339
+ protocols: depends.protocols,
340
+ loaders
309
341
  };
310
342
  }
311
- function buildNormalizedCore(core) {
343
+ function resolveTmpDeploymentName(tmp) {
344
+ assertNoLegacyTmpKeys(isRecord2(tmp?.configs) ? tmp.configs : undefined);
345
+ const project = isRecord2(tmp?.project) ? tmp.project : {};
346
+ const projectName = typeof project.name === "string" ? project.name.trim() : undefined;
347
+ return projectName || undefined;
348
+ }
349
+ function buildNormalizedDepends(depends) {
312
350
  return {
313
- tmp: {
314
- fileWatchIntervalMs: core.tmp?.fileWatchIntervalMs
315
- }
351
+ protocols: depends.protocols,
352
+ loaders: depends.loaders
316
353
  };
317
354
  }
318
355
  function buildTmpVarContext(global) {
@@ -329,15 +366,19 @@ function applyTmpGlobalVars(tmp) {
329
366
  }
330
367
  function resolveTmpRuntimeConfigs(tmp) {
331
368
  const configs = isRecord2(tmp?.configs) ? tmp.configs : {};
369
+ assertNoLegacyTmpKeys(configs);
332
370
  const global = readTmpGlobalBlock(configs);
333
- const service = readTmpServiceBlock(configs);
334
- const core = readTmpCoreBlock(configs);
335
- const normalizedService = buildNormalizedService(service);
371
+ const depends = readTmpDependsBlock(configs);
372
+ const merged = resolveMergedPaths(configs);
336
373
  return {
337
- global,
338
- service: normalizedService,
339
- core: buildNormalizedCore(core),
340
- rootFolderPath: normalizeRootFolder2(normalizedService.paths.root)
374
+ global: {
375
+ ...global,
376
+ build: readTmpBuildBlock(configs)
377
+ },
378
+ depends: buildNormalizedDepends(depends),
379
+ deploymentName: resolveTmpDeploymentName(tmp),
380
+ rootFolderPath: merged.root,
381
+ tmpRelPath: merged.tmpRelPath
341
382
  };
342
383
  }
343
384
  function normalizeTmpDocument(tmp) {
@@ -347,18 +388,37 @@ function normalizeTmpDocument(tmp) {
347
388
  configs: resolveTmpRuntimeConfigs(interpolated)
348
389
  };
349
390
  }
391
+ function resolveProjectRootFromTmpPath(tmpFilePath, configs) {
392
+ const merged = resolveMergedPaths(configs);
393
+ const abs = tmpFilePath.replace(/\\/g, "/");
394
+ const rel = merged.tmpRelPath;
395
+ if (abs.endsWith(`/${rel}`)) {
396
+ return abs.slice(0, -(rel.length + 1));
397
+ }
398
+ throw new Error(`${defaults_default.packageName}: tmp path ${tmpFilePath} does not match configs.global.paths (${rel})`);
399
+ }
400
+ function resolveTmpAbsPath(projectRoot, configs) {
401
+ const merged = resolveMergedPaths(configs);
402
+ return `${projectRoot.replace(/\\/g, "/").replace(/\/$/, "")}/${merged.tmpRelPath}`;
403
+ }
350
404
  export {
351
405
  resolveTmpRuntimeConfigs,
352
- resolveServiceLayoutPaths,
406
+ resolveTmpDeploymentName,
407
+ resolveTmpAbsPath,
408
+ resolveProjectRootFromTmpPath,
409
+ resolveMergedPaths,
353
410
  resolveEffectiveBundler,
354
- readTmpServiceBlock,
411
+ readTmpGlobalPathsBlock,
355
412
  readTmpGlobalBlock,
356
- readTmpCoreBlock,
413
+ readTmpDependsBlock,
414
+ readTmpBuildBlock,
357
415
  normalizeTmpDocument,
358
416
  normalizeSourceFolder2 as normalizeSourceFolder,
359
417
  normalizeRuntime,
360
418
  normalizeRootFolder2 as normalizeRootFolder,
419
+ normalizeGlobalType,
361
420
  normalizeBundler,
362
421
  buildTmpVarContext,
422
+ assertNoLegacyTmpKeys,
363
423
  applyTmpGlobalVars
364
424
  };