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
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { combineContexts } from './chunk-32Q2PG5D.js';
|
|
2
|
+
import { handleResolveId } from './chunk-G7S5PIAC.js';
|
|
2
3
|
import { extendLog } from './chunk-ENRLU4UR.js';
|
|
3
4
|
import { getString } from './chunk-M263EZ4F.js';
|
|
4
5
|
import { __name } from './chunk-SHUYVCID.js';
|
|
5
6
|
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
6
|
-
import { omit } from '@stryke/helpers/omit';
|
|
7
7
|
import { findFileName } from '@stryke/path/file-path-fns';
|
|
8
8
|
import { replaceExtension } from '@stryke/path/replace';
|
|
9
9
|
import { isString } from '@stryke/type-checks/is-string';
|
|
10
|
-
import defu from 'defu';
|
|
11
10
|
|
|
12
11
|
function createUnplugin(context, options = {}) {
|
|
13
12
|
const ctx = context;
|
|
@@ -68,7 +67,7 @@ function createUnplugin(context, options = {}) {
|
|
|
68
67
|
entry.output ||= entry.output?.replace(findFileName(entry.output, {
|
|
69
68
|
withExtension: true
|
|
70
69
|
}), entry.file);
|
|
71
|
-
await ctx.
|
|
70
|
+
await ctx.emitEntry(`
|
|
72
71
|
${ctx.config.build.polyfill.map((p) => `import "${p}";`).join("\n")}
|
|
73
72
|
|
|
74
73
|
export * from "${isString(resolved) ? resolved : resolved.id}";
|
|
@@ -114,9 +113,7 @@ export * from "${isString(resolved) ? resolved : resolved.id}";
|
|
|
114
113
|
async function transform(code, id) {
|
|
115
114
|
let transformed = code;
|
|
116
115
|
for (const handler of ctx.$$internal.environment.selectHooks("transform")) {
|
|
117
|
-
const result = await handler.apply(
|
|
118
|
-
"parse"
|
|
119
|
-
])), [
|
|
116
|
+
const result = await handler.apply(combineContexts(ctx, this), [
|
|
120
117
|
getString(transformed),
|
|
121
118
|
id
|
|
122
119
|
]);
|
|
@@ -143,6 +140,7 @@ export * from "${isString(resolved) ? resolved : resolved.id}";
|
|
|
143
140
|
__name(writeBundle, "writeBundle");
|
|
144
141
|
return {
|
|
145
142
|
name: "powerlines",
|
|
143
|
+
api: ctx.$$internal.api,
|
|
146
144
|
resolveId: {
|
|
147
145
|
filter: {
|
|
148
146
|
id: {
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
4
|
+
var types = require('@storm-software/config-tools/types');
|
|
5
|
+
var isString = require('@stryke/type-checks/is-string');
|
|
6
|
+
var isFunction = require('@stryke/type-checks/is-function');
|
|
7
|
+
var isSet = require('@stryke/type-checks/is-set');
|
|
8
|
+
var chalk = require('chalk');
|
|
9
|
+
var defu = require('defu');
|
|
10
|
+
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
14
|
+
|
|
15
|
+
async function callHook(context, hook, options, ...args) {
|
|
16
|
+
const handlers = context.selectHooks(hook, options);
|
|
17
|
+
if (handlers.length > 0) {
|
|
18
|
+
context.log(types.LogLevelLabel.DEBUG, ` \u{1F9E9} Calling plugin hook: ${chalk__default.default.bold.cyanBright(`${hook}${options?.order ? ` (${options.order})` : ""}`)}`);
|
|
19
|
+
let results = [];
|
|
20
|
+
if (options?.sequential === false) {
|
|
21
|
+
results = await Promise.all(handlers.map(async (handler) => {
|
|
22
|
+
if (!isFunction.isFunction(handler)) {
|
|
23
|
+
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
24
|
+
}
|
|
25
|
+
return Promise.resolve(handler.apply(null, ...args));
|
|
26
|
+
}));
|
|
27
|
+
} else {
|
|
28
|
+
for (const handler of handlers) {
|
|
29
|
+
if (!isFunction.isFunction(handler)) {
|
|
30
|
+
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
31
|
+
}
|
|
32
|
+
results.push(await Promise.resolve(handler.apply(null, ...args)));
|
|
33
|
+
if (options?.result === "first" && isSet.isSet(results[results.length - 1])) {
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const definedResults = results.filter((result) => isSet.isSet(result));
|
|
39
|
+
if (definedResults.length > 0) {
|
|
40
|
+
let mergedResult = void 0;
|
|
41
|
+
for (const result of definedResults) {
|
|
42
|
+
mergedResult = defu.defu(result, mergedResult ?? {});
|
|
43
|
+
}
|
|
44
|
+
return mergedResult;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return void 0;
|
|
48
|
+
}
|
|
49
|
+
chunkUSNT2KNT_cjs.__name(callHook, "callHook");
|
|
50
|
+
|
|
51
|
+
// src/lib/contexts/plugin-context.ts
|
|
52
|
+
function createPluginContext(plugin, environment) {
|
|
53
|
+
const normalizeMessage = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((message) => {
|
|
54
|
+
return isString.isString(message) ? message : message.message;
|
|
55
|
+
}, "normalizeMessage");
|
|
56
|
+
const log = environment.extendLog(plugin.name);
|
|
57
|
+
const callHookFn = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(async (hook, options, ...args) => {
|
|
58
|
+
return callHook(environment, hook, {
|
|
59
|
+
sequential: true,
|
|
60
|
+
...options
|
|
61
|
+
}, ...args);
|
|
62
|
+
}, "callHookFn");
|
|
63
|
+
return new Proxy({}, {
|
|
64
|
+
get(_, prop) {
|
|
65
|
+
if (prop === "$$internal") {
|
|
66
|
+
return {
|
|
67
|
+
...environment.$$internal,
|
|
68
|
+
environment,
|
|
69
|
+
callHook: callHookFn
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (prop === "log" || prop === "logger") {
|
|
73
|
+
return log;
|
|
74
|
+
}
|
|
75
|
+
if (prop === "error") {
|
|
76
|
+
return (message) => {
|
|
77
|
+
log(types.LogLevelLabel.ERROR, normalizeMessage(message));
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (prop === "warn") {
|
|
81
|
+
return (message) => {
|
|
82
|
+
log(types.LogLevelLabel.WARN, normalizeMessage(message));
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (prop === "info") {
|
|
86
|
+
return (message) => {
|
|
87
|
+
log(types.LogLevelLabel.INFO, normalizeMessage(message));
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (prop === "debug") {
|
|
91
|
+
return (message) => {
|
|
92
|
+
log(types.LogLevelLabel.DEBUG, normalizeMessage(message));
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (prop === "trace") {
|
|
96
|
+
return (message) => {
|
|
97
|
+
log(types.LogLevelLabel.TRACE, normalizeMessage(message));
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return environment[prop];
|
|
101
|
+
},
|
|
102
|
+
set(_, prop, value) {
|
|
103
|
+
if ([
|
|
104
|
+
"$$internal",
|
|
105
|
+
"environment",
|
|
106
|
+
"config",
|
|
107
|
+
"log",
|
|
108
|
+
"logger",
|
|
109
|
+
"error",
|
|
110
|
+
"warn",
|
|
111
|
+
"plugins",
|
|
112
|
+
"hooks",
|
|
113
|
+
"addPlugin",
|
|
114
|
+
"selectHooks"
|
|
115
|
+
].includes(prop)) {
|
|
116
|
+
log(types.LogLevelLabel.WARN, `Cannot set read-only property "${String(prop)}"`);
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
environment[prop] = value;
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
chunkUSNT2KNT_cjs.__name(createPluginContext, "createPluginContext");
|
|
125
|
+
|
|
126
|
+
exports.callHook = callHook;
|
|
127
|
+
exports.createPluginContext = createPluginContext;
|