@jskit-ai/jskit-cli 0.2.43 → 0.2.45
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.45",
|
|
4
4
|
"description": "Bundle and package orchestration CLI for JSKIT apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -20,9 +20,9 @@
|
|
|
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.44",
|
|
24
|
+
"@jskit-ai/kernel": "0.1.36",
|
|
25
|
+
"@jskit-ai/shell-web": "0.1.35"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
28
|
"node": "20.x"
|
|
@@ -48,6 +48,10 @@ const SETTINGS_FIELDS_CONTRACT_TARGETS = Object.freeze({
|
|
|
48
48
|
])
|
|
49
49
|
})
|
|
50
50
|
});
|
|
51
|
+
const PRE_FILE_CONFIG_MUTATION_TARGETS = new Set([
|
|
52
|
+
"config/public.js",
|
|
53
|
+
"config/server.js"
|
|
54
|
+
]);
|
|
51
55
|
|
|
52
56
|
function resolveSettingsFieldsContractTarget(relativeFile = "") {
|
|
53
57
|
const normalizedRelativeFile = normalizeMutationRelativeFilePath(relativeFile);
|
|
@@ -236,6 +240,33 @@ function isPositioningTextMutation(value = {}) {
|
|
|
236
240
|
return normalizeMutationRelativeFilePath(mutation.file) === "src/placement.js";
|
|
237
241
|
}
|
|
238
242
|
|
|
243
|
+
function isPreFileConfigTextMutation(value = {}) {
|
|
244
|
+
const mutation = ensureObject(value);
|
|
245
|
+
const operation = String(mutation.op || "").trim();
|
|
246
|
+
if (operation !== "append-text") {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
return PRE_FILE_CONFIG_MUTATION_TARGETS.has(normalizeMutationRelativeFilePath(mutation.file));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function partitionPreFileConfigTextMutations(textMutations = []) {
|
|
253
|
+
const preFileTextMutations = [];
|
|
254
|
+
const postFileTextMutations = [];
|
|
255
|
+
|
|
256
|
+
for (const mutation of ensureArray(textMutations)) {
|
|
257
|
+
if (isPreFileConfigTextMutation(mutation)) {
|
|
258
|
+
preFileTextMutations.push(mutation);
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
postFileTextMutations.push(mutation);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return {
|
|
265
|
+
preFileTextMutations,
|
|
266
|
+
postFileTextMutations
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
239
270
|
function resolvePositioningMutations(descriptorMutations = {}) {
|
|
240
271
|
const mutations = ensureObject(descriptorMutations);
|
|
241
272
|
const files = ensureArray(mutations.files).filter((mutationValue) => {
|
|
@@ -251,5 +282,6 @@ function resolvePositioningMutations(descriptorMutations = {}) {
|
|
|
251
282
|
|
|
252
283
|
export {
|
|
253
284
|
applyTextMutations,
|
|
285
|
+
partitionPreFileConfigTextMutations,
|
|
254
286
|
resolvePositioningMutations
|
|
255
287
|
};
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
applyFileMutations,
|
|
34
34
|
applyTextMutations,
|
|
35
|
+
partitionPreFileConfigTextMutations,
|
|
35
36
|
prepareFileMutations,
|
|
36
37
|
resolvePositioningMutations
|
|
37
38
|
} from "./mutationApplication.js";
|
|
@@ -299,6 +300,19 @@ async function applyPackageInstall({
|
|
|
299
300
|
const mutationWarnings = [];
|
|
300
301
|
const mutations = ensureObject(packageEntry.descriptor.mutations);
|
|
301
302
|
const fileMutations = ensureArray(mutations.files);
|
|
303
|
+
const textMutations = ensureArray(mutations.text);
|
|
304
|
+
const hasSurfaceTargetedFileMutations = fileMutations.some((mutationValue) =>
|
|
305
|
+
Boolean(normalizeFileMutationRecord(mutationValue).toSurface)
|
|
306
|
+
);
|
|
307
|
+
const {
|
|
308
|
+
preFileTextMutations,
|
|
309
|
+
postFileTextMutations
|
|
310
|
+
} = hasSurfaceTargetedFileMutations
|
|
311
|
+
? partitionPreFileConfigTextMutations(textMutations)
|
|
312
|
+
: {
|
|
313
|
+
preFileTextMutations: [],
|
|
314
|
+
postFileTextMutations: textMutations
|
|
315
|
+
};
|
|
302
316
|
const templateRoot = await resolvePackageTemplateRoot({
|
|
303
317
|
packageEntry,
|
|
304
318
|
appRoot,
|
|
@@ -311,6 +325,19 @@ async function applyPackageInstall({
|
|
|
311
325
|
...packageEntry,
|
|
312
326
|
rootDir: templateRoot
|
|
313
327
|
};
|
|
328
|
+
const managedRecord = createManagedRecordBase(packageEntry, packageOptions);
|
|
329
|
+
managedRecord.managed.migrations = cloneManagedArray(existingManaged.migrations);
|
|
330
|
+
|
|
331
|
+
if (preFileTextMutations.length > 0) {
|
|
332
|
+
await applyTextMutations(
|
|
333
|
+
packageEntryForMutations,
|
|
334
|
+
appRoot,
|
|
335
|
+
preFileTextMutations,
|
|
336
|
+
packageOptions,
|
|
337
|
+
managedRecord.managed.text,
|
|
338
|
+
touchedFiles
|
|
339
|
+
);
|
|
340
|
+
}
|
|
314
341
|
|
|
315
342
|
const preparedFileMutations = await prepareFileMutations(
|
|
316
343
|
packageEntryForMutations,
|
|
@@ -326,9 +353,6 @@ async function applyPackageInstall({
|
|
|
326
353
|
touchedFiles
|
|
327
354
|
});
|
|
328
355
|
|
|
329
|
-
const managedRecord = createManagedRecordBase(packageEntry, packageOptions);
|
|
330
|
-
managedRecord.managed.migrations = cloneManagedArray(existingManaged.migrations);
|
|
331
|
-
|
|
332
356
|
const mutationDependencies = ensureObject(mutations.dependencies);
|
|
333
357
|
const runtimeDependencies = ensureObject(mutationDependencies.runtime);
|
|
334
358
|
const devDependencies = ensureObject(mutationDependencies.dev);
|
|
@@ -444,7 +468,7 @@ async function applyPackageInstall({
|
|
|
444
468
|
await applyTextMutations(
|
|
445
469
|
packageEntryForMutations,
|
|
446
470
|
appRoot,
|
|
447
|
-
|
|
471
|
+
postFileTextMutations,
|
|
448
472
|
packageOptions,
|
|
449
473
|
managedRecord.managed.text,
|
|
450
474
|
touchedFiles
|