@powerlines/nx 0.11.216 → 0.11.218
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-Q6ARGUEG.js → chunk-2VN57DMC.js} +2 -2
- package/dist/chunk-3BI2YVJ3.js +156 -0
- package/dist/{chunk-LQ6NEJBJ.js → chunk-3TZVQPPH.js} +2 -2
- package/dist/chunk-4OMPO3GC.mjs +154 -0
- package/dist/{chunk-QZQ42FLG.mjs → chunk-5NHMBXXZ.mjs} +1 -1
- package/dist/{chunk-NJFLBZ5O.mjs → chunk-CINC3R52.mjs} +1 -1
- package/dist/{chunk-HXG555M5.mjs → chunk-EFG2AWKX.mjs} +220 -388
- package/dist/{chunk-TWOXCXFE.js → chunk-EQMUIUSF.js} +16 -16
- package/dist/{chunk-DPLLKEJ7.mjs → chunk-ETYR57U3.mjs} +2 -2
- package/dist/chunk-FSGRYCTL.js +281 -0
- package/dist/{chunk-2YJP4HRC.mjs → chunk-GCIPEE4T.mjs} +7 -7
- package/dist/{chunk-ELBUYWVF.mjs → chunk-GKRW32W2.mjs} +1 -1
- package/dist/{chunk-D4FP3KIU.mjs → chunk-H7FXL53F.mjs} +1 -1
- package/dist/{chunk-VSMLSWBT.js → chunk-IOBDAGVL.js} +8 -8
- package/dist/{chunk-POEOITLM.js → chunk-JCB2SUGI.js} +2 -2
- package/dist/{chunk-2W2T5G3F.js → chunk-JFLVE4R6.js} +2 -2
- package/dist/chunk-JL4HQ7ZD.mjs +260 -0
- package/dist/{chunk-WJP3FWAH.js → chunk-MDVQOPYK.js} +2 -2
- package/dist/{chunk-ZYOL33SX.mjs → chunk-RQR4JLRG.mjs} +15 -15
- package/dist/{chunk-ELR7ZJ3T.js → chunk-VNEJ2D4E.js} +3 -3
- package/dist/{chunk-T36V4JK7.mjs → chunk-XX6ZLY4D.mjs} +1 -1
- package/dist/{chunk-MV4TOX46.js → chunk-ZVVHO24E.js} +244 -412
- package/dist/{executor-Bb8vGV8C.d.ts → executor-AQVlPFta.d.ts} +90 -19
- package/dist/{executor-CQzw0-So.d.mts → executor-BNmIhtpF.d.mts} +90 -19
- package/dist/{executor-DwTFXSVb.d.mts → executor-C0A5mFLO.d.mts} +74 -19
- package/dist/{executor-u-vw0Uzf.d.mts → executor-Cep8-Y3A.d.mts} +90 -19
- package/dist/{executor-DY7vA66P.d.ts → executor-CkyahICv.d.ts} +74 -19
- package/dist/{executor-C2WSCUOW.d.ts → executor-DOsxw-Ih.d.ts} +90 -19
- package/dist/{executor-C5rCem7d.d.ts → executor-DUQbjUVt.d.ts} +90 -19
- package/dist/{executor-C9MI57kJ.d.ts → executor-O3MDQSFT.d.ts} +90 -19
- package/dist/{executor-fccJAIjg.d.mts → executor-U4mVkhQK.d.mts} +90 -19
- package/dist/{executor-DXaEo8YG.d.mts → executor-Xt5qNzC5.d.mts} +90 -19
- package/dist/executors.d.mts +5 -6
- package/dist/executors.d.ts +5 -6
- package/dist/executors.js +12 -12
- package/dist/executors.mjs +7 -7
- package/dist/index.d.mts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.js +15 -15
- package/dist/index.mjs +9 -9
- package/dist/src/base/base-executor.d.mts +1 -2
- package/dist/src/base/base-executor.d.ts +1 -2
- package/dist/src/base/base-executor.js +3 -3
- package/dist/src/base/base-executor.mjs +2 -2
- package/dist/src/base/base-executor.schema.d.d.mts +74 -19
- package/dist/src/base/base-executor.schema.d.d.ts +74 -19
- package/dist/src/base/base-executor.schema.d.ts +74 -19
- package/dist/src/base/base-executor.schema.json +108 -26
- package/dist/src/base/base-executor.untyped.js +2 -2
- package/dist/src/base/base-executor.untyped.mjs +1 -1
- package/dist/src/executors/build/executor.d.mts +1 -2
- package/dist/src/executors/build/executor.d.ts +1 -2
- package/dist/src/executors/build/executor.js +5 -5
- package/dist/src/executors/build/executor.mjs +3 -3
- package/dist/src/executors/build/schema.d.ts +90 -19
- package/dist/src/executors/build/schema.json +119 -25
- package/dist/src/executors/build/untyped.js +3 -3
- package/dist/src/executors/build/untyped.mjs +2 -2
- package/dist/src/executors/clean/executor.d.mts +1 -2
- package/dist/src/executors/clean/executor.d.ts +1 -2
- package/dist/src/executors/clean/executor.js +5 -5
- package/dist/src/executors/clean/executor.mjs +3 -3
- package/dist/src/executors/clean/schema.d.ts +74 -19
- package/dist/src/executors/clean/schema.json +108 -26
- package/dist/src/executors/clean/untyped.js +2 -2
- package/dist/src/executors/clean/untyped.mjs +1 -1
- package/dist/src/executors/docs/executor.d.mts +1 -2
- package/dist/src/executors/docs/executor.d.ts +1 -2
- package/dist/src/executors/docs/executor.js +5 -5
- package/dist/src/executors/docs/executor.mjs +3 -3
- package/dist/src/executors/docs/schema.d.ts +90 -19
- package/dist/src/executors/docs/schema.json +120 -26
- package/dist/src/executors/docs/untyped.js +3 -3
- package/dist/src/executors/docs/untyped.mjs +2 -2
- package/dist/src/executors/lint/executor.d.mts +1 -2
- package/dist/src/executors/lint/executor.d.ts +1 -2
- package/dist/src/executors/lint/executor.js +5 -5
- package/dist/src/executors/lint/executor.mjs +3 -3
- package/dist/src/executors/lint/schema.d.ts +90 -19
- package/dist/src/executors/lint/schema.json +120 -26
- package/dist/src/executors/lint/untyped.js +3 -3
- package/dist/src/executors/lint/untyped.mjs +2 -2
- package/dist/src/executors/prepare/executor.d.mts +1 -2
- package/dist/src/executors/prepare/executor.d.ts +1 -2
- package/dist/src/executors/prepare/executor.js +5 -5
- package/dist/src/executors/prepare/executor.mjs +3 -3
- package/dist/src/executors/prepare/schema.d.ts +90 -19
- package/dist/src/executors/prepare/schema.json +120 -26
- package/dist/src/executors/prepare/untyped.js +3 -3
- package/dist/src/executors/prepare/untyped.mjs +2 -2
- package/dist/src/helpers/plugin-utilities.js +5 -5
- package/dist/src/helpers/plugin-utilities.mjs +2 -2
- package/dist/src/plugin/index.js +4 -4
- package/dist/src/plugin/index.mjs +3 -3
- package/docs/api/base-executor.schema.md +71 -19
- package/docs/api/build/schema.md +89 -19
- package/docs/api/clean/schema.md +71 -19
- package/docs/api/docs/schema.md +89 -19
- package/docs/api/lint/schema.md +89 -19
- package/docs/api/prepare/schema.md +89 -19
- package/package.json +11 -11
- package/dist/chunk-AGZ4P3AS.mjs +0 -87
- package/dist/chunk-IR6TAW72.js +0 -81
- package/dist/chunk-NU3VTAH5.js +0 -98
- package/dist/chunk-XXWF7X5C.mjs +0 -75
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { loadWorkspaceConfig, CACHE_HASH_LENGTH,
|
|
1
|
+
import { replacePathTokens, extendLog, format, loadWorkspaceConfig, resolveEntriesSync, CACHE_HASH_LENGTH, ROOT_HASH_LENGTH, createLog, loadUserConfigFile, getUniqueInputs, GLOBAL_ENVIRONMENT, getFileHeader, formatFolder, DEFAULT_ENVIRONMENT } from './chunk-JL4HQ7ZD.mjs';
|
|
2
2
|
import { __name } from './chunk-O6YSETKJ.mjs';
|
|
3
|
-
import {
|
|
3
|
+
import { 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
6
|
import defu7, { createDefu, defu } from 'defu';
|
|
@@ -24,27 +24,31 @@ import { isSet } from '@stryke/type-checks/is-set';
|
|
|
24
24
|
import { isSetObject } from '@stryke/type-checks/is-set-object';
|
|
25
25
|
import { isSetString } from '@stryke/type-checks/is-set-string';
|
|
26
26
|
import { isString } from '@stryke/type-checks/is-string';
|
|
27
|
-
import
|
|
27
|
+
import chalk4 from 'chalk';
|
|
28
28
|
import Handlebars from 'handlebars';
|
|
29
29
|
import { hasFileExtension, findFilePath, findFileName, findFileExtensionSafe, findFileDotExtensionSafe, relativePath } from '@stryke/path/file-path-fns';
|
|
30
30
|
import { isParentPath } from '@stryke/path/is-parent-path';
|
|
31
31
|
import { prettyBytes } from '@stryke/string-format/pretty-bytes';
|
|
32
32
|
import { InMemoryFileSystemHost, Project, DiagnosticCategory } from 'ts-morph';
|
|
33
|
+
import { getUnique, getUniqueBy } from '@stryke/helpers/get-unique';
|
|
34
|
+
import { isRegExp } from '@stryke/type-checks/is-regexp';
|
|
33
35
|
import { isUndefined } from '@stryke/type-checks/is-undefined';
|
|
36
|
+
import { joinPaths } from '@stryke/path/join';
|
|
37
|
+
import { unlinkSync } from 'node:fs';
|
|
34
38
|
import { getPackageName, hasPackageVersion, getPackageVersion } from '@stryke/string-format/package';
|
|
35
|
-
import {
|
|
39
|
+
import { existsSync, exists } from '@stryke/fs/exists';
|
|
36
40
|
import { readJsonFile, readJsonFileSync } from '@stryke/fs/json';
|
|
41
|
+
import '@stryke/fs/remove-file';
|
|
42
|
+
import { kebabCase } from '@stryke/string-format/kebab-case';
|
|
43
|
+
import { getObjectDiff } from '@donedeal0/superdiff';
|
|
37
44
|
import { StormJSON } from '@stryke/json/storm-json';
|
|
38
45
|
import { titleCase } from '@stryke/string-format/title-case';
|
|
39
|
-
import { existsSync, exists } from '@stryke/fs/exists';
|
|
40
46
|
import ts from 'typescript';
|
|
41
47
|
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
42
48
|
import { getEnvPaths } from '@stryke/env/get-env-paths';
|
|
43
49
|
import { hashDirectory } from '@stryke/hash/hash-files';
|
|
44
50
|
import { murmurhash } from '@stryke/hash/murmurhash';
|
|
45
|
-
import { getUnique, getUniqueBy } from '@stryke/helpers/get-unique';
|
|
46
51
|
import { fetchRequest } from '@stryke/http/fetch';
|
|
47
|
-
import { joinPaths } from '@stryke/path/join';
|
|
48
52
|
import { isNull } from '@stryke/type-checks/is-null';
|
|
49
53
|
import { uuid } from '@stryke/unique-id/uuid';
|
|
50
54
|
import { tsconfigPathsToRegExp, match } from 'bundle-require';
|
|
@@ -53,30 +57,24 @@ import { create } from 'flat-cache';
|
|
|
53
57
|
import { parse } from 'oxc-parser';
|
|
54
58
|
import { Agent, setGlobalDispatcher, interceptors, Response } from 'undici';
|
|
55
59
|
import { createJiti } from 'jiti';
|
|
56
|
-
import { parseTypeDefinition } from '@stryke/convert/parse-type-definition';
|
|
57
|
-
import { isAbsolutePath } from '@stryke/path/is-type';
|
|
58
60
|
import * as $ from '@stryke/capnp';
|
|
59
61
|
import { readFileBuffer, readFileBufferSync, writeFileBuffer } from '@stryke/fs/buffer';
|
|
60
62
|
import { correctPath, stripStars } from '@stryke/path/correct-path';
|
|
61
63
|
import { globToRegex } from '@stryke/path/glob-to-regex';
|
|
62
|
-
import {
|
|
64
|
+
import { isAbsolutePath } from '@stryke/path/is-type';
|
|
65
|
+
import { slash } from '@stryke/path/slash';
|
|
63
66
|
import { Blob as Blob$1 } from 'node:buffer';
|
|
64
67
|
import { fileURLToPath } from 'node:url';
|
|
65
|
-
import { getColor } from '@storm-software/config-tools/utilities/colors';
|
|
66
|
-
import { noop } from '@stryke/helpers/noop';
|
|
67
|
-
import { kebabCase } from '@stryke/string-format/kebab-case';
|
|
68
|
-
import { resolveConfig, format as format$1 } from 'prettier';
|
|
69
|
-
import { slash } from '@stryke/path/slash';
|
|
70
68
|
import { isDirectory, isFile } from '@stryke/fs/is-file';
|
|
71
69
|
import { readFileSync, readFile } from '@stryke/fs/read-file';
|
|
72
70
|
import { writeFileSync, writeFile } from '@stryke/fs/write-file';
|
|
73
|
-
import { unlinkSync } from 'node:fs';
|
|
74
71
|
import { unlink } from 'node:fs/promises';
|
|
75
72
|
import { resolve } from 'node:path';
|
|
73
|
+
import 'unplugin';
|
|
76
74
|
|
|
77
75
|
// ../powerlines/package.json
|
|
78
76
|
var package_default = {
|
|
79
|
-
version: "0.38.
|
|
77
|
+
version: "0.38.57"};
|
|
80
78
|
var VirtualFileSystemHost = class extends InMemoryFileSystemHost {
|
|
81
79
|
static {
|
|
82
80
|
__name(this, "VirtualFileSystemHost");
|
|
@@ -183,7 +181,7 @@ function createProgram(context, override) {
|
|
|
183
181
|
}
|
|
184
182
|
__name(createProgram, "createProgram");
|
|
185
183
|
|
|
186
|
-
// ../powerlines/src/
|
|
184
|
+
// ../powerlines/src/_internal/helpers/generate-types.ts
|
|
187
185
|
var getModuleCommentBlockRegex = /* @__PURE__ */ __name((moduleId) => new RegExp(`\\/\\*\\*(?s:.)*?@module\\s+${moduleId}(?s:.)*?\\*\\/\\s+`), "getModuleCommentBlockRegex");
|
|
188
186
|
function formatTypes(code) {
|
|
189
187
|
return code.replace(
|
|
@@ -254,7 +252,20 @@ declare module "${moduleId}" {
|
|
|
254
252
|
}
|
|
255
253
|
__name(emitBuiltinTypes, "emitBuiltinTypes");
|
|
256
254
|
|
|
257
|
-
// ../
|
|
255
|
+
// ../core/src/types/commands.ts
|
|
256
|
+
var SUPPORTED_COMMANDS = [
|
|
257
|
+
"new",
|
|
258
|
+
"clean",
|
|
259
|
+
"prepare",
|
|
260
|
+
"lint",
|
|
261
|
+
"test",
|
|
262
|
+
"build",
|
|
263
|
+
"docs",
|
|
264
|
+
"deploy",
|
|
265
|
+
"finalize"
|
|
266
|
+
];
|
|
267
|
+
|
|
268
|
+
// ../core/src/types/unplugin.ts
|
|
258
269
|
var UNPLUGIN_BUILDER_VARIANTS = [
|
|
259
270
|
"rollup",
|
|
260
271
|
"webpack",
|
|
@@ -273,20 +284,7 @@ var BUILDER_VARIANTS = [
|
|
|
273
284
|
"unbuild"
|
|
274
285
|
];
|
|
275
286
|
|
|
276
|
-
// ../
|
|
277
|
-
var SUPPORTED_COMMANDS = [
|
|
278
|
-
"new",
|
|
279
|
-
"clean",
|
|
280
|
-
"prepare",
|
|
281
|
-
"lint",
|
|
282
|
-
"test",
|
|
283
|
-
"build",
|
|
284
|
-
"docs",
|
|
285
|
-
"deploy",
|
|
286
|
-
"finalize"
|
|
287
|
-
];
|
|
288
|
-
|
|
289
|
-
// ../powerlines/src/types/plugin.ts
|
|
287
|
+
// ../core/src/types/plugin.ts
|
|
290
288
|
var PLUGIN_NON_HOOK_FIELDS = [
|
|
291
289
|
"name",
|
|
292
290
|
"api",
|
|
@@ -308,7 +306,7 @@ var PLUGIN_HOOKS_FIELDS = [
|
|
|
308
306
|
"writeBundle"
|
|
309
307
|
];
|
|
310
308
|
|
|
311
|
-
// ../
|
|
309
|
+
// ../core/src/plugin-utils/helpers.ts
|
|
312
310
|
function isPlugin(value) {
|
|
313
311
|
return isSetObject(value) && "name" in value && isSetString(value.name) && (isUndefined(value.api) || "api" in value && isSetObject(value.api)) && (isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction(value.applyToEnvironment)) && (isUndefined(value.dedupe) || "dedupe" in value && isFunction(value.dedupe)) && PLUGIN_HOOKS_FIELDS.every((hook) => isUndefined(value[hook]) || hook in value && (isPluginHookFunction(value[hook]) || hook === "config" && isSetObject(value[hook]))) && BUILDER_VARIANTS.every((variant) => isUndefined(value[variant]) || variant in value && isSetObject(value[variant]));
|
|
314
312
|
}
|
|
@@ -390,7 +388,7 @@ function findInvalidPluginConfig(config) {
|
|
|
390
388
|
}
|
|
391
389
|
__name(findInvalidPluginConfig, "findInvalidPluginConfig");
|
|
392
390
|
|
|
393
|
-
// ../
|
|
391
|
+
// ../core/src/plugin-utils/merge.ts
|
|
394
392
|
createDefu((obj, key, value) => {
|
|
395
393
|
if (isPluginHook(obj[key]) && isPluginHook(value)) {
|
|
396
394
|
obj[key] = {
|
|
@@ -420,7 +418,7 @@ var mergeConfig = createDefu((obj, key, value) => {
|
|
|
420
418
|
return false;
|
|
421
419
|
});
|
|
422
420
|
|
|
423
|
-
// ../powerlines/src/
|
|
421
|
+
// ../powerlines/src/_internal/helpers/hooks.ts
|
|
424
422
|
var mergeResultObjects = createDefu((obj, key, value) => {
|
|
425
423
|
if (isString(obj[key]) && isString(value)) {
|
|
426
424
|
obj[key] = `${obj[key] || ""}
|
|
@@ -460,7 +458,7 @@ __name(mergeConfigs, "mergeConfigs");
|
|
|
460
458
|
async function callHook(context, key, options, ...args) {
|
|
461
459
|
const hooks = context.selectHooks(key, options);
|
|
462
460
|
if (hooks.length > 0) {
|
|
463
|
-
context.debug(` \u{1F9E9} Calling plugin hook: ${
|
|
461
|
+
context.debug(` \u{1F9E9} Calling plugin hook: ${chalk4.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)}`);
|
|
464
462
|
const invokeHook = /* @__PURE__ */ __name(async (hook, hookArgs) => {
|
|
465
463
|
return Reflect.apply(hook.handler, hook.context, hookArgs);
|
|
466
464
|
}, "invokeHook");
|
|
@@ -524,12 +522,12 @@ async function callHook(context, key, options, ...args) {
|
|
|
524
522
|
__name(callHook, "callHook");
|
|
525
523
|
async function installPackage(context, packageName, dev = false) {
|
|
526
524
|
if (!await isPackageListed(getPackageName(packageName), {
|
|
527
|
-
cwd: context.config.
|
|
525
|
+
cwd: context.config.root
|
|
528
526
|
})) {
|
|
529
527
|
if (context.config.autoInstall) {
|
|
530
528
|
context.warn(`The package "${packageName}" is not installed. It will be installed automatically.`);
|
|
531
529
|
const result = await install(packageName, {
|
|
532
|
-
cwd: context.config.
|
|
530
|
+
cwd: context.config.root,
|
|
533
531
|
dev
|
|
534
532
|
});
|
|
535
533
|
if (isNumber(result.exitCode) && result.exitCode > 0) {
|
|
@@ -540,10 +538,10 @@ async function installPackage(context, packageName, dev = false) {
|
|
|
540
538
|
context.warn(`The package "${packageName}" is not installed. Since the "autoInstall" option is set to false, it will not be installed automatically.`);
|
|
541
539
|
}
|
|
542
540
|
} else if (hasPackageVersion(packageName) && !process.env.POWERLINES_SKIP_VERSION_CHECK) {
|
|
543
|
-
const isMatching = await doesPackageMatch(getPackageName(packageName), getPackageVersion(packageName), context.config.
|
|
541
|
+
const isMatching = await doesPackageMatch(getPackageName(packageName), getPackageVersion(packageName), context.config.root);
|
|
544
542
|
if (!isMatching) {
|
|
545
543
|
const packageListing = await getPackageListing(getPackageName(packageName), {
|
|
546
|
-
cwd: context.config.
|
|
544
|
+
cwd: context.config.root
|
|
547
545
|
});
|
|
548
546
|
if (!packageListing?.version.startsWith("catalog:") && !packageListing?.version.startsWith("workspace:")) {
|
|
549
547
|
context.warn(`The package "${getPackageName(packageName)}" is installed but does not match the expected version ${getPackageVersion(packageName)} (installed version: ${packageListing?.version || "<Unknown>"}). Please ensure this is intentional before proceeding. Note: You can skip this validation with the "STORM_STACK_SKIP_VERSION_CHECK" environment variable.`);
|
|
@@ -553,7 +551,7 @@ async function installPackage(context, packageName, dev = false) {
|
|
|
553
551
|
}
|
|
554
552
|
__name(installPackage, "installPackage");
|
|
555
553
|
|
|
556
|
-
// ../powerlines/src/
|
|
554
|
+
// ../powerlines/src/_internal/helpers/install-dependencies.ts
|
|
557
555
|
async function installDependencies(context) {
|
|
558
556
|
context.debug(`Checking and installing missing project dependencies.`);
|
|
559
557
|
context.dependencies ??= {};
|
|
@@ -574,6 +572,17 @@ ${Object.entries(context.devDependencies).map(([name, version]) => `- ${name}@${
|
|
|
574
572
|
]);
|
|
575
573
|
}
|
|
576
574
|
__name(installDependencies, "installDependencies");
|
|
575
|
+
function getPrefixedRootHash(name, rootHash) {
|
|
576
|
+
const combined = `${kebabCase(name)}_${rootHash}`;
|
|
577
|
+
return combined.length > ROOT_HASH_LENGTH ? combined.slice(0, ROOT_HASH_LENGTH) : combined;
|
|
578
|
+
}
|
|
579
|
+
__name(getPrefixedRootHash, "getPrefixedRootHash");
|
|
580
|
+
async function writeMetaFile(context) {
|
|
581
|
+
const metaFilePath = joinPaths$1(context.dataPath, "meta.json");
|
|
582
|
+
context.debug(`Writing runtime metadata to ${metaFilePath}`);
|
|
583
|
+
await context.fs.write(metaFilePath, JSON.stringify(context.meta, null, 2));
|
|
584
|
+
}
|
|
585
|
+
__name(writeMetaFile, "writeMetaFile");
|
|
577
586
|
function getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
|
|
578
587
|
let tsconfigFilePath;
|
|
579
588
|
if (tsconfig) {
|
|
@@ -673,15 +682,15 @@ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && err
|
|
|
673
682
|
}
|
|
674
683
|
__name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
|
|
675
684
|
|
|
676
|
-
// ../powerlines/src/
|
|
685
|
+
// ../powerlines/src/_internal/helpers/resolve-tsconfig.ts
|
|
677
686
|
function getTsconfigDtsPath(context) {
|
|
678
|
-
const dtsRelativePath = joinPaths$1(relativePath(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.
|
|
687
|
+
const dtsRelativePath = joinPaths$1(relativePath(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.root), findFilePath(context.dtsPath)), findFileName(context.dtsPath));
|
|
679
688
|
return dtsRelativePath;
|
|
680
689
|
}
|
|
681
690
|
__name(getTsconfigDtsPath, "getTsconfigDtsPath");
|
|
682
691
|
async function resolveTsconfigChanges(context) {
|
|
683
|
-
const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.
|
|
684
|
-
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.
|
|
692
|
+
const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig, context.config.tsconfigRaw);
|
|
693
|
+
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig);
|
|
685
694
|
const tsconfigJson = await readJsonFile(tsconfigFilePath);
|
|
686
695
|
tsconfigJson.compilerOptions ??= {};
|
|
687
696
|
if (context.config.output.dts !== false) {
|
|
@@ -709,7 +718,7 @@ async function resolveTsconfigChanges(context) {
|
|
|
709
718
|
if (tsconfig.options.isolatedModules !== true) {
|
|
710
719
|
tsconfigJson.compilerOptions.isolatedModules = true;
|
|
711
720
|
}
|
|
712
|
-
if (context.config.
|
|
721
|
+
if (context.config.platform === "node") {
|
|
713
722
|
if (!tsconfig.options.types?.some((type) => type.toLowerCase() === "node" || type.toLowerCase() === "@types/node")) {
|
|
714
723
|
tsconfigJson.compilerOptions.types ??= [];
|
|
715
724
|
tsconfigJson.compilerOptions.types.push("node");
|
|
@@ -723,12 +732,12 @@ async function initializeTsconfig(context) {
|
|
|
723
732
|
if (!isPackageExists("typescript")) {
|
|
724
733
|
throw new Error('The TypeScript package is not installed. Please install the package using the command: "npm install typescript --save-dev"');
|
|
725
734
|
}
|
|
726
|
-
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.
|
|
735
|
+
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig);
|
|
727
736
|
context.tsconfig.originalTsconfigJson = await readJsonFile(tsconfigFilePath);
|
|
728
737
|
context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
|
|
729
738
|
context.debug("Writing updated TypeScript configuration (tsconfig.json) file to disk.");
|
|
730
739
|
await context.fs.write(tsconfigFilePath, StormJSON.stringify(context.tsconfig.tsconfigJson));
|
|
731
|
-
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.
|
|
740
|
+
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
|
|
732
741
|
}
|
|
733
742
|
__name(initializeTsconfig, "initializeTsconfig");
|
|
734
743
|
async function resolveTsconfig(context) {
|
|
@@ -770,31 +779,25 @@ async function resolveTsconfig(context) {
|
|
|
770
779
|
if (changes.length > 0) {
|
|
771
780
|
context.warn(`Updating the following configuration values in "${context.tsconfig.tsconfigFilePath}" file:
|
|
772
781
|
|
|
773
|
-
${changes.map((change, i) => `${
|
|
774
|
-
${
|
|
775
|
-
${
|
|
782
|
+
${changes.map((change, i) => `${chalk4.bold.whiteBright(`${i + 1}. ${titleCase(change.status)} the ${change.field} field: `)}
|
|
783
|
+
${chalk4.red(` - Previous: ${change.previous} `)}
|
|
784
|
+
${chalk4.green(` - Updated: ${change.current} `)}
|
|
776
785
|
`).join("\n")}
|
|
777
786
|
`);
|
|
778
787
|
}
|
|
779
788
|
await context.fs.write(context.tsconfig.tsconfigFilePath, StormJSON.stringify(updateTsconfigJson));
|
|
780
|
-
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.
|
|
789
|
+
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig);
|
|
781
790
|
if (!context.tsconfig) {
|
|
782
791
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
783
792
|
}
|
|
784
793
|
}
|
|
785
794
|
__name(resolveTsconfig, "resolveTsconfig");
|
|
786
|
-
|
|
787
|
-
// ../powerlines/src/lib/constants/environments.ts
|
|
788
|
-
var DEFAULT_ENVIRONMENT = "default";
|
|
789
|
-
var GLOBAL_ENVIRONMENT = "__global__";
|
|
790
|
-
|
|
791
|
-
// ../powerlines/src/internal/helpers/environment.ts
|
|
792
795
|
function createEnvironment(name, userConfig) {
|
|
793
796
|
return defu7(userConfig.environments?.[name] ?? {}, {
|
|
794
797
|
name,
|
|
795
798
|
title: userConfig.title || titleCase(userConfig.name),
|
|
796
799
|
ssr: false,
|
|
797
|
-
mainFields: userConfig
|
|
800
|
+
mainFields: userConfig?.platform === "browser" ? [
|
|
798
801
|
"browser",
|
|
799
802
|
"module",
|
|
800
803
|
"jsnext:main",
|
|
@@ -813,8 +816,8 @@ function createEnvironment(name, userConfig) {
|
|
|
813
816
|
".tsx",
|
|
814
817
|
".json"
|
|
815
818
|
],
|
|
816
|
-
consumer: userConfig
|
|
817
|
-
preview: userConfig
|
|
819
|
+
consumer: userConfig?.platform === "browser" ? "client" : "server",
|
|
820
|
+
preview: userConfig?.platform === "browser" ? {
|
|
818
821
|
port: 5173,
|
|
819
822
|
open: true,
|
|
820
823
|
strictPort: false,
|
|
@@ -841,81 +844,12 @@ function resolveOptions(options) {
|
|
|
841
844
|
});
|
|
842
845
|
}
|
|
843
846
|
__name(resolveOptions, "resolveOptions");
|
|
844
|
-
function createPluginResolver(options) {
|
|
845
|
-
return createJiti(joinPaths$1(options.workspaceRoot, options.projectRoot), resolveOptions({
|
|
846
|
-
...options
|
|
847
|
-
}));
|
|
848
|
-
}
|
|
849
|
-
__name(createPluginResolver, "createPluginResolver");
|
|
850
847
|
function createResolver(options) {
|
|
851
|
-
const baseResolver = createJiti(joinPaths$1(options.workspaceRoot, options.
|
|
852
|
-
baseResolver.plugin =
|
|
848
|
+
const baseResolver = createJiti(joinPaths$1(options.workspaceRoot, options.root), resolveOptions(options));
|
|
849
|
+
baseResolver.plugin = createJiti(joinPaths$1(options.workspaceRoot, options.root), resolveOptions(options));
|
|
853
850
|
return baseResolver;
|
|
854
851
|
}
|
|
855
852
|
__name(createResolver, "createResolver");
|
|
856
|
-
function replacePathTokens(context, path) {
|
|
857
|
-
if (!path) {
|
|
858
|
-
return path;
|
|
859
|
-
}
|
|
860
|
-
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}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
861
|
-
}
|
|
862
|
-
__name(replacePathTokens, "replacePathTokens");
|
|
863
|
-
function resolveEntryOutput(context, typeDefinition) {
|
|
864
|
-
return replaceExtension(replacePath(replacePath(replacePath(replacePath(replacePath(typeDefinition.file, joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.sourceRoot)), joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot)), context.config.sourceRoot), context.config.projectRoot), replacePath(context.config.sourceRoot, context.config.projectRoot)));
|
|
865
|
-
}
|
|
866
|
-
__name(resolveEntryOutput, "resolveEntryOutput");
|
|
867
|
-
function resolveEntry(context, typeDefinition, input, output) {
|
|
868
|
-
return {
|
|
869
|
-
...typeDefinition,
|
|
870
|
-
input: input ?? typeDefinition,
|
|
871
|
-
output: output || resolveEntryOutput(context, typeDefinition)
|
|
872
|
-
};
|
|
873
|
-
}
|
|
874
|
-
__name(resolveEntry, "resolveEntry");
|
|
875
|
-
function isTypeDefinition(entry) {
|
|
876
|
-
return !isString(entry) && entry.file !== void 0;
|
|
877
|
-
}
|
|
878
|
-
__name(isTypeDefinition, "isTypeDefinition");
|
|
879
|
-
function isResolvedEntryTypeDefinition(entry) {
|
|
880
|
-
return isTypeDefinition(entry) && entry.output !== void 0;
|
|
881
|
-
}
|
|
882
|
-
__name(isResolvedEntryTypeDefinition, "isResolvedEntryTypeDefinition");
|
|
883
|
-
function resolveEntriesSync(context, typeDefinitions) {
|
|
884
|
-
return typeDefinitions.map((entry) => {
|
|
885
|
-
if (isResolvedEntryTypeDefinition(entry)) {
|
|
886
|
-
return {
|
|
887
|
-
...entry,
|
|
888
|
-
output: entry.output ? replacePathTokens(context, entry.output) : void 0,
|
|
889
|
-
file: replacePathTokens(context, entry.file)
|
|
890
|
-
};
|
|
891
|
-
}
|
|
892
|
-
let typeDefinition;
|
|
893
|
-
if (isString(entry)) {
|
|
894
|
-
typeDefinition = parseTypeDefinition(replacePathTokens(context, entry));
|
|
895
|
-
} else {
|
|
896
|
-
typeDefinition = entry;
|
|
897
|
-
typeDefinition.file = replacePathTokens(context, typeDefinition.file);
|
|
898
|
-
}
|
|
899
|
-
const filePath = isAbsolutePath(typeDefinition.file) ? typeDefinition.file : appendPath(typeDefinition.file, context.config.projectRoot);
|
|
900
|
-
if (context.fs.isFileSync(filePath)) {
|
|
901
|
-
return resolveEntry(context, {
|
|
902
|
-
file: appendPath(filePath, context.workspaceConfig.workspaceRoot),
|
|
903
|
-
name: typeDefinition.name
|
|
904
|
-
});
|
|
905
|
-
}
|
|
906
|
-
return context.fs.globSync(appendPath(filePath, context.workspaceConfig.workspaceRoot)).map((file) => resolveEntry(context, {
|
|
907
|
-
file,
|
|
908
|
-
name: typeDefinition.name
|
|
909
|
-
}));
|
|
910
|
-
}).flat().filter(Boolean);
|
|
911
|
-
}
|
|
912
|
-
__name(resolveEntriesSync, "resolveEntriesSync");
|
|
913
|
-
function getUniqueEntries(entries = []) {
|
|
914
|
-
return getUniqueBy(toArray(entries), (item) => isSetString(item) ? item : murmurhash(item ?? {}, {
|
|
915
|
-
maxLength: 24
|
|
916
|
-
}));
|
|
917
|
-
}
|
|
918
|
-
__name(getUniqueEntries, "getUniqueEntries");
|
|
919
853
|
BigInt("0xa56c61324b9d6e49");
|
|
920
854
|
var FileMetadata_KeyValuePair = class extends $.Struct {
|
|
921
855
|
static {
|
|
@@ -1138,110 +1072,6 @@ FileMetadata._Properties = $.CompositeList(FileMetadata_KeyValuePair);
|
|
|
1138
1072
|
FileSystem._Ids = $.CompositeList(FileId);
|
|
1139
1073
|
FileSystem._Storage = $.CompositeList(FileStorage);
|
|
1140
1074
|
FileSystem._Metadata = $.CompositeList(FileMetadata);
|
|
1141
|
-
var createLog = /* @__PURE__ */ __name((name, options = {}) => {
|
|
1142
|
-
const logLevel = options.logLevel === null ? LogLevelLabel.SILENT : options.logLevel || LogLevelLabel.INFO;
|
|
1143
|
-
if (logLevel === LogLevelLabel.SILENT) {
|
|
1144
|
-
return noop;
|
|
1145
|
-
}
|
|
1146
|
-
if (options.customLogger) {
|
|
1147
|
-
return options.customLogger;
|
|
1148
|
-
}
|
|
1149
|
-
return (type, ...args) => getLogFn(getLogLevel(type), {
|
|
1150
|
-
...options,
|
|
1151
|
-
logLevel
|
|
1152
|
-
})(`${chalk5.bold.hex(getColor("brand", options))(`${name ? kebabCase(name) : ""}${options.name ? `${name ? chalk5.gray(" > ") : ""}${kebabCase(options.name)}` : ""}${chalk5.gray(" > ")}`)}${args.join(" ")} `.trim());
|
|
1153
|
-
}, "createLog");
|
|
1154
|
-
var BADGE_COLORS = [
|
|
1155
|
-
"#00A0DD",
|
|
1156
|
-
"#6FCE4E",
|
|
1157
|
-
"#FBBF24",
|
|
1158
|
-
"#F43F5E",
|
|
1159
|
-
"#3B82F6",
|
|
1160
|
-
"#A855F7",
|
|
1161
|
-
"#469592",
|
|
1162
|
-
"#288EDF",
|
|
1163
|
-
"#D8B4FE",
|
|
1164
|
-
"#10B981",
|
|
1165
|
-
"#EF4444",
|
|
1166
|
-
"#F0EC56",
|
|
1167
|
-
"#F472B6",
|
|
1168
|
-
"#22D3EE",
|
|
1169
|
-
"#EAB308",
|
|
1170
|
-
"#84CC16",
|
|
1171
|
-
"#F87171",
|
|
1172
|
-
"#0EA5E9",
|
|
1173
|
-
"#D946EF",
|
|
1174
|
-
"#FACC15",
|
|
1175
|
-
"#34D399",
|
|
1176
|
-
"#8B5CF6"
|
|
1177
|
-
];
|
|
1178
|
-
var extendLog = /* @__PURE__ */ __name((logFn, name) => {
|
|
1179
|
-
return (type, ...args) => logFn(type, ` ${chalk5.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase(name)} `)} ${args.join(" ")} `);
|
|
1180
|
-
}, "extendLog");
|
|
1181
|
-
async function format(context, path, data, force = false) {
|
|
1182
|
-
if (!force && (isParentPath(path, appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot)) || isParentPath(path, appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot)))) {
|
|
1183
|
-
return data;
|
|
1184
|
-
}
|
|
1185
|
-
let code = data;
|
|
1186
|
-
const resolvedConfig = await resolveConfig(path);
|
|
1187
|
-
if (resolvedConfig) {
|
|
1188
|
-
code = await format$1(data, {
|
|
1189
|
-
absolutePath: path,
|
|
1190
|
-
...resolvedConfig
|
|
1191
|
-
});
|
|
1192
|
-
}
|
|
1193
|
-
return code;
|
|
1194
|
-
}
|
|
1195
|
-
__name(format, "format");
|
|
1196
|
-
async function formatFolder(context, path) {
|
|
1197
|
-
if (!isParentPath(path, appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot)) && !isParentPath(path, appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot))) {
|
|
1198
|
-
await Promise.allSettled((await listFiles(path)).map(async (file) => {
|
|
1199
|
-
if (!isParentPath(file, appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot)) && !isParentPath(file, appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot))) {
|
|
1200
|
-
const data = await context.fs.read(file);
|
|
1201
|
-
if (data) {
|
|
1202
|
-
const formatted = await format(context, file, data);
|
|
1203
|
-
return context.fs.write(file, formatted);
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
}));
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
__name(formatFolder, "formatFolder");
|
|
1210
|
-
function isFileError(err) {
|
|
1211
|
-
return isError(err) && "code" in err && err.code;
|
|
1212
|
-
}
|
|
1213
|
-
__name(isFileError, "isFileError");
|
|
1214
|
-
function ignoreNotfound(err) {
|
|
1215
|
-
return isFileError(err) && (err.code === "ENOENT" || err.code === "EISDIR" ? null : err);
|
|
1216
|
-
}
|
|
1217
|
-
__name(ignoreNotfound, "ignoreNotfound");
|
|
1218
|
-
function toFilePath(path) {
|
|
1219
|
-
return correctPath(slash(path?.toString() || ".").replace(/^file:\/\//, ""));
|
|
1220
|
-
}
|
|
1221
|
-
__name(toFilePath, "toFilePath");
|
|
1222
|
-
function isValidId(id, prefix = "powerlines") {
|
|
1223
|
-
return id.replace(/^\\0/, "").startsWith(`${prefix.replace(/:$/, "")}`);
|
|
1224
|
-
}
|
|
1225
|
-
__name(isValidId, "isValidId");
|
|
1226
|
-
function normalizeId(id, prefix = "powerlines") {
|
|
1227
|
-
return replaceExtension(toFilePath(id)).replace(/^\\0/, "").replace(/^powerlines:/, "").replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), "");
|
|
1228
|
-
}
|
|
1229
|
-
__name(normalizeId, "normalizeId");
|
|
1230
|
-
function normalizePath(path, builtinsPath, prefix = "powerlines") {
|
|
1231
|
-
return isAbsolutePath(path) ? path : isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
|
|
1232
|
-
}
|
|
1233
|
-
__name(normalizePath, "normalizePath");
|
|
1234
|
-
function normalizeGlobPatterns(workspaceRoot, patterns) {
|
|
1235
|
-
return getUnique(toArray(patterns).map((pattern) => {
|
|
1236
|
-
if (isSetObject(pattern) && (isSetString(pattern.input) || isSetString(pattern.glob))) {
|
|
1237
|
-
return joinPaths(pattern.input || workspaceRoot, pattern.glob || "**/*");
|
|
1238
|
-
} else if (!isSetString(pattern)) {
|
|
1239
|
-
return void 0;
|
|
1240
|
-
}
|
|
1241
|
-
return pattern;
|
|
1242
|
-
}).filter(isSetString));
|
|
1243
|
-
}
|
|
1244
|
-
__name(normalizeGlobPatterns, "normalizeGlobPatterns");
|
|
1245
1075
|
var BaseStorageAdapter = class {
|
|
1246
1076
|
static {
|
|
1247
1077
|
__name(this, "BaseStorageAdapter");
|
|
@@ -1444,8 +1274,16 @@ var BaseStorageAdapter = class {
|
|
|
1444
1274
|
}
|
|
1445
1275
|
}
|
|
1446
1276
|
};
|
|
1277
|
+
function isFileError(err) {
|
|
1278
|
+
return isError(err) && "code" in err && err.code;
|
|
1279
|
+
}
|
|
1280
|
+
__name(isFileError, "isFileError");
|
|
1281
|
+
function ignoreNotfound(err) {
|
|
1282
|
+
return isFileError(err) && (err.code === "ENOENT" || err.code === "EISDIR" ? null : err);
|
|
1283
|
+
}
|
|
1284
|
+
__name(ignoreNotfound, "ignoreNotfound");
|
|
1447
1285
|
|
|
1448
|
-
// ../powerlines/src/
|
|
1286
|
+
// ../powerlines/src/storage/file-system.ts
|
|
1449
1287
|
var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
1450
1288
|
static {
|
|
1451
1289
|
__name(this, "FileSystemStorageAdapter");
|
|
@@ -1699,7 +1537,34 @@ var VirtualStorageAdapter = class extends BaseStorageAdapter {
|
|
|
1699
1537
|
}
|
|
1700
1538
|
};
|
|
1701
1539
|
|
|
1702
|
-
// ../powerlines/src/
|
|
1540
|
+
// ../powerlines/src/_internal/vfs.ts
|
|
1541
|
+
function toFilePath(path) {
|
|
1542
|
+
return correctPath(slash(path?.toString() || ".").replace(/^file:\/\//, ""));
|
|
1543
|
+
}
|
|
1544
|
+
__name(toFilePath, "toFilePath");
|
|
1545
|
+
function isValidId(id, prefix = "powerlines") {
|
|
1546
|
+
return id.replace(/^\\0/, "").startsWith(`${prefix.replace(/:$/, "")}`);
|
|
1547
|
+
}
|
|
1548
|
+
__name(isValidId, "isValidId");
|
|
1549
|
+
function normalizeId(id, prefix = "powerlines") {
|
|
1550
|
+
return replaceExtension(toFilePath(id)).replace(/^\\0/, "").replace(/^powerlines:/, "").replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), "");
|
|
1551
|
+
}
|
|
1552
|
+
__name(normalizeId, "normalizeId");
|
|
1553
|
+
function normalizePath(path, builtinsPath, prefix = "powerlines") {
|
|
1554
|
+
return isAbsolutePath(path) ? path : isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
|
|
1555
|
+
}
|
|
1556
|
+
__name(normalizePath, "normalizePath");
|
|
1557
|
+
function normalizeGlobPatterns(workspaceRoot, patterns) {
|
|
1558
|
+
return getUnique(toArray(patterns).map((pattern) => {
|
|
1559
|
+
if (isSetObject(pattern) && (isSetString(pattern.input) || isSetString(pattern.glob))) {
|
|
1560
|
+
return joinPaths(pattern.input || workspaceRoot, pattern.glob || "**/*");
|
|
1561
|
+
} else if (!isSetString(pattern)) {
|
|
1562
|
+
return void 0;
|
|
1563
|
+
}
|
|
1564
|
+
return pattern;
|
|
1565
|
+
}).filter(isSetString));
|
|
1566
|
+
}
|
|
1567
|
+
__name(normalizeGlobPatterns, "normalizeGlobPatterns");
|
|
1703
1568
|
var VirtualFileSystem = class _VirtualFileSystem {
|
|
1704
1569
|
static {
|
|
1705
1570
|
__name(this, "VirtualFileSystem");
|
|
@@ -1825,8 +1690,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1825
1690
|
static async create(context) {
|
|
1826
1691
|
context.debug("Starting virtual file system (VFS) initialization processes...");
|
|
1827
1692
|
let result;
|
|
1828
|
-
if (!context.config.skipCache && existsSync(joinPaths
|
|
1829
|
-
const buffer = await readFileBuffer(joinPaths
|
|
1693
|
+
if (!context.config.skipCache && existsSync(joinPaths(context.dataPath, "fs.bin"))) {
|
|
1694
|
+
const buffer = await readFileBuffer(joinPaths(context.dataPath, "fs.bin"));
|
|
1830
1695
|
const message = new $.Message(buffer, false);
|
|
1831
1696
|
const fs = message.getRoot(FileSystem);
|
|
1832
1697
|
result = new _VirtualFileSystem(context, fs);
|
|
@@ -1871,8 +1736,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1871
1736
|
static createSync(context) {
|
|
1872
1737
|
context.debug("Starting virtual file system (VFS) initialization processes...");
|
|
1873
1738
|
let result;
|
|
1874
|
-
if (!context.config.skipCache && existsSync(joinPaths
|
|
1875
|
-
const buffer = readFileBufferSync(joinPaths
|
|
1739
|
+
if (!context.config.skipCache && existsSync(joinPaths(context.dataPath, "fs.bin"))) {
|
|
1740
|
+
const buffer = readFileBufferSync(joinPaths(context.dataPath, "fs.bin"));
|
|
1876
1741
|
const message = new $.Message(buffer, false);
|
|
1877
1742
|
const fs = message.getRoot(FileSystem);
|
|
1878
1743
|
result = new _VirtualFileSystem(context, fs);
|
|
@@ -2514,9 +2379,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2514
2379
|
*/
|
|
2515
2380
|
resolveAlias(id) {
|
|
2516
2381
|
let path = id;
|
|
2517
|
-
if (this.#context.config.
|
|
2518
|
-
if (Array.isArray(this.#context.config.
|
|
2519
|
-
const found = this.#context.config.
|
|
2382
|
+
if (this.#context.config.resolve.alias) {
|
|
2383
|
+
if (Array.isArray(this.#context.config.resolve.alias) && this.#context.config.resolve.alias.length > 0) {
|
|
2384
|
+
const found = this.#context.config.resolve.alias.filter((alias) => isSetString(alias.find) && (alias.find === path || path.startsWith(`${alias.find}/`)) || isRegExp(alias.find) && alias.find.test(path));
|
|
2520
2385
|
if (found.length > 0) {
|
|
2521
2386
|
const alias = found.reduce((ret, current) => {
|
|
2522
2387
|
const retLength = isSetString(ret.find) ? ret.find.length : isRegExp(ret.find) ? ret.find.source.length : 0;
|
|
@@ -2529,13 +2394,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2529
2394
|
path = path.replace(alias.find, alias.replacement);
|
|
2530
2395
|
}
|
|
2531
2396
|
}
|
|
2532
|
-
} else if (isSetObject(this.#context.config.
|
|
2533
|
-
const found = Object.keys(this.#context.config.
|
|
2397
|
+
} else if (isSetObject(this.#context.config.resolve.alias)) {
|
|
2398
|
+
const found = Object.keys(this.#context.config.resolve.alias).filter((key) => key === path || path.startsWith(`${key}/`));
|
|
2534
2399
|
if (found.length > 0) {
|
|
2535
2400
|
const alias = found.reduce((ret, current) => {
|
|
2536
2401
|
return ret.length > current.length ? ret : current;
|
|
2537
2402
|
});
|
|
2538
|
-
path = path.replace(new RegExp(`^${alias}`), this.#context.config.
|
|
2403
|
+
path = path.replace(new RegExp(`^${alias}`), this.#context.config.resolve.alias[alias]);
|
|
2539
2404
|
}
|
|
2540
2405
|
}
|
|
2541
2406
|
}
|
|
@@ -2587,8 +2452,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2587
2452
|
paths.push(importer);
|
|
2588
2453
|
}
|
|
2589
2454
|
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2590
|
-
paths.push(appendPath(this.#context.config.
|
|
2591
|
-
paths.push(appendPath(this.#context.config.
|
|
2455
|
+
paths.push(appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot));
|
|
2456
|
+
paths.push(appendPath(joinPaths(this.#context.config.root, "src"), this.#context.workspaceConfig.workspaceRoot));
|
|
2592
2457
|
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) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
|
|
2593
2458
|
for (const combination of getResolutionCombinations(path, {
|
|
2594
2459
|
paths
|
|
@@ -2655,8 +2520,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2655
2520
|
paths.push(importer);
|
|
2656
2521
|
}
|
|
2657
2522
|
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2658
|
-
paths.push(appendPath(this.#context.config.
|
|
2659
|
-
paths.push(appendPath(this.#context.config.
|
|
2523
|
+
paths.push(appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot));
|
|
2524
|
+
paths.push(appendPath(joinPaths(this.#context.config.root, "src"), this.#context.workspaceConfig.workspaceRoot));
|
|
2660
2525
|
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) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
|
|
2661
2526
|
for (const combination of getResolutionCombinations(path, {
|
|
2662
2527
|
paths
|
|
@@ -2689,7 +2554,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2689
2554
|
if (!this.#isDisposed) {
|
|
2690
2555
|
this.#isDisposed = true;
|
|
2691
2556
|
this.#log(LogLevelLabel.DEBUG, "Disposing virtual file system...");
|
|
2692
|
-
await this.remove(joinPaths
|
|
2557
|
+
await this.remove(joinPaths(this.#context.dataPath, "fs.bin"));
|
|
2693
2558
|
const message = new $.Message();
|
|
2694
2559
|
const fs = message.initRoot(FileSystem);
|
|
2695
2560
|
const storage = fs._initStorage(Object.keys(this.#paths).length);
|
|
@@ -2720,7 +2585,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2720
2585
|
});
|
|
2721
2586
|
}
|
|
2722
2587
|
});
|
|
2723
|
-
await writeFileBuffer(joinPaths
|
|
2588
|
+
await writeFileBuffer(joinPaths(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
|
|
2724
2589
|
if (!this.#context.config.skipCache) {
|
|
2725
2590
|
this.#resolverCache.save(true);
|
|
2726
2591
|
}
|
|
@@ -2756,7 +2621,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2756
2621
|
}
|
|
2757
2622
|
};
|
|
2758
2623
|
|
|
2759
|
-
// ../powerlines/src/
|
|
2624
|
+
// ../powerlines/src/context/context.ts
|
|
2760
2625
|
var configCache = /* @__PURE__ */ new WeakMap();
|
|
2761
2626
|
var envPathCache = /* @__PURE__ */ new WeakMap();
|
|
2762
2627
|
var agent = new Agent({
|
|
@@ -2793,35 +2658,31 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2793
2658
|
#requestCache;
|
|
2794
2659
|
#getConfigProps(config = {}) {
|
|
2795
2660
|
return mergeConfig({
|
|
2796
|
-
|
|
2797
|
-
projectType: config.type,
|
|
2798
|
-
projectRoot: config.root,
|
|
2661
|
+
root: config.root,
|
|
2799
2662
|
name: config.name,
|
|
2800
2663
|
title: config.title,
|
|
2801
2664
|
organization: config.organization,
|
|
2802
2665
|
compatibilityDate: resolveCompatibilityDates(config.compatibilityDate, "latest"),
|
|
2803
2666
|
description: config.description,
|
|
2804
|
-
sourceRoot: config.sourceRoot,
|
|
2805
2667
|
configFile: config.configFile,
|
|
2668
|
+
projectType: config.projectType,
|
|
2806
2669
|
customLogger: config.customLogger,
|
|
2807
2670
|
logLevel: config.logLevel,
|
|
2808
2671
|
tsconfig: config.tsconfig,
|
|
2809
2672
|
tsconfigRaw: config.tsconfigRaw,
|
|
2810
2673
|
skipCache: config.skipCache,
|
|
2811
2674
|
autoInstall: config.autoInstall,
|
|
2812
|
-
|
|
2675
|
+
input: config.input,
|
|
2813
2676
|
output: config.output,
|
|
2814
2677
|
plugins: config.plugins,
|
|
2815
2678
|
mode: config.mode,
|
|
2816
|
-
|
|
2817
|
-
transform: config.transform,
|
|
2818
|
-
build: config.build,
|
|
2679
|
+
resolve: config.resolve,
|
|
2819
2680
|
framework: config.framework,
|
|
2820
2681
|
...config
|
|
2821
2682
|
}, {
|
|
2822
2683
|
output: config.framework ? {
|
|
2823
2684
|
artifactsPath: `.${config.framework ?? "powerlines"}`,
|
|
2824
|
-
dts: joinPaths(config.root ?? this.config.
|
|
2685
|
+
dts: joinPaths(config.root ?? this.config.root, `${config.framework ?? "powerlines"}.d.ts`)
|
|
2825
2686
|
} : {}
|
|
2826
2687
|
});
|
|
2827
2688
|
}
|
|
@@ -2900,8 +2761,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2900
2761
|
* The resolved entry type definitions for the project
|
|
2901
2762
|
*/
|
|
2902
2763
|
get entry() {
|
|
2903
|
-
const entry = this.
|
|
2904
|
-
return resolveEntriesSync(this,
|
|
2764
|
+
const entry = this.resolvedEntry;
|
|
2765
|
+
return resolveEntriesSync(this, entry && entry.length > 0 ? entry : Array.isArray(this.config.input) || isSetObject(this.config.input) && !isRegExp(this.config.input) ? this.config.input : toArray(this.config.input));
|
|
2905
2766
|
}
|
|
2906
2767
|
/**
|
|
2907
2768
|
* The TypeScript configuration parsed from the tsconfig file
|
|
@@ -2945,11 +2806,11 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2945
2806
|
releaseId: this.#releaseId,
|
|
2946
2807
|
checksum: this.#checksum,
|
|
2947
2808
|
timestamp: this.#timestamp,
|
|
2948
|
-
|
|
2809
|
+
rootHash: murmurhash({
|
|
2949
2810
|
workspaceRoot: this.workspaceConfig?.workspaceRoot,
|
|
2950
|
-
|
|
2811
|
+
root: this.config?.root
|
|
2951
2812
|
}, {
|
|
2952
|
-
maxLength:
|
|
2813
|
+
maxLength: ROOT_HASH_LENGTH
|
|
2953
2814
|
}),
|
|
2954
2815
|
configHash: murmurhash(this.config, {
|
|
2955
2816
|
maxLength: CACHE_HASH_LENGTH
|
|
@@ -3005,7 +2866,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3005
2866
|
* Get the path to the artifacts directory for the project
|
|
3006
2867
|
*/
|
|
3007
2868
|
get artifactsPath() {
|
|
3008
|
-
return joinPaths(this.workspaceConfig.workspaceRoot, this.config.
|
|
2869
|
+
return joinPaths(this.workspaceConfig.workspaceRoot, this.config.root, this.config.output.artifactsPath);
|
|
3009
2870
|
}
|
|
3010
2871
|
/**
|
|
3011
2872
|
* Get the path to the builtin modules used by the project
|
|
@@ -3023,7 +2884,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3023
2884
|
* Get the path to the data directory for the project
|
|
3024
2885
|
*/
|
|
3025
2886
|
get dataPath() {
|
|
3026
|
-
return joinPaths(this.envPaths.data, "projects",
|
|
2887
|
+
return joinPaths(this.envPaths.data, "projects", getPrefixedRootHash(this.config.name, this.meta.rootHash));
|
|
3027
2888
|
}
|
|
3028
2889
|
/**
|
|
3029
2890
|
* Get the path to the cache directory for the project
|
|
@@ -3040,13 +2901,13 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3040
2901
|
* Get the path to the generated declaration file for the project
|
|
3041
2902
|
*/
|
|
3042
2903
|
get dtsPath() {
|
|
3043
|
-
return this.config.output.dts ? appendPath(this.config.output.dts, this.workspaceConfig.workspaceRoot) : joinPaths(this.workspaceConfig.workspaceRoot, this.config.
|
|
2904
|
+
return this.config.output.dts ? appendPath(this.config.output.dts, this.workspaceConfig.workspaceRoot) : joinPaths(this.workspaceConfig.workspaceRoot, this.config.root, "powerlines.d.ts");
|
|
3044
2905
|
}
|
|
3045
2906
|
/**
|
|
3046
2907
|
* Get the project root relative to the workspace root
|
|
3047
2908
|
*/
|
|
3048
2909
|
get relativeToWorkspaceRoot() {
|
|
3049
|
-
return relativeToWorkspaceRoot(this.config.
|
|
2910
|
+
return relativeToWorkspaceRoot(this.config.root);
|
|
3050
2911
|
}
|
|
3051
2912
|
/**
|
|
3052
2913
|
* The builtin module id that exist in the Powerlines virtual file system
|
|
@@ -3070,12 +2931,12 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3070
2931
|
}
|
|
3071
2932
|
}
|
|
3072
2933
|
return ret;
|
|
3073
|
-
}, this.config.
|
|
2934
|
+
}, this.config.resolve.alias ? Array.isArray(this.config.resolve.alias) ? this.config.resolve.alias.reduce((ret, alias) => {
|
|
3074
2935
|
if (!ret[alias.find.toString()]) {
|
|
3075
2936
|
ret[alias.find.toString()] = alias.replacement;
|
|
3076
2937
|
}
|
|
3077
2938
|
return ret;
|
|
3078
|
-
}, {}) : this.config.
|
|
2939
|
+
}, {}) : this.config.resolve.alias : {});
|
|
3079
2940
|
}
|
|
3080
2941
|
/**
|
|
3081
2942
|
* Gets the parser cache.
|
|
@@ -3110,7 +2971,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3110
2971
|
/**
|
|
3111
2972
|
* The entry points that exist in the Powerlines virtual file system
|
|
3112
2973
|
*/
|
|
3113
|
-
get
|
|
2974
|
+
get resolvedEntry() {
|
|
3114
2975
|
return Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.type === "entry").map(([path, meta]) => {
|
|
3115
2976
|
const typeDefinition = {
|
|
3116
2977
|
file: path
|
|
@@ -3251,22 +3112,22 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3251
3112
|
*/
|
|
3252
3113
|
async resolve(id, importer, options = {}) {
|
|
3253
3114
|
let moduleId = id;
|
|
3254
|
-
if (this.config.
|
|
3255
|
-
if (Array.isArray(this.config.
|
|
3256
|
-
const alias = this.config.
|
|
3115
|
+
if (this.config.resolve.alias) {
|
|
3116
|
+
if (Array.isArray(this.config.resolve.alias)) {
|
|
3117
|
+
const alias = this.config.resolve.alias.find((a) => match(moduleId, [
|
|
3257
3118
|
a.find
|
|
3258
3119
|
]));
|
|
3259
3120
|
if (alias) {
|
|
3260
3121
|
moduleId = alias.replacement;
|
|
3261
3122
|
}
|
|
3262
|
-
} else if (isSetObject(this.config.
|
|
3263
|
-
moduleId = this.config.
|
|
3123
|
+
} else if (isSetObject(this.config.resolve.alias) && this.config.resolve.alias[id]) {
|
|
3124
|
+
moduleId = this.config.resolve.alias[id];
|
|
3264
3125
|
}
|
|
3265
3126
|
}
|
|
3266
3127
|
if (this.fs.isVirtual(moduleId)) {
|
|
3267
3128
|
const result = await this.fs.resolve(moduleId, importer, {
|
|
3268
|
-
conditions: this.config.
|
|
3269
|
-
extensions: this.config.
|
|
3129
|
+
conditions: this.config.resolve.conditions,
|
|
3130
|
+
extensions: this.config.resolve.extensions,
|
|
3270
3131
|
...options
|
|
3271
3132
|
});
|
|
3272
3133
|
if (!result) {
|
|
@@ -3277,11 +3138,11 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3277
3138
|
external: this.config.projectType !== "application"
|
|
3278
3139
|
};
|
|
3279
3140
|
}
|
|
3280
|
-
if (this.config.
|
|
3281
|
-
if (match(moduleId, this.resolvePatterns) || match(moduleId, this.config.
|
|
3141
|
+
if (this.config.resolve.skipNodeModulesBundle) {
|
|
3142
|
+
if (match(moduleId, this.resolvePatterns) || match(moduleId, this.config.resolve.noExternal)) {
|
|
3282
3143
|
return void 0;
|
|
3283
3144
|
}
|
|
3284
|
-
if (match(moduleId, this.config.
|
|
3145
|
+
if (match(moduleId, this.config.resolve.external) || moduleId.startsWith("node:")) {
|
|
3285
3146
|
return {
|
|
3286
3147
|
id: moduleId,
|
|
3287
3148
|
external: true
|
|
@@ -3294,10 +3155,10 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3294
3155
|
};
|
|
3295
3156
|
}
|
|
3296
3157
|
} else {
|
|
3297
|
-
if (match(moduleId, this.config.
|
|
3158
|
+
if (match(moduleId, this.config.resolve.noExternal)) {
|
|
3298
3159
|
return void 0;
|
|
3299
3160
|
}
|
|
3300
|
-
if (match(moduleId, this.config.
|
|
3161
|
+
if (match(moduleId, this.config.resolve.external) || moduleId.startsWith("node:")) {
|
|
3301
3162
|
return {
|
|
3302
3163
|
id: moduleId,
|
|
3303
3164
|
external: true
|
|
@@ -3581,7 +3442,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3581
3442
|
* @param root - The root directory of the project to generate the checksum for
|
|
3582
3443
|
* @returns A promise that resolves to a string representing the checksum
|
|
3583
3444
|
*/
|
|
3584
|
-
async generateChecksum(root = this.config.
|
|
3445
|
+
async generateChecksum(root = this.config.root) {
|
|
3585
3446
|
this.#checksum = await hashDirectory(root, {
|
|
3586
3447
|
ignore: [
|
|
3587
3448
|
"node_modules",
|
|
@@ -3627,13 +3488,13 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3627
3488
|
isHighPriority: true
|
|
3628
3489
|
}) {
|
|
3629
3490
|
const cacheKey = {
|
|
3630
|
-
|
|
3491
|
+
root: config.root ?? this.config.root ?? this.config.userConfig?.root ?? this.config.inlineConfig?.root,
|
|
3631
3492
|
mode: (config.mode ?? this.config.mode) || this.workspaceConfig.mode,
|
|
3632
3493
|
skipCache: config.skipCache ?? this.config.skipCache ?? false,
|
|
3633
3494
|
configFile: config.configFile ?? this.config.configFile,
|
|
3634
3495
|
framework: config.framework ?? this.config.framework ?? "powerlines",
|
|
3635
3496
|
command: this.config.inlineConfig?.command,
|
|
3636
|
-
alias: this.config.
|
|
3497
|
+
alias: this.config.resolve?.alias ?? config.resolve?.alias
|
|
3637
3498
|
};
|
|
3638
3499
|
if (configCache.has(cacheKey)) {
|
|
3639
3500
|
const result = configCache.get(cacheKey);
|
|
@@ -3643,28 +3504,28 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3643
3504
|
this.resolver = result.resolver;
|
|
3644
3505
|
this.mergeUserConfig(result.userConfig.config, this.config.userConfig);
|
|
3645
3506
|
} else {
|
|
3646
|
-
const projectJsonPath = joinPaths(cacheKey.
|
|
3507
|
+
const projectJsonPath = joinPaths(cacheKey.root, "project.json");
|
|
3647
3508
|
if (existsSync(projectJsonPath)) {
|
|
3648
3509
|
this.projectJson = await readJsonFile(projectJsonPath);
|
|
3649
3510
|
}
|
|
3650
|
-
const packageJsonPath = joinPaths(cacheKey.
|
|
3511
|
+
const packageJsonPath = joinPaths(cacheKey.root, "package.json");
|
|
3651
3512
|
if (existsSync(packageJsonPath)) {
|
|
3652
3513
|
this.packageJson = await readJsonFile(packageJsonPath);
|
|
3653
3514
|
}
|
|
3654
|
-
this.#checksum = await this.generateChecksum(cacheKey.
|
|
3515
|
+
this.#checksum = await this.generateChecksum(cacheKey.root);
|
|
3655
3516
|
this.resolver = createResolver({
|
|
3656
3517
|
workspaceRoot: this.workspaceConfig.workspaceRoot,
|
|
3657
|
-
|
|
3518
|
+
root: cacheKey.root,
|
|
3658
3519
|
cacheDir: this.cachePath,
|
|
3659
3520
|
mode: cacheKey.mode,
|
|
3660
3521
|
logLevel: config.logLevel || this.config.logLevel || this.workspaceConfig.logLevel || "info",
|
|
3661
3522
|
skipCache: cacheKey.skipCache,
|
|
3662
|
-
alias: this.config.
|
|
3523
|
+
alias: this.config.resolve?.alias ? Array.isArray(this.config.resolve.alias) ? this.config.resolve.alias.reduce((ret, alias) => {
|
|
3663
3524
|
ret[alias.find.toString()] = alias.replacement;
|
|
3664
3525
|
return ret;
|
|
3665
|
-
}, {}) : this.config.
|
|
3526
|
+
}, {}) : this.config.resolve.alias : {}
|
|
3666
3527
|
});
|
|
3667
|
-
const userConfig = await loadUserConfigFile(cacheKey.
|
|
3528
|
+
const userConfig = await loadUserConfigFile(cacheKey.root, this.workspaceConfig.workspaceRoot, this.resolver, cacheKey.command, cacheKey.mode, cacheKey.configFile, cacheKey.framework);
|
|
3668
3529
|
this.mergeUserConfig(userConfig.config);
|
|
3669
3530
|
configCache.set(cacheKey, {
|
|
3670
3531
|
projectJson: this.projectJson,
|
|
@@ -3674,14 +3535,14 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3674
3535
|
userConfig
|
|
3675
3536
|
});
|
|
3676
3537
|
}
|
|
3677
|
-
config.tsconfig ??= getTsconfigFilePath(this.workspaceConfig.workspaceRoot, cacheKey.
|
|
3538
|
+
config.tsconfig ??= getTsconfigFilePath(this.workspaceConfig.workspaceRoot, cacheKey.root, config.tsconfig);
|
|
3678
3539
|
if (isSetObject(config)) {
|
|
3679
3540
|
this.resolvedConfig = mergeConfig({
|
|
3680
3541
|
inlineConfig: this.config.inlineConfig,
|
|
3681
3542
|
userConfig: this.config.userConfig
|
|
3682
3543
|
}, options.isHighPriority ? this.#getConfigProps(config) : {}, {
|
|
3683
|
-
|
|
3684
|
-
|
|
3544
|
+
...this.#getConfigProps(this.config.inlineConfig),
|
|
3545
|
+
command: this.config.inlineConfig?.command
|
|
3685
3546
|
}, this.#getConfigProps(this.config.userConfig), {
|
|
3686
3547
|
mode: this.workspaceConfig?.mode,
|
|
3687
3548
|
logLevel: this.workspaceConfig?.logLevel,
|
|
@@ -3690,21 +3551,20 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3690
3551
|
name: this.projectJson?.name || this.packageJson?.name,
|
|
3691
3552
|
version: this.packageJson?.version,
|
|
3692
3553
|
description: this.packageJson?.description,
|
|
3693
|
-
sourceRoot: this.projectJson?.sourceRoot || appendPath("src", cacheKey.projectRoot),
|
|
3694
3554
|
output: mergeConfig(config.output ?? {}, {
|
|
3695
|
-
outputPath: cacheKey.
|
|
3555
|
+
outputPath: cacheKey.root ? joinPaths(this.workspaceConfig?.directories?.build || "dist", cacheKey.root) : this.workspaceConfig?.directories?.build || "dist",
|
|
3696
3556
|
artifactsPath: `.${config.framework ?? "powerlines"}`,
|
|
3697
|
-
dts: joinPaths(cacheKey.
|
|
3557
|
+
dts: joinPaths(cacheKey.root, `${config.framework ?? "powerlines"}.d.ts`),
|
|
3698
3558
|
assets: [
|
|
3699
3559
|
{
|
|
3700
3560
|
glob: "LICENSE"
|
|
3701
3561
|
},
|
|
3702
3562
|
{
|
|
3703
|
-
input: cacheKey.
|
|
3563
|
+
input: cacheKey.root,
|
|
3704
3564
|
glob: "*.md"
|
|
3705
3565
|
},
|
|
3706
3566
|
{
|
|
3707
|
-
input: cacheKey.
|
|
3567
|
+
input: cacheKey.root,
|
|
3708
3568
|
glob: "package.json"
|
|
3709
3569
|
}
|
|
3710
3570
|
]
|
|
@@ -3715,42 +3575,30 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3715
3575
|
framework: "powerlines",
|
|
3716
3576
|
mode: "production",
|
|
3717
3577
|
projectType: "application",
|
|
3578
|
+
platform: "neutral",
|
|
3718
3579
|
logLevel: "info",
|
|
3719
3580
|
preview: false,
|
|
3720
3581
|
environments: {},
|
|
3721
|
-
|
|
3722
|
-
babel: {
|
|
3723
|
-
plugins: [],
|
|
3724
|
-
presets: []
|
|
3725
|
-
}
|
|
3726
|
-
},
|
|
3727
|
-
lint: {
|
|
3728
|
-
eslint: {}
|
|
3729
|
-
},
|
|
3730
|
-
build: {
|
|
3731
|
-
target: "esnext",
|
|
3732
|
-
platform: "neutral",
|
|
3733
|
-
override: {}
|
|
3734
|
-
}
|
|
3582
|
+
resolve: {}
|
|
3735
3583
|
});
|
|
3736
3584
|
}
|
|
3737
|
-
this.config.
|
|
3585
|
+
this.config.input = getUniqueInputs(this.config.input);
|
|
3738
3586
|
if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) {
|
|
3739
3587
|
this.config.name = this.config.name.split("/").filter(Boolean)[1];
|
|
3740
3588
|
}
|
|
3741
3589
|
this.config.title ??= titleCase(this.config.name);
|
|
3742
3590
|
this.config.organization ??= (isSetObject(this.workspaceConfig.organization) ? this.workspaceConfig.organization.name : this.workspaceConfig.organization) || (isSetObject(this.packageJson?.author) ? this.packageJson?.author?.name : this.packageJson?.author) || this.config.name;
|
|
3743
|
-
if (this.config.userConfig.
|
|
3744
|
-
this.config.userConfig.
|
|
3591
|
+
if (this.config.userConfig.resolve?.external) {
|
|
3592
|
+
this.config.userConfig.resolve.external = getUnique(this.config.userConfig.resolve.external);
|
|
3745
3593
|
}
|
|
3746
|
-
if (this.config.userConfig.
|
|
3747
|
-
this.config.userConfig.
|
|
3594
|
+
if (this.config.userConfig.resolve?.noExternal) {
|
|
3595
|
+
this.config.userConfig.resolve.noExternal = getUnique(this.config.userConfig.resolve.noExternal);
|
|
3748
3596
|
}
|
|
3749
|
-
if (this.config.
|
|
3750
|
-
this.config.
|
|
3597
|
+
if (this.config.resolve.external) {
|
|
3598
|
+
this.config.resolve.external = getUnique(this.config.resolve.external);
|
|
3751
3599
|
}
|
|
3752
|
-
if (this.config.
|
|
3753
|
-
this.config.
|
|
3600
|
+
if (this.config.resolve.noExternal) {
|
|
3601
|
+
this.config.resolve.noExternal = getUnique(this.config.resolve.noExternal);
|
|
3754
3602
|
}
|
|
3755
3603
|
this.config.output.format = getUnique(toArray(this.config.output?.format ?? (this.config.projectType === "library" ? [
|
|
3756
3604
|
"cjs",
|
|
@@ -3758,9 +3606,9 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3758
3606
|
] : [
|
|
3759
3607
|
"esm"
|
|
3760
3608
|
])));
|
|
3761
|
-
if (this.config.
|
|
3762
|
-
this.config.output.outputPath ??= joinPaths("dist", this.config.
|
|
3763
|
-
this.config.output.buildPath ??= joinPaths(this.config.
|
|
3609
|
+
if (this.config.root && this.config.root !== "." && this.config.root !== "./" && this.config.root !== this.workspaceConfig.workspaceRoot) {
|
|
3610
|
+
this.config.output.outputPath ??= joinPaths("dist", this.config.root);
|
|
3611
|
+
this.config.output.buildPath ??= joinPaths(this.config.root, "dist");
|
|
3764
3612
|
} else {
|
|
3765
3613
|
this.config.output.outputPath ??= "dist";
|
|
3766
3614
|
this.config.output.buildPath ??= "dist";
|
|
@@ -3787,12 +3635,9 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3787
3635
|
if (isSetString(this.config.output.dts)) {
|
|
3788
3636
|
this.config.output.dts = replacePathTokens(this, this.config.output.dts);
|
|
3789
3637
|
} else {
|
|
3790
|
-
this.config.output.dts = joinPaths(this.config.
|
|
3638
|
+
this.config.output.dts = joinPaths(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`);
|
|
3791
3639
|
}
|
|
3792
3640
|
}
|
|
3793
|
-
if (this.config.build.polyfill) {
|
|
3794
|
-
this.config.build.polyfill = this.config.build.polyfill.map((polyfill) => replacePathTokens(this, polyfill));
|
|
3795
|
-
}
|
|
3796
3641
|
if (this.config.output.assets) {
|
|
3797
3642
|
this.config.output.assets = this.config.output.assets.map((asset) => ({
|
|
3798
3643
|
...asset,
|
|
@@ -3806,11 +3651,11 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3806
3651
|
}
|
|
3807
3652
|
mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
|
|
3808
3653
|
this.config.userConfig = mergeConfig({
|
|
3809
|
-
|
|
3654
|
+
input: isSetObject(from.input) && !isRegExp(from.input) && !Array.isArray(from.input) && from.input.file ? from.input.file : isSetObject(into?.input) && !isRegExp(into.input) && !Array.isArray(into.input) && into.input.file ? into.input.file : Array.isArray(from.input) && from.input.length > 0 ? from.input : Array.isArray(into?.input) && into.input.length > 0 ? into.input : []
|
|
3810
3655
|
}, omit(from ?? {}, [
|
|
3811
|
-
"
|
|
3656
|
+
"input"
|
|
3812
3657
|
]), omit(into ?? {}, [
|
|
3813
|
-
"
|
|
3658
|
+
"input"
|
|
3814
3659
|
]));
|
|
3815
3660
|
if (this.config.userConfig.output?.format) {
|
|
3816
3661
|
this.config.userConfig.output.format = getUnique(toArray(this.config.userConfig.output?.format));
|
|
@@ -3911,7 +3756,7 @@ function createPluginContext(plugin, environment) {
|
|
|
3911
3756
|
}
|
|
3912
3757
|
__name(createPluginContext, "createPluginContext");
|
|
3913
3758
|
|
|
3914
|
-
// ../powerlines/src/
|
|
3759
|
+
// ../powerlines/src/context/environment-context.ts
|
|
3915
3760
|
var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends PowerlinesContext {
|
|
3916
3761
|
static {
|
|
3917
3762
|
__name(this, "PowerlinesEnvironmentContext");
|
|
@@ -4132,7 +3977,7 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends P
|
|
|
4132
3977
|
}
|
|
4133
3978
|
};
|
|
4134
3979
|
|
|
4135
|
-
// ../powerlines/src/
|
|
3980
|
+
// ../powerlines/src/context/api-context.ts
|
|
4136
3981
|
var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext {
|
|
4137
3982
|
static {
|
|
4138
3983
|
__name(this, "PowerlinesAPIContext");
|
|
@@ -4284,14 +4129,14 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4284
4129
|
}
|
|
4285
4130
|
if (Object.keys(this.environments).length === 1) {
|
|
4286
4131
|
environment = this.environments[Object.keys(this.environments)[0]];
|
|
4287
|
-
this.debug(`Applying the only configured environment: ${
|
|
4132
|
+
this.debug(`Applying the only configured environment: ${chalk4.bold.cyanBright(environment?.environment.name)}`);
|
|
4288
4133
|
}
|
|
4289
4134
|
if (!environment) {
|
|
4290
4135
|
if (name) {
|
|
4291
4136
|
throw new Error(`Environment "${name}" not found.`);
|
|
4292
4137
|
}
|
|
4293
4138
|
environment = await this.in(createDefaultEnvironment(this.config.userConfig));
|
|
4294
|
-
this.warn(`No environment specified, and no default environment found. Using a temporary default environment: ${
|
|
4139
|
+
this.warn(`No environment specified, and no default environment found. Using a temporary default environment: ${chalk4.bold.cyanBright(environment?.environment.name)}`);
|
|
4295
4140
|
}
|
|
4296
4141
|
return environment;
|
|
4297
4142
|
}
|
|
@@ -4327,26 +4172,6 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4327
4172
|
return environment;
|
|
4328
4173
|
}
|
|
4329
4174
|
};
|
|
4330
|
-
function getBaseFileHeader(context) {
|
|
4331
|
-
return `
|
|
4332
|
-
// Generated with ${titleCase(context.config.framework)}
|
|
4333
|
-
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
4334
|
-
`;
|
|
4335
|
-
}
|
|
4336
|
-
__name(getBaseFileHeader, "getBaseFileHeader");
|
|
4337
|
-
function getFileHeader(context, options = {}) {
|
|
4338
|
-
const { directive = null, prettierIgnore = false } = options;
|
|
4339
|
-
return `/* eslint-disable */
|
|
4340
|
-
// biome-ignore lint: disable
|
|
4341
|
-
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `
|
|
4342
|
-
|
|
4343
|
-
${directive}
|
|
4344
|
-
` : "\n"}
|
|
4345
|
-
${getBaseFileHeader(context)}
|
|
4346
|
-
|
|
4347
|
-
`;
|
|
4348
|
-
}
|
|
4349
|
-
__name(getFileHeader, "getFileHeader");
|
|
4350
4175
|
|
|
4351
4176
|
// ../powerlines/src/api.ts
|
|
4352
4177
|
var PowerlinesAPI = class _PowerlinesAPI {
|
|
@@ -4428,7 +4253,7 @@ var PowerlinesAPI = class _PowerlinesAPI {
|
|
|
4428
4253
|
order: "normal"
|
|
4429
4254
|
});
|
|
4430
4255
|
if (context.entry.length > 0) {
|
|
4431
|
-
context.debug(`The configuration provided ${toArray(context.config.
|
|
4256
|
+
context.debug(`The configuration provided ${isObject(context.config.input) ? Object.keys(context.config.input).length : toArray(context.config.input).length} entry point(s), Powerlines has found ${context.entry.length} entry files(s) for the ${context.config.title} project${context.entry.length > 0 && context.entry.length < 10 ? `:
|
|
4432
4257
|
${context.entry.map((entry) => `- ${entry.file}${entry.output ? ` -> ${entry.output}` : ""}`).join(" \n")}` : ""}`);
|
|
4433
4258
|
} else {
|
|
4434
4259
|
context.warn(`No entry files were found for the ${context.config.title} project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`);
|
|
@@ -4555,7 +4380,7 @@ ${formatTypes(types)}
|
|
|
4555
4380
|
}
|
|
4556
4381
|
}
|
|
4557
4382
|
}
|
|
4558
|
-
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.
|
|
4383
|
+
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig);
|
|
4559
4384
|
if (!context.tsconfig) {
|
|
4560
4385
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
4561
4386
|
}
|
|
@@ -4595,7 +4420,7 @@ ${formatTypes(types)}
|
|
|
4595
4420
|
for (const file of files) {
|
|
4596
4421
|
context.trace(`Adding template file to project: ${file}`);
|
|
4597
4422
|
const template = Handlebars.compile(file);
|
|
4598
|
-
await context.fs.write(joinPaths$1(context.config.
|
|
4423
|
+
await context.fs.write(joinPaths$1(context.config.root, file.replace(".hbs", "")), template(context));
|
|
4599
4424
|
}
|
|
4600
4425
|
await this.callHook("new", {
|
|
4601
4426
|
environment: context,
|
|
@@ -4606,14 +4431,14 @@ ${formatTypes(types)}
|
|
|
4606
4431
|
for (const file of files2) {
|
|
4607
4432
|
context.trace(`Adding application template file: ${file}`);
|
|
4608
4433
|
const template = Handlebars.compile(file);
|
|
4609
|
-
await context.fs.write(joinPaths$1(context.config.
|
|
4434
|
+
await context.fs.write(joinPaths$1(context.config.root, file.replace(".hbs", "")), template(context));
|
|
4610
4435
|
}
|
|
4611
4436
|
} else {
|
|
4612
4437
|
const files2 = await listFiles(joinPaths$1(context.powerlinesPath, "files/library/**/*.hbs"));
|
|
4613
4438
|
for (const file of files2) {
|
|
4614
4439
|
context.trace(`Adding library template file: ${file}`);
|
|
4615
4440
|
const template = Handlebars.compile(file);
|
|
4616
|
-
await context.fs.write(joinPaths$1(context.config.
|
|
4441
|
+
await context.fs.write(joinPaths$1(context.config.root, file.replace(".hbs", "")), template(context));
|
|
4617
4442
|
}
|
|
4618
4443
|
}
|
|
4619
4444
|
await this.callHook("new", {
|
|
@@ -4640,7 +4465,7 @@ ${formatTypes(types)}
|
|
|
4640
4465
|
await this.#executeEnvironments(async (context) => {
|
|
4641
4466
|
context.debug("Cleaning the project's dist and artifacts directories.");
|
|
4642
4467
|
await context.fs.remove(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.output.buildPath));
|
|
4643
|
-
await context.fs.remove(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.
|
|
4468
|
+
await context.fs.remove(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.root, context.config.output.artifactsPath));
|
|
4644
4469
|
await this.callHook("clean", {
|
|
4645
4470
|
environment: context,
|
|
4646
4471
|
sequential: false
|
|
@@ -4660,12 +4485,10 @@ ${formatTypes(types)}
|
|
|
4660
4485
|
this.context.info("\u{1F4CB} Linting the Powerlines project");
|
|
4661
4486
|
await this.prepare(inlineConfig);
|
|
4662
4487
|
await this.#executeEnvironments(async (context) => {
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
});
|
|
4668
|
-
}
|
|
4488
|
+
await this.callHook("lint", {
|
|
4489
|
+
environment: context,
|
|
4490
|
+
sequential: false
|
|
4491
|
+
});
|
|
4669
4492
|
});
|
|
4670
4493
|
this.context.debug("\u2714 Powerlines linting completed successfully");
|
|
4671
4494
|
}
|
|
@@ -4802,7 +4625,7 @@ ${formatTypes(types)}
|
|
|
4802
4625
|
}
|
|
4803
4626
|
}
|
|
4804
4627
|
await Promise.all(context.config.output.assets.map(async (asset) => {
|
|
4805
|
-
context.trace(`Copying asset(s): ${
|
|
4628
|
+
context.trace(`Copying asset(s): ${chalk4.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : joinPaths$1(replacePath(asset.input, context.workspaceConfig.workspaceRoot), asset.glob))} -> ${chalk4.greenBright(joinPaths$1(replacePath(asset.output, context.workspaceConfig.workspaceRoot), asset.glob))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk4.yellowBright(i)).join(", ")})` : ""}`);
|
|
4806
4629
|
await context.fs.copy(asset, asset.output);
|
|
4807
4630
|
}));
|
|
4808
4631
|
await this.callHook("build", {
|
|
@@ -4858,7 +4681,7 @@ ${formatTypes(types)}
|
|
|
4858
4681
|
return;
|
|
4859
4682
|
}
|
|
4860
4683
|
for (const plugin of result) {
|
|
4861
|
-
this.context.debug(`Successfully initialized the ${
|
|
4684
|
+
this.context.debug(`Successfully initialized the ${chalk4.bold.cyanBright(plugin.name)} plugin`);
|
|
4862
4685
|
await this.context.addPlugin(plugin);
|
|
4863
4686
|
}
|
|
4864
4687
|
}
|
|
@@ -4945,10 +4768,10 @@ Please ensure the value is one of the following:
|
|
|
4945
4768
|
const result = [];
|
|
4946
4769
|
for (const plugin of plugins) {
|
|
4947
4770
|
if (checkDedupe(plugin, this.context.plugins)) {
|
|
4948
|
-
this.context.trace(`Duplicate ${
|
|
4771
|
+
this.context.trace(`Duplicate ${chalk4.bold.cyanBright(plugin.name)} plugin dependency detected - Skipping initialization.`);
|
|
4949
4772
|
} else {
|
|
4950
4773
|
result.push(plugin);
|
|
4951
|
-
this.context.trace(`Initializing the ${
|
|
4774
|
+
this.context.trace(`Initializing the ${chalk4.bold.cyanBright(plugin.name)} plugin...`);
|
|
4952
4775
|
}
|
|
4953
4776
|
}
|
|
4954
4777
|
return result;
|
|
@@ -4961,13 +4784,13 @@ Please ensure the value is one of the following:
|
|
|
4961
4784
|
const isInstalled = isPackageExists(pluginPath, {
|
|
4962
4785
|
paths: [
|
|
4963
4786
|
this.context.workspaceConfig.workspaceRoot,
|
|
4964
|
-
this.context.config.
|
|
4787
|
+
this.context.config.root
|
|
4965
4788
|
]
|
|
4966
4789
|
});
|
|
4967
4790
|
if (!isInstalled && this.context.config.autoInstall) {
|
|
4968
4791
|
this.#context.warn(`The plugin package "${pluginPath}" is not installed. It will be installed automatically.`);
|
|
4969
4792
|
const result = await install(pluginPath, {
|
|
4970
|
-
cwd: this.context.config.
|
|
4793
|
+
cwd: this.context.config.root
|
|
4971
4794
|
});
|
|
4972
4795
|
if (isNumber(result.exitCode) && result.exitCode > 0) {
|
|
4973
4796
|
this.#context.error(result.stderr);
|
|
@@ -5017,16 +4840,25 @@ function withExecutor(command, executorFn) {
|
|
|
5017
4840
|
}
|
|
5018
4841
|
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
5019
4842
|
const api = await src_default.from(workspaceConfig.workspaceRoot, defu7({
|
|
4843
|
+
input: options.input,
|
|
4844
|
+
output: {
|
|
4845
|
+
outputPath: options.outputPath ?? projectConfig.targets?.build?.options?.outputPath,
|
|
4846
|
+
format: options.format,
|
|
4847
|
+
sourceMap: options.sourceMap
|
|
4848
|
+
},
|
|
4849
|
+
resolve: {
|
|
4850
|
+
external: options.external,
|
|
4851
|
+
noExternal: options.noExternal,
|
|
4852
|
+
skipNodeModulesBundle: options.skipNodeModulesBundle
|
|
4853
|
+
},
|
|
5020
4854
|
root: projectConfig.root,
|
|
5021
|
-
|
|
4855
|
+
projectType: projectConfig.projectType,
|
|
5022
4856
|
sourceRoot: projectConfig.sourceRoot,
|
|
5023
4857
|
tsconfig: options.tsconfig,
|
|
4858
|
+
platform: options.platform,
|
|
4859
|
+
define: options.define,
|
|
5024
4860
|
logLevel: options.logLevel,
|
|
5025
|
-
mode: options.mode
|
|
5026
|
-
skipCache: options.skipCache,
|
|
5027
|
-
output: {
|
|
5028
|
-
outputPath: options.outputPath ?? projectConfig.targets?.build?.options?.outputPath
|
|
5029
|
-
}
|
|
4861
|
+
mode: options.mode
|
|
5030
4862
|
}, options));
|
|
5031
4863
|
try {
|
|
5032
4864
|
return await Promise.resolve(executorFn(defu7({
|