powerlines 0.23.2 → 0.23.4
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--9pVSIbm.d.cts +168 -0
- package/dist/api-DxPACGY4.d.ts +168 -0
- package/dist/api.cjs +3 -3
- package/dist/api.d.cts +16 -7
- package/dist/api.d.ts +16 -7
- package/dist/api.js +2 -2
- package/dist/astro.cjs +8 -8
- package/dist/astro.d.cts +3 -5
- package/dist/astro.d.ts +3 -5
- package/dist/astro.js +5 -5
- package/dist/{chunk-ZFO3FUM4.cjs → chunk-2FLICTDF.cjs} +2 -2
- package/dist/{chunk-JAJ4CI2F.cjs → chunk-3OQXZ5MM.cjs} +2 -2
- package/dist/{chunk-KFRKOIP3.js → chunk-5B6P2VUG.js} +1 -1
- package/dist/{chunk-GNNF5SG6.cjs → chunk-6ACGI52O.cjs} +2 -2
- package/dist/{chunk-JZAQW55G.cjs → chunk-AF5VNWZD.cjs} +2 -2
- package/dist/{chunk-J7MZRPLN.cjs → chunk-AIC2EHPW.cjs} +5 -4
- package/dist/{chunk-3WDMXRK6.cjs → chunk-AYKZK666.cjs} +1 -1
- package/dist/chunk-CHNKTBUA.cjs +32 -0
- package/dist/{chunk-M4QJ2474.cjs → chunk-CTSSNO5L.cjs} +4 -4
- package/dist/{chunk-5A7FM72H.cjs → chunk-GP6XGAJ4.cjs} +2 -2
- package/dist/{chunk-DUYZ3TCT.js → chunk-HLQGKQZY.js} +1 -1
- package/dist/{chunk-LKN52AAX.js → chunk-HNJC47JM.js} +1 -1
- package/dist/{chunk-IGWSCIES.js → chunk-ISLX4Z3L.js} +3 -2
- package/dist/{chunk-J5LKLH5Z.js → chunk-KFSVTJMR.js} +1 -1
- package/dist/{chunk-RWVNX2CP.js → chunk-MI3U2GAT.js} +1 -1
- package/dist/{chunk-4ODWTALP.js → chunk-N3F54RFW.js} +2 -2
- package/dist/{chunk-Q7HBETZW.js → chunk-O2WB6QZ6.js} +1 -1
- package/dist/{chunk-DWV5QAGZ.cjs → chunk-OEKSQ22R.cjs} +2997 -2710
- package/dist/{chunk-WSLPUUGZ.js → chunk-PTZB4LWS.js} +1 -1
- package/dist/{chunk-CPRXGMH2.js → chunk-QSNFMINQ.js} +1 -1
- package/dist/{chunk-YQ76DZYD.cjs → chunk-QUZ4T5AX.cjs} +2 -2
- package/dist/chunk-UTAJPBVT.js +29 -0
- package/dist/{chunk-WG55ZHJL.cjs → chunk-UW3MXOWV.cjs} +2 -2
- package/dist/{chunk-F6BDL4HD.js → chunk-VDBKZJV6.js} +1 -1
- package/dist/{chunk-J3LN5HOC.cjs → chunk-VFLCP3SA.cjs} +2 -2
- package/dist/{chunk-FM4ABZQ2.js → chunk-VT7NVLLU.js} +1 -1
- package/dist/{chunk-WDBPA4RQ.cjs → chunk-VXAKPZ3A.cjs} +2 -2
- package/dist/{chunk-WXU3KLBP.cjs → chunk-XOI5CY62.cjs} +2 -2
- package/dist/{chunk-NH7U3PTV.js → chunk-ZQ7PDXYO.js} +1 -1
- package/dist/{chunk-TNYZH6EG.js → chunk-ZYCPZLIG.js} +2982 -2700
- package/dist/config.d.cts +3 -5
- package/dist/config.d.ts +3 -5
- package/dist/esbuild.cjs +7 -7
- package/dist/esbuild.d.cts +3 -5
- package/dist/esbuild.d.ts +3 -5
- package/dist/esbuild.js +4 -4
- package/dist/farm.cjs +4 -4
- package/dist/farm.d.cts +3 -5
- package/dist/farm.d.ts +3 -5
- package/dist/farm.js +3 -3
- package/dist/index.cjs +54 -33
- package/dist/index.d.cts +191 -39
- package/dist/index.d.ts +191 -39
- package/dist/index.js +18 -17
- package/dist/lib/api-B6hfFxVS.d.ts +167 -0
- package/dist/lib/api-CD2QlMig.d.cts +167 -0
- package/dist/lib/build/esbuild.d.cts +2 -4
- package/dist/lib/build/esbuild.d.ts +2 -4
- package/dist/lib/build/index.d.cts +4 -5
- package/dist/lib/build/index.d.ts +4 -5
- package/dist/lib/build/rolldown.d.cts +2 -4
- package/dist/lib/build/rolldown.d.ts +2 -4
- package/dist/lib/build/rollup.d.cts +2 -4
- package/dist/lib/build/rollup.d.ts +2 -4
- package/dist/lib/build/rspack.d.cts +2 -4
- package/dist/lib/build/rspack.d.ts +2 -4
- package/dist/lib/build/tsup.d.cts +2 -4
- package/dist/lib/build/tsup.d.ts +2 -4
- package/dist/lib/build/unbuild.d.cts +4 -23
- package/dist/lib/build/unbuild.d.ts +4 -23
- package/dist/lib/build/vite.d.cts +2 -4
- package/dist/lib/build/vite.d.ts +2 -4
- package/dist/lib/build/webpack.d.cts +2 -4
- package/dist/lib/build/webpack.d.ts +2 -4
- package/dist/lib/chunk-32Q2PG5D.js +9 -0
- package/dist/lib/chunk-35FGUJFD.cjs +2 -0
- package/dist/lib/{chunk-LIN4KAV3.js → chunk-52VDUP5J.js} +5 -7
- package/dist/lib/chunk-B3EE3VHZ.cjs +127 -0
- package/dist/lib/{chunk-UWHGJ4JS.js → chunk-BLNW3ZQA.js} +483 -1776
- package/dist/lib/chunk-DX2VAXZB.cjs +11 -0
- package/dist/lib/{chunk-VGSV2BEL.cjs → chunk-EFYMNU53.cjs} +6 -12
- package/dist/lib/chunk-FBQIPNRV.cjs +146 -0
- package/dist/lib/chunk-FFT4PWRM.js +1 -0
- package/dist/lib/{chunk-L4NEN725.js → chunk-G7S5PIAC.js} +1 -1
- package/dist/lib/chunk-KFJCWNVG.js +120 -0
- package/dist/lib/chunk-M2U6XIQ2.js +144 -0
- package/dist/lib/chunk-MVIKYHBX.cjs +2 -0
- package/dist/lib/chunk-NYNHNTHT.js +1 -0
- package/dist/lib/{chunk-A5SB72VO.cjs → chunk-PYQADZVV.cjs} +493 -1779
- package/dist/lib/chunk-QP6WX3Q3.js +1190 -0
- package/dist/lib/chunk-S7LLEDQM.cjs +1218 -0
- package/dist/lib/chunk-UHGGYHSK.cjs +175 -0
- package/dist/lib/chunk-YNKFRPUY.js +168 -0
- package/dist/lib/{chunk-ULJVBW4L.cjs → chunk-ZBDVQVUK.cjs} +1 -1
- package/dist/lib/{config-BoGlIhnH.d.cts → config-DTSdCZsw.d.cts} +650 -633
- package/dist/lib/{config-CTej7RMP.d.ts → config-DeUaQYc_.d.ts} +650 -633
- package/dist/lib/config-file.d.cts +4 -5
- package/dist/lib/config-file.d.ts +4 -5
- package/dist/lib/contexts/api-context.cjs +18 -0
- package/dist/lib/contexts/api-context.d.cts +69 -0
- package/dist/lib/contexts/api-context.d.ts +69 -0
- package/dist/lib/contexts/api-context.js +9 -0
- package/dist/lib/contexts/context.cjs +15 -0
- package/dist/lib/contexts/context.d.cts +255 -0
- package/dist/lib/contexts/context.d.ts +255 -0
- package/dist/lib/contexts/context.js +6 -0
- package/dist/lib/contexts/environment-context.cjs +17 -0
- package/dist/lib/contexts/environment-context.d.cts +65 -0
- package/dist/lib/contexts/environment-context.d.ts +65 -0
- package/dist/lib/contexts/environment-context.js +8 -0
- package/dist/lib/contexts/index.cjs +31 -0
- package/dist/lib/contexts/index.d.cts +35 -0
- package/dist/lib/contexts/index.d.ts +35 -0
- package/dist/lib/contexts/index.js +10 -0
- package/dist/lib/contexts/plugin-context.cjs +11 -0
- package/dist/lib/contexts/plugin-context.d.cts +42 -0
- package/dist/lib/contexts/plugin-context.d.ts +42 -0
- package/dist/lib/contexts/plugin-context.js +2 -0
- package/dist/lib/entry.d.cts +2 -4
- package/dist/lib/entry.d.ts +2 -4
- package/dist/lib/index.cjs +96 -74
- package/dist/lib/index.d.cts +26 -23
- package/dist/lib/index.d.ts +26 -23
- package/dist/lib/index.js +18 -12
- package/dist/lib/internal-CpVMJCaU.d.ts +39 -0
- package/dist/lib/internal-ypnrUNZy.d.cts +39 -0
- package/dist/lib/logger.d.cts +4 -5
- package/dist/lib/logger.d.ts +4 -5
- package/dist/lib/typescript/compiler-host.cjs +1 -1
- package/dist/lib/typescript/compiler-host.d.cts +5 -5
- package/dist/lib/typescript/compiler-host.d.ts +5 -5
- package/dist/lib/typescript/compiler-host.js +1 -1
- package/dist/lib/typescript/import-transformer.d.cts +2 -4
- package/dist/lib/typescript/import-transformer.d.ts +2 -4
- package/dist/lib/typescript/index.cjs +29 -24
- package/dist/lib/typescript/index.d.cts +6 -6
- package/dist/lib/typescript/index.d.ts +6 -6
- package/dist/lib/typescript/index.js +3 -2
- package/dist/lib/typescript/isolated-decl.d.cts +2 -1
- package/dist/lib/typescript/isolated-decl.d.ts +2 -1
- package/dist/lib/typescript/program.d.cts +5 -5
- package/dist/lib/typescript/program.d.ts +5 -5
- package/dist/lib/typescript/ts-morph.cjs +11 -0
- package/dist/lib/{create-program.d.ts → typescript/ts-morph.d.cts} +3 -5
- package/dist/lib/{create-program.d.cts → typescript/ts-morph.d.ts} +3 -5
- package/dist/lib/typescript/ts-morph.js +2 -0
- package/dist/lib/unplugin/factory.cjs +8 -4
- package/dist/lib/unplugin/factory.d.cts +27 -10
- package/dist/lib/unplugin/factory.d.ts +27 -10
- package/dist/lib/unplugin/factory.js +7 -3
- package/dist/lib/unplugin/helpers.cjs +11 -0
- package/dist/lib/unplugin/helpers.d.cts +128 -0
- package/dist/lib/unplugin/helpers.d.ts +128 -0
- package/dist/lib/unplugin/helpers.js +2 -0
- package/dist/lib/unplugin/index.cjs +12 -7
- package/dist/lib/unplugin/index.d.cts +6 -8
- package/dist/lib/unplugin/index.d.ts +6 -8
- package/dist/lib/unplugin/index.js +9 -4
- package/dist/lib/unplugin/plugin.cjs +4 -3
- package/dist/lib/unplugin/plugin.d.cts +4 -5
- package/dist/lib/unplugin/plugin.d.ts +4 -5
- package/dist/lib/unplugin/plugin.js +3 -2
- package/dist/lib/unplugin/resolve-id.cjs +2 -2
- package/dist/lib/unplugin/resolve-id.d.cts +5 -5
- package/dist/lib/unplugin/resolve-id.d.ts +5 -5
- package/dist/lib/unplugin/resolve-id.js +1 -1
- package/dist/lib/utilities/bundle.d.cts +2 -4
- package/dist/lib/utilities/bundle.d.ts +2 -4
- package/dist/lib/utilities/cache.d.cts +2 -4
- package/dist/lib/utilities/cache.d.ts +2 -4
- package/dist/lib/utilities/file-header.d.cts +4 -5
- package/dist/lib/utilities/file-header.d.ts +4 -5
- package/dist/lib/utilities/index.cjs +18 -18
- package/dist/lib/utilities/index.d.cts +5 -7
- package/dist/lib/utilities/index.d.ts +5 -7
- package/dist/lib/utilities/index.js +4 -4
- package/dist/lib/utilities/meta.d.cts +4 -5
- package/dist/lib/utilities/meta.d.ts +4 -5
- package/dist/lib/utilities/resolve-path.d.cts +2 -4
- package/dist/lib/utilities/resolve-path.d.ts +2 -4
- package/dist/lib/utilities/resolve.d.cts +2 -4
- package/dist/lib/utilities/resolve.d.ts +2 -4
- package/dist/lib/utilities/source-file.d.cts +2 -4
- package/dist/lib/utilities/source-file.d.ts +2 -4
- package/dist/lib/utilities/source-map.d.cts +2 -4
- package/dist/lib/utilities/source-map.d.ts +2 -4
- package/dist/lib/utilities/worker.d.cts +4 -5
- package/dist/lib/utilities/worker.d.ts +4 -5
- package/dist/lib/utilities/write-file.d.cts +2 -4
- package/dist/lib/utilities/write-file.d.ts +2 -4
- package/dist/next.cjs +8 -8
- package/dist/next.js +5 -5
- package/dist/nuxt.cjs +9 -9
- package/dist/nuxt.js +6 -6
- package/dist/plugin-utils/{context-D1I2JQgs.d.cts → context-DRFZE3XI.d.cts} +535 -518
- package/dist/plugin-utils/{context-D1I2JQgs.d.ts → context-DRFZE3XI.d.ts} +535 -518
- package/dist/plugin-utils/context-helpers.d.cts +2 -4
- package/dist/plugin-utils/context-helpers.d.ts +2 -4
- package/dist/plugin-utils/enforce.d.cts +2 -4
- package/dist/plugin-utils/enforce.d.ts +2 -4
- package/dist/plugin-utils/extend.d.cts +2 -4
- package/dist/plugin-utils/extend.d.ts +2 -4
- package/dist/plugin-utils/get-config-path.d.cts +2 -4
- package/dist/plugin-utils/get-config-path.d.ts +2 -4
- package/dist/plugin-utils/helpers.d.cts +2 -4
- package/dist/plugin-utils/helpers.d.ts +2 -4
- package/dist/plugin-utils/index.d.cts +3 -5
- package/dist/plugin-utils/index.d.ts +3 -5
- package/dist/plugin-utils/merge.d.cts +4 -5
- package/dist/plugin-utils/merge.d.ts +4 -5
- package/dist/plugin-utils/paths.d.cts +2 -4
- package/dist/plugin-utils/paths.d.ts +2 -4
- package/dist/{resolved-DYLxPDut.d.cts → resolved-C00CJgsk.d.cts} +128 -9
- package/dist/{resolved-D1ySEdUv.d.ts → resolved-DKFZ11S7.d.ts} +128 -9
- package/dist/rolldown.cjs +7 -7
- package/dist/rolldown.d.cts +3 -5
- package/dist/rolldown.d.ts +3 -5
- package/dist/rolldown.js +4 -4
- package/dist/rollup.cjs +7 -7
- package/dist/rollup.d.cts +3 -5
- package/dist/rollup.d.ts +3 -5
- package/dist/rollup.js +4 -4
- package/dist/rspack.cjs +7 -7
- package/dist/rspack.d.cts +3 -5
- package/dist/rspack.d.ts +3 -5
- package/dist/rspack.js +4 -4
- package/dist/tsup.cjs +8 -8
- package/dist/tsup.js +5 -5
- package/dist/types/api.cjs +4 -0
- package/dist/types/api.d.cts +36 -0
- package/dist/types/api.d.ts +36 -0
- package/dist/types/api.js +1 -0
- package/dist/types/babel.d.cts +3 -5
- package/dist/types/babel.d.ts +3 -5
- package/dist/types/build.d.cts +26 -1
- package/dist/types/build.d.ts +26 -1
- package/dist/types/commands.d.cts +3 -5
- package/dist/types/commands.d.ts +3 -5
- package/dist/types/config.d.cts +3 -5
- package/dist/types/config.d.ts +3 -5
- package/dist/types/context.d.cts +3 -5
- package/dist/types/context.d.ts +3 -5
- package/dist/types/{vfs.cjs → fs.cjs} +3 -3
- package/dist/types/{vfs.d.cts → fs.d.cts} +54 -35
- package/dist/types/{vfs.d.ts → fs.d.ts} +54 -35
- package/dist/types/fs.js +2 -0
- package/dist/types/hooks.d.cts +3 -5
- package/dist/types/hooks.d.ts +3 -5
- package/dist/types/index.cjs +9 -8
- package/dist/types/index.d.cts +8 -9
- package/dist/types/index.d.ts +8 -9
- package/dist/types/index.js +3 -2
- package/dist/types/internal.d.cts +46 -9
- package/dist/types/internal.d.ts +46 -9
- package/dist/types/plugin.d.cts +3 -5
- package/dist/types/plugin.d.ts +3 -5
- package/dist/types/resolved.d.cts +3 -5
- package/dist/types/resolved.d.ts +3 -5
- package/dist/types/tsconfig.d.cts +8 -1
- package/dist/types/tsconfig.d.ts +8 -1
- package/dist/types/typedoc.d.cts +3 -1
- package/dist/types/typedoc.d.ts +3 -1
- package/dist/types/unplugin.d.cts +22 -11
- package/dist/types/unplugin.d.ts +22 -11
- package/dist/unloader.cjs +7 -7
- package/dist/unloader.d.cts +12 -14
- package/dist/unloader.d.ts +12 -14
- package/dist/unloader.js +4 -4
- package/dist/unplugin.cjs +18 -18
- package/dist/unplugin.d.cts +6 -9
- package/dist/unplugin.d.ts +6 -9
- package/dist/unplugin.js +15 -15
- package/dist/vite.cjs +7 -7
- package/dist/vite.d.cts +3 -5
- package/dist/vite.d.ts +3 -5
- package/dist/vite.js +4 -4
- package/dist/webpack.cjs +7 -7
- package/dist/webpack.d.cts +3 -5
- package/dist/webpack.d.ts +3 -5
- package/dist/webpack.js +4 -4
- package/package.json +39 -11
- package/schemas/fs.capnp +73 -15
- package/dist/chunk-RODEAGIJ.cjs +0 -32
- package/dist/chunk-SKLSRHBU.js +0 -29
- package/dist/hooks-D2UGCryi.d.ts +0 -28
- package/dist/hooks-DJG3B-Hw.d.cts +0 -28
- package/dist/lib/create-program.cjs +0 -11
- package/dist/lib/create-program.js +0 -2
- package/dist/lib/hooks-CDLPWf7j.d.cts +0 -28
- package/dist/lib/hooks-Cn-IqwYp.d.ts +0 -28
- package/dist/types/vfs.js +0 -2
- /package/dist/{chunk-KIKTWMI3.cjs → chunk-2NCILNCH.cjs} +0 -0
- /package/dist/{chunk-XVLT2RQ2.js → chunk-BLNT5INX.js} +0 -0
- /package/dist/{lib/chunk-RJ4277VZ.cjs → chunk-GRU7B3QM.cjs} +0 -0
- /package/dist/{lib/chunk-ZBLDAREE.js → chunk-T2P533I5.js} +0 -0
- /package/dist/lib/{chunk-CGYAL3S2.cjs → chunk-4EIXDLFP.cjs} +0 -0
- /package/dist/lib/{chunk-CXRSMYEX.js → chunk-RD5AUWXN.js} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
4
|
+
var defu = require('defu');
|
|
5
|
+
|
|
6
|
+
function combineContexts(context, unplugin) {
|
|
7
|
+
return defu.defu(context, unplugin);
|
|
8
|
+
}
|
|
9
|
+
chunkUSNT2KNT_cjs.__name(combineContexts, "combineContexts");
|
|
10
|
+
|
|
11
|
+
exports.combineContexts = combineContexts;
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkDX2VAXZB_cjs = require('./chunk-DX2VAXZB.cjs');
|
|
4
|
+
var chunkZBDVQVUK_cjs = require('./chunk-ZBDVQVUK.cjs');
|
|
4
5
|
var chunkJA4HSQRN_cjs = require('./chunk-JA4HSQRN.cjs');
|
|
5
6
|
var chunk3OCI4TH7_cjs = require('./chunk-3OCI4TH7.cjs');
|
|
6
7
|
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
7
8
|
var types = require('@storm-software/config-tools/types');
|
|
8
|
-
var omit = require('@stryke/helpers/omit');
|
|
9
9
|
var filePathFns = require('@stryke/path/file-path-fns');
|
|
10
10
|
var replace = require('@stryke/path/replace');
|
|
11
11
|
var isString = require('@stryke/type-checks/is-string');
|
|
12
|
-
var defu = require('defu');
|
|
13
|
-
|
|
14
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
|
|
16
|
-
var defu__default = /*#__PURE__*/_interopDefault(defu);
|
|
17
12
|
|
|
18
13
|
function createUnplugin(context, options = {}) {
|
|
19
14
|
const ctx = context;
|
|
@@ -48,7 +43,7 @@ function createUnplugin(context, options = {}) {
|
|
|
48
43
|
if (result) {
|
|
49
44
|
return result;
|
|
50
45
|
}
|
|
51
|
-
result = await
|
|
46
|
+
result = await chunkZBDVQVUK_cjs.handleResolveId(ctx, {
|
|
52
47
|
id,
|
|
53
48
|
importer,
|
|
54
49
|
options: opts
|
|
@@ -74,7 +69,7 @@ function createUnplugin(context, options = {}) {
|
|
|
74
69
|
entry.output ||= entry.output?.replace(filePathFns.findFileName(entry.output, {
|
|
75
70
|
withExtension: true
|
|
76
71
|
}), entry.file);
|
|
77
|
-
await ctx.
|
|
72
|
+
await ctx.emitEntry(`
|
|
78
73
|
${ctx.config.build.polyfill.map((p) => `import "${p}";`).join("\n")}
|
|
79
74
|
|
|
80
75
|
export * from "${isString.isString(resolved) ? resolved : resolved.id}";
|
|
@@ -120,9 +115,7 @@ export * from "${isString.isString(resolved) ? resolved : resolved.id}";
|
|
|
120
115
|
async function transform(code, id) {
|
|
121
116
|
let transformed = code;
|
|
122
117
|
for (const handler of ctx.$$internal.environment.selectHooks("transform")) {
|
|
123
|
-
const result = await handler.apply(
|
|
124
|
-
"parse"
|
|
125
|
-
])), [
|
|
118
|
+
const result = await handler.apply(chunkDX2VAXZB_cjs.combineContexts(ctx, this), [
|
|
126
119
|
chunk3OCI4TH7_cjs.getString(transformed),
|
|
127
120
|
id
|
|
128
121
|
]);
|
|
@@ -149,6 +142,7 @@ export * from "${isString.isString(resolved) ? resolved : resolved.id}";
|
|
|
149
142
|
chunkUSNT2KNT_cjs.__name(writeBundle, "writeBundle");
|
|
150
143
|
return {
|
|
151
144
|
name: "powerlines",
|
|
145
|
+
api: ctx.$$internal.api,
|
|
152
146
|
resolveId: {
|
|
153
147
|
filter: {
|
|
154
148
|
id: {
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkB3EE3VHZ_cjs = require('./chunk-B3EE3VHZ.cjs');
|
|
4
|
+
var chunkPYQADZVV_cjs = require('./chunk-PYQADZVV.cjs');
|
|
5
|
+
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
6
|
+
var resolve = require('@stryke/fs/resolve');
|
|
7
|
+
var isFunction = require('@stryke/type-checks/is-function');
|
|
8
|
+
var isObject = require('@stryke/type-checks/is-object');
|
|
9
|
+
|
|
10
|
+
// src/types/plugin.ts
|
|
11
|
+
var PLUGIN_NON_HOOK_FIELDS = [
|
|
12
|
+
"name",
|
|
13
|
+
"enforce",
|
|
14
|
+
"dedupe",
|
|
15
|
+
"dependsOn",
|
|
16
|
+
"applyToEnvironment"
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
// src/lib/contexts/environment-context.ts
|
|
20
|
+
var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends chunkPYQADZVV_cjs.PowerlinesContext {
|
|
21
|
+
static {
|
|
22
|
+
chunkUSNT2KNT_cjs.__name(this, "PowerlinesEnvironmentContext");
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The hooks registered by plugins in this environment
|
|
26
|
+
*/
|
|
27
|
+
#hooks = {};
|
|
28
|
+
/**
|
|
29
|
+
* Create a new Storm context from the workspace root and user config.
|
|
30
|
+
*
|
|
31
|
+
* @param workspaceConfig - The root directory of the workspace.
|
|
32
|
+
* @param config - The user configuration options.
|
|
33
|
+
* @returns A promise that resolves to the new context.
|
|
34
|
+
*/
|
|
35
|
+
static async fromConfig(workspaceConfig, config) {
|
|
36
|
+
const context = new _PowerlinesEnvironmentContext(config, workspaceConfig);
|
|
37
|
+
await context.init();
|
|
38
|
+
context.powerlinesPath = await resolve.resolvePackage("powerlines");
|
|
39
|
+
if (!context.powerlinesPath) {
|
|
40
|
+
throw new Error("Could not resolve `powerlines` package location.");
|
|
41
|
+
}
|
|
42
|
+
return context;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The resolved environment configuration
|
|
46
|
+
*/
|
|
47
|
+
environment;
|
|
48
|
+
/**
|
|
49
|
+
* The list of plugins applied to this environment
|
|
50
|
+
*/
|
|
51
|
+
plugins = [];
|
|
52
|
+
/**
|
|
53
|
+
* The resolved configuration options
|
|
54
|
+
*/
|
|
55
|
+
get config() {
|
|
56
|
+
return super.config;
|
|
57
|
+
}
|
|
58
|
+
get hooks() {
|
|
59
|
+
return this.#hooks;
|
|
60
|
+
}
|
|
61
|
+
async addPlugin(plugin) {
|
|
62
|
+
let resolvedPlugin = plugin;
|
|
63
|
+
if (plugin.applyToEnvironment) {
|
|
64
|
+
const result = await Promise.resolve(plugin.applyToEnvironment(this.environment));
|
|
65
|
+
if (!result || isObject.isObject(result) && Object.keys(result).length === 0) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
resolvedPlugin = chunkPYQADZVV_cjs.isPlugin(result) ? result : plugin;
|
|
69
|
+
}
|
|
70
|
+
const context = chunkB3EE3VHZ_cjs.createPluginContext(resolvedPlugin, this);
|
|
71
|
+
this.plugins.push({
|
|
72
|
+
plugin: resolvedPlugin,
|
|
73
|
+
context
|
|
74
|
+
});
|
|
75
|
+
this.#hooks = Object.keys(resolvedPlugin).filter((key) => !PLUGIN_NON_HOOK_FIELDS.includes(key)).reduce((ret, key) => {
|
|
76
|
+
const hook = key;
|
|
77
|
+
const pluginHook = resolvedPlugin[hook];
|
|
78
|
+
if (!chunkPYQADZVV_cjs.isPluginHook(pluginHook)) {
|
|
79
|
+
return ret;
|
|
80
|
+
}
|
|
81
|
+
if (!chunkPYQADZVV_cjs.isHookExternal(hook)) {
|
|
82
|
+
ret[hook] ??= {};
|
|
83
|
+
if (resolvedPlugin.enforce) {
|
|
84
|
+
ret[hook][`${resolvedPlugin.enforce}Enforced`] ??= [];
|
|
85
|
+
chunkPYQADZVV_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][`${resolvedPlugin.enforce}Enforced`]);
|
|
86
|
+
return ret;
|
|
87
|
+
}
|
|
88
|
+
if (isFunction.isFunction(pluginHook) || !pluginHook.order) {
|
|
89
|
+
ret[hook].normal ??= [];
|
|
90
|
+
chunkPYQADZVV_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook].normal);
|
|
91
|
+
return ret;
|
|
92
|
+
}
|
|
93
|
+
ret[hook][`${pluginHook.order}Ordered`] ??= [];
|
|
94
|
+
chunkPYQADZVV_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][`${pluginHook.order}Ordered`]);
|
|
95
|
+
} else {
|
|
96
|
+
ret[hook] ??= [];
|
|
97
|
+
ret[hook].push({
|
|
98
|
+
plugin: resolvedPlugin,
|
|
99
|
+
hook: chunkPYQADZVV_cjs.getHookHandler(pluginHook).bind(context)
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return ret;
|
|
103
|
+
}, this.hooks);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Retrieves the hook handlers for a specific hook name
|
|
107
|
+
*/
|
|
108
|
+
selectHooks(hook, options) {
|
|
109
|
+
const handlers = [];
|
|
110
|
+
if (this.hooks[hook]) {
|
|
111
|
+
if (!chunkPYQADZVV_cjs.isHookExternal(hook)) {
|
|
112
|
+
const hooks = this.hooks[hook];
|
|
113
|
+
if (options?.order) {
|
|
114
|
+
if (options?.order === "pre") {
|
|
115
|
+
handlers.push(...(hooks.preOrdered ?? []).map((h) => h.handler));
|
|
116
|
+
handlers.push(...(hooks.preEnforced ?? []).map((h) => h.handler));
|
|
117
|
+
} else if (options?.order === "post") {
|
|
118
|
+
handlers.push(...(hooks.postOrdered ?? []).map((h) => h.handler));
|
|
119
|
+
handlers.push(...(hooks.postEnforced ?? []).map((h) => h.handler));
|
|
120
|
+
} else {
|
|
121
|
+
handlers.push(...(hooks.normal ?? []).map((h) => h.handler));
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
handlers.push(...this.selectHooks(hook, {
|
|
125
|
+
order: "pre"
|
|
126
|
+
}));
|
|
127
|
+
handlers.push(...this.selectHooks(hook, {
|
|
128
|
+
order: "normal"
|
|
129
|
+
}));
|
|
130
|
+
handlers.push(...this.selectHooks(hook, {
|
|
131
|
+
order: "post"
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
handlers.push(...this.hooks[hook].map((h) => h.handler));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return handlers;
|
|
139
|
+
}
|
|
140
|
+
constructor(config, workspaceConfig) {
|
|
141
|
+
super(workspaceConfig);
|
|
142
|
+
this.resolvedConfig = config;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
exports.PowerlinesEnvironmentContext = PowerlinesEnvironmentContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -71,7 +71,7 @@ async function handleResolveId(context, args, options = {}) {
|
|
|
71
71
|
args.importer
|
|
72
72
|
] : []
|
|
73
73
|
});
|
|
74
|
-
if (match(args.id, options.noExternal) || resolvedPath && context.fs.metadata[resolvedPath]?.
|
|
74
|
+
if (match(args.id, options.noExternal) || resolvedPath && context.fs.metadata[resolvedPath]?.type === "builtin") {
|
|
75
75
|
return void 0;
|
|
76
76
|
}
|
|
77
77
|
if (match(args.id, options.external) || args.id.startsWith("node:")) {
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
+
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
3
|
+
import { isString } from '@stryke/type-checks/is-string';
|
|
4
|
+
import { isFunction } from '@stryke/type-checks/is-function';
|
|
5
|
+
import { isSet } from '@stryke/type-checks/is-set';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import { defu } from 'defu';
|
|
8
|
+
|
|
9
|
+
async function callHook(context, hook, options, ...args) {
|
|
10
|
+
const handlers = context.selectHooks(hook, options);
|
|
11
|
+
if (handlers.length > 0) {
|
|
12
|
+
context.log(LogLevelLabel.DEBUG, ` \u{1F9E9} Calling plugin hook: ${chalk.bold.cyanBright(`${hook}${options?.order ? ` (${options.order})` : ""}`)}`);
|
|
13
|
+
let results = [];
|
|
14
|
+
if (options?.sequential === false) {
|
|
15
|
+
results = await Promise.all(handlers.map(async (handler) => {
|
|
16
|
+
if (!isFunction(handler)) {
|
|
17
|
+
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
18
|
+
}
|
|
19
|
+
return Promise.resolve(handler.apply(null, ...args));
|
|
20
|
+
}));
|
|
21
|
+
} else {
|
|
22
|
+
for (const handler of handlers) {
|
|
23
|
+
if (!isFunction(handler)) {
|
|
24
|
+
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
25
|
+
}
|
|
26
|
+
results.push(await Promise.resolve(handler.apply(null, ...args)));
|
|
27
|
+
if (options?.result === "first" && isSet(results[results.length - 1])) {
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const definedResults = results.filter((result) => isSet(result));
|
|
33
|
+
if (definedResults.length > 0) {
|
|
34
|
+
let mergedResult = void 0;
|
|
35
|
+
for (const result of definedResults) {
|
|
36
|
+
mergedResult = defu(result, mergedResult ?? {});
|
|
37
|
+
}
|
|
38
|
+
return mergedResult;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
__name(callHook, "callHook");
|
|
44
|
+
|
|
45
|
+
// src/lib/contexts/plugin-context.ts
|
|
46
|
+
function createPluginContext(plugin, environment) {
|
|
47
|
+
const normalizeMessage = /* @__PURE__ */ __name((message) => {
|
|
48
|
+
return isString(message) ? message : message.message;
|
|
49
|
+
}, "normalizeMessage");
|
|
50
|
+
const log = environment.extendLog(plugin.name);
|
|
51
|
+
const callHookFn = /* @__PURE__ */ __name(async (hook, options, ...args) => {
|
|
52
|
+
return callHook(environment, hook, {
|
|
53
|
+
sequential: true,
|
|
54
|
+
...options
|
|
55
|
+
}, ...args);
|
|
56
|
+
}, "callHookFn");
|
|
57
|
+
return new Proxy({}, {
|
|
58
|
+
get(_, prop) {
|
|
59
|
+
if (prop === "$$internal") {
|
|
60
|
+
return {
|
|
61
|
+
...environment.$$internal,
|
|
62
|
+
environment,
|
|
63
|
+
callHook: callHookFn
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (prop === "log" || prop === "logger") {
|
|
67
|
+
return log;
|
|
68
|
+
}
|
|
69
|
+
if (prop === "error") {
|
|
70
|
+
return (message) => {
|
|
71
|
+
log(LogLevelLabel.ERROR, normalizeMessage(message));
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (prop === "warn") {
|
|
75
|
+
return (message) => {
|
|
76
|
+
log(LogLevelLabel.WARN, normalizeMessage(message));
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (prop === "info") {
|
|
80
|
+
return (message) => {
|
|
81
|
+
log(LogLevelLabel.INFO, normalizeMessage(message));
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (prop === "debug") {
|
|
85
|
+
return (message) => {
|
|
86
|
+
log(LogLevelLabel.DEBUG, normalizeMessage(message));
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (prop === "trace") {
|
|
90
|
+
return (message) => {
|
|
91
|
+
log(LogLevelLabel.TRACE, normalizeMessage(message));
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return environment[prop];
|
|
95
|
+
},
|
|
96
|
+
set(_, prop, value) {
|
|
97
|
+
if ([
|
|
98
|
+
"$$internal",
|
|
99
|
+
"environment",
|
|
100
|
+
"config",
|
|
101
|
+
"log",
|
|
102
|
+
"logger",
|
|
103
|
+
"error",
|
|
104
|
+
"warn",
|
|
105
|
+
"plugins",
|
|
106
|
+
"hooks",
|
|
107
|
+
"addPlugin",
|
|
108
|
+
"selectHooks"
|
|
109
|
+
].includes(prop)) {
|
|
110
|
+
log(LogLevelLabel.WARN, `Cannot set read-only property "${String(prop)}"`);
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
environment[prop] = value;
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
__name(createPluginContext, "createPluginContext");
|
|
119
|
+
|
|
120
|
+
export { callHook, createPluginContext };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { createPluginContext } from './chunk-KFJCWNVG.js';
|
|
2
|
+
import { PowerlinesContext, isPlugin, isPluginHook, isHookExternal, addPluginHook, getHookHandler } from './chunk-BLNW3ZQA.js';
|
|
3
|
+
import { __name } from './chunk-SHUYVCID.js';
|
|
4
|
+
import { resolvePackage } from '@stryke/fs/resolve';
|
|
5
|
+
import { isFunction } from '@stryke/type-checks/is-function';
|
|
6
|
+
import { isObject } from '@stryke/type-checks/is-object';
|
|
7
|
+
|
|
8
|
+
// src/types/plugin.ts
|
|
9
|
+
var PLUGIN_NON_HOOK_FIELDS = [
|
|
10
|
+
"name",
|
|
11
|
+
"enforce",
|
|
12
|
+
"dedupe",
|
|
13
|
+
"dependsOn",
|
|
14
|
+
"applyToEnvironment"
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
// src/lib/contexts/environment-context.ts
|
|
18
|
+
var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends PowerlinesContext {
|
|
19
|
+
static {
|
|
20
|
+
__name(this, "PowerlinesEnvironmentContext");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The hooks registered by plugins in this environment
|
|
24
|
+
*/
|
|
25
|
+
#hooks = {};
|
|
26
|
+
/**
|
|
27
|
+
* Create a new Storm context from the workspace root and user config.
|
|
28
|
+
*
|
|
29
|
+
* @param workspaceConfig - The root directory of the workspace.
|
|
30
|
+
* @param config - The user configuration options.
|
|
31
|
+
* @returns A promise that resolves to the new context.
|
|
32
|
+
*/
|
|
33
|
+
static async fromConfig(workspaceConfig, config) {
|
|
34
|
+
const context = new _PowerlinesEnvironmentContext(config, workspaceConfig);
|
|
35
|
+
await context.init();
|
|
36
|
+
context.powerlinesPath = await resolvePackage("powerlines");
|
|
37
|
+
if (!context.powerlinesPath) {
|
|
38
|
+
throw new Error("Could not resolve `powerlines` package location.");
|
|
39
|
+
}
|
|
40
|
+
return context;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The resolved environment configuration
|
|
44
|
+
*/
|
|
45
|
+
environment;
|
|
46
|
+
/**
|
|
47
|
+
* The list of plugins applied to this environment
|
|
48
|
+
*/
|
|
49
|
+
plugins = [];
|
|
50
|
+
/**
|
|
51
|
+
* The resolved configuration options
|
|
52
|
+
*/
|
|
53
|
+
get config() {
|
|
54
|
+
return super.config;
|
|
55
|
+
}
|
|
56
|
+
get hooks() {
|
|
57
|
+
return this.#hooks;
|
|
58
|
+
}
|
|
59
|
+
async addPlugin(plugin) {
|
|
60
|
+
let resolvedPlugin = plugin;
|
|
61
|
+
if (plugin.applyToEnvironment) {
|
|
62
|
+
const result = await Promise.resolve(plugin.applyToEnvironment(this.environment));
|
|
63
|
+
if (!result || isObject(result) && Object.keys(result).length === 0) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
resolvedPlugin = isPlugin(result) ? result : plugin;
|
|
67
|
+
}
|
|
68
|
+
const context = createPluginContext(resolvedPlugin, this);
|
|
69
|
+
this.plugins.push({
|
|
70
|
+
plugin: resolvedPlugin,
|
|
71
|
+
context
|
|
72
|
+
});
|
|
73
|
+
this.#hooks = Object.keys(resolvedPlugin).filter((key) => !PLUGIN_NON_HOOK_FIELDS.includes(key)).reduce((ret, key) => {
|
|
74
|
+
const hook = key;
|
|
75
|
+
const pluginHook = resolvedPlugin[hook];
|
|
76
|
+
if (!isPluginHook(pluginHook)) {
|
|
77
|
+
return ret;
|
|
78
|
+
}
|
|
79
|
+
if (!isHookExternal(hook)) {
|
|
80
|
+
ret[hook] ??= {};
|
|
81
|
+
if (resolvedPlugin.enforce) {
|
|
82
|
+
ret[hook][`${resolvedPlugin.enforce}Enforced`] ??= [];
|
|
83
|
+
addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][`${resolvedPlugin.enforce}Enforced`]);
|
|
84
|
+
return ret;
|
|
85
|
+
}
|
|
86
|
+
if (isFunction(pluginHook) || !pluginHook.order) {
|
|
87
|
+
ret[hook].normal ??= [];
|
|
88
|
+
addPluginHook(context, resolvedPlugin, pluginHook, ret[hook].normal);
|
|
89
|
+
return ret;
|
|
90
|
+
}
|
|
91
|
+
ret[hook][`${pluginHook.order}Ordered`] ??= [];
|
|
92
|
+
addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][`${pluginHook.order}Ordered`]);
|
|
93
|
+
} else {
|
|
94
|
+
ret[hook] ??= [];
|
|
95
|
+
ret[hook].push({
|
|
96
|
+
plugin: resolvedPlugin,
|
|
97
|
+
hook: getHookHandler(pluginHook).bind(context)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return ret;
|
|
101
|
+
}, this.hooks);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Retrieves the hook handlers for a specific hook name
|
|
105
|
+
*/
|
|
106
|
+
selectHooks(hook, options) {
|
|
107
|
+
const handlers = [];
|
|
108
|
+
if (this.hooks[hook]) {
|
|
109
|
+
if (!isHookExternal(hook)) {
|
|
110
|
+
const hooks = this.hooks[hook];
|
|
111
|
+
if (options?.order) {
|
|
112
|
+
if (options?.order === "pre") {
|
|
113
|
+
handlers.push(...(hooks.preOrdered ?? []).map((h) => h.handler));
|
|
114
|
+
handlers.push(...(hooks.preEnforced ?? []).map((h) => h.handler));
|
|
115
|
+
} else if (options?.order === "post") {
|
|
116
|
+
handlers.push(...(hooks.postOrdered ?? []).map((h) => h.handler));
|
|
117
|
+
handlers.push(...(hooks.postEnforced ?? []).map((h) => h.handler));
|
|
118
|
+
} else {
|
|
119
|
+
handlers.push(...(hooks.normal ?? []).map((h) => h.handler));
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
handlers.push(...this.selectHooks(hook, {
|
|
123
|
+
order: "pre"
|
|
124
|
+
}));
|
|
125
|
+
handlers.push(...this.selectHooks(hook, {
|
|
126
|
+
order: "normal"
|
|
127
|
+
}));
|
|
128
|
+
handlers.push(...this.selectHooks(hook, {
|
|
129
|
+
order: "post"
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
handlers.push(...this.hooks[hook].map((h) => h.handler));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return handlers;
|
|
137
|
+
}
|
|
138
|
+
constructor(config, workspaceConfig) {
|
|
139
|
+
super(workspaceConfig);
|
|
140
|
+
this.resolvedConfig = config;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export { PowerlinesEnvironmentContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|