@powerlines/nx 0.11.217 → 0.11.219
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 +16 -0
- package/dist/chunk-3BI2YVJ3.js +156 -0
- package/dist/{chunk-AQU4Y7TY.mjs → chunk-4KF5AUPD.mjs} +1 -1
- package/dist/chunk-4OMPO3GC.mjs +154 -0
- package/dist/{chunk-MMYSL52M.mjs → chunk-7EWOPOET.mjs} +220 -388
- package/dist/{chunk-JQZOWO7J.mjs → chunk-FIOTA3DI.mjs} +1 -1
- package/dist/chunk-FSGRYCTL.js +281 -0
- package/dist/{chunk-UWZA4FE6.mjs → chunk-GB6SETBZ.mjs} +1 -1
- package/dist/{chunk-2YJP4HRC.mjs → chunk-GCIPEE4T.mjs} +7 -7
- package/dist/{chunk-WJP3FWAH.js → chunk-GJ62I4AV.js} +2 -2
- package/dist/chunk-HNRM52ID.js +374 -0
- package/dist/chunk-IA3YWWWC.mjs +366 -0
- package/dist/{chunk-VSMLSWBT.js → chunk-IOBDAGVL.js} +8 -8
- package/dist/chunk-JL4HQ7ZD.mjs +260 -0
- package/dist/{chunk-5XND6U2P.js → chunk-K6HPKAIP.js} +2 -2
- package/dist/{chunk-TL367T24.js → chunk-KAY4UTGV.js} +2 -2
- package/dist/{chunk-2OUVFH73.js → chunk-MYNOF2F6.js} +2 -2
- package/dist/{chunk-5QDW5A4Z.js → chunk-QA32JCA6.js} +2 -2
- package/dist/{chunk-ELBUYWVF.mjs → chunk-QN6ZKFPV.mjs} +1 -1
- package/dist/{chunk-BUUW4BAS.mjs → chunk-RLKRZBG3.mjs} +2 -2
- package/dist/{chunk-C4XEVBMI.mjs → chunk-ULCS2R4D.mjs} +1 -1
- package/dist/{chunk-QJE3HWRQ.js → chunk-WXALQB3J.js} +3 -3
- package/dist/{chunk-BM4NZS6T.js → chunk-ZODDB4GG.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.d.mts +1 -1
- package/dist/src/helpers/plugin-utilities.d.ts +1 -1
- 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-TWOXCXFE.js +0 -364
- package/dist/chunk-XXWF7X5C.mjs +0 -75
- package/dist/chunk-ZYOL33SX.mjs +0 -356
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFSGRYCTL_js = require('./chunk-FSGRYCTL.js');
|
|
4
4
|
var chunkSHUYVCID_js = require('./chunk-SHUYVCID.js');
|
|
5
5
|
var logger = require('@storm-software/config-tools/logger');
|
|
6
6
|
var baseExecutor = require('@storm-software/workspace-tools/base/base-executor');
|
|
@@ -26,27 +26,31 @@ var isSet = require('@stryke/type-checks/is-set');
|
|
|
26
26
|
var isSetObject = require('@stryke/type-checks/is-set-object');
|
|
27
27
|
var isSetString = require('@stryke/type-checks/is-set-string');
|
|
28
28
|
var isString = require('@stryke/type-checks/is-string');
|
|
29
|
-
var
|
|
29
|
+
var chalk4 = require('chalk');
|
|
30
30
|
var Handlebars = require('handlebars');
|
|
31
31
|
var filePathFns = require('@stryke/path/file-path-fns');
|
|
32
32
|
var isParentPath = require('@stryke/path/is-parent-path');
|
|
33
33
|
var prettyBytes = require('@stryke/string-format/pretty-bytes');
|
|
34
34
|
var tsMorph = require('ts-morph');
|
|
35
|
+
var getUnique = require('@stryke/helpers/get-unique');
|
|
36
|
+
var isRegexp = require('@stryke/type-checks/is-regexp');
|
|
35
37
|
var isUndefined = require('@stryke/type-checks/is-undefined');
|
|
38
|
+
var join = require('@stryke/path/join');
|
|
39
|
+
var fs = require('fs');
|
|
36
40
|
var _package = require('@stryke/string-format/package');
|
|
37
|
-
var
|
|
41
|
+
var exists = require('@stryke/fs/exists');
|
|
38
42
|
var json = require('@stryke/fs/json');
|
|
43
|
+
require('@stryke/fs/remove-file');
|
|
44
|
+
var kebabCase = require('@stryke/string-format/kebab-case');
|
|
45
|
+
var superdiff = require('@donedeal0/superdiff');
|
|
39
46
|
var stormJson = require('@stryke/json/storm-json');
|
|
40
47
|
var titleCase = require('@stryke/string-format/title-case');
|
|
41
|
-
var exists = require('@stryke/fs/exists');
|
|
42
48
|
var ts = require('typescript');
|
|
43
49
|
var types = require('@storm-software/config-tools/types');
|
|
44
50
|
var getEnvPaths = require('@stryke/env/get-env-paths');
|
|
45
51
|
var hashFiles = require('@stryke/hash/hash-files');
|
|
46
52
|
var murmurhash = require('@stryke/hash/murmurhash');
|
|
47
|
-
var getUnique = require('@stryke/helpers/get-unique');
|
|
48
53
|
var fetch = require('@stryke/http/fetch');
|
|
49
|
-
var join = require('@stryke/path/join');
|
|
50
54
|
var isNull = require('@stryke/type-checks/is-null');
|
|
51
55
|
var uuid = require('@stryke/unique-id/uuid');
|
|
52
56
|
var bundleRequire = require('bundle-require');
|
|
@@ -55,26 +59,20 @@ var flatCache = require('flat-cache');
|
|
|
55
59
|
var oxcParser = require('oxc-parser');
|
|
56
60
|
var undici = require('undici');
|
|
57
61
|
var jiti = require('jiti');
|
|
58
|
-
var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
|
|
59
|
-
var isType = require('@stryke/path/is-type');
|
|
60
62
|
var $ = require('@stryke/capnp');
|
|
61
63
|
var buffer = require('@stryke/fs/buffer');
|
|
62
64
|
var correctPath = require('@stryke/path/correct-path');
|
|
63
65
|
var globToRegex = require('@stryke/path/glob-to-regex');
|
|
64
|
-
var
|
|
66
|
+
var isType = require('@stryke/path/is-type');
|
|
67
|
+
var slash = require('@stryke/path/slash');
|
|
65
68
|
var buffer$1 = require('buffer');
|
|
66
69
|
var url = require('url');
|
|
67
|
-
var colors = require('@storm-software/config-tools/utilities/colors');
|
|
68
|
-
var noop = require('@stryke/helpers/noop');
|
|
69
|
-
var kebabCase = require('@stryke/string-format/kebab-case');
|
|
70
|
-
var prettier = require('prettier');
|
|
71
|
-
var slash = require('@stryke/path/slash');
|
|
72
70
|
var isFile = require('@stryke/fs/is-file');
|
|
73
71
|
var readFile = require('@stryke/fs/read-file');
|
|
74
72
|
var writeFile = require('@stryke/fs/write-file');
|
|
75
|
-
var fs = require('fs');
|
|
76
73
|
var promises = require('fs/promises');
|
|
77
74
|
var path = require('path');
|
|
75
|
+
require('unplugin');
|
|
78
76
|
|
|
79
77
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
80
78
|
|
|
@@ -97,14 +95,14 @@ function _interopNamespace(e) {
|
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
var defu7__default = /*#__PURE__*/_interopDefault(defu7);
|
|
100
|
-
var
|
|
98
|
+
var chalk4__default = /*#__PURE__*/_interopDefault(chalk4);
|
|
101
99
|
var Handlebars__default = /*#__PURE__*/_interopDefault(Handlebars);
|
|
102
100
|
var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
103
101
|
var $__namespace = /*#__PURE__*/_interopNamespace($);
|
|
104
102
|
|
|
105
103
|
// ../powerlines/package.json
|
|
106
104
|
var package_default = {
|
|
107
|
-
version: "0.
|
|
105
|
+
version: "0.39.0"};
|
|
108
106
|
var VirtualFileSystemHost = class extends tsMorph.InMemoryFileSystemHost {
|
|
109
107
|
static {
|
|
110
108
|
chunkSHUYVCID_js.__name(this, "VirtualFileSystemHost");
|
|
@@ -211,7 +209,7 @@ function createProgram(context, override) {
|
|
|
211
209
|
}
|
|
212
210
|
chunkSHUYVCID_js.__name(createProgram, "createProgram");
|
|
213
211
|
|
|
214
|
-
// ../powerlines/src/
|
|
212
|
+
// ../powerlines/src/_internal/helpers/generate-types.ts
|
|
215
213
|
var getModuleCommentBlockRegex = /* @__PURE__ */ chunkSHUYVCID_js.__name((moduleId) => new RegExp(`\\/\\*\\*(?s:.)*?@module\\s+${moduleId}(?s:.)*?\\*\\/\\s+`), "getModuleCommentBlockRegex");
|
|
216
214
|
function formatTypes(code) {
|
|
217
215
|
return code.replace(
|
|
@@ -282,7 +280,20 @@ declare module "${moduleId}" {
|
|
|
282
280
|
}
|
|
283
281
|
chunkSHUYVCID_js.__name(emitBuiltinTypes, "emitBuiltinTypes");
|
|
284
282
|
|
|
285
|
-
// ../
|
|
283
|
+
// ../core/src/types/commands.ts
|
|
284
|
+
var SUPPORTED_COMMANDS = [
|
|
285
|
+
"new",
|
|
286
|
+
"clean",
|
|
287
|
+
"prepare",
|
|
288
|
+
"lint",
|
|
289
|
+
"test",
|
|
290
|
+
"build",
|
|
291
|
+
"docs",
|
|
292
|
+
"deploy",
|
|
293
|
+
"finalize"
|
|
294
|
+
];
|
|
295
|
+
|
|
296
|
+
// ../core/src/types/unplugin.ts
|
|
286
297
|
var UNPLUGIN_BUILDER_VARIANTS = [
|
|
287
298
|
"rollup",
|
|
288
299
|
"webpack",
|
|
@@ -301,20 +312,7 @@ var BUILDER_VARIANTS = [
|
|
|
301
312
|
"unbuild"
|
|
302
313
|
];
|
|
303
314
|
|
|
304
|
-
// ../
|
|
305
|
-
var SUPPORTED_COMMANDS = [
|
|
306
|
-
"new",
|
|
307
|
-
"clean",
|
|
308
|
-
"prepare",
|
|
309
|
-
"lint",
|
|
310
|
-
"test",
|
|
311
|
-
"build",
|
|
312
|
-
"docs",
|
|
313
|
-
"deploy",
|
|
314
|
-
"finalize"
|
|
315
|
-
];
|
|
316
|
-
|
|
317
|
-
// ../powerlines/src/types/plugin.ts
|
|
315
|
+
// ../core/src/types/plugin.ts
|
|
318
316
|
var PLUGIN_NON_HOOK_FIELDS = [
|
|
319
317
|
"name",
|
|
320
318
|
"api",
|
|
@@ -336,7 +334,7 @@ var PLUGIN_HOOKS_FIELDS = [
|
|
|
336
334
|
"writeBundle"
|
|
337
335
|
];
|
|
338
336
|
|
|
339
|
-
// ../
|
|
337
|
+
// ../core/src/plugin-utils/helpers.ts
|
|
340
338
|
function isPlugin(value) {
|
|
341
339
|
return isSetObject.isSetObject(value) && "name" in value && isSetString.isSetString(value.name) && (isUndefined.isUndefined(value.api) || "api" in value && isSetObject.isSetObject(value.api)) && (isUndefined.isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction.isFunction(value.applyToEnvironment)) && (isUndefined.isUndefined(value.dedupe) || "dedupe" in value && isFunction.isFunction(value.dedupe)) && PLUGIN_HOOKS_FIELDS.every((hook) => isUndefined.isUndefined(value[hook]) || hook in value && (isPluginHookFunction(value[hook]) || hook === "config" && isSetObject.isSetObject(value[hook]))) && BUILDER_VARIANTS.every((variant) => isUndefined.isUndefined(value[variant]) || variant in value && isSetObject.isSetObject(value[variant]));
|
|
342
340
|
}
|
|
@@ -418,7 +416,7 @@ function findInvalidPluginConfig(config) {
|
|
|
418
416
|
}
|
|
419
417
|
chunkSHUYVCID_js.__name(findInvalidPluginConfig, "findInvalidPluginConfig");
|
|
420
418
|
|
|
421
|
-
// ../
|
|
419
|
+
// ../core/src/plugin-utils/merge.ts
|
|
422
420
|
defu7.createDefu((obj, key, value) => {
|
|
423
421
|
if (isPluginHook(obj[key]) && isPluginHook(value)) {
|
|
424
422
|
obj[key] = {
|
|
@@ -448,7 +446,7 @@ var mergeConfig = defu7.createDefu((obj, key, value) => {
|
|
|
448
446
|
return false;
|
|
449
447
|
});
|
|
450
448
|
|
|
451
|
-
// ../powerlines/src/
|
|
449
|
+
// ../powerlines/src/_internal/helpers/hooks.ts
|
|
452
450
|
var mergeResultObjects = defu7.createDefu((obj, key, value) => {
|
|
453
451
|
if (isString.isString(obj[key]) && isString.isString(value)) {
|
|
454
452
|
obj[key] = `${obj[key] || ""}
|
|
@@ -488,7 +486,7 @@ chunkSHUYVCID_js.__name(mergeConfigs, "mergeConfigs");
|
|
|
488
486
|
async function callHook(context, key, options, ...args) {
|
|
489
487
|
const hooks = context.selectHooks(key, options);
|
|
490
488
|
if (hooks.length > 0) {
|
|
491
|
-
context.debug(` \u{1F9E9} Calling plugin hook: ${
|
|
489
|
+
context.debug(` \u{1F9E9} Calling plugin hook: ${chalk4__default.default.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)}`);
|
|
492
490
|
const invokeHook = /* @__PURE__ */ chunkSHUYVCID_js.__name(async (hook, hookArgs) => {
|
|
493
491
|
return Reflect.apply(hook.handler, hook.context, hookArgs);
|
|
494
492
|
}, "invokeHook");
|
|
@@ -552,12 +550,12 @@ async function callHook(context, key, options, ...args) {
|
|
|
552
550
|
chunkSHUYVCID_js.__name(callHook, "callHook");
|
|
553
551
|
async function installPackage(context, packageName, dev = false) {
|
|
554
552
|
if (!await packageFns.isPackageListed(_package.getPackageName(packageName), {
|
|
555
|
-
cwd: context.config.
|
|
553
|
+
cwd: context.config.root
|
|
556
554
|
})) {
|
|
557
555
|
if (context.config.autoInstall) {
|
|
558
556
|
context.warn(`The package "${packageName}" is not installed. It will be installed automatically.`);
|
|
559
557
|
const result = await install.install(packageName, {
|
|
560
|
-
cwd: context.config.
|
|
558
|
+
cwd: context.config.root,
|
|
561
559
|
dev
|
|
562
560
|
});
|
|
563
561
|
if (isNumber.isNumber(result.exitCode) && result.exitCode > 0) {
|
|
@@ -568,10 +566,10 @@ async function installPackage(context, packageName, dev = false) {
|
|
|
568
566
|
context.warn(`The package "${packageName}" is not installed. Since the "autoInstall" option is set to false, it will not be installed automatically.`);
|
|
569
567
|
}
|
|
570
568
|
} else if (_package.hasPackageVersion(packageName) && !process.env.POWERLINES_SKIP_VERSION_CHECK) {
|
|
571
|
-
const isMatching = await packageFns.doesPackageMatch(_package.getPackageName(packageName), _package.getPackageVersion(packageName), context.config.
|
|
569
|
+
const isMatching = await packageFns.doesPackageMatch(_package.getPackageName(packageName), _package.getPackageVersion(packageName), context.config.root);
|
|
572
570
|
if (!isMatching) {
|
|
573
571
|
const packageListing = await packageFns.getPackageListing(_package.getPackageName(packageName), {
|
|
574
|
-
cwd: context.config.
|
|
572
|
+
cwd: context.config.root
|
|
575
573
|
});
|
|
576
574
|
if (!packageListing?.version.startsWith("catalog:") && !packageListing?.version.startsWith("workspace:")) {
|
|
577
575
|
context.warn(`The package "${_package.getPackageName(packageName)}" is installed but does not match the expected version ${_package.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.`);
|
|
@@ -581,7 +579,7 @@ async function installPackage(context, packageName, dev = false) {
|
|
|
581
579
|
}
|
|
582
580
|
chunkSHUYVCID_js.__name(installPackage, "installPackage");
|
|
583
581
|
|
|
584
|
-
// ../powerlines/src/
|
|
582
|
+
// ../powerlines/src/_internal/helpers/install-dependencies.ts
|
|
585
583
|
async function installDependencies(context) {
|
|
586
584
|
context.debug(`Checking and installing missing project dependencies.`);
|
|
587
585
|
context.dependencies ??= {};
|
|
@@ -602,6 +600,17 @@ ${Object.entries(context.devDependencies).map(([name, version]) => `- ${name}@${
|
|
|
602
600
|
]);
|
|
603
601
|
}
|
|
604
602
|
chunkSHUYVCID_js.__name(installDependencies, "installDependencies");
|
|
603
|
+
function getPrefixedRootHash(name, rootHash) {
|
|
604
|
+
const combined = `${kebabCase.kebabCase(name)}_${rootHash}`;
|
|
605
|
+
return combined.length > chunkFSGRYCTL_js.ROOT_HASH_LENGTH ? combined.slice(0, chunkFSGRYCTL_js.ROOT_HASH_LENGTH) : combined;
|
|
606
|
+
}
|
|
607
|
+
chunkSHUYVCID_js.__name(getPrefixedRootHash, "getPrefixedRootHash");
|
|
608
|
+
async function writeMetaFile(context) {
|
|
609
|
+
const metaFilePath = joinPaths.joinPaths(context.dataPath, "meta.json");
|
|
610
|
+
context.debug(`Writing runtime metadata to ${metaFilePath}`);
|
|
611
|
+
await context.fs.write(metaFilePath, JSON.stringify(context.meta, null, 2));
|
|
612
|
+
}
|
|
613
|
+
chunkSHUYVCID_js.__name(writeMetaFile, "writeMetaFile");
|
|
605
614
|
function getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
|
|
606
615
|
let tsconfigFilePath;
|
|
607
616
|
if (tsconfig) {
|
|
@@ -701,15 +710,15 @@ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && err
|
|
|
701
710
|
}
|
|
702
711
|
chunkSHUYVCID_js.__name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
|
|
703
712
|
|
|
704
|
-
// ../powerlines/src/
|
|
713
|
+
// ../powerlines/src/_internal/helpers/resolve-tsconfig.ts
|
|
705
714
|
function getTsconfigDtsPath(context) {
|
|
706
|
-
const dtsRelativePath = joinPaths.joinPaths(filePathFns.relativePath(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.
|
|
715
|
+
const dtsRelativePath = joinPaths.joinPaths(filePathFns.relativePath(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.root), filePathFns.findFilePath(context.dtsPath)), filePathFns.findFileName(context.dtsPath));
|
|
707
716
|
return dtsRelativePath;
|
|
708
717
|
}
|
|
709
718
|
chunkSHUYVCID_js.__name(getTsconfigDtsPath, "getTsconfigDtsPath");
|
|
710
719
|
async function resolveTsconfigChanges(context) {
|
|
711
|
-
const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.
|
|
712
|
-
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.
|
|
720
|
+
const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig, context.config.tsconfigRaw);
|
|
721
|
+
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig);
|
|
713
722
|
const tsconfigJson = await json.readJsonFile(tsconfigFilePath);
|
|
714
723
|
tsconfigJson.compilerOptions ??= {};
|
|
715
724
|
if (context.config.output.dts !== false) {
|
|
@@ -737,7 +746,7 @@ async function resolveTsconfigChanges(context) {
|
|
|
737
746
|
if (tsconfig.options.isolatedModules !== true) {
|
|
738
747
|
tsconfigJson.compilerOptions.isolatedModules = true;
|
|
739
748
|
}
|
|
740
|
-
if (context.config.
|
|
749
|
+
if (context.config.platform === "node") {
|
|
741
750
|
if (!tsconfig.options.types?.some((type) => type.toLowerCase() === "node" || type.toLowerCase() === "@types/node")) {
|
|
742
751
|
tsconfigJson.compilerOptions.types ??= [];
|
|
743
752
|
tsconfigJson.compilerOptions.types.push("node");
|
|
@@ -751,12 +760,12 @@ async function initializeTsconfig(context) {
|
|
|
751
760
|
if (!packageFns.isPackageExists("typescript")) {
|
|
752
761
|
throw new Error('The TypeScript package is not installed. Please install the package using the command: "npm install typescript --save-dev"');
|
|
753
762
|
}
|
|
754
|
-
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.
|
|
763
|
+
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig);
|
|
755
764
|
context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
|
|
756
765
|
context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
|
|
757
766
|
context.debug("Writing updated TypeScript configuration (tsconfig.json) file to disk.");
|
|
758
767
|
await context.fs.write(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson));
|
|
759
|
-
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.
|
|
768
|
+
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
|
|
760
769
|
}
|
|
761
770
|
chunkSHUYVCID_js.__name(initializeTsconfig, "initializeTsconfig");
|
|
762
771
|
async function resolveTsconfig(context) {
|
|
@@ -798,31 +807,25 @@ async function resolveTsconfig(context) {
|
|
|
798
807
|
if (changes.length > 0) {
|
|
799
808
|
context.warn(`Updating the following configuration values in "${context.tsconfig.tsconfigFilePath}" file:
|
|
800
809
|
|
|
801
|
-
${changes.map((change, i) => `${
|
|
802
|
-
${
|
|
803
|
-
${
|
|
810
|
+
${changes.map((change, i) => `${chalk4__default.default.bold.whiteBright(`${i + 1}. ${titleCase.titleCase(change.status)} the ${change.field} field: `)}
|
|
811
|
+
${chalk4__default.default.red(` - Previous: ${change.previous} `)}
|
|
812
|
+
${chalk4__default.default.green(` - Updated: ${change.current} `)}
|
|
804
813
|
`).join("\n")}
|
|
805
814
|
`);
|
|
806
815
|
}
|
|
807
816
|
await context.fs.write(context.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(updateTsconfigJson));
|
|
808
|
-
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.
|
|
817
|
+
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig);
|
|
809
818
|
if (!context.tsconfig) {
|
|
810
819
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
811
820
|
}
|
|
812
821
|
}
|
|
813
822
|
chunkSHUYVCID_js.__name(resolveTsconfig, "resolveTsconfig");
|
|
814
|
-
|
|
815
|
-
// ../powerlines/src/lib/constants/environments.ts
|
|
816
|
-
var DEFAULT_ENVIRONMENT = "default";
|
|
817
|
-
var GLOBAL_ENVIRONMENT = "__global__";
|
|
818
|
-
|
|
819
|
-
// ../powerlines/src/internal/helpers/environment.ts
|
|
820
823
|
function createEnvironment(name, userConfig) {
|
|
821
824
|
return defu7__default.default(userConfig.environments?.[name] ?? {}, {
|
|
822
825
|
name,
|
|
823
826
|
title: userConfig.title || titleCase.titleCase(userConfig.name),
|
|
824
827
|
ssr: false,
|
|
825
|
-
mainFields: userConfig
|
|
828
|
+
mainFields: userConfig?.platform === "browser" ? [
|
|
826
829
|
"browser",
|
|
827
830
|
"module",
|
|
828
831
|
"jsnext:main",
|
|
@@ -841,8 +844,8 @@ function createEnvironment(name, userConfig) {
|
|
|
841
844
|
".tsx",
|
|
842
845
|
".json"
|
|
843
846
|
],
|
|
844
|
-
consumer: userConfig
|
|
845
|
-
preview: userConfig
|
|
847
|
+
consumer: userConfig?.platform === "browser" ? "client" : "server",
|
|
848
|
+
preview: userConfig?.platform === "browser" ? {
|
|
846
849
|
port: 5173,
|
|
847
850
|
open: true,
|
|
848
851
|
strictPort: false,
|
|
@@ -858,7 +861,7 @@ function createEnvironment(name, userConfig) {
|
|
|
858
861
|
}
|
|
859
862
|
chunkSHUYVCID_js.__name(createEnvironment, "createEnvironment");
|
|
860
863
|
function createDefaultEnvironment(userConfig) {
|
|
861
|
-
return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);
|
|
864
|
+
return createEnvironment(chunkFSGRYCTL_js.DEFAULT_ENVIRONMENT, userConfig);
|
|
862
865
|
}
|
|
863
866
|
chunkSHUYVCID_js.__name(createDefaultEnvironment, "createDefaultEnvironment");
|
|
864
867
|
function resolveOptions(options) {
|
|
@@ -869,81 +872,12 @@ function resolveOptions(options) {
|
|
|
869
872
|
});
|
|
870
873
|
}
|
|
871
874
|
chunkSHUYVCID_js.__name(resolveOptions, "resolveOptions");
|
|
872
|
-
function createPluginResolver(options) {
|
|
873
|
-
return jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({
|
|
874
|
-
...options
|
|
875
|
-
}));
|
|
876
|
-
}
|
|
877
|
-
chunkSHUYVCID_js.__name(createPluginResolver, "createPluginResolver");
|
|
878
875
|
function createResolver(options) {
|
|
879
|
-
const baseResolver = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.
|
|
880
|
-
baseResolver.plugin =
|
|
876
|
+
const baseResolver = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.root), resolveOptions(options));
|
|
877
|
+
baseResolver.plugin = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.root), resolveOptions(options));
|
|
881
878
|
return baseResolver;
|
|
882
879
|
}
|
|
883
880
|
chunkSHUYVCID_js.__name(createResolver, "createResolver");
|
|
884
|
-
function replacePathTokens(context, path) {
|
|
885
|
-
if (!path) {
|
|
886
|
-
return path;
|
|
887
|
-
}
|
|
888
|
-
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));
|
|
889
|
-
}
|
|
890
|
-
chunkSHUYVCID_js.__name(replacePathTokens, "replacePathTokens");
|
|
891
|
-
function resolveEntryOutput(context, typeDefinition) {
|
|
892
|
-
return replace.replaceExtension(replace.replacePath(replace.replacePath(replace.replacePath(replace.replacePath(replace.replacePath(typeDefinition.file, joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.sourceRoot)), joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)), context.config.sourceRoot), context.config.projectRoot), replace.replacePath(context.config.sourceRoot, context.config.projectRoot)));
|
|
893
|
-
}
|
|
894
|
-
chunkSHUYVCID_js.__name(resolveEntryOutput, "resolveEntryOutput");
|
|
895
|
-
function resolveEntry(context, typeDefinition, input, output) {
|
|
896
|
-
return {
|
|
897
|
-
...typeDefinition,
|
|
898
|
-
input: input ?? typeDefinition,
|
|
899
|
-
output: output || resolveEntryOutput(context, typeDefinition)
|
|
900
|
-
};
|
|
901
|
-
}
|
|
902
|
-
chunkSHUYVCID_js.__name(resolveEntry, "resolveEntry");
|
|
903
|
-
function isTypeDefinition(entry) {
|
|
904
|
-
return !isString.isString(entry) && entry.file !== void 0;
|
|
905
|
-
}
|
|
906
|
-
chunkSHUYVCID_js.__name(isTypeDefinition, "isTypeDefinition");
|
|
907
|
-
function isResolvedEntryTypeDefinition(entry) {
|
|
908
|
-
return isTypeDefinition(entry) && entry.output !== void 0;
|
|
909
|
-
}
|
|
910
|
-
chunkSHUYVCID_js.__name(isResolvedEntryTypeDefinition, "isResolvedEntryTypeDefinition");
|
|
911
|
-
function resolveEntriesSync(context, typeDefinitions) {
|
|
912
|
-
return typeDefinitions.map((entry) => {
|
|
913
|
-
if (isResolvedEntryTypeDefinition(entry)) {
|
|
914
|
-
return {
|
|
915
|
-
...entry,
|
|
916
|
-
output: entry.output ? replacePathTokens(context, entry.output) : void 0,
|
|
917
|
-
file: replacePathTokens(context, entry.file)
|
|
918
|
-
};
|
|
919
|
-
}
|
|
920
|
-
let typeDefinition;
|
|
921
|
-
if (isString.isString(entry)) {
|
|
922
|
-
typeDefinition = parseTypeDefinition.parseTypeDefinition(replacePathTokens(context, entry));
|
|
923
|
-
} else {
|
|
924
|
-
typeDefinition = entry;
|
|
925
|
-
typeDefinition.file = replacePathTokens(context, typeDefinition.file);
|
|
926
|
-
}
|
|
927
|
-
const filePath = isType.isAbsolutePath(typeDefinition.file) ? typeDefinition.file : append.appendPath(typeDefinition.file, context.config.projectRoot);
|
|
928
|
-
if (context.fs.isFileSync(filePath)) {
|
|
929
|
-
return resolveEntry(context, {
|
|
930
|
-
file: append.appendPath(filePath, context.workspaceConfig.workspaceRoot),
|
|
931
|
-
name: typeDefinition.name
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
|
-
return context.fs.globSync(append.appendPath(filePath, context.workspaceConfig.workspaceRoot)).map((file) => resolveEntry(context, {
|
|
935
|
-
file,
|
|
936
|
-
name: typeDefinition.name
|
|
937
|
-
}));
|
|
938
|
-
}).flat().filter(Boolean);
|
|
939
|
-
}
|
|
940
|
-
chunkSHUYVCID_js.__name(resolveEntriesSync, "resolveEntriesSync");
|
|
941
|
-
function getUniqueEntries(entries = []) {
|
|
942
|
-
return getUnique.getUniqueBy(toArray.toArray(entries), (item) => isSetString.isSetString(item) ? item : murmurhash.murmurhash(item ?? {}, {
|
|
943
|
-
maxLength: 24
|
|
944
|
-
}));
|
|
945
|
-
}
|
|
946
|
-
chunkSHUYVCID_js.__name(getUniqueEntries, "getUniqueEntries");
|
|
947
881
|
BigInt("0xa56c61324b9d6e49");
|
|
948
882
|
var FileMetadata_KeyValuePair = class extends $__namespace.Struct {
|
|
949
883
|
static {
|
|
@@ -1166,110 +1100,6 @@ FileMetadata._Properties = $__namespace.CompositeList(FileMetadata_KeyValuePair)
|
|
|
1166
1100
|
FileSystem._Ids = $__namespace.CompositeList(FileId);
|
|
1167
1101
|
FileSystem._Storage = $__namespace.CompositeList(FileStorage);
|
|
1168
1102
|
FileSystem._Metadata = $__namespace.CompositeList(FileMetadata);
|
|
1169
|
-
var createLog = /* @__PURE__ */ chunkSHUYVCID_js.__name((name, options = {}) => {
|
|
1170
|
-
const logLevel = options.logLevel === null ? types.LogLevelLabel.SILENT : options.logLevel || types.LogLevelLabel.INFO;
|
|
1171
|
-
if (logLevel === types.LogLevelLabel.SILENT) {
|
|
1172
|
-
return noop.noop;
|
|
1173
|
-
}
|
|
1174
|
-
if (options.customLogger) {
|
|
1175
|
-
return options.customLogger;
|
|
1176
|
-
}
|
|
1177
|
-
return (type, ...args) => logger.getLogFn(logger.getLogLevel(type), {
|
|
1178
|
-
...options,
|
|
1179
|
-
logLevel
|
|
1180
|
-
})(`${chalk5__default.default.bold.hex(colors.getColor("brand", options))(`${name ? kebabCase.kebabCase(name) : ""}${options.name ? `${name ? chalk5__default.default.gray(" > ") : ""}${kebabCase.kebabCase(options.name)}` : ""}${chalk5__default.default.gray(" > ")}`)}${args.join(" ")} `.trim());
|
|
1181
|
-
}, "createLog");
|
|
1182
|
-
var BADGE_COLORS = [
|
|
1183
|
-
"#00A0DD",
|
|
1184
|
-
"#6FCE4E",
|
|
1185
|
-
"#FBBF24",
|
|
1186
|
-
"#F43F5E",
|
|
1187
|
-
"#3B82F6",
|
|
1188
|
-
"#A855F7",
|
|
1189
|
-
"#469592",
|
|
1190
|
-
"#288EDF",
|
|
1191
|
-
"#D8B4FE",
|
|
1192
|
-
"#10B981",
|
|
1193
|
-
"#EF4444",
|
|
1194
|
-
"#F0EC56",
|
|
1195
|
-
"#F472B6",
|
|
1196
|
-
"#22D3EE",
|
|
1197
|
-
"#EAB308",
|
|
1198
|
-
"#84CC16",
|
|
1199
|
-
"#F87171",
|
|
1200
|
-
"#0EA5E9",
|
|
1201
|
-
"#D946EF",
|
|
1202
|
-
"#FACC15",
|
|
1203
|
-
"#34D399",
|
|
1204
|
-
"#8B5CF6"
|
|
1205
|
-
];
|
|
1206
|
-
var extendLog = /* @__PURE__ */ chunkSHUYVCID_js.__name((logFn, name) => {
|
|
1207
|
-
return (type, ...args) => logFn(type, ` ${chalk5__default.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase.titleCase(name)} `)} ${args.join(" ")} `);
|
|
1208
|
-
}, "extendLog");
|
|
1209
|
-
async function format(context, path, data, force = false) {
|
|
1210
|
-
if (!force && (isParentPath.isParentPath(path, append.appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot)) || isParentPath.isParentPath(path, append.appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot)))) {
|
|
1211
|
-
return data;
|
|
1212
|
-
}
|
|
1213
|
-
let code = data;
|
|
1214
|
-
const resolvedConfig = await prettier.resolveConfig(path);
|
|
1215
|
-
if (resolvedConfig) {
|
|
1216
|
-
code = await prettier.format(data, {
|
|
1217
|
-
absolutePath: path,
|
|
1218
|
-
...resolvedConfig
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
|
-
return code;
|
|
1222
|
-
}
|
|
1223
|
-
chunkSHUYVCID_js.__name(format, "format");
|
|
1224
|
-
async function formatFolder(context, path) {
|
|
1225
|
-
if (!isParentPath.isParentPath(path, append.appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot)) && !isParentPath.isParentPath(path, append.appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot))) {
|
|
1226
|
-
await Promise.allSettled((await listFiles.listFiles(path)).map(async (file) => {
|
|
1227
|
-
if (!isParentPath.isParentPath(file, append.appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot)) && !isParentPath.isParentPath(file, append.appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot))) {
|
|
1228
|
-
const data = await context.fs.read(file);
|
|
1229
|
-
if (data) {
|
|
1230
|
-
const formatted = await format(context, file, data);
|
|
1231
|
-
return context.fs.write(file, formatted);
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
}));
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
chunkSHUYVCID_js.__name(formatFolder, "formatFolder");
|
|
1238
|
-
function isFileError(err) {
|
|
1239
|
-
return isError.isError(err) && "code" in err && err.code;
|
|
1240
|
-
}
|
|
1241
|
-
chunkSHUYVCID_js.__name(isFileError, "isFileError");
|
|
1242
|
-
function ignoreNotfound(err) {
|
|
1243
|
-
return isFileError(err) && (err.code === "ENOENT" || err.code === "EISDIR" ? null : err);
|
|
1244
|
-
}
|
|
1245
|
-
chunkSHUYVCID_js.__name(ignoreNotfound, "ignoreNotfound");
|
|
1246
|
-
function toFilePath(path) {
|
|
1247
|
-
return correctPath.correctPath(slash.slash(path?.toString() || ".").replace(/^file:\/\//, ""));
|
|
1248
|
-
}
|
|
1249
|
-
chunkSHUYVCID_js.__name(toFilePath, "toFilePath");
|
|
1250
|
-
function isValidId(id, prefix = "powerlines") {
|
|
1251
|
-
return id.replace(/^\\0/, "").startsWith(`${prefix.replace(/:$/, "")}`);
|
|
1252
|
-
}
|
|
1253
|
-
chunkSHUYVCID_js.__name(isValidId, "isValidId");
|
|
1254
|
-
function normalizeId(id, prefix = "powerlines") {
|
|
1255
|
-
return replace.replaceExtension(toFilePath(id)).replace(/^\\0/, "").replace(/^powerlines:/, "").replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), "");
|
|
1256
|
-
}
|
|
1257
|
-
chunkSHUYVCID_js.__name(normalizeId, "normalizeId");
|
|
1258
|
-
function normalizePath(path, builtinsPath, prefix = "powerlines") {
|
|
1259
|
-
return isType.isAbsolutePath(path) ? path : isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
|
|
1260
|
-
}
|
|
1261
|
-
chunkSHUYVCID_js.__name(normalizePath, "normalizePath");
|
|
1262
|
-
function normalizeGlobPatterns(workspaceRoot, patterns) {
|
|
1263
|
-
return getUnique.getUnique(toArray.toArray(patterns).map((pattern) => {
|
|
1264
|
-
if (isSetObject.isSetObject(pattern) && (isSetString.isSetString(pattern.input) || isSetString.isSetString(pattern.glob))) {
|
|
1265
|
-
return join.joinPaths(pattern.input || workspaceRoot, pattern.glob || "**/*");
|
|
1266
|
-
} else if (!isSetString.isSetString(pattern)) {
|
|
1267
|
-
return void 0;
|
|
1268
|
-
}
|
|
1269
|
-
return pattern;
|
|
1270
|
-
}).filter(isSetString.isSetString));
|
|
1271
|
-
}
|
|
1272
|
-
chunkSHUYVCID_js.__name(normalizeGlobPatterns, "normalizeGlobPatterns");
|
|
1273
1103
|
var BaseStorageAdapter = class {
|
|
1274
1104
|
static {
|
|
1275
1105
|
chunkSHUYVCID_js.__name(this, "BaseStorageAdapter");
|
|
@@ -1472,8 +1302,16 @@ var BaseStorageAdapter = class {
|
|
|
1472
1302
|
}
|
|
1473
1303
|
}
|
|
1474
1304
|
};
|
|
1305
|
+
function isFileError(err) {
|
|
1306
|
+
return isError.isError(err) && "code" in err && err.code;
|
|
1307
|
+
}
|
|
1308
|
+
chunkSHUYVCID_js.__name(isFileError, "isFileError");
|
|
1309
|
+
function ignoreNotfound(err) {
|
|
1310
|
+
return isFileError(err) && (err.code === "ENOENT" || err.code === "EISDIR" ? null : err);
|
|
1311
|
+
}
|
|
1312
|
+
chunkSHUYVCID_js.__name(ignoreNotfound, "ignoreNotfound");
|
|
1475
1313
|
|
|
1476
|
-
// ../powerlines/src/
|
|
1314
|
+
// ../powerlines/src/storage/file-system.ts
|
|
1477
1315
|
var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
1478
1316
|
static {
|
|
1479
1317
|
chunkSHUYVCID_js.__name(this, "FileSystemStorageAdapter");
|
|
@@ -1727,7 +1565,34 @@ var VirtualStorageAdapter = class extends BaseStorageAdapter {
|
|
|
1727
1565
|
}
|
|
1728
1566
|
};
|
|
1729
1567
|
|
|
1730
|
-
// ../powerlines/src/
|
|
1568
|
+
// ../powerlines/src/_internal/vfs.ts
|
|
1569
|
+
function toFilePath(path) {
|
|
1570
|
+
return correctPath.correctPath(slash.slash(path?.toString() || ".").replace(/^file:\/\//, ""));
|
|
1571
|
+
}
|
|
1572
|
+
chunkSHUYVCID_js.__name(toFilePath, "toFilePath");
|
|
1573
|
+
function isValidId(id, prefix = "powerlines") {
|
|
1574
|
+
return id.replace(/^\\0/, "").startsWith(`${prefix.replace(/:$/, "")}`);
|
|
1575
|
+
}
|
|
1576
|
+
chunkSHUYVCID_js.__name(isValidId, "isValidId");
|
|
1577
|
+
function normalizeId(id, prefix = "powerlines") {
|
|
1578
|
+
return replace.replaceExtension(toFilePath(id)).replace(/^\\0/, "").replace(/^powerlines:/, "").replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), "");
|
|
1579
|
+
}
|
|
1580
|
+
chunkSHUYVCID_js.__name(normalizeId, "normalizeId");
|
|
1581
|
+
function normalizePath(path, builtinsPath, prefix = "powerlines") {
|
|
1582
|
+
return isType.isAbsolutePath(path) ? path : isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
|
|
1583
|
+
}
|
|
1584
|
+
chunkSHUYVCID_js.__name(normalizePath, "normalizePath");
|
|
1585
|
+
function normalizeGlobPatterns(workspaceRoot, patterns) {
|
|
1586
|
+
return getUnique.getUnique(toArray.toArray(patterns).map((pattern) => {
|
|
1587
|
+
if (isSetObject.isSetObject(pattern) && (isSetString.isSetString(pattern.input) || isSetString.isSetString(pattern.glob))) {
|
|
1588
|
+
return join.joinPaths(pattern.input || workspaceRoot, pattern.glob || "**/*");
|
|
1589
|
+
} else if (!isSetString.isSetString(pattern)) {
|
|
1590
|
+
return void 0;
|
|
1591
|
+
}
|
|
1592
|
+
return pattern;
|
|
1593
|
+
}).filter(isSetString.isSetString));
|
|
1594
|
+
}
|
|
1595
|
+
chunkSHUYVCID_js.__name(normalizeGlobPatterns, "normalizeGlobPatterns");
|
|
1731
1596
|
var VirtualFileSystem = class _VirtualFileSystem {
|
|
1732
1597
|
static {
|
|
1733
1598
|
chunkSHUYVCID_js.__name(this, "VirtualFileSystem");
|
|
@@ -1789,7 +1654,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1789
1654
|
* @returns The normalized path.
|
|
1790
1655
|
*/
|
|
1791
1656
|
#normalizePath(path) {
|
|
1792
|
-
return normalizePath(path.includes("{") || path.includes("}") ? replacePathTokens(this.#context, path) : path, this.#context.builtinsPath, this.#context.config.framework);
|
|
1657
|
+
return normalizePath(path.includes("{") || path.includes("}") ? chunkFSGRYCTL_js.replacePathTokens(this.#context, path) : path, this.#context.builtinsPath, this.#context.config.framework);
|
|
1793
1658
|
}
|
|
1794
1659
|
/**
|
|
1795
1660
|
* Gets the storage adapter and relative key for a given key.
|
|
@@ -1853,8 +1718,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1853
1718
|
static async create(context) {
|
|
1854
1719
|
context.debug("Starting virtual file system (VFS) initialization processes...");
|
|
1855
1720
|
let result;
|
|
1856
|
-
if (!context.config.skipCache && exists.existsSync(
|
|
1857
|
-
const buffer$1 = await buffer.readFileBuffer(
|
|
1721
|
+
if (!context.config.skipCache && exists.existsSync(join.joinPaths(context.dataPath, "fs.bin"))) {
|
|
1722
|
+
const buffer$1 = await buffer.readFileBuffer(join.joinPaths(context.dataPath, "fs.bin"));
|
|
1858
1723
|
const message = new $__namespace.Message(buffer$1, false);
|
|
1859
1724
|
const fs = message.getRoot(FileSystem);
|
|
1860
1725
|
result = new _VirtualFileSystem(context, fs);
|
|
@@ -1899,8 +1764,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1899
1764
|
static createSync(context) {
|
|
1900
1765
|
context.debug("Starting virtual file system (VFS) initialization processes...");
|
|
1901
1766
|
let result;
|
|
1902
|
-
if (!context.config.skipCache && exists.existsSync(
|
|
1903
|
-
const buffer$1 = buffer.readFileBufferSync(
|
|
1767
|
+
if (!context.config.skipCache && exists.existsSync(join.joinPaths(context.dataPath, "fs.bin"))) {
|
|
1768
|
+
const buffer$1 = buffer.readFileBufferSync(join.joinPaths(context.dataPath, "fs.bin"));
|
|
1904
1769
|
const message = new $__namespace.Message(buffer$1, false);
|
|
1905
1770
|
const fs = message.getRoot(FileSystem);
|
|
1906
1771
|
result = new _VirtualFileSystem(context, fs);
|
|
@@ -2078,7 +1943,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2078
1943
|
return ret;
|
|
2079
1944
|
}, {});
|
|
2080
1945
|
}
|
|
2081
|
-
this.#log = extendLog(this.#context.log, "file-system");
|
|
1946
|
+
this.#log = chunkFSGRYCTL_js.extendLog(this.#context.log, "file-system");
|
|
2082
1947
|
}
|
|
2083
1948
|
/**
|
|
2084
1949
|
* Asynchronously checks if a file exists in the virtual file system (VFS).
|
|
@@ -2443,7 +2308,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2443
2308
|
let code = data;
|
|
2444
2309
|
try {
|
|
2445
2310
|
if (!options.skipFormat) {
|
|
2446
|
-
code = await format(this.#context, resolvedPath, data);
|
|
2311
|
+
code = await chunkFSGRYCTL_js.format(this.#context, resolvedPath, data);
|
|
2447
2312
|
}
|
|
2448
2313
|
} catch (err) {
|
|
2449
2314
|
if ([
|
|
@@ -2542,9 +2407,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2542
2407
|
*/
|
|
2543
2408
|
resolveAlias(id) {
|
|
2544
2409
|
let path = id;
|
|
2545
|
-
if (this.#context.config.
|
|
2546
|
-
if (Array.isArray(this.#context.config.
|
|
2547
|
-
const found = this.#context.config.
|
|
2410
|
+
if (this.#context.config.resolve.alias) {
|
|
2411
|
+
if (Array.isArray(this.#context.config.resolve.alias) && this.#context.config.resolve.alias.length > 0) {
|
|
2412
|
+
const found = this.#context.config.resolve.alias.filter((alias) => isSetString.isSetString(alias.find) && (alias.find === path || path.startsWith(`${alias.find}/`)) || isRegexp.isRegExp(alias.find) && alias.find.test(path));
|
|
2548
2413
|
if (found.length > 0) {
|
|
2549
2414
|
const alias = found.reduce((ret, current) => {
|
|
2550
2415
|
const retLength = isSetString.isSetString(ret.find) ? ret.find.length : isRegexp.isRegExp(ret.find) ? ret.find.source.length : 0;
|
|
@@ -2557,13 +2422,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2557
2422
|
path = path.replace(alias.find, alias.replacement);
|
|
2558
2423
|
}
|
|
2559
2424
|
}
|
|
2560
|
-
} else if (isSetObject.isSetObject(this.#context.config.
|
|
2561
|
-
const found = Object.keys(this.#context.config.
|
|
2425
|
+
} else if (isSetObject.isSetObject(this.#context.config.resolve.alias)) {
|
|
2426
|
+
const found = Object.keys(this.#context.config.resolve.alias).filter((key) => key === path || path.startsWith(`${key}/`));
|
|
2562
2427
|
if (found.length > 0) {
|
|
2563
2428
|
const alias = found.reduce((ret, current) => {
|
|
2564
2429
|
return ret.length > current.length ? ret : current;
|
|
2565
2430
|
});
|
|
2566
|
-
path = path.replace(new RegExp(`^${alias}`), this.#context.config.
|
|
2431
|
+
path = path.replace(new RegExp(`^${alias}`), this.#context.config.resolve.alias[alias]);
|
|
2567
2432
|
}
|
|
2568
2433
|
}
|
|
2569
2434
|
}
|
|
@@ -2588,7 +2453,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2588
2453
|
async resolve(id, importer, options = {}) {
|
|
2589
2454
|
let path = id;
|
|
2590
2455
|
if (path.includes("{") || path.includes("}")) {
|
|
2591
|
-
path = replacePathTokens(this.#context, path);
|
|
2456
|
+
path = chunkFSGRYCTL_js.replacePathTokens(this.#context, path);
|
|
2592
2457
|
}
|
|
2593
2458
|
if (options.skipAlias !== true) {
|
|
2594
2459
|
path = this.resolveAlias(path);
|
|
@@ -2615,8 +2480,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2615
2480
|
paths.push(importer);
|
|
2616
2481
|
}
|
|
2617
2482
|
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2618
|
-
paths.push(append.appendPath(this.#context.config.
|
|
2619
|
-
paths.push(append.appendPath(this.#context.config.
|
|
2483
|
+
paths.push(append.appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot));
|
|
2484
|
+
paths.push(append.appendPath(join.joinPaths(this.#context.config.root, "src"), this.#context.workspaceConfig.workspaceRoot));
|
|
2620
2485
|
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)));
|
|
2621
2486
|
for (const combination of resolve.getResolutionCombinations(path, {
|
|
2622
2487
|
paths
|
|
@@ -2661,7 +2526,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2661
2526
|
resolveSync(id, importer, options = {}) {
|
|
2662
2527
|
let path = id;
|
|
2663
2528
|
if (path.includes("{") || path.includes("}")) {
|
|
2664
|
-
path = replacePathTokens(this.#context, path);
|
|
2529
|
+
path = chunkFSGRYCTL_js.replacePathTokens(this.#context, path);
|
|
2665
2530
|
}
|
|
2666
2531
|
if (options.skipAlias !== true) {
|
|
2667
2532
|
path = this.resolveAlias(path);
|
|
@@ -2683,8 +2548,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2683
2548
|
paths.push(importer);
|
|
2684
2549
|
}
|
|
2685
2550
|
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2686
|
-
paths.push(append.appendPath(this.#context.config.
|
|
2687
|
-
paths.push(append.appendPath(this.#context.config.
|
|
2551
|
+
paths.push(append.appendPath(this.#context.config.root, this.#context.workspaceConfig.workspaceRoot));
|
|
2552
|
+
paths.push(append.appendPath(join.joinPaths(this.#context.config.root, "src"), this.#context.workspaceConfig.workspaceRoot));
|
|
2688
2553
|
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)));
|
|
2689
2554
|
for (const combination of resolve.getResolutionCombinations(path, {
|
|
2690
2555
|
paths
|
|
@@ -2717,7 +2582,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2717
2582
|
if (!this.#isDisposed) {
|
|
2718
2583
|
this.#isDisposed = true;
|
|
2719
2584
|
this.#log(types.LogLevelLabel.DEBUG, "Disposing virtual file system...");
|
|
2720
|
-
await this.remove(
|
|
2585
|
+
await this.remove(join.joinPaths(this.#context.dataPath, "fs.bin"));
|
|
2721
2586
|
const message = new $__namespace.Message();
|
|
2722
2587
|
const fs = message.initRoot(FileSystem);
|
|
2723
2588
|
const storage = fs._initStorage(Object.keys(this.#paths).length);
|
|
@@ -2748,7 +2613,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2748
2613
|
});
|
|
2749
2614
|
}
|
|
2750
2615
|
});
|
|
2751
|
-
await buffer.writeFileBuffer(
|
|
2616
|
+
await buffer.writeFileBuffer(join.joinPaths(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
|
|
2752
2617
|
if (!this.#context.config.skipCache) {
|
|
2753
2618
|
this.#resolverCache.save(true);
|
|
2754
2619
|
}
|
|
@@ -2784,7 +2649,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2784
2649
|
}
|
|
2785
2650
|
};
|
|
2786
2651
|
|
|
2787
|
-
// ../powerlines/src/
|
|
2652
|
+
// ../powerlines/src/context/context.ts
|
|
2788
2653
|
var configCache = /* @__PURE__ */ new WeakMap();
|
|
2789
2654
|
var envPathCache = /* @__PURE__ */ new WeakMap();
|
|
2790
2655
|
var agent = new undici.Agent({
|
|
@@ -2821,35 +2686,31 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2821
2686
|
#requestCache;
|
|
2822
2687
|
#getConfigProps(config = {}) {
|
|
2823
2688
|
return mergeConfig({
|
|
2824
|
-
|
|
2825
|
-
projectType: config.type,
|
|
2826
|
-
projectRoot: config.root,
|
|
2689
|
+
root: config.root,
|
|
2827
2690
|
name: config.name,
|
|
2828
2691
|
title: config.title,
|
|
2829
2692
|
organization: config.organization,
|
|
2830
2693
|
compatibilityDate: compatx.resolveCompatibilityDates(config.compatibilityDate, "latest"),
|
|
2831
2694
|
description: config.description,
|
|
2832
|
-
sourceRoot: config.sourceRoot,
|
|
2833
2695
|
configFile: config.configFile,
|
|
2696
|
+
projectType: config.projectType,
|
|
2834
2697
|
customLogger: config.customLogger,
|
|
2835
2698
|
logLevel: config.logLevel,
|
|
2836
2699
|
tsconfig: config.tsconfig,
|
|
2837
2700
|
tsconfigRaw: config.tsconfigRaw,
|
|
2838
2701
|
skipCache: config.skipCache,
|
|
2839
2702
|
autoInstall: config.autoInstall,
|
|
2840
|
-
|
|
2703
|
+
input: config.input,
|
|
2841
2704
|
output: config.output,
|
|
2842
2705
|
plugins: config.plugins,
|
|
2843
2706
|
mode: config.mode,
|
|
2844
|
-
|
|
2845
|
-
transform: config.transform,
|
|
2846
|
-
build: config.build,
|
|
2707
|
+
resolve: config.resolve,
|
|
2847
2708
|
framework: config.framework,
|
|
2848
2709
|
...config
|
|
2849
2710
|
}, {
|
|
2850
2711
|
output: config.framework ? {
|
|
2851
2712
|
artifactsPath: `.${config.framework ?? "powerlines"}`,
|
|
2852
|
-
dts: join.joinPaths(config.root ?? this.config.
|
|
2713
|
+
dts: join.joinPaths(config.root ?? this.config.root, `${config.framework ?? "powerlines"}.d.ts`)
|
|
2853
2714
|
} : {}
|
|
2854
2715
|
});
|
|
2855
2716
|
}
|
|
@@ -2861,7 +2722,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2861
2722
|
* @returns A promise that resolves to the new context.
|
|
2862
2723
|
*/
|
|
2863
2724
|
static async from(workspaceRoot, config) {
|
|
2864
|
-
const context = new _PowerlinesContext(await
|
|
2725
|
+
const context = new _PowerlinesContext(await chunkFSGRYCTL_js.loadWorkspaceConfig(workspaceRoot, config.root));
|
|
2865
2726
|
await context.withUserConfig(config);
|
|
2866
2727
|
const powerlinesPath = await resolve.resolvePackage("powerlines");
|
|
2867
2728
|
if (!powerlinesPath) {
|
|
@@ -2928,8 +2789,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2928
2789
|
* The resolved entry type definitions for the project
|
|
2929
2790
|
*/
|
|
2930
2791
|
get entry() {
|
|
2931
|
-
const entry = this.
|
|
2932
|
-
return resolveEntriesSync(this,
|
|
2792
|
+
const entry = this.resolvedEntry;
|
|
2793
|
+
return chunkFSGRYCTL_js.resolveEntriesSync(this, entry && entry.length > 0 ? entry : Array.isArray(this.config.input) || isSetObject.isSetObject(this.config.input) && !isRegexp.isRegExp(this.config.input) ? this.config.input : toArray.toArray(this.config.input));
|
|
2933
2794
|
}
|
|
2934
2795
|
/**
|
|
2935
2796
|
* The TypeScript configuration parsed from the tsconfig file
|
|
@@ -2973,14 +2834,14 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2973
2834
|
releaseId: this.#releaseId,
|
|
2974
2835
|
checksum: this.#checksum,
|
|
2975
2836
|
timestamp: this.#timestamp,
|
|
2976
|
-
|
|
2837
|
+
rootHash: murmurhash.murmurhash({
|
|
2977
2838
|
workspaceRoot: this.workspaceConfig?.workspaceRoot,
|
|
2978
|
-
|
|
2839
|
+
root: this.config?.root
|
|
2979
2840
|
}, {
|
|
2980
|
-
maxLength:
|
|
2841
|
+
maxLength: chunkFSGRYCTL_js.ROOT_HASH_LENGTH
|
|
2981
2842
|
}),
|
|
2982
2843
|
configHash: murmurhash.murmurhash(this.config, {
|
|
2983
|
-
maxLength:
|
|
2844
|
+
maxLength: chunkFSGRYCTL_js.CACHE_HASH_LENGTH
|
|
2984
2845
|
})
|
|
2985
2846
|
};
|
|
2986
2847
|
}
|
|
@@ -3033,7 +2894,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3033
2894
|
* Get the path to the artifacts directory for the project
|
|
3034
2895
|
*/
|
|
3035
2896
|
get artifactsPath() {
|
|
3036
|
-
return join.joinPaths(this.workspaceConfig.workspaceRoot, this.config.
|
|
2897
|
+
return join.joinPaths(this.workspaceConfig.workspaceRoot, this.config.root, this.config.output.artifactsPath);
|
|
3037
2898
|
}
|
|
3038
2899
|
/**
|
|
3039
2900
|
* Get the path to the builtin modules used by the project
|
|
@@ -3051,7 +2912,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3051
2912
|
* Get the path to the data directory for the project
|
|
3052
2913
|
*/
|
|
3053
2914
|
get dataPath() {
|
|
3054
|
-
return join.joinPaths(this.envPaths.data, "projects",
|
|
2915
|
+
return join.joinPaths(this.envPaths.data, "projects", getPrefixedRootHash(this.config.name, this.meta.rootHash));
|
|
3055
2916
|
}
|
|
3056
2917
|
/**
|
|
3057
2918
|
* Get the path to the cache directory for the project
|
|
@@ -3061,20 +2922,20 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3061
2922
|
checksum: this.#checksum,
|
|
3062
2923
|
config: this.meta.configHash
|
|
3063
2924
|
}, {
|
|
3064
|
-
maxLength:
|
|
2925
|
+
maxLength: chunkFSGRYCTL_js.CACHE_HASH_LENGTH
|
|
3065
2926
|
}));
|
|
3066
2927
|
}
|
|
3067
2928
|
/**
|
|
3068
2929
|
* Get the path to the generated declaration file for the project
|
|
3069
2930
|
*/
|
|
3070
2931
|
get dtsPath() {
|
|
3071
|
-
return this.config.output.dts ? append.appendPath(this.config.output.dts, this.workspaceConfig.workspaceRoot) : join.joinPaths(this.workspaceConfig.workspaceRoot, this.config.
|
|
2932
|
+
return this.config.output.dts ? append.appendPath(this.config.output.dts, this.workspaceConfig.workspaceRoot) : join.joinPaths(this.workspaceConfig.workspaceRoot, this.config.root, "powerlines.d.ts");
|
|
3072
2933
|
}
|
|
3073
2934
|
/**
|
|
3074
2935
|
* Get the project root relative to the workspace root
|
|
3075
2936
|
*/
|
|
3076
2937
|
get relativeToWorkspaceRoot() {
|
|
3077
|
-
return getWorkspaceRoot.relativeToWorkspaceRoot(this.config.
|
|
2938
|
+
return getWorkspaceRoot.relativeToWorkspaceRoot(this.config.root);
|
|
3078
2939
|
}
|
|
3079
2940
|
/**
|
|
3080
2941
|
* The builtin module id that exist in the Powerlines virtual file system
|
|
@@ -3098,12 +2959,12 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3098
2959
|
}
|
|
3099
2960
|
}
|
|
3100
2961
|
return ret;
|
|
3101
|
-
}, this.config.
|
|
2962
|
+
}, this.config.resolve.alias ? Array.isArray(this.config.resolve.alias) ? this.config.resolve.alias.reduce((ret, alias) => {
|
|
3102
2963
|
if (!ret[alias.find.toString()]) {
|
|
3103
2964
|
ret[alias.find.toString()] = alias.replacement;
|
|
3104
2965
|
}
|
|
3105
2966
|
return ret;
|
|
3106
|
-
}, {}) : this.config.
|
|
2967
|
+
}, {}) : this.config.resolve.alias : {});
|
|
3107
2968
|
}
|
|
3108
2969
|
/**
|
|
3109
2970
|
* Gets the parser cache.
|
|
@@ -3138,7 +2999,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3138
2999
|
/**
|
|
3139
3000
|
* The entry points that exist in the Powerlines virtual file system
|
|
3140
3001
|
*/
|
|
3141
|
-
get
|
|
3002
|
+
get resolvedEntry() {
|
|
3142
3003
|
return Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.type === "entry").map(([path, meta]) => {
|
|
3143
3004
|
const typeDefinition = {
|
|
3144
3005
|
file: path
|
|
@@ -3279,22 +3140,22 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3279
3140
|
*/
|
|
3280
3141
|
async resolve(id, importer, options = {}) {
|
|
3281
3142
|
let moduleId = id;
|
|
3282
|
-
if (this.config.
|
|
3283
|
-
if (Array.isArray(this.config.
|
|
3284
|
-
const alias = this.config.
|
|
3143
|
+
if (this.config.resolve.alias) {
|
|
3144
|
+
if (Array.isArray(this.config.resolve.alias)) {
|
|
3145
|
+
const alias = this.config.resolve.alias.find((a) => bundleRequire.match(moduleId, [
|
|
3285
3146
|
a.find
|
|
3286
3147
|
]));
|
|
3287
3148
|
if (alias) {
|
|
3288
3149
|
moduleId = alias.replacement;
|
|
3289
3150
|
}
|
|
3290
|
-
} else if (isSetObject.isSetObject(this.config.
|
|
3291
|
-
moduleId = this.config.
|
|
3151
|
+
} else if (isSetObject.isSetObject(this.config.resolve.alias) && this.config.resolve.alias[id]) {
|
|
3152
|
+
moduleId = this.config.resolve.alias[id];
|
|
3292
3153
|
}
|
|
3293
3154
|
}
|
|
3294
3155
|
if (this.fs.isVirtual(moduleId)) {
|
|
3295
3156
|
const result = await this.fs.resolve(moduleId, importer, {
|
|
3296
|
-
conditions: this.config.
|
|
3297
|
-
extensions: this.config.
|
|
3157
|
+
conditions: this.config.resolve.conditions,
|
|
3158
|
+
extensions: this.config.resolve.extensions,
|
|
3298
3159
|
...options
|
|
3299
3160
|
});
|
|
3300
3161
|
if (!result) {
|
|
@@ -3305,11 +3166,11 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3305
3166
|
external: this.config.projectType !== "application"
|
|
3306
3167
|
};
|
|
3307
3168
|
}
|
|
3308
|
-
if (this.config.
|
|
3309
|
-
if (bundleRequire.match(moduleId, this.resolvePatterns) || bundleRequire.match(moduleId, this.config.
|
|
3169
|
+
if (this.config.resolve.skipNodeModulesBundle) {
|
|
3170
|
+
if (bundleRequire.match(moduleId, this.resolvePatterns) || bundleRequire.match(moduleId, this.config.resolve.noExternal)) {
|
|
3310
3171
|
return void 0;
|
|
3311
3172
|
}
|
|
3312
|
-
if (bundleRequire.match(moduleId, this.config.
|
|
3173
|
+
if (bundleRequire.match(moduleId, this.config.resolve.external) || moduleId.startsWith("node:")) {
|
|
3313
3174
|
return {
|
|
3314
3175
|
id: moduleId,
|
|
3315
3176
|
external: true
|
|
@@ -3322,10 +3183,10 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3322
3183
|
};
|
|
3323
3184
|
}
|
|
3324
3185
|
} else {
|
|
3325
|
-
if (bundleRequire.match(moduleId, this.config.
|
|
3186
|
+
if (bundleRequire.match(moduleId, this.config.resolve.noExternal)) {
|
|
3326
3187
|
return void 0;
|
|
3327
3188
|
}
|
|
3328
|
-
if (bundleRequire.match(moduleId, this.config.
|
|
3189
|
+
if (bundleRequire.match(moduleId, this.config.resolve.external) || moduleId.startsWith("node:")) {
|
|
3329
3190
|
return {
|
|
3330
3191
|
id: moduleId,
|
|
3331
3192
|
external: true
|
|
@@ -3589,7 +3450,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3589
3450
|
* @returns A logger function
|
|
3590
3451
|
*/
|
|
3591
3452
|
createLog(name = null) {
|
|
3592
|
-
return createLog(name, {
|
|
3453
|
+
return chunkFSGRYCTL_js.createLog(name, {
|
|
3593
3454
|
...this.config,
|
|
3594
3455
|
logLevel: isNull.isNull(this.config.logLevel) ? "silent" : this.config.logLevel
|
|
3595
3456
|
});
|
|
@@ -3601,7 +3462,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3601
3462
|
* @returns A logger function
|
|
3602
3463
|
*/
|
|
3603
3464
|
extendLog(name) {
|
|
3604
|
-
return extendLog(this.log, name);
|
|
3465
|
+
return chunkFSGRYCTL_js.extendLog(this.log, name);
|
|
3605
3466
|
}
|
|
3606
3467
|
/**
|
|
3607
3468
|
* Generates a checksum representing the current context state
|
|
@@ -3609,7 +3470,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3609
3470
|
* @param root - The root directory of the project to generate the checksum for
|
|
3610
3471
|
* @returns A promise that resolves to a string representing the checksum
|
|
3611
3472
|
*/
|
|
3612
|
-
async generateChecksum(root = this.config.
|
|
3473
|
+
async generateChecksum(root = this.config.root) {
|
|
3613
3474
|
this.#checksum = await hashFiles.hashDirectory(root, {
|
|
3614
3475
|
ignore: [
|
|
3615
3476
|
"node_modules",
|
|
@@ -3655,13 +3516,13 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3655
3516
|
isHighPriority: true
|
|
3656
3517
|
}) {
|
|
3657
3518
|
const cacheKey = {
|
|
3658
|
-
|
|
3519
|
+
root: config.root ?? this.config.root ?? this.config.userConfig?.root ?? this.config.inlineConfig?.root,
|
|
3659
3520
|
mode: (config.mode ?? this.config.mode) || this.workspaceConfig.mode,
|
|
3660
3521
|
skipCache: config.skipCache ?? this.config.skipCache ?? false,
|
|
3661
3522
|
configFile: config.configFile ?? this.config.configFile,
|
|
3662
3523
|
framework: config.framework ?? this.config.framework ?? "powerlines",
|
|
3663
3524
|
command: this.config.inlineConfig?.command,
|
|
3664
|
-
alias: this.config.
|
|
3525
|
+
alias: this.config.resolve?.alias ?? config.resolve?.alias
|
|
3665
3526
|
};
|
|
3666
3527
|
if (configCache.has(cacheKey)) {
|
|
3667
3528
|
const result = configCache.get(cacheKey);
|
|
@@ -3671,28 +3532,28 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3671
3532
|
this.resolver = result.resolver;
|
|
3672
3533
|
this.mergeUserConfig(result.userConfig.config, this.config.userConfig);
|
|
3673
3534
|
} else {
|
|
3674
|
-
const projectJsonPath = join.joinPaths(cacheKey.
|
|
3535
|
+
const projectJsonPath = join.joinPaths(cacheKey.root, "project.json");
|
|
3675
3536
|
if (exists.existsSync(projectJsonPath)) {
|
|
3676
3537
|
this.projectJson = await json.readJsonFile(projectJsonPath);
|
|
3677
3538
|
}
|
|
3678
|
-
const packageJsonPath = join.joinPaths(cacheKey.
|
|
3539
|
+
const packageJsonPath = join.joinPaths(cacheKey.root, "package.json");
|
|
3679
3540
|
if (exists.existsSync(packageJsonPath)) {
|
|
3680
3541
|
this.packageJson = await json.readJsonFile(packageJsonPath);
|
|
3681
3542
|
}
|
|
3682
|
-
this.#checksum = await this.generateChecksum(cacheKey.
|
|
3543
|
+
this.#checksum = await this.generateChecksum(cacheKey.root);
|
|
3683
3544
|
this.resolver = createResolver({
|
|
3684
3545
|
workspaceRoot: this.workspaceConfig.workspaceRoot,
|
|
3685
|
-
|
|
3546
|
+
root: cacheKey.root,
|
|
3686
3547
|
cacheDir: this.cachePath,
|
|
3687
3548
|
mode: cacheKey.mode,
|
|
3688
3549
|
logLevel: config.logLevel || this.config.logLevel || this.workspaceConfig.logLevel || "info",
|
|
3689
3550
|
skipCache: cacheKey.skipCache,
|
|
3690
|
-
alias: this.config.
|
|
3551
|
+
alias: this.config.resolve?.alias ? Array.isArray(this.config.resolve.alias) ? this.config.resolve.alias.reduce((ret, alias) => {
|
|
3691
3552
|
ret[alias.find.toString()] = alias.replacement;
|
|
3692
3553
|
return ret;
|
|
3693
|
-
}, {}) : this.config.
|
|
3554
|
+
}, {}) : this.config.resolve.alias : {}
|
|
3694
3555
|
});
|
|
3695
|
-
const userConfig = await
|
|
3556
|
+
const userConfig = await chunkFSGRYCTL_js.loadUserConfigFile(cacheKey.root, this.workspaceConfig.workspaceRoot, this.resolver, cacheKey.command, cacheKey.mode, cacheKey.configFile, cacheKey.framework);
|
|
3696
3557
|
this.mergeUserConfig(userConfig.config);
|
|
3697
3558
|
configCache.set(cacheKey, {
|
|
3698
3559
|
projectJson: this.projectJson,
|
|
@@ -3702,14 +3563,14 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3702
3563
|
userConfig
|
|
3703
3564
|
});
|
|
3704
3565
|
}
|
|
3705
|
-
config.tsconfig ??= getTsconfigFilePath(this.workspaceConfig.workspaceRoot, cacheKey.
|
|
3566
|
+
config.tsconfig ??= getTsconfigFilePath(this.workspaceConfig.workspaceRoot, cacheKey.root, config.tsconfig);
|
|
3706
3567
|
if (isSetObject.isSetObject(config)) {
|
|
3707
3568
|
this.resolvedConfig = mergeConfig({
|
|
3708
3569
|
inlineConfig: this.config.inlineConfig,
|
|
3709
3570
|
userConfig: this.config.userConfig
|
|
3710
3571
|
}, options.isHighPriority ? this.#getConfigProps(config) : {}, {
|
|
3711
|
-
|
|
3712
|
-
|
|
3572
|
+
...this.#getConfigProps(this.config.inlineConfig),
|
|
3573
|
+
command: this.config.inlineConfig?.command
|
|
3713
3574
|
}, this.#getConfigProps(this.config.userConfig), {
|
|
3714
3575
|
mode: this.workspaceConfig?.mode,
|
|
3715
3576
|
logLevel: this.workspaceConfig?.logLevel,
|
|
@@ -3718,21 +3579,20 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3718
3579
|
name: this.projectJson?.name || this.packageJson?.name,
|
|
3719
3580
|
version: this.packageJson?.version,
|
|
3720
3581
|
description: this.packageJson?.description,
|
|
3721
|
-
sourceRoot: this.projectJson?.sourceRoot || append.appendPath("src", cacheKey.projectRoot),
|
|
3722
3582
|
output: mergeConfig(config.output ?? {}, {
|
|
3723
|
-
outputPath: cacheKey.
|
|
3583
|
+
outputPath: cacheKey.root ? join.joinPaths(this.workspaceConfig?.directories?.build || "dist", cacheKey.root) : this.workspaceConfig?.directories?.build || "dist",
|
|
3724
3584
|
artifactsPath: `.${config.framework ?? "powerlines"}`,
|
|
3725
|
-
dts: join.joinPaths(cacheKey.
|
|
3585
|
+
dts: join.joinPaths(cacheKey.root, `${config.framework ?? "powerlines"}.d.ts`),
|
|
3726
3586
|
assets: [
|
|
3727
3587
|
{
|
|
3728
3588
|
glob: "LICENSE"
|
|
3729
3589
|
},
|
|
3730
3590
|
{
|
|
3731
|
-
input: cacheKey.
|
|
3591
|
+
input: cacheKey.root,
|
|
3732
3592
|
glob: "*.md"
|
|
3733
3593
|
},
|
|
3734
3594
|
{
|
|
3735
|
-
input: cacheKey.
|
|
3595
|
+
input: cacheKey.root,
|
|
3736
3596
|
glob: "package.json"
|
|
3737
3597
|
}
|
|
3738
3598
|
]
|
|
@@ -3743,42 +3603,30 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3743
3603
|
framework: "powerlines",
|
|
3744
3604
|
mode: "production",
|
|
3745
3605
|
projectType: "application",
|
|
3606
|
+
platform: "neutral",
|
|
3746
3607
|
logLevel: "info",
|
|
3747
3608
|
preview: false,
|
|
3748
3609
|
environments: {},
|
|
3749
|
-
|
|
3750
|
-
babel: {
|
|
3751
|
-
plugins: [],
|
|
3752
|
-
presets: []
|
|
3753
|
-
}
|
|
3754
|
-
},
|
|
3755
|
-
lint: {
|
|
3756
|
-
eslint: {}
|
|
3757
|
-
},
|
|
3758
|
-
build: {
|
|
3759
|
-
target: "esnext",
|
|
3760
|
-
platform: "neutral",
|
|
3761
|
-
override: {}
|
|
3762
|
-
}
|
|
3610
|
+
resolve: {}
|
|
3763
3611
|
});
|
|
3764
3612
|
}
|
|
3765
|
-
this.config.
|
|
3613
|
+
this.config.input = chunkFSGRYCTL_js.getUniqueInputs(this.config.input);
|
|
3766
3614
|
if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) {
|
|
3767
3615
|
this.config.name = this.config.name.split("/").filter(Boolean)[1];
|
|
3768
3616
|
}
|
|
3769
3617
|
this.config.title ??= titleCase.titleCase(this.config.name);
|
|
3770
3618
|
this.config.organization ??= (isSetObject.isSetObject(this.workspaceConfig.organization) ? this.workspaceConfig.organization.name : this.workspaceConfig.organization) || (isSetObject.isSetObject(this.packageJson?.author) ? this.packageJson?.author?.name : this.packageJson?.author) || this.config.name;
|
|
3771
|
-
if (this.config.userConfig.
|
|
3772
|
-
this.config.userConfig.
|
|
3619
|
+
if (this.config.userConfig.resolve?.external) {
|
|
3620
|
+
this.config.userConfig.resolve.external = getUnique.getUnique(this.config.userConfig.resolve.external);
|
|
3773
3621
|
}
|
|
3774
|
-
if (this.config.userConfig.
|
|
3775
|
-
this.config.userConfig.
|
|
3622
|
+
if (this.config.userConfig.resolve?.noExternal) {
|
|
3623
|
+
this.config.userConfig.resolve.noExternal = getUnique.getUnique(this.config.userConfig.resolve.noExternal);
|
|
3776
3624
|
}
|
|
3777
|
-
if (this.config.
|
|
3778
|
-
this.config.
|
|
3625
|
+
if (this.config.resolve.external) {
|
|
3626
|
+
this.config.resolve.external = getUnique.getUnique(this.config.resolve.external);
|
|
3779
3627
|
}
|
|
3780
|
-
if (this.config.
|
|
3781
|
-
this.config.
|
|
3628
|
+
if (this.config.resolve.noExternal) {
|
|
3629
|
+
this.config.resolve.noExternal = getUnique.getUnique(this.config.resolve.noExternal);
|
|
3782
3630
|
}
|
|
3783
3631
|
this.config.output.format = getUnique.getUnique(toArray.toArray(this.config.output?.format ?? (this.config.projectType === "library" ? [
|
|
3784
3632
|
"cjs",
|
|
@@ -3786,9 +3634,9 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3786
3634
|
] : [
|
|
3787
3635
|
"esm"
|
|
3788
3636
|
])));
|
|
3789
|
-
if (this.config.
|
|
3790
|
-
this.config.output.outputPath ??= join.joinPaths("dist", this.config.
|
|
3791
|
-
this.config.output.buildPath ??= join.joinPaths(this.config.
|
|
3637
|
+
if (this.config.root && this.config.root !== "." && this.config.root !== "./" && this.config.root !== this.workspaceConfig.workspaceRoot) {
|
|
3638
|
+
this.config.output.outputPath ??= join.joinPaths("dist", this.config.root);
|
|
3639
|
+
this.config.output.buildPath ??= join.joinPaths(this.config.root, "dist");
|
|
3792
3640
|
} else {
|
|
3793
3641
|
this.config.output.outputPath ??= "dist";
|
|
3794
3642
|
this.config.output.buildPath ??= "dist";
|
|
@@ -3809,36 +3657,33 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3809
3657
|
return ret;
|
|
3810
3658
|
}, []);
|
|
3811
3659
|
if (this.config.tsconfig) {
|
|
3812
|
-
this.config.tsconfig = replacePathTokens(this, this.config.tsconfig);
|
|
3660
|
+
this.config.tsconfig = chunkFSGRYCTL_js.replacePathTokens(this, this.config.tsconfig);
|
|
3813
3661
|
}
|
|
3814
3662
|
if (this.config.output.dts) {
|
|
3815
3663
|
if (isSetString.isSetString(this.config.output.dts)) {
|
|
3816
|
-
this.config.output.dts = replacePathTokens(this, this.config.output.dts);
|
|
3664
|
+
this.config.output.dts = chunkFSGRYCTL_js.replacePathTokens(this, this.config.output.dts);
|
|
3817
3665
|
} else {
|
|
3818
|
-
this.config.output.dts = join.joinPaths(this.config.
|
|
3666
|
+
this.config.output.dts = join.joinPaths(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`);
|
|
3819
3667
|
}
|
|
3820
3668
|
}
|
|
3821
|
-
if (this.config.build.polyfill) {
|
|
3822
|
-
this.config.build.polyfill = this.config.build.polyfill.map((polyfill) => replacePathTokens(this, polyfill));
|
|
3823
|
-
}
|
|
3824
3669
|
if (this.config.output.assets) {
|
|
3825
3670
|
this.config.output.assets = this.config.output.assets.map((asset) => ({
|
|
3826
3671
|
...asset,
|
|
3827
|
-
glob: replacePathTokens(this, asset.glob),
|
|
3828
|
-
ignore: asset.ignore ? asset.ignore.map((ignore) => replacePathTokens(this, ignore)) : void 0,
|
|
3829
|
-
input: replacePathTokens(this, asset.input),
|
|
3830
|
-
output: replacePathTokens(this, asset.output)
|
|
3672
|
+
glob: chunkFSGRYCTL_js.replacePathTokens(this, asset.glob),
|
|
3673
|
+
ignore: asset.ignore ? asset.ignore.map((ignore) => chunkFSGRYCTL_js.replacePathTokens(this, ignore)) : void 0,
|
|
3674
|
+
input: chunkFSGRYCTL_js.replacePathTokens(this, asset.input),
|
|
3675
|
+
output: chunkFSGRYCTL_js.replacePathTokens(this, asset.output)
|
|
3831
3676
|
}));
|
|
3832
3677
|
}
|
|
3833
3678
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
3834
3679
|
}
|
|
3835
3680
|
mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
|
|
3836
3681
|
this.config.userConfig = mergeConfig({
|
|
3837
|
-
|
|
3682
|
+
input: isSetObject.isSetObject(from.input) && !isRegexp.isRegExp(from.input) && !Array.isArray(from.input) && from.input.file ? from.input.file : isSetObject.isSetObject(into?.input) && !isRegexp.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 : []
|
|
3838
3683
|
}, omit.omit(from ?? {}, [
|
|
3839
|
-
"
|
|
3684
|
+
"input"
|
|
3840
3685
|
]), omit.omit(into ?? {}, [
|
|
3841
|
-
"
|
|
3686
|
+
"input"
|
|
3842
3687
|
]));
|
|
3843
3688
|
if (this.config.userConfig.output?.format) {
|
|
3844
3689
|
this.config.userConfig.output.format = getUnique.getUnique(toArray.toArray(this.config.userConfig.output?.format));
|
|
@@ -3939,7 +3784,7 @@ function createPluginContext(plugin, environment) {
|
|
|
3939
3784
|
}
|
|
3940
3785
|
chunkSHUYVCID_js.__name(createPluginContext, "createPluginContext");
|
|
3941
3786
|
|
|
3942
|
-
// ../powerlines/src/
|
|
3787
|
+
// ../powerlines/src/context/environment-context.ts
|
|
3943
3788
|
var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends PowerlinesContext {
|
|
3944
3789
|
static {
|
|
3945
3790
|
chunkSHUYVCID_js.__name(this, "PowerlinesEnvironmentContext");
|
|
@@ -4160,7 +4005,7 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends P
|
|
|
4160
4005
|
}
|
|
4161
4006
|
};
|
|
4162
4007
|
|
|
4163
|
-
// ../powerlines/src/
|
|
4008
|
+
// ../powerlines/src/context/api-context.ts
|
|
4164
4009
|
var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext {
|
|
4165
4010
|
static {
|
|
4166
4011
|
chunkSHUYVCID_js.__name(this, "PowerlinesAPIContext");
|
|
@@ -4176,7 +4021,7 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4176
4021
|
* @returns A promise that resolves to the new context.
|
|
4177
4022
|
*/
|
|
4178
4023
|
static async from(workspaceRoot, config) {
|
|
4179
|
-
const context = new _PowerlinesAPIContext(await
|
|
4024
|
+
const context = new _PowerlinesAPIContext(await chunkFSGRYCTL_js.loadWorkspaceConfig(workspaceRoot, config.root));
|
|
4180
4025
|
await context.withUserConfig(config);
|
|
4181
4026
|
const powerlinesPath = await resolve.resolvePackage("powerlines");
|
|
4182
4027
|
if (!powerlinesPath) {
|
|
@@ -4312,14 +4157,14 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4312
4157
|
}
|
|
4313
4158
|
if (Object.keys(this.environments).length === 1) {
|
|
4314
4159
|
environment = this.environments[Object.keys(this.environments)[0]];
|
|
4315
|
-
this.debug(`Applying the only configured environment: ${
|
|
4160
|
+
this.debug(`Applying the only configured environment: ${chalk4__default.default.bold.cyanBright(environment?.environment.name)}`);
|
|
4316
4161
|
}
|
|
4317
4162
|
if (!environment) {
|
|
4318
4163
|
if (name) {
|
|
4319
4164
|
throw new Error(`Environment "${name}" not found.`);
|
|
4320
4165
|
}
|
|
4321
4166
|
environment = await this.in(createDefaultEnvironment(this.config.userConfig));
|
|
4322
|
-
this.warn(`No environment specified, and no default environment found. Using a temporary default environment: ${
|
|
4167
|
+
this.warn(`No environment specified, and no default environment found. Using a temporary default environment: ${chalk4__default.default.bold.cyanBright(environment?.environment.name)}`);
|
|
4323
4168
|
}
|
|
4324
4169
|
return environment;
|
|
4325
4170
|
}
|
|
@@ -4347,7 +4192,7 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4347
4192
|
async toEnvironment() {
|
|
4348
4193
|
let environment;
|
|
4349
4194
|
if (Object.keys(this.environments).length > 1) {
|
|
4350
|
-
environment = await this.in(createEnvironment(GLOBAL_ENVIRONMENT, this.config.userConfig));
|
|
4195
|
+
environment = await this.in(createEnvironment(chunkFSGRYCTL_js.GLOBAL_ENVIRONMENT, this.config.userConfig));
|
|
4351
4196
|
this.debug(`Combined all ${Object.keys(this.environments).length} environments into a single global context.`);
|
|
4352
4197
|
} else {
|
|
4353
4198
|
environment = await this.getEnvironment();
|
|
@@ -4355,26 +4200,6 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4355
4200
|
return environment;
|
|
4356
4201
|
}
|
|
4357
4202
|
};
|
|
4358
|
-
function getBaseFileHeader(context) {
|
|
4359
|
-
return `
|
|
4360
|
-
// Generated with ${titleCase.titleCase(context.config.framework)}
|
|
4361
|
-
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
4362
|
-
`;
|
|
4363
|
-
}
|
|
4364
|
-
chunkSHUYVCID_js.__name(getBaseFileHeader, "getBaseFileHeader");
|
|
4365
|
-
function getFileHeader(context, options = {}) {
|
|
4366
|
-
const { directive = null, prettierIgnore = false } = options;
|
|
4367
|
-
return `/* eslint-disable */
|
|
4368
|
-
// biome-ignore lint: disable
|
|
4369
|
-
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `
|
|
4370
|
-
|
|
4371
|
-
${directive}
|
|
4372
|
-
` : "\n"}
|
|
4373
|
-
${getBaseFileHeader(context)}
|
|
4374
|
-
|
|
4375
|
-
`;
|
|
4376
|
-
}
|
|
4377
|
-
chunkSHUYVCID_js.__name(getFileHeader, "getFileHeader");
|
|
4378
4203
|
|
|
4379
4204
|
// ../powerlines/src/api.ts
|
|
4380
4205
|
var PowerlinesAPI = class _PowerlinesAPI {
|
|
@@ -4456,7 +4281,7 @@ var PowerlinesAPI = class _PowerlinesAPI {
|
|
|
4456
4281
|
order: "normal"
|
|
4457
4282
|
});
|
|
4458
4283
|
if (context.entry.length > 0) {
|
|
4459
|
-
context.debug(`The configuration provided ${toArray.toArray(context.config.
|
|
4284
|
+
context.debug(`The configuration provided ${isObject.isObject(context.config.input) ? Object.keys(context.config.input).length : toArray.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 ? `:
|
|
4460
4285
|
${context.entry.map((entry) => `- ${entry.file}${entry.output ? ` -> ${entry.output}` : ""}`).join(" \n")}` : ""}`);
|
|
4461
4286
|
} else {
|
|
4462
4287
|
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.`);
|
|
@@ -4567,7 +4392,7 @@ ${console.formatLogMessage({
|
|
|
4567
4392
|
if (isSetString.isSetString(types?.trim()) || directives.length > 0) {
|
|
4568
4393
|
await context.fs.write(context.dtsPath, `${directives.length > 0 ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
|
|
4569
4394
|
|
|
4570
|
-
` : ""}${getFileHeader(context, {
|
|
4395
|
+
` : ""}${chunkFSGRYCTL_js.getFileHeader(context, {
|
|
4571
4396
|
directive: null,
|
|
4572
4397
|
prettierIgnore: false
|
|
4573
4398
|
})}
|
|
@@ -4583,20 +4408,20 @@ ${formatTypes(types)}
|
|
|
4583
4408
|
}
|
|
4584
4409
|
}
|
|
4585
4410
|
}
|
|
4586
|
-
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.
|
|
4411
|
+
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.root, context.config.tsconfig);
|
|
4587
4412
|
if (!context.tsconfig) {
|
|
4588
4413
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
4589
4414
|
}
|
|
4590
4415
|
this.context.debug("Formatting files generated during the prepare step.");
|
|
4591
4416
|
await Promise.all([
|
|
4592
|
-
formatFolder(context, context.builtinsPath),
|
|
4593
|
-
formatFolder(context, context.entryPath)
|
|
4417
|
+
chunkFSGRYCTL_js.formatFolder(context, context.builtinsPath),
|
|
4418
|
+
chunkFSGRYCTL_js.formatFolder(context, context.entryPath)
|
|
4594
4419
|
]);
|
|
4595
4420
|
await this.callHook("prepare", {
|
|
4596
4421
|
environment: context,
|
|
4597
4422
|
order: "post"
|
|
4598
4423
|
});
|
|
4599
|
-
await
|
|
4424
|
+
await writeMetaFile(context);
|
|
4600
4425
|
context.persistedMeta = context.meta;
|
|
4601
4426
|
});
|
|
4602
4427
|
this.context.debug("\u2714 Powerlines preparation has completed successfully");
|
|
@@ -4623,7 +4448,7 @@ ${formatTypes(types)}
|
|
|
4623
4448
|
for (const file of files) {
|
|
4624
4449
|
context.trace(`Adding template file to project: ${file}`);
|
|
4625
4450
|
const template = Handlebars__default.default.compile(file);
|
|
4626
|
-
await context.fs.write(joinPaths.joinPaths(context.config.
|
|
4451
|
+
await context.fs.write(joinPaths.joinPaths(context.config.root, file.replace(".hbs", "")), template(context));
|
|
4627
4452
|
}
|
|
4628
4453
|
await this.callHook("new", {
|
|
4629
4454
|
environment: context,
|
|
@@ -4634,14 +4459,14 @@ ${formatTypes(types)}
|
|
|
4634
4459
|
for (const file of files2) {
|
|
4635
4460
|
context.trace(`Adding application template file: ${file}`);
|
|
4636
4461
|
const template = Handlebars__default.default.compile(file);
|
|
4637
|
-
await context.fs.write(joinPaths.joinPaths(context.config.
|
|
4462
|
+
await context.fs.write(joinPaths.joinPaths(context.config.root, file.replace(".hbs", "")), template(context));
|
|
4638
4463
|
}
|
|
4639
4464
|
} else {
|
|
4640
4465
|
const files2 = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/library/**/*.hbs"));
|
|
4641
4466
|
for (const file of files2) {
|
|
4642
4467
|
context.trace(`Adding library template file: ${file}`);
|
|
4643
4468
|
const template = Handlebars__default.default.compile(file);
|
|
4644
|
-
await context.fs.write(joinPaths.joinPaths(context.config.
|
|
4469
|
+
await context.fs.write(joinPaths.joinPaths(context.config.root, file.replace(".hbs", "")), template(context));
|
|
4645
4470
|
}
|
|
4646
4471
|
}
|
|
4647
4472
|
await this.callHook("new", {
|
|
@@ -4668,7 +4493,7 @@ ${formatTypes(types)}
|
|
|
4668
4493
|
await this.#executeEnvironments(async (context) => {
|
|
4669
4494
|
context.debug("Cleaning the project's dist and artifacts directories.");
|
|
4670
4495
|
await context.fs.remove(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.buildPath));
|
|
4671
|
-
await context.fs.remove(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.
|
|
4496
|
+
await context.fs.remove(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.root, context.config.output.artifactsPath));
|
|
4672
4497
|
await this.callHook("clean", {
|
|
4673
4498
|
environment: context,
|
|
4674
4499
|
sequential: false
|
|
@@ -4688,12 +4513,10 @@ ${formatTypes(types)}
|
|
|
4688
4513
|
this.context.info("\u{1F4CB} Linting the Powerlines project");
|
|
4689
4514
|
await this.prepare(inlineConfig);
|
|
4690
4515
|
await this.#executeEnvironments(async (context) => {
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
});
|
|
4696
|
-
}
|
|
4516
|
+
await this.callHook("lint", {
|
|
4517
|
+
environment: context,
|
|
4518
|
+
sequential: false
|
|
4519
|
+
});
|
|
4697
4520
|
});
|
|
4698
4521
|
this.context.debug("\u2714 Powerlines linting completed successfully");
|
|
4699
4522
|
}
|
|
@@ -4816,7 +4639,7 @@ ${formatTypes(types)}
|
|
|
4816
4639
|
order: "pre"
|
|
4817
4640
|
});
|
|
4818
4641
|
context.debug("Formatting the generated entry files before the build process starts.");
|
|
4819
|
-
await formatFolder(context, context.entryPath);
|
|
4642
|
+
await chunkFSGRYCTL_js.formatFolder(context, context.entryPath);
|
|
4820
4643
|
await this.callHook("build", {
|
|
4821
4644
|
environment: context,
|
|
4822
4645
|
order: "normal"
|
|
@@ -4830,7 +4653,7 @@ ${formatTypes(types)}
|
|
|
4830
4653
|
}
|
|
4831
4654
|
}
|
|
4832
4655
|
await Promise.all(context.config.output.assets.map(async (asset) => {
|
|
4833
|
-
context.trace(`Copying asset(s): ${
|
|
4656
|
+
context.trace(`Copying asset(s): ${chalk4__default.default.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : joinPaths.joinPaths(replace.replacePath(asset.input, context.workspaceConfig.workspaceRoot), asset.glob))} -> ${chalk4__default.default.greenBright(joinPaths.joinPaths(replace.replacePath(asset.output, context.workspaceConfig.workspaceRoot), asset.glob))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk4__default.default.yellowBright(i)).join(", ")})` : ""}`);
|
|
4834
4657
|
await context.fs.copy(asset, asset.output);
|
|
4835
4658
|
}));
|
|
4836
4659
|
await this.callHook("build", {
|
|
@@ -4886,7 +4709,7 @@ ${formatTypes(types)}
|
|
|
4886
4709
|
return;
|
|
4887
4710
|
}
|
|
4888
4711
|
for (const plugin of result) {
|
|
4889
|
-
this.context.debug(`Successfully initialized the ${
|
|
4712
|
+
this.context.debug(`Successfully initialized the ${chalk4__default.default.bold.cyanBright(plugin.name)} plugin`);
|
|
4890
4713
|
await this.context.addPlugin(plugin);
|
|
4891
4714
|
}
|
|
4892
4715
|
}
|
|
@@ -4973,10 +4796,10 @@ Please ensure the value is one of the following:
|
|
|
4973
4796
|
const result = [];
|
|
4974
4797
|
for (const plugin of plugins) {
|
|
4975
4798
|
if (checkDedupe(plugin, this.context.plugins)) {
|
|
4976
|
-
this.context.trace(`Duplicate ${
|
|
4799
|
+
this.context.trace(`Duplicate ${chalk4__default.default.bold.cyanBright(plugin.name)} plugin dependency detected - Skipping initialization.`);
|
|
4977
4800
|
} else {
|
|
4978
4801
|
result.push(plugin);
|
|
4979
|
-
this.context.trace(`Initializing the ${
|
|
4802
|
+
this.context.trace(`Initializing the ${chalk4__default.default.bold.cyanBright(plugin.name)} plugin...`);
|
|
4980
4803
|
}
|
|
4981
4804
|
}
|
|
4982
4805
|
return result;
|
|
@@ -4989,13 +4812,13 @@ Please ensure the value is one of the following:
|
|
|
4989
4812
|
const isInstalled = packageFns.isPackageExists(pluginPath, {
|
|
4990
4813
|
paths: [
|
|
4991
4814
|
this.context.workspaceConfig.workspaceRoot,
|
|
4992
|
-
this.context.config.
|
|
4815
|
+
this.context.config.root
|
|
4993
4816
|
]
|
|
4994
4817
|
});
|
|
4995
4818
|
if (!isInstalled && this.context.config.autoInstall) {
|
|
4996
4819
|
this.#context.warn(`The plugin package "${pluginPath}" is not installed. It will be installed automatically.`);
|
|
4997
4820
|
const result = await install.install(pluginPath, {
|
|
4998
|
-
cwd: this.context.config.
|
|
4821
|
+
cwd: this.context.config.root
|
|
4999
4822
|
});
|
|
5000
4823
|
if (isNumber.isNumber(result.exitCode) && result.exitCode > 0) {
|
|
5001
4824
|
this.#context.error(result.stderr);
|
|
@@ -5045,16 +4868,25 @@ function withExecutor(command, executorFn) {
|
|
|
5045
4868
|
}
|
|
5046
4869
|
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
5047
4870
|
const api = await src_default.from(workspaceConfig.workspaceRoot, defu7__default.default({
|
|
4871
|
+
input: options.input,
|
|
4872
|
+
output: {
|
|
4873
|
+
outputPath: options.outputPath ?? projectConfig.targets?.build?.options?.outputPath,
|
|
4874
|
+
format: options.format,
|
|
4875
|
+
sourceMap: options.sourceMap
|
|
4876
|
+
},
|
|
4877
|
+
resolve: {
|
|
4878
|
+
external: options.external,
|
|
4879
|
+
noExternal: options.noExternal,
|
|
4880
|
+
skipNodeModulesBundle: options.skipNodeModulesBundle
|
|
4881
|
+
},
|
|
5048
4882
|
root: projectConfig.root,
|
|
5049
|
-
|
|
4883
|
+
projectType: projectConfig.projectType,
|
|
5050
4884
|
sourceRoot: projectConfig.sourceRoot,
|
|
5051
4885
|
tsconfig: options.tsconfig,
|
|
4886
|
+
platform: options.platform,
|
|
4887
|
+
define: options.define,
|
|
5052
4888
|
logLevel: options.logLevel,
|
|
5053
|
-
mode: options.mode
|
|
5054
|
-
skipCache: options.skipCache,
|
|
5055
|
-
output: {
|
|
5056
|
-
outputPath: options.outputPath ?? projectConfig.targets?.build?.options?.outputPath
|
|
5057
|
-
}
|
|
4889
|
+
mode: options.mode
|
|
5058
4890
|
}, options));
|
|
5059
4891
|
try {
|
|
5060
4892
|
return await Promise.resolve(executorFn(defu7__default.default({
|