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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { getFileHeader } from './chunk-GANVMM73.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { isPluginConfig, isPlugin, isPluginConfigTuple, isPluginConfigObject, checkDedupe } from './chunk-HE6HOGLS.js';
|
|
2
|
+
import { PowerlinesAPIContext } from './chunk-GD7KTLPU.js';
|
|
3
|
+
import { isPluginConfig, isPlugin, isPluginConfigTuple, isPluginConfigObject, checkDedupe } from './chunk-GSGF6RL2.js';
|
|
5
4
|
import { writeMetaFile } from './chunk-OEF6EHQV.js';
|
|
6
5
|
import { createProgram } from './chunk-4W6WV35V.js';
|
|
7
|
-
import { getParsedTypeScriptConfig, getTsconfigFilePath
|
|
6
|
+
import { isIncludeMatchFound, getParsedTypeScriptConfig, getTsconfigFilePath } from './chunk-ZGMEHSNN.js';
|
|
8
7
|
import { createLog } from './chunk-ENRLU4UR.js';
|
|
9
8
|
import { getString } from './chunk-M263EZ4F.js';
|
|
10
9
|
import { __name } from './chunk-SHUYVCID.js';
|
|
11
10
|
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
12
11
|
import { getWorkspaceRoot } from '@stryke/fs/get-workspace-root';
|
|
12
|
+
import { setParseImpl } from 'unplugin';
|
|
13
13
|
import { transformAsync } from '@babel/core';
|
|
14
14
|
import { formatLogMessage } from '@storm-software/config-tools/logger/console';
|
|
15
15
|
import { toArray } from '@stryke/convert/to-array';
|
|
@@ -25,6 +25,7 @@ import { replacePath } from '@stryke/path/replace';
|
|
|
25
25
|
import { isError } from '@stryke/type-checks/is-error';
|
|
26
26
|
import { isFunction } from '@stryke/type-checks/is-function';
|
|
27
27
|
import { isNumber } from '@stryke/type-checks/is-number';
|
|
28
|
+
import { isObject } from '@stryke/type-checks/is-object';
|
|
28
29
|
import { isPromiseLike } from '@stryke/type-checks/is-promise';
|
|
29
30
|
import { isSet } from '@stryke/type-checks/is-set';
|
|
30
31
|
import { isSetObject } from '@stryke/type-checks/is-set-object';
|
|
@@ -200,7 +201,9 @@ async function callHook(context, hook, options, ...args) {
|
|
|
200
201
|
if (!isFunction(handler)) {
|
|
201
202
|
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
202
203
|
}
|
|
203
|
-
return Promise.resolve(handler.apply(null,
|
|
204
|
+
return Promise.resolve(handler.apply(null, [
|
|
205
|
+
...args
|
|
206
|
+
]));
|
|
204
207
|
}));
|
|
205
208
|
} else {
|
|
206
209
|
for (const handler of handlers) {
|
|
@@ -208,7 +211,9 @@ async function callHook(context, hook, options, ...args) {
|
|
|
208
211
|
throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
|
|
209
212
|
}
|
|
210
213
|
if (options?.result === "first" || options?.asNextParam === false) {
|
|
211
|
-
results.push(await Promise.resolve(handler.apply(null,
|
|
214
|
+
results.push(await Promise.resolve(handler.apply(null, [
|
|
215
|
+
...args
|
|
216
|
+
])));
|
|
212
217
|
if (options?.result === "first" && isSet(results[results.length - 1])) {
|
|
213
218
|
break;
|
|
214
219
|
}
|
|
@@ -220,12 +225,22 @@ async function callHook(context, hook, options, ...args) {
|
|
|
220
225
|
sequenceArgs[0] = isFunction(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
|
|
221
226
|
}
|
|
222
227
|
const result = await Promise.resolve(
|
|
223
|
-
// eslint-disable-next-line ts/no-unsafe-call
|
|
224
|
-
handler.apply(null,
|
|
228
|
+
// eslint-disable-next-line ts/no-unsafe-call, no-useless-call
|
|
229
|
+
handler.apply(null, [
|
|
230
|
+
...sequenceArgs
|
|
231
|
+
])
|
|
225
232
|
);
|
|
226
|
-
|
|
227
|
-
result
|
|
228
|
-
|
|
233
|
+
if (result) {
|
|
234
|
+
if (options?.result === "last") {
|
|
235
|
+
results = [
|
|
236
|
+
result
|
|
237
|
+
];
|
|
238
|
+
} else {
|
|
239
|
+
results = [
|
|
240
|
+
defu(result, results[0] ?? {})
|
|
241
|
+
];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
229
244
|
}
|
|
230
245
|
}
|
|
231
246
|
}
|
|
@@ -293,13 +308,18 @@ ${Object.entries(context.devDependencies).map(([name, version]) => `- ${name}@${
|
|
|
293
308
|
]);
|
|
294
309
|
}
|
|
295
310
|
__name(installDependencies, "installDependencies");
|
|
311
|
+
function getTsconfigDtsPath(context) {
|
|
312
|
+
const dtsRelativePath = joinPaths(relativePath(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot), findFilePath(context.dtsPath)), findFileName(context.dtsPath));
|
|
313
|
+
return dtsRelativePath;
|
|
314
|
+
}
|
|
315
|
+
__name(getTsconfigDtsPath, "getTsconfigDtsPath");
|
|
296
316
|
async function resolveTsconfigChanges(context) {
|
|
297
317
|
const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw);
|
|
298
318
|
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
299
319
|
const tsconfigJson = await readJsonFile(tsconfigFilePath);
|
|
300
320
|
tsconfigJson.compilerOptions ??= {};
|
|
301
321
|
if (context.config.output.dts !== false) {
|
|
302
|
-
const dtsRelativePath =
|
|
322
|
+
const dtsRelativePath = getTsconfigDtsPath(context);
|
|
303
323
|
if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [
|
|
304
324
|
context.dtsPath,
|
|
305
325
|
dtsRelativePath
|
|
@@ -341,7 +361,7 @@ async function initializeTsconfig(context) {
|
|
|
341
361
|
context.tsconfig.originalTsconfigJson = await readJsonFile(tsconfigFilePath);
|
|
342
362
|
context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
|
|
343
363
|
context.log(LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
|
|
344
|
-
await
|
|
364
|
+
await context.fs.write(tsconfigFilePath, StormJSON.stringify(context.tsconfig.tsconfigJson));
|
|
345
365
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
|
|
346
366
|
}
|
|
347
367
|
__name(initializeTsconfig, "initializeTsconfig");
|
|
@@ -390,13 +410,11 @@ async function resolveTsconfig(context) {
|
|
|
390
410
|
`).join("\n")}
|
|
391
411
|
`);
|
|
392
412
|
}
|
|
393
|
-
await
|
|
413
|
+
await context.fs.write(context.tsconfig.tsconfigFilePath, StormJSON.stringify(updateTsconfigJson));
|
|
394
414
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
395
415
|
if (!context.tsconfig) {
|
|
396
416
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
397
417
|
}
|
|
398
|
-
context.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
399
|
-
context.tsconfig.tsconfigJson.compilerOptions.strict = false;
|
|
400
418
|
}
|
|
401
419
|
__name(resolveTsconfig, "resolveTsconfig");
|
|
402
420
|
|
|
@@ -556,9 +574,13 @@ ${formatLogMessage(context.config)}`);
|
|
|
556
574
|
let generatedTypes = await emitTypes(context, files);
|
|
557
575
|
context.log(LogLevelLabel.TRACE, `Generating TypeScript declaration file ${context.dtsPath}.`);
|
|
558
576
|
const directives = [];
|
|
577
|
+
const asNextParam = /* @__PURE__ */ __name((previousResult) => isObject(previousResult) ? previousResult.code : previousResult, "asNextParam");
|
|
559
578
|
let result = await this.callHook("generateTypes", {
|
|
560
579
|
environment: context,
|
|
561
|
-
|
|
580
|
+
sequential: true,
|
|
581
|
+
order: "pre",
|
|
582
|
+
result: "merge",
|
|
583
|
+
asNextParam
|
|
562
584
|
}, generatedTypes);
|
|
563
585
|
if (result) {
|
|
564
586
|
if (isSetObject(result)) {
|
|
@@ -572,7 +594,10 @@ ${formatLogMessage(context.config)}`);
|
|
|
572
594
|
}
|
|
573
595
|
result = await this.callHook("generateTypes", {
|
|
574
596
|
environment: context,
|
|
575
|
-
|
|
597
|
+
sequential: true,
|
|
598
|
+
order: "normal",
|
|
599
|
+
result: "merge",
|
|
600
|
+
asNextParam
|
|
576
601
|
}, generatedTypes);
|
|
577
602
|
if (result) {
|
|
578
603
|
if (isSetObject(result)) {
|
|
@@ -586,7 +611,10 @@ ${formatLogMessage(context.config)}`);
|
|
|
586
611
|
}
|
|
587
612
|
result = await this.callHook("generateTypes", {
|
|
588
613
|
environment: context,
|
|
589
|
-
|
|
614
|
+
sequential: true,
|
|
615
|
+
order: "post",
|
|
616
|
+
result: "merge",
|
|
617
|
+
asNextParam
|
|
590
618
|
}, generatedTypes);
|
|
591
619
|
if (result) {
|
|
592
620
|
if (isSetObject(result)) {
|
|
@@ -598,15 +626,24 @@ ${formatLogMessage(context.config)}`);
|
|
|
598
626
|
generatedTypes = result;
|
|
599
627
|
}
|
|
600
628
|
}
|
|
601
|
-
|
|
629
|
+
if (generatedTypes?.trim() || directives.length > 0) {
|
|
630
|
+
await context.fs.write(context.dtsPath, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
|
|
602
631
|
|
|
603
632
|
` : ""}${getFileHeader(context, {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
633
|
+
directive: null,
|
|
634
|
+
prettierIgnore: false
|
|
635
|
+
})}
|
|
607
636
|
|
|
608
637
|
${formatTypes(generatedTypes)}
|
|
609
638
|
`);
|
|
639
|
+
} else {
|
|
640
|
+
const dtsRelativePath = getTsconfigDtsPath(context);
|
|
641
|
+
if (context.tsconfig.tsconfigJson.include && isIncludeMatchFound(dtsRelativePath, context.tsconfig.tsconfigJson.include)) {
|
|
642
|
+
const normalizedDtsRelativePath = dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath;
|
|
643
|
+
context.tsconfig.tsconfigJson.include = context.tsconfig.tsconfigJson.include.filter((includeValue) => includeValue?.toString() !== normalizedDtsRelativePath);
|
|
644
|
+
await context.fs.write(context.tsconfig.tsconfigFilePath, JSON.stringify(context.tsconfig.tsconfigJson, null, 2));
|
|
645
|
+
}
|
|
646
|
+
}
|
|
610
647
|
}
|
|
611
648
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
612
649
|
if (!context.tsconfig) {
|
|
@@ -643,7 +680,7 @@ ${formatTypes(generatedTypes)}
|
|
|
643
680
|
for (const file of files) {
|
|
644
681
|
context.log(LogLevelLabel.TRACE, `Adding template file: ${file}`);
|
|
645
682
|
const template = Handlebars.compile(file);
|
|
646
|
-
await
|
|
683
|
+
await context.fs.write(joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
647
684
|
}
|
|
648
685
|
await this.callHook("new", {
|
|
649
686
|
environment: context,
|
|
@@ -654,14 +691,14 @@ ${formatTypes(generatedTypes)}
|
|
|
654
691
|
for (const file of files2) {
|
|
655
692
|
context.log(LogLevelLabel.TRACE, `Adding application template file: ${file}`);
|
|
656
693
|
const template = Handlebars.compile(file);
|
|
657
|
-
await
|
|
694
|
+
await context.fs.write(joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
658
695
|
}
|
|
659
696
|
} else {
|
|
660
697
|
const files2 = await listFiles(joinPaths(context.powerlinesPath, "files/library/**/*.hbs"));
|
|
661
698
|
for (const file of files2) {
|
|
662
699
|
context.log(LogLevelLabel.TRACE, `Adding library template file: ${file}`);
|
|
663
700
|
const template = Handlebars.compile(file);
|
|
664
|
-
await
|
|
701
|
+
await context.fs.write(joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
665
702
|
}
|
|
666
703
|
}
|
|
667
704
|
await this.callHook("new", {
|
|
@@ -1031,8 +1068,8 @@ function createUnpluginFactory(variant, decorate) {
|
|
|
1031
1068
|
let api;
|
|
1032
1069
|
async function buildStart() {
|
|
1033
1070
|
log(LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
|
|
1034
|
-
|
|
1035
|
-
api
|
|
1071
|
+
api = await PowerlinesAPI.from(getWorkspaceRoot(process.cwd()), userConfig);
|
|
1072
|
+
setParseImpl(api.context.parse);
|
|
1036
1073
|
log(LogLevelLabel.DEBUG, "Preparing build artifacts for the Powerlines project...");
|
|
1037
1074
|
await api.prepare({
|
|
1038
1075
|
command: "build"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
4
|
+
var replace = require('@stryke/path/replace');
|
|
5
|
+
|
|
6
|
+
function replacePathTokens(context, path) {
|
|
7
|
+
if (!path) {
|
|
8
|
+
return path;
|
|
9
|
+
}
|
|
10
|
+
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));
|
|
11
|
+
}
|
|
12
|
+
chunkUSNT2KNT_cjs.__name(replacePathTokens, "replacePathTokens");
|
|
13
|
+
|
|
14
|
+
exports.replacePathTokens = replacePathTokens;
|
|
@@ -4,6 +4,7 @@ var chunk6OYSDQXE_cjs = require('./chunk-6OYSDQXE.cjs');
|
|
|
4
4
|
var chunkXUYQYUWZ_cjs = require('./chunk-XUYQYUWZ.cjs');
|
|
5
5
|
var chunkYYEAV24J_cjs = require('./chunk-YYEAV24J.cjs');
|
|
6
6
|
var chunkJA4HSQRN_cjs = require('./chunk-JA4HSQRN.cjs');
|
|
7
|
+
var chunkYXJJCE6V_cjs = require('./chunk-YXJJCE6V.cjs');
|
|
7
8
|
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
8
9
|
var types = require('@storm-software/config-tools/types');
|
|
9
10
|
var $ = require('@stryke/capnp');
|
|
@@ -13,7 +14,6 @@ var exists = require('@stryke/fs/exists');
|
|
|
13
14
|
var resolve = require('@stryke/fs/resolve');
|
|
14
15
|
var murmurhash = require('@stryke/hash/murmurhash');
|
|
15
16
|
var append = require('@stryke/path/append');
|
|
16
|
-
var correctPath = require('@stryke/path/correct-path');
|
|
17
17
|
var filePathFns = require('@stryke/path/file-path-fns');
|
|
18
18
|
var isParentPath = require('@stryke/path/is-parent-path');
|
|
19
19
|
var isType = require('@stryke/path/is-type');
|
|
@@ -324,7 +324,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
324
324
|
* @returns The normalized module id.
|
|
325
325
|
*/
|
|
326
326
|
#normalizeId(id) {
|
|
327
|
-
|
|
327
|
+
let normalized = id;
|
|
328
|
+
if (isParentPath.isParentPath(normalized, this.#context.builtinsPath)) {
|
|
329
|
+
normalized = replace.replacePath(normalized, this.#context.builtinsPath);
|
|
330
|
+
}
|
|
331
|
+
return chunkYYEAV24J_cjs.normalizeId(normalized, this.#context.config.output.builtinPrefix);
|
|
328
332
|
}
|
|
329
333
|
/**
|
|
330
334
|
* Normalizes a given path by resolving it against the project root, workspace root, and built-ins path.
|
|
@@ -333,7 +337,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
333
337
|
* @returns The normalized path.
|
|
334
338
|
*/
|
|
335
339
|
#normalizePath(path) {
|
|
336
|
-
return chunkYYEAV24J_cjs.normalizePath(path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
|
|
340
|
+
return chunkYYEAV24J_cjs.normalizePath(path.includes("{") || path.includes("}") ? chunkYXJJCE6V_cjs.replacePathTokens(this.#context, path) : path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
|
|
337
341
|
}
|
|
338
342
|
/**
|
|
339
343
|
* Builds a regular expression from a string pattern for path matching.
|
|
@@ -838,15 +842,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
838
842
|
}
|
|
839
843
|
}
|
|
840
844
|
const { relativeKey, adapter } = this.#getStorage(path);
|
|
841
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(
|
|
842
|
-
const id = options?.meta?.id || this.#normalizeId(
|
|
845
|
+
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)})`);
|
|
846
|
+
const id = options?.meta?.id || this.#normalizeId(relativeKey);
|
|
843
847
|
this.#metadata[id] = {
|
|
844
848
|
variant: "normal",
|
|
845
849
|
timestamp: Date.now(),
|
|
846
850
|
...options.meta ?? {}
|
|
847
851
|
};
|
|
848
|
-
this.#paths[id] = this.#normalizePath(
|
|
849
|
-
this.#ids[this.#normalizePath(
|
|
852
|
+
this.#paths[id] = this.#normalizePath(relativeKey);
|
|
853
|
+
this.#ids[this.#normalizePath(relativeKey)] = id;
|
|
850
854
|
return adapter.set(relativeKey, code);
|
|
851
855
|
}
|
|
852
856
|
/**
|
|
@@ -858,15 +862,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
858
862
|
*/
|
|
859
863
|
writeSync(path, data = "", options = {}) {
|
|
860
864
|
const { relativeKey, adapter } = this.#getStorage(path);
|
|
861
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(
|
|
862
|
-
const id = options?.meta?.id || this.#normalizeId(
|
|
865
|
+
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)})`);
|
|
866
|
+
const id = options?.meta?.id || this.#normalizeId(relativeKey);
|
|
863
867
|
this.#metadata[id] = {
|
|
864
868
|
variant: "normal",
|
|
865
869
|
timestamp: Date.now(),
|
|
866
870
|
...options.meta ?? {}
|
|
867
871
|
};
|
|
868
|
-
this.#paths[id] = this.#normalizePath(
|
|
869
|
-
this.#ids[this.#normalizePath(
|
|
872
|
+
this.#paths[id] = this.#normalizePath(relativeKey);
|
|
873
|
+
this.#ids[this.#normalizePath(relativeKey)] = id;
|
|
870
874
|
return adapter.setSync(relativeKey, data);
|
|
871
875
|
}
|
|
872
876
|
/**
|
|
@@ -899,11 +903,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
899
903
|
* @returns A promise that resolves to the resolved module path.
|
|
900
904
|
*/
|
|
901
905
|
async resolve(id, importer, options = {}) {
|
|
902
|
-
|
|
903
|
-
|
|
906
|
+
let path = id;
|
|
907
|
+
if (path.includes("{") || path.includes("}")) {
|
|
908
|
+
path = chunkYXJJCE6V_cjs.replacePathTokens(this.#context, path);
|
|
909
|
+
}
|
|
910
|
+
if (isType.isAbsolutePath(path)) {
|
|
911
|
+
return path;
|
|
904
912
|
}
|
|
905
913
|
const resolverCacheKey = murmurhash.murmurhash({
|
|
906
|
-
|
|
914
|
+
path: this.#normalizeId(path),
|
|
907
915
|
importer,
|
|
908
916
|
options
|
|
909
917
|
});
|
|
@@ -914,7 +922,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
914
922
|
return result;
|
|
915
923
|
}
|
|
916
924
|
}
|
|
917
|
-
result = this.paths[this.#normalizeId(
|
|
925
|
+
result = this.paths[this.#normalizeId(path)];
|
|
918
926
|
if (!result) {
|
|
919
927
|
const paths = options.paths ?? [];
|
|
920
928
|
if (importer && !paths.includes(importer)) {
|
|
@@ -923,8 +931,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
923
931
|
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
924
932
|
paths.push(append.appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
925
933
|
paths.push(append.appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
926
|
-
paths.push(...Object.keys(this.#context.tsconfig
|
|
927
|
-
for (const combination of resolve.getResolutionCombinations(
|
|
934
|
+
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)));
|
|
935
|
+
for (const combination of resolve.getResolutionCombinations(path, {
|
|
928
936
|
paths
|
|
929
937
|
})) {
|
|
930
938
|
const { relativeKey, adapter } = this.#getStorage(combination);
|
|
@@ -933,19 +941,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
933
941
|
break;
|
|
934
942
|
}
|
|
935
943
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
944
|
+
if (!result) {
|
|
945
|
+
try {
|
|
946
|
+
result = await resolve.resolve(path, {
|
|
947
|
+
...options,
|
|
948
|
+
paths
|
|
949
|
+
});
|
|
950
|
+
} catch {
|
|
951
|
+
}
|
|
942
952
|
}
|
|
943
953
|
}
|
|
944
|
-
if (result) {
|
|
945
|
-
|
|
946
|
-
if (!this.#context.config.skipCache) {
|
|
947
|
-
this.resolverCache.set(resolverCacheKey, result);
|
|
948
|
-
}
|
|
954
|
+
if (result && !this.#context.config.skipCache) {
|
|
955
|
+
this.resolverCache.set(resolverCacheKey, result);
|
|
949
956
|
}
|
|
950
957
|
return result;
|
|
951
958
|
}
|
|
@@ -966,17 +973,21 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
966
973
|
* @returns The resolved module path.
|
|
967
974
|
*/
|
|
968
975
|
resolveSync(id, importer, options = {}) {
|
|
969
|
-
|
|
970
|
-
|
|
976
|
+
let path = id;
|
|
977
|
+
if (path.includes("{") || path.includes("}")) {
|
|
978
|
+
path = chunkYXJJCE6V_cjs.replacePathTokens(this.#context, path);
|
|
979
|
+
}
|
|
980
|
+
if (isType.isAbsolutePath(path)) {
|
|
981
|
+
return path;
|
|
971
982
|
}
|
|
972
983
|
let result;
|
|
973
984
|
if (!this.#context.config.skipCache) {
|
|
974
|
-
result = this.resolverCache.get(this.#normalizeId(
|
|
985
|
+
result = this.resolverCache.get(this.#normalizeId(path));
|
|
975
986
|
if (result) {
|
|
976
987
|
return result;
|
|
977
988
|
}
|
|
978
989
|
}
|
|
979
|
-
result = this.paths[this.#normalizeId(
|
|
990
|
+
result = this.paths[this.#normalizeId(path)];
|
|
980
991
|
if (!result) {
|
|
981
992
|
const paths = options.paths ?? [];
|
|
982
993
|
if (importer && !paths.includes(importer)) {
|
|
@@ -985,8 +996,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
985
996
|
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
986
997
|
paths.push(append.appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
987
998
|
paths.push(append.appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
988
|
-
paths.push(...Object.keys(this.#context.tsconfig
|
|
989
|
-
for (const combination of resolve.getResolutionCombinations(
|
|
999
|
+
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)));
|
|
1000
|
+
for (const combination of resolve.getResolutionCombinations(path, {
|
|
990
1001
|
paths
|
|
991
1002
|
})) {
|
|
992
1003
|
const { relativeKey, adapter } = this.#getStorage(combination);
|
|
@@ -995,18 +1006,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
995
1006
|
break;
|
|
996
1007
|
}
|
|
997
1008
|
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1009
|
+
if (!result) {
|
|
1010
|
+
try {
|
|
1011
|
+
result = resolve.resolveSync(path, {
|
|
1012
|
+
...options,
|
|
1013
|
+
paths
|
|
1014
|
+
});
|
|
1015
|
+
} catch {
|
|
1016
|
+
}
|
|
1003
1017
|
}
|
|
1004
1018
|
}
|
|
1005
|
-
if (result) {
|
|
1006
|
-
|
|
1007
|
-
if (!this.#context.config.skipCache) {
|
|
1008
|
-
this.resolverCache.set(this.#normalizeId(id), result);
|
|
1009
|
-
}
|
|
1019
|
+
if (result && !this.#context.config.skipCache) {
|
|
1020
|
+
this.resolverCache.set(this.#normalizeId(path), result);
|
|
1010
1021
|
}
|
|
1011
1022
|
return result;
|
|
1012
1023
|
}
|
|
@@ -15,12 +15,15 @@ import { RolldownOptions, RolldownOutput } from 'rolldown';
|
|
|
15
15
|
import { RollupOptions, OutputOptions } from 'rollup';
|
|
16
16
|
import { Configuration } from 'webpack';
|
|
17
17
|
import { EnvPaths } from '@stryke/env/get-env-paths';
|
|
18
|
+
import { FetchRequestOptions } from '@stryke/http/fetch';
|
|
18
19
|
import { PackageJson } from '@stryke/types/package-json';
|
|
19
20
|
import { Worker } from 'jest-worker';
|
|
20
21
|
import { Jiti } from 'jiti';
|
|
21
22
|
import MagicString, { SourceMap } from 'magic-string';
|
|
23
|
+
import { ParserOptions, ParseResult } from 'oxc-parser';
|
|
22
24
|
import { Range } from 'semver';
|
|
23
25
|
import { Project } from 'ts-morph';
|
|
26
|
+
import { RequestInfo, Response } from 'undici';
|
|
24
27
|
import { TransformResult as TransformResult$1, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginMessage, UnpluginBuildContext } from 'unplugin';
|
|
25
28
|
import { V as VirtualFileSystemInterface, R as ResolveOptions, a as VirtualFile, b as StoragePort, c as StoragePreset } from './fs-Dg-aTfiN.cjs';
|
|
26
29
|
import { ArrayValues } from '@stryke/types/array';
|
|
@@ -218,7 +221,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> &
|
|
|
218
221
|
/**
|
|
219
222
|
* The resolved options for the Powerlines project configuration.
|
|
220
223
|
*/
|
|
221
|
-
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework">> & {
|
|
224
|
+
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
|
|
222
225
|
/**
|
|
223
226
|
* The configuration options that were provided inline to the Powerlines CLI.
|
|
224
227
|
*/
|
|
@@ -608,6 +611,18 @@ interface InitContextOptions {
|
|
|
608
611
|
*/
|
|
609
612
|
isHighPriority: boolean;
|
|
610
613
|
}
|
|
614
|
+
interface FetchOptions extends FetchRequestOptions {
|
|
615
|
+
/**
|
|
616
|
+
* An indicator specifying that the request should bypass any caching
|
|
617
|
+
*/
|
|
618
|
+
skipCache?: boolean;
|
|
619
|
+
}
|
|
620
|
+
interface ParseOptions extends ParserOptions {
|
|
621
|
+
/**
|
|
622
|
+
* When true this allows return statements to be outside functions to e.g. support parsing CommonJS code.
|
|
623
|
+
*/
|
|
624
|
+
allowReturnOutsideFunction?: boolean;
|
|
625
|
+
}
|
|
611
626
|
/**
|
|
612
627
|
* The unresolved Powerlines context.
|
|
613
628
|
*
|
|
@@ -624,6 +639,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
624
639
|
*/
|
|
625
640
|
config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
|
|
626
641
|
projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
|
|
642
|
+
sourceRoot: NonUndefined<TResolvedConfig["userConfig"]["sourceRoot"]>;
|
|
627
643
|
output: TResolvedConfig["output"];
|
|
628
644
|
};
|
|
629
645
|
/**
|
|
@@ -743,6 +759,44 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
743
759
|
* This instance is created lazily on first access.
|
|
744
760
|
*/
|
|
745
761
|
program: Project;
|
|
762
|
+
/**
|
|
763
|
+
* A function to perform HTTP fetch requests
|
|
764
|
+
*
|
|
765
|
+
* @remarks
|
|
766
|
+
* This function uses a caching layer to avoid duplicate requests during the Powerlines process.
|
|
767
|
+
*
|
|
768
|
+
* @example
|
|
769
|
+
* ```ts
|
|
770
|
+
* const response = await context.fetch("https://api.example.com/data");
|
|
771
|
+
* const data = await response.json();
|
|
772
|
+
* ```
|
|
773
|
+
*
|
|
774
|
+
* @see https://github.com/nodejs/undici
|
|
775
|
+
*
|
|
776
|
+
* @param input - The URL to fetch.
|
|
777
|
+
* @param options - The fetch request options.
|
|
778
|
+
* @returns A promise that resolves to a response returned by the fetch.
|
|
779
|
+
*/
|
|
780
|
+
fetch: (input: RequestInfo, options?: FetchOptions) => Promise<Response>;
|
|
781
|
+
/**
|
|
782
|
+
* Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
|
|
783
|
+
*
|
|
784
|
+
* @remarks
|
|
785
|
+
* This function can be used to parse TypeScript code into an AST for further analysis or transformation.
|
|
786
|
+
*
|
|
787
|
+
* @example
|
|
788
|
+
* ```ts
|
|
789
|
+
* const ast = context.parse("const x: number = 42;");
|
|
790
|
+
* ```
|
|
791
|
+
*
|
|
792
|
+
* @see https://rollupjs.org/plugin-development/#this-parse
|
|
793
|
+
* @see https://github.com/oxc/oxc
|
|
794
|
+
*
|
|
795
|
+
* @param code - The source code to parse.
|
|
796
|
+
* @param options - The options to pass to the parser.
|
|
797
|
+
* @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
|
|
798
|
+
*/
|
|
799
|
+
parse: (code: string, options?: ParseOptions) => Promise<ParseResult>;
|
|
746
800
|
/**
|
|
747
801
|
* A helper function to resolve modules using the Jiti resolver
|
|
748
802
|
*
|
|
@@ -938,7 +992,7 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
938
992
|
*/
|
|
939
993
|
logger: LogFn;
|
|
940
994
|
}
|
|
941
|
-
type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> =
|
|
995
|
+
type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
|
|
942
996
|
|
|
943
997
|
type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
|
|
944
998
|
/**
|
|
@@ -965,6 +1019,22 @@ type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions
|
|
|
965
1019
|
*/
|
|
966
1020
|
type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | Promise<Plugin<TContext>> | PluginConfigTuple<TContext> | PluginConfigObject<TContext>;
|
|
967
1021
|
type ProjectType = "application" | "library";
|
|
1022
|
+
interface DeployConfig {
|
|
1023
|
+
/**
|
|
1024
|
+
* The deployment variant being used by the Powerlines engine.
|
|
1025
|
+
*
|
|
1026
|
+
* @example
|
|
1027
|
+
* ```ts
|
|
1028
|
+
* export default defineConfig({
|
|
1029
|
+
* deploy: {
|
|
1030
|
+
* variant: "cloudflare"
|
|
1031
|
+
* }
|
|
1032
|
+
* });
|
|
1033
|
+
*
|
|
1034
|
+
* ```
|
|
1035
|
+
*/
|
|
1036
|
+
variant?: string;
|
|
1037
|
+
}
|
|
968
1038
|
interface OutputConfig {
|
|
969
1039
|
/**
|
|
970
1040
|
* The path to output the final compiled files to
|
|
@@ -1087,7 +1157,7 @@ interface BaseConfig {
|
|
|
1087
1157
|
* @remarks
|
|
1088
1158
|
* If set to `false`, the deployment will be disabled.
|
|
1089
1159
|
*/
|
|
1090
|
-
deploy?:
|
|
1160
|
+
deploy?: DeployConfig | false;
|
|
1091
1161
|
/**
|
|
1092
1162
|
* The path to the tsconfig file to be used by the compiler
|
|
1093
1163
|
*
|
|
@@ -1214,7 +1284,7 @@ interface CommonUserConfig extends BaseConfig {
|
|
|
1214
1284
|
*/
|
|
1215
1285
|
framework?: string;
|
|
1216
1286
|
}
|
|
1217
|
-
|
|
1287
|
+
interface UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> extends Omit<CommonUserConfig, "build"> {
|
|
1218
1288
|
/**
|
|
1219
1289
|
* Configuration provided to build processes
|
|
1220
1290
|
*
|
|
@@ -1234,7 +1304,7 @@ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedCo
|
|
|
1234
1304
|
*/
|
|
1235
1305
|
override?: Partial<TBuildResolvedConfig>;
|
|
1236
1306
|
};
|
|
1237
|
-
}
|
|
1307
|
+
}
|
|
1238
1308
|
type WebpackUserConfig = UserConfig<WebpackBuildConfig, WebpackResolvedBuildConfig, "webpack">;
|
|
1239
1309
|
type RspackUserConfig = UserConfig<RspackBuildConfig, RspackResolvedBuildConfig, "rspack">;
|
|
1240
1310
|
type RollupUserConfig = UserConfig<RollupBuildConfig, RollupResolvedBuildConfig, "rollup">;
|
|
@@ -1314,4 +1384,4 @@ type DeployInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineCon
|
|
|
1314
1384
|
command: "deploy";
|
|
1315
1385
|
};
|
|
1316
1386
|
|
|
1317
|
-
export type { APIContext as A, BuildPlugin as B, Context as C,
|
|
1387
|
+
export type { APIContext as A, BuildPlugin as B, Context as C, CleanInlineConfig as D, ESBuildResolvedBuildConfig as E, FetchOptions as F, BuildInlineConfig as G, HooksList as H, InitialUserConfig as I, LintInlineConfig as J, DocsInlineConfig as K, LogFn as L, MetaInfo as M, NewInlineConfig as N, DeployInlineConfig as O, PowerlinesCommand as P, ResolvedEntryTypeDefinition as R, SelectHooksOptions as S, TsupBuildConfig as T, UnbuildBuildConfig as U, ViteResolvedBuildConfig as V, WorkspaceConfig as W, ParsedUserConfig as a, RolldownResolvedBuildConfig as b, RollupResolvedBuildConfig as c, TsupResolvedBuildConfig as d, UnbuildResolvedBuildConfig as e, ResolvedConfig as f, EnvironmentContext as g, Plugin as h, PluginContext as i, EnvironmentResolvedConfig as j, InitContextOptions as k, EnvironmentContextPlugin as l, HookKeys as m, InferHookHandler as n, Resolver as o, ParseOptions as p, TransformResult as q, InferHookParameters as r, InferHookReturnType as s, UnpluginBuildVariant as t, InferResolvedConfig as u, InferUnpluginVariant as v, InferUserConfig as w, SourceFile as x, WorkerProcess as y, PrepareInlineConfig as z };
|