@powerlines/nx 0.10.45 → 0.10.47
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 +12 -0
- package/dist/{chunk-2JXCBCM2.js → chunk-23GFPMA6.js} +2 -2
- package/dist/{chunk-RV4A57IL.js → chunk-2ZHIKYNK.js} +2 -2
- package/dist/{chunk-ZL37TY72.js → chunk-3IX4CIEZ.js} +2 -2
- package/dist/{chunk-HMVFFEMQ.mjs → chunk-BRGJUSQE.mjs} +1 -1
- package/dist/{chunk-TCMZZXZF.mjs → chunk-JLOTTRGF.mjs} +310 -126
- package/dist/{chunk-7KYZYROW.mjs → chunk-KAGXZMPG.mjs} +1 -1
- package/dist/{chunk-6G6UOPGV.mjs → chunk-RVCS4GUB.mjs} +1 -1
- package/dist/{chunk-Z4DURF7V.js → chunk-SMUQRWNQ.js} +311 -127
- package/dist/{chunk-SFMHLFAI.mjs → chunk-SW7WPPQ5.mjs} +1 -1
- package/dist/{chunk-4GOHIU5C.js → chunk-UC4XWZN3.js} +2 -2
- package/dist/{chunk-OXP4T7OM.mjs → chunk-WOB6ZDJH.mjs} +1 -1
- package/dist/{chunk-DTWYF2BM.js → chunk-ZUHOITET.js} +2 -2
- 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
|
@@ -21,6 +21,7 @@ var joinPaths = require('@stryke/path/join-paths');
|
|
|
21
21
|
var replace = require('@stryke/path/replace');
|
|
22
22
|
var isFunction = require('@stryke/type-checks/is-function');
|
|
23
23
|
var isNumber = require('@stryke/type-checks/is-number');
|
|
24
|
+
var isObject = require('@stryke/type-checks/is-object');
|
|
24
25
|
var isPromise = require('@stryke/type-checks/is-promise');
|
|
25
26
|
var isSet = require('@stryke/type-checks/is-set');
|
|
26
27
|
var isSetObject = require('@stryke/type-checks/is-set-object');
|
|
@@ -39,38 +40,40 @@ var stormJson = require('@stryke/json/storm-json');
|
|
|
39
40
|
var filePathFns = require('@stryke/path/file-path-fns');
|
|
40
41
|
var titleCase = require('@stryke/string-format/title-case');
|
|
41
42
|
var exists = require('@stryke/fs/exists');
|
|
42
|
-
var writeFile$1 = require('@stryke/fs/write-file');
|
|
43
|
-
var prettier = require('prettier');
|
|
44
43
|
var getEnvPaths = require('@stryke/env/get-env-paths');
|
|
45
44
|
var getWorkspaceRoot = require('@stryke/fs/get-workspace-root');
|
|
46
45
|
var hashFiles = require('@stryke/hash/hash-files');
|
|
47
46
|
var murmurhash = require('@stryke/hash/murmurhash');
|
|
48
47
|
var getUnique = require('@stryke/helpers/get-unique');
|
|
49
48
|
var omit = require('@stryke/helpers/omit');
|
|
49
|
+
var fetch = require('@stryke/http/fetch');
|
|
50
50
|
var isType = require('@stryke/path/is-type');
|
|
51
51
|
var isNull = require('@stryke/type-checks/is-null');
|
|
52
52
|
var isString = require('@stryke/type-checks/is-string');
|
|
53
53
|
var uuid = require('@stryke/unique-id/uuid');
|
|
54
54
|
var bundleRequire = require('bundle-require');
|
|
55
|
+
var flatCache = require('flat-cache');
|
|
56
|
+
var oxcParser = require('oxc-parser');
|
|
57
|
+
var undici = require('undici');
|
|
55
58
|
var jiti = require('jiti');
|
|
56
59
|
var isUndefined = require('@stryke/type-checks/is-undefined');
|
|
57
60
|
var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
|
|
58
61
|
var isFile = require('@stryke/fs/is-file');
|
|
59
62
|
var $ = require('@stryke/capnp');
|
|
60
63
|
var buffer = require('@stryke/fs/buffer');
|
|
61
|
-
var correctPath = require('@stryke/path/correct-path');
|
|
62
64
|
var isParentPath = require('@stryke/path/is-parent-path');
|
|
63
65
|
var prettyBytes = require('@stryke/string-format/pretty-bytes');
|
|
64
|
-
var flatCache = require('flat-cache');
|
|
65
66
|
var buffer$1 = require('buffer');
|
|
67
|
+
var prettier = require('prettier');
|
|
66
68
|
var colors = require('@storm-software/config-tools/utilities/colors');
|
|
67
69
|
var noop = require('@stryke/helpers/noop');
|
|
70
|
+
var correctPath = require('@stryke/path/correct-path');
|
|
68
71
|
var slash = require('@stryke/path/slash');
|
|
69
72
|
var readFile = require('@stryke/fs/read-file');
|
|
73
|
+
var writeFile = require('@stryke/fs/write-file');
|
|
70
74
|
var fs = require('fs');
|
|
71
75
|
var promises = require('fs/promises');
|
|
72
76
|
var path = require('path');
|
|
73
|
-
var isObject = require('@stryke/type-checks/is-object');
|
|
74
77
|
|
|
75
78
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
76
79
|
|
|
@@ -359,7 +362,9 @@ async function callHook(context, hook, options, ...args) {
|
|
|
359
362
|
if (!isFunction.isFunction(handler)) {
|
|
360
363
|
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
361
364
|
}
|
|
362
|
-
return Promise.resolve(handler.apply(null,
|
|
365
|
+
return Promise.resolve(handler.apply(null, [
|
|
366
|
+
...args
|
|
367
|
+
]));
|
|
363
368
|
}));
|
|
364
369
|
} else {
|
|
365
370
|
for (const handler of handlers) {
|
|
@@ -367,7 +372,9 @@ async function callHook(context, hook, options, ...args) {
|
|
|
367
372
|
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
368
373
|
}
|
|
369
374
|
if (options?.result === "first" || options?.asNextParam === false) {
|
|
370
|
-
results.push(await Promise.resolve(handler.apply(null,
|
|
375
|
+
results.push(await Promise.resolve(handler.apply(null, [
|
|
376
|
+
...args
|
|
377
|
+
])));
|
|
371
378
|
if (options?.result === "first" && isSet.isSet(results[results.length - 1])) {
|
|
372
379
|
break;
|
|
373
380
|
}
|
|
@@ -379,12 +386,22 @@ async function callHook(context, hook, options, ...args) {
|
|
|
379
386
|
sequenceArgs[0] = isFunction.isFunction(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
|
|
380
387
|
}
|
|
381
388
|
const result = await Promise.resolve(
|
|
382
|
-
// eslint-disable-next-line ts/no-unsafe-call
|
|
383
|
-
handler.apply(null,
|
|
389
|
+
// eslint-disable-next-line ts/no-unsafe-call, no-useless-call
|
|
390
|
+
handler.apply(null, [
|
|
391
|
+
...sequenceArgs
|
|
392
|
+
])
|
|
384
393
|
);
|
|
385
|
-
|
|
386
|
-
result
|
|
387
|
-
|
|
394
|
+
if (result) {
|
|
395
|
+
if (options?.result === "last") {
|
|
396
|
+
results = [
|
|
397
|
+
result
|
|
398
|
+
];
|
|
399
|
+
} else {
|
|
400
|
+
results = [
|
|
401
|
+
defu6.defu(result, results[0] ?? {})
|
|
402
|
+
];
|
|
403
|
+
}
|
|
404
|
+
}
|
|
388
405
|
}
|
|
389
406
|
}
|
|
390
407
|
}
|
|
@@ -550,33 +567,20 @@ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && err
|
|
|
550
567
|
};
|
|
551
568
|
}
|
|
552
569
|
chunkSHUYVCID_js.__name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
|
|
553
|
-
async function writeFile(log, filepath, content, skipFormat = false) {
|
|
554
|
-
try {
|
|
555
|
-
if (skipFormat) {
|
|
556
|
-
await writeFile$1.writeFile(filepath, content);
|
|
557
|
-
} else {
|
|
558
|
-
const config = await prettier.resolveConfig(filepath);
|
|
559
|
-
const formatted = await prettier.format(content, {
|
|
560
|
-
...config ?? {},
|
|
561
|
-
filepath
|
|
562
|
-
});
|
|
563
|
-
await writeFile$1.writeFile(filepath, formatted || "");
|
|
564
|
-
}
|
|
565
|
-
} catch (error) {
|
|
566
|
-
log(types.LogLevelLabel.ERROR, `Failed to write file ${filepath} to disk
|
|
567
|
-
${error?.message ? error.message : ""}`);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
chunkSHUYVCID_js.__name(writeFile, "writeFile");
|
|
571
570
|
|
|
572
571
|
// ../powerlines/src/internal/helpers/resolve-tsconfig.ts
|
|
572
|
+
function getTsconfigDtsPath(context) {
|
|
573
|
+
const dtsRelativePath = joinPaths.joinPaths(filePathFns.relativePath(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot), filePathFns.findFilePath(context.dtsPath)), filePathFns.findFileName(context.dtsPath));
|
|
574
|
+
return dtsRelativePath;
|
|
575
|
+
}
|
|
576
|
+
chunkSHUYVCID_js.__name(getTsconfigDtsPath, "getTsconfigDtsPath");
|
|
573
577
|
async function resolveTsconfigChanges(context) {
|
|
574
578
|
const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw);
|
|
575
579
|
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
576
580
|
const tsconfigJson = await json.readJsonFile(tsconfigFilePath);
|
|
577
581
|
tsconfigJson.compilerOptions ??= {};
|
|
578
582
|
if (context.config.output.dts !== false) {
|
|
579
|
-
const dtsRelativePath =
|
|
583
|
+
const dtsRelativePath = getTsconfigDtsPath(context);
|
|
580
584
|
if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [
|
|
581
585
|
context.dtsPath,
|
|
582
586
|
dtsRelativePath
|
|
@@ -618,7 +622,7 @@ async function initializeTsconfig(context) {
|
|
|
618
622
|
context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
|
|
619
623
|
context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
|
|
620
624
|
context.log(types.LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
|
|
621
|
-
await
|
|
625
|
+
await context.fs.write(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson));
|
|
622
626
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
|
|
623
627
|
}
|
|
624
628
|
chunkSHUYVCID_js.__name(initializeTsconfig, "initializeTsconfig");
|
|
@@ -667,13 +671,11 @@ async function resolveTsconfig(context) {
|
|
|
667
671
|
`).join("\n")}
|
|
668
672
|
`);
|
|
669
673
|
}
|
|
670
|
-
await
|
|
674
|
+
await context.fs.write(context.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(updateTsconfigJson));
|
|
671
675
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
672
676
|
if (!context.tsconfig) {
|
|
673
677
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
674
678
|
}
|
|
675
|
-
context.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
676
|
-
context.tsconfig.tsconfigJson.compilerOptions.strict = false;
|
|
677
679
|
}
|
|
678
680
|
chunkSHUYVCID_js.__name(resolveTsconfig, "resolveTsconfig");
|
|
679
681
|
var DEFAULT_ENVIRONMENT = "default";
|
|
@@ -813,7 +815,7 @@ function replacePathTokens(context, path) {
|
|
|
813
815
|
if (!path) {
|
|
814
816
|
return path;
|
|
815
817
|
}
|
|
816
|
-
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replace.replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replace.replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replace.replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
818
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replace.replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replace.replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replace.replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
817
819
|
}
|
|
818
820
|
chunkSHUYVCID_js.__name(replacePathTokens, "replacePathTokens");
|
|
819
821
|
function resolveEntryInputFile(context, typeDefinition) {
|
|
@@ -1371,7 +1373,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
1371
1373
|
*/
|
|
1372
1374
|
setSync(key, value) {
|
|
1373
1375
|
if (!this.options.isReadOnly) {
|
|
1374
|
-
return writeFile
|
|
1376
|
+
return writeFile.writeFileSync(this.resolve(key), value);
|
|
1375
1377
|
}
|
|
1376
1378
|
}
|
|
1377
1379
|
/**
|
|
@@ -1382,7 +1384,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
1382
1384
|
*/
|
|
1383
1385
|
async set(key, value) {
|
|
1384
1386
|
if (!this.options.isReadOnly) {
|
|
1385
|
-
return writeFile
|
|
1387
|
+
return writeFile.writeFile(this.resolve(key), value);
|
|
1386
1388
|
}
|
|
1387
1389
|
}
|
|
1388
1390
|
/**
|
|
@@ -1565,7 +1567,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1565
1567
|
* @returns The normalized module id.
|
|
1566
1568
|
*/
|
|
1567
1569
|
#normalizeId(id) {
|
|
1568
|
-
|
|
1570
|
+
let normalized = id;
|
|
1571
|
+
if (isParentPath.isParentPath(normalized, this.#context.builtinsPath)) {
|
|
1572
|
+
normalized = replace.replacePath(normalized, this.#context.builtinsPath);
|
|
1573
|
+
}
|
|
1574
|
+
return normalizeId(normalized, this.#context.config.output.builtinPrefix);
|
|
1569
1575
|
}
|
|
1570
1576
|
/**
|
|
1571
1577
|
* Normalizes a given path by resolving it against the project root, workspace root, and built-ins path.
|
|
@@ -1574,7 +1580,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1574
1580
|
* @returns The normalized path.
|
|
1575
1581
|
*/
|
|
1576
1582
|
#normalizePath(path) {
|
|
1577
|
-
return normalizePath(path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
|
|
1583
|
+
return normalizePath(path.includes("{") || path.includes("}") ? replacePathTokens(this.#context, path) : path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
|
|
1578
1584
|
}
|
|
1579
1585
|
/**
|
|
1580
1586
|
* Builds a regular expression from a string pattern for path matching.
|
|
@@ -2079,15 +2085,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2079
2085
|
}
|
|
2080
2086
|
}
|
|
2081
2087
|
const { relativeKey, adapter } = this.#getStorage(path);
|
|
2082
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(
|
|
2083
|
-
const id = options?.meta?.id || this.#normalizeId(
|
|
2088
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(relativeKey)} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
|
|
2089
|
+
const id = options?.meta?.id || this.#normalizeId(relativeKey);
|
|
2084
2090
|
this.#metadata[id] = {
|
|
2085
2091
|
variant: "normal",
|
|
2086
2092
|
timestamp: Date.now(),
|
|
2087
2093
|
...options.meta ?? {}
|
|
2088
2094
|
};
|
|
2089
|
-
this.#paths[id] = this.#normalizePath(
|
|
2090
|
-
this.#ids[this.#normalizePath(
|
|
2095
|
+
this.#paths[id] = this.#normalizePath(relativeKey);
|
|
2096
|
+
this.#ids[this.#normalizePath(relativeKey)] = id;
|
|
2091
2097
|
return adapter.set(relativeKey, code);
|
|
2092
2098
|
}
|
|
2093
2099
|
/**
|
|
@@ -2099,15 +2105,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2099
2105
|
*/
|
|
2100
2106
|
writeSync(path, data = "", options = {}) {
|
|
2101
2107
|
const { relativeKey, adapter } = this.#getStorage(path);
|
|
2102
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(
|
|
2103
|
-
const id = options?.meta?.id || this.#normalizeId(
|
|
2108
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(relativeKey)} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(data)).size)})`);
|
|
2109
|
+
const id = options?.meta?.id || this.#normalizeId(relativeKey);
|
|
2104
2110
|
this.#metadata[id] = {
|
|
2105
2111
|
variant: "normal",
|
|
2106
2112
|
timestamp: Date.now(),
|
|
2107
2113
|
...options.meta ?? {}
|
|
2108
2114
|
};
|
|
2109
|
-
this.#paths[id] = this.#normalizePath(
|
|
2110
|
-
this.#ids[this.#normalizePath(
|
|
2115
|
+
this.#paths[id] = this.#normalizePath(relativeKey);
|
|
2116
|
+
this.#ids[this.#normalizePath(relativeKey)] = id;
|
|
2111
2117
|
return adapter.setSync(relativeKey, data);
|
|
2112
2118
|
}
|
|
2113
2119
|
/**
|
|
@@ -2140,17 +2146,26 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2140
2146
|
* @returns A promise that resolves to the resolved module path.
|
|
2141
2147
|
*/
|
|
2142
2148
|
async resolve(id, importer, options = {}) {
|
|
2143
|
-
|
|
2144
|
-
|
|
2149
|
+
let path = id;
|
|
2150
|
+
if (path.includes("{") || path.includes("}")) {
|
|
2151
|
+
path = replacePathTokens(this.#context, path);
|
|
2145
2152
|
}
|
|
2153
|
+
if (isType.isAbsolutePath(path)) {
|
|
2154
|
+
return path;
|
|
2155
|
+
}
|
|
2156
|
+
const resolverCacheKey = murmurhash.murmurhash({
|
|
2157
|
+
path: this.#normalizeId(path),
|
|
2158
|
+
importer,
|
|
2159
|
+
options
|
|
2160
|
+
});
|
|
2146
2161
|
let result;
|
|
2147
2162
|
if (!this.#context.config.skipCache) {
|
|
2148
|
-
result = this.resolverCache.get(
|
|
2163
|
+
result = this.resolverCache.get(resolverCacheKey);
|
|
2149
2164
|
if (result) {
|
|
2150
2165
|
return result;
|
|
2151
2166
|
}
|
|
2152
2167
|
}
|
|
2153
|
-
result = this.paths[this.#normalizeId(
|
|
2168
|
+
result = this.paths[this.#normalizeId(path)];
|
|
2154
2169
|
if (!result) {
|
|
2155
2170
|
const paths = options.paths ?? [];
|
|
2156
2171
|
if (importer && !paths.includes(importer)) {
|
|
@@ -2159,8 +2174,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2159
2174
|
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2160
2175
|
paths.push(append.appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
2161
2176
|
paths.push(append.appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
2162
|
-
paths.push(...Object.keys(this.#context.tsconfig
|
|
2163
|
-
for (const combination of resolve.getResolutionCombinations(
|
|
2177
|
+
paths.push(...Object.keys(this.#context.tsconfig?.options?.paths ?? {}).filter((tsconfigPath) => path.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig?.options?.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
|
|
2178
|
+
for (const combination of resolve.getResolutionCombinations(path, {
|
|
2164
2179
|
paths
|
|
2165
2180
|
})) {
|
|
2166
2181
|
const { relativeKey, adapter } = this.#getStorage(combination);
|
|
@@ -2169,18 +2184,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2169
2184
|
break;
|
|
2170
2185
|
}
|
|
2171
2186
|
}
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2187
|
+
if (!result) {
|
|
2188
|
+
try {
|
|
2189
|
+
result = await resolve.resolve(path, {
|
|
2190
|
+
...options,
|
|
2191
|
+
paths
|
|
2192
|
+
});
|
|
2193
|
+
} catch {
|
|
2194
|
+
}
|
|
2177
2195
|
}
|
|
2178
2196
|
}
|
|
2179
|
-
if (result) {
|
|
2180
|
-
|
|
2181
|
-
if (!this.#context.config.skipCache) {
|
|
2182
|
-
this.resolverCache.set(this.#normalizeId(id), result);
|
|
2183
|
-
}
|
|
2197
|
+
if (result && !this.#context.config.skipCache) {
|
|
2198
|
+
this.resolverCache.set(resolverCacheKey, result);
|
|
2184
2199
|
}
|
|
2185
2200
|
return result;
|
|
2186
2201
|
}
|
|
@@ -2201,17 +2216,21 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2201
2216
|
* @returns The resolved module path.
|
|
2202
2217
|
*/
|
|
2203
2218
|
resolveSync(id, importer, options = {}) {
|
|
2204
|
-
|
|
2205
|
-
|
|
2219
|
+
let path = id;
|
|
2220
|
+
if (path.includes("{") || path.includes("}")) {
|
|
2221
|
+
path = replacePathTokens(this.#context, path);
|
|
2222
|
+
}
|
|
2223
|
+
if (isType.isAbsolutePath(path)) {
|
|
2224
|
+
return path;
|
|
2206
2225
|
}
|
|
2207
2226
|
let result;
|
|
2208
2227
|
if (!this.#context.config.skipCache) {
|
|
2209
|
-
result = this.resolverCache.get(this.#normalizeId(
|
|
2228
|
+
result = this.resolverCache.get(this.#normalizeId(path));
|
|
2210
2229
|
if (result) {
|
|
2211
2230
|
return result;
|
|
2212
2231
|
}
|
|
2213
2232
|
}
|
|
2214
|
-
result = this.paths[this.#normalizeId(
|
|
2233
|
+
result = this.paths[this.#normalizeId(path)];
|
|
2215
2234
|
if (!result) {
|
|
2216
2235
|
const paths = options.paths ?? [];
|
|
2217
2236
|
if (importer && !paths.includes(importer)) {
|
|
@@ -2220,8 +2239,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2220
2239
|
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2221
2240
|
paths.push(append.appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
2222
2241
|
paths.push(append.appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
2223
|
-
paths.push(...Object.keys(this.#context.tsconfig
|
|
2224
|
-
for (const combination of resolve.getResolutionCombinations(
|
|
2242
|
+
paths.push(...Object.keys(this.#context.tsconfig?.options?.paths ?? {}).filter((tsconfigPath) => path.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig?.options?.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
|
|
2243
|
+
for (const combination of resolve.getResolutionCombinations(path, {
|
|
2225
2244
|
paths
|
|
2226
2245
|
})) {
|
|
2227
2246
|
const { relativeKey, adapter } = this.#getStorage(combination);
|
|
@@ -2230,18 +2249,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2230
2249
|
break;
|
|
2231
2250
|
}
|
|
2232
2251
|
}
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2252
|
+
if (!result) {
|
|
2253
|
+
try {
|
|
2254
|
+
result = resolve.resolveSync(path, {
|
|
2255
|
+
...options,
|
|
2256
|
+
paths
|
|
2257
|
+
});
|
|
2258
|
+
} catch {
|
|
2259
|
+
}
|
|
2238
2260
|
}
|
|
2239
2261
|
}
|
|
2240
|
-
if (result) {
|
|
2241
|
-
|
|
2242
|
-
if (!this.#context.config.skipCache) {
|
|
2243
|
-
this.resolverCache.set(this.#normalizeId(id), result);
|
|
2244
|
-
}
|
|
2262
|
+
if (result && !this.#context.config.skipCache) {
|
|
2263
|
+
this.resolverCache.set(this.#normalizeId(path), result);
|
|
2245
2264
|
}
|
|
2246
2265
|
return result;
|
|
2247
2266
|
}
|
|
@@ -2341,7 +2360,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2341
2360
|
#fs;
|
|
2342
2361
|
#tsconfig;
|
|
2343
2362
|
#program;
|
|
2344
|
-
#
|
|
2363
|
+
#parserCache;
|
|
2364
|
+
#requestCache;
|
|
2345
2365
|
#getConfigProps(config = {}) {
|
|
2346
2366
|
return {
|
|
2347
2367
|
variant: config.build?.variant,
|
|
@@ -2365,7 +2385,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2365
2385
|
lint: config.lint,
|
|
2366
2386
|
transform: config.transform,
|
|
2367
2387
|
build: config.build,
|
|
2368
|
-
framework: config.framework
|
|
2388
|
+
framework: config.framework,
|
|
2389
|
+
...config
|
|
2369
2390
|
};
|
|
2370
2391
|
}
|
|
2371
2392
|
/**
|
|
@@ -2413,6 +2434,10 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2413
2434
|
*/
|
|
2414
2435
|
resolver;
|
|
2415
2436
|
/**
|
|
2437
|
+
* The resolved configuration options
|
|
2438
|
+
*/
|
|
2439
|
+
resolvePatterns = [];
|
|
2440
|
+
/**
|
|
2416
2441
|
* Internal context fields and methods
|
|
2417
2442
|
*
|
|
2418
2443
|
* @internal
|
|
@@ -2444,7 +2469,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2444
2469
|
*/
|
|
2445
2470
|
set tsconfig(value) {
|
|
2446
2471
|
this.#tsconfig = value;
|
|
2447
|
-
this
|
|
2472
|
+
this.resolvePatterns = bundleRequire.tsconfigPathsToRegExp(value?.options?.paths ?? {});
|
|
2448
2473
|
}
|
|
2449
2474
|
/**
|
|
2450
2475
|
* The virtual file system interface for the project
|
|
@@ -2585,6 +2610,123 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2585
2610
|
return this.#program;
|
|
2586
2611
|
}
|
|
2587
2612
|
/**
|
|
2613
|
+
* Gets the parser cache.
|
|
2614
|
+
*/
|
|
2615
|
+
get parserCache() {
|
|
2616
|
+
if (!this.#parserCache) {
|
|
2617
|
+
this.#parserCache = flatCache.create({
|
|
2618
|
+
cacheId: "parser",
|
|
2619
|
+
cacheDir: this.cachePath,
|
|
2620
|
+
ttl: 2 * 60 * 60 * 1e3,
|
|
2621
|
+
lruSize: 5e3,
|
|
2622
|
+
persistInterval: 250
|
|
2623
|
+
});
|
|
2624
|
+
}
|
|
2625
|
+
return this.#parserCache;
|
|
2626
|
+
}
|
|
2627
|
+
/**
|
|
2628
|
+
* Gets the request cache.
|
|
2629
|
+
*/
|
|
2630
|
+
get requestCache() {
|
|
2631
|
+
if (!this.#requestCache) {
|
|
2632
|
+
this.#requestCache = flatCache.create({
|
|
2633
|
+
cacheId: "http",
|
|
2634
|
+
cacheDir: this.cachePath,
|
|
2635
|
+
ttl: 5 * 60 * 1e3,
|
|
2636
|
+
lruSize: 5e3,
|
|
2637
|
+
persistInterval: 250
|
|
2638
|
+
});
|
|
2639
|
+
}
|
|
2640
|
+
return this.#requestCache;
|
|
2641
|
+
}
|
|
2642
|
+
/**
|
|
2643
|
+
* A function to perform HTTP fetch requests
|
|
2644
|
+
*
|
|
2645
|
+
* @remarks
|
|
2646
|
+
* This function uses a caching layer to avoid duplicate requests during the Powerlines process.
|
|
2647
|
+
*
|
|
2648
|
+
* @example
|
|
2649
|
+
* ```ts
|
|
2650
|
+
* const response = await context.fetch("https://api.example.com/data");
|
|
2651
|
+
* const data = await response.json();
|
|
2652
|
+
* ```
|
|
2653
|
+
*
|
|
2654
|
+
* @see https://github.com/nodejs/undici
|
|
2655
|
+
*
|
|
2656
|
+
* @param input - The URL to fetch.
|
|
2657
|
+
* @param options - The fetch request options.
|
|
2658
|
+
* @returns A promise that resolves to a response returned by the fetch.
|
|
2659
|
+
*/
|
|
2660
|
+
async fetch(input, options = {}) {
|
|
2661
|
+
const cacheKey = murmurhash.murmurhash({
|
|
2662
|
+
input: input.toString(),
|
|
2663
|
+
options: JSON.stringify(options)
|
|
2664
|
+
});
|
|
2665
|
+
if (!this.config.skipCache && !options.skipCache) {
|
|
2666
|
+
const cached = this.requestCache.get(cacheKey);
|
|
2667
|
+
if (cached) {
|
|
2668
|
+
return new undici.Response(cached.body, {
|
|
2669
|
+
status: cached.status,
|
|
2670
|
+
statusText: cached.statusText,
|
|
2671
|
+
headers: cached.headers
|
|
2672
|
+
});
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
const result = await fetch.fetchRequest(input, options);
|
|
2676
|
+
if (!this.config.skipCache && !options.skipCache) {
|
|
2677
|
+
try {
|
|
2678
|
+
this.requestCache.set(cacheKey, {
|
|
2679
|
+
body: await result.text(),
|
|
2680
|
+
status: result.status,
|
|
2681
|
+
statusText: result.statusText,
|
|
2682
|
+
headers: Object.fromEntries(result.headers.entries())
|
|
2683
|
+
});
|
|
2684
|
+
} catch {
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
return result;
|
|
2688
|
+
}
|
|
2689
|
+
/**
|
|
2690
|
+
* Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
|
|
2691
|
+
*
|
|
2692
|
+
* @remarks
|
|
2693
|
+
* This function can be used to parse TypeScript code into an AST for further analysis or transformation.
|
|
2694
|
+
*
|
|
2695
|
+
* @example
|
|
2696
|
+
* ```ts
|
|
2697
|
+
* const ast = context.parse("const x: number = 42;");
|
|
2698
|
+
* ```
|
|
2699
|
+
*
|
|
2700
|
+
* @see https://rollupjs.org/plugin-development/#this-parse
|
|
2701
|
+
* @see https://github.com/oxc/oxc
|
|
2702
|
+
*
|
|
2703
|
+
* @param code - The source code to parse.
|
|
2704
|
+
* @param options - The options to pass to the parser.
|
|
2705
|
+
* @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
|
|
2706
|
+
*/
|
|
2707
|
+
async parse(code, options = {}) {
|
|
2708
|
+
const cacheKey = murmurhash.murmurhash({
|
|
2709
|
+
code,
|
|
2710
|
+
options
|
|
2711
|
+
});
|
|
2712
|
+
let result;
|
|
2713
|
+
if (!this.config.skipCache) {
|
|
2714
|
+
result = this.parserCache.get(cacheKey);
|
|
2715
|
+
if (result) {
|
|
2716
|
+
return result;
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
result = await oxcParser.parse(`source.${options.lang || "ts"}`, code, {
|
|
2720
|
+
...options,
|
|
2721
|
+
sourceType: "module",
|
|
2722
|
+
showSemanticErrors: this.config.mode === "development"
|
|
2723
|
+
});
|
|
2724
|
+
if (!this.config.skipCache) {
|
|
2725
|
+
this.parserCache.set(cacheKey, result);
|
|
2726
|
+
}
|
|
2727
|
+
return result;
|
|
2728
|
+
}
|
|
2729
|
+
/**
|
|
2588
2730
|
* A helper function to resolve modules in the Virtual File System
|
|
2589
2731
|
*
|
|
2590
2732
|
* @remarks
|
|
@@ -2600,9 +2742,26 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2600
2742
|
* @param options - Additional resolution options.
|
|
2601
2743
|
* @returns A promise that resolves to the resolved module path.
|
|
2602
2744
|
*/
|
|
2603
|
-
async
|
|
2604
|
-
|
|
2605
|
-
|
|
2745
|
+
async resolve(id, importer, options = {}) {
|
|
2746
|
+
let moduleId = id;
|
|
2747
|
+
if (this.config.build.alias) {
|
|
2748
|
+
if (Array.isArray(this.config.build.alias)) {
|
|
2749
|
+
const alias = this.config.build.alias.find((a) => bundleRequire.match(moduleId, [
|
|
2750
|
+
a.find
|
|
2751
|
+
]));
|
|
2752
|
+
if (alias) {
|
|
2753
|
+
moduleId = alias.replacement;
|
|
2754
|
+
}
|
|
2755
|
+
} else if (isSetObject.isSetObject(this.config.build.alias) && this.config.build.alias[id]) {
|
|
2756
|
+
moduleId = this.config.build.alias[id];
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
if (this.fs.isVirtual(moduleId)) {
|
|
2760
|
+
const result = await this.fs.resolve(moduleId, importer, {
|
|
2761
|
+
conditions: this.config.build.conditions,
|
|
2762
|
+
extensions: this.config.build.extensions,
|
|
2763
|
+
...options
|
|
2764
|
+
});
|
|
2606
2765
|
if (!result) {
|
|
2607
2766
|
return void 0;
|
|
2608
2767
|
}
|
|
@@ -2612,28 +2771,28 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2612
2771
|
};
|
|
2613
2772
|
}
|
|
2614
2773
|
if (this.config.build.skipNodeModulesBundle) {
|
|
2615
|
-
if (bundleRequire.match(
|
|
2774
|
+
if (bundleRequire.match(moduleId, this.resolvePatterns) || bundleRequire.match(moduleId, this.config.build.noExternal)) {
|
|
2616
2775
|
return void 0;
|
|
2617
2776
|
}
|
|
2618
|
-
if (bundleRequire.match(
|
|
2777
|
+
if (bundleRequire.match(moduleId, this.config.build.external) || moduleId.startsWith("node:")) {
|
|
2619
2778
|
return {
|
|
2620
|
-
id,
|
|
2779
|
+
id: moduleId,
|
|
2621
2780
|
external: true
|
|
2622
2781
|
};
|
|
2623
2782
|
}
|
|
2624
|
-
if (!/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(
|
|
2783
|
+
if (!/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(moduleId)) {
|
|
2625
2784
|
return {
|
|
2626
|
-
id,
|
|
2785
|
+
id: moduleId,
|
|
2627
2786
|
external: true
|
|
2628
2787
|
};
|
|
2629
2788
|
}
|
|
2630
2789
|
} else {
|
|
2631
|
-
if (bundleRequire.match(
|
|
2790
|
+
if (bundleRequire.match(moduleId, this.config.build.noExternal)) {
|
|
2632
2791
|
return void 0;
|
|
2633
2792
|
}
|
|
2634
|
-
if (bundleRequire.match(
|
|
2793
|
+
if (bundleRequire.match(moduleId, this.config.build.external) || moduleId.startsWith("node:")) {
|
|
2635
2794
|
return {
|
|
2636
|
-
id,
|
|
2795
|
+
id: moduleId,
|
|
2637
2796
|
external: true
|
|
2638
2797
|
};
|
|
2639
2798
|
}
|
|
@@ -2806,6 +2965,26 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2806
2965
|
return extendLog(this.log, name);
|
|
2807
2966
|
}
|
|
2808
2967
|
/**
|
|
2968
|
+
* Generates a checksum representing the current context state
|
|
2969
|
+
*
|
|
2970
|
+
* @param root - The root directory of the project to generate the checksum for
|
|
2971
|
+
* @returns A promise that resolves to a string representing the checksum
|
|
2972
|
+
*/
|
|
2973
|
+
async generateChecksum(root = this.config.projectRoot) {
|
|
2974
|
+
this.#checksum = await hashFiles.hashDirectory(root, {
|
|
2975
|
+
ignore: [
|
|
2976
|
+
"node_modules",
|
|
2977
|
+
".git",
|
|
2978
|
+
".nx",
|
|
2979
|
+
".cache",
|
|
2980
|
+
".storm",
|
|
2981
|
+
"tmp",
|
|
2982
|
+
"dist"
|
|
2983
|
+
]
|
|
2984
|
+
});
|
|
2985
|
+
return this.#checksum;
|
|
2986
|
+
}
|
|
2987
|
+
/**
|
|
2809
2988
|
* Creates a new StormContext instance.
|
|
2810
2989
|
*
|
|
2811
2990
|
* @param workspaceConfig - The workspace configuration.
|
|
@@ -2827,26 +3006,6 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2827
3006
|
*/
|
|
2828
3007
|
logFn;
|
|
2829
3008
|
/**
|
|
2830
|
-
* Generates a checksum representing the current context state
|
|
2831
|
-
*
|
|
2832
|
-
* @param root - The root directory of the project to generate the checksum for
|
|
2833
|
-
* @returns A promise that resolves to a string representing the checksum
|
|
2834
|
-
*/
|
|
2835
|
-
async generateChecksum(root = this.config.projectRoot) {
|
|
2836
|
-
this.#checksum = await hashFiles.hashDirectory(root, {
|
|
2837
|
-
ignore: [
|
|
2838
|
-
"node_modules",
|
|
2839
|
-
".git",
|
|
2840
|
-
".nx",
|
|
2841
|
-
".cache",
|
|
2842
|
-
".storm",
|
|
2843
|
-
"tmp",
|
|
2844
|
-
"dist"
|
|
2845
|
-
]
|
|
2846
|
-
});
|
|
2847
|
-
return this.#checksum;
|
|
2848
|
-
}
|
|
2849
|
-
/**
|
|
2850
3009
|
* Initialize the context with the provided configuration options
|
|
2851
3010
|
*
|
|
2852
3011
|
* @param config - The partial user configuration to use for initialization.
|
|
@@ -3059,9 +3218,11 @@ function createPluginContext(plugin, environment) {
|
|
|
3059
3218
|
}, "normalizeMessage");
|
|
3060
3219
|
const log = environment.extendLog(plugin.name);
|
|
3061
3220
|
const callHookFn = /* @__PURE__ */ chunkSHUYVCID_js.__name(async (hook, options, ...args) => {
|
|
3062
|
-
return callHook(
|
|
3221
|
+
return environment.$$internal.api.callHook(hook, {
|
|
3063
3222
|
sequential: true,
|
|
3064
|
-
|
|
3223
|
+
result: "merge",
|
|
3224
|
+
...options,
|
|
3225
|
+
environment
|
|
3065
3226
|
}, ...args);
|
|
3066
3227
|
}, "callHookFn");
|
|
3067
3228
|
return new Proxy({}, {
|
|
@@ -3444,7 +3605,11 @@ var PowerlinesAPI = class _PowerlinesAPI {
|
|
|
3444
3605
|
this.#context = context;
|
|
3445
3606
|
}
|
|
3446
3607
|
/**
|
|
3447
|
-
* Initialize
|
|
3608
|
+
* Initialize a Powerlines API instance
|
|
3609
|
+
*
|
|
3610
|
+
* @param workspaceRoot - The directory of the underlying workspace the Powerlines project exists in
|
|
3611
|
+
* @param config - An object containing the configuration required to run Powerlines tasks.
|
|
3612
|
+
* @returns A new instance of the Powerlines API
|
|
3448
3613
|
*/
|
|
3449
3614
|
static async from(workspaceRoot, config) {
|
|
3450
3615
|
const api = new _PowerlinesAPI(await PowerlinesAPIContext.from(workspaceRoot, config));
|
|
@@ -3572,9 +3737,13 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3572
3737
|
let generatedTypes = await emitTypes(context, files);
|
|
3573
3738
|
context.log(types.LogLevelLabel.TRACE, `Generating TypeScript declaration file ${context.dtsPath}.`);
|
|
3574
3739
|
const directives = [];
|
|
3740
|
+
const asNextParam = /* @__PURE__ */ chunkSHUYVCID_js.__name((previousResult) => isObject.isObject(previousResult) ? previousResult.code : previousResult, "asNextParam");
|
|
3575
3741
|
let result = await this.callHook("generateTypes", {
|
|
3576
3742
|
environment: context,
|
|
3577
|
-
|
|
3743
|
+
sequential: true,
|
|
3744
|
+
order: "pre",
|
|
3745
|
+
result: "merge",
|
|
3746
|
+
asNextParam
|
|
3578
3747
|
}, generatedTypes);
|
|
3579
3748
|
if (result) {
|
|
3580
3749
|
if (isSetObject.isSetObject(result)) {
|
|
@@ -3588,7 +3757,10 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3588
3757
|
}
|
|
3589
3758
|
result = await this.callHook("generateTypes", {
|
|
3590
3759
|
environment: context,
|
|
3591
|
-
|
|
3760
|
+
sequential: true,
|
|
3761
|
+
order: "normal",
|
|
3762
|
+
result: "merge",
|
|
3763
|
+
asNextParam
|
|
3592
3764
|
}, generatedTypes);
|
|
3593
3765
|
if (result) {
|
|
3594
3766
|
if (isSetObject.isSetObject(result)) {
|
|
@@ -3602,7 +3774,10 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3602
3774
|
}
|
|
3603
3775
|
result = await this.callHook("generateTypes", {
|
|
3604
3776
|
environment: context,
|
|
3605
|
-
|
|
3777
|
+
sequential: true,
|
|
3778
|
+
order: "post",
|
|
3779
|
+
result: "merge",
|
|
3780
|
+
asNextParam
|
|
3606
3781
|
}, generatedTypes);
|
|
3607
3782
|
if (result) {
|
|
3608
3783
|
if (isSetObject.isSetObject(result)) {
|
|
@@ -3614,15 +3789,24 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3614
3789
|
generatedTypes = result;
|
|
3615
3790
|
}
|
|
3616
3791
|
}
|
|
3617
|
-
|
|
3792
|
+
if (generatedTypes?.trim() || directives.length > 0) {
|
|
3793
|
+
await context.fs.write(context.dtsPath, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
|
|
3618
3794
|
|
|
3619
3795
|
` : ""}${getFileHeader(context, {
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3796
|
+
directive: null,
|
|
3797
|
+
prettierIgnore: false
|
|
3798
|
+
})}
|
|
3623
3799
|
|
|
3624
3800
|
${formatTypes(generatedTypes)}
|
|
3625
3801
|
`);
|
|
3802
|
+
} else {
|
|
3803
|
+
const dtsRelativePath = getTsconfigDtsPath(context);
|
|
3804
|
+
if (context.tsconfig.tsconfigJson.include && isIncludeMatchFound(dtsRelativePath, context.tsconfig.tsconfigJson.include)) {
|
|
3805
|
+
const normalizedDtsRelativePath = dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath;
|
|
3806
|
+
context.tsconfig.tsconfigJson.include = context.tsconfig.tsconfigJson.include.filter((includeValue) => includeValue?.toString() !== normalizedDtsRelativePath);
|
|
3807
|
+
await context.fs.write(context.tsconfig.tsconfigFilePath, JSON.stringify(context.tsconfig.tsconfigJson, null, 2));
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3626
3810
|
}
|
|
3627
3811
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
3628
3812
|
if (!context.tsconfig) {
|
|
@@ -3659,7 +3843,7 @@ ${formatTypes(generatedTypes)}
|
|
|
3659
3843
|
for (const file of files) {
|
|
3660
3844
|
context.log(types.LogLevelLabel.TRACE, `Adding template file: ${file}`);
|
|
3661
3845
|
const template = Handlebars__default.default.compile(file);
|
|
3662
|
-
await
|
|
3846
|
+
await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
3663
3847
|
}
|
|
3664
3848
|
await this.callHook("new", {
|
|
3665
3849
|
environment: context,
|
|
@@ -3670,14 +3854,14 @@ ${formatTypes(generatedTypes)}
|
|
|
3670
3854
|
for (const file of files2) {
|
|
3671
3855
|
context.log(types.LogLevelLabel.TRACE, `Adding application template file: ${file}`);
|
|
3672
3856
|
const template = Handlebars__default.default.compile(file);
|
|
3673
|
-
await
|
|
3857
|
+
await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
3674
3858
|
}
|
|
3675
3859
|
} else {
|
|
3676
3860
|
const files2 = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/library/**/*.hbs"));
|
|
3677
3861
|
for (const file of files2) {
|
|
3678
3862
|
context.log(types.LogLevelLabel.TRACE, `Adding library template file: ${file}`);
|
|
3679
3863
|
const template = Handlebars__default.default.compile(file);
|
|
3680
|
-
await
|
|
3864
|
+
await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
3681
3865
|
}
|
|
3682
3866
|
}
|
|
3683
3867
|
await this.callHook("new", {
|