@powerlines/nx 0.10.47 → 0.10.48
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/CHANGELOG.md +6 -0
- package/dist/{chunk-JLOTTRGF.mjs → chunk-22IQ22WZ.mjs} +416 -135
- package/dist/{chunk-KAGXZMPG.mjs → chunk-2Z55S53G.mjs} +1 -1
- package/dist/{chunk-WOB6ZDJH.mjs → chunk-3K4DAFFO.mjs} +1 -1
- package/dist/{chunk-23GFPMA6.js → chunk-AWWEVPW6.js} +2 -2
- package/dist/{chunk-ZUHOITET.js → chunk-CSSCW7NJ.js} +2 -2
- package/dist/{chunk-UC4XWZN3.js → chunk-D5NQ7RJL.js} +2 -2
- package/dist/{chunk-SW7WPPQ5.mjs → chunk-IZGOLA5N.mjs} +1 -1
- package/dist/{chunk-2ZHIKYNK.js → chunk-J2P7ZMNQ.js} +2 -2
- package/dist/{chunk-3IX4CIEZ.js → chunk-JLTPLOQU.js} +2 -2
- package/dist/{chunk-RVCS4GUB.mjs → chunk-Q3ETCCV3.mjs} +1 -1
- package/dist/{chunk-BRGJUSQE.mjs → chunk-XRZRSXSO.mjs} +1 -1
- package/dist/{chunk-SMUQRWNQ.js → chunk-YYQPZELV.js} +412 -131
- package/dist/executors.js +11 -11
- package/dist/executors.mjs +6 -6
- package/dist/index.js +11 -11
- package/dist/index.mjs +6 -6
- package/dist/src/base/base-executor.js +2 -2
- package/dist/src/base/base-executor.mjs +1 -1
- package/dist/src/executors/build/executor.js +4 -4
- package/dist/src/executors/build/executor.mjs +2 -2
- package/dist/src/executors/clean/executor.js +4 -4
- package/dist/src/executors/clean/executor.mjs +2 -2
- package/dist/src/executors/docs/executor.js +4 -4
- package/dist/src/executors/docs/executor.mjs +2 -2
- package/dist/src/executors/lint/executor.js +4 -4
- package/dist/src/executors/lint/executor.mjs +2 -2
- package/dist/src/executors/prepare/executor.js +4 -4
- package/dist/src/executors/prepare/executor.mjs +2 -2
- package/package.json +8 -8
|
@@ -3,13 +3,12 @@ import { __name } from './chunk-O6YSETKJ.mjs';
|
|
|
3
3
|
import { getLogFn, getLogLevel, writeError } from '@storm-software/config-tools/logger';
|
|
4
4
|
import { withRunExecutor } from '@storm-software/workspace-tools/base/base-executor';
|
|
5
5
|
import { isError } from '@stryke/type-checks/is-error';
|
|
6
|
-
import defu6, { defu } from 'defu';
|
|
6
|
+
import defu6, { createDefu, defu } from 'defu';
|
|
7
7
|
import { transformAsync } from '@babel/core';
|
|
8
8
|
import { formatLogMessage } from '@storm-software/config-tools/logger/console';
|
|
9
9
|
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
10
10
|
import { toArray } from '@stryke/convert/to-array';
|
|
11
|
-
import {
|
|
12
|
-
import { createDirectory } from '@stryke/fs/helpers';
|
|
11
|
+
import { createDirectorySync, createDirectory } from '@stryke/fs/helpers';
|
|
13
12
|
import { install } from '@stryke/fs/install';
|
|
14
13
|
import { listFilesSync, listFiles } from '@stryke/fs/list-files';
|
|
15
14
|
import { isPackageExists, isPackageListed, doesPackageMatch, getPackageListing } from '@stryke/fs/package-fns';
|
|
@@ -29,8 +28,8 @@ import Handlebars from 'handlebars';
|
|
|
29
28
|
import { declare } from '@babel/helper-plugin-utils';
|
|
30
29
|
import * as t from '@babel/types';
|
|
31
30
|
import ts, { flattenDiagnosticMessageText } from 'typescript';
|
|
32
|
-
import { joinPaths } from '@stryke/path/join';
|
|
33
31
|
import { InMemoryFileSystemHost, Project } from 'ts-morph';
|
|
32
|
+
import { isString } from '@stryke/type-checks/is-string';
|
|
34
33
|
import { getPackageName, hasPackageVersion, getPackageVersion } from '@stryke/string-format/package';
|
|
35
34
|
import { getObjectDiff } from '@donedeal0/superdiff';
|
|
36
35
|
import { readJsonFile, readJsonFileSync } from '@stryke/fs/json';
|
|
@@ -46,22 +45,23 @@ import { getUnique, getUniqueBy } from '@stryke/helpers/get-unique';
|
|
|
46
45
|
import { omit } from '@stryke/helpers/omit';
|
|
47
46
|
import { fetchRequest } from '@stryke/http/fetch';
|
|
48
47
|
import { isAbsolutePath, isAbsolute } from '@stryke/path/is-type';
|
|
48
|
+
import { joinPaths } from '@stryke/path/join';
|
|
49
49
|
import { isNull } from '@stryke/type-checks/is-null';
|
|
50
|
-
import { isString } from '@stryke/type-checks/is-string';
|
|
51
50
|
import { uuid } from '@stryke/unique-id/uuid';
|
|
52
51
|
import { tsconfigPathsToRegExp, match } from 'bundle-require';
|
|
53
52
|
import { create } from 'flat-cache';
|
|
54
53
|
import { parse } from 'oxc-parser';
|
|
55
|
-
import { Response } from 'undici';
|
|
54
|
+
import { Agent, setGlobalDispatcher, interceptors, Response } from 'undici';
|
|
56
55
|
import { createJiti } from 'jiti';
|
|
57
56
|
import { isUndefined } from '@stryke/type-checks/is-undefined';
|
|
58
57
|
import { parseTypeDefinition } from '@stryke/convert/parse-type-definition';
|
|
59
|
-
import { isFile } from '@stryke/fs/is-file';
|
|
58
|
+
import { isDirectory, isFile } from '@stryke/fs/is-file';
|
|
60
59
|
import * as $ from '@stryke/capnp';
|
|
61
60
|
import { readFileBuffer, readFileBufferSync, writeFileBuffer } from '@stryke/fs/buffer';
|
|
62
61
|
import { isParentPath } from '@stryke/path/is-parent-path';
|
|
63
62
|
import { prettyBytes } from '@stryke/string-format/pretty-bytes';
|
|
64
63
|
import { Blob } from 'node:buffer';
|
|
64
|
+
import { fileURLToPath } from 'node:url';
|
|
65
65
|
import { resolveConfig, format } from 'prettier';
|
|
66
66
|
import { getColor } from '@storm-software/config-tools/utilities/colors';
|
|
67
67
|
import { noop } from '@stryke/helpers/noop';
|
|
@@ -187,13 +187,16 @@ var VirtualFileSystemHost = class extends InMemoryFileSystemHost {
|
|
|
187
187
|
this.#context.fs.removeSync(path);
|
|
188
188
|
}
|
|
189
189
|
readDirSync(dirPath) {
|
|
190
|
+
if (!this.#context.fs.isDirectorySync(dirPath)) {
|
|
191
|
+
return [];
|
|
192
|
+
}
|
|
190
193
|
return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {
|
|
191
|
-
const fullPath = this.#context.fs.resolveSync(
|
|
194
|
+
const fullPath = this.#context.fs.resolveSync(entry);
|
|
192
195
|
if (fullPath) {
|
|
193
196
|
ret.push({
|
|
194
197
|
name: entry,
|
|
195
|
-
isDirectory: this.#context.fs.
|
|
196
|
-
isFile: this.#context.fs.
|
|
198
|
+
isDirectory: this.#context.fs.isDirectorySync(fullPath),
|
|
199
|
+
isFile: this.#context.fs.isFileSync(fullPath),
|
|
197
200
|
isSymlink: false
|
|
198
201
|
});
|
|
199
202
|
}
|
|
@@ -201,14 +204,14 @@ var VirtualFileSystemHost = class extends InMemoryFileSystemHost {
|
|
|
201
204
|
}, []);
|
|
202
205
|
}
|
|
203
206
|
async readFile(filePath) {
|
|
204
|
-
if (!this.#context.fs.
|
|
205
|
-
|
|
207
|
+
if (!this.#context.fs.isFileSync(filePath)) {
|
|
208
|
+
return "";
|
|
206
209
|
}
|
|
207
210
|
return await this.#context.fs.read(filePath);
|
|
208
211
|
}
|
|
209
212
|
readFileSync(filePath) {
|
|
210
|
-
if (!this.#context.fs.
|
|
211
|
-
|
|
213
|
+
if (!this.#context.fs.isFileSync(filePath)) {
|
|
214
|
+
return "";
|
|
212
215
|
}
|
|
213
216
|
return this.#context.fs.readSync(filePath);
|
|
214
217
|
}
|
|
@@ -218,9 +221,11 @@ var VirtualFileSystemHost = class extends InMemoryFileSystemHost {
|
|
|
218
221
|
writeFileSync(filePath, fileText) {
|
|
219
222
|
this.#context.fs.writeSync(filePath, fileText);
|
|
220
223
|
}
|
|
221
|
-
async mkdir(
|
|
224
|
+
async mkdir(dirPath) {
|
|
225
|
+
await this.#context.fs.mkdir(dirPath);
|
|
222
226
|
}
|
|
223
|
-
mkdirSync(
|
|
227
|
+
mkdirSync(dirPath) {
|
|
228
|
+
this.#context.fs.mkdirSync(dirPath);
|
|
224
229
|
}
|
|
225
230
|
async move(srcPath, destPath) {
|
|
226
231
|
await this.#context.fs.move(srcPath, destPath);
|
|
@@ -235,16 +240,16 @@ var VirtualFileSystemHost = class extends InMemoryFileSystemHost {
|
|
|
235
240
|
this.#context.fs.copySync(srcPath, destPath);
|
|
236
241
|
}
|
|
237
242
|
async fileExists(filePath) {
|
|
238
|
-
return this.#context.fs.
|
|
243
|
+
return this.#context.fs.isFile(filePath);
|
|
239
244
|
}
|
|
240
245
|
fileExistsSync(filePath) {
|
|
241
|
-
return this.#context.fs.
|
|
246
|
+
return this.#context.fs.isFileSync(filePath);
|
|
242
247
|
}
|
|
243
248
|
async directoryExists(dirPath) {
|
|
244
|
-
return this.#context.fs.
|
|
249
|
+
return this.#context.fs.isDirectory(dirPath);
|
|
245
250
|
}
|
|
246
251
|
directoryExistsSync(dirPath) {
|
|
247
|
-
return this.#context.fs.
|
|
252
|
+
return this.#context.fs.isDirectorySync(dirPath);
|
|
248
253
|
}
|
|
249
254
|
realpathSync(path) {
|
|
250
255
|
return this.#context.fs.resolveSync(path) || path;
|
|
@@ -323,6 +328,14 @@ ${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : dia
|
|
|
323
328
|
return formatTypes(builtinModules);
|
|
324
329
|
}
|
|
325
330
|
__name(emitTypes, "emitTypes");
|
|
331
|
+
var mergeResults = createDefu((obj, key, value) => {
|
|
332
|
+
if (isString(obj[key]) && isString(value)) {
|
|
333
|
+
obj[key] = `${obj[key] || ""}
|
|
334
|
+
${value || ""}`.trim();
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
return false;
|
|
338
|
+
});
|
|
326
339
|
async function callHook(context, hook, options, ...args) {
|
|
327
340
|
const handlers = context.selectHooks(hook, options);
|
|
328
341
|
if (handlers.length > 0) {
|
|
@@ -330,22 +343,28 @@ async function callHook(context, hook, options, ...args) {
|
|
|
330
343
|
let results = [];
|
|
331
344
|
if (options?.sequential === false) {
|
|
332
345
|
results = await Promise.all(handlers.map(async (handler) => {
|
|
333
|
-
if (!isFunction(handler)) {
|
|
346
|
+
if (!isFunction(handler.handle)) {
|
|
334
347
|
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
335
348
|
}
|
|
336
|
-
return Promise.resolve(
|
|
337
|
-
|
|
338
|
-
|
|
349
|
+
return Promise.resolve(
|
|
350
|
+
// eslint-disable-next-line ts/no-unsafe-call
|
|
351
|
+
handler.handle.apply(handler.context, [
|
|
352
|
+
...args
|
|
353
|
+
])
|
|
354
|
+
);
|
|
339
355
|
}));
|
|
340
356
|
} else {
|
|
341
357
|
for (const handler of handlers) {
|
|
342
|
-
if (!isFunction(handler)) {
|
|
358
|
+
if (!isFunction(handler.handle)) {
|
|
343
359
|
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
344
360
|
}
|
|
345
361
|
if (options?.result === "first" || options?.asNextParam === false) {
|
|
346
|
-
results.push(await Promise.resolve(
|
|
347
|
-
|
|
348
|
-
|
|
362
|
+
results.push(await Promise.resolve(
|
|
363
|
+
// eslint-disable-next-line ts/no-unsafe-call
|
|
364
|
+
handler.handle.apply(handler.context, [
|
|
365
|
+
...args
|
|
366
|
+
])
|
|
367
|
+
));
|
|
349
368
|
if (options?.result === "first" && isSet(results[results.length - 1])) {
|
|
350
369
|
break;
|
|
351
370
|
}
|
|
@@ -357,8 +376,8 @@ async function callHook(context, hook, options, ...args) {
|
|
|
357
376
|
sequenceArgs[0] = isFunction(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
|
|
358
377
|
}
|
|
359
378
|
const result = await Promise.resolve(
|
|
360
|
-
// eslint-disable-next-line ts/no-unsafe-call
|
|
361
|
-
handler.apply(
|
|
379
|
+
// eslint-disable-next-line ts/no-unsafe-call
|
|
380
|
+
handler.handle.apply(handler.context, [
|
|
362
381
|
...sequenceArgs
|
|
363
382
|
])
|
|
364
383
|
);
|
|
@@ -367,9 +386,14 @@ async function callHook(context, hook, options, ...args) {
|
|
|
367
386
|
results = [
|
|
368
387
|
result
|
|
369
388
|
];
|
|
370
|
-
} else {
|
|
389
|
+
} else if (isString(result)) {
|
|
390
|
+
results = [
|
|
391
|
+
`${isString(results[0]) ? results[0] || "" : ""}
|
|
392
|
+
${result || ""}`.trim()
|
|
393
|
+
];
|
|
394
|
+
} else if (isObject(result)) {
|
|
371
395
|
results = [
|
|
372
|
-
|
|
396
|
+
mergeResults(result, results[0] ?? {})
|
|
373
397
|
];
|
|
374
398
|
}
|
|
375
399
|
}
|
|
@@ -1127,20 +1151,17 @@ function normalizePath(path, builtinsPath, prefix = "powerlines") {
|
|
|
1127
1151
|
return isAbsolutePath(path) ? path : isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
|
|
1128
1152
|
}
|
|
1129
1153
|
__name(normalizePath, "normalizePath");
|
|
1130
|
-
function
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
return key.startsWith(base) && key[key.length - 1] !== "$";
|
|
1140
|
-
}
|
|
1141
|
-
return key[key.length - 1] !== "$";
|
|
1154
|
+
function normalizeGlobPatterns(workspaceRoot, patterns) {
|
|
1155
|
+
return getUnique(toArray(patterns).map((pattern) => {
|
|
1156
|
+
if (isSetObject(pattern) && (isSetString(pattern.input) || isSetString(pattern.glob))) {
|
|
1157
|
+
return joinPaths(pattern.input || workspaceRoot, pattern.glob || "**/*");
|
|
1158
|
+
} else if (!isSetString(pattern)) {
|
|
1159
|
+
return void 0;
|
|
1160
|
+
}
|
|
1161
|
+
return pattern;
|
|
1162
|
+
}).filter(isSetString));
|
|
1142
1163
|
}
|
|
1143
|
-
__name(
|
|
1164
|
+
__name(normalizeGlobPatterns, "normalizeGlobPatterns");
|
|
1144
1165
|
var BaseStorageAdapter = class {
|
|
1145
1166
|
static {
|
|
1146
1167
|
__name(this, "BaseStorageAdapter");
|
|
@@ -1195,6 +1216,21 @@ var BaseStorageAdapter = class {
|
|
|
1195
1216
|
}
|
|
1196
1217
|
}
|
|
1197
1218
|
/**
|
|
1219
|
+
* Synchronously creates a directory at the specified path.
|
|
1220
|
+
*
|
|
1221
|
+
* @param _ - The path of the directory to create.
|
|
1222
|
+
*/
|
|
1223
|
+
mkdirSync(_) {
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Creates a directory at the specified path.
|
|
1227
|
+
*
|
|
1228
|
+
* @param dirPath - The path of the directory to create.
|
|
1229
|
+
*/
|
|
1230
|
+
async mkdir(dirPath) {
|
|
1231
|
+
return Promise.resolve(this.mkdirSync(dirPath));
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1198
1234
|
* Asynchronously removes a key from the storage.
|
|
1199
1235
|
*
|
|
1200
1236
|
* @param key - The key to remove.
|
|
@@ -1243,6 +1279,42 @@ var BaseStorageAdapter = class {
|
|
|
1243
1279
|
return this.listSync(base);
|
|
1244
1280
|
}
|
|
1245
1281
|
/**
|
|
1282
|
+
* Synchronously checks if the given key is a directory.
|
|
1283
|
+
*
|
|
1284
|
+
* @param _ - The key to check.
|
|
1285
|
+
* @returns `true` if the key is a directory, otherwise `false`.
|
|
1286
|
+
*/
|
|
1287
|
+
isDirectorySync(_) {
|
|
1288
|
+
return false;
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Checks if the given key is a directory.
|
|
1292
|
+
*
|
|
1293
|
+
* @param key - The key to check.
|
|
1294
|
+
* @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
|
|
1295
|
+
*/
|
|
1296
|
+
async isDirectory(key) {
|
|
1297
|
+
return Promise.resolve(this.isDirectorySync(key));
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* Synchronously checks if the given key is a file.
|
|
1301
|
+
*
|
|
1302
|
+
* @param key - The key to check.
|
|
1303
|
+
* @returns `true` if the key is a file, otherwise `false`.
|
|
1304
|
+
*/
|
|
1305
|
+
isFileSync(key) {
|
|
1306
|
+
return this.existsSync(key) && !this.isDirectorySync(key);
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Checks if the given key is a file.
|
|
1310
|
+
*
|
|
1311
|
+
* @param key - The key to check.
|
|
1312
|
+
* @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
|
|
1313
|
+
*/
|
|
1314
|
+
async isFile(key) {
|
|
1315
|
+
return Promise.resolve(this.isFileSync(key));
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1246
1318
|
* Disposes of the storage adapter, releasing any held resources.
|
|
1247
1319
|
*
|
|
1248
1320
|
* @returns A promise that resolves when the disposal is complete.
|
|
@@ -1383,6 +1455,22 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
1383
1455
|
}
|
|
1384
1456
|
}
|
|
1385
1457
|
/**
|
|
1458
|
+
* Synchronously creates a directory at the specified path.
|
|
1459
|
+
*
|
|
1460
|
+
* @param dirPath - The path of the directory to create.
|
|
1461
|
+
*/
|
|
1462
|
+
mkdirSync(dirPath) {
|
|
1463
|
+
createDirectorySync(this.resolve(dirPath));
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* Creates a directory at the specified path.
|
|
1467
|
+
*
|
|
1468
|
+
* @param dirPath - The path of the directory to create.
|
|
1469
|
+
*/
|
|
1470
|
+
async mkdir(dirPath) {
|
|
1471
|
+
await createDirectory(this.resolve(dirPath));
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1386
1474
|
* Lists all keys under a given base path synchronously.
|
|
1387
1475
|
*
|
|
1388
1476
|
* @param base - The base path to list keys from.
|
|
@@ -1408,6 +1496,24 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
1408
1496
|
ignore: this.options.ignore
|
|
1409
1497
|
}).catch(ignoreNotfound).then((r) => r || []);
|
|
1410
1498
|
}
|
|
1499
|
+
/**
|
|
1500
|
+
* Synchronously checks if the given key is a directory.
|
|
1501
|
+
*
|
|
1502
|
+
* @param key - The key to check.
|
|
1503
|
+
* @returns `true` if the key is a directory, otherwise `false`.
|
|
1504
|
+
*/
|
|
1505
|
+
isDirectorySync(key) {
|
|
1506
|
+
return isDirectory(this.resolve(key));
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Synchronously checks if the given key is a file.
|
|
1510
|
+
*
|
|
1511
|
+
* @param key - The key to check.
|
|
1512
|
+
* @returns `true` if the key is a file, otherwise `false`.
|
|
1513
|
+
*/
|
|
1514
|
+
isFileSync(key) {
|
|
1515
|
+
return !isFile(this.resolve(key));
|
|
1516
|
+
}
|
|
1411
1517
|
};
|
|
1412
1518
|
var VirtualStorageAdapter = class extends BaseStorageAdapter {
|
|
1413
1519
|
static {
|
|
@@ -1778,26 +1884,65 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1778
1884
|
return this.#getStorage(resolved)?.adapter?.name === "virtual";
|
|
1779
1885
|
}
|
|
1780
1886
|
/**
|
|
1887
|
+
* Checks if a path is a directory in the virtual file system (VFS).
|
|
1888
|
+
*
|
|
1889
|
+
* @param path - The path to check.
|
|
1890
|
+
* @returns `true` if the path is a directory, otherwise `false`.
|
|
1891
|
+
*/
|
|
1892
|
+
isDirectorySync(path) {
|
|
1893
|
+
const resolved = this.resolveSync(path);
|
|
1894
|
+
if (!resolved) {
|
|
1895
|
+
return false;
|
|
1896
|
+
}
|
|
1897
|
+
return !!(this.existsSync(resolved) && this.#getStorage(resolved)?.adapter?.isDirectorySync(resolved));
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Checks if a path is a directory in the virtual file system (VFS).
|
|
1901
|
+
*
|
|
1902
|
+
* @param path - The path to check.
|
|
1903
|
+
* @returns `true` if the path is a directory, otherwise `false`.
|
|
1904
|
+
*/
|
|
1905
|
+
async isDirectory(path) {
|
|
1906
|
+
const resolved = await this.resolve(path);
|
|
1907
|
+
if (!resolved) {
|
|
1908
|
+
return false;
|
|
1909
|
+
}
|
|
1910
|
+
return !!(await this.exists(resolved) && await this.#getStorage(resolved)?.adapter?.isDirectory(resolved));
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* Checks if a path is a file in the virtual file system (VFS).
|
|
1914
|
+
*
|
|
1915
|
+
* @param path - The path to check.
|
|
1916
|
+
* @returns `true` if the path is a file, otherwise `false`.
|
|
1917
|
+
*/
|
|
1918
|
+
isFileSync(path) {
|
|
1919
|
+
const resolved = this.resolveSync(path);
|
|
1920
|
+
if (!resolved) {
|
|
1921
|
+
return false;
|
|
1922
|
+
}
|
|
1923
|
+
return this.#getStorage(resolved)?.adapter?.isFileSync(resolved) ?? false;
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
* Checks if a path is a file in the virtual file system (VFS).
|
|
1927
|
+
*
|
|
1928
|
+
* @param path - The path to check.
|
|
1929
|
+
* @returns `true` if the path is a file, otherwise `false`.
|
|
1930
|
+
*/
|
|
1931
|
+
async isFile(path) {
|
|
1932
|
+
const resolved = await this.resolve(path);
|
|
1933
|
+
if (!resolved) {
|
|
1934
|
+
return false;
|
|
1935
|
+
}
|
|
1936
|
+
return await this.#getStorage(resolved)?.adapter?.isFile(resolved) ?? false;
|
|
1937
|
+
}
|
|
1938
|
+
/**
|
|
1781
1939
|
* Lists files in a given path.
|
|
1782
1940
|
*
|
|
1783
1941
|
* @param path - The path to list files from.
|
|
1784
1942
|
* @returns An array of file names in the specified path.
|
|
1785
1943
|
*/
|
|
1786
1944
|
listSync(path) {
|
|
1787
|
-
|
|
1788
|
-
const allKeys = [];
|
|
1789
|
-
for (const storage of this.#getStorages(path, true)) {
|
|
1790
|
-
for (const key of storage.adapter.listSync(storage.relativeBase)) {
|
|
1791
|
-
if (!maskedMounts.some((p) => `${storage.base}${normalizeKey(key)}`.startsWith(p))) {
|
|
1792
|
-
allKeys.push(`${storage.base}${normalizeKey(key)}`);
|
|
1793
|
-
}
|
|
1794
|
-
}
|
|
1795
|
-
maskedMounts = [
|
|
1796
|
-
storage.base,
|
|
1797
|
-
...maskedMounts.filter((p) => !p.startsWith(storage.base))
|
|
1798
|
-
];
|
|
1799
|
-
}
|
|
1800
|
-
return allKeys.filter((key) => filterKeyByBase(key, path));
|
|
1945
|
+
return getUnique(this.#getStorages(path, true).map((storage) => storage.adapter.listSync(storage.relativeBase ? storage.base ? appendPath(storage.relativeBase, storage.base) : storage.relativeBase : storage.base)).flat());
|
|
1801
1946
|
}
|
|
1802
1947
|
/**
|
|
1803
1948
|
* Lists files in a given path.
|
|
@@ -1806,20 +1951,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1806
1951
|
* @returns An array of file names in the specified path.
|
|
1807
1952
|
*/
|
|
1808
1953
|
async list(path) {
|
|
1809
|
-
|
|
1810
|
-
const allKeys = [];
|
|
1811
|
-
for (const storage of this.#getStorages(path, true)) {
|
|
1812
|
-
for (const key of await storage.adapter.list(storage.relativeBase)) {
|
|
1813
|
-
if (!maskedMounts.some((p) => `${storage.base}${normalizeKey(key)}`.startsWith(p))) {
|
|
1814
|
-
allKeys.push(`${storage.base}${normalizeKey(key)}`);
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
maskedMounts = [
|
|
1818
|
-
storage.base,
|
|
1819
|
-
...maskedMounts.filter((p) => !p.startsWith(storage.base))
|
|
1820
|
-
];
|
|
1821
|
-
}
|
|
1822
|
-
return allKeys.filter((key) => filterKeyByBase(key, path));
|
|
1954
|
+
return getUnique((await Promise.all(this.#getStorages(path, true).map(async (storage) => storage.adapter.list(storage.relativeBase ? storage.base ? appendPath(storage.relativeBase, storage.base) : storage.relativeBase : storage.base)))).flat());
|
|
1823
1955
|
}
|
|
1824
1956
|
/**
|
|
1825
1957
|
* Removes a file in the virtual file system (VFS).
|
|
@@ -1871,12 +2003,16 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1871
2003
|
*/
|
|
1872
2004
|
async glob(patterns) {
|
|
1873
2005
|
const results = [];
|
|
1874
|
-
for (const pattern of
|
|
2006
|
+
for (const pattern of normalizeGlobPatterns(this.#context.workspaceConfig.workspaceRoot, patterns)) {
|
|
1875
2007
|
const normalized = this.#normalizePath(pattern);
|
|
1876
2008
|
if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
2009
|
+
if (this.isDirectorySync(normalized)) {
|
|
2010
|
+
results.push(...await this.list(normalized));
|
|
2011
|
+
} else {
|
|
2012
|
+
const resolved = await this.resolve(normalized);
|
|
2013
|
+
if (resolved && !results.includes(resolved)) {
|
|
2014
|
+
results.push(resolved);
|
|
2015
|
+
}
|
|
1880
2016
|
}
|
|
1881
2017
|
continue;
|
|
1882
2018
|
}
|
|
@@ -1902,12 +2038,16 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1902
2038
|
*/
|
|
1903
2039
|
globSync(patterns) {
|
|
1904
2040
|
const results = [];
|
|
1905
|
-
for (const pattern of
|
|
2041
|
+
for (const pattern of normalizeGlobPatterns(this.#context.workspaceConfig.workspaceRoot, patterns)) {
|
|
1906
2042
|
const normalized = this.#normalizePath(pattern);
|
|
1907
2043
|
if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
2044
|
+
if (this.isDirectorySync(normalized)) {
|
|
2045
|
+
results.push(...this.listSync(normalized));
|
|
2046
|
+
} else {
|
|
2047
|
+
const resolved = this.resolveSync(normalized);
|
|
2048
|
+
if (resolved && !results.includes(resolved)) {
|
|
2049
|
+
results.push(resolved);
|
|
2050
|
+
}
|
|
1911
2051
|
}
|
|
1912
2052
|
continue;
|
|
1913
2053
|
}
|
|
@@ -1933,20 +2073,27 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1933
2073
|
* @param destPath - The destination path to copy to
|
|
1934
2074
|
*/
|
|
1935
2075
|
async copy(srcPath, destPath) {
|
|
1936
|
-
|
|
1937
|
-
|
|
2076
|
+
const src = srcPath instanceof URL ? fileURLToPath(srcPath) : srcPath;
|
|
2077
|
+
const dest = destPath instanceof URL ? fileURLToPath(destPath) : destPath;
|
|
2078
|
+
if (!isSetString(src) && (!isSetObject(src) || !isSetString(src.input)) || !isSetString(dest)) {
|
|
2079
|
+
return;
|
|
2080
|
+
}
|
|
2081
|
+
const sourceStr = isString(src) ? src : src.input ? src.input : this.#context.workspaceConfig.workspaceRoot;
|
|
2082
|
+
const source = await this.resolve(sourceStr);
|
|
2083
|
+
if (!source) {
|
|
2084
|
+
return;
|
|
2085
|
+
}
|
|
2086
|
+
if (this.isDirectorySync(source) || isSetString(src) && src.includes("*") || isSetObject(src) && isSetString(src.glob)) {
|
|
2087
|
+
await Promise.all((await this.glob(src)).map(async (file) => {
|
|
2088
|
+
return this.copy(file, appendPath(replacePath(file, sourceStr), dest));
|
|
2089
|
+
}));
|
|
2090
|
+
} else {
|
|
2091
|
+
const content = await this.read(source);
|
|
1938
2092
|
if (content !== void 0) {
|
|
1939
|
-
await this.write(
|
|
2093
|
+
await this.write(this.#normalizePath(dest), content, {
|
|
2094
|
+
skipFormat: true
|
|
2095
|
+
});
|
|
1940
2096
|
}
|
|
1941
|
-
} else {
|
|
1942
|
-
await Promise.all((await this.list(srcPath)).map(async (file) => {
|
|
1943
|
-
const relativePath2 = file.replace(this.#normalizePath(srcPath), "");
|
|
1944
|
-
const destinationPath = this.#normalizePath(appendPath(destPath, relativePath2));
|
|
1945
|
-
const content = await this.read(file);
|
|
1946
|
-
if (content !== void 0) {
|
|
1947
|
-
await this.write(destinationPath, content);
|
|
1948
|
-
}
|
|
1949
|
-
}));
|
|
1950
2097
|
}
|
|
1951
2098
|
}
|
|
1952
2099
|
/**
|
|
@@ -1956,20 +2103,27 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1956
2103
|
* @param destPath - The destination path to copy to
|
|
1957
2104
|
*/
|
|
1958
2105
|
copySync(srcPath, destPath) {
|
|
1959
|
-
|
|
1960
|
-
|
|
2106
|
+
const src = srcPath instanceof URL ? fileURLToPath(srcPath) : srcPath;
|
|
2107
|
+
const dest = destPath instanceof URL ? fileURLToPath(destPath) : destPath;
|
|
2108
|
+
if (!isSetString(src) && (!isSetObject(src) || !isSetString(src.input)) || !isSetString(dest)) {
|
|
2109
|
+
return;
|
|
2110
|
+
}
|
|
2111
|
+
const sourceStr = isString(src) ? src : src.input ? src.input : this.#context.workspaceConfig.workspaceRoot;
|
|
2112
|
+
const source = this.resolveSync(sourceStr);
|
|
2113
|
+
if (!source) {
|
|
2114
|
+
return;
|
|
2115
|
+
}
|
|
2116
|
+
if (this.isDirectorySync(source) || isSetString(src) && src.includes("*") || isSetObject(src) && isSetString(src.glob)) {
|
|
2117
|
+
this.globSync(src).map((file) => {
|
|
2118
|
+
return this.copySync(file, appendPath(findFilePath(replacePath(file, sourceStr)), dest));
|
|
2119
|
+
});
|
|
2120
|
+
} else {
|
|
2121
|
+
const content = this.readSync(source);
|
|
1961
2122
|
if (content !== void 0) {
|
|
1962
|
-
this.writeSync(hasFileExtension(
|
|
2123
|
+
this.writeSync(this.#normalizePath(hasFileExtension(dest) ? dest : appendPath(findFileName(source), dest)), content, {
|
|
2124
|
+
skipFormat: true
|
|
2125
|
+
});
|
|
1963
2126
|
}
|
|
1964
|
-
} else {
|
|
1965
|
-
this.listSync(srcPath).forEach((file) => {
|
|
1966
|
-
const relativePath2 = file.replace(this.#normalizePath(srcPath), "");
|
|
1967
|
-
const destinationPath = this.#normalizePath(appendPath(destPath, relativePath2));
|
|
1968
|
-
const content = this.readSync(file);
|
|
1969
|
-
if (content !== void 0) {
|
|
1970
|
-
this.writeSync(destinationPath, content);
|
|
1971
|
-
}
|
|
1972
|
-
});
|
|
1973
2127
|
}
|
|
1974
2128
|
}
|
|
1975
2129
|
/**
|
|
@@ -2088,6 +2242,22 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2088
2242
|
return adapter.setSync(relativeKey, data);
|
|
2089
2243
|
}
|
|
2090
2244
|
/**
|
|
2245
|
+
* Synchronously creates a directory at the specified path.
|
|
2246
|
+
*
|
|
2247
|
+
* @param dirPath - The path of the directory to create.
|
|
2248
|
+
*/
|
|
2249
|
+
mkdirSync(dirPath) {
|
|
2250
|
+
return this.#getStorage(dirPath)?.adapter?.mkdirSync(dirPath);
|
|
2251
|
+
}
|
|
2252
|
+
/**
|
|
2253
|
+
* Creates a directory at the specified path.
|
|
2254
|
+
*
|
|
2255
|
+
* @param path - The path of the directory to create.
|
|
2256
|
+
*/
|
|
2257
|
+
async mkdir(path) {
|
|
2258
|
+
return this.#getStorage(path)?.adapter?.mkdir(path);
|
|
2259
|
+
}
|
|
2260
|
+
/**
|
|
2091
2261
|
* Retrieves the metadata of a file in the virtual file system (VFS).
|
|
2092
2262
|
*
|
|
2093
2263
|
* @param pathOrId - The path or ID of the file to retrieve metadata for.
|
|
@@ -2312,16 +2482,29 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2312
2482
|
|
|
2313
2483
|
// ../powerlines/src/lib/contexts/context.ts
|
|
2314
2484
|
var configCache = /* @__PURE__ */ new WeakMap();
|
|
2485
|
+
var agent = new Agent({
|
|
2486
|
+
keepAliveTimeout: 1e4
|
|
2487
|
+
});
|
|
2488
|
+
setGlobalDispatcher(agent.compose(interceptors.retry({
|
|
2489
|
+
maxRetries: 3,
|
|
2490
|
+
minTimeout: 1e3,
|
|
2491
|
+
maxTimeout: 1e4,
|
|
2492
|
+
timeoutFactor: 2,
|
|
2493
|
+
retryAfter: true
|
|
2494
|
+
})));
|
|
2315
2495
|
var PowerlinesContext = class _PowerlinesContext {
|
|
2316
2496
|
static {
|
|
2317
2497
|
__name(this, "PowerlinesContext");
|
|
2318
2498
|
}
|
|
2319
2499
|
/**
|
|
2320
|
-
* Internal
|
|
2500
|
+
* Internal references storage
|
|
2501
|
+
*
|
|
2502
|
+
* @danger
|
|
2503
|
+
* This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
|
|
2321
2504
|
*
|
|
2322
2505
|
* @internal
|
|
2323
2506
|
*/
|
|
2324
|
-
#
|
|
2507
|
+
#internal = {};
|
|
2325
2508
|
#workspaceConfig;
|
|
2326
2509
|
#checksum = null;
|
|
2327
2510
|
#buildId = uuid();
|
|
@@ -2411,12 +2594,24 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2411
2594
|
/**
|
|
2412
2595
|
* Internal context fields and methods
|
|
2413
2596
|
*
|
|
2597
|
+
* @danger
|
|
2598
|
+
* This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
|
|
2599
|
+
*
|
|
2414
2600
|
* @internal
|
|
2415
2601
|
*/
|
|
2416
2602
|
get $$internal() {
|
|
2417
|
-
return
|
|
2418
|
-
|
|
2419
|
-
|
|
2603
|
+
return this.#internal;
|
|
2604
|
+
}
|
|
2605
|
+
/**
|
|
2606
|
+
* Internal context fields and methods
|
|
2607
|
+
*
|
|
2608
|
+
* @danger
|
|
2609
|
+
* This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
|
|
2610
|
+
*
|
|
2611
|
+
* @internal
|
|
2612
|
+
*/
|
|
2613
|
+
set $$internal(value) {
|
|
2614
|
+
this.#internal = value;
|
|
2420
2615
|
}
|
|
2421
2616
|
/**
|
|
2422
2617
|
* The resolved entry type definitions for the project
|
|
@@ -2643,19 +2838,27 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2643
2838
|
});
|
|
2644
2839
|
}
|
|
2645
2840
|
}
|
|
2646
|
-
const
|
|
2841
|
+
const response = await fetchRequest(input, {
|
|
2842
|
+
timeout: 12e3,
|
|
2843
|
+
...options
|
|
2844
|
+
});
|
|
2845
|
+
const result = {
|
|
2846
|
+
body: await response.text(),
|
|
2847
|
+
status: response.status,
|
|
2848
|
+
statusText: response.statusText,
|
|
2849
|
+
headers: Object.fromEntries(response.headers.entries())
|
|
2850
|
+
};
|
|
2647
2851
|
if (!this.config.skipCache && !options.skipCache) {
|
|
2648
2852
|
try {
|
|
2649
|
-
this.requestCache.set(cacheKey,
|
|
2650
|
-
body: await result.text(),
|
|
2651
|
-
status: result.status,
|
|
2652
|
-
statusText: result.statusText,
|
|
2653
|
-
headers: Object.fromEntries(result.headers.entries())
|
|
2654
|
-
});
|
|
2853
|
+
this.requestCache.set(cacheKey, result);
|
|
2655
2854
|
} catch {
|
|
2656
2855
|
}
|
|
2657
2856
|
}
|
|
2658
|
-
return result
|
|
2857
|
+
return new Response(result.body, {
|
|
2858
|
+
status: result.status,
|
|
2859
|
+
statusText: result.statusText,
|
|
2860
|
+
headers: result.headers
|
|
2861
|
+
});
|
|
2659
2862
|
}
|
|
2660
2863
|
/**
|
|
2661
2864
|
* Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
|
|
@@ -3349,36 +3552,90 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends P
|
|
|
3349
3552
|
* Retrieves the hook handlers for a specific hook name
|
|
3350
3553
|
*/
|
|
3351
3554
|
selectHooks(hook, options) {
|
|
3352
|
-
const
|
|
3555
|
+
const result = [];
|
|
3353
3556
|
if (this.hooks[hook]) {
|
|
3354
3557
|
if (!isHookExternal(hook)) {
|
|
3355
3558
|
const hooks = this.hooks[hook];
|
|
3356
3559
|
if (options?.order) {
|
|
3357
3560
|
if (options?.order === "pre") {
|
|
3358
|
-
|
|
3359
|
-
|
|
3561
|
+
result.push(...(hooks.preOrdered ?? []).map((h) => {
|
|
3562
|
+
const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
|
|
3563
|
+
if (!plugin) {
|
|
3564
|
+
throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
|
|
3565
|
+
}
|
|
3566
|
+
return {
|
|
3567
|
+
handle: h.handler,
|
|
3568
|
+
context: plugin.context
|
|
3569
|
+
};
|
|
3570
|
+
}));
|
|
3571
|
+
result.push(...(hooks.preEnforced ?? []).map((h) => {
|
|
3572
|
+
const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
|
|
3573
|
+
if (!plugin) {
|
|
3574
|
+
throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
|
|
3575
|
+
}
|
|
3576
|
+
return {
|
|
3577
|
+
handle: h.handler,
|
|
3578
|
+
context: plugin.context
|
|
3579
|
+
};
|
|
3580
|
+
}));
|
|
3360
3581
|
} else if (options?.order === "post") {
|
|
3361
|
-
|
|
3362
|
-
|
|
3582
|
+
result.push(...(hooks.postOrdered ?? []).map((h) => {
|
|
3583
|
+
const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
|
|
3584
|
+
if (!plugin) {
|
|
3585
|
+
throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
|
|
3586
|
+
}
|
|
3587
|
+
return {
|
|
3588
|
+
handle: h.handler,
|
|
3589
|
+
context: plugin.context
|
|
3590
|
+
};
|
|
3591
|
+
}));
|
|
3592
|
+
result.push(...(hooks.postEnforced ?? []).map((h) => {
|
|
3593
|
+
const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
|
|
3594
|
+
if (!plugin) {
|
|
3595
|
+
throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
|
|
3596
|
+
}
|
|
3597
|
+
return {
|
|
3598
|
+
handle: h.handler,
|
|
3599
|
+
context: plugin.context
|
|
3600
|
+
};
|
|
3601
|
+
}));
|
|
3363
3602
|
} else {
|
|
3364
|
-
|
|
3603
|
+
result.push(...(hooks.normal ?? []).map((h) => {
|
|
3604
|
+
const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
|
|
3605
|
+
if (!plugin) {
|
|
3606
|
+
throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
|
|
3607
|
+
}
|
|
3608
|
+
return {
|
|
3609
|
+
handle: h.handler,
|
|
3610
|
+
context: plugin.context
|
|
3611
|
+
};
|
|
3612
|
+
}));
|
|
3365
3613
|
}
|
|
3366
3614
|
} else {
|
|
3367
|
-
|
|
3615
|
+
result.push(...this.selectHooks(hook, {
|
|
3368
3616
|
order: "pre"
|
|
3369
3617
|
}));
|
|
3370
|
-
|
|
3618
|
+
result.push(...this.selectHooks(hook, {
|
|
3371
3619
|
order: "normal"
|
|
3372
3620
|
}));
|
|
3373
|
-
|
|
3621
|
+
result.push(...this.selectHooks(hook, {
|
|
3374
3622
|
order: "post"
|
|
3375
3623
|
}));
|
|
3376
3624
|
}
|
|
3377
3625
|
} else {
|
|
3378
|
-
|
|
3626
|
+
result.push(...this.hooks[hook].map((h) => {
|
|
3627
|
+
const plugin = this.plugins.find((p) => p.plugin.name === h.plugin.name);
|
|
3628
|
+
if (!plugin) {
|
|
3629
|
+
throw new Error(`Could not find plugin context for plugin "${h.plugin.name}".`);
|
|
3630
|
+
}
|
|
3631
|
+
return {
|
|
3632
|
+
handle: h.handler,
|
|
3633
|
+
context: plugin.context
|
|
3634
|
+
};
|
|
3635
|
+
}));
|
|
3379
3636
|
}
|
|
3380
3637
|
}
|
|
3381
|
-
return
|
|
3638
|
+
return result;
|
|
3382
3639
|
}
|
|
3383
3640
|
constructor(config, workspaceConfig) {
|
|
3384
3641
|
super(workspaceConfig);
|
|
@@ -3411,6 +3668,31 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
3411
3668
|
return context;
|
|
3412
3669
|
}
|
|
3413
3670
|
/**
|
|
3671
|
+
* Internal context fields and methods
|
|
3672
|
+
*
|
|
3673
|
+
* @danger
|
|
3674
|
+
* This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
|
|
3675
|
+
*
|
|
3676
|
+
* @internal
|
|
3677
|
+
*/
|
|
3678
|
+
get $$internal() {
|
|
3679
|
+
return super.$$internal;
|
|
3680
|
+
}
|
|
3681
|
+
/**
|
|
3682
|
+
* Internal context fields and methods
|
|
3683
|
+
*
|
|
3684
|
+
* @danger
|
|
3685
|
+
* This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
|
|
3686
|
+
*
|
|
3687
|
+
* @internal
|
|
3688
|
+
*/
|
|
3689
|
+
set $$internal(value) {
|
|
3690
|
+
super.$$internal = value;
|
|
3691
|
+
for (const environment of Object.values(this.environments)) {
|
|
3692
|
+
environment.$$internal = super.$$internal;
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3695
|
+
/**
|
|
3414
3696
|
* A record of all environments by name
|
|
3415
3697
|
*/
|
|
3416
3698
|
get environments() {
|
|
@@ -3584,7 +3866,9 @@ var PowerlinesAPI = class _PowerlinesAPI {
|
|
|
3584
3866
|
*/
|
|
3585
3867
|
static async from(workspaceRoot, config) {
|
|
3586
3868
|
const api = new _PowerlinesAPI(await PowerlinesAPIContext.from(workspaceRoot, config));
|
|
3587
|
-
api.#context.$$internal
|
|
3869
|
+
api.#context.$$internal = {
|
|
3870
|
+
api
|
|
3871
|
+
};
|
|
3588
3872
|
for (const plugin of api.context.config.plugins ?? []) {
|
|
3589
3873
|
await api.#addPlugin(plugin);
|
|
3590
3874
|
}
|
|
@@ -3916,15 +4200,12 @@ ${formatTypes(generatedTypes)}
|
|
|
3916
4200
|
const destinationPath = joinPaths$1(appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot), "dist");
|
|
3917
4201
|
if (sourcePath !== destinationPath) {
|
|
3918
4202
|
context.log(LogLevelLabel.INFO, `Copying build output files from project's build directory (${context.config.output.buildPath}) to the workspace's output directory (${context.config.output.outputPath}).`);
|
|
3919
|
-
await
|
|
3920
|
-
input: sourcePath,
|
|
3921
|
-
glob: "**/*"
|
|
3922
|
-
}, destinationPath);
|
|
4203
|
+
await context.fs.copy(sourcePath, destinationPath);
|
|
3923
4204
|
}
|
|
3924
4205
|
}
|
|
3925
4206
|
await Promise.all(context.config.output.assets.map(async (asset) => {
|
|
3926
4207
|
context.log(LogLevelLabel.DEBUG, `Copying asset(s): ${chalk5.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : joinPaths$1(replacePath(asset.input, context.workspaceConfig.workspaceRoot), asset.glob))} -> ${chalk5.greenBright(joinPaths$1(replacePath(asset.output, context.workspaceConfig.workspaceRoot), asset.glob))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk5.yellowBright(i)).join(", ")})` : ""}`);
|
|
3927
|
-
await
|
|
4208
|
+
await context.fs.copy(asset, asset.output);
|
|
3928
4209
|
}));
|
|
3929
4210
|
await this.callHook("build", {
|
|
3930
4211
|
environment: context,
|