powerlines 0.27.0 → 0.28.0
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/dist/{api-CHbGX3BG.d.ts → api-BgDfE1J3.d.ts} +2 -2
- package/dist/{api-DGMQopJ5.d.cts → api-D-3EvHyy.d.cts} +2 -2
- package/dist/api.cjs +2 -2
- package/dist/api.d.cts +5 -2
- package/dist/api.d.ts +5 -2
- package/dist/api.js +1 -1
- package/dist/astro.cjs +4 -4
- package/dist/astro.d.cts +4 -1
- package/dist/astro.d.ts +4 -1
- package/dist/astro.js +3 -3
- package/dist/{chunk-PYID3NKT.js → chunk-5CV2NNIR.js} +6 -5
- package/dist/chunk-C3APS65S.cjs +12 -0
- package/dist/{chunk-HG7JY6AQ.cjs → chunk-DD4XJNKQ.cjs} +7 -6
- package/dist/{chunk-RCYXXBJ3.cjs → chunk-ERZWC77E.cjs} +272 -117
- package/dist/{chunk-KW66GUWJ.cjs → chunk-FJ67PPIW.cjs} +4 -4
- package/dist/{chunk-YULFP33E.cjs → chunk-MRHWIMY2.cjs} +2 -2
- package/dist/{chunk-CSJMUAPJ.js → chunk-NHZBSVDJ.js} +3 -3
- package/dist/{chunk-2DWFEC7G.js → chunk-QRE6JMCD.js} +271 -116
- package/dist/{chunk-P647W2BA.js → chunk-UMZ2WNMA.js} +2 -2
- package/dist/{chunk-ISPXQBOL.js → chunk-VJ26HHRE.js} +3 -3
- package/dist/{chunk-CF7B5HOG.cjs → chunk-XMYY4XUM.cjs} +4 -4
- package/dist/{chunk-BH4JSKPK.js → chunk-Z3HPP53Q.js} +3 -3
- package/dist/{context-BjOICcQB.d.cts → context-CDZY3RHt.d.cts} +80 -21
- package/dist/{context-BqTYt9FC.d.ts → context-CcPf9RC_.d.ts} +80 -21
- package/dist/esbuild.cjs +6 -6
- package/dist/esbuild.d.cts +4 -1
- package/dist/esbuild.d.ts +4 -1
- package/dist/esbuild.js +3 -3
- package/dist/farm.cjs +3 -3
- package/dist/farm.d.cts +4 -1
- package/dist/farm.d.ts +4 -1
- package/dist/farm.js +2 -2
- package/dist/index.cjs +18 -18
- package/dist/index.d.cts +15 -4
- package/dist/index.d.ts +15 -4
- package/dist/index.js +10 -7
- package/dist/lib/{api-_rRpguWX.d.cts → api-BIHEKpyq.d.ts} +2 -2
- package/dist/lib/{api-Cxmk8sFc.d.ts → api-Wawenasn.d.cts} +2 -2
- package/dist/lib/build/esbuild.cjs +6 -5
- package/dist/lib/build/esbuild.d.cts +4 -1
- package/dist/lib/build/esbuild.d.ts +4 -1
- package/dist/lib/build/esbuild.js +3 -2
- package/dist/lib/build/index.cjs +13 -12
- package/dist/lib/build/index.d.cts +6 -3
- package/dist/lib/build/index.d.ts +6 -3
- package/dist/lib/build/index.js +5 -4
- package/dist/lib/build/rolldown.d.cts +4 -1
- package/dist/lib/build/rolldown.d.ts +4 -1
- package/dist/lib/build/rollup.d.cts +4 -1
- package/dist/lib/build/rollup.d.ts +4 -1
- package/dist/lib/build/rspack.d.cts +4 -1
- package/dist/lib/build/rspack.d.ts +4 -1
- package/dist/lib/build/tsup.cjs +7 -6
- package/dist/lib/build/tsup.d.cts +4 -1
- package/dist/lib/build/tsup.d.ts +4 -1
- package/dist/lib/build/tsup.js +4 -3
- package/dist/lib/build/unbuild.d.cts +6 -3
- package/dist/lib/build/unbuild.d.ts +6 -3
- package/dist/lib/build/vite.cjs +6 -5
- package/dist/lib/build/vite.d.cts +4 -1
- package/dist/lib/build/vite.d.ts +4 -1
- package/dist/lib/build/vite.js +4 -3
- package/dist/lib/build/webpack.d.cts +4 -1
- package/dist/lib/build/webpack.d.ts +4 -1
- package/dist/lib/{chunk-UNUP4XMO.cjs → chunk-3Y4F37CB.cjs} +2 -2
- package/dist/lib/{chunk-Q4D2L67H.cjs → chunk-7VRXU4F7.cjs} +2 -2
- package/dist/lib/{chunk-N5YLKWC2.js → chunk-DYGQQI74.js} +2 -10
- package/dist/lib/{chunk-HM52GHX3.js → chunk-GD7KTLPU.js} +2 -2
- package/dist/lib/{chunk-CU23POMD.js → chunk-GLWPZDAR.js} +1 -1
- package/dist/lib/{chunk-HE6HOGLS.js → chunk-GSGF6RL2.js} +154 -26
- package/dist/lib/{chunk-4SULM54S.js → chunk-KG4HFVJU.js} +55 -44
- package/dist/lib/{chunk-ZDBHX3VV.cjs → chunk-LBR46BPB.cjs} +72 -35
- package/dist/lib/{chunk-YB54H3SQ.js → chunk-N22WOZ3U.js} +3 -1
- package/dist/lib/{chunk-QR2N3DPP.js → chunk-NZ6NCXM2.js} +1 -1
- package/dist/lib/{chunk-AFLI3CLM.js → chunk-OKXWWMEF.js} +1 -1
- package/dist/lib/{chunk-R3E56AJ4.cjs → chunk-OYLWPIBP.cjs} +2 -2
- package/dist/lib/{chunk-I76RI47U.cjs → chunk-PURLNHXG.cjs} +3 -1
- package/dist/lib/{chunk-N5XEKCVW.cjs → chunk-QF3UTBJE.cjs} +2 -11
- package/dist/lib/{chunk-QDRITYHV.cjs → chunk-R3XAVNPY.cjs} +2 -2
- package/dist/lib/{chunk-Z5JKSYRP.cjs → chunk-S4OH7KW6.cjs} +165 -37
- package/dist/lib/{chunk-YGSXCTX2.js → chunk-S6WYOXLM.js} +1 -1
- package/dist/lib/chunk-T35JQHYE.js +12 -0
- package/dist/lib/{chunk-GKCWJVF7.cjs → chunk-TWABN364.cjs} +10 -10
- package/dist/lib/{chunk-UJYCAW2D.cjs → chunk-V2523R33.cjs} +4 -4
- package/dist/lib/{chunk-KJDASLW3.js → chunk-VKFXVPY6.js} +1 -1
- package/dist/lib/{chunk-AJDYMANR.cjs → chunk-XBSGDSV3.cjs} +2 -2
- package/dist/lib/{chunk-7GCAHOJK.js → chunk-XIK3Y6BP.js} +1 -1
- package/dist/lib/{chunk-CP77I6WM.js → chunk-Y2DPOC4G.js} +65 -28
- package/dist/lib/chunk-YXJJCE6V.cjs +14 -0
- package/dist/lib/{chunk-4V5OI73E.cjs → chunk-Z6BSDYUR.cjs} +55 -44
- package/dist/lib/{config-DMXVnKGF.d.cts → config-D2dTFLlQ.d.cts} +76 -6
- package/dist/lib/{config-B2q8Me0M.d.ts → config-Dzk6j2mr.d.ts} +76 -6
- package/dist/lib/config-file.d.cts +4 -1
- package/dist/lib/config-file.d.ts +4 -1
- package/dist/lib/contexts/api-context.cjs +7 -6
- package/dist/lib/contexts/api-context.d.cts +7 -3
- package/dist/lib/contexts/api-context.d.ts +7 -3
- package/dist/lib/contexts/api-context.js +6 -5
- package/dist/lib/contexts/context.cjs +5 -4
- package/dist/lib/contexts/context.d.cts +64 -10
- package/dist/lib/contexts/context.d.ts +64 -10
- package/dist/lib/contexts/context.js +4 -3
- package/dist/lib/contexts/environment-context.cjs +6 -5
- package/dist/lib/contexts/environment-context.d.cts +7 -3
- package/dist/lib/contexts/environment-context.d.ts +7 -3
- package/dist/lib/contexts/environment-context.js +5 -4
- package/dist/lib/contexts/index.cjs +9 -8
- package/dist/lib/contexts/index.d.cts +7 -3
- package/dist/lib/contexts/index.d.ts +7 -3
- package/dist/lib/contexts/index.js +6 -5
- package/dist/lib/contexts/plugin-context.d.cts +6 -3
- package/dist/lib/contexts/plugin-context.d.ts +6 -3
- package/dist/lib/entry.cjs +10 -9
- package/dist/lib/entry.d.cts +4 -1
- package/dist/lib/entry.d.ts +4 -1
- package/dist/lib/entry.js +2 -1
- package/dist/lib/fs/index.cjs +3 -2
- package/dist/lib/fs/index.d.cts +4 -1
- package/dist/lib/fs/index.d.ts +4 -1
- package/dist/lib/fs/index.js +2 -1
- package/dist/lib/fs/vfs.cjs +3 -2
- package/dist/lib/fs/vfs.d.cts +4 -1
- package/dist/lib/fs/vfs.d.ts +4 -1
- package/dist/lib/fs/vfs.js +2 -1
- package/dist/lib/index.cjs +32 -31
- package/dist/lib/index.d.cts +8 -5
- package/dist/lib/index.d.ts +8 -5
- package/dist/lib/index.js +12 -11
- package/dist/lib/{internal-CGIi3MOX.d.ts → internal-Cgp0NF-t.d.ts} +2 -2
- package/dist/lib/{internal-CfIJWv8T.d.cts → internal-DC9vYMIn.d.cts} +2 -2
- package/dist/lib/logger.d.cts +4 -1
- package/dist/lib/logger.d.ts +4 -1
- package/dist/lib/typescript/import-transformer.d.cts +4 -1
- package/dist/lib/typescript/import-transformer.d.ts +4 -1
- package/dist/lib/typescript/index.d.cts +4 -1
- package/dist/lib/typescript/index.d.ts +4 -1
- package/dist/lib/typescript/ts-morph.d.cts +4 -1
- package/dist/lib/typescript/ts-morph.d.ts +4 -1
- package/dist/lib/unplugin/factory.cjs +8 -8
- package/dist/lib/unplugin/factory.d.cts +6 -3
- package/dist/lib/unplugin/factory.d.ts +6 -3
- package/dist/lib/unplugin/factory.js +7 -7
- package/dist/lib/unplugin/helpers.d.cts +4 -1
- package/dist/lib/unplugin/helpers.d.ts +4 -1
- package/dist/lib/unplugin/index.cjs +10 -10
- package/dist/lib/unplugin/index.d.cts +7 -4
- package/dist/lib/unplugin/index.d.ts +7 -4
- package/dist/lib/unplugin/index.js +8 -8
- package/dist/lib/unplugin/plugin.cjs +2 -2
- package/dist/lib/unplugin/plugin.d.cts +8 -18
- package/dist/lib/unplugin/plugin.d.ts +8 -18
- package/dist/lib/unplugin/plugin.js +1 -1
- package/dist/lib/{unplugin-B_F1TZK4.d.cts → unplugin-CvYjC7ZL.d.cts} +2 -2
- package/dist/lib/{unplugin-Da9GAj4a.d.ts → unplugin-D7lpyIpN.d.ts} +2 -2
- package/dist/lib/utilities/bundle.cjs +5 -4
- package/dist/lib/utilities/bundle.d.cts +4 -1
- package/dist/lib/utilities/bundle.d.ts +4 -1
- package/dist/lib/utilities/bundle.js +4 -3
- package/dist/lib/utilities/cache.d.cts +4 -1
- package/dist/lib/utilities/cache.d.ts +4 -1
- package/dist/lib/utilities/file-header.d.cts +4 -1
- package/dist/lib/utilities/file-header.d.ts +4 -1
- package/dist/lib/utilities/index.cjs +12 -11
- package/dist/lib/utilities/index.d.cts +4 -1
- package/dist/lib/utilities/index.d.ts +4 -1
- package/dist/lib/utilities/index.js +6 -5
- package/dist/lib/utilities/meta.d.cts +4 -1
- package/dist/lib/utilities/meta.d.ts +4 -1
- package/dist/lib/utilities/resolve.cjs +6 -5
- package/dist/lib/utilities/resolve.d.cts +4 -1
- package/dist/lib/utilities/resolve.d.ts +4 -1
- package/dist/lib/utilities/resolve.js +5 -4
- package/dist/lib/utilities/source-file.d.cts +4 -1
- package/dist/lib/utilities/source-file.d.ts +4 -1
- package/dist/lib/utilities/source-map.d.cts +4 -1
- package/dist/lib/utilities/source-map.d.ts +4 -1
- package/dist/lib/utilities/worker.d.cts +4 -1
- package/dist/lib/utilities/worker.d.ts +4 -1
- package/dist/lib/utilities/write-file.d.cts +4 -1
- package/dist/lib/utilities/write-file.d.ts +4 -1
- package/dist/next.cjs +4 -4
- package/dist/next.js +3 -3
- package/dist/nuxt.cjs +6 -6
- package/dist/nuxt.js +4 -4
- package/dist/plugin-utils/chunk-DCJAIIJ5.cjs +14 -0
- package/dist/plugin-utils/chunk-FBLNGP3S.js +12 -0
- package/dist/plugin-utils/context-helpers.d.cts +4 -1
- package/dist/plugin-utils/context-helpers.d.ts +4 -1
- package/dist/plugin-utils/{context-y3G_SQPM.d.cts → context-iOcgJtAf.d.cts} +75 -5
- package/dist/plugin-utils/{context-y3G_SQPM.d.ts → context-iOcgJtAf.d.ts} +75 -5
- package/dist/plugin-utils/enforce.d.cts +4 -1
- package/dist/plugin-utils/enforce.d.ts +4 -1
- package/dist/plugin-utils/extend.d.cts +4 -1
- package/dist/plugin-utils/extend.d.ts +4 -1
- package/dist/plugin-utils/get-config-path.d.cts +4 -1
- package/dist/plugin-utils/get-config-path.d.ts +4 -1
- package/dist/plugin-utils/helpers.d.cts +14 -11
- package/dist/plugin-utils/helpers.d.ts +14 -11
- package/dist/plugin-utils/index.cjs +2 -2
- package/dist/plugin-utils/index.d.cts +4 -1
- package/dist/plugin-utils/index.d.ts +4 -1
- package/dist/plugin-utils/index.js +1 -1
- package/dist/plugin-utils/merge.d.cts +4 -1
- package/dist/plugin-utils/merge.d.ts +4 -1
- package/dist/plugin-utils/paths.cjs +2 -2
- package/dist/plugin-utils/paths.d.cts +5 -1
- package/dist/plugin-utils/paths.d.ts +5 -1
- package/dist/plugin-utils/paths.js +1 -1
- package/dist/rolldown.cjs +3 -3
- package/dist/rolldown.d.cts +4 -1
- package/dist/rolldown.d.ts +4 -1
- package/dist/rolldown.js +2 -2
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.d.cts +4 -1
- package/dist/rollup.d.ts +4 -1
- package/dist/rollup.js +2 -2
- package/dist/rspack.cjs +3 -3
- package/dist/rspack.d.cts +4 -1
- package/dist/rspack.d.ts +4 -1
- package/dist/rspack.js +2 -2
- package/dist/tsup.cjs +4 -4
- package/dist/tsup.js +3 -3
- package/dist/types/api.d.cts +5 -2
- package/dist/types/api.d.ts +5 -2
- package/dist/types/babel.d.cts +4 -1
- package/dist/types/babel.d.ts +4 -1
- package/dist/types/commands.d.cts +4 -1
- package/dist/types/commands.d.ts +4 -1
- package/dist/types/config.d.cts +4 -1
- package/dist/types/config.d.ts +4 -1
- package/dist/types/context.cjs +2 -2
- package/dist/types/context.d.cts +4 -1
- package/dist/types/context.d.ts +4 -1
- package/dist/types/context.js +1 -1
- package/dist/types/hooks.d.cts +4 -1
- package/dist/types/hooks.d.ts +4 -1
- package/dist/types/index.cjs +3 -3
- package/dist/types/index.d.cts +5 -2
- package/dist/types/index.d.ts +5 -2
- package/dist/types/index.js +2 -2
- package/dist/types/internal.d.cts +5 -2
- package/dist/types/internal.d.ts +5 -2
- package/dist/types/plugin.d.cts +4 -1
- package/dist/types/plugin.d.ts +4 -1
- package/dist/types/resolved.d.cts +4 -1
- package/dist/types/resolved.d.ts +4 -1
- package/dist/types/unplugin.d.cts +5 -2
- package/dist/types/unplugin.d.ts +5 -2
- package/dist/unloader.cjs +3 -3
- package/dist/unloader.d.cts +4 -1
- package/dist/unloader.d.ts +4 -1
- package/dist/unloader.js +2 -2
- package/dist/unplugin.cjs +8 -6
- package/dist/unplugin.d.cts +7 -17
- package/dist/unplugin.d.ts +7 -17
- package/dist/unplugin.js +6 -4
- package/dist/vite.cjs +6 -6
- package/dist/vite.d.cts +4 -1
- package/dist/vite.d.ts +4 -1
- package/dist/vite.js +3 -3
- package/dist/webpack.cjs +6 -6
- package/dist/webpack.d.cts +4 -1
- package/dist/webpack.d.ts +4 -1
- package/dist/webpack.js +3 -3
- package/package.json +24 -21
- package/dist/babel-types.d.ts +0 -292
- package/dist/chunk-GBIIAZH5.cjs +0 -13
- package/dist/chunk-QXHINXRM.js +0 -11
- package/dist/chunk-UWLQNNZE.cjs +0 -12
- package/dist/config.cjs +0 -13
- package/dist/config.d.cts +0 -45
- package/dist/config.d.ts +0 -45
- package/dist/config.js +0 -4
- package/dist/plugin-utils/chunk-K2GWRZPV.js +0 -12
- package/dist/plugin-utils/chunk-VWFJOPKC.cjs +0 -14
|
@@ -20,6 +20,7 @@ var replace = require('@stryke/path/replace');
|
|
|
20
20
|
var isError = require('@stryke/type-checks/is-error');
|
|
21
21
|
var isFunction = require('@stryke/type-checks/is-function');
|
|
22
22
|
var isNumber = require('@stryke/type-checks/is-number');
|
|
23
|
+
var isObject = require('@stryke/type-checks/is-object');
|
|
23
24
|
var isPromise = require('@stryke/type-checks/is-promise');
|
|
24
25
|
var isSet = require('@stryke/type-checks/is-set');
|
|
25
26
|
var isSetObject = require('@stryke/type-checks/is-set-object');
|
|
@@ -39,8 +40,6 @@ var stormJson = require('@stryke/json/storm-json');
|
|
|
39
40
|
var filePathFns = require('@stryke/path/file-path-fns');
|
|
40
41
|
var titleCase = require('@stryke/string-format/title-case');
|
|
41
42
|
var exists = require('@stryke/fs/exists');
|
|
42
|
-
var writeFile$1 = require('@stryke/fs/write-file');
|
|
43
|
-
var prettier = require('prettier');
|
|
44
43
|
var getConfig = require('@storm-software/config-tools/get-config');
|
|
45
44
|
var c12 = require('c12');
|
|
46
45
|
var getEnvPaths = require('@stryke/env/get-env-paths');
|
|
@@ -49,33 +48,37 @@ var hashFiles = require('@stryke/hash/hash-files');
|
|
|
49
48
|
var murmurhash = require('@stryke/hash/murmurhash');
|
|
50
49
|
var getUnique = require('@stryke/helpers/get-unique');
|
|
51
50
|
var omit = require('@stryke/helpers/omit');
|
|
51
|
+
var fetch = require('@stryke/http/fetch');
|
|
52
52
|
var isType = require('@stryke/path/is-type');
|
|
53
53
|
var isNull = require('@stryke/type-checks/is-null');
|
|
54
54
|
var isString = require('@stryke/type-checks/is-string');
|
|
55
55
|
var uuid = require('@stryke/unique-id/uuid');
|
|
56
56
|
var bundleRequire = require('bundle-require');
|
|
57
|
+
var flatCache = require('flat-cache');
|
|
58
|
+
var oxcParser = require('oxc-parser');
|
|
59
|
+
var undici = require('undici');
|
|
57
60
|
var jiti = require('jiti');
|
|
58
61
|
var isUndefined = require('@stryke/type-checks/is-undefined');
|
|
59
62
|
var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
|
|
60
63
|
var isFile = require('@stryke/fs/is-file');
|
|
61
64
|
var $ = require('@stryke/capnp');
|
|
62
65
|
var buffer = require('@stryke/fs/buffer');
|
|
63
|
-
var correctPath = require('@stryke/path/correct-path');
|
|
64
66
|
var isParentPath = require('@stryke/path/is-parent-path');
|
|
65
67
|
var prettyBytes = require('@stryke/string-format/pretty-bytes');
|
|
66
|
-
var flatCache = require('flat-cache');
|
|
67
68
|
var buffer$1 = require('buffer');
|
|
69
|
+
var prettier = require('prettier');
|
|
68
70
|
var logger = require('@storm-software/config-tools/logger');
|
|
69
71
|
var colors = require('@storm-software/config-tools/utilities/colors');
|
|
70
72
|
var noop = require('@stryke/helpers/noop');
|
|
73
|
+
var correctPath = require('@stryke/path/correct-path');
|
|
71
74
|
var slash = require('@stryke/path/slash');
|
|
72
75
|
var readFile = require('@stryke/fs/read-file');
|
|
76
|
+
var writeFile = require('@stryke/fs/write-file');
|
|
73
77
|
var fs = require('fs');
|
|
74
78
|
var promises = require('fs/promises');
|
|
75
79
|
var path = require('path');
|
|
76
80
|
require('@stryke/fs/remove-file');
|
|
77
81
|
var kebabCase = require('@stryke/string-format/kebab-case');
|
|
78
|
-
var isObject = require('@stryke/type-checks/is-object');
|
|
79
82
|
|
|
80
83
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
81
84
|
|
|
@@ -364,7 +367,9 @@ async function callHook(context, hook, options, ...args) {
|
|
|
364
367
|
if (!isFunction.isFunction(handler)) {
|
|
365
368
|
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
366
369
|
}
|
|
367
|
-
return Promise.resolve(handler.apply(null,
|
|
370
|
+
return Promise.resolve(handler.apply(null, [
|
|
371
|
+
...args
|
|
372
|
+
]));
|
|
368
373
|
}));
|
|
369
374
|
} else {
|
|
370
375
|
for (const handler of handlers) {
|
|
@@ -372,7 +377,9 @@ async function callHook(context, hook, options, ...args) {
|
|
|
372
377
|
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
373
378
|
}
|
|
374
379
|
if (options?.result === "first" || options?.asNextParam === false) {
|
|
375
|
-
results.push(await Promise.resolve(handler.apply(null,
|
|
380
|
+
results.push(await Promise.resolve(handler.apply(null, [
|
|
381
|
+
...args
|
|
382
|
+
])));
|
|
376
383
|
if (options?.result === "first" && isSet.isSet(results[results.length - 1])) {
|
|
377
384
|
break;
|
|
378
385
|
}
|
|
@@ -384,12 +391,22 @@ async function callHook(context, hook, options, ...args) {
|
|
|
384
391
|
sequenceArgs[0] = isFunction.isFunction(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
|
|
385
392
|
}
|
|
386
393
|
const result = await Promise.resolve(
|
|
387
|
-
// eslint-disable-next-line ts/no-unsafe-call
|
|
388
|
-
handler.apply(null,
|
|
394
|
+
// eslint-disable-next-line ts/no-unsafe-call, no-useless-call
|
|
395
|
+
handler.apply(null, [
|
|
396
|
+
...sequenceArgs
|
|
397
|
+
])
|
|
389
398
|
);
|
|
390
|
-
|
|
391
|
-
result
|
|
392
|
-
|
|
399
|
+
if (result) {
|
|
400
|
+
if (options?.result === "last") {
|
|
401
|
+
results = [
|
|
402
|
+
result
|
|
403
|
+
];
|
|
404
|
+
} else {
|
|
405
|
+
results = [
|
|
406
|
+
defu7.defu(result, results[0] ?? {})
|
|
407
|
+
];
|
|
408
|
+
}
|
|
409
|
+
}
|
|
393
410
|
}
|
|
394
411
|
}
|
|
395
412
|
}
|
|
@@ -555,33 +572,20 @@ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && err
|
|
|
555
572
|
};
|
|
556
573
|
}
|
|
557
574
|
chunkPK6SKIKE_cjs.__name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
|
|
558
|
-
async function writeFile(log, filepath, content, skipFormat = false) {
|
|
559
|
-
try {
|
|
560
|
-
if (skipFormat) {
|
|
561
|
-
await writeFile$1.writeFile(filepath, content);
|
|
562
|
-
} else {
|
|
563
|
-
const config = await prettier.resolveConfig(filepath);
|
|
564
|
-
const formatted = await prettier.format(content, {
|
|
565
|
-
...config ?? {},
|
|
566
|
-
filepath
|
|
567
|
-
});
|
|
568
|
-
await writeFile$1.writeFile(filepath, formatted || "");
|
|
569
|
-
}
|
|
570
|
-
} catch (error) {
|
|
571
|
-
log(types.LogLevelLabel.ERROR, `Failed to write file ${filepath} to disk
|
|
572
|
-
${error?.message ? error.message : ""}`);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
chunkPK6SKIKE_cjs.__name(writeFile, "writeFile");
|
|
576
575
|
|
|
577
576
|
// src/internal/helpers/resolve-tsconfig.ts
|
|
577
|
+
function getTsconfigDtsPath(context) {
|
|
578
|
+
const dtsRelativePath = joinPaths.joinPaths(filePathFns.relativePath(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot), filePathFns.findFilePath(context.dtsPath)), filePathFns.findFileName(context.dtsPath));
|
|
579
|
+
return dtsRelativePath;
|
|
580
|
+
}
|
|
581
|
+
chunkPK6SKIKE_cjs.__name(getTsconfigDtsPath, "getTsconfigDtsPath");
|
|
578
582
|
async function resolveTsconfigChanges(context) {
|
|
579
583
|
const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw);
|
|
580
584
|
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
581
585
|
const tsconfigJson = await json.readJsonFile(tsconfigFilePath);
|
|
582
586
|
tsconfigJson.compilerOptions ??= {};
|
|
583
587
|
if (context.config.output.dts !== false) {
|
|
584
|
-
const dtsRelativePath =
|
|
588
|
+
const dtsRelativePath = getTsconfigDtsPath(context);
|
|
585
589
|
if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [
|
|
586
590
|
context.dtsPath,
|
|
587
591
|
dtsRelativePath
|
|
@@ -623,7 +627,7 @@ async function initializeTsconfig(context) {
|
|
|
623
627
|
context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
|
|
624
628
|
context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
|
|
625
629
|
context.log(types.LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
|
|
626
|
-
await
|
|
630
|
+
await context.fs.write(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson));
|
|
627
631
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
|
|
628
632
|
}
|
|
629
633
|
chunkPK6SKIKE_cjs.__name(initializeTsconfig, "initializeTsconfig");
|
|
@@ -672,13 +676,11 @@ async function resolveTsconfig(context) {
|
|
|
672
676
|
`).join("\n")}
|
|
673
677
|
`);
|
|
674
678
|
}
|
|
675
|
-
await
|
|
679
|
+
await context.fs.write(context.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(updateTsconfigJson));
|
|
676
680
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
677
681
|
if (!context.tsconfig) {
|
|
678
682
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
679
683
|
}
|
|
680
|
-
context.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
681
|
-
context.tsconfig.tsconfigJson.compilerOptions.strict = false;
|
|
682
684
|
}
|
|
683
685
|
chunkPK6SKIKE_cjs.__name(resolveTsconfig, "resolveTsconfig");
|
|
684
686
|
var DEFAULT_ENVIRONMENT = "default";
|
|
@@ -858,7 +860,7 @@ function replacePathTokens(context, path) {
|
|
|
858
860
|
if (!path) {
|
|
859
861
|
return path;
|
|
860
862
|
}
|
|
861
|
-
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replace.replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replace.replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replace.replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
863
|
+
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));
|
|
862
864
|
}
|
|
863
865
|
chunkPK6SKIKE_cjs.__name(replacePathTokens, "replacePathTokens");
|
|
864
866
|
function resolveEntryInputFile(context, typeDefinition) {
|
|
@@ -1409,7 +1411,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
1409
1411
|
*/
|
|
1410
1412
|
setSync(key, value) {
|
|
1411
1413
|
if (!this.options.isReadOnly) {
|
|
1412
|
-
return writeFile
|
|
1414
|
+
return writeFile.writeFileSync(this.resolve(key), value);
|
|
1413
1415
|
}
|
|
1414
1416
|
}
|
|
1415
1417
|
/**
|
|
@@ -1420,7 +1422,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
1420
1422
|
*/
|
|
1421
1423
|
async set(key, value) {
|
|
1422
1424
|
if (!this.options.isReadOnly) {
|
|
1423
|
-
return writeFile
|
|
1425
|
+
return writeFile.writeFile(this.resolve(key), value);
|
|
1424
1426
|
}
|
|
1425
1427
|
}
|
|
1426
1428
|
/**
|
|
@@ -1603,7 +1605,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1603
1605
|
* @returns The normalized module id.
|
|
1604
1606
|
*/
|
|
1605
1607
|
#normalizeId(id) {
|
|
1606
|
-
|
|
1608
|
+
let normalized = id;
|
|
1609
|
+
if (isParentPath.isParentPath(normalized, this.#context.builtinsPath)) {
|
|
1610
|
+
normalized = replace.replacePath(normalized, this.#context.builtinsPath);
|
|
1611
|
+
}
|
|
1612
|
+
return normalizeId(normalized, this.#context.config.output.builtinPrefix);
|
|
1607
1613
|
}
|
|
1608
1614
|
/**
|
|
1609
1615
|
* Normalizes a given path by resolving it against the project root, workspace root, and built-ins path.
|
|
@@ -1612,7 +1618,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1612
1618
|
* @returns The normalized path.
|
|
1613
1619
|
*/
|
|
1614
1620
|
#normalizePath(path) {
|
|
1615
|
-
return normalizePath(path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
|
|
1621
|
+
return normalizePath(path.includes("{") || path.includes("}") ? replacePathTokens(this.#context, path) : path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
|
|
1616
1622
|
}
|
|
1617
1623
|
/**
|
|
1618
1624
|
* Builds a regular expression from a string pattern for path matching.
|
|
@@ -2117,15 +2123,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2117
2123
|
}
|
|
2118
2124
|
}
|
|
2119
2125
|
const { relativeKey, adapter } = this.#getStorage(path);
|
|
2120
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(
|
|
2121
|
-
const id = options?.meta?.id || this.#normalizeId(
|
|
2126
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(relativeKey)} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
|
|
2127
|
+
const id = options?.meta?.id || this.#normalizeId(relativeKey);
|
|
2122
2128
|
this.#metadata[id] = {
|
|
2123
2129
|
variant: "normal",
|
|
2124
2130
|
timestamp: Date.now(),
|
|
2125
2131
|
...options.meta ?? {}
|
|
2126
2132
|
};
|
|
2127
|
-
this.#paths[id] = this.#normalizePath(
|
|
2128
|
-
this.#ids[this.#normalizePath(
|
|
2133
|
+
this.#paths[id] = this.#normalizePath(relativeKey);
|
|
2134
|
+
this.#ids[this.#normalizePath(relativeKey)] = id;
|
|
2129
2135
|
return adapter.set(relativeKey, code);
|
|
2130
2136
|
}
|
|
2131
2137
|
/**
|
|
@@ -2137,15 +2143,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2137
2143
|
*/
|
|
2138
2144
|
writeSync(path, data = "", options = {}) {
|
|
2139
2145
|
const { relativeKey, adapter } = this.#getStorage(path);
|
|
2140
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(
|
|
2141
|
-
const id = options?.meta?.id || this.#normalizeId(
|
|
2146
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(relativeKey)} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(data)).size)})`);
|
|
2147
|
+
const id = options?.meta?.id || this.#normalizeId(relativeKey);
|
|
2142
2148
|
this.#metadata[id] = {
|
|
2143
2149
|
variant: "normal",
|
|
2144
2150
|
timestamp: Date.now(),
|
|
2145
2151
|
...options.meta ?? {}
|
|
2146
2152
|
};
|
|
2147
|
-
this.#paths[id] = this.#normalizePath(
|
|
2148
|
-
this.#ids[this.#normalizePath(
|
|
2153
|
+
this.#paths[id] = this.#normalizePath(relativeKey);
|
|
2154
|
+
this.#ids[this.#normalizePath(relativeKey)] = id;
|
|
2149
2155
|
return adapter.setSync(relativeKey, data);
|
|
2150
2156
|
}
|
|
2151
2157
|
/**
|
|
@@ -2178,11 +2184,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2178
2184
|
* @returns A promise that resolves to the resolved module path.
|
|
2179
2185
|
*/
|
|
2180
2186
|
async resolve(id, importer, options = {}) {
|
|
2181
|
-
|
|
2182
|
-
|
|
2187
|
+
let path = id;
|
|
2188
|
+
if (path.includes("{") || path.includes("}")) {
|
|
2189
|
+
path = replacePathTokens(this.#context, path);
|
|
2190
|
+
}
|
|
2191
|
+
if (isType.isAbsolutePath(path)) {
|
|
2192
|
+
return path;
|
|
2183
2193
|
}
|
|
2184
2194
|
const resolverCacheKey = murmurhash.murmurhash({
|
|
2185
|
-
|
|
2195
|
+
path: this.#normalizeId(path),
|
|
2186
2196
|
importer,
|
|
2187
2197
|
options
|
|
2188
2198
|
});
|
|
@@ -2193,7 +2203,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2193
2203
|
return result;
|
|
2194
2204
|
}
|
|
2195
2205
|
}
|
|
2196
|
-
result = this.paths[this.#normalizeId(
|
|
2206
|
+
result = this.paths[this.#normalizeId(path)];
|
|
2197
2207
|
if (!result) {
|
|
2198
2208
|
const paths = options.paths ?? [];
|
|
2199
2209
|
if (importer && !paths.includes(importer)) {
|
|
@@ -2202,8 +2212,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2202
2212
|
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2203
2213
|
paths.push(append.appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
2204
2214
|
paths.push(append.appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
2205
|
-
paths.push(...Object.keys(this.#context.tsconfig
|
|
2206
|
-
for (const combination of resolve.getResolutionCombinations(
|
|
2215
|
+
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)));
|
|
2216
|
+
for (const combination of resolve.getResolutionCombinations(path, {
|
|
2207
2217
|
paths
|
|
2208
2218
|
})) {
|
|
2209
2219
|
const { relativeKey, adapter } = this.#getStorage(combination);
|
|
@@ -2212,19 +2222,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2212
2222
|
break;
|
|
2213
2223
|
}
|
|
2214
2224
|
}
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2225
|
+
if (!result) {
|
|
2226
|
+
try {
|
|
2227
|
+
result = await resolve.resolve(path, {
|
|
2228
|
+
...options,
|
|
2229
|
+
paths
|
|
2230
|
+
});
|
|
2231
|
+
} catch {
|
|
2232
|
+
}
|
|
2221
2233
|
}
|
|
2222
2234
|
}
|
|
2223
|
-
if (result) {
|
|
2224
|
-
|
|
2225
|
-
if (!this.#context.config.skipCache) {
|
|
2226
|
-
this.resolverCache.set(resolverCacheKey, result);
|
|
2227
|
-
}
|
|
2235
|
+
if (result && !this.#context.config.skipCache) {
|
|
2236
|
+
this.resolverCache.set(resolverCacheKey, result);
|
|
2228
2237
|
}
|
|
2229
2238
|
return result;
|
|
2230
2239
|
}
|
|
@@ -2245,17 +2254,21 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2245
2254
|
* @returns The resolved module path.
|
|
2246
2255
|
*/
|
|
2247
2256
|
resolveSync(id, importer, options = {}) {
|
|
2248
|
-
|
|
2249
|
-
|
|
2257
|
+
let path = id;
|
|
2258
|
+
if (path.includes("{") || path.includes("}")) {
|
|
2259
|
+
path = replacePathTokens(this.#context, path);
|
|
2260
|
+
}
|
|
2261
|
+
if (isType.isAbsolutePath(path)) {
|
|
2262
|
+
return path;
|
|
2250
2263
|
}
|
|
2251
2264
|
let result;
|
|
2252
2265
|
if (!this.#context.config.skipCache) {
|
|
2253
|
-
result = this.resolverCache.get(this.#normalizeId(
|
|
2266
|
+
result = this.resolverCache.get(this.#normalizeId(path));
|
|
2254
2267
|
if (result) {
|
|
2255
2268
|
return result;
|
|
2256
2269
|
}
|
|
2257
2270
|
}
|
|
2258
|
-
result = this.paths[this.#normalizeId(
|
|
2271
|
+
result = this.paths[this.#normalizeId(path)];
|
|
2259
2272
|
if (!result) {
|
|
2260
2273
|
const paths = options.paths ?? [];
|
|
2261
2274
|
if (importer && !paths.includes(importer)) {
|
|
@@ -2264,8 +2277,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2264
2277
|
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2265
2278
|
paths.push(append.appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
2266
2279
|
paths.push(append.appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
2267
|
-
paths.push(...Object.keys(this.#context.tsconfig
|
|
2268
|
-
for (const combination of resolve.getResolutionCombinations(
|
|
2280
|
+
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)));
|
|
2281
|
+
for (const combination of resolve.getResolutionCombinations(path, {
|
|
2269
2282
|
paths
|
|
2270
2283
|
})) {
|
|
2271
2284
|
const { relativeKey, adapter } = this.#getStorage(combination);
|
|
@@ -2274,18 +2287,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2274
2287
|
break;
|
|
2275
2288
|
}
|
|
2276
2289
|
}
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2290
|
+
if (!result) {
|
|
2291
|
+
try {
|
|
2292
|
+
result = resolve.resolveSync(path, {
|
|
2293
|
+
...options,
|
|
2294
|
+
paths
|
|
2295
|
+
});
|
|
2296
|
+
} catch {
|
|
2297
|
+
}
|
|
2282
2298
|
}
|
|
2283
2299
|
}
|
|
2284
|
-
if (result) {
|
|
2285
|
-
|
|
2286
|
-
if (!this.#context.config.skipCache) {
|
|
2287
|
-
this.resolverCache.set(this.#normalizeId(id), result);
|
|
2288
|
-
}
|
|
2300
|
+
if (result && !this.#context.config.skipCache) {
|
|
2301
|
+
this.resolverCache.set(this.#normalizeId(path), result);
|
|
2289
2302
|
}
|
|
2290
2303
|
return result;
|
|
2291
2304
|
}
|
|
@@ -2398,7 +2411,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2398
2411
|
#fs;
|
|
2399
2412
|
#tsconfig;
|
|
2400
2413
|
#program;
|
|
2401
|
-
#
|
|
2414
|
+
#parserCache;
|
|
2415
|
+
#requestCache;
|
|
2402
2416
|
#getConfigProps(config = {}) {
|
|
2403
2417
|
return {
|
|
2404
2418
|
variant: config.build?.variant,
|
|
@@ -2422,7 +2436,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2422
2436
|
lint: config.lint,
|
|
2423
2437
|
transform: config.transform,
|
|
2424
2438
|
build: config.build,
|
|
2425
|
-
framework: config.framework
|
|
2439
|
+
framework: config.framework,
|
|
2440
|
+
...config
|
|
2426
2441
|
};
|
|
2427
2442
|
}
|
|
2428
2443
|
/**
|
|
@@ -2470,6 +2485,10 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2470
2485
|
*/
|
|
2471
2486
|
resolver;
|
|
2472
2487
|
/**
|
|
2488
|
+
* The resolved configuration options
|
|
2489
|
+
*/
|
|
2490
|
+
resolvePatterns = [];
|
|
2491
|
+
/**
|
|
2473
2492
|
* Internal context fields and methods
|
|
2474
2493
|
*
|
|
2475
2494
|
* @internal
|
|
@@ -2501,7 +2520,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2501
2520
|
*/
|
|
2502
2521
|
set tsconfig(value) {
|
|
2503
2522
|
this.#tsconfig = value;
|
|
2504
|
-
this
|
|
2523
|
+
this.resolvePatterns = bundleRequire.tsconfigPathsToRegExp(value?.options?.paths ?? {});
|
|
2505
2524
|
}
|
|
2506
2525
|
/**
|
|
2507
2526
|
* The virtual file system interface for the project
|
|
@@ -2642,6 +2661,123 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2642
2661
|
return this.#program;
|
|
2643
2662
|
}
|
|
2644
2663
|
/**
|
|
2664
|
+
* Gets the parser cache.
|
|
2665
|
+
*/
|
|
2666
|
+
get parserCache() {
|
|
2667
|
+
if (!this.#parserCache) {
|
|
2668
|
+
this.#parserCache = flatCache.create({
|
|
2669
|
+
cacheId: "parser",
|
|
2670
|
+
cacheDir: this.cachePath,
|
|
2671
|
+
ttl: 2 * 60 * 60 * 1e3,
|
|
2672
|
+
lruSize: 5e3,
|
|
2673
|
+
persistInterval: 250
|
|
2674
|
+
});
|
|
2675
|
+
}
|
|
2676
|
+
return this.#parserCache;
|
|
2677
|
+
}
|
|
2678
|
+
/**
|
|
2679
|
+
* Gets the request cache.
|
|
2680
|
+
*/
|
|
2681
|
+
get requestCache() {
|
|
2682
|
+
if (!this.#requestCache) {
|
|
2683
|
+
this.#requestCache = flatCache.create({
|
|
2684
|
+
cacheId: "http",
|
|
2685
|
+
cacheDir: this.cachePath,
|
|
2686
|
+
ttl: 5 * 60 * 1e3,
|
|
2687
|
+
lruSize: 5e3,
|
|
2688
|
+
persistInterval: 250
|
|
2689
|
+
});
|
|
2690
|
+
}
|
|
2691
|
+
return this.#requestCache;
|
|
2692
|
+
}
|
|
2693
|
+
/**
|
|
2694
|
+
* A function to perform HTTP fetch requests
|
|
2695
|
+
*
|
|
2696
|
+
* @remarks
|
|
2697
|
+
* This function uses a caching layer to avoid duplicate requests during the Powerlines process.
|
|
2698
|
+
*
|
|
2699
|
+
* @example
|
|
2700
|
+
* ```ts
|
|
2701
|
+
* const response = await context.fetch("https://api.example.com/data");
|
|
2702
|
+
* const data = await response.json();
|
|
2703
|
+
* ```
|
|
2704
|
+
*
|
|
2705
|
+
* @see https://github.com/nodejs/undici
|
|
2706
|
+
*
|
|
2707
|
+
* @param input - The URL to fetch.
|
|
2708
|
+
* @param options - The fetch request options.
|
|
2709
|
+
* @returns A promise that resolves to a response returned by the fetch.
|
|
2710
|
+
*/
|
|
2711
|
+
async fetch(input, options = {}) {
|
|
2712
|
+
const cacheKey = murmurhash.murmurhash({
|
|
2713
|
+
input: input.toString(),
|
|
2714
|
+
options: JSON.stringify(options)
|
|
2715
|
+
});
|
|
2716
|
+
if (!this.config.skipCache && !options.skipCache) {
|
|
2717
|
+
const cached = this.requestCache.get(cacheKey);
|
|
2718
|
+
if (cached) {
|
|
2719
|
+
return new undici.Response(cached.body, {
|
|
2720
|
+
status: cached.status,
|
|
2721
|
+
statusText: cached.statusText,
|
|
2722
|
+
headers: cached.headers
|
|
2723
|
+
});
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
const result = await fetch.fetchRequest(input, options);
|
|
2727
|
+
if (!this.config.skipCache && !options.skipCache) {
|
|
2728
|
+
try {
|
|
2729
|
+
this.requestCache.set(cacheKey, {
|
|
2730
|
+
body: await result.text(),
|
|
2731
|
+
status: result.status,
|
|
2732
|
+
statusText: result.statusText,
|
|
2733
|
+
headers: Object.fromEntries(result.headers.entries())
|
|
2734
|
+
});
|
|
2735
|
+
} catch {
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
return result;
|
|
2739
|
+
}
|
|
2740
|
+
/**
|
|
2741
|
+
* Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
|
|
2742
|
+
*
|
|
2743
|
+
* @remarks
|
|
2744
|
+
* This function can be used to parse TypeScript code into an AST for further analysis or transformation.
|
|
2745
|
+
*
|
|
2746
|
+
* @example
|
|
2747
|
+
* ```ts
|
|
2748
|
+
* const ast = context.parse("const x: number = 42;");
|
|
2749
|
+
* ```
|
|
2750
|
+
*
|
|
2751
|
+
* @see https://rollupjs.org/plugin-development/#this-parse
|
|
2752
|
+
* @see https://github.com/oxc/oxc
|
|
2753
|
+
*
|
|
2754
|
+
* @param code - The source code to parse.
|
|
2755
|
+
* @param options - The options to pass to the parser.
|
|
2756
|
+
* @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
|
|
2757
|
+
*/
|
|
2758
|
+
async parse(code, options = {}) {
|
|
2759
|
+
const cacheKey = murmurhash.murmurhash({
|
|
2760
|
+
code,
|
|
2761
|
+
options
|
|
2762
|
+
});
|
|
2763
|
+
let result;
|
|
2764
|
+
if (!this.config.skipCache) {
|
|
2765
|
+
result = this.parserCache.get(cacheKey);
|
|
2766
|
+
if (result) {
|
|
2767
|
+
return result;
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
result = await oxcParser.parse(`source.${options.lang || "ts"}`, code, {
|
|
2771
|
+
...options,
|
|
2772
|
+
sourceType: "module",
|
|
2773
|
+
showSemanticErrors: this.config.mode === "development"
|
|
2774
|
+
});
|
|
2775
|
+
if (!this.config.skipCache) {
|
|
2776
|
+
this.parserCache.set(cacheKey, result);
|
|
2777
|
+
}
|
|
2778
|
+
return result;
|
|
2779
|
+
}
|
|
2780
|
+
/**
|
|
2645
2781
|
* A helper function to resolve modules in the Virtual File System
|
|
2646
2782
|
*
|
|
2647
2783
|
* @remarks
|
|
@@ -2686,7 +2822,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2686
2822
|
};
|
|
2687
2823
|
}
|
|
2688
2824
|
if (this.config.build.skipNodeModulesBundle) {
|
|
2689
|
-
if (bundleRequire.match(moduleId, this
|
|
2825
|
+
if (bundleRequire.match(moduleId, this.resolvePatterns) || bundleRequire.match(moduleId, this.config.build.noExternal)) {
|
|
2690
2826
|
return void 0;
|
|
2691
2827
|
}
|
|
2692
2828
|
if (bundleRequire.match(moduleId, this.config.build.external) || moduleId.startsWith("node:")) {
|
|
@@ -2880,6 +3016,26 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2880
3016
|
return extendLog(this.log, name);
|
|
2881
3017
|
}
|
|
2882
3018
|
/**
|
|
3019
|
+
* Generates a checksum representing the current context state
|
|
3020
|
+
*
|
|
3021
|
+
* @param root - The root directory of the project to generate the checksum for
|
|
3022
|
+
* @returns A promise that resolves to a string representing the checksum
|
|
3023
|
+
*/
|
|
3024
|
+
async generateChecksum(root = this.config.projectRoot) {
|
|
3025
|
+
this.#checksum = await hashFiles.hashDirectory(root, {
|
|
3026
|
+
ignore: [
|
|
3027
|
+
"node_modules",
|
|
3028
|
+
".git",
|
|
3029
|
+
".nx",
|
|
3030
|
+
".cache",
|
|
3031
|
+
".storm",
|
|
3032
|
+
"tmp",
|
|
3033
|
+
"dist"
|
|
3034
|
+
]
|
|
3035
|
+
});
|
|
3036
|
+
return this.#checksum;
|
|
3037
|
+
}
|
|
3038
|
+
/**
|
|
2883
3039
|
* Creates a new StormContext instance.
|
|
2884
3040
|
*
|
|
2885
3041
|
* @param workspaceConfig - The workspace configuration.
|
|
@@ -2901,26 +3057,6 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2901
3057
|
*/
|
|
2902
3058
|
logFn;
|
|
2903
3059
|
/**
|
|
2904
|
-
* Generates a checksum representing the current context state
|
|
2905
|
-
*
|
|
2906
|
-
* @param root - The root directory of the project to generate the checksum for
|
|
2907
|
-
* @returns A promise that resolves to a string representing the checksum
|
|
2908
|
-
*/
|
|
2909
|
-
async generateChecksum(root = this.config.projectRoot) {
|
|
2910
|
-
this.#checksum = await hashFiles.hashDirectory(root, {
|
|
2911
|
-
ignore: [
|
|
2912
|
-
"node_modules",
|
|
2913
|
-
".git",
|
|
2914
|
-
".nx",
|
|
2915
|
-
".cache",
|
|
2916
|
-
".storm",
|
|
2917
|
-
"tmp",
|
|
2918
|
-
"dist"
|
|
2919
|
-
]
|
|
2920
|
-
});
|
|
2921
|
-
return this.#checksum;
|
|
2922
|
-
}
|
|
2923
|
-
/**
|
|
2924
3060
|
* Initialize the context with the provided configuration options
|
|
2925
3061
|
*
|
|
2926
3062
|
* @param config - The partial user configuration to use for initialization.
|
|
@@ -3642,9 +3778,13 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3642
3778
|
let generatedTypes = await emitTypes(context, files);
|
|
3643
3779
|
context.log(types.LogLevelLabel.TRACE, `Generating TypeScript declaration file ${context.dtsPath}.`);
|
|
3644
3780
|
const directives = [];
|
|
3781
|
+
const asNextParam = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((previousResult) => isObject.isObject(previousResult) ? previousResult.code : previousResult, "asNextParam");
|
|
3645
3782
|
let result = await this.callHook("generateTypes", {
|
|
3646
3783
|
environment: context,
|
|
3647
|
-
|
|
3784
|
+
sequential: true,
|
|
3785
|
+
order: "pre",
|
|
3786
|
+
result: "merge",
|
|
3787
|
+
asNextParam
|
|
3648
3788
|
}, generatedTypes);
|
|
3649
3789
|
if (result) {
|
|
3650
3790
|
if (isSetObject.isSetObject(result)) {
|
|
@@ -3658,7 +3798,10 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3658
3798
|
}
|
|
3659
3799
|
result = await this.callHook("generateTypes", {
|
|
3660
3800
|
environment: context,
|
|
3661
|
-
|
|
3801
|
+
sequential: true,
|
|
3802
|
+
order: "normal",
|
|
3803
|
+
result: "merge",
|
|
3804
|
+
asNextParam
|
|
3662
3805
|
}, generatedTypes);
|
|
3663
3806
|
if (result) {
|
|
3664
3807
|
if (isSetObject.isSetObject(result)) {
|
|
@@ -3672,7 +3815,10 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3672
3815
|
}
|
|
3673
3816
|
result = await this.callHook("generateTypes", {
|
|
3674
3817
|
environment: context,
|
|
3675
|
-
|
|
3818
|
+
sequential: true,
|
|
3819
|
+
order: "post",
|
|
3820
|
+
result: "merge",
|
|
3821
|
+
asNextParam
|
|
3676
3822
|
}, generatedTypes);
|
|
3677
3823
|
if (result) {
|
|
3678
3824
|
if (isSetObject.isSetObject(result)) {
|
|
@@ -3684,15 +3830,24 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3684
3830
|
generatedTypes = result;
|
|
3685
3831
|
}
|
|
3686
3832
|
}
|
|
3687
|
-
|
|
3833
|
+
if (generatedTypes?.trim() || directives.length > 0) {
|
|
3834
|
+
await context.fs.write(context.dtsPath, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
|
|
3688
3835
|
|
|
3689
3836
|
` : ""}${getFileHeader(context, {
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3837
|
+
directive: null,
|
|
3838
|
+
prettierIgnore: false
|
|
3839
|
+
})}
|
|
3693
3840
|
|
|
3694
3841
|
${formatTypes(generatedTypes)}
|
|
3695
3842
|
`);
|
|
3843
|
+
} else {
|
|
3844
|
+
const dtsRelativePath = getTsconfigDtsPath(context);
|
|
3845
|
+
if (context.tsconfig.tsconfigJson.include && isIncludeMatchFound(dtsRelativePath, context.tsconfig.tsconfigJson.include)) {
|
|
3846
|
+
const normalizedDtsRelativePath = dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath;
|
|
3847
|
+
context.tsconfig.tsconfigJson.include = context.tsconfig.tsconfigJson.include.filter((includeValue) => includeValue?.toString() !== normalizedDtsRelativePath);
|
|
3848
|
+
await context.fs.write(context.tsconfig.tsconfigFilePath, JSON.stringify(context.tsconfig.tsconfigJson, null, 2));
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3696
3851
|
}
|
|
3697
3852
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
3698
3853
|
if (!context.tsconfig) {
|
|
@@ -3729,7 +3884,7 @@ ${formatTypes(generatedTypes)}
|
|
|
3729
3884
|
for (const file of files) {
|
|
3730
3885
|
context.log(types.LogLevelLabel.TRACE, `Adding template file: ${file}`);
|
|
3731
3886
|
const template = Handlebars__default.default.compile(file);
|
|
3732
|
-
await
|
|
3887
|
+
await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
3733
3888
|
}
|
|
3734
3889
|
await this.callHook("new", {
|
|
3735
3890
|
environment: context,
|
|
@@ -3740,14 +3895,14 @@ ${formatTypes(generatedTypes)}
|
|
|
3740
3895
|
for (const file of files2) {
|
|
3741
3896
|
context.log(types.LogLevelLabel.TRACE, `Adding application template file: ${file}`);
|
|
3742
3897
|
const template = Handlebars__default.default.compile(file);
|
|
3743
|
-
await
|
|
3898
|
+
await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
3744
3899
|
}
|
|
3745
3900
|
} else {
|
|
3746
3901
|
const files2 = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/library/**/*.hbs"));
|
|
3747
3902
|
for (const file of files2) {
|
|
3748
3903
|
context.log(types.LogLevelLabel.TRACE, `Adding library template file: ${file}`);
|
|
3749
3904
|
const template = Handlebars__default.default.compile(file);
|
|
3750
|
-
await
|
|
3905
|
+
await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
3751
3906
|
}
|
|
3752
3907
|
}
|
|
3753
3908
|
await this.callHook("new", {
|
|
@@ -4112,5 +4267,5 @@ exports.PowerlinesAPI = PowerlinesAPI;
|
|
|
4112
4267
|
exports._capnpFileId = _capnpFileId;
|
|
4113
4268
|
exports.createLog = createLog;
|
|
4114
4269
|
exports.extendLog = extendLog;
|
|
4115
|
-
//# sourceMappingURL=chunk-
|
|
4116
|
-
//# sourceMappingURL=chunk-
|
|
4270
|
+
//# sourceMappingURL=chunk-ERZWC77E.cjs.map
|
|
4271
|
+
//# sourceMappingURL=chunk-ERZWC77E.cjs.map
|