@jskit-ai/jskit-cli 0.2.77 → 0.2.79
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/jskit-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.79",
|
|
4
4
|
"description": "Bundle and package orchestration CLI for JSKIT apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"test": "node --test"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@jskit-ai/jskit-catalog": "0.1.
|
|
24
|
-
"@jskit-ai/kernel": "0.1.
|
|
25
|
-
"@jskit-ai/shell-web": "0.1.
|
|
23
|
+
"@jskit-ai/jskit-catalog": "0.1.78",
|
|
24
|
+
"@jskit-ai/kernel": "0.1.70",
|
|
25
|
+
"@jskit-ai/shell-web": "0.1.69"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
|
-
"node": "20
|
|
28
|
+
"node": ">=20 <23"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
@@ -52,6 +52,21 @@ function normalizeFileMutationRecord(value) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
function normalizeDependencyMutationRecord(value) {
|
|
56
|
+
const record = ensureObject(value);
|
|
57
|
+
if (Object.keys(record).length < 1) {
|
|
58
|
+
return {
|
|
59
|
+
version: String(value || ""),
|
|
60
|
+
when: null
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
version: String(record.version || record.value || "").trim(),
|
|
66
|
+
when: normalizeMutationWhen(record.when)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
55
70
|
function normalizeMutationWhen(value) {
|
|
56
71
|
const source = ensureObject(value);
|
|
57
72
|
const allConditions = ensureArray(source.all)
|
|
@@ -304,6 +319,7 @@ function shouldApplyMutationWhen(
|
|
|
304
319
|
export {
|
|
305
320
|
normalizeMutationExtension,
|
|
306
321
|
normalizeTemplateContextRecord,
|
|
322
|
+
normalizeDependencyMutationRecord,
|
|
307
323
|
normalizeFileMutationRecord,
|
|
308
324
|
normalizeMutationWhen,
|
|
309
325
|
readObjectPath,
|
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
interpolateOptionValue
|
|
9
9
|
} from "../shared/optionInterpolation.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
11
|
+
normalizeDependencyMutationRecord,
|
|
12
|
+
normalizeFileMutationRecord,
|
|
13
|
+
shouldApplyMutationWhen
|
|
12
14
|
} from "./mutationWhen.js";
|
|
13
15
|
import {
|
|
14
16
|
applyViteMutations,
|
|
@@ -141,6 +143,13 @@ function resolveManagedSourceRecord(packageEntry, existingInstall = {}) {
|
|
|
141
143
|
return sourceRecord;
|
|
142
144
|
}
|
|
143
145
|
|
|
146
|
+
function dependencyMutationUsesWhen(entries = []) {
|
|
147
|
+
return entries.some(([, rawDependencySpec]) => {
|
|
148
|
+
const dependencySpec = normalizeDependencyMutationRecord(rawDependencySpec);
|
|
149
|
+
return Boolean(dependencySpec.when);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
144
153
|
async function applyPackagePositioning({
|
|
145
154
|
packageEntry,
|
|
146
155
|
packageOptions,
|
|
@@ -413,9 +422,28 @@ async function applyPackageInstall({
|
|
|
413
422
|
const mutationDependencies = ensureObject(mutations.dependencies);
|
|
414
423
|
const runtimeDependencies = ensureObject(mutationDependencies.runtime);
|
|
415
424
|
const devDependencies = ensureObject(mutationDependencies.dev);
|
|
425
|
+
const runtimeDependencyEntries = Object.entries(runtimeDependencies);
|
|
426
|
+
const devDependencyEntries = Object.entries(devDependencies);
|
|
427
|
+
const needsDependencyWhenConfig = dependencyMutationUsesWhen([
|
|
428
|
+
...runtimeDependencyEntries,
|
|
429
|
+
...devDependencyEntries
|
|
430
|
+
]);
|
|
431
|
+
const dependencyWhenConfigContext = needsDependencyWhenConfig
|
|
432
|
+
? await loadMutationWhenConfigContext(appRoot)
|
|
433
|
+
: {};
|
|
416
434
|
const mutationScripts = ensureObject(ensureObject(mutations.packageJson).scripts);
|
|
417
435
|
|
|
418
|
-
for (const [rawDependencyId,
|
|
436
|
+
for (const [rawDependencyId, rawDependencySpec] of runtimeDependencyEntries) {
|
|
437
|
+
const dependencySpec = normalizeDependencyMutationRecord(rawDependencySpec);
|
|
438
|
+
if (!shouldApplyMutationWhen(dependencySpec.when, {
|
|
439
|
+
options: packageOptions,
|
|
440
|
+
configContext: dependencyWhenConfigContext,
|
|
441
|
+
packageId: packageEntry.packageId,
|
|
442
|
+
mutationContext: `dependencies.runtime.${rawDependencyId}`
|
|
443
|
+
})) {
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
|
|
419
447
|
const dependencyId = interpolateOptionValue(
|
|
420
448
|
rawDependencyId,
|
|
421
449
|
packageOptions,
|
|
@@ -423,7 +451,7 @@ async function applyPackageInstall({
|
|
|
423
451
|
`dependencies.runtime.${rawDependencyId}.id`
|
|
424
452
|
);
|
|
425
453
|
const dependencyVersion = interpolateOptionValue(
|
|
426
|
-
|
|
454
|
+
dependencySpec.version,
|
|
427
455
|
packageOptions,
|
|
428
456
|
packageEntry.packageId,
|
|
429
457
|
`dependencies.runtime.${rawDependencyId}.value`
|
|
@@ -447,7 +475,17 @@ async function applyPackageInstall({
|
|
|
447
475
|
}
|
|
448
476
|
}
|
|
449
477
|
|
|
450
|
-
for (const [rawDependencyId,
|
|
478
|
+
for (const [rawDependencyId, rawDependencySpec] of devDependencyEntries) {
|
|
479
|
+
const dependencySpec = normalizeDependencyMutationRecord(rawDependencySpec);
|
|
480
|
+
if (!shouldApplyMutationWhen(dependencySpec.when, {
|
|
481
|
+
options: packageOptions,
|
|
482
|
+
configContext: dependencyWhenConfigContext,
|
|
483
|
+
packageId: packageEntry.packageId,
|
|
484
|
+
mutationContext: `dependencies.dev.${rawDependencyId}`
|
|
485
|
+
})) {
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
|
|
451
489
|
const dependencyId = interpolateOptionValue(
|
|
452
490
|
rawDependencyId,
|
|
453
491
|
packageOptions,
|
|
@@ -455,7 +493,7 @@ async function applyPackageInstall({
|
|
|
455
493
|
`dependencies.dev.${rawDependencyId}.id`
|
|
456
494
|
);
|
|
457
495
|
const dependencyVersion = interpolateOptionValue(
|
|
458
|
-
|
|
496
|
+
dependencySpec.version,
|
|
459
497
|
packageOptions,
|
|
460
498
|
packageEntry.packageId,
|
|
461
499
|
`dependencies.dev.${rawDependencyId}.value`
|
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
ensureArray,
|
|
3
3
|
ensureObject
|
|
4
4
|
} from "../../shared/collectionUtils.js";
|
|
5
|
+
import {
|
|
6
|
+
normalizeDependencyMutationRecord
|
|
7
|
+
} from "../../cliRuntime/mutationWhen.js";
|
|
5
8
|
import { createShowRenderHelpers } from "./renderHelpers.js";
|
|
6
9
|
import { writePackageExportsSection } from "./renderPackageExports.js";
|
|
7
10
|
import { writeCapabilitiesSections } from "./renderPackageCapabilities.js";
|
|
@@ -35,6 +38,12 @@ function resolveOwnershipGuidance(payload = {}) {
|
|
|
35
38
|
return ensureObject(ensureObject(ensureObject(payload.metadata).jskit).ownershipGuidance);
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
function renderDependencyMutationSpec(versionSpec) {
|
|
42
|
+
const dependencySpec = normalizeDependencyMutationRecord(versionSpec);
|
|
43
|
+
const whenSuffix = dependencySpec.when ? ` when ${JSON.stringify(dependencySpec.when)}` : "";
|
|
44
|
+
return `${dependencySpec.version}${whenSuffix}`.trim();
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
function renderPackagePayloadText({
|
|
39
48
|
payload,
|
|
40
49
|
provides,
|
|
@@ -255,7 +264,7 @@ function renderPackagePayloadText({
|
|
|
255
264
|
wrapWidth,
|
|
256
265
|
items: runtimeMutationEntries.map(([dependencyId, versionSpec]) => {
|
|
257
266
|
const dependencyText = String(dependencyId);
|
|
258
|
-
const versionText =
|
|
267
|
+
const versionText = renderDependencyMutationSpec(versionSpec);
|
|
259
268
|
return {
|
|
260
269
|
text: `${dependencyText} ${versionText}`,
|
|
261
270
|
rendered: `${color.item(dependencyText)} ${color.installed(versionText)}`
|
|
@@ -325,7 +334,7 @@ function renderPackagePayloadText({
|
|
|
325
334
|
wrapWidth,
|
|
326
335
|
items: devMutationEntries.map(([dependencyId, versionSpec]) => {
|
|
327
336
|
const dependencyText = String(dependencyId);
|
|
328
|
-
const versionText =
|
|
337
|
+
const versionText = renderDependencyMutationSpec(versionSpec);
|
|
329
338
|
return {
|
|
330
339
|
text: `${dependencyText} ${versionText}`,
|
|
331
340
|
rendered: `${color.item(dependencyText)} ${color.installed(versionText)}`
|