powerlines 0.19.5 → 0.21.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.cjs +4 -4
- package/dist/api.d.cts +7 -8
- package/dist/api.d.ts +7 -8
- package/dist/api.js +3 -3
- package/dist/astro.cjs +10 -10
- package/dist/astro.d.cts +1 -2
- package/dist/astro.d.ts +1 -2
- package/dist/astro.js +7 -7
- package/dist/{chunk-MLAYLHZO.js → chunk-237NITCY.js} +20 -5
- package/dist/{chunk-5PRY6OJM.cjs → chunk-2HNC5JVK.cjs} +2 -2
- package/dist/{chunk-AEJIVPUZ.js → chunk-2Q2PSPZK.js} +1 -1
- package/dist/{chunk-JPWBN72J.js → chunk-3FS7K4DZ.js} +1 -1
- package/dist/{chunk-BSGWY4AP.cjs → chunk-3JH36WUJ.cjs} +2 -2
- package/dist/{chunk-ZOUGUAQY.cjs → chunk-44UTUCBG.cjs} +34 -16
- package/dist/{chunk-KMELWYHW.cjs → chunk-6XRDZOE3.cjs} +967 -664
- package/dist/{chunk-YQZXG4X6.cjs → chunk-7C2NEC7D.cjs} +2 -2
- package/dist/{chunk-GQM2JCO3.js → chunk-A5GTERYN.js} +2 -2
- package/dist/chunk-B4KLWFY6.cjs +32 -0
- package/dist/{chunk-I4LLZ5BI.js → chunk-C5TKY75S.js} +1 -1
- package/dist/{chunk-TK6CN2KT.cjs → chunk-DMXXNXLS.cjs} +4 -4
- package/dist/{chunk-MCDMY6GK.cjs → chunk-F4BD5CXH.cjs} +2 -2
- package/dist/chunk-GRAVJX3I.js +29 -0
- package/dist/chunk-HV7SHEHD.cjs +118 -0
- package/dist/{chunk-WJ4CZKXY.js → chunk-JKBJF3UI.js} +1 -1
- package/dist/{chunk-BHPTTRBA.js → chunk-L4AXJFX2.js} +32 -14
- package/dist/{chunk-Z63SQZUB.cjs → chunk-LKYBC6DX.cjs} +4 -4
- package/dist/{chunk-RR7EC4RF.js → chunk-M6XGEVJY.js} +1 -1
- package/dist/{chunk-PAJB5K7A.js → chunk-NZXMP4J5.js} +3 -2
- package/dist/{chunk-GFINPIIK.js → chunk-OZU47JET.js} +1000 -704
- package/dist/{chunk-FCTNMPJF.cjs → chunk-PAMSESZV.cjs} +1 -1
- package/dist/chunk-PDFOF6ZP.js +112 -0
- package/dist/{chunk-7HKTQSUG.cjs → chunk-PJP4MECA.cjs} +4 -3
- package/dist/{chunk-OJSRHKHW.js → chunk-QQGXARP3.js} +1 -1
- package/dist/{chunk-ULFJBFI7.cjs → chunk-SQANNMRF.cjs} +22 -7
- package/dist/{chunk-HI3LNK6Q.js → chunk-SVDPKN3U.js} +1 -1
- package/dist/chunk-SVF4ATJR.cjs +8 -0
- package/dist/{chunk-A3FMGMBV.cjs → chunk-UVM4JAR3.cjs} +2 -2
- package/dist/{chunk-VICSRRKQ.js → chunk-WU7I52LM.js} +2 -2
- package/dist/{chunk-X5LPEBDE.cjs → chunk-WYJGOC3Y.cjs} +2 -2
- package/dist/{chunk-LIXKMZW5.cjs → chunk-YG5ORYN2.cjs} +2 -2
- package/dist/{chunk-HEG6IAVR.js → chunk-ZPOCM5XZ.js} +1 -1
- package/dist/chunk-ZWF7LZXE.js +5 -0
- package/dist/config.d.cts +1 -2
- package/dist/config.d.ts +1 -2
- package/dist/esbuild.cjs +9 -9
- package/dist/esbuild.d.cts +1 -2
- package/dist/esbuild.d.ts +1 -2
- package/dist/esbuild.js +6 -6
- package/dist/farm.cjs +5 -5
- package/dist/farm.d.cts +1 -2
- package/dist/farm.d.ts +1 -2
- package/dist/farm.js +4 -4
- package/dist/{hooks-C6t50M6a.d.cts → hooks-CJ1W5lrx.d.cts} +1 -1
- package/dist/{hooks-Bq2jUAKs.d.ts → hooks-CNEZpkMS.d.ts} +1 -1
- package/dist/index.cjs +45 -287
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +20 -244
- package/dist/lib/build/esbuild.cjs +5 -5
- package/dist/lib/build/esbuild.d.cts +3 -5
- package/dist/lib/build/esbuild.d.ts +3 -5
- package/dist/lib/build/esbuild.js +2 -2
- package/dist/lib/build/index.cjs +25 -25
- package/dist/lib/build/index.d.cts +3 -5
- package/dist/lib/build/index.d.ts +3 -5
- package/dist/lib/build/index.js +9 -9
- package/dist/lib/build/rolldown.cjs +3 -3
- package/dist/lib/build/rolldown.d.cts +1 -3
- package/dist/lib/build/rolldown.d.ts +1 -3
- package/dist/lib/build/rolldown.js +2 -2
- package/dist/lib/build/rollup.cjs +3 -3
- package/dist/lib/build/rollup.d.cts +1 -3
- package/dist/lib/build/rollup.d.ts +1 -3
- package/dist/lib/build/rollup.js +1 -1
- package/dist/lib/build/rspack.cjs +2 -2
- package/dist/lib/build/rspack.d.cts +1 -3
- package/dist/lib/build/rspack.d.ts +1 -3
- package/dist/lib/build/rspack.js +1 -1
- package/dist/lib/build/tsup.cjs +6 -6
- package/dist/lib/build/tsup.d.cts +1 -3
- package/dist/lib/build/tsup.d.ts +1 -3
- package/dist/lib/build/tsup.js +3 -3
- package/dist/lib/build/unbuild.cjs +5 -5
- package/dist/lib/build/unbuild.d.cts +2 -4
- package/dist/lib/build/unbuild.d.ts +2 -4
- package/dist/lib/build/unbuild.js +2 -2
- package/dist/lib/build/vite.cjs +5 -5
- package/dist/lib/build/vite.d.cts +1 -3
- package/dist/lib/build/vite.d.ts +1 -3
- package/dist/lib/build/vite.js +3 -3
- package/dist/lib/build/webpack.cjs +2 -2
- package/dist/lib/build/webpack.d.cts +1 -3
- package/dist/lib/build/webpack.d.ts +1 -3
- package/dist/lib/build/webpack.js +1 -1
- package/dist/lib/chunk-27VJFYDM.cjs +132 -0
- package/dist/lib/chunk-3G4C3YAU.js +124 -0
- package/dist/lib/{chunk-DX4TFRS3.js → chunk-43VJVIL2.js} +976 -681
- package/dist/lib/{chunk-5EXW3ZRC.cjs → chunk-4FX4VOLA.cjs} +25 -4
- package/dist/lib/{chunk-ADKYAHF5.js → chunk-5GM5UAUO.js} +32 -12
- package/dist/lib/{chunk-JB2JJXGW.js → chunk-5SADLYYK.js} +1 -1
- package/dist/lib/{chunk-KXCEN6Y4.js → chunk-5SP6QZLX.js} +1 -1
- package/dist/lib/{chunk-TNHDC2ZQ.cjs → chunk-7XHBIYIN.cjs} +1 -20
- package/dist/lib/{chunk-SM3S7DYW.js → chunk-BHDQZ6YX.js} +12 -2
- package/dist/lib/{chunk-F7IDAYLH.cjs → chunk-CSJ6KNIX.cjs} +12 -9
- package/dist/lib/{chunk-37W2ZDLA.cjs → chunk-E2MVGKGH.cjs} +2 -2
- package/dist/lib/{chunk-ET5QBFGZ.cjs → chunk-FN7673NC.cjs} +2 -2
- package/dist/lib/{chunk-67IBLMW6.cjs → chunk-GDXHCTCX.cjs} +14 -7
- package/dist/lib/{chunk-ESNHFT4V.cjs → chunk-HCOHRD3Q.cjs} +26 -13
- package/dist/lib/{chunk-SYHVP3OW.js → chunk-HOZ37BFN.js} +23 -4
- package/dist/lib/{chunk-7OHD3BD4.js → chunk-HQ5YA43H.js} +12 -9
- package/dist/lib/{chunk-47WZIAPZ.js → chunk-IOM7GRZU.js} +5 -8
- package/dist/lib/{chunk-WFUO3YPK.js → chunk-L4NEN725.js} +19 -4
- package/dist/lib/{chunk-MVSXEH4P.cjs → chunk-LAFEAMNN.cjs} +6 -9
- package/dist/lib/{chunk-7Y5MJRWF.js → chunk-LIN4KAV3.js} +57 -34
- package/dist/lib/{chunk-LJ4WO7TW.cjs → chunk-LMO7PRBP.cjs} +35 -13
- package/dist/lib/{chunk-4AMFNBTX.cjs → chunk-LPA7UJIR.cjs} +956 -659
- package/dist/lib/{chunk-OTBLE55Z.cjs → chunk-MPCVQK2D.cjs} +12 -1
- package/dist/lib/{chunk-5ASXKB2V.js → chunk-QAXCBFBP.js} +1 -1
- package/dist/lib/{chunk-N2EGPL2L.js → chunk-T7RMV2FW.js} +25 -12
- package/dist/lib/{chunk-7K7JH3DF.cjs → chunk-ULJVBW4L.cjs} +19 -4
- package/dist/lib/{chunk-UDJ37BEE.cjs → chunk-VGSV2BEL.cjs} +57 -34
- package/dist/lib/{chunk-AOKLB4V2.cjs → chunk-Y2BHXV33.cjs} +1 -1
- package/dist/lib/{chunk-GRJJZ5VJ.js → chunk-YH5GOJS3.js} +2 -15
- package/dist/lib/{chunk-Q3ERHHXJ.js → chunk-YV6MDKW4.js} +13 -6
- package/dist/lib/{config-LK_Wl1SU.d.cts → config-7vXtXiGg.d.cts} +204 -118
- package/dist/lib/{config-CnPcoKqT.d.ts → config-B9aVEiiX.d.ts} +204 -118
- package/dist/lib/config-file.d.cts +1 -3
- package/dist/lib/config-file.d.ts +1 -3
- package/dist/lib/create-program.d.cts +1 -3
- package/dist/lib/create-program.d.ts +1 -3
- package/dist/lib/entry.cjs +9 -9
- package/dist/lib/entry.d.cts +1 -3
- package/dist/lib/entry.d.ts +1 -3
- package/dist/lib/entry.js +1 -1
- package/dist/lib/{hooks-DX1o8l6J.d.ts → hooks-BxUBzqCb.d.ts} +1 -1
- package/dist/lib/{hooks-BD2rDhpA.d.cts → hooks-cvv50JDh.d.cts} +1 -1
- package/dist/lib/index.cjs +32 -28
- package/dist/lib/index.d.cts +326 -7
- package/dist/lib/index.d.ts +326 -7
- package/dist/lib/index.js +8 -8
- package/dist/lib/logger.d.cts +1 -3
- package/dist/lib/logger.d.ts +1 -3
- package/dist/lib/typescript/compiler-host.d.cts +1 -3
- package/dist/lib/typescript/compiler-host.d.ts +1 -3
- package/dist/lib/typescript/import-transformer.d.cts +1 -3
- package/dist/lib/typescript/import-transformer.d.ts +1 -3
- package/dist/lib/typescript/index.d.cts +1 -3
- package/dist/lib/typescript/index.d.ts +1 -3
- package/dist/lib/typescript/program.d.cts +1 -3
- package/dist/lib/typescript/program.d.ts +1 -3
- package/dist/lib/unplugin/factory.cjs +5 -5
- package/dist/lib/unplugin/factory.d.cts +7 -9
- package/dist/lib/unplugin/factory.d.ts +7 -9
- package/dist/lib/unplugin/factory.js +4 -4
- package/dist/lib/unplugin/index.cjs +8 -8
- package/dist/lib/unplugin/index.d.cts +2 -4
- package/dist/lib/unplugin/index.d.ts +2 -4
- package/dist/lib/unplugin/index.js +5 -5
- package/dist/lib/unplugin/plugin.cjs +3 -3
- package/dist/lib/unplugin/plugin.d.cts +1 -3
- package/dist/lib/unplugin/plugin.d.ts +1 -3
- package/dist/lib/unplugin/plugin.js +2 -2
- package/dist/lib/unplugin/resolve-id.cjs +2 -2
- package/dist/lib/unplugin/resolve-id.d.cts +1 -3
- package/dist/lib/unplugin/resolve-id.d.ts +1 -3
- package/dist/lib/unplugin/resolve-id.js +1 -1
- package/dist/lib/utilities/bundle.cjs +4 -4
- package/dist/lib/utilities/bundle.d.cts +1 -3
- package/dist/lib/utilities/bundle.d.ts +1 -3
- package/dist/lib/utilities/bundle.js +3 -3
- package/dist/lib/utilities/cache.d.cts +1 -3
- package/dist/lib/utilities/cache.d.ts +1 -3
- package/dist/lib/utilities/file-header.d.cts +1 -3
- package/dist/lib/utilities/file-header.d.ts +1 -3
- package/dist/lib/utilities/index.cjs +14 -14
- package/dist/lib/utilities/index.d.cts +1 -3
- package/dist/lib/utilities/index.d.ts +1 -3
- package/dist/lib/utilities/index.js +5 -5
- package/dist/lib/utilities/meta.cjs +8 -8
- package/dist/lib/utilities/meta.d.cts +1 -3
- package/dist/lib/utilities/meta.d.ts +1 -3
- package/dist/lib/utilities/meta.js +1 -1
- package/dist/lib/utilities/resolve-path.d.cts +1 -3
- package/dist/lib/utilities/resolve-path.d.ts +1 -3
- package/dist/lib/utilities/resolve.cjs +5 -5
- package/dist/lib/utilities/resolve.d.cts +1 -3
- package/dist/lib/utilities/resolve.d.ts +1 -3
- package/dist/lib/utilities/resolve.js +4 -4
- package/dist/lib/utilities/source-file.d.cts +1 -3
- package/dist/lib/utilities/source-file.d.ts +1 -3
- package/dist/lib/utilities/source-map.d.cts +1 -3
- package/dist/lib/utilities/source-map.d.ts +1 -3
- package/dist/lib/utilities/worker.d.cts +1 -3
- package/dist/lib/utilities/worker.d.ts +1 -3
- package/dist/lib/utilities/write-file.d.cts +1 -3
- package/dist/lib/utilities/write-file.d.ts +1 -3
- package/dist/next.cjs +9 -9
- package/dist/next.js +6 -6
- package/dist/nuxt.cjs +11 -11
- package/dist/nuxt.js +8 -8
- package/dist/plugin-utils/{chunk-YKIS7BLU.cjs → chunk-5MO4BCOW.cjs} +24 -0
- package/dist/plugin-utils/{chunk-HHFA3IEZ.js → chunk-CYVV2MB7.js} +24 -0
- package/dist/plugin-utils/{chunk-75UVEMIV.cjs → chunk-DZZPNO5H.cjs} +2 -2
- package/dist/plugin-utils/{chunk-WEIEQXIJ.cjs → chunk-ECFS7DPV.cjs} +5 -5
- package/dist/plugin-utils/{chunk-MQOW6ENT.cjs → chunk-F65J5WOX.cjs} +1 -1
- package/dist/plugin-utils/{chunk-IHME6YWJ.js → chunk-GV7O3E7P.js} +1 -1
- package/dist/plugin-utils/chunk-J33TXWF6.js +12 -0
- package/dist/plugin-utils/{chunk-PK6PYFWY.js → chunk-L277XSSN.js} +1 -1
- package/dist/plugin-utils/{chunk-YDYJAGMP.js → chunk-QKMG6ZAU.js} +1 -1
- package/dist/plugin-utils/chunk-QP6OJWFG.cjs +14 -0
- package/dist/plugin-utils/{chunk-5TL6KEQ5.cjs → chunk-UNAGYQRB.cjs} +4 -4
- package/dist/plugin-utils/{chunk-432MQOUZ.js → chunk-XIXI67PY.js} +1 -1
- package/dist/plugin-utils/{config-48EWGWXq.d.cts → config-BzVVjChJ.d.cts} +201 -115
- package/dist/plugin-utils/{config-48EWGWXq.d.ts → config-BzVVjChJ.d.ts} +201 -115
- package/dist/plugin-utils/enforce.cjs +5 -5
- package/dist/plugin-utils/enforce.d.cts +1 -3
- package/dist/plugin-utils/enforce.d.ts +1 -3
- package/dist/plugin-utils/enforce.js +4 -4
- package/dist/plugin-utils/extend.cjs +4 -4
- package/dist/plugin-utils/extend.d.cts +1 -3
- package/dist/plugin-utils/extend.d.ts +1 -3
- package/dist/plugin-utils/extend.js +3 -3
- package/dist/plugin-utils/get-config-path.cjs +2 -2
- 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/get-config-path.js +1 -1
- package/dist/plugin-utils/helpers.cjs +14 -14
- package/dist/plugin-utils/helpers.d.cts +3 -5
- package/dist/plugin-utils/helpers.d.ts +3 -5
- package/dist/plugin-utils/helpers.js +1 -1
- package/dist/plugin-utils/index.cjs +24 -24
- package/dist/plugin-utils/index.d.cts +1 -3
- package/dist/plugin-utils/index.d.ts +1 -3
- package/dist/plugin-utils/index.js +6 -6
- package/dist/plugin-utils/merge.cjs +3 -3
- package/dist/plugin-utils/merge.d.cts +1 -3
- package/dist/plugin-utils/merge.d.ts +1 -3
- package/dist/plugin-utils/merge.js +2 -2
- package/dist/plugin-utils/paths.cjs +2 -2
- package/dist/plugin-utils/paths.d.cts +4 -5
- package/dist/plugin-utils/paths.d.ts +4 -5
- package/dist/plugin-utils/paths.js +1 -1
- package/dist/{resolved-B41SbjnS.d.cts → resolved-D8vIizyA.d.cts} +81 -66
- package/dist/{resolved-J7a2Aeuk.d.ts → resolved-DWxXKJYy.d.ts} +81 -66
- package/dist/rolldown.cjs +8 -8
- package/dist/rolldown.d.cts +1 -2
- package/dist/rolldown.d.ts +1 -2
- package/dist/rolldown.js +5 -5
- package/dist/rollup.cjs +8 -8
- package/dist/rollup.d.cts +1 -2
- package/dist/rollup.d.ts +1 -2
- package/dist/rollup.js +5 -5
- package/dist/rspack.cjs +8 -8
- package/dist/rspack.d.cts +1 -2
- package/dist/rspack.d.ts +1 -2
- package/dist/rspack.js +5 -5
- package/dist/tsup.cjs +10 -10
- package/dist/tsup.js +7 -7
- package/dist/types/babel.d.cts +1 -2
- package/dist/types/babel.d.ts +1 -2
- package/dist/types/build.d.cts +94 -7
- package/dist/types/build.d.ts +94 -7
- package/dist/types/commands.cjs +2 -2
- package/dist/types/commands.d.cts +1 -2
- package/dist/types/commands.d.ts +1 -2
- package/dist/types/commands.js +1 -1
- package/dist/types/config.d.cts +1 -2
- package/dist/types/config.d.ts +1 -2
- package/dist/types/context.d.cts +2 -3
- package/dist/types/context.d.ts +2 -3
- package/dist/types/hooks.d.cts +1 -2
- package/dist/types/hooks.d.ts +1 -2
- package/dist/types/index.cjs +6 -22
- package/dist/types/index.d.cts +2 -3
- package/dist/types/index.d.ts +2 -3
- package/dist/types/index.js +2 -2
- package/dist/types/internal.d.cts +2 -3
- package/dist/types/internal.d.ts +2 -3
- package/dist/types/plugin.d.cts +1 -2
- package/dist/types/plugin.d.ts +1 -2
- package/dist/types/resolved.d.cts +1 -2
- package/dist/types/resolved.d.ts +1 -2
- package/dist/types/unplugin.d.cts +1 -2
- package/dist/types/unplugin.d.ts +1 -2
- package/dist/types/vfs.cjs +4 -20
- package/dist/types/vfs.d.cts +47 -54
- package/dist/types/vfs.d.ts +47 -54
- package/dist/types/vfs.js +1 -1
- package/dist/unloader.cjs +8 -8
- package/dist/unloader.d.cts +3 -4
- package/dist/unloader.d.ts +3 -4
- package/dist/unloader.js +5 -5
- package/dist/unplugin.cjs +20 -20
- package/dist/unplugin.d.cts +4 -5
- package/dist/unplugin.d.ts +4 -5
- package/dist/unplugin.js +17 -17
- package/dist/vite.cjs +9 -9
- package/dist/vite.d.cts +1 -2
- package/dist/vite.d.ts +1 -2
- package/dist/vite.js +6 -6
- package/dist/webpack.cjs +8 -8
- package/dist/webpack.d.cts +1 -2
- package/dist/webpack.d.ts +1 -2
- package/dist/webpack.js +5 -5
- package/package.json +8 -6
- package/dist/chunk-CWCEYGLM.js +0 -43
- package/dist/chunk-F5NKLRZD.cjs +0 -49
- package/dist/chunk-OBYFBPPO.js +0 -9
- package/dist/chunk-RDMLGFIT.js +0 -29
- package/dist/chunk-RF6RSWD4.cjs +0 -16
- package/dist/chunk-XDLLDHRY.cjs +0 -32
- package/dist/lib/chunk-POOHWK7C.cjs +0 -63
- package/dist/lib/chunk-VLHOYZG2.js +0 -55
- package/dist/plugin-utils/chunk-2HFS2OOG.cjs +0 -14
- package/dist/plugin-utils/chunk-CVZA2RT3.js +0 -12
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkETKZMGLN_cjs = require('./chunk-ETKZMGLN.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkSVF4ATJR_cjs = require('./chunk-SVF4ATJR.cjs');
|
|
5
|
+
var chunkPAMSESZV_cjs = require('./chunk-PAMSESZV.cjs');
|
|
6
6
|
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
7
7
|
var core = require('@babel/core');
|
|
8
8
|
var console = require('@storm-software/config-tools/logger/console');
|
|
@@ -25,7 +25,7 @@ var isSet = require('@stryke/type-checks/is-set');
|
|
|
25
25
|
var isSetObject = require('@stryke/type-checks/is-set-object');
|
|
26
26
|
var isSetString = require('@stryke/type-checks/is-set-string');
|
|
27
27
|
var chalk5 = require('chalk');
|
|
28
|
-
var
|
|
28
|
+
var defu3 = require('defu');
|
|
29
29
|
var Handlebars = require('handlebars');
|
|
30
30
|
var helperPluginUtils = require('@babel/helper-plugin-utils');
|
|
31
31
|
var t = require('@babel/types');
|
|
@@ -49,23 +49,25 @@ var uuid = require('@stryke/unique-id/uuid');
|
|
|
49
49
|
var oxcParser = require('oxc-parser');
|
|
50
50
|
var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
|
|
51
51
|
var isFile = require('@stryke/fs/is-file');
|
|
52
|
+
var $ = require('@stryke/capnp');
|
|
53
|
+
var bufferToString = require('@stryke/convert/buffer-to-string');
|
|
54
|
+
var buffer = require('@stryke/fs/buffer');
|
|
55
|
+
var prettyBytes = require('@stryke/string-format/pretty-bytes');
|
|
56
|
+
var isBuffer = require('@stryke/type-checks/is-buffer');
|
|
57
|
+
var buffer$1 = require('buffer');
|
|
58
|
+
var fs = require('fs');
|
|
59
|
+
var prettier = require('prettier');
|
|
52
60
|
var logger = require('@storm-software/config-tools/logger');
|
|
53
61
|
var colors = require('@storm-software/config-tools/utilities/colors');
|
|
54
62
|
var noop = require('@stryke/helpers/noop');
|
|
63
|
+
var isUndefined = require('@stryke/type-checks/is-undefined');
|
|
64
|
+
var isParentPath = require('@stryke/path/is-parent-path');
|
|
65
|
+
var volume = require('memfs/lib/node/volume');
|
|
66
|
+
var unionfs = require('unionfs');
|
|
55
67
|
require('@stryke/fs/remove-file');
|
|
56
68
|
var hashFiles = require('@stryke/hash/hash-files');
|
|
57
69
|
var kebabCase = require('@stryke/string-format/kebab-case');
|
|
58
|
-
var isUndefined = require('@stryke/type-checks/is-undefined');
|
|
59
70
|
var jiti = require('jiti');
|
|
60
|
-
var bufferToString = require('@stryke/convert/buffer-to-string');
|
|
61
|
-
var isParentPath = require('@stryke/path/is-parent-path');
|
|
62
|
-
var prettyBytes = require('@stryke/string-format/pretty-bytes');
|
|
63
|
-
var isBuffer = require('@stryke/type-checks/is-buffer');
|
|
64
|
-
var memfs = require('memfs');
|
|
65
|
-
var buffer = require('buffer');
|
|
66
|
-
var fs = require('fs');
|
|
67
|
-
var prettier = require('prettier');
|
|
68
|
-
var unionfs = require('unionfs');
|
|
69
71
|
var isObject = require('@stryke/type-checks/is-object');
|
|
70
72
|
var ts2 = require('typescript');
|
|
71
73
|
var _package = require('@stryke/string-format/package');
|
|
@@ -94,9 +96,10 @@ function _interopNamespace(e) {
|
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
var chalk5__default = /*#__PURE__*/_interopDefault(chalk5);
|
|
97
|
-
var
|
|
99
|
+
var defu3__default = /*#__PURE__*/_interopDefault(defu3);
|
|
98
100
|
var Handlebars__default = /*#__PURE__*/_interopDefault(Handlebars);
|
|
99
101
|
var t__namespace = /*#__PURE__*/_interopNamespace(t);
|
|
102
|
+
var $__namespace = /*#__PURE__*/_interopNamespace($);
|
|
100
103
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
101
104
|
var ts2__default = /*#__PURE__*/_interopDefault(ts2);
|
|
102
105
|
|
|
@@ -202,7 +205,7 @@ var moduleResolverBabelPlugin = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((contex
|
|
|
202
205
|
}, "builder"));
|
|
203
206
|
}, "moduleResolverBabelPlugin");
|
|
204
207
|
async function loadWorkspaceConfig(workspaceRoot, cwd) {
|
|
205
|
-
return
|
|
208
|
+
return defu3__default.default({
|
|
206
209
|
workspaceRoot
|
|
207
210
|
}, await getConfig.getWorkspaceConfig(true, {
|
|
208
211
|
cwd,
|
|
@@ -244,7 +247,7 @@ async function loadUserConfigFile(projectRoot, jiti, command, mode, configFile,
|
|
|
244
247
|
dotenv: true,
|
|
245
248
|
jiti
|
|
246
249
|
});
|
|
247
|
-
return
|
|
250
|
+
return defu3__default.default(resolvedUserConfig, isSetObject.isSetObject(result?.config) ? {
|
|
248
251
|
...result.config,
|
|
249
252
|
...result
|
|
250
253
|
} : {});
|
|
@@ -252,7 +255,7 @@ async function loadUserConfigFile(projectRoot, jiti, command, mode, configFile,
|
|
|
252
255
|
chunkUSNT2KNT_cjs.__name(loadUserConfigFile, "loadUserConfigFile");
|
|
253
256
|
var DEFAULT_ENVIRONMENT = "default";
|
|
254
257
|
function createEnvironment(name, userConfig) {
|
|
255
|
-
return
|
|
258
|
+
return defu3__default.default(userConfig.environments?.[name] ?? {}, {
|
|
256
259
|
name,
|
|
257
260
|
title: userConfig.title || titleCase.titleCase(userConfig.name),
|
|
258
261
|
ssr: false,
|
|
@@ -295,6 +298,15 @@ function createDefaultEnvironment(userConfig) {
|
|
|
295
298
|
return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);
|
|
296
299
|
}
|
|
297
300
|
chunkUSNT2KNT_cjs.__name(createDefaultEnvironment, "createDefaultEnvironment");
|
|
301
|
+
function replacePathTokens(context, path) {
|
|
302
|
+
if (!path) {
|
|
303
|
+
return path;
|
|
304
|
+
}
|
|
305
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{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));
|
|
306
|
+
}
|
|
307
|
+
chunkUSNT2KNT_cjs.__name(replacePathTokens, "replacePathTokens");
|
|
308
|
+
|
|
309
|
+
// src/lib/entry.ts
|
|
298
310
|
function resolveEntryInputFile(context, typeDefinition) {
|
|
299
311
|
return replace.replacePath(typeDefinition.file, joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot));
|
|
300
312
|
}
|
|
@@ -320,7 +332,7 @@ function resolveEntry(context, typeDefinition) {
|
|
|
320
332
|
}
|
|
321
333
|
chunkUSNT2KNT_cjs.__name(resolveEntry, "resolveEntry");
|
|
322
334
|
function resolveEntriesSync(context, typeDefinitions) {
|
|
323
|
-
return typeDefinitions.map((typeDefinition) => {
|
|
335
|
+
return typeDefinitions.map((entry) => isString.isString(entry) ? replacePathTokens(context, entry) : replacePathTokens(context, entry.file)).map((typeDefinition) => {
|
|
324
336
|
const parsed = parseTypeDefinition.parseTypeDefinition(typeDefinition);
|
|
325
337
|
const filePath = append.appendPath(parsed.file, context.config.projectRoot);
|
|
326
338
|
if (isFile.isFile(filePath)) {
|
|
@@ -342,6 +354,228 @@ function getUniqueEntries(entries = []) {
|
|
|
342
354
|
}));
|
|
343
355
|
}
|
|
344
356
|
chunkUSNT2KNT_cjs.__name(getUniqueEntries, "getUniqueEntries");
|
|
357
|
+
var _capnpFileId = BigInt("0xa56c61324b9d6e49");
|
|
358
|
+
var FileMetadata_KeyValuePair = class extends $__namespace.Struct {
|
|
359
|
+
static {
|
|
360
|
+
chunkUSNT2KNT_cjs.__name(this, "FileMetadata_KeyValuePair");
|
|
361
|
+
}
|
|
362
|
+
static _capnp = {
|
|
363
|
+
displayName: "KeyValuePair",
|
|
364
|
+
id: "eabb26cf58b2a14c",
|
|
365
|
+
size: new $__namespace.ObjectSize(0, 2)
|
|
366
|
+
};
|
|
367
|
+
get key() {
|
|
368
|
+
return $__namespace.utils.getText(0, this);
|
|
369
|
+
}
|
|
370
|
+
set key(value) {
|
|
371
|
+
$__namespace.utils.setText(0, value, this);
|
|
372
|
+
}
|
|
373
|
+
get value() {
|
|
374
|
+
return $__namespace.utils.getText(1, this);
|
|
375
|
+
}
|
|
376
|
+
set value(value) {
|
|
377
|
+
$__namespace.utils.setText(1, value, this);
|
|
378
|
+
}
|
|
379
|
+
toString() {
|
|
380
|
+
return "FileMetadata_KeyValuePair_" + super.toString();
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
var FileMetadata = class _FileMetadata extends $__namespace.Struct {
|
|
384
|
+
static {
|
|
385
|
+
chunkUSNT2KNT_cjs.__name(this, "FileMetadata");
|
|
386
|
+
}
|
|
387
|
+
static KeyValuePair = FileMetadata_KeyValuePair;
|
|
388
|
+
static _capnp = {
|
|
389
|
+
displayName: "FileMetadata",
|
|
390
|
+
id: "8e2cab5d7e28c7b3",
|
|
391
|
+
size: new $__namespace.ObjectSize(0, 4),
|
|
392
|
+
defaultVariant: "normal"
|
|
393
|
+
};
|
|
394
|
+
static _Properties;
|
|
395
|
+
/**
|
|
396
|
+
* The variant of the file.
|
|
397
|
+
*
|
|
398
|
+
*/
|
|
399
|
+
get id() {
|
|
400
|
+
return $__namespace.utils.getText(0, this);
|
|
401
|
+
}
|
|
402
|
+
set id(value) {
|
|
403
|
+
$__namespace.utils.setText(0, value, this);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* The output mode of the file.
|
|
407
|
+
*
|
|
408
|
+
*/
|
|
409
|
+
get variant() {
|
|
410
|
+
return $__namespace.utils.getText(1, this, _FileMetadata._capnp.defaultVariant);
|
|
411
|
+
}
|
|
412
|
+
set variant(value) {
|
|
413
|
+
$__namespace.utils.setText(1, value, this);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Additional metadata associated with the file.
|
|
417
|
+
*
|
|
418
|
+
*/
|
|
419
|
+
get mode() {
|
|
420
|
+
return $__namespace.utils.getText(2, this);
|
|
421
|
+
}
|
|
422
|
+
set mode(value) {
|
|
423
|
+
$__namespace.utils.setText(2, value, this);
|
|
424
|
+
}
|
|
425
|
+
_adoptProperties(value) {
|
|
426
|
+
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(3, this));
|
|
427
|
+
}
|
|
428
|
+
_disownProperties() {
|
|
429
|
+
return $__namespace.utils.disown(this.properties);
|
|
430
|
+
}
|
|
431
|
+
get properties() {
|
|
432
|
+
return $__namespace.utils.getList(3, _FileMetadata._Properties, this);
|
|
433
|
+
}
|
|
434
|
+
_hasProperties() {
|
|
435
|
+
return !$__namespace.utils.isNull($__namespace.utils.getPointer(3, this));
|
|
436
|
+
}
|
|
437
|
+
_initProperties(length) {
|
|
438
|
+
return $__namespace.utils.initList(3, _FileMetadata._Properties, length, this);
|
|
439
|
+
}
|
|
440
|
+
set properties(value) {
|
|
441
|
+
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(3, this));
|
|
442
|
+
}
|
|
443
|
+
toString() {
|
|
444
|
+
return "FileMetadata_" + super.toString();
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
var FileIdentifier = class extends $__namespace.Struct {
|
|
448
|
+
static {
|
|
449
|
+
chunkUSNT2KNT_cjs.__name(this, "FileIdentifier");
|
|
450
|
+
}
|
|
451
|
+
static _capnp = {
|
|
452
|
+
displayName: "FileIdentifier",
|
|
453
|
+
id: "e12b8732389d7406",
|
|
454
|
+
size: new $__namespace.ObjectSize(0, 2)
|
|
455
|
+
};
|
|
456
|
+
/**
|
|
457
|
+
* An additional identifier for the file.
|
|
458
|
+
*
|
|
459
|
+
*/
|
|
460
|
+
get path() {
|
|
461
|
+
return $__namespace.utils.getText(0, this);
|
|
462
|
+
}
|
|
463
|
+
set path(value) {
|
|
464
|
+
$__namespace.utils.setText(0, value, this);
|
|
465
|
+
}
|
|
466
|
+
get id() {
|
|
467
|
+
return $__namespace.utils.getText(1, this);
|
|
468
|
+
}
|
|
469
|
+
set id(value) {
|
|
470
|
+
$__namespace.utils.setText(1, value, this);
|
|
471
|
+
}
|
|
472
|
+
toString() {
|
|
473
|
+
return "FileIdentifier_" + super.toString();
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
var FileData = class extends $__namespace.Struct {
|
|
477
|
+
static {
|
|
478
|
+
chunkUSNT2KNT_cjs.__name(this, "FileData");
|
|
479
|
+
}
|
|
480
|
+
static _capnp = {
|
|
481
|
+
displayName: "FileData",
|
|
482
|
+
id: "fa6725c8a360f9a2",
|
|
483
|
+
size: new $__namespace.ObjectSize(0, 2)
|
|
484
|
+
};
|
|
485
|
+
/**
|
|
486
|
+
* The contents of the file.
|
|
487
|
+
*
|
|
488
|
+
*/
|
|
489
|
+
get path() {
|
|
490
|
+
return $__namespace.utils.getText(0, this);
|
|
491
|
+
}
|
|
492
|
+
set path(value) {
|
|
493
|
+
$__namespace.utils.setText(0, value, this);
|
|
494
|
+
}
|
|
495
|
+
get content() {
|
|
496
|
+
return $__namespace.utils.getText(1, this);
|
|
497
|
+
}
|
|
498
|
+
set content(value) {
|
|
499
|
+
$__namespace.utils.setText(1, value, this);
|
|
500
|
+
}
|
|
501
|
+
toString() {
|
|
502
|
+
return "FileData_" + super.toString();
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
var FileSystemData = class _FileSystemData extends $__namespace.Struct {
|
|
506
|
+
static {
|
|
507
|
+
chunkUSNT2KNT_cjs.__name(this, "FileSystemData");
|
|
508
|
+
}
|
|
509
|
+
static _capnp = {
|
|
510
|
+
displayName: "FileSystemData",
|
|
511
|
+
id: "aaa72a672ac0732f",
|
|
512
|
+
size: new $__namespace.ObjectSize(0, 3)
|
|
513
|
+
};
|
|
514
|
+
static _Ids;
|
|
515
|
+
static _Metadata;
|
|
516
|
+
static _Files;
|
|
517
|
+
_adoptIds(value) {
|
|
518
|
+
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(0, this));
|
|
519
|
+
}
|
|
520
|
+
_disownIds() {
|
|
521
|
+
return $__namespace.utils.disown(this.ids);
|
|
522
|
+
}
|
|
523
|
+
get ids() {
|
|
524
|
+
return $__namespace.utils.getList(0, _FileSystemData._Ids, this);
|
|
525
|
+
}
|
|
526
|
+
_hasIds() {
|
|
527
|
+
return !$__namespace.utils.isNull($__namespace.utils.getPointer(0, this));
|
|
528
|
+
}
|
|
529
|
+
_initIds(length) {
|
|
530
|
+
return $__namespace.utils.initList(0, _FileSystemData._Ids, length, this);
|
|
531
|
+
}
|
|
532
|
+
set ids(value) {
|
|
533
|
+
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(0, this));
|
|
534
|
+
}
|
|
535
|
+
_adoptMetadata(value) {
|
|
536
|
+
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(1, this));
|
|
537
|
+
}
|
|
538
|
+
_disownMetadata() {
|
|
539
|
+
return $__namespace.utils.disown(this.metadata);
|
|
540
|
+
}
|
|
541
|
+
get metadata() {
|
|
542
|
+
return $__namespace.utils.getList(1, _FileSystemData._Metadata, this);
|
|
543
|
+
}
|
|
544
|
+
_hasMetadata() {
|
|
545
|
+
return !$__namespace.utils.isNull($__namespace.utils.getPointer(1, this));
|
|
546
|
+
}
|
|
547
|
+
_initMetadata(length) {
|
|
548
|
+
return $__namespace.utils.initList(1, _FileSystemData._Metadata, length, this);
|
|
549
|
+
}
|
|
550
|
+
set metadata(value) {
|
|
551
|
+
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(1, this));
|
|
552
|
+
}
|
|
553
|
+
_adoptFiles(value) {
|
|
554
|
+
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(2, this));
|
|
555
|
+
}
|
|
556
|
+
_disownFiles() {
|
|
557
|
+
return $__namespace.utils.disown(this.files);
|
|
558
|
+
}
|
|
559
|
+
get files() {
|
|
560
|
+
return $__namespace.utils.getList(2, _FileSystemData._Files, this);
|
|
561
|
+
}
|
|
562
|
+
_hasFiles() {
|
|
563
|
+
return !$__namespace.utils.isNull($__namespace.utils.getPointer(2, this));
|
|
564
|
+
}
|
|
565
|
+
_initFiles(length) {
|
|
566
|
+
return $__namespace.utils.initList(2, _FileSystemData._Files, length, this);
|
|
567
|
+
}
|
|
568
|
+
set files(value) {
|
|
569
|
+
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
|
|
570
|
+
}
|
|
571
|
+
toString() {
|
|
572
|
+
return "FileSystemData_" + super.toString();
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
FileMetadata._Properties = $__namespace.CompositeList(FileMetadata_KeyValuePair);
|
|
576
|
+
FileSystemData._Ids = $__namespace.CompositeList(FileIdentifier);
|
|
577
|
+
FileSystemData._Metadata = $__namespace.CompositeList(FileMetadata);
|
|
578
|
+
FileSystemData._Files = $__namespace.CompositeList(FileData);
|
|
345
579
|
var createLog = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((name, options = {}) => {
|
|
346
580
|
const logLevel = options.logLevel === null ? types.LogLevelLabel.SILENT : options.logLevel || types.LogLevelLabel.INFO;
|
|
347
581
|
if (logLevel === types.LogLevelLabel.SILENT) {
|
|
@@ -380,112 +614,6 @@ var BADGE_COLORS = [
|
|
|
380
614
|
var extendLog = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((logFn, name) => {
|
|
381
615
|
return (type, ...args) => logFn(type, ` ${chalk5__default.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase.titleCase(name)} `)} ${args.join(" ")} `);
|
|
382
616
|
}, "extendLog");
|
|
383
|
-
var PROJECT_ROOT_HASH_LENGTH = 45;
|
|
384
|
-
var CACHE_HASH_LENGTH = 62;
|
|
385
|
-
function getPrefixedProjectRootHash(name, projectRootHash) {
|
|
386
|
-
const combined = `${kebabCase.kebabCase(name)}_${projectRootHash}`;
|
|
387
|
-
return combined.length > PROJECT_ROOT_HASH_LENGTH ? combined.slice(0, PROJECT_ROOT_HASH_LENGTH) : combined;
|
|
388
|
-
}
|
|
389
|
-
chunkUSNT2KNT_cjs.__name(getPrefixedProjectRootHash, "getPrefixedProjectRootHash");
|
|
390
|
-
async function getChecksum(path) {
|
|
391
|
-
return hashFiles.hashDirectory(path, {
|
|
392
|
-
ignore: [
|
|
393
|
-
"node_modules",
|
|
394
|
-
".git",
|
|
395
|
-
".nx",
|
|
396
|
-
".cache",
|
|
397
|
-
".storm",
|
|
398
|
-
"tmp",
|
|
399
|
-
"dist"
|
|
400
|
-
]
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
chunkUSNT2KNT_cjs.__name(getChecksum, "getChecksum");
|
|
404
|
-
async function writeMetaFile(context) {
|
|
405
|
-
const metaFilePath = joinPaths.joinPaths(context.dataPath, "meta.json");
|
|
406
|
-
context.log(types.LogLevelLabel.DEBUG, `Writing runtime metadata to ${metaFilePath}`);
|
|
407
|
-
await context.fs.writeFile(metaFilePath, JSON.stringify({
|
|
408
|
-
...context.meta,
|
|
409
|
-
virtualFiles: context.fs[chunkRF6RSWD4_cjs.__VFS_VIRTUAL__].toJSON(context.artifactsPath),
|
|
410
|
-
virtualFilesMeta: context.fs.getPartialMeta()
|
|
411
|
-
}, null, 2), {
|
|
412
|
-
mode: "fs"
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
chunkUSNT2KNT_cjs.__name(writeMetaFile, "writeMetaFile");
|
|
416
|
-
function isPlugin(value) {
|
|
417
|
-
return isSetObject.isSetObject(value) && "name" in value && isSetString.isSetString(value.name) && (isUndefined.isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction.isFunction(value.applyToEnvironment)) && (isUndefined.isUndefined(value.dedupe) || "dedupe" in value && isFunction.isFunction(value.dedupe)) && (isUndefined.isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) && chunkFCTNMPJF_cjs.SUPPORTED_COMMANDS.every((command) => isUndefined.isUndefined(value[command]) || command in value && (isFunction.isFunction(value[command]) || isSetObject.isSetObject(value[command]) && "handler" in value[command] && isFunction.isFunction(value[command].handler)));
|
|
418
|
-
}
|
|
419
|
-
chunkUSNT2KNT_cjs.__name(isPlugin, "isPlugin");
|
|
420
|
-
function isPluginConfigObject(value) {
|
|
421
|
-
return isSetObject.isSetObject(value) && "plugin" in value && ((isSetString.isSetString(value.plugin) || isFunction.isFunction(value.plugin)) && "options" in value && isSetObject.isSetObject(value.options) || isPlugin(value.plugin));
|
|
422
|
-
}
|
|
423
|
-
chunkUSNT2KNT_cjs.__name(isPluginConfigObject, "isPluginConfigObject");
|
|
424
|
-
function isPluginConfigTuple(value) {
|
|
425
|
-
return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString.isSetString(value[0]) || isFunction.isFunction(value[0])) && value.length > 1 && isSetObject.isSetObject(value[1]) || isPlugin(value[0]));
|
|
426
|
-
}
|
|
427
|
-
chunkUSNT2KNT_cjs.__name(isPluginConfigTuple, "isPluginConfigTuple");
|
|
428
|
-
function isPluginConfig(value) {
|
|
429
|
-
return isSetString.isSetString(value) || isFunction.isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
|
|
430
|
-
}
|
|
431
|
-
chunkUSNT2KNT_cjs.__name(isPluginConfig, "isPluginConfig");
|
|
432
|
-
function isPluginHookFunction(value) {
|
|
433
|
-
return isFunction.isFunction(value) || isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
|
|
434
|
-
}
|
|
435
|
-
chunkUSNT2KNT_cjs.__name(isPluginHookFunction, "isPluginHookFunction");
|
|
436
|
-
function isPluginHookObject(value) {
|
|
437
|
-
return isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
|
|
438
|
-
}
|
|
439
|
-
chunkUSNT2KNT_cjs.__name(isPluginHookObject, "isPluginHookObject");
|
|
440
|
-
function isPluginHook(value) {
|
|
441
|
-
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
442
|
-
}
|
|
443
|
-
chunkUSNT2KNT_cjs.__name(isPluginHook, "isPluginHook");
|
|
444
|
-
function getHookHandler(pluginHook) {
|
|
445
|
-
return isFunction.isFunction(pluginHook) ? pluginHook : pluginHook.handler;
|
|
446
|
-
}
|
|
447
|
-
chunkUSNT2KNT_cjs.__name(getHookHandler, "getHookHandler");
|
|
448
|
-
function isHookExternal(hook) {
|
|
449
|
-
return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
|
|
450
|
-
}
|
|
451
|
-
chunkUSNT2KNT_cjs.__name(isHookExternal, "isHookExternal");
|
|
452
|
-
function checkDedupe(plugin, plugins) {
|
|
453
|
-
return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction.isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
454
|
-
}
|
|
455
|
-
chunkUSNT2KNT_cjs.__name(checkDedupe, "checkDedupe");
|
|
456
|
-
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
457
|
-
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
|
|
458
|
-
hooksList.push(isFunction.isFunction(pluginHook) ? {
|
|
459
|
-
plugin,
|
|
460
|
-
handler: getHookHandler(pluginHook).bind(context)
|
|
461
|
-
} : {
|
|
462
|
-
plugin,
|
|
463
|
-
...pluginHook,
|
|
464
|
-
handler: getHookHandler(pluginHook).bind(context)
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
chunkUSNT2KNT_cjs.__name(addPluginHook, "addPluginHook");
|
|
469
|
-
function resolveOptions(options) {
|
|
470
|
-
return defu4__default.default(options, {
|
|
471
|
-
interopDefault: true,
|
|
472
|
-
fsCache: options.mode !== "development" ? joinPaths.joinPaths(options.cacheDir, "jiti") : false,
|
|
473
|
-
moduleCache: options.mode !== "development"
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
chunkUSNT2KNT_cjs.__name(resolveOptions, "resolveOptions");
|
|
477
|
-
function createPluginResolver(options) {
|
|
478
|
-
return jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({
|
|
479
|
-
...options
|
|
480
|
-
}));
|
|
481
|
-
}
|
|
482
|
-
chunkUSNT2KNT_cjs.__name(createPluginResolver, "createPluginResolver");
|
|
483
|
-
function createResolver(options) {
|
|
484
|
-
const baseResolver = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions(options));
|
|
485
|
-
baseResolver.plugin = createPluginResolver(options);
|
|
486
|
-
return baseResolver;
|
|
487
|
-
}
|
|
488
|
-
chunkUSNT2KNT_cjs.__name(createResolver, "createResolver");
|
|
489
617
|
function isBufferEncoding(options) {
|
|
490
618
|
return isSetString.isSetString(options) || options === null;
|
|
491
619
|
}
|
|
@@ -634,46 +762,201 @@ function patchFS(originalFS, vfs) {
|
|
|
634
762
|
};
|
|
635
763
|
}
|
|
636
764
|
chunkUSNT2KNT_cjs.__name(patchFS, "patchFS");
|
|
637
|
-
var
|
|
765
|
+
var UnifiedFS = class _UnifiedFS extends unionfs.Union {
|
|
638
766
|
static {
|
|
639
|
-
chunkUSNT2KNT_cjs.__name(this, "
|
|
767
|
+
chunkUSNT2KNT_cjs.__name(this, "UnifiedFS");
|
|
640
768
|
}
|
|
641
769
|
/**
|
|
642
770
|
* The internal map of virtual files.
|
|
643
771
|
*/
|
|
644
|
-
#
|
|
772
|
+
#virtualFS = new volume.Volume();
|
|
645
773
|
/**
|
|
646
|
-
*
|
|
774
|
+
* The physical file system.
|
|
647
775
|
*/
|
|
648
|
-
#
|
|
776
|
+
#physicalFS = cloneFS(fs__default.default);
|
|
649
777
|
/**
|
|
650
|
-
*
|
|
778
|
+
* The context of the unified file system.
|
|
651
779
|
*/
|
|
652
|
-
#
|
|
780
|
+
#context;
|
|
781
|
+
static create(context, data) {
|
|
782
|
+
let result = new _UnifiedFS(context, data);
|
|
783
|
+
result = result.use(result.#physicalFS);
|
|
784
|
+
if (result.#context.config.output.mode !== "fs") {
|
|
785
|
+
result = result.use(result.#virtualFS);
|
|
786
|
+
}
|
|
787
|
+
return result;
|
|
788
|
+
}
|
|
653
789
|
/**
|
|
654
|
-
*
|
|
790
|
+
* Gets the virtual file system (VFS).
|
|
655
791
|
*/
|
|
656
|
-
|
|
792
|
+
get virtual() {
|
|
793
|
+
return this.#virtualFS;
|
|
794
|
+
}
|
|
657
795
|
/**
|
|
658
|
-
*
|
|
796
|
+
* Gets the physical file system (FS).
|
|
659
797
|
*/
|
|
660
|
-
|
|
798
|
+
get physical() {
|
|
799
|
+
return this.#physicalFS;
|
|
800
|
+
}
|
|
661
801
|
/**
|
|
662
|
-
*
|
|
802
|
+
* Creates a new instance of the VirtualFileSystem.
|
|
803
|
+
*
|
|
804
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
805
|
+
* @param data - A buffer containing the serialized virtual file system data.
|
|
663
806
|
*/
|
|
664
|
-
|
|
807
|
+
constructor(context, data) {
|
|
808
|
+
super();
|
|
809
|
+
this.#context = context;
|
|
810
|
+
if (!this.#physicalFS.existsSync(this.#context.dataPath)) {
|
|
811
|
+
this.#physicalFS.mkdirSync(this.#context.dataPath, {
|
|
812
|
+
recursive: true
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
if (!this.#physicalFS.existsSync(this.#context.cachePath)) {
|
|
816
|
+
this.#physicalFS.mkdirSync(this.#context.cachePath, {
|
|
817
|
+
recursive: true
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
if (!this.#physicalFS.existsSync(join.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
|
|
821
|
+
this.#physicalFS.mkdirSync(join.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath), {
|
|
822
|
+
recursive: true
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
if (this.#context.config.output.mode !== "fs") {
|
|
826
|
+
this.#virtualFS = volume.Volume.fromJSON(data._hasFiles() && data.files.length > 0 ? data.files.values().reduce((ret, file) => {
|
|
827
|
+
ret[file.path] = file.content;
|
|
828
|
+
return ret;
|
|
829
|
+
}, {}) : {});
|
|
830
|
+
if (!this.#virtualFS.existsSync(this.#context.artifactsPath)) {
|
|
831
|
+
this.#virtualFS.mkdirSync(this.#context.artifactsPath, {
|
|
832
|
+
recursive: true
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
if (!this.#virtualFS.existsSync(this.#context.builtinsPath)) {
|
|
836
|
+
this.#virtualFS.mkdirSync(this.#context.builtinsPath, {
|
|
837
|
+
recursive: true
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
if (!this.#virtualFS.existsSync(this.#context.entryPath)) {
|
|
841
|
+
this.#virtualFS.mkdirSync(this.#context.entryPath, {
|
|
842
|
+
recursive: true
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
if (!this.#virtualFS.existsSync(this.#context.dtsPath)) {
|
|
846
|
+
this.#virtualFS.mkdirSync(this.#context.dtsPath, {
|
|
847
|
+
recursive: true
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
} else if (this.#context.config.projectType === "application") {
|
|
851
|
+
if (!this.#physicalFS.existsSync(this.#context.artifactsPath)) {
|
|
852
|
+
this.#physicalFS.mkdirSync(this.#context.artifactsPath, {
|
|
853
|
+
recursive: true
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
if (!this.#physicalFS.existsSync(this.#context.builtinsPath)) {
|
|
857
|
+
this.#physicalFS.mkdirSync(this.#context.builtinsPath, {
|
|
858
|
+
recursive: true
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
if (!this.#physicalFS.existsSync(this.#context.entryPath)) {
|
|
862
|
+
this.#physicalFS.mkdirSync(this.#context.entryPath, {
|
|
863
|
+
recursive: true
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
if (!this.#physicalFS.existsSync(this.#context.dtsPath)) {
|
|
867
|
+
this.#physicalFS.mkdirSync(this.#context.dtsPath, {
|
|
868
|
+
recursive: true
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Select the file system module to use for the operation based on the path or URL.
|
|
875
|
+
*
|
|
876
|
+
* @param pathOrUrl - The path to perform the file system operation on.
|
|
877
|
+
* @param options - Options for the operation, such as output mode.
|
|
878
|
+
* @returns The file system module used for the operation.
|
|
879
|
+
*/
|
|
880
|
+
resolveFS(pathOrUrl, options = {}) {
|
|
881
|
+
const mode = this.resolveMode(pathOrUrl, options);
|
|
882
|
+
if (mode === "virtual") {
|
|
883
|
+
return {
|
|
884
|
+
...this.#virtualFS,
|
|
885
|
+
mode: "virtual"
|
|
886
|
+
};
|
|
887
|
+
} else if (mode === "fs") {
|
|
888
|
+
return {
|
|
889
|
+
...this.#physicalFS,
|
|
890
|
+
mode: "fs"
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
return {
|
|
894
|
+
...this,
|
|
895
|
+
mode: this.#context.config.output.mode
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Select the file system module to use for the operation based on the path or URL.
|
|
900
|
+
*
|
|
901
|
+
* @param pathOrUrl - The path to perform the file system operation on.
|
|
902
|
+
* @param options - Options for the operation, such as output mode.
|
|
903
|
+
* @returns The file system module used for the operation.
|
|
904
|
+
*/
|
|
905
|
+
resolveMode(pathOrUrl, options = {}) {
|
|
906
|
+
if (options.mode === "virtual" && this.#context.config.output.mode !== "fs" && isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.artifactsPath)) {
|
|
907
|
+
return "virtual";
|
|
908
|
+
} else if (options.mode === "fs" || this.#context.config.output.mode === "fs" || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.dataPath) || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.cachePath) || isParentPath.isParentPath(toFilePath(pathOrUrl), join.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
|
|
909
|
+
return "fs";
|
|
910
|
+
}
|
|
911
|
+
return void 0;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Serializes the virtual file system (VFS) to a JSON object.
|
|
915
|
+
*
|
|
916
|
+
* @returns A JSON representation of the virtual file system.
|
|
917
|
+
*/
|
|
918
|
+
toJSON() {
|
|
919
|
+
return this.#virtualFS.toJSON();
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
|
|
923
|
+
// src/lib/fs/vfs.ts
|
|
924
|
+
var VirtualFileSystem = class _VirtualFileSystem {
|
|
925
|
+
static {
|
|
926
|
+
chunkUSNT2KNT_cjs.__name(this, "VirtualFileSystem");
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* A map of virtual file IDs to their associated metadata.
|
|
930
|
+
*/
|
|
931
|
+
#metadata;
|
|
932
|
+
/**
|
|
933
|
+
* A map of virtual file IDs to their underlying file paths.
|
|
934
|
+
*/
|
|
935
|
+
#ids;
|
|
936
|
+
/**
|
|
937
|
+
* A map of underlying file paths to their virtual file IDs.
|
|
938
|
+
*/
|
|
939
|
+
#paths;
|
|
940
|
+
/**
|
|
941
|
+
* A map of virtual file paths to their underlying file content.
|
|
942
|
+
*/
|
|
943
|
+
#cachedResolver = /* @__PURE__ */ new Map();
|
|
665
944
|
/**
|
|
666
945
|
* The unified volume that combines the virtual file system with the real file system.
|
|
667
946
|
*
|
|
668
947
|
* @remarks
|
|
669
948
|
* This volume allows for seamless access to both virtual and real files.
|
|
670
949
|
*/
|
|
671
|
-
#unifiedFS
|
|
950
|
+
#unifiedFS;
|
|
672
951
|
/**
|
|
673
952
|
* Indicator specifying if the file system module is patched
|
|
674
953
|
*/
|
|
675
954
|
#isPatched = false;
|
|
676
955
|
/**
|
|
956
|
+
* Indicator specifying if the virtual file system (VFS) is disposed
|
|
957
|
+
*/
|
|
958
|
+
#isDisposed = false;
|
|
959
|
+
/**
|
|
677
960
|
* Function to revert require patch
|
|
678
961
|
*/
|
|
679
962
|
#revert;
|
|
@@ -693,60 +976,224 @@ var VirtualFileSystem = class {
|
|
|
693
976
|
*/
|
|
694
977
|
#existsSync(path) {
|
|
695
978
|
const formattedPath = this.formatPath(path);
|
|
696
|
-
return this.#
|
|
979
|
+
return this.#unifiedFS.virtual.existsSync(formattedPath) || this.#unifiedFS.physical.existsSync(formattedPath) || this.#unifiedFS.resolveFS(path).existsSync(formattedPath);
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Builds a regular expression from a string pattern for path matching.
|
|
983
|
+
*
|
|
984
|
+
* @param strPattern - The string pattern to convert.
|
|
985
|
+
* @returns A regular expression for matching paths.
|
|
986
|
+
*/
|
|
987
|
+
#buildRegex(strPattern) {
|
|
988
|
+
const token = "::GLOBSTAR::";
|
|
989
|
+
return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
|
|
697
990
|
}
|
|
698
991
|
/**
|
|
699
|
-
*
|
|
992
|
+
* Formats a file id by removing the file extension and prepending the runtime prefix.
|
|
993
|
+
*
|
|
994
|
+
* @param id - The file ID to format.
|
|
995
|
+
* @returns The formatted file ID.
|
|
700
996
|
*/
|
|
701
|
-
|
|
702
|
-
|
|
997
|
+
#formatId(id) {
|
|
998
|
+
const formattedId = toFilePath(id);
|
|
999
|
+
return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(formattedId), "")}`;
|
|
703
1000
|
}
|
|
704
1001
|
/**
|
|
705
|
-
*
|
|
1002
|
+
* Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
1003
|
+
*
|
|
1004
|
+
* @param id - The id to resolve.
|
|
1005
|
+
* @returns The resolved file id if it exists, otherwise undefined.
|
|
706
1006
|
*/
|
|
707
|
-
|
|
708
|
-
|
|
1007
|
+
#resolveId(id) {
|
|
1008
|
+
if (this.#ids[this.#formatId(id)]) {
|
|
1009
|
+
return this.#ids[this.#formatId(id)] || false;
|
|
1010
|
+
}
|
|
1011
|
+
return false;
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
1015
|
+
*
|
|
1016
|
+
* @param path - The path to resolve.
|
|
1017
|
+
* @param options - Optional parameters for resolving the path.
|
|
1018
|
+
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1019
|
+
*/
|
|
1020
|
+
#resolvePath(path, options = {}) {
|
|
1021
|
+
if (isType.isAbsolutePath(path)) {
|
|
1022
|
+
if (this.#existsSync(path)) {
|
|
1023
|
+
return path;
|
|
1024
|
+
}
|
|
1025
|
+
const result = this.#checkVariants(path);
|
|
1026
|
+
if (result) {
|
|
1027
|
+
return result;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
for (const parentPath of this.#resolveParentPaths(path, options.paths)) {
|
|
1031
|
+
const request = joinPaths.joinPaths(parentPath, path);
|
|
1032
|
+
if (this.#existsSync(request)) {
|
|
1033
|
+
return request;
|
|
1034
|
+
}
|
|
1035
|
+
const result = this.#checkVariants(request);
|
|
1036
|
+
if (result) {
|
|
1037
|
+
return result;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
return false;
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Resolves parent paths for a given request.
|
|
1044
|
+
*
|
|
1045
|
+
* @param request - The request path to resolve parent paths for.
|
|
1046
|
+
* @param parents - An optional array of parent paths to consider.
|
|
1047
|
+
* @returns An array of resolved parent paths.
|
|
1048
|
+
*/
|
|
1049
|
+
#resolveParentPaths(request, parents = []) {
|
|
1050
|
+
let paths = [
|
|
1051
|
+
this.#context.workspaceConfig.workspaceRoot,
|
|
1052
|
+
joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
|
|
1053
|
+
];
|
|
1054
|
+
if (this.#context.tsconfig.options.paths) {
|
|
1055
|
+
paths = this.#context.tsconfig.options.paths ? Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => request.startsWith(tsconfigPath.replaceAll("*", ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().reduce((ret, path) => {
|
|
1056
|
+
if (path && !ret.includes(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path))) {
|
|
1057
|
+
ret.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path));
|
|
1058
|
+
}
|
|
1059
|
+
return ret;
|
|
1060
|
+
}, paths) : paths;
|
|
1061
|
+
}
|
|
1062
|
+
return paths.reduce((ret, path) => {
|
|
1063
|
+
if (!ret.includes(path)) {
|
|
1064
|
+
ret.push(path);
|
|
1065
|
+
}
|
|
1066
|
+
return ret;
|
|
1067
|
+
}, parents.filter(Boolean).map((p) => this.formatPath(p)));
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Clears the resolver cache for a given path.
|
|
1071
|
+
*
|
|
1072
|
+
* @param path - The path to clear the resolver cache for.
|
|
1073
|
+
*/
|
|
1074
|
+
#clearResolverCache(path) {
|
|
1075
|
+
this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Check if the file exists with different variants (index, extensions).
|
|
1079
|
+
*
|
|
1080
|
+
* @param request - The request path to check.
|
|
1081
|
+
* @param parentPath - An optional parent path to prepend to the request.
|
|
1082
|
+
* @returns The file path if it exists, otherwise false.
|
|
1083
|
+
*/
|
|
1084
|
+
#checkVariants(request, parentPath) {
|
|
1085
|
+
const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
|
|
1086
|
+
let file = this.#checkExtensions(path);
|
|
1087
|
+
if (file) {
|
|
1088
|
+
return file;
|
|
1089
|
+
}
|
|
1090
|
+
file = this.#checkIndex(path);
|
|
1091
|
+
if (file) {
|
|
1092
|
+
return file;
|
|
1093
|
+
}
|
|
1094
|
+
return false;
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Check if the index file exists in the given request path.
|
|
1098
|
+
*
|
|
1099
|
+
* @param request - The request path to check.
|
|
1100
|
+
* @returns The index file path if it exists, otherwise false.
|
|
1101
|
+
*/
|
|
1102
|
+
#checkIndex(request) {
|
|
1103
|
+
let file = joinPaths.joinPaths(request, "index");
|
|
1104
|
+
if (this.#existsSync(file)) {
|
|
1105
|
+
return file;
|
|
1106
|
+
}
|
|
1107
|
+
file = this.#checkExtensions(file);
|
|
1108
|
+
if (file) {
|
|
1109
|
+
return file;
|
|
1110
|
+
}
|
|
1111
|
+
return false;
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Check if the file exists with different extensions.
|
|
1115
|
+
*
|
|
1116
|
+
* @param request - The request path to check.
|
|
1117
|
+
* @returns The file path if it exists with any of the checked extensions, otherwise false.
|
|
1118
|
+
*/
|
|
1119
|
+
#checkExtensions(request) {
|
|
1120
|
+
let file = `${request}.ts`;
|
|
1121
|
+
if (this.#existsSync(file)) {
|
|
1122
|
+
return file;
|
|
1123
|
+
}
|
|
1124
|
+
file = `${request}.mts`;
|
|
1125
|
+
if (this.#existsSync(file)) {
|
|
1126
|
+
return file;
|
|
1127
|
+
}
|
|
1128
|
+
file = `${request}.cts`;
|
|
1129
|
+
if (this.#existsSync(file)) {
|
|
1130
|
+
return file;
|
|
1131
|
+
}
|
|
1132
|
+
file = `${request}.tsx`;
|
|
1133
|
+
if (this.#existsSync(file)) {
|
|
1134
|
+
return file;
|
|
1135
|
+
}
|
|
1136
|
+
file = `${request}.js`;
|
|
1137
|
+
if (this.#existsSync(file)) {
|
|
1138
|
+
return file;
|
|
1139
|
+
}
|
|
1140
|
+
file = `${request}.mjs`;
|
|
1141
|
+
if (this.#existsSync(file)) {
|
|
1142
|
+
return file;
|
|
1143
|
+
}
|
|
1144
|
+
file = `${request}.cjs`;
|
|
1145
|
+
if (this.#existsSync(file)) {
|
|
1146
|
+
return file;
|
|
1147
|
+
}
|
|
1148
|
+
file = `${request}.jsx`;
|
|
1149
|
+
if (this.#existsSync(file)) {
|
|
1150
|
+
return file;
|
|
1151
|
+
}
|
|
1152
|
+
file = `${request}.json`;
|
|
1153
|
+
if (this.#existsSync(file)) {
|
|
1154
|
+
return file;
|
|
1155
|
+
}
|
|
1156
|
+
file = `${request}.d.ts`;
|
|
1157
|
+
if (this.#existsSync(file)) {
|
|
1158
|
+
return file;
|
|
1159
|
+
}
|
|
1160
|
+
return false;
|
|
709
1161
|
}
|
|
710
1162
|
/**
|
|
711
|
-
*
|
|
1163
|
+
* Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
1164
|
+
*
|
|
1165
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
1166
|
+
* @returns A promise that resolves to a new virtual file system instance.
|
|
712
1167
|
*/
|
|
713
|
-
|
|
714
|
-
|
|
1168
|
+
static async create(context) {
|
|
1169
|
+
if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.cachePath, "fs.bin"))) {
|
|
1170
|
+
const buffer$1 = await buffer.readFileBuffer(joinPaths.joinPaths(context.cachePath, "fs.bin"));
|
|
1171
|
+
const message2 = new $__namespace.Message(buffer$1, false);
|
|
1172
|
+
return new _VirtualFileSystem(context, message2.getRoot(FileSystemData));
|
|
1173
|
+
}
|
|
1174
|
+
const message = new $__namespace.Message();
|
|
1175
|
+
return new _VirtualFileSystem(context, message.initRoot(FileSystemData));
|
|
715
1176
|
}
|
|
716
1177
|
/**
|
|
717
|
-
*
|
|
1178
|
+
* Synchronously creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
1179
|
+
*
|
|
1180
|
+
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
1181
|
+
* @returns A new virtual file system instance.
|
|
718
1182
|
*/
|
|
719
|
-
|
|
720
|
-
|
|
1183
|
+
static createSync(context) {
|
|
1184
|
+
if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.cachePath, "fs.bin"))) {
|
|
1185
|
+
const buffer$1 = buffer.readFileBufferSync(joinPaths.joinPaths(context.cachePath, "fs.bin"));
|
|
1186
|
+
const message2 = new $__namespace.Message(buffer$1, false);
|
|
1187
|
+
return new _VirtualFileSystem(context, message2.getRoot(FileSystemData));
|
|
1188
|
+
}
|
|
1189
|
+
const message = new $__namespace.Message();
|
|
1190
|
+
return new _VirtualFileSystem(context, message.initRoot(FileSystemData));
|
|
721
1191
|
}
|
|
722
1192
|
/**
|
|
723
|
-
* A
|
|
1193
|
+
* A map of file ids to their metadata.
|
|
724
1194
|
*/
|
|
725
|
-
get
|
|
726
|
-
return
|
|
727
|
-
get: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop) => {
|
|
728
|
-
if (target[prop]) {
|
|
729
|
-
return {
|
|
730
|
-
id: prop,
|
|
731
|
-
mode: this.#virtualFS.existsSync(prop) ? "virtual" : this.#fs.existsSync(prop) ? "fs" : this.#context.config.output.mode,
|
|
732
|
-
details: {},
|
|
733
|
-
variant: "normal",
|
|
734
|
-
...target[prop]
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
return void 0;
|
|
738
|
-
}, "get"),
|
|
739
|
-
set: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop, value) => {
|
|
740
|
-
target[prop] = value;
|
|
741
|
-
this.#ids[value.id || prop] = prop;
|
|
742
|
-
return true;
|
|
743
|
-
}, "set"),
|
|
744
|
-
deleteProperty: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop) => {
|
|
745
|
-
delete this.#ids[target[prop]?.id || prop];
|
|
746
|
-
delete target[prop];
|
|
747
|
-
return true;
|
|
748
|
-
}, "deleteProperty")
|
|
749
|
-
});
|
|
1195
|
+
get metadata() {
|
|
1196
|
+
return this.#metadata;
|
|
750
1197
|
}
|
|
751
1198
|
/**
|
|
752
1199
|
* A map of module ids to their file paths.
|
|
@@ -755,98 +1202,49 @@ var VirtualFileSystem = class {
|
|
|
755
1202
|
return this.#ids;
|
|
756
1203
|
}
|
|
757
1204
|
/**
|
|
758
|
-
*
|
|
1205
|
+
* A map of virtual file paths to their IDs.
|
|
1206
|
+
*/
|
|
1207
|
+
get paths() {
|
|
1208
|
+
return this.#paths;
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Creates a new instance of the {@link VirtualFileSystem}.
|
|
759
1212
|
*
|
|
760
1213
|
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
761
|
-
* @param
|
|
1214
|
+
* @param data - A buffer containing the serialized virtual file system data.
|
|
762
1215
|
*/
|
|
763
|
-
constructor(context,
|
|
1216
|
+
constructor(context, data) {
|
|
764
1217
|
this.#context = context;
|
|
765
|
-
this.#
|
|
766
|
-
this.#
|
|
767
|
-
|
|
768
|
-
data.
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
recursive: true
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
if (!this.#virtualFS.existsSync(this.#context.builtinsPath)) {
|
|
797
|
-
this.#virtualFS.mkdirSync(this.#context.builtinsPath, {
|
|
798
|
-
recursive: true
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
if (!this.#virtualFS.existsSync(this.#context.entryPath)) {
|
|
802
|
-
this.#virtualFS.mkdirSync(this.#context.entryPath, {
|
|
803
|
-
recursive: true
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
if (!this.#virtualFS.existsSync(this.#context.dtsPath)) {
|
|
807
|
-
this.#virtualFS.mkdirSync(this.#context.dtsPath, {
|
|
808
|
-
recursive: true
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
this.#unifiedFS = this.#unifiedFS.use(this.#virtualFS);
|
|
812
|
-
} else if (this.#context.config.projectType === "application") {
|
|
813
|
-
if (!this.#fs.existsSync(this.#context.artifactsPath)) {
|
|
814
|
-
this.#fs.mkdirSync(this.#context.artifactsPath, {
|
|
815
|
-
recursive: true
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
if (!this.#fs.existsSync(this.#context.builtinsPath)) {
|
|
819
|
-
this.#fs.mkdirSync(this.#context.builtinsPath, {
|
|
820
|
-
recursive: true
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
|
-
if (!this.#fs.existsSync(this.#context.entryPath)) {
|
|
824
|
-
this.#fs.mkdirSync(this.#context.entryPath, {
|
|
825
|
-
recursive: true
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
if (!this.#fs.existsSync(this.#context.dtsPath)) {
|
|
829
|
-
this.#fs.mkdirSync(this.#context.dtsPath, {
|
|
830
|
-
recursive: true
|
|
831
|
-
});
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
this.#log = extendLog(this.#context.log, "virtual-file-system");
|
|
835
|
-
}
|
|
836
|
-
[chunkRF6RSWD4_cjs.__VFS_INIT__]() {
|
|
837
|
-
if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
838
|
-
this.#revert = patchFS(fs__default.default, this);
|
|
839
|
-
this.#isPatched = true;
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
[chunkRF6RSWD4_cjs.__VFS_REVERT__]() {
|
|
843
|
-
if (this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
844
|
-
if (!this.#revert) {
|
|
845
|
-
throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
|
|
846
|
-
}
|
|
847
|
-
this.#revert?.();
|
|
848
|
-
this.#isPatched = false;
|
|
1218
|
+
this.#unifiedFS = UnifiedFS.create(context, data);
|
|
1219
|
+
this.#metadata = {};
|
|
1220
|
+
if (data._hasMetadata()) {
|
|
1221
|
+
this.#metadata = data.metadata.values().reduce((ret, data2) => {
|
|
1222
|
+
ret[data2.id] = {
|
|
1223
|
+
id: data2.id,
|
|
1224
|
+
variant: data2.variant,
|
|
1225
|
+
mode: data2.mode,
|
|
1226
|
+
properties: data2._hasProperties() ? data2.properties.values().reduce((ret2, item) => {
|
|
1227
|
+
ret2[item.key] = item.value;
|
|
1228
|
+
return ret2;
|
|
1229
|
+
}, {}) : {}
|
|
1230
|
+
};
|
|
1231
|
+
return ret;
|
|
1232
|
+
}, {});
|
|
1233
|
+
}
|
|
1234
|
+
this.#ids = {};
|
|
1235
|
+
this.#paths = {};
|
|
1236
|
+
if (data._hasIds()) {
|
|
1237
|
+
this.#ids = data.ids.values().reduce((ret, data2) => {
|
|
1238
|
+
ret[data2.id] ??= data2.path;
|
|
1239
|
+
ret[data2.path] ??= data2.path;
|
|
1240
|
+
return ret;
|
|
1241
|
+
}, {});
|
|
1242
|
+
this.#paths = data.ids.values().reduce((ret, data2) => {
|
|
1243
|
+
ret[data2.path] ??= data2.id;
|
|
1244
|
+
return ret;
|
|
1245
|
+
}, {});
|
|
849
1246
|
}
|
|
1247
|
+
this.#log = extendLog(this.#context.log, "file-system");
|
|
850
1248
|
}
|
|
851
1249
|
/**
|
|
852
1250
|
* Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
@@ -866,7 +1264,7 @@ var VirtualFileSystem = class {
|
|
|
866
1264
|
if (!resolvedPath) {
|
|
867
1265
|
return false;
|
|
868
1266
|
}
|
|
869
|
-
return this.
|
|
1267
|
+
return this.metadata[resolvedPath]?.mode === "virtual";
|
|
870
1268
|
}
|
|
871
1269
|
/**
|
|
872
1270
|
* Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
@@ -875,7 +1273,7 @@ var VirtualFileSystem = class {
|
|
|
875
1273
|
* @param options - Optional parameters for resolving the path.
|
|
876
1274
|
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
877
1275
|
*/
|
|
878
|
-
|
|
1276
|
+
isPhysical(pathOrId, options = {}) {
|
|
879
1277
|
if (!pathOrId) {
|
|
880
1278
|
return false;
|
|
881
1279
|
}
|
|
@@ -886,18 +1284,7 @@ var VirtualFileSystem = class {
|
|
|
886
1284
|
if (!resolvedPath) {
|
|
887
1285
|
return false;
|
|
888
1286
|
}
|
|
889
|
-
return this.
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
|
|
893
|
-
*
|
|
894
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
895
|
-
*
|
|
896
|
-
* @param pathOrId - The path or ID to check.
|
|
897
|
-
* @returns Whether the path or ID corresponds to a virtual file.
|
|
898
|
-
*/
|
|
899
|
-
isTsconfigPath(pathOrId) {
|
|
900
|
-
return !!this.#context.tsconfig.options.paths && Object.keys(this.#context.tsconfig.options.paths).some((path) => pathOrId.startsWith(path.replaceAll("*", "")));
|
|
1287
|
+
return this.metadata[resolvedPath]?.mode === "fs";
|
|
901
1288
|
}
|
|
902
1289
|
/**
|
|
903
1290
|
* Lists files in a given path.
|
|
@@ -907,7 +1294,7 @@ var VirtualFileSystem = class {
|
|
|
907
1294
|
* @returns An array of file names in the specified path.
|
|
908
1295
|
*/
|
|
909
1296
|
readdirSync(path, options = "utf8") {
|
|
910
|
-
return this.resolveFS(path).readdirSync(toFilePath(path), options);
|
|
1297
|
+
return this.#unifiedFS.resolveFS(path).readdirSync(toFilePath(path), options);
|
|
911
1298
|
}
|
|
912
1299
|
/**
|
|
913
1300
|
* Removes a file in the virtual file system (VFS).
|
|
@@ -920,9 +1307,11 @@ var VirtualFileSystem = class {
|
|
|
920
1307
|
return;
|
|
921
1308
|
}
|
|
922
1309
|
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${formattedPath}`);
|
|
923
|
-
this.resolveFS(path, options).unlinkSync(formattedPath);
|
|
924
|
-
this
|
|
925
|
-
|
|
1310
|
+
this.#unifiedFS.resolveFS(path, options).unlinkSync(formattedPath);
|
|
1311
|
+
if (this.paths[formattedPath] && this.metadata[this.paths[formattedPath]]) {
|
|
1312
|
+
delete this.metadata[this.paths[formattedPath]];
|
|
1313
|
+
}
|
|
1314
|
+
this.#clearResolverCache(formattedPath);
|
|
926
1315
|
}
|
|
927
1316
|
/**
|
|
928
1317
|
* Removes a file in the virtual file system (VFS).
|
|
@@ -935,10 +1324,12 @@ var VirtualFileSystem = class {
|
|
|
935
1324
|
return;
|
|
936
1325
|
}
|
|
937
1326
|
this.#log(types.LogLevelLabel.TRACE, `Removing file: ${formattedPath}`);
|
|
938
|
-
if (isFunction.isFunction(this.resolveFS(path, options).promises.unlink)) {
|
|
939
|
-
await this.resolveFS(path, options).promises.unlink(formattedPath);
|
|
940
|
-
this
|
|
941
|
-
|
|
1327
|
+
if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.unlink)) {
|
|
1328
|
+
await this.#unifiedFS.resolveFS(path, options).promises.unlink(formattedPath);
|
|
1329
|
+
if (this.paths[formattedPath] && this.metadata[this.paths[formattedPath]]) {
|
|
1330
|
+
delete this.metadata[this.paths[formattedPath]];
|
|
1331
|
+
}
|
|
1332
|
+
this.#clearResolverCache(formattedPath);
|
|
942
1333
|
} else {
|
|
943
1334
|
this.unlinkSync(formattedPath, options);
|
|
944
1335
|
}
|
|
@@ -955,11 +1346,10 @@ var VirtualFileSystem = class {
|
|
|
955
1346
|
return;
|
|
956
1347
|
}
|
|
957
1348
|
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${formattedPath}`);
|
|
958
|
-
this.resolveFS(path, options).rmdirSync(formattedPath,
|
|
1349
|
+
this.#unifiedFS.resolveFS(path, options).rmdirSync(formattedPath, defu3__default.default(options, {
|
|
959
1350
|
recursive: true
|
|
960
1351
|
}));
|
|
961
|
-
this.#
|
|
962
|
-
this.clearResolverCache(formattedPath);
|
|
1352
|
+
this.#clearResolverCache(formattedPath);
|
|
963
1353
|
}
|
|
964
1354
|
/**
|
|
965
1355
|
* Removes a directory in the virtual file system (VFS).
|
|
@@ -974,15 +1364,14 @@ var VirtualFileSystem = class {
|
|
|
974
1364
|
return;
|
|
975
1365
|
}
|
|
976
1366
|
this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${formattedPath}`);
|
|
977
|
-
if (isFunction.isFunction(this.resolveFS(path, options).promises.rm)) {
|
|
978
|
-
await this.resolveFS(path, options).promises.rm(formattedPath,
|
|
1367
|
+
if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.rm)) {
|
|
1368
|
+
await this.#unifiedFS.resolveFS(path, options).promises.rm(formattedPath, defu3__default.default(options, {
|
|
979
1369
|
force: true,
|
|
980
1370
|
recursive: true
|
|
981
1371
|
}));
|
|
982
|
-
this.#
|
|
983
|
-
this.clearResolverCache(formattedPath);
|
|
1372
|
+
this.#clearResolverCache(formattedPath);
|
|
984
1373
|
} else {
|
|
985
|
-
this.rmdirSync(formattedPath,
|
|
1374
|
+
this.rmdirSync(formattedPath, defu3__default.default(options ?? {}, {
|
|
986
1375
|
force: true,
|
|
987
1376
|
recursive: true
|
|
988
1377
|
}));
|
|
@@ -1024,8 +1413,8 @@ var VirtualFileSystem = class {
|
|
|
1024
1413
|
*/
|
|
1025
1414
|
mkdirSync(path, options = {}) {
|
|
1026
1415
|
const filePath = toFilePath(path);
|
|
1027
|
-
this
|
|
1028
|
-
return this.resolveFS(filePath, options).mkdirSync(filePath,
|
|
1416
|
+
this.#clearResolverCache(filePath);
|
|
1417
|
+
return this.#unifiedFS.resolveFS(filePath, options).mkdirSync(filePath, defu3__default.default(options ?? {}, {
|
|
1029
1418
|
recursive: true
|
|
1030
1419
|
}));
|
|
1031
1420
|
}
|
|
@@ -1039,16 +1428,16 @@ var VirtualFileSystem = class {
|
|
|
1039
1428
|
async mkdir(path, options = {}) {
|
|
1040
1429
|
let result;
|
|
1041
1430
|
const filePath = toFilePath(path);
|
|
1042
|
-
if (isFunction.isFunction(this.resolveFS(filePath, options).promises.mkdir)) {
|
|
1043
|
-
result = await this.resolveFS(filePath, options).promises.mkdir(filePath,
|
|
1431
|
+
if (isFunction.isFunction(this.#unifiedFS.resolveFS(filePath, options).promises.mkdir)) {
|
|
1432
|
+
result = await this.#unifiedFS.resolveFS(filePath, options).promises.mkdir(filePath, defu3__default.default(options ?? {}, {
|
|
1044
1433
|
recursive: true
|
|
1045
1434
|
}));
|
|
1046
1435
|
} else {
|
|
1047
|
-
result = this.resolveFS(filePath, options).mkdirSync(filePath,
|
|
1436
|
+
result = this.#unifiedFS.resolveFS(filePath, options).mkdirSync(filePath, defu3__default.default(options ?? {}, {
|
|
1048
1437
|
recursive: true
|
|
1049
1438
|
}));
|
|
1050
1439
|
}
|
|
1051
|
-
this
|
|
1440
|
+
this.#clearResolverCache(filePath);
|
|
1052
1441
|
return result;
|
|
1053
1442
|
}
|
|
1054
1443
|
/**
|
|
@@ -1096,7 +1485,7 @@ var VirtualFileSystem = class {
|
|
|
1096
1485
|
if (stats.isDirectory()) {
|
|
1097
1486
|
stack.push(full);
|
|
1098
1487
|
} else if (stats.isFile()) {
|
|
1099
|
-
if (this
|
|
1488
|
+
if (this.#buildRegex(absPattern).test(full)) {
|
|
1100
1489
|
const resolved = this.resolve(full, {
|
|
1101
1490
|
type: "file"
|
|
1102
1491
|
});
|
|
@@ -1155,7 +1544,7 @@ var VirtualFileSystem = class {
|
|
|
1155
1544
|
if (stats.isDirectory()) {
|
|
1156
1545
|
stack.push(full);
|
|
1157
1546
|
} else if (stats.isFile()) {
|
|
1158
|
-
if (this
|
|
1547
|
+
if (this.#buildRegex(absPattern).test(full)) {
|
|
1159
1548
|
const resolved = this.resolve(full, {
|
|
1160
1549
|
type: "file"
|
|
1161
1550
|
});
|
|
@@ -1219,7 +1608,7 @@ var VirtualFileSystem = class {
|
|
|
1219
1608
|
* @returns An array of file names in the specified path.
|
|
1220
1609
|
*/
|
|
1221
1610
|
async readdir(pathOrId, options = "utf8") {
|
|
1222
|
-
return this.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
|
|
1611
|
+
return this.#unifiedFS.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
|
|
1223
1612
|
}
|
|
1224
1613
|
/**
|
|
1225
1614
|
* Asynchronously reads a file from the virtual file system (VFS).
|
|
@@ -1235,17 +1624,13 @@ var VirtualFileSystem = class {
|
|
|
1235
1624
|
type: "file"
|
|
1236
1625
|
});
|
|
1237
1626
|
if (filePath) {
|
|
1238
|
-
if (this.#cachedFS.has(filePath)) {
|
|
1239
|
-
return this.#cachedFS.get(filePath);
|
|
1240
|
-
}
|
|
1241
1627
|
let result;
|
|
1242
|
-
if (isFunction.isFunction(this.resolveFS(filePath).promises.readFile)) {
|
|
1243
|
-
result = (await this.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
|
|
1628
|
+
if (isFunction.isFunction(this.#unifiedFS.resolveFS(filePath).promises.readFile)) {
|
|
1629
|
+
result = (await this.#unifiedFS.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
|
|
1244
1630
|
} else {
|
|
1245
|
-
result = this.resolveFS(filePath).readFileSync(filePath, options);
|
|
1631
|
+
result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
|
|
1246
1632
|
}
|
|
1247
1633
|
const content = isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
|
|
1248
|
-
this.#cachedFS.set(filePath, content);
|
|
1249
1634
|
return content;
|
|
1250
1635
|
}
|
|
1251
1636
|
return void 0;
|
|
@@ -1264,12 +1649,8 @@ var VirtualFileSystem = class {
|
|
|
1264
1649
|
type: "file"
|
|
1265
1650
|
});
|
|
1266
1651
|
if (filePath) {
|
|
1267
|
-
|
|
1268
|
-
return this.#cachedFS.get(filePath);
|
|
1269
|
-
}
|
|
1270
|
-
const result = this.resolveFS(filePath).readFileSync(filePath, options);
|
|
1652
|
+
const result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
|
|
1271
1653
|
const content = isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
|
|
1272
|
-
this.#cachedFS.set(filePath, content);
|
|
1273
1654
|
return content;
|
|
1274
1655
|
}
|
|
1275
1656
|
return void 0;
|
|
@@ -1297,17 +1678,15 @@ var VirtualFileSystem = class {
|
|
|
1297
1678
|
});
|
|
1298
1679
|
}
|
|
1299
1680
|
}
|
|
1300
|
-
const outputMode = this.
|
|
1301
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(code)).size)})`);
|
|
1302
|
-
this.
|
|
1303
|
-
path: formattedPath,
|
|
1304
|
-
code,
|
|
1681
|
+
const outputMode = this.#unifiedFS.resolveMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
1682
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
|
|
1683
|
+
this.metadata[formattedPath] = {
|
|
1305
1684
|
mode: outputMode,
|
|
1306
1685
|
variant: "normal",
|
|
1307
1686
|
...isPowerLinesWriteFileData(data) ? data : {}
|
|
1308
1687
|
};
|
|
1309
|
-
this
|
|
1310
|
-
const ifs = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
1688
|
+
this.#clearResolverCache(formattedPath);
|
|
1689
|
+
const ifs = this.#unifiedFS.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
1311
1690
|
if (isFunction.isFunction(ifs.promises.writeFile)) {
|
|
1312
1691
|
return ifs.promises.writeFile(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
|
|
1313
1692
|
}
|
|
@@ -1326,17 +1705,15 @@ var VirtualFileSystem = class {
|
|
|
1326
1705
|
this.mkdirSync(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
1327
1706
|
}
|
|
1328
1707
|
const code = isPowerLinesWriteFileData(data) ? data.code : data;
|
|
1329
|
-
const outputMode = this.
|
|
1330
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(code)).size)})`);
|
|
1331
|
-
this.
|
|
1332
|
-
path: formattedPath,
|
|
1333
|
-
code,
|
|
1708
|
+
const outputMode = this.#unifiedFS.resolveMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
1709
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
|
|
1710
|
+
this.metadata[formattedPath] = {
|
|
1334
1711
|
mode: outputMode,
|
|
1335
1712
|
variant: "normal",
|
|
1336
1713
|
...isPowerLinesWriteFileData(data) ? data : {}
|
|
1337
1714
|
};
|
|
1338
|
-
this
|
|
1339
|
-
const writeStream = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
|
|
1715
|
+
this.#clearResolverCache(formattedPath);
|
|
1716
|
+
const writeStream = this.#unifiedFS.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
|
|
1340
1717
|
try {
|
|
1341
1718
|
writeStream.write(code);
|
|
1342
1719
|
} finally {
|
|
@@ -1360,8 +1737,8 @@ var VirtualFileSystem = class {
|
|
|
1360
1737
|
*/
|
|
1361
1738
|
getMetadata(pathOrId) {
|
|
1362
1739
|
const resolved = this.resolve(pathOrId);
|
|
1363
|
-
if (resolved && this.
|
|
1364
|
-
return this.
|
|
1740
|
+
if (resolved && this.metadata[resolved]) {
|
|
1741
|
+
return this.metadata[resolved];
|
|
1365
1742
|
}
|
|
1366
1743
|
return void 0;
|
|
1367
1744
|
}
|
|
@@ -1376,7 +1753,7 @@ var VirtualFileSystem = class {
|
|
|
1376
1753
|
*/
|
|
1377
1754
|
isFile(pathOrId) {
|
|
1378
1755
|
const resolved = this.resolve(pathOrId);
|
|
1379
|
-
return !!(resolved && (this.#
|
|
1756
|
+
return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isFile() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isFile() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isFile()));
|
|
1380
1757
|
}
|
|
1381
1758
|
/**
|
|
1382
1759
|
* Checks if a directory exists in the virtual file system (VFS).
|
|
@@ -1386,7 +1763,7 @@ var VirtualFileSystem = class {
|
|
|
1386
1763
|
*/
|
|
1387
1764
|
isDirectory(pathOrId) {
|
|
1388
1765
|
const resolved = this.resolve(pathOrId);
|
|
1389
|
-
return !!(resolved && (this.#
|
|
1766
|
+
return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isDirectory() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isDirectory() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isDirectory()));
|
|
1390
1767
|
}
|
|
1391
1768
|
/**
|
|
1392
1769
|
* Retrieves the status of a file in the virtual file system (VFS).
|
|
@@ -1394,340 +1771,258 @@ var VirtualFileSystem = class {
|
|
|
1394
1771
|
* @param pathOrId - The path or ID of the file to retrieve status for.
|
|
1395
1772
|
* @returns A promise that resolves to the file's status information, or false if the file does not exist.
|
|
1396
1773
|
*/
|
|
1397
|
-
async stat(pathOrId, options) {
|
|
1398
|
-
return this.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1399
|
-
}
|
|
1400
|
-
/**
|
|
1401
|
-
* Synchronously retrieves the status of a file in the virtual file system (VFS).
|
|
1402
|
-
*
|
|
1403
|
-
* @param pathOrId - The path or ID of the file to retrieve status for.
|
|
1404
|
-
* @returns The file's status information, or false if the file does not exist.
|
|
1405
|
-
*/
|
|
1406
|
-
statSync(pathOrId) {
|
|
1407
|
-
return this.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
|
|
1408
|
-
}
|
|
1409
|
-
/**
|
|
1410
|
-
* Retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
1411
|
-
*
|
|
1412
|
-
* @param pathOrId - The path or ID of the symbolic link to retrieve status for.
|
|
1413
|
-
* @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
|
|
1414
|
-
*/
|
|
1415
|
-
async lstat(pathOrId, options) {
|
|
1416
|
-
return this.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1417
|
-
}
|
|
1418
|
-
/**
|
|
1419
|
-
* Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
1420
|
-
*
|
|
1421
|
-
* @param pathOrId - The path or ID of the symbolic link to retrieve status for.
|
|
1422
|
-
* @returns The symbolic link's status information, or false if the link does not exist.
|
|
1423
|
-
*/
|
|
1424
|
-
lstatSync(pathOrId, options) {
|
|
1425
|
-
return this.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1426
|
-
}
|
|
1427
|
-
/**
|
|
1428
|
-
* Resolves a path based on TypeScript's `tsconfig.json` paths.
|
|
1429
|
-
*
|
|
1430
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
1431
|
-
*
|
|
1432
|
-
* @param path - The path to check.
|
|
1433
|
-
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1434
|
-
*/
|
|
1435
|
-
resolveTsconfigPath(path) {
|
|
1436
|
-
if (this.#context.tsconfig.options.paths) {
|
|
1437
|
-
for (const tsconfigPathKey of Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")))) {
|
|
1438
|
-
const resolvedPath = this.#context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath) => this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, tsconfigPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || this.formatPath(tsconfigPath) === this.formatPath(path));
|
|
1439
|
-
if (resolvedPath) {
|
|
1440
|
-
return this.formatPath(resolvedPath) === this.formatPath(path) ? this.formatPath(resolvedPath) : this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), "")));
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
return false;
|
|
1445
|
-
}
|
|
1446
|
-
/**
|
|
1447
|
-
* Resolves a path based on TypeScript's `tsconfig.json` paths.
|
|
1448
|
-
*
|
|
1449
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
1450
|
-
*
|
|
1451
|
-
* @param path - The path to check.
|
|
1452
|
-
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1453
|
-
*/
|
|
1454
|
-
resolveTsconfigPathPackage(path) {
|
|
1455
|
-
if (this.#context.tsconfig.options.paths) {
|
|
1456
|
-
const tsconfigPathKeys = Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")));
|
|
1457
|
-
if (tsconfigPathKeys.length > 0 && tsconfigPathKeys[0]) {
|
|
1458
|
-
return tsconfigPathKeys[0].replace(/\/\*$/, "");
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
return false;
|
|
1462
|
-
}
|
|
1463
|
-
/**
|
|
1464
|
-
* Resolves a path or ID to its real path in the virtual file system (VFS).
|
|
1465
|
-
*
|
|
1466
|
-
* @param pathOrId - The path or ID to resolve.
|
|
1467
|
-
* @returns The resolved real path if it exists, otherwise undefined.
|
|
1468
|
-
*/
|
|
1469
|
-
realpathSync(pathOrId) {
|
|
1470
|
-
const filePath = this.resolve(toFilePath(pathOrId));
|
|
1471
|
-
if (!filePath) {
|
|
1472
|
-
throw new Error(`File not found: ${toFilePath(pathOrId)}`);
|
|
1473
|
-
}
|
|
1474
|
-
return filePath;
|
|
1475
|
-
}
|
|
1476
|
-
/**
|
|
1477
|
-
* Resolves a path or ID parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
1478
|
-
*
|
|
1479
|
-
* @param pathOrId - The path or ID to resolve.
|
|
1480
|
-
* @param options - Optional parameters for resolving the path, such as whether to include the file extension.
|
|
1481
|
-
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1482
|
-
*/
|
|
1483
|
-
resolve(pathOrId, options = {}) {
|
|
1484
|
-
const formattedPathOrId = toFilePath(pathOrId);
|
|
1485
|
-
const resolverKey = `${formattedPathOrId}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash.murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
|
|
1486
|
-
if (this.#cachedResolver.has(resolverKey)) {
|
|
1487
|
-
return this.#cachedResolver.get(resolverKey);
|
|
1488
|
-
}
|
|
1489
|
-
let result = this.resolveId(formattedPathOrId);
|
|
1490
|
-
if (!result) {
|
|
1491
|
-
result = this.resolvePath(formattedPathOrId, options);
|
|
1492
|
-
}
|
|
1493
|
-
if (!result) {
|
|
1494
|
-
result = false;
|
|
1495
|
-
}
|
|
1496
|
-
if (result && options.withExtension === false) {
|
|
1497
|
-
return result.replace(/\.[m|c]?[t|j]sx?$/, "");
|
|
1498
|
-
}
|
|
1499
|
-
this.#cachedResolver.set(resolverKey, result);
|
|
1500
|
-
return result;
|
|
1501
|
-
}
|
|
1502
|
-
/**
|
|
1503
|
-
* Retrieves the partial metadata for all files in the virtual file system (VFS).
|
|
1504
|
-
*
|
|
1505
|
-
* @returns A record containing the partial metadata for all files.
|
|
1506
|
-
*/
|
|
1507
|
-
getPartialMeta() {
|
|
1508
|
-
return Object.fromEntries(Object.entries(this.#meta).filter(([_, data]) => isSetObject.isSetObject(data)));
|
|
1509
|
-
}
|
|
1510
|
-
buildRegex(strPattern) {
|
|
1511
|
-
const token = "::GLOBSTAR::";
|
|
1512
|
-
return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
|
|
1513
|
-
}
|
|
1514
|
-
/**
|
|
1515
|
-
* Converts a relative path to an absolute path based on the workspace and project root.
|
|
1516
|
-
*
|
|
1517
|
-
* @param path - The relative path to convert.
|
|
1518
|
-
* @returns The absolute path.
|
|
1519
|
-
*/
|
|
1520
|
-
formatPath(path) {
|
|
1521
|
-
const formattedPath = toFilePath(path);
|
|
1522
|
-
if (isType.isAbsolutePath(formattedPath) || formattedPath.startsWith(this.#context.workspaceConfig.workspaceRoot)) {
|
|
1523
|
-
return formattedPath;
|
|
1524
|
-
} else if (formattedPath.startsWith(this.#context.config.projectRoot)) {
|
|
1525
|
-
return joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, formattedPath);
|
|
1526
|
-
}
|
|
1527
|
-
return formattedPath;
|
|
1528
|
-
}
|
|
1529
|
-
/**
|
|
1530
|
-
* Formats a file id by removing the file extension and prepending the runtime prefix.
|
|
1531
|
-
*
|
|
1532
|
-
* @param id - The file ID to format.
|
|
1533
|
-
* @returns The formatted file ID.
|
|
1534
|
-
*/
|
|
1535
|
-
formatId(id) {
|
|
1536
|
-
const formattedId = toFilePath(id);
|
|
1537
|
-
return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(formattedId), "")}`;
|
|
1538
|
-
}
|
|
1539
|
-
/**
|
|
1540
|
-
* Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
1541
|
-
*
|
|
1542
|
-
* @param id - The id to resolve.
|
|
1543
|
-
* @returns The resolved file id if it exists, otherwise undefined.
|
|
1544
|
-
*/
|
|
1545
|
-
resolveId(id) {
|
|
1546
|
-
if (this.#ids[this.formatId(id)]) {
|
|
1547
|
-
return this.#ids[this.formatId(id)] || false;
|
|
1548
|
-
}
|
|
1549
|
-
return false;
|
|
1550
|
-
}
|
|
1551
|
-
/**
|
|
1552
|
-
* Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
1553
|
-
*
|
|
1554
|
-
* @param path - The path to resolve.
|
|
1555
|
-
* @param options - Optional parameters for resolving the path.
|
|
1556
|
-
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1557
|
-
*/
|
|
1558
|
-
resolvePath(path, options = {}) {
|
|
1559
|
-
if (isType.isAbsolutePath(path)) {
|
|
1560
|
-
if (this.#existsSync(path)) {
|
|
1561
|
-
return path;
|
|
1562
|
-
}
|
|
1563
|
-
const result = this.checkVariants(path);
|
|
1564
|
-
if (result) {
|
|
1565
|
-
return result;
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
for (const parentPath of this.resolveParentPaths(path, options.paths)) {
|
|
1569
|
-
const request = joinPaths.joinPaths(parentPath, path);
|
|
1570
|
-
if (this.#existsSync(request)) {
|
|
1571
|
-
return request;
|
|
1572
|
-
}
|
|
1573
|
-
const result = this.checkVariants(request);
|
|
1574
|
-
if (result) {
|
|
1575
|
-
return result;
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
return false;
|
|
1579
|
-
}
|
|
1580
|
-
resolveParentPaths(request, parents = []) {
|
|
1581
|
-
let paths = [
|
|
1582
|
-
this.#context.workspaceConfig.workspaceRoot,
|
|
1583
|
-
joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
|
|
1584
|
-
];
|
|
1585
|
-
if (this.#context.tsconfig.options.paths) {
|
|
1586
|
-
paths = this.#context.tsconfig.options.paths ? Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => request.startsWith(tsconfigPath.replaceAll("*", ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().reduce((ret, path) => {
|
|
1587
|
-
if (path && !ret.includes(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path))) {
|
|
1588
|
-
ret.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path));
|
|
1589
|
-
}
|
|
1590
|
-
return ret;
|
|
1591
|
-
}, paths) : paths;
|
|
1592
|
-
}
|
|
1593
|
-
return paths.reduce((ret, path) => {
|
|
1594
|
-
if (!ret.includes(path)) {
|
|
1595
|
-
ret.push(path);
|
|
1596
|
-
}
|
|
1597
|
-
return ret;
|
|
1598
|
-
}, parents.filter(Boolean).map((p) => this.formatPath(p)));
|
|
1774
|
+
async stat(pathOrId, options) {
|
|
1775
|
+
return this.#unifiedFS.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1599
1776
|
}
|
|
1600
1777
|
/**
|
|
1601
|
-
*
|
|
1778
|
+
* Synchronously retrieves the status of a file in the virtual file system (VFS).
|
|
1602
1779
|
*
|
|
1603
|
-
* @param
|
|
1604
|
-
* @
|
|
1605
|
-
* @returns The file system module used for the operation.
|
|
1780
|
+
* @param pathOrId - The path or ID of the file to retrieve status for.
|
|
1781
|
+
* @returns The file's status information, or false if the file does not exist.
|
|
1606
1782
|
*/
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
if (mode === "virtual") {
|
|
1610
|
-
return this.#virtualFS;
|
|
1611
|
-
} else if (mode === "fs") {
|
|
1612
|
-
return this.#fs;
|
|
1613
|
-
}
|
|
1614
|
-
return this.#unifiedFS;
|
|
1783
|
+
statSync(pathOrId) {
|
|
1784
|
+
return this.#unifiedFS.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
|
|
1615
1785
|
}
|
|
1616
1786
|
/**
|
|
1617
|
-
*
|
|
1787
|
+
* Retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
1618
1788
|
*
|
|
1619
|
-
* @param
|
|
1620
|
-
* @
|
|
1621
|
-
* @returns The file system module used for the operation.
|
|
1789
|
+
* @param pathOrId - The path or ID of the symbolic link to retrieve status for.
|
|
1790
|
+
* @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
|
|
1622
1791
|
*/
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
return "virtual";
|
|
1626
|
-
} else if (options.mode === "fs" || this.#context.config.output.mode === "fs" || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.dataPath) || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.cachePath) || isParentPath.isParentPath(toFilePath(pathOrUrl), joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
|
|
1627
|
-
return "fs";
|
|
1628
|
-
}
|
|
1629
|
-
return void 0;
|
|
1792
|
+
async lstat(pathOrId, options) {
|
|
1793
|
+
return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1630
1794
|
}
|
|
1631
1795
|
/**
|
|
1632
|
-
*
|
|
1796
|
+
* Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
1633
1797
|
*
|
|
1634
|
-
* @param
|
|
1798
|
+
* @param pathOrId - The path or ID of the symbolic link to retrieve status for.
|
|
1799
|
+
* @returns The symbolic link's status information, or false if the link does not exist.
|
|
1635
1800
|
*/
|
|
1636
|
-
|
|
1637
|
-
this.#
|
|
1801
|
+
lstatSync(pathOrId, options) {
|
|
1802
|
+
return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
1638
1803
|
}
|
|
1639
1804
|
/**
|
|
1640
|
-
*
|
|
1805
|
+
* Resolves a path or ID to its real path in the virtual file system (VFS).
|
|
1641
1806
|
*
|
|
1642
|
-
* @param
|
|
1643
|
-
* @
|
|
1644
|
-
* @returns The file path if it exists, otherwise false.
|
|
1807
|
+
* @param pathOrId - The path or ID to resolve.
|
|
1808
|
+
* @returns The resolved real path if it exists, otherwise undefined.
|
|
1645
1809
|
*/
|
|
1646
|
-
|
|
1647
|
-
const
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
return file;
|
|
1651
|
-
}
|
|
1652
|
-
file = this.checkIndex(path);
|
|
1653
|
-
if (file) {
|
|
1654
|
-
return file;
|
|
1810
|
+
realpathSync(pathOrId) {
|
|
1811
|
+
const filePath = this.resolve(toFilePath(pathOrId));
|
|
1812
|
+
if (!filePath) {
|
|
1813
|
+
throw new Error(`File not found: ${toFilePath(pathOrId)}`);
|
|
1655
1814
|
}
|
|
1656
|
-
return
|
|
1815
|
+
return filePath;
|
|
1657
1816
|
}
|
|
1658
1817
|
/**
|
|
1659
|
-
*
|
|
1818
|
+
* Resolves a path or ID parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
1660
1819
|
*
|
|
1661
|
-
* @param
|
|
1662
|
-
* @
|
|
1820
|
+
* @param pathOrId - The path or ID to resolve.
|
|
1821
|
+
* @param options - Optional parameters for resolving the path, such as whether to include the file extension.
|
|
1822
|
+
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1663
1823
|
*/
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1824
|
+
resolve(pathOrId, options = {}) {
|
|
1825
|
+
const formattedPathOrId = toFilePath(pathOrId);
|
|
1826
|
+
const resolverKey = `${formattedPathOrId}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash.murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
|
|
1827
|
+
if (this.#cachedResolver.has(resolverKey)) {
|
|
1828
|
+
return this.#cachedResolver.get(resolverKey);
|
|
1668
1829
|
}
|
|
1669
|
-
|
|
1670
|
-
if (
|
|
1671
|
-
|
|
1830
|
+
let result = this.#resolveId(formattedPathOrId);
|
|
1831
|
+
if (!result) {
|
|
1832
|
+
result = this.#resolvePath(formattedPathOrId, options);
|
|
1672
1833
|
}
|
|
1673
|
-
|
|
1834
|
+
if (!result) {
|
|
1835
|
+
result = false;
|
|
1836
|
+
}
|
|
1837
|
+
if (result && options.withExtension === false) {
|
|
1838
|
+
return result.replace(/\.[m|c]?[t|j]sx?$/, "");
|
|
1839
|
+
}
|
|
1840
|
+
this.#cachedResolver.set(resolverKey, result);
|
|
1841
|
+
return result;
|
|
1674
1842
|
}
|
|
1675
1843
|
/**
|
|
1676
|
-
*
|
|
1844
|
+
* Converts a relative path to an absolute path based on the workspace and project root.
|
|
1677
1845
|
*
|
|
1678
|
-
* @param
|
|
1679
|
-
* @
|
|
1680
|
-
* @returns The file path if it exists with any of the checked extensions, otherwise false.
|
|
1846
|
+
* @param path - The relative path to convert.
|
|
1847
|
+
* @returns The absolute path.
|
|
1681
1848
|
*/
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
if (this.#
|
|
1685
|
-
return
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
if (this.#existsSync(file)) {
|
|
1689
|
-
return file;
|
|
1690
|
-
}
|
|
1691
|
-
file = `${request}.cts`;
|
|
1692
|
-
if (this.#existsSync(file)) {
|
|
1693
|
-
return file;
|
|
1694
|
-
}
|
|
1695
|
-
file = `${request}.tsx`;
|
|
1696
|
-
if (this.#existsSync(file)) {
|
|
1697
|
-
return file;
|
|
1698
|
-
}
|
|
1699
|
-
file = `${request}.js`;
|
|
1700
|
-
if (this.#existsSync(file)) {
|
|
1701
|
-
return file;
|
|
1702
|
-
}
|
|
1703
|
-
file = `${request}.mjs`;
|
|
1704
|
-
if (this.#existsSync(file)) {
|
|
1705
|
-
return file;
|
|
1706
|
-
}
|
|
1707
|
-
file = `${request}.cjs`;
|
|
1708
|
-
if (this.#existsSync(file)) {
|
|
1709
|
-
return file;
|
|
1849
|
+
formatPath(path) {
|
|
1850
|
+
const formattedPath = toFilePath(path);
|
|
1851
|
+
if (isType.isAbsolutePath(formattedPath) || formattedPath.startsWith(this.#context.workspaceConfig.workspaceRoot)) {
|
|
1852
|
+
return formattedPath;
|
|
1853
|
+
} else if (formattedPath.startsWith(this.#context.config.projectRoot)) {
|
|
1854
|
+
return joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, formattedPath);
|
|
1710
1855
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1856
|
+
return formattedPath;
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* Disposes of the virtual file system (VFS) by saving its state to disk.
|
|
1860
|
+
*/
|
|
1861
|
+
async dispose() {
|
|
1862
|
+
if (!this.#isDisposed) {
|
|
1863
|
+
this.#isDisposed = true;
|
|
1864
|
+
this.#log(types.LogLevelLabel.DEBUG, "Disposing virtual file system...");
|
|
1865
|
+
await this.unlink(joinPaths.joinPaths(this.#context.cachePath, "fs.bin"));
|
|
1866
|
+
const message = new $__namespace.Message();
|
|
1867
|
+
const data = message.initRoot(FileSystemData);
|
|
1868
|
+
const virtualFS = this.#unifiedFS.toJSON();
|
|
1869
|
+
const files = data._initFiles(Object.keys(virtualFS).length);
|
|
1870
|
+
Object.entries(virtualFS).filter(([_, content]) => content).forEach(([path, content], index) => {
|
|
1871
|
+
const fileData = files.get(index);
|
|
1872
|
+
fileData.path = path;
|
|
1873
|
+
fileData.content = content;
|
|
1874
|
+
});
|
|
1875
|
+
const ids = data._initIds(Object.keys(this.ids).length);
|
|
1876
|
+
Object.entries(this.ids).forEach(([id, path], index) => {
|
|
1877
|
+
const fileId = ids.get(index);
|
|
1878
|
+
fileId.id = id;
|
|
1879
|
+
fileId.path = path;
|
|
1880
|
+
});
|
|
1881
|
+
const metadata = data._initMetadata(Object.keys(this.metadata).length);
|
|
1882
|
+
Object.entries(this.metadata).forEach(([id, value], index) => {
|
|
1883
|
+
const fileMetadata = metadata.get(index);
|
|
1884
|
+
fileMetadata.id = id;
|
|
1885
|
+
fileMetadata.mode = value.mode;
|
|
1886
|
+
fileMetadata.variant = value.variant;
|
|
1887
|
+
if (value.properties) {
|
|
1888
|
+
const props = fileMetadata._initProperties(Object.keys(value.properties).length);
|
|
1889
|
+
Object.entries(value.properties).forEach(([key, val], propIndex) => {
|
|
1890
|
+
const propData = props.get(propIndex);
|
|
1891
|
+
propData.key = key;
|
|
1892
|
+
propData.value = val;
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
});
|
|
1896
|
+
await buffer.writeFileBuffer(joinPaths.joinPaths(this.#context.cachePath, "fs.bin"), message.toArrayBuffer());
|
|
1714
1897
|
}
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Initializes the virtual file system (VFS) by patching the file system module if necessary.
|
|
1901
|
+
*/
|
|
1902
|
+
[chunkSVF4ATJR_cjs.__VFS_PATCH__]() {
|
|
1903
|
+
if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
1904
|
+
this.#revert = patchFS(fs__default.default, this);
|
|
1905
|
+
this.#isPatched = true;
|
|
1718
1906
|
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1907
|
+
}
|
|
1908
|
+
/**
|
|
1909
|
+
* Reverts the file system module to its original state if it was previously patched.
|
|
1910
|
+
*/
|
|
1911
|
+
[chunkSVF4ATJR_cjs.__VFS_REVERT__]() {
|
|
1912
|
+
if (this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
1913
|
+
if (!this.#revert) {
|
|
1914
|
+
throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
|
|
1915
|
+
}
|
|
1916
|
+
this.#revert?.();
|
|
1917
|
+
this.#isPatched = false;
|
|
1722
1918
|
}
|
|
1723
|
-
|
|
1919
|
+
}
|
|
1920
|
+
async [Symbol.asyncDispose]() {
|
|
1921
|
+
return this.dispose();
|
|
1724
1922
|
}
|
|
1725
1923
|
};
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1924
|
+
var PROJECT_ROOT_HASH_LENGTH = 45;
|
|
1925
|
+
var CACHE_HASH_LENGTH = 62;
|
|
1926
|
+
function getPrefixedProjectRootHash(name, projectRootHash) {
|
|
1927
|
+
const combined = `${kebabCase.kebabCase(name)}_${projectRootHash}`;
|
|
1928
|
+
return combined.length > PROJECT_ROOT_HASH_LENGTH ? combined.slice(0, PROJECT_ROOT_HASH_LENGTH) : combined;
|
|
1929
|
+
}
|
|
1930
|
+
chunkUSNT2KNT_cjs.__name(getPrefixedProjectRootHash, "getPrefixedProjectRootHash");
|
|
1931
|
+
async function getChecksum(path) {
|
|
1932
|
+
return hashFiles.hashDirectory(path, {
|
|
1933
|
+
ignore: [
|
|
1934
|
+
"node_modules",
|
|
1935
|
+
".git",
|
|
1936
|
+
".nx",
|
|
1937
|
+
".cache",
|
|
1938
|
+
".storm",
|
|
1939
|
+
"tmp",
|
|
1940
|
+
"dist"
|
|
1941
|
+
]
|
|
1942
|
+
});
|
|
1943
|
+
}
|
|
1944
|
+
chunkUSNT2KNT_cjs.__name(getChecksum, "getChecksum");
|
|
1945
|
+
async function writeMetaFile(context) {
|
|
1946
|
+
const metaFilePath = joinPaths.joinPaths(context.dataPath, "meta.json");
|
|
1947
|
+
context.log(types.LogLevelLabel.DEBUG, `Writing runtime metadata to ${metaFilePath}`);
|
|
1948
|
+
await context.fs.writeFile(metaFilePath, JSON.stringify(context.meta, null, 2), {
|
|
1949
|
+
mode: "fs"
|
|
1950
|
+
});
|
|
1951
|
+
}
|
|
1952
|
+
chunkUSNT2KNT_cjs.__name(writeMetaFile, "writeMetaFile");
|
|
1953
|
+
function isPlugin(value) {
|
|
1954
|
+
return isSetObject.isSetObject(value) && "name" in value && isSetString.isSetString(value.name) && (isUndefined.isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction.isFunction(value.applyToEnvironment)) && (isUndefined.isUndefined(value.dedupe) || "dedupe" in value && isFunction.isFunction(value.dedupe)) && (isUndefined.isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) && chunkPAMSESZV_cjs.SUPPORTED_COMMANDS.every((command) => isUndefined.isUndefined(value[command]) || command in value && (isFunction.isFunction(value[command]) || isSetObject.isSetObject(value[command]) && "handler" in value[command] && isFunction.isFunction(value[command].handler)));
|
|
1955
|
+
}
|
|
1956
|
+
chunkUSNT2KNT_cjs.__name(isPlugin, "isPlugin");
|
|
1957
|
+
function isPluginConfigObject(value) {
|
|
1958
|
+
return isSetObject.isSetObject(value) && "plugin" in value && ((isSetString.isSetString(value.plugin) || isFunction.isFunction(value.plugin)) && "options" in value && isSetObject.isSetObject(value.options) || isPlugin(value.plugin));
|
|
1959
|
+
}
|
|
1960
|
+
chunkUSNT2KNT_cjs.__name(isPluginConfigObject, "isPluginConfigObject");
|
|
1961
|
+
function isPluginConfigTuple(value) {
|
|
1962
|
+
return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString.isSetString(value[0]) || isFunction.isFunction(value[0])) && value.length > 1 && isSetObject.isSetObject(value[1]) || isPlugin(value[0]));
|
|
1963
|
+
}
|
|
1964
|
+
chunkUSNT2KNT_cjs.__name(isPluginConfigTuple, "isPluginConfigTuple");
|
|
1965
|
+
function isPluginConfig(value) {
|
|
1966
|
+
return isSetString.isSetString(value) || isFunction.isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
|
|
1967
|
+
}
|
|
1968
|
+
chunkUSNT2KNT_cjs.__name(isPluginConfig, "isPluginConfig");
|
|
1969
|
+
function isPluginHookFunction(value) {
|
|
1970
|
+
return isFunction.isFunction(value) || isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
|
|
1971
|
+
}
|
|
1972
|
+
chunkUSNT2KNT_cjs.__name(isPluginHookFunction, "isPluginHookFunction");
|
|
1973
|
+
function isPluginHookObject(value) {
|
|
1974
|
+
return isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
|
|
1975
|
+
}
|
|
1976
|
+
chunkUSNT2KNT_cjs.__name(isPluginHookObject, "isPluginHookObject");
|
|
1977
|
+
function isPluginHook(value) {
|
|
1978
|
+
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
1979
|
+
}
|
|
1980
|
+
chunkUSNT2KNT_cjs.__name(isPluginHook, "isPluginHook");
|
|
1981
|
+
function getHookHandler(pluginHook) {
|
|
1982
|
+
return isFunction.isFunction(pluginHook) ? pluginHook : pluginHook.handler;
|
|
1983
|
+
}
|
|
1984
|
+
chunkUSNT2KNT_cjs.__name(getHookHandler, "getHookHandler");
|
|
1985
|
+
function isHookExternal(hook) {
|
|
1986
|
+
return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
|
|
1987
|
+
}
|
|
1988
|
+
chunkUSNT2KNT_cjs.__name(isHookExternal, "isHookExternal");
|
|
1989
|
+
function checkDedupe(plugin, plugins) {
|
|
1990
|
+
return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction.isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
1991
|
+
}
|
|
1992
|
+
chunkUSNT2KNT_cjs.__name(checkDedupe, "checkDedupe");
|
|
1993
|
+
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
1994
|
+
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
|
|
1995
|
+
hooksList.push(isFunction.isFunction(pluginHook) ? {
|
|
1996
|
+
plugin,
|
|
1997
|
+
handler: getHookHandler(pluginHook).bind(context)
|
|
1998
|
+
} : {
|
|
1999
|
+
plugin,
|
|
2000
|
+
...pluginHook,
|
|
2001
|
+
handler: getHookHandler(pluginHook).bind(context)
|
|
2002
|
+
});
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
chunkUSNT2KNT_cjs.__name(addPluginHook, "addPluginHook");
|
|
2006
|
+
function resolveOptions(options) {
|
|
2007
|
+
return defu3__default.default(options, {
|
|
2008
|
+
interopDefault: true,
|
|
2009
|
+
fsCache: options.mode !== "development" ? joinPaths.joinPaths(options.cacheDir, "jiti") : false,
|
|
2010
|
+
moduleCache: options.mode !== "development"
|
|
2011
|
+
});
|
|
2012
|
+
}
|
|
2013
|
+
chunkUSNT2KNT_cjs.__name(resolveOptions, "resolveOptions");
|
|
2014
|
+
function createPluginResolver(options) {
|
|
2015
|
+
return jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({
|
|
2016
|
+
...options
|
|
2017
|
+
}));
|
|
2018
|
+
}
|
|
2019
|
+
chunkUSNT2KNT_cjs.__name(createPluginResolver, "createPluginResolver");
|
|
2020
|
+
function createResolver(options) {
|
|
2021
|
+
const baseResolver = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions(options));
|
|
2022
|
+
baseResolver.plugin = createPluginResolver(options);
|
|
2023
|
+
return baseResolver;
|
|
1729
2024
|
}
|
|
1730
|
-
chunkUSNT2KNT_cjs.__name(
|
|
2025
|
+
chunkUSNT2KNT_cjs.__name(createResolver, "createResolver");
|
|
1731
2026
|
|
|
1732
2027
|
// src/internal/contexts/context.ts
|
|
1733
2028
|
var configCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -1767,7 +2062,6 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1767
2062
|
lint: config.lint,
|
|
1768
2063
|
transform: config.transform,
|
|
1769
2064
|
build: config.build,
|
|
1770
|
-
override: config.override,
|
|
1771
2065
|
framework: config.framework
|
|
1772
2066
|
};
|
|
1773
2067
|
}
|
|
@@ -1843,7 +2137,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1843
2137
|
*/
|
|
1844
2138
|
get fs() {
|
|
1845
2139
|
if (!this.#fs) {
|
|
1846
|
-
this.#fs =
|
|
2140
|
+
this.#fs = VirtualFileSystem.createSync(this);
|
|
1847
2141
|
}
|
|
1848
2142
|
return this.#fs;
|
|
1849
2143
|
}
|
|
@@ -1870,9 +2164,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1870
2164
|
}),
|
|
1871
2165
|
configHash: murmurhash.murmurhash(this.config, {
|
|
1872
2166
|
maxLength: CACHE_HASH_LENGTH
|
|
1873
|
-
})
|
|
1874
|
-
builtinIdMap: {},
|
|
1875
|
-
virtualFiles: {}
|
|
2167
|
+
})
|
|
1876
2168
|
};
|
|
1877
2169
|
}
|
|
1878
2170
|
/**
|
|
@@ -1960,13 +2252,13 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1960
2252
|
* The builtin module id that exist in the Powerlines virtual file system
|
|
1961
2253
|
*/
|
|
1962
2254
|
get builtins() {
|
|
1963
|
-
return Object.values(this.fs.
|
|
2255
|
+
return Object.values(this.fs.metadata).filter((meta) => meta && meta.variant === "builtin").map((meta) => meta?.id).filter(Boolean);
|
|
1964
2256
|
}
|
|
1965
2257
|
/**
|
|
1966
|
-
* Get the
|
|
2258
|
+
* Get the builtin virtual files that exist in the Powerlines virtual file system
|
|
1967
2259
|
*/
|
|
1968
2260
|
async getBuiltins() {
|
|
1969
|
-
return Promise.all(Object.entries(this.fs.
|
|
2261
|
+
return Promise.all(Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.variant === "builtin").map(async ([path, meta]) => {
|
|
1970
2262
|
const code = await this.fs.readFile(path);
|
|
1971
2263
|
return {
|
|
1972
2264
|
...meta,
|
|
@@ -1986,7 +2278,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1986
2278
|
return this.fs.writeFile(isType.isAbsolute(path) ? path : append.appendPath(path, this.entryPath), {
|
|
1987
2279
|
code,
|
|
1988
2280
|
variant: "entry"
|
|
1989
|
-
},
|
|
2281
|
+
}, defu3__default.default(options, {
|
|
1990
2282
|
mode: this.config.output.mode
|
|
1991
2283
|
}));
|
|
1992
2284
|
}
|
|
@@ -2003,7 +2295,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2003
2295
|
id,
|
|
2004
2296
|
code,
|
|
2005
2297
|
variant: "builtin"
|
|
2006
|
-
},
|
|
2298
|
+
}, defu3__default.default(options, {
|
|
2007
2299
|
mode: this.config.output.mode
|
|
2008
2300
|
}));
|
|
2009
2301
|
}
|
|
@@ -2025,7 +2317,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2025
2317
|
options
|
|
2026
2318
|
});
|
|
2027
2319
|
}
|
|
2028
|
-
const result = await oxcParser.parseAsync(id, code,
|
|
2320
|
+
const result = await oxcParser.parseAsync(id, code, defu3__default.default(options ?? {}, {
|
|
2029
2321
|
lang: filePathFns.hasFileExtension(id) ? void 0 : "ts",
|
|
2030
2322
|
astType: filePathFns.hasFileExtension(id) ? void 0 : "ts",
|
|
2031
2323
|
sourceType: "module",
|
|
@@ -2213,7 +2505,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2213
2505
|
});
|
|
2214
2506
|
}
|
|
2215
2507
|
if (isSetObject.isSetObject(config)) {
|
|
2216
|
-
this.resolvedConfig =
|
|
2508
|
+
this.resolvedConfig = defu3__default.default({
|
|
2217
2509
|
inlineConfig: this.config.inlineConfig,
|
|
2218
2510
|
userConfig: this.config.userConfig
|
|
2219
2511
|
}, options.isHighPriority ? this.#getConfigProps(config) : {}, {
|
|
@@ -2269,9 +2561,9 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2269
2561
|
eslint: {}
|
|
2270
2562
|
},
|
|
2271
2563
|
build: {
|
|
2272
|
-
target: "esnext"
|
|
2273
|
-
|
|
2274
|
-
|
|
2564
|
+
target: "esnext",
|
|
2565
|
+
override: {}
|
|
2566
|
+
}
|
|
2275
2567
|
});
|
|
2276
2568
|
}
|
|
2277
2569
|
this.config.entry = getUniqueEntries(this.config.entry);
|
|
@@ -2307,9 +2599,10 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2307
2599
|
ret.push(plugin);
|
|
2308
2600
|
return ret;
|
|
2309
2601
|
}, []);
|
|
2602
|
+
this.#fs ??= await VirtualFileSystem.create(this);
|
|
2310
2603
|
}
|
|
2311
2604
|
mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
|
|
2312
|
-
this.config.userConfig =
|
|
2605
|
+
this.config.userConfig = defu3__default.default({
|
|
2313
2606
|
entry: Array.isArray(from.entry) && from.entry.length > 0 ? from.entry : Array.isArray(into?.entry) && into.entry.length > 0 ? into.entry : []
|
|
2314
2607
|
}, omit.omit(from ?? {}, [
|
|
2315
2608
|
"entry"
|
|
@@ -2355,7 +2648,7 @@ async function callHook(context, hook, options, ...args) {
|
|
|
2355
2648
|
if (definedResults.length > 0) {
|
|
2356
2649
|
let mergedResult = void 0;
|
|
2357
2650
|
for (const result of definedResults) {
|
|
2358
|
-
mergedResult =
|
|
2651
|
+
mergedResult = defu3.defu(result, mergedResult ?? {});
|
|
2359
2652
|
}
|
|
2360
2653
|
return mergedResult;
|
|
2361
2654
|
}
|
|
@@ -2665,7 +2958,7 @@ async function emitTypes(context, tsconfig, files) {
|
|
|
2665
2958
|
const emitResult = program.emit(void 0, (fileName, text, _, __, sourceFiles, _data) => {
|
|
2666
2959
|
const sourceFile = sourceFiles?.[0];
|
|
2667
2960
|
if (sourceFile?.fileName && !fileName.endsWith(".map")) {
|
|
2668
|
-
if (context.builtins.some((file) => file === sourceFile.fileName || context.fs.
|
|
2961
|
+
if (context.builtins.some((file) => file === sourceFile.fileName || context.fs.metadata[file]?.id && context.fs.metadata[file]?.id === sourceFile.fileName)) {
|
|
2669
2962
|
builtinModules += `
|
|
2670
2963
|
declare module "${context.fs.resolve(sourceFile.fileName)}" {
|
|
2671
2964
|
${text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
|
|
@@ -2814,7 +3107,7 @@ function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfi
|
|
|
2814
3107
|
if (!tsconfigJson) {
|
|
2815
3108
|
throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${joinPaths.joinPaths(projectRoot, tsconfig ?? "tsconfig.json")}`);
|
|
2816
3109
|
}
|
|
2817
|
-
const parsedCommandLine = ts2__default.default.parseJsonConfigFileContent(
|
|
3110
|
+
const parsedCommandLine = ts2__default.default.parseJsonConfigFileContent(defu3__default.default(tsconfigRaw ?? {}, tsconfigJson), host, append.appendPath(projectRoot, workspaceRoot));
|
|
2818
3111
|
if (parsedCommandLine.errors.length > 0) {
|
|
2819
3112
|
const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:
|
|
2820
3113
|
${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && error.code ? `[${error.category}-${error.code}]: ` : "") + error.messageText.toString()}`).join("\n")}
|
|
@@ -3106,10 +3399,13 @@ ${context.entry.map((entry) => `- ${entry.input.file || entry.file}${entry.outpu
|
|
|
3106
3399
|
await resolveTsconfig(context);
|
|
3107
3400
|
await installDependencies(context);
|
|
3108
3401
|
await this.callPostHook(context, "configResolved");
|
|
3402
|
+
if (context.config.build.polyfill) {
|
|
3403
|
+
context.config.build.polyfill = context.config.build.polyfill.map((polyfill) => replacePathTokens(context, polyfill));
|
|
3404
|
+
}
|
|
3109
3405
|
context.log(types.LogLevelLabel.TRACE, `Powerlines configuration has been resolved:
|
|
3110
3406
|
|
|
3111
3407
|
${console.formatLogMessage(context.config)}`);
|
|
3112
|
-
context.fs[
|
|
3408
|
+
context.fs[chunkSVF4ATJR_cjs.__VFS_PATCH__]();
|
|
3113
3409
|
await writeMetaFile(context);
|
|
3114
3410
|
context.persistedMeta = context.meta;
|
|
3115
3411
|
if (!exists.existsSync(context.cachePath)) {
|
|
@@ -3169,7 +3465,7 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3169
3465
|
joinPaths.joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")
|
|
3170
3466
|
]);
|
|
3171
3467
|
context.log(types.LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
|
|
3172
|
-
const resolvedTsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath,
|
|
3468
|
+
const resolvedTsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath, defu3__default.default({
|
|
3173
3469
|
compilerOptions: {
|
|
3174
3470
|
strict: false,
|
|
3175
3471
|
noEmit: false,
|
|
@@ -3241,7 +3537,7 @@ ${formatTypes(generatedTypes)}
|
|
|
3241
3537
|
}
|
|
3242
3538
|
await this.callPostHook(context, "prepare");
|
|
3243
3539
|
await writeMetaFile(context);
|
|
3244
|
-
context.fs[
|
|
3540
|
+
context.fs[chunkSVF4ATJR_cjs.__VFS_REVERT__]();
|
|
3245
3541
|
});
|
|
3246
3542
|
this.context.log(types.LogLevelLabel.INFO, "Powerlines API has been prepared successfully");
|
|
3247
3543
|
}
|
|
@@ -3371,22 +3667,22 @@ ${formatTypes(generatedTypes)}
|
|
|
3371
3667
|
this.#context.log(types.LogLevelLabel.TRACE, "Powerlines documentation generation completed");
|
|
3372
3668
|
}
|
|
3373
3669
|
/**
|
|
3374
|
-
*
|
|
3670
|
+
* Deploy the project source code
|
|
3375
3671
|
*
|
|
3376
3672
|
* @remarks
|
|
3377
|
-
* This method will prepare and build the Powerlines project, generating the necessary artifacts for
|
|
3673
|
+
* This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
|
|
3378
3674
|
*
|
|
3379
|
-
* @param inlineConfig - The inline configuration for the
|
|
3675
|
+
* @param inlineConfig - The inline configuration for the deploy command
|
|
3380
3676
|
*/
|
|
3381
|
-
async
|
|
3382
|
-
command: "
|
|
3677
|
+
async deploy(inlineConfig = {
|
|
3678
|
+
command: "deploy"
|
|
3383
3679
|
}) {
|
|
3384
|
-
this.context.log(types.LogLevelLabel.INFO, "\u{1F4E6}
|
|
3680
|
+
this.context.log(types.LogLevelLabel.INFO, "\u{1F4E6} Deploying the Powerlines project");
|
|
3385
3681
|
await this.prepare(inlineConfig);
|
|
3386
3682
|
await this.#executeEnvironments(async (context) => {
|
|
3387
|
-
await this.callHook(context, "
|
|
3683
|
+
await this.callHook(context, "deploy");
|
|
3388
3684
|
});
|
|
3389
|
-
this.context.log(types.LogLevelLabel.TRACE, "Powerlines
|
|
3685
|
+
this.context.log(types.LogLevelLabel.TRACE, "Powerlines deploy completed");
|
|
3390
3686
|
}
|
|
3391
3687
|
/**
|
|
3392
3688
|
* Finalization process
|
|
@@ -3400,7 +3696,8 @@ ${formatTypes(generatedTypes)}
|
|
|
3400
3696
|
this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution started");
|
|
3401
3697
|
await this.#executeEnvironments(async (context) => {
|
|
3402
3698
|
await this.callHook(context, "finalize");
|
|
3403
|
-
context.fs[
|
|
3699
|
+
context.fs[chunkSVF4ATJR_cjs.__VFS_REVERT__]();
|
|
3700
|
+
await context.fs.dispose();
|
|
3404
3701
|
});
|
|
3405
3702
|
this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution completed");
|
|
3406
3703
|
}
|
|
@@ -3659,5 +3956,11 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
3659
3956
|
}
|
|
3660
3957
|
};
|
|
3661
3958
|
|
|
3959
|
+
exports.FileData = FileData;
|
|
3960
|
+
exports.FileIdentifier = FileIdentifier;
|
|
3961
|
+
exports.FileMetadata = FileMetadata;
|
|
3962
|
+
exports.FileMetadata_KeyValuePair = FileMetadata_KeyValuePair;
|
|
3963
|
+
exports.FileSystemData = FileSystemData;
|
|
3662
3964
|
exports.PowerlinesAPI = PowerlinesAPI;
|
|
3965
|
+
exports._capnpFileId = _capnpFileId;
|
|
3663
3966
|
exports.createLog = createLog;
|