@xrystal/core 3.51.5 → 3.52.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/README.md +35 -1
- package/package.json +1 -1
- package/x/bin/commands/create.mjs +44 -0
- package/x/bin/commands/projects.mjs +53 -0
- package/x/bin/commands/sync.mjs +49 -1
- package/x/bin/commands/tmp.mjs +1 -1
- package/x/bin/helpers/.generated/.generated-from +2 -0
- package/x/bin/helpers/.generated/seed-from-tmp.mjs +25 -31
- package/x/bin/helpers/.generated/tmp-schema.mjs +156 -96
- package/x/bin/helpers/.generated/workspace.mjs +402 -0
- package/x/bin/helpers/.generated/xrystal-home-registry.mjs +310 -0
- package/x/bin/helpers/build-config.mjs +3 -2
- package/x/bin/helpers/cli-help.mjs +3 -1
- package/x/bin/helpers/project-artifacts.mjs +9 -0
- package/x/bin/helpers/tmp-config.mjs +13 -12
- package/x/bin/helpers/tmp-layout.mjs +28 -52
- package/x/bin/helpers/tmp-schema.mjs +9 -3
- package/x/bin/helpers/workspace-resolve.mjs +11 -0
- package/x/bin/helpers/workspace-scaffold.mjs +23 -0
- package/x/bin/helpers/xrystal-registry.mjs +13 -0
- package/x/bin/main-cli.js +2 -0
- package/x/dist/index.js +5 -1
- package/x/dist/loader/clients/index.js +22 -1
- package/x/dist/loader/configs/index.js +97 -1
- package/x/dist/loader/controller/index.js +267 -1
- package/x/dist/loader/dto/index.js +92 -1
- package/x/dist/loader/events/index.js +39 -1
- package/x/dist/loader/index.js +13 -1
- package/x/dist/loader/kafka/index.js +142 -1
- package/x/dist/loader/kafka/resolve-ssl.js +23 -1
- package/x/dist/loader/localizations/index.js +46 -1
- package/x/dist/loader/logger/index.js +229 -2
- package/x/dist/loader/mongo/index.js +52 -1
- package/x/dist/loader/mongo/resolve-connect.js +16 -1
- package/x/dist/loader/redis/index.js +57 -1
- package/x/dist/loader/redis/resolve-socket.js +31 -1
- package/x/dist/loader/registry/index.js +1 -1
- package/x/dist/loader/service/index.js +7 -1
- package/x/dist/loader/system/index.js +26 -1
- package/x/dist/project/index.js +51 -1
- package/x/dist/utils/constants/defaults.json +3 -1
- package/x/dist/utils/constants/index.d.ts +1 -0
- package/x/dist/utils/constants/index.js +42 -1
- package/x/dist/utils/constants/package-root.js +6 -1
- package/x/dist/utils/helpers/configs/index.js +1 -1
- package/x/dist/utils/helpers/context/controller-store.js +12 -1
- package/x/dist/utils/helpers/context/index.js +24 -1
- package/x/dist/utils/helpers/core/handlebars-resolve.js +15 -1
- package/x/dist/utils/helpers/core/index.js +46 -1
- package/x/dist/utils/helpers/core/paths.js +78 -1
- package/x/dist/utils/helpers/core/tmp-layout.d.ts +4 -4
- package/x/dist/utils/helpers/core/tmp-layout.js +229 -1
- package/x/dist/utils/helpers/date/index.js +48 -1
- package/x/dist/utils/helpers/dispatch/index.js +53 -1
- package/x/dist/utils/helpers/dto/index.js +10 -1
- package/x/dist/utils/helpers/filters/index.js +44 -1
- package/x/dist/utils/helpers/framework/index.js +18 -1
- package/x/dist/utils/helpers/handlers/adapters.js +41 -1
- package/x/dist/utils/helpers/handlers/execute.js +82 -1
- package/x/dist/utils/helpers/handlers/index.js +31 -1
- package/x/dist/utils/helpers/hash/crypto.js +22 -1
- package/x/dist/utils/helpers/id/index.js +24 -1
- package/x/dist/utils/helpers/index.d.ts +1 -0
- package/x/dist/utils/helpers/index.js +28 -1
- package/x/dist/utils/helpers/ip/index.js +21 -1
- package/x/dist/utils/helpers/is/index.js +35 -1
- package/x/dist/utils/helpers/kafka-loader-options/index.js +14 -1
- package/x/dist/utils/helpers/locales/index.js +82 -1
- package/x/dist/utils/helpers/logger-layer/index.js +33 -1
- package/x/dist/utils/helpers/math/index.js +14 -1
- package/x/dist/utils/helpers/middleware/index.js +36 -1
- package/x/dist/utils/helpers/node-env/index.js +20 -1
- package/x/dist/utils/helpers/objects/index.js +55 -1
- package/x/dist/utils/helpers/path/index.js +5 -1
- package/x/dist/utils/helpers/path/resolve-alias-path.d.ts +1 -1
- package/x/dist/utils/helpers/path/resolve-alias-path.js +62 -1
- package/x/dist/utils/helpers/protocol/index.d.ts +1 -1
- package/x/dist/utils/helpers/protocol/index.js +100 -1
- package/x/dist/utils/helpers/protocol/options.js +13 -1
- package/x/dist/utils/helpers/regex/checkSpecialRegexControl.js +3 -1
- package/x/dist/utils/helpers/registry/index.d.ts +6 -0
- package/x/dist/utils/helpers/registry/index.js +103 -1
- package/x/dist/utils/helpers/runtime/dto-access.js +5 -1
- package/x/dist/utils/helpers/runtime/dto-types.js +1 -1
- package/x/dist/utils/helpers/runtime/index.js +2 -1
- package/x/dist/utils/helpers/runtime/shutdown.js +36 -1
- package/x/dist/utils/helpers/state/index.js +185 -1
- package/x/dist/utils/helpers/state/props-from-tmp.js +46 -1
- package/x/dist/utils/helpers/state/request-key-guard.js +43 -1
- package/x/dist/utils/helpers/state/scopes.js +69 -1
- package/x/dist/utils/helpers/string/index.js +9 -1
- package/x/dist/utils/helpers/timer/index.js +5 -1
- package/x/dist/utils/helpers/tmp/index.d.ts +2 -2
- package/x/dist/utils/helpers/tmp/index.js +8 -1
- package/x/dist/utils/helpers/tmp/loader-tmp-sync.js +14 -1
- package/x/dist/utils/helpers/tmp/path-normalize.js +27 -1
- package/x/dist/utils/helpers/tmp/runtime-tmp.js +42 -1
- package/x/dist/utils/helpers/tmp/seed-from-tmp.d.ts +2 -2
- package/x/dist/utils/helpers/tmp/seed-from-tmp.js +62 -1
- package/x/dist/utils/helpers/tmp/tmp-interpolate.js +22 -1
- package/x/dist/utils/helpers/tmp/tmp-loader.js +56 -1
- package/x/dist/utils/helpers/tmp/tmp-schema.d.ts +35 -23
- package/x/dist/utils/helpers/tmp/tmp-schema.js +211 -1
- package/x/dist/utils/helpers/tmp/tmp-watch.js +23 -1
- package/x/dist/utils/helpers/tmp/toolchain-heal.js +157 -2
- package/x/dist/utils/helpers/validates/index.js +20 -1
- package/x/dist/utils/helpers/workspace/index.d.ts +42 -0
- package/x/dist/utils/helpers/workspace/index.js +222 -0
- package/x/dist/utils/helpers/xrystal-home/registry.d.ts +32 -0
- package/x/dist/utils/helpers/xrystal-home/registry.js +92 -0
- package/x/dist/utils/index.js +3 -1
- package/x/dist/utils/models/classes/class.clients.js +142 -1
- package/x/dist/utils/models/classes/class.interfaces.js +10 -1
- package/x/dist/utils/models/classes/class.service-locator.js +16 -1
- package/x/dist/utils/models/classes/class.tmp-file-loader.js +61 -1
- package/x/dist/utils/models/classes/class.x.js +181 -1
- package/x/dist/utils/models/enums/index.d.ts +9 -1
- package/x/dist/utils/models/enums/index.js +169 -1
- package/x/dist/utils/models/index.js +9 -1
- package/x/dist/utils/models/types/index.js +2 -1
- 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:
|
|
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
|
|
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
|
|
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.
|
|
128
|
-
environments: requireString(block.environments, "configs.
|
|
129
|
-
dist: requireString(block.dist, "configs.
|
|
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
|
|
133
|
-
|
|
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 =
|
|
143
|
+
let dir = start;
|
|
149
144
|
for (;; ) {
|
|
150
|
-
const candidate = path.join(dir,
|
|
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}:
|
|
154
|
+
throw new Error(`${defaults_default.packageName}: api-service template not found (${templateRel})`);
|
|
160
155
|
}
|
|
161
156
|
function loadSeedFromBundledTmp(tmpFilePath) {
|
|
162
|
-
const file =
|
|
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
|
|
166
|
-
const paths =
|
|
167
|
-
const
|
|
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:
|
|
168
|
+
rootFolder: rootNorm,
|
|
170
169
|
sourceFolder: normalizeSourceFolder(sourceRaw, sourceRaw),
|
|
171
|
-
framework: requireString(
|
|
172
|
-
layout: readLayoutFromSpecial(
|
|
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
|
|
261
|
+
function readTmpGlobalPathsBlock(configs) {
|
|
247
262
|
const global = isRecord2(configs?.global) ? configs.global : {};
|
|
248
|
-
const
|
|
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
|
-
|
|
251
|
-
|
|
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
|
|
255
|
-
const
|
|
256
|
-
const
|
|
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
|
-
|
|
259
|
-
|
|
260
|
-
|
|
287
|
+
root,
|
|
288
|
+
source,
|
|
289
|
+
special,
|
|
290
|
+
tmpRelPath: `${root}/${tmpName}`.replace(/\/+/g, "/")
|
|
261
291
|
};
|
|
262
292
|
}
|
|
263
|
-
function
|
|
264
|
-
const
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
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
|
|
294
|
-
|
|
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
|
|
297
|
-
|
|
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
|
-
|
|
300
|
-
|
|
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
|
|
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
|
-
|
|
314
|
-
|
|
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
|
|
334
|
-
const
|
|
335
|
-
const normalizedService = buildNormalizedService(service);
|
|
371
|
+
const depends = readTmpDependsBlock(configs);
|
|
372
|
+
const merged = resolveMergedPaths(configs);
|
|
336
373
|
return {
|
|
337
|
-
global
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
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
|
-
|
|
406
|
+
resolveTmpDeploymentName,
|
|
407
|
+
resolveTmpAbsPath,
|
|
408
|
+
resolveProjectRootFromTmpPath,
|
|
409
|
+
resolveMergedPaths,
|
|
353
410
|
resolveEffectiveBundler,
|
|
354
|
-
|
|
411
|
+
readTmpGlobalPathsBlock,
|
|
355
412
|
readTmpGlobalBlock,
|
|
356
|
-
|
|
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
|
};
|