powerlines 0.10.0 → 0.10.2
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/astro.cjs +9 -9
- package/dist/astro.d.cts +2 -1
- package/dist/astro.d.ts +2 -1
- package/dist/astro.js +6 -6
- package/dist/{chunk-UESICHEO.cjs → chunk-2RHPFVYT.cjs} +17 -18
- package/dist/{chunk-75B5EPR4.js → chunk-3Y5CCIJR.js} +3 -3
- package/dist/{chunk-YE56I7CZ.cjs → chunk-5XYGZ3DC.cjs} +2 -2
- package/dist/{chunk-PFCQFK7H.js → chunk-5Y4JYQ66.js} +3 -3
- package/dist/{chunk-H2SX5ZYF.cjs → chunk-66GXB2UY.cjs} +4 -4
- package/dist/{chunk-VOB62ELC.js → chunk-6TJGZR5X.js} +4 -4
- package/dist/{chunk-BWZCYCIF.js → chunk-6UDHGAAI.js} +3 -3
- package/dist/{chunk-ETEQKM36.cjs → chunk-7IWH37DY.cjs} +2 -2
- package/dist/{chunk-GI35XXXH.js → chunk-EGSEJQCE.js} +3 -3
- package/dist/{chunk-ILVCZATT.js → chunk-GPPJ2CRE.js} +2 -2
- package/dist/{chunk-54SOH6E5.js → chunk-HVT7PBFF.js} +3 -3
- package/dist/chunk-IJBH5OUN.cjs +12 -0
- package/dist/chunk-JBTSAOIQ.js +31 -0
- package/dist/{chunk-MXYZKFOD.js → chunk-KYGEWAEG.js} +3 -3
- package/dist/{chunk-6X6QQH33.cjs → chunk-L2SAK2JC.cjs} +4 -4
- package/dist/chunk-LXMNDUPG.cjs +12 -0
- package/dist/{chunk-V56DIXOO.js → chunk-N7NE3VOU.js} +4 -4
- package/dist/{chunk-D55IOUF3.js → chunk-OYIM2M74.js} +522 -517
- package/dist/{chunk-RRGXS7GZ.cjs → chunk-QHGPZK2H.cjs} +4 -4
- package/dist/chunk-RQ4CHMPO.cjs +12 -0
- package/dist/chunk-S5QFX2GM.cjs +12 -0
- package/dist/{chunk-KCDZ3LCF.js → chunk-S746E63M.js} +3 -3
- package/dist/{chunk-FBBWXUGK.js → chunk-SDEBJQDT.js} +12 -13
- package/dist/chunk-SL3CXJWD.cjs +34 -0
- package/dist/{chunk-I5D3SVUH.cjs → chunk-UHCRNFFC.cjs} +9 -9
- package/dist/{chunk-5ST7UKJF.cjs → chunk-UTVZVGM3.cjs} +530 -525
- package/dist/{chunk-QIKKQQF7.cjs → chunk-UZQYBO6Z.cjs} +4 -4
- package/dist/{chunk-YOHDGH77.js → chunk-VIRKTIPK.js} +3 -3
- package/dist/{chunk-WAWIGYB4.js → chunk-WCPY7HPU.js} +4 -4
- package/dist/{chunk-MMDBMHAW.js → chunk-WPVIF35O.js} +2 -2
- package/dist/chunk-YG7U2GIR.cjs +24 -0
- package/dist/{chunk-DOBCIS3U.cjs → chunk-ZBDP43LG.cjs} +6 -6
- package/dist/chunk-ZFATNDSY.cjs +12 -0
- package/dist/{chunk-4R6CQNB2.js → chunk-ZU4IRZSQ.js} +7 -7
- package/dist/define-config.d.cts +2 -1
- package/dist/define-config.d.ts +2 -1
- package/dist/esbuild.cjs +8 -8
- package/dist/esbuild.d.cts +2 -1
- package/dist/esbuild.d.ts +2 -1
- package/dist/esbuild.js +5 -5
- package/dist/extend-plugin.d.cts +2 -1
- package/dist/extend-plugin.d.ts +2 -1
- package/dist/farm.cjs +4 -4
- package/dist/farm.d.cts +2 -1
- package/dist/farm.d.ts +2 -1
- package/dist/farm.js +3 -3
- package/dist/{hooks-D0gf1nT3.d.ts → hooks-BGYnc61f.d.ts} +1 -1
- package/dist/{hooks-fVJu9DCF.d.cts → hooks-gk8S8LFP.d.cts} +1 -1
- package/dist/index.cjs +27 -27
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +18 -18
- package/dist/internal/api.cjs +3 -3
- package/dist/internal/api.d.cts +3 -2
- package/dist/internal/api.d.ts +3 -2
- package/dist/internal/api.js +2 -2
- package/dist/lib/build/esbuild.cjs +4 -4
- package/dist/lib/build/esbuild.d.cts +2 -1
- package/dist/lib/build/esbuild.d.ts +2 -1
- package/dist/lib/build/esbuild.js +1 -1
- package/dist/lib/build/index.cjs +25 -25
- package/dist/lib/build/index.d.cts +3 -2
- package/dist/lib/build/index.d.ts +3 -2
- package/dist/lib/build/index.js +9 -9
- package/dist/lib/build/rolldown.cjs +3 -3
- package/dist/lib/build/rolldown.d.cts +2 -1
- package/dist/lib/build/rolldown.d.ts +2 -1
- package/dist/lib/build/rolldown.js +2 -2
- package/dist/lib/build/rollup.cjs +3 -3
- package/dist/lib/build/rollup.d.cts +2 -1
- package/dist/lib/build/rollup.d.ts +2 -1
- package/dist/lib/build/rollup.js +1 -1
- package/dist/lib/build/rspack.cjs +2 -2
- package/dist/lib/build/rspack.d.cts +2 -1
- package/dist/lib/build/rspack.d.ts +2 -1
- package/dist/lib/build/rspack.js +1 -1
- package/dist/lib/build/tsup.cjs +5 -5
- package/dist/lib/build/tsup.d.cts +2 -1
- package/dist/lib/build/tsup.d.ts +2 -1
- package/dist/lib/build/tsup.js +2 -2
- package/dist/lib/build/unbuild.cjs +6 -6
- package/dist/lib/build/unbuild.d.cts +3 -2
- package/dist/lib/build/unbuild.d.ts +3 -2
- package/dist/lib/build/unbuild.js +3 -3
- package/dist/lib/build/vite.cjs +4 -4
- package/dist/lib/build/vite.d.cts +2 -1
- package/dist/lib/build/vite.d.ts +2 -1
- package/dist/lib/build/vite.js +2 -2
- package/dist/lib/build/webpack.cjs +2 -2
- package/dist/lib/build/webpack.d.cts +2 -1
- package/dist/lib/build/webpack.d.ts +2 -1
- package/dist/lib/build/webpack.js +1 -1
- package/dist/lib/{chunk-7CZ2QZEV.js → chunk-3I2YOM2E.js} +4 -4
- package/dist/lib/chunk-3I2YOM2E.js.map +1 -0
- package/dist/lib/{chunk-KAOWUIFH.cjs → chunk-4XUVP2LL.cjs} +3 -3
- package/dist/lib/chunk-4XUVP2LL.cjs.map +1 -0
- package/dist/lib/{chunk-ZKYZWEHY.cjs → chunk-6U2UX2PX.cjs} +4 -4
- package/dist/lib/chunk-6U2UX2PX.cjs.map +1 -0
- package/dist/lib/{chunk-VRNWPH35.cjs → chunk-7EAV6Q7B.cjs} +10 -9
- package/dist/lib/chunk-7EAV6Q7B.cjs.map +1 -0
- package/dist/lib/{chunk-ZYBUJ2HE.js → chunk-CAPN4FSS.js} +7 -7
- package/dist/lib/chunk-CAPN4FSS.js.map +1 -0
- package/dist/lib/{chunk-LTBRHAQ2.cjs → chunk-GJNFAFKR.cjs} +4 -4
- package/dist/lib/chunk-GJNFAFKR.cjs.map +1 -0
- package/dist/lib/{chunk-VANFTXBT.cjs → chunk-GWYTWFZE.cjs} +7 -7
- package/dist/lib/chunk-GWYTWFZE.cjs.map +1 -0
- package/dist/lib/{chunk-DKE25WTL.js → chunk-HQ6TGY34.js} +2 -2
- package/dist/lib/chunk-HQ6TGY34.js.map +1 -0
- package/dist/lib/{chunk-QSBORJCS.js → chunk-HZDOJWUO.js} +6 -6
- package/dist/lib/chunk-HZDOJWUO.js.map +1 -0
- package/dist/lib/{chunk-ECJPGNXE.cjs → chunk-IK3ABDPP.cjs} +2 -2
- package/dist/lib/chunk-IK3ABDPP.cjs.map +1 -0
- package/dist/lib/{chunk-G5DJO4HA.cjs → chunk-JTUL3477.cjs} +5 -5
- package/dist/lib/chunk-JTUL3477.cjs.map +1 -0
- package/dist/lib/{chunk-E7UTFXPP.js → chunk-KFE2IR3Y.js} +4 -4
- package/dist/lib/chunk-KFE2IR3Y.js.map +1 -0
- package/dist/lib/{chunk-RY67J24J.js → chunk-KSBESEOF.js} +2 -2
- package/dist/lib/chunk-KSBESEOF.js.map +1 -0
- package/dist/lib/{chunk-26W3IQT6.js → chunk-LTVWU4J2.js} +5 -5
- package/dist/lib/chunk-LTVWU4J2.js.map +1 -0
- package/dist/lib/{chunk-GWAVDFOE.js → chunk-M7U5RMK7.js} +8 -6
- package/dist/lib/chunk-M7U5RMK7.js.map +1 -0
- package/dist/lib/{chunk-2D74QBNW.cjs → chunk-M7WHFUKR.cjs} +524 -522
- package/dist/lib/chunk-M7WHFUKR.cjs.map +1 -0
- package/dist/lib/{chunk-EOO7IRCI.js → chunk-MAHHHINV.js} +3 -3
- package/dist/lib/chunk-MAHHHINV.js.map +1 -0
- package/dist/lib/{chunk-7FQQFIHR.cjs → chunk-NANLYIUO.cjs} +4 -4
- package/dist/lib/chunk-NANLYIUO.cjs.map +1 -0
- package/dist/lib/{chunk-TNCZYSNV.js → chunk-NE46WXNJ.js} +2 -2
- package/dist/lib/chunk-NE46WXNJ.js.map +1 -0
- package/dist/lib/{chunk-QGJVGFY4.js → chunk-OF5IJ4WG.js} +6 -6
- package/dist/lib/chunk-OF5IJ4WG.js.map +1 -0
- package/dist/lib/{chunk-WDNYOFEH.js → chunk-PIFE7MUZ.js} +500 -498
- package/dist/lib/chunk-PIFE7MUZ.js.map +1 -0
- package/dist/lib/{chunk-2ZYHO243.js → chunk-PXSRMP4E.js} +2 -2
- package/dist/lib/chunk-PXSRMP4E.js.map +1 -0
- package/dist/lib/{chunk-CXYZENE4.js → chunk-Q2L3FNJO.js} +13 -7
- package/dist/lib/chunk-Q2L3FNJO.js.map +1 -0
- package/dist/lib/{chunk-XFIGAAKN.cjs → chunk-Q2RUDKWY.cjs} +8 -6
- package/dist/lib/chunk-Q2RUDKWY.cjs.map +1 -0
- package/dist/lib/{chunk-NFDRIBCM.js → chunk-Q3KJZ3B5.js} +5 -7
- package/dist/lib/chunk-Q3KJZ3B5.js.map +1 -0
- package/dist/lib/{chunk-FHZJQZOE.cjs → chunk-QXJHCA3E.cjs} +7 -7
- package/dist/lib/chunk-QXJHCA3E.cjs.map +1 -0
- package/dist/lib/{chunk-TZFBE35T.cjs → chunk-RQICHHZM.cjs} +2 -2
- package/dist/lib/chunk-RQICHHZM.cjs.map +1 -0
- package/dist/lib/{chunk-7MXG5EG2.js → chunk-RXQWNSZX.js} +3 -3
- package/dist/lib/chunk-RXQWNSZX.js.map +1 -0
- package/dist/lib/{chunk-I6A564OE.cjs → chunk-U36VZLW6.cjs} +2 -2
- package/dist/lib/chunk-U36VZLW6.cjs.map +1 -0
- package/dist/lib/{chunk-65DUUIIF.cjs → chunk-UQJWVRRE.cjs} +2 -2
- package/dist/lib/chunk-UQJWVRRE.cjs.map +1 -0
- package/dist/lib/{chunk-XHCRXNQ3.cjs → chunk-V5OY4ALI.cjs} +5 -5
- package/dist/lib/chunk-V5OY4ALI.cjs.map +1 -0
- package/dist/lib/{chunk-I3I4BYJ4.js → chunk-VJN72T2O.js} +5 -5
- package/dist/lib/chunk-VJN72T2O.js.map +1 -0
- package/dist/lib/{chunk-KACTPBW2.cjs → chunk-W4OMKQ7W.cjs} +14 -8
- package/dist/lib/chunk-W4OMKQ7W.cjs.map +1 -0
- package/dist/lib/{chunk-SB3NFYXT.cjs → chunk-XZD7S5TU.cjs} +5 -5
- package/dist/lib/chunk-XZD7S5TU.cjs.map +1 -0
- package/dist/lib/{chunk-PJKWY74P.js → chunk-YBIWVB66.js} +10 -9
- package/dist/lib/chunk-YBIWVB66.js.map +1 -0
- package/dist/lib/{chunk-JXIRUV56.js → chunk-YF3YHK4X.js} +5 -5
- package/dist/lib/chunk-YF3YHK4X.js.map +1 -0
- package/dist/lib/{chunk-TJQEGHJA.cjs → chunk-YVDJCVE5.cjs} +12 -12
- package/dist/lib/chunk-YVDJCVE5.cjs.map +1 -0
- package/dist/lib/{chunk-M2TB43VG.cjs → chunk-ZP7PDTVE.cjs} +7 -9
- package/dist/lib/chunk-ZP7PDTVE.cjs.map +1 -0
- package/dist/lib/{config-BOPIY57U.d.cts → config-AuIGsUck.d.cts} +110 -106
- package/dist/lib/{config-Chd_3Uh3.d.ts → config-B_WTwd49.d.ts} +110 -106
- package/dist/lib/config-file.d.cts +2 -1
- package/dist/lib/config-file.d.ts +2 -1
- package/dist/lib/entry.d.cts +2 -1
- package/dist/lib/entry.d.ts +2 -1
- package/dist/lib/{hooks-DkVRKYVN.d.cts → hooks-4KkL9GD2.d.cts} +1 -1
- package/dist/lib/{hooks-56fQP2HY.d.ts → hooks-DErK4Fv4.d.ts} +1 -1
- package/dist/lib/index.cjs +36 -36
- package/dist/lib/index.d.cts +3 -2
- package/dist/lib/index.d.ts +3 -2
- package/dist/lib/index.js +11 -11
- package/dist/lib/logger.d.cts +2 -1
- package/dist/lib/logger.d.ts +2 -1
- package/dist/lib/typescript/compiler-host.cjs +6 -6
- package/dist/lib/typescript/compiler-host.cjs.map +1 -1
- package/dist/lib/typescript/compiler-host.d.cts +2 -1
- package/dist/lib/typescript/compiler-host.d.ts +2 -1
- package/dist/lib/typescript/compiler-host.js +5 -5
- package/dist/lib/typescript/compiler-host.js.map +1 -1
- package/dist/lib/typescript/import-transformer.cjs +1 -1
- package/dist/lib/typescript/import-transformer.cjs.map +1 -1
- package/dist/lib/typescript/import-transformer.d.cts +2 -1
- package/dist/lib/typescript/import-transformer.d.ts +2 -1
- package/dist/lib/typescript/import-transformer.js +1 -1
- package/dist/lib/typescript/import-transformer.js.map +1 -1
- package/dist/lib/typescript/index.cjs +6 -6
- package/dist/lib/typescript/index.d.cts +2 -1
- package/dist/lib/typescript/index.d.ts +2 -1
- package/dist/lib/typescript/index.js +1 -1
- package/dist/lib/typescript/program.cjs +6 -6
- package/dist/lib/typescript/program.d.cts +2 -1
- package/dist/lib/typescript/program.d.ts +2 -1
- package/dist/lib/typescript/program.js +1 -1
- package/dist/lib/unplugin/factory.cjs +6 -6
- package/dist/lib/unplugin/factory.d.cts +3 -2
- package/dist/lib/unplugin/factory.d.ts +3 -2
- package/dist/lib/unplugin/factory.js +5 -5
- package/dist/lib/unplugin/index.cjs +9 -9
- package/dist/lib/unplugin/index.d.cts +3 -2
- package/dist/lib/unplugin/index.d.ts +3 -2
- package/dist/lib/unplugin/index.js +6 -6
- package/dist/lib/unplugin/plugin.cjs +4 -4
- package/dist/lib/unplugin/plugin.d.cts +2 -1
- package/dist/lib/unplugin/plugin.d.ts +2 -1
- package/dist/lib/unplugin/plugin.js +3 -3
- package/dist/lib/unplugin/resolve-id.cjs +2 -2
- package/dist/lib/unplugin/resolve-id.d.cts +2 -1
- package/dist/lib/unplugin/resolve-id.d.ts +2 -1
- package/dist/lib/unplugin/resolve-id.js +1 -1
- package/dist/lib/utilities/cache.cjs +4 -4
- package/dist/lib/utilities/cache.js +2 -2
- package/dist/lib/utilities/file-header.d.cts +2 -1
- package/dist/lib/utilities/file-header.d.ts +2 -1
- package/dist/lib/utilities/index.cjs +24 -24
- package/dist/lib/utilities/index.d.cts +2 -1
- package/dist/lib/utilities/index.d.ts +2 -1
- package/dist/lib/utilities/index.js +7 -7
- package/dist/lib/utilities/meta.cjs +8 -8
- package/dist/lib/utilities/meta.d.cts +2 -1
- package/dist/lib/utilities/meta.d.ts +2 -1
- package/dist/lib/utilities/meta.js +1 -1
- package/dist/lib/utilities/plugin-helpers.d.cts +2 -1
- package/dist/lib/utilities/plugin-helpers.d.ts +2 -1
- package/dist/lib/utilities/resolve-path.cjs +2 -2
- package/dist/lib/utilities/resolve-path.d.cts +2 -1
- package/dist/lib/utilities/resolve-path.d.ts +2 -1
- package/dist/lib/utilities/resolve-path.js +1 -1
- package/dist/lib/utilities/source-file.cjs +4 -4
- package/dist/lib/utilities/source-file.js +1 -1
- package/dist/lib/utilities/source-map.cjs +2 -2
- package/dist/lib/utilities/source-map.js +1 -1
- package/dist/lib/utilities/worker.cjs +3 -3
- package/dist/lib/utilities/worker.d.cts +2 -1
- package/dist/lib/utilities/worker.d.ts +2 -1
- package/dist/lib/utilities/worker.js +1 -1
- package/dist/lib/utilities/write-file.cjs +2 -2
- package/dist/lib/utilities/write-file.d.cts +2 -1
- package/dist/lib/utilities/write-file.d.ts +2 -1
- package/dist/lib/utilities/write-file.js +1 -1
- package/dist/next.cjs +8 -8
- package/dist/next.js +5 -5
- package/dist/nuxt.cjs +10 -10
- package/dist/nuxt.js +7 -7
- package/dist/{resolved-NZTd64-O.d.cts → resolved-CcuVqMqc.d.cts} +28 -3
- package/dist/{resolved-DhHHMnUD.d.ts → resolved-Dhscmo3z.d.ts} +28 -3
- package/dist/rolldown.cjs +7 -7
- package/dist/rolldown.d.cts +2 -1
- package/dist/rolldown.d.ts +2 -1
- package/dist/rolldown.js +4 -4
- package/dist/rollup.cjs +7 -7
- package/dist/rollup.d.cts +2 -1
- package/dist/rollup.d.ts +2 -1
- package/dist/rollup.js +4 -4
- package/dist/rspack.cjs +7 -7
- package/dist/rspack.d.cts +2 -1
- package/dist/rspack.d.ts +2 -1
- package/dist/rspack.js +4 -4
- package/dist/tsup.cjs +9 -9
- package/dist/tsup.js +6 -6
- package/dist/types/babel.d.cts +2 -1
- package/dist/types/babel.d.ts +2 -1
- package/dist/types/commands.d.cts +2 -1
- package/dist/types/commands.d.ts +2 -1
- package/dist/types/compiler.d.cts +2 -1
- package/dist/types/compiler.d.ts +2 -1
- package/dist/types/config.d.cts +2 -1
- package/dist/types/config.d.ts +2 -1
- package/dist/types/context.cjs +2 -2
- package/dist/types/context.d.cts +2 -1
- package/dist/types/context.d.ts +2 -1
- package/dist/types/context.js +1 -1
- package/dist/types/hooks.d.cts +2 -1
- package/dist/types/hooks.d.ts +2 -1
- package/dist/types/index.cjs +9 -9
- package/dist/types/index.d.cts +3 -2
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.js +2 -2
- package/dist/types/internal.d.cts +3 -2
- package/dist/types/internal.d.ts +3 -2
- package/dist/types/plugin.d.cts +2 -1
- package/dist/types/plugin.d.ts +2 -1
- package/dist/types/resolved.d.cts +2 -1
- package/dist/types/resolved.d.ts +2 -1
- package/dist/types/unplugin.d.cts +2 -1
- package/dist/types/unplugin.d.ts +2 -1
- package/dist/types/vfs.cjs +7 -7
- package/dist/types/vfs.d.cts +93 -111
- package/dist/types/vfs.d.ts +93 -111
- package/dist/types/vfs.js +1 -1
- package/dist/unloader.cjs +7 -7
- package/dist/unloader.d.cts +2 -1
- package/dist/unloader.d.ts +2 -1
- package/dist/unloader.js +4 -4
- package/dist/unplugin.cjs +19 -19
- package/dist/unplugin.d.cts +3 -2
- package/dist/unplugin.d.ts +3 -2
- package/dist/unplugin.js +16 -16
- package/dist/vite.cjs +8 -8
- package/dist/vite.d.cts +2 -1
- package/dist/vite.d.ts +2 -1
- package/dist/vite.js +5 -5
- package/dist/webpack.cjs +7 -7
- package/dist/webpack.d.cts +2 -1
- package/dist/webpack.d.ts +2 -1
- package/dist/webpack.js +4 -4
- package/package.json +9 -13
- package/dist/chunk-6FRFYMLC.cjs +0 -12
- package/dist/chunk-6M3HIMSG.cjs +0 -12
- package/dist/chunk-6ODSQSQL.cjs +0 -34
- package/dist/chunk-HPXUAQCU.cjs +0 -12
- package/dist/chunk-KJHDE76P.cjs +0 -24
- package/dist/chunk-R5CZG7XN.js +0 -31
- package/dist/chunk-RGMGFYXY.cjs +0 -12
- package/dist/chunk-TZ4Y7R4G.cjs +0 -12
- package/dist/lib/chunk-26W3IQT6.js.map +0 -1
- package/dist/lib/chunk-2D74QBNW.cjs.map +0 -1
- package/dist/lib/chunk-2ZYHO243.js.map +0 -1
- package/dist/lib/chunk-65DUUIIF.cjs.map +0 -1
- package/dist/lib/chunk-7CZ2QZEV.js.map +0 -1
- package/dist/lib/chunk-7FQQFIHR.cjs.map +0 -1
- package/dist/lib/chunk-7MXG5EG2.js.map +0 -1
- package/dist/lib/chunk-CXYZENE4.js.map +0 -1
- package/dist/lib/chunk-DKE25WTL.js.map +0 -1
- package/dist/lib/chunk-E7UTFXPP.js.map +0 -1
- package/dist/lib/chunk-ECJPGNXE.cjs.map +0 -1
- package/dist/lib/chunk-EOO7IRCI.js.map +0 -1
- package/dist/lib/chunk-FHZJQZOE.cjs.map +0 -1
- package/dist/lib/chunk-G5DJO4HA.cjs.map +0 -1
- package/dist/lib/chunk-GWAVDFOE.js.map +0 -1
- package/dist/lib/chunk-I3I4BYJ4.js.map +0 -1
- package/dist/lib/chunk-I6A564OE.cjs.map +0 -1
- package/dist/lib/chunk-JXIRUV56.js.map +0 -1
- package/dist/lib/chunk-KACTPBW2.cjs.map +0 -1
- package/dist/lib/chunk-KAOWUIFH.cjs.map +0 -1
- package/dist/lib/chunk-LTBRHAQ2.cjs.map +0 -1
- package/dist/lib/chunk-M2TB43VG.cjs.map +0 -1
- package/dist/lib/chunk-NFDRIBCM.js.map +0 -1
- package/dist/lib/chunk-PJKWY74P.js.map +0 -1
- package/dist/lib/chunk-QGJVGFY4.js.map +0 -1
- package/dist/lib/chunk-QSBORJCS.js.map +0 -1
- package/dist/lib/chunk-RY67J24J.js.map +0 -1
- package/dist/lib/chunk-SB3NFYXT.cjs.map +0 -1
- package/dist/lib/chunk-TJQEGHJA.cjs.map +0 -1
- package/dist/lib/chunk-TNCZYSNV.js.map +0 -1
- package/dist/lib/chunk-TZFBE35T.cjs.map +0 -1
- package/dist/lib/chunk-VANFTXBT.cjs.map +0 -1
- package/dist/lib/chunk-VRNWPH35.cjs.map +0 -1
- package/dist/lib/chunk-WDNYOFEH.js.map +0 -1
- package/dist/lib/chunk-XFIGAAKN.cjs.map +0 -1
- package/dist/lib/chunk-XHCRXNQ3.cjs.map +0 -1
- package/dist/lib/chunk-ZKYZWEHY.cjs.map +0 -1
- package/dist/lib/chunk-ZYBUJ2HE.js.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRQICHHZM_cjs = require('./chunk-RQICHHZM.cjs');
|
|
4
4
|
var chunkMFC7UJHT_cjs = require('./chunk-MFC7UJHT.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkQ2RUDKWY_cjs = require('./chunk-Q2RUDKWY.cjs');
|
|
6
6
|
var chunkRK2VVGL6_cjs = require('./chunk-RK2VVGL6.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunk7EAV6Q7B_cjs = require('./chunk-7EAV6Q7B.cjs');
|
|
8
8
|
var chunkLJZEN4HP_cjs = require('./chunk-LJZEN4HP.cjs');
|
|
9
9
|
var chunkMGEZC2RV_cjs = require('./chunk-MGEZC2RV.cjs');
|
|
10
10
|
var chunk632PWWU7_cjs = require('./chunk-632PWWU7.cjs');
|
|
11
|
-
var
|
|
11
|
+
var chunkUQJWVRRE_cjs = require('./chunk-UQJWVRRE.cjs');
|
|
12
12
|
var chunkBEKLDCTV_cjs = require('./chunk-BEKLDCTV.cjs');
|
|
13
13
|
var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
|
|
14
14
|
var types = require('@storm-software/config-tools/types');
|
|
@@ -22,8 +22,6 @@ var helpers = require('@stryke/fs/helpers');
|
|
|
22
22
|
var install = require('@stryke/fs/install');
|
|
23
23
|
var listFiles = require('@stryke/fs/list-files');
|
|
24
24
|
var packageFns = require('@stryke/fs/package-fns');
|
|
25
|
-
var filePathFns = require('@stryke/path/file-path-fns');
|
|
26
|
-
var isParentPath = require('@stryke/path/is-parent-path');
|
|
27
25
|
var joinPaths = require('@stryke/path/join-paths');
|
|
28
26
|
var replace = require('@stryke/path/replace');
|
|
29
27
|
var isError = require('@stryke/type-checks/is-error');
|
|
@@ -44,6 +42,8 @@ var murmurhash = require('@stryke/hash/murmurhash');
|
|
|
44
42
|
var getUnique = require('@stryke/helpers/get-unique');
|
|
45
43
|
var omit = require('@stryke/helpers/omit');
|
|
46
44
|
var append = require('@stryke/path/append');
|
|
45
|
+
var filePathFns = require('@stryke/path/file-path-fns');
|
|
46
|
+
var isType = require('@stryke/path/is-type');
|
|
47
47
|
var join = require('@stryke/path/join');
|
|
48
48
|
var isNull = require('@stryke/type-checks/is-null');
|
|
49
49
|
var isString = require('@stryke/type-checks/is-string');
|
|
@@ -51,9 +51,10 @@ var uuid = require('@stryke/unique-id/uuid');
|
|
|
51
51
|
var oxcParser = require('oxc-parser');
|
|
52
52
|
var jiti = require('jiti');
|
|
53
53
|
var bufferToString = require('@stryke/convert/buffer-to-string');
|
|
54
|
-
var
|
|
54
|
+
var isParentPath = require('@stryke/path/is-parent-path');
|
|
55
55
|
var prettyBytes = require('@stryke/string-format/pretty-bytes');
|
|
56
56
|
var isBuffer = require('@stryke/type-checks/is-buffer');
|
|
57
|
+
var isUndefined = require('@stryke/type-checks/is-undefined');
|
|
57
58
|
var memfs = require('memfs');
|
|
58
59
|
var buffer = require('buffer');
|
|
59
60
|
var fs = require('fs');
|
|
@@ -161,6 +162,154 @@ function createResolver(options) {
|
|
|
161
162
|
return baseResolver;
|
|
162
163
|
}
|
|
163
164
|
chunkPK6SKIKE_cjs.__name(createResolver, "createResolver");
|
|
165
|
+
function isBufferEncoding(options) {
|
|
166
|
+
return isSetString.isSetString(options) || options === null;
|
|
167
|
+
}
|
|
168
|
+
chunkPK6SKIKE_cjs.__name(isBufferEncoding, "isBufferEncoding");
|
|
169
|
+
function isPowerlinesWriteFileOptions(options) {
|
|
170
|
+
return !isBufferEncoding(options) && isSetObject.isSetObject(options) && ("skipFormat" in options || "mode" in options && (options.mode === "fs" || options.mode === "virtual"));
|
|
171
|
+
}
|
|
172
|
+
chunkPK6SKIKE_cjs.__name(isPowerlinesWriteFileOptions, "isPowerlinesWriteFileOptions");
|
|
173
|
+
function isNodeWriteFileOptions(options) {
|
|
174
|
+
return !isUndefined.isUndefined(options) && (isBufferEncoding(options) || !isPowerlinesWriteFileOptions(options));
|
|
175
|
+
}
|
|
176
|
+
chunkPK6SKIKE_cjs.__name(isNodeWriteFileOptions, "isNodeWriteFileOptions");
|
|
177
|
+
function isPowerLinesWriteFileData(data) {
|
|
178
|
+
return !!(isSetObject.isSetObject(data) && "code" in data && data.code);
|
|
179
|
+
}
|
|
180
|
+
chunkPK6SKIKE_cjs.__name(isPowerLinesWriteFileData, "isPowerLinesWriteFileData");
|
|
181
|
+
var FILE_PREFIX = "file://";
|
|
182
|
+
function toFilePath(pathOrUrl) {
|
|
183
|
+
if (!pathOrUrl) {
|
|
184
|
+
throw new Error("No Path or URL provided to Virtual File System");
|
|
185
|
+
}
|
|
186
|
+
let result = pathOrUrl.toString();
|
|
187
|
+
if (result.startsWith(FILE_PREFIX)) {
|
|
188
|
+
result = result.slice(FILE_PREFIX.length);
|
|
189
|
+
}
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
chunkPK6SKIKE_cjs.__name(toFilePath, "toFilePath");
|
|
193
|
+
var FS_METHODS = [
|
|
194
|
+
"mkdir",
|
|
195
|
+
"mkdirSync",
|
|
196
|
+
"rmdir",
|
|
197
|
+
"rmdirSync",
|
|
198
|
+
"unlink",
|
|
199
|
+
"unlinkSync",
|
|
200
|
+
"existsSync",
|
|
201
|
+
"realpathSync",
|
|
202
|
+
"writeFileSync",
|
|
203
|
+
"readFileSync",
|
|
204
|
+
"readdirSync",
|
|
205
|
+
"createWriteStream",
|
|
206
|
+
"WriteStream",
|
|
207
|
+
"createReadStream",
|
|
208
|
+
"ReadStream"
|
|
209
|
+
];
|
|
210
|
+
var FS_PROMISE_METHODS = [
|
|
211
|
+
"mkdir",
|
|
212
|
+
"rm",
|
|
213
|
+
"rmdir",
|
|
214
|
+
"unlink",
|
|
215
|
+
"writeFile",
|
|
216
|
+
"readFile",
|
|
217
|
+
"readdir",
|
|
218
|
+
"stat",
|
|
219
|
+
"lstat"
|
|
220
|
+
];
|
|
221
|
+
function cloneFS(originalFS) {
|
|
222
|
+
const clonedFS = {
|
|
223
|
+
...originalFS,
|
|
224
|
+
promises: {
|
|
225
|
+
...originalFS.promises ?? {}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
for (const method of FS_METHODS) {
|
|
229
|
+
if (originalFS[method]) {
|
|
230
|
+
clonedFS[method] = originalFS[method];
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
originalFS.promises ??= {};
|
|
234
|
+
for (const method of FS_PROMISE_METHODS) {
|
|
235
|
+
if (originalFS.promises[method]) {
|
|
236
|
+
clonedFS.promises ??= {};
|
|
237
|
+
clonedFS.promises[method] = originalFS.promises[method];
|
|
238
|
+
clonedFS[method] = originalFS.promises[method];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
for (const prop in clonedFS) {
|
|
242
|
+
if (isFunction.isFunction(clonedFS[prop])) {
|
|
243
|
+
clonedFS[prop] = clonedFS[prop].bind(originalFS);
|
|
244
|
+
if (isFunction.isFunction(clonedFS.promises[prop])) {
|
|
245
|
+
clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
for (const prop in clonedFS.promises) {
|
|
250
|
+
if (isFunction.isFunction(clonedFS.promises[prop])) {
|
|
251
|
+
clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return clonedFS;
|
|
255
|
+
}
|
|
256
|
+
chunkPK6SKIKE_cjs.__name(cloneFS, "cloneFS");
|
|
257
|
+
function patchFS(originalFS, vfs) {
|
|
258
|
+
const clonedFS = cloneFS(originalFS);
|
|
259
|
+
originalFS.mkdirSync = (file, options) => vfs.mkdirSync(toFilePath(file), options);
|
|
260
|
+
originalFS.mkdir = (file, options, callback) => vfs.mkdir(toFilePath(file), options, callback);
|
|
261
|
+
originalFS.promises.mkdir = async (file, options) => vfs.mkdir(toFilePath(file), options);
|
|
262
|
+
originalFS.unlinkSync = (file) => vfs.unlinkSync(toFilePath(file));
|
|
263
|
+
originalFS.promises.rm = async (file, options) => vfs.rm(toFilePath(file), options);
|
|
264
|
+
originalFS.promises.unlink = async (file) => vfs.unlink(toFilePath(file));
|
|
265
|
+
originalFS.existsSync = (file) => vfs.existsSync(toFilePath(file));
|
|
266
|
+
Object.defineProperty(originalFS, "realpathSync", {
|
|
267
|
+
value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.realpathSync(toFilePath(file), options), "value")
|
|
268
|
+
});
|
|
269
|
+
originalFS.writeFileSync = (file, data, options) => vfs.writeFileSync(toFilePath(file), data, options);
|
|
270
|
+
originalFS.promises.writeFile = async (file, data, options) => vfs.writeFile(toFilePath(file), data, options);
|
|
271
|
+
originalFS.readFileSync = (file, options) => vfs.readFileSync(toFilePath(file), options);
|
|
272
|
+
originalFS.promises.readFile = (file, options) => vfs.readFile(toFilePath(file), options);
|
|
273
|
+
originalFS.readdirSync = (file, options) => vfs.readdirSync(toFilePath(file), options);
|
|
274
|
+
originalFS.promises.readdir = (file, options) => vfs.readdir(toFilePath(file), options);
|
|
275
|
+
Object.defineProperty(originalFS, "statSync", {
|
|
276
|
+
value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.statSync(toFilePath(file), options), "value")
|
|
277
|
+
});
|
|
278
|
+
originalFS.stat = (file, options) => vfs.statSync(toFilePath(file), options);
|
|
279
|
+
originalFS.promises.stat = (file, options) => vfs.stat(toFilePath(file), options);
|
|
280
|
+
Object.defineProperty(originalFS, "lstatSync", {
|
|
281
|
+
value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.lstatSync(toFilePath(file), options), "value")
|
|
282
|
+
});
|
|
283
|
+
originalFS.lstat = (file, options) => vfs.lstatSync(toFilePath(file), options);
|
|
284
|
+
originalFS.promises.lstat = (file, options) => vfs.lstat(toFilePath(file), options);
|
|
285
|
+
return () => {
|
|
286
|
+
originalFS.mkdirSync = clonedFS.mkdirSync;
|
|
287
|
+
originalFS.mkdir = clonedFS.mkdir;
|
|
288
|
+
originalFS.promises.mkdir = clonedFS.promises.mkdir;
|
|
289
|
+
originalFS.unlinkSync = clonedFS.unlinkSync;
|
|
290
|
+
originalFS.promises.rm = clonedFS.promises.rm;
|
|
291
|
+
originalFS.promises.unlink = clonedFS.promises.unlink;
|
|
292
|
+
originalFS.existsSync = clonedFS.existsSync;
|
|
293
|
+
originalFS.realpathSync = clonedFS.realpathSync;
|
|
294
|
+
originalFS.writeFileSync = clonedFS.writeFileSync;
|
|
295
|
+
originalFS.promises.writeFile = clonedFS.promises.writeFile;
|
|
296
|
+
originalFS.readFileSync = clonedFS.readFileSync;
|
|
297
|
+
originalFS.promises.readFile = clonedFS.promises.readFile;
|
|
298
|
+
originalFS.readdirSync = clonedFS.readdirSync;
|
|
299
|
+
originalFS.promises.readdir = clonedFS.promises.readdir;
|
|
300
|
+
Object.defineProperty(originalFS, "statSync", {
|
|
301
|
+
value: clonedFS.statSync
|
|
302
|
+
});
|
|
303
|
+
originalFS.stat = clonedFS.stat;
|
|
304
|
+
originalFS.promises.stat = clonedFS.promises.stat;
|
|
305
|
+
Object.defineProperty(originalFS, "lstatSync", {
|
|
306
|
+
value: clonedFS.lstatSync
|
|
307
|
+
});
|
|
308
|
+
originalFS.lstat = clonedFS.lstat;
|
|
309
|
+
originalFS.promises.lstat = clonedFS.promises.lstat;
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
chunkPK6SKIKE_cjs.__name(patchFS, "patchFS");
|
|
164
313
|
var VirtualFileSystem = class {
|
|
165
314
|
static {
|
|
166
315
|
chunkPK6SKIKE_cjs.__name(this, "VirtualFileSystem");
|
|
@@ -168,7 +317,11 @@ var VirtualFileSystem = class {
|
|
|
168
317
|
/**
|
|
169
318
|
* The internal map of virtual files.
|
|
170
319
|
*/
|
|
171
|
-
#
|
|
320
|
+
#meta = {};
|
|
321
|
+
/**
|
|
322
|
+
* A map of unique identifiers to their virtual file paths.
|
|
323
|
+
*/
|
|
324
|
+
#ids = {};
|
|
172
325
|
/**
|
|
173
326
|
* A map of virtual file paths to their underlying file content.
|
|
174
327
|
*/
|
|
@@ -209,39 +362,88 @@ var VirtualFileSystem = class {
|
|
|
209
362
|
*/
|
|
210
363
|
#log;
|
|
211
364
|
/**
|
|
365
|
+
* Checks if a path exists in the virtual file system (VFS).
|
|
366
|
+
*
|
|
367
|
+
* @param path - The path to check.
|
|
368
|
+
* @returns `true` if the path exists, otherwise `false`.
|
|
369
|
+
*/
|
|
370
|
+
#existsSync(path) {
|
|
371
|
+
const formattedPath = this.formatPath(path);
|
|
372
|
+
return this.#virtualFS.existsSync(formattedPath) || this.#fs.existsSync(formattedPath) || this.resolveFS(path).existsSync(formattedPath);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
212
375
|
* Exposes the internal VFS map for advanced usage.
|
|
213
376
|
*/
|
|
214
|
-
get [
|
|
377
|
+
get [chunkQ2RUDKWY_cjs.__VFS_CACHE__]() {
|
|
215
378
|
return this.#cachedFS;
|
|
216
379
|
}
|
|
217
380
|
/**
|
|
218
381
|
* Exposes the internal VFS resolver cache for advanced usage.
|
|
219
382
|
*/
|
|
220
|
-
get [
|
|
383
|
+
get [chunkQ2RUDKWY_cjs.__VFS_RESOLVER__]() {
|
|
221
384
|
return this.#cachedResolver;
|
|
222
385
|
}
|
|
223
386
|
/**
|
|
224
387
|
* Exposes the internal VFS map for advanced usage.
|
|
225
388
|
*/
|
|
226
|
-
get [
|
|
389
|
+
get [chunkQ2RUDKWY_cjs.__VFS_VIRTUAL__]() {
|
|
227
390
|
return this.#virtualFS;
|
|
228
391
|
}
|
|
229
392
|
/**
|
|
230
393
|
* Exposes the internal UFS map for advanced usage.
|
|
231
394
|
*/
|
|
232
|
-
get [
|
|
395
|
+
get [chunkQ2RUDKWY_cjs.__VFS_UNIFIED__]() {
|
|
233
396
|
return this.#unifiedFS;
|
|
234
397
|
}
|
|
235
398
|
/**
|
|
399
|
+
* A proxy to access the underlying file metadata.
|
|
400
|
+
*/
|
|
401
|
+
get meta() {
|
|
402
|
+
return new Proxy(this.#meta, {
|
|
403
|
+
get: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
|
|
404
|
+
if (target[prop]) {
|
|
405
|
+
return {
|
|
406
|
+
id: prop,
|
|
407
|
+
mode: this.#virtualFS.existsSync(prop) ? "virtual" : this.#fs.existsSync(prop) ? "fs" : this.#context.config.output.mode,
|
|
408
|
+
details: {},
|
|
409
|
+
variant: "normal",
|
|
410
|
+
...target[prop]
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
return void 0;
|
|
414
|
+
}, "get"),
|
|
415
|
+
set: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop, value) => {
|
|
416
|
+
target[prop] = value;
|
|
417
|
+
this.#ids[value.id || prop] = prop;
|
|
418
|
+
return true;
|
|
419
|
+
}, "set"),
|
|
420
|
+
deleteProperty: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
|
|
421
|
+
delete this.#ids[target[prop]?.id || prop];
|
|
422
|
+
delete target[prop];
|
|
423
|
+
return true;
|
|
424
|
+
}, "deleteProperty")
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* A map of module ids to their file paths.
|
|
429
|
+
*/
|
|
430
|
+
get ids() {
|
|
431
|
+
return this.#ids;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
236
434
|
* Creates a new instance of the VirtualFileSystem.
|
|
237
435
|
*
|
|
238
436
|
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
239
437
|
* @param serialized - A map of files/file contents to populate in cache
|
|
240
438
|
*/
|
|
241
|
-
constructor(context, serialized) {
|
|
439
|
+
constructor(context, serialized = {}) {
|
|
242
440
|
this.#context = context;
|
|
243
441
|
this.#cachedFS = /* @__PURE__ */ new Map();
|
|
244
|
-
this.#
|
|
442
|
+
this.#meta = Object.fromEntries(Object.entries(serialized.virtualFilesMeta ?? {}));
|
|
443
|
+
this.#ids = Object.fromEntries(Object.entries(this.#meta).map(([path, data]) => [
|
|
444
|
+
data.id || path,
|
|
445
|
+
path
|
|
446
|
+
]));
|
|
245
447
|
if (!this.#fs.existsSync(this.#context.dataPath)) {
|
|
246
448
|
this.#fs.mkdirSync(this.#context.dataPath, {
|
|
247
449
|
recursive: true
|
|
@@ -307,13 +509,13 @@ var VirtualFileSystem = class {
|
|
|
307
509
|
}
|
|
308
510
|
this.#log = chunk632PWWU7_cjs.extendLog(this.#context.log, "virtual-file-system");
|
|
309
511
|
}
|
|
310
|
-
[
|
|
512
|
+
[chunkQ2RUDKWY_cjs.__VFS_INIT__]() {
|
|
311
513
|
if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
312
514
|
this.#revert = patchFS(fs__default.default, this);
|
|
313
515
|
this.#isPatched = true;
|
|
314
516
|
}
|
|
315
517
|
}
|
|
316
|
-
[
|
|
518
|
+
[chunkQ2RUDKWY_cjs.__VFS_REVERT__]() {
|
|
317
519
|
if (this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
318
520
|
if (!this.#revert) {
|
|
319
521
|
throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
|
|
@@ -323,65 +525,44 @@ var VirtualFileSystem = class {
|
|
|
323
525
|
}
|
|
324
526
|
}
|
|
325
527
|
/**
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
* @returns A Map where the keys are runtime file IDs (strings) and the values are their corresponding paths (strings).
|
|
329
|
-
*/
|
|
330
|
-
get builtinIdMap() {
|
|
331
|
-
return this.#builtinIdMap;
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Lists all runtime IDs in the virtual file system.
|
|
335
|
-
*
|
|
336
|
-
* @returns An array of formatted runtime IDs.
|
|
337
|
-
*/
|
|
338
|
-
get runtimeIds() {
|
|
339
|
-
return Array.from(this.builtinIdMap.keys()).map((id) => this.formatRuntimeId(id));
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Checks if a given path or ID corresponds to a runtime file.
|
|
528
|
+
* Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
343
529
|
*
|
|
344
|
-
* @param pathOrId - The path or
|
|
345
|
-
* @param options -
|
|
346
|
-
* @returns
|
|
530
|
+
* @param pathOrId - The path or id to check.
|
|
531
|
+
* @param options - Optional parameters for resolving the path.
|
|
532
|
+
* @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
347
533
|
*/
|
|
348
|
-
|
|
349
|
-
|
|
534
|
+
isVirtual(pathOrId, options = {}) {
|
|
535
|
+
if (!pathOrId) {
|
|
536
|
+
return false;
|
|
537
|
+
}
|
|
538
|
+
const resolvedPath = this.resolve(pathOrId, {
|
|
350
539
|
...options,
|
|
351
540
|
type: "file"
|
|
352
|
-
})
|
|
541
|
+
});
|
|
542
|
+
if (!resolvedPath) {
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
return this.meta[resolvedPath]?.mode === "virtual";
|
|
353
546
|
}
|
|
354
547
|
/**
|
|
355
|
-
*
|
|
548
|
+
* Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
356
549
|
*
|
|
357
|
-
* @param
|
|
358
|
-
* @
|
|
550
|
+
* @param pathOrId - The path or id to check.
|
|
551
|
+
* @param options - Optional parameters for resolving the path.
|
|
552
|
+
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
359
553
|
*/
|
|
360
|
-
|
|
361
|
-
return id.startsWith(`${this.#context.config.output.builtinPrefix}:`);
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Check if a path or ID corresponds to a virtual file.
|
|
365
|
-
*
|
|
366
|
-
* @param pathOrId - The path or ID to check.
|
|
367
|
-
* @param options - Options for resolving the path, such as paths to check.
|
|
368
|
-
* @returns Whether the path or ID corresponds to a virtual file.
|
|
369
|
-
*/
|
|
370
|
-
isVirtualFile(pathOrId, options = {}) {
|
|
554
|
+
isFs(pathOrId, options = {}) {
|
|
371
555
|
if (!pathOrId) {
|
|
372
556
|
return false;
|
|
373
557
|
}
|
|
374
|
-
const resolvedPath = this.
|
|
558
|
+
const resolvedPath = this.resolve(pathOrId, {
|
|
375
559
|
...options,
|
|
376
560
|
type: "file"
|
|
377
561
|
});
|
|
378
562
|
if (!resolvedPath) {
|
|
379
563
|
return false;
|
|
380
564
|
}
|
|
381
|
-
|
|
382
|
-
return true;
|
|
383
|
-
}
|
|
384
|
-
return this.#virtualFS.existsSync(resolvedPath);
|
|
565
|
+
return this.meta[resolvedPath]?.mode === "fs";
|
|
385
566
|
}
|
|
386
567
|
/**
|
|
387
568
|
* Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
|
|
@@ -395,37 +576,6 @@ var VirtualFileSystem = class {
|
|
|
395
576
|
return !!this.#context.tsconfig.options.paths && Object.keys(this.#context.tsconfig.options.paths).some((path) => pathOrId.startsWith(path.replaceAll("*", "")));
|
|
396
577
|
}
|
|
397
578
|
/**
|
|
398
|
-
* Checks if a given ID corresponds to a runtime file path.
|
|
399
|
-
*
|
|
400
|
-
* @param id - The unique identifier for the runtime file.
|
|
401
|
-
* @param pathOrId - The path or ID to check.
|
|
402
|
-
* @returns `true` if the ID corresponds to the path or ID of a runtime file, otherwise `false`.
|
|
403
|
-
*/
|
|
404
|
-
isMatchingBuiltinId(id, pathOrId) {
|
|
405
|
-
const resolvedPath = this.resolvePath(pathOrId);
|
|
406
|
-
const resolvedId = this.resolveId(pathOrId);
|
|
407
|
-
return !!(this.isBuiltinFile(pathOrId) && (resolvedPath && (resolvedPath === this.builtinIdMap.get(id) || resolvedPath === this.builtinIdMap.get(this.formatRuntimeId(id))) || resolvedId && (resolvedId === this.builtinIdMap.get(id) || resolvedId === this.builtinIdMap.get(this.formatRuntimeId(id)))));
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Lists all runtime files in the virtual file system.
|
|
411
|
-
*
|
|
412
|
-
* @returns A promise that resolves to an array of runtime files.
|
|
413
|
-
*/
|
|
414
|
-
async listBuiltinFiles() {
|
|
415
|
-
const runtimeFiles = [];
|
|
416
|
-
for (const [id, path] of this.builtinIdMap.entries()) {
|
|
417
|
-
const contents = await this.readFile(path);
|
|
418
|
-
if (contents) {
|
|
419
|
-
runtimeFiles.push({
|
|
420
|
-
id: this.formatRuntimeId(id),
|
|
421
|
-
path,
|
|
422
|
-
contents
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
return runtimeFiles;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
579
|
* Lists files in a given path.
|
|
430
580
|
*
|
|
431
581
|
* @param path - The path to list files from.
|
|
@@ -442,7 +592,7 @@ var VirtualFileSystem = class {
|
|
|
442
592
|
*/
|
|
443
593
|
unlinkSync(path, options) {
|
|
444
594
|
const formattedPath = toFilePath(path);
|
|
445
|
-
if (!this.
|
|
595
|
+
if (!this.isFile(formattedPath)) {
|
|
446
596
|
return;
|
|
447
597
|
}
|
|
448
598
|
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${formattedPath}`);
|
|
@@ -457,7 +607,7 @@ var VirtualFileSystem = class {
|
|
|
457
607
|
*/
|
|
458
608
|
async unlink(path, options) {
|
|
459
609
|
const formattedPath = toFilePath(path);
|
|
460
|
-
if (!this.
|
|
610
|
+
if (!this.isFile(formattedPath)) {
|
|
461
611
|
return;
|
|
462
612
|
}
|
|
463
613
|
this.#log(types.LogLevelLabel.TRACE, `Removing file: ${formattedPath}`);
|
|
@@ -477,7 +627,7 @@ var VirtualFileSystem = class {
|
|
|
477
627
|
*/
|
|
478
628
|
rmdirSync(path, options = {}) {
|
|
479
629
|
const formattedPath = toFilePath(path);
|
|
480
|
-
if (!this.
|
|
630
|
+
if (!this.isDirectory(formattedPath)) {
|
|
481
631
|
return;
|
|
482
632
|
}
|
|
483
633
|
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${formattedPath}`);
|
|
@@ -496,7 +646,7 @@ var VirtualFileSystem = class {
|
|
|
496
646
|
*/
|
|
497
647
|
async rmdir(path, options = {}) {
|
|
498
648
|
const formattedPath = toFilePath(path);
|
|
499
|
-
if (!this.
|
|
649
|
+
if (!this.isDirectory(formattedPath)) {
|
|
500
650
|
return;
|
|
501
651
|
}
|
|
502
652
|
this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${formattedPath}`);
|
|
@@ -523,7 +673,7 @@ var VirtualFileSystem = class {
|
|
|
523
673
|
*/
|
|
524
674
|
async rm(path, options = {}) {
|
|
525
675
|
this.#log(types.LogLevelLabel.TRACE, `Removing: ${toFilePath(path)}`);
|
|
526
|
-
if (this.
|
|
676
|
+
if (this.isDirectory(path)) {
|
|
527
677
|
return this.rmdir(path, options);
|
|
528
678
|
}
|
|
529
679
|
return this.unlink(path, options);
|
|
@@ -567,12 +717,12 @@ var VirtualFileSystem = class {
|
|
|
567
717
|
/**
|
|
568
718
|
* Lists files in a given path.
|
|
569
719
|
*
|
|
570
|
-
* @param
|
|
720
|
+
* @param pathOrId - The path to list files from.
|
|
571
721
|
* @param options - Options for listing files, such as encoding and recursion.
|
|
572
722
|
* @returns An array of file names in the specified path.
|
|
573
723
|
*/
|
|
574
|
-
async readdir(
|
|
575
|
-
return this.resolveFS(
|
|
724
|
+
async readdir(pathOrId, options = "utf8") {
|
|
725
|
+
return this.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
|
|
576
726
|
}
|
|
577
727
|
/**
|
|
578
728
|
* Asynchronously reads a file from the virtual file system (VFS).
|
|
@@ -584,7 +734,7 @@ var VirtualFileSystem = class {
|
|
|
584
734
|
if (!pathOrId) {
|
|
585
735
|
return void 0;
|
|
586
736
|
}
|
|
587
|
-
const filePath = this.
|
|
737
|
+
const filePath = this.resolve(toFilePath(pathOrId), {
|
|
588
738
|
type: "file"
|
|
589
739
|
});
|
|
590
740
|
if (filePath) {
|
|
@@ -613,7 +763,7 @@ var VirtualFileSystem = class {
|
|
|
613
763
|
if (!pathOrId) {
|
|
614
764
|
return void 0;
|
|
615
765
|
}
|
|
616
|
-
const filePath = this.
|
|
766
|
+
const filePath = this.resolve(toFilePath(pathOrId), {
|
|
617
767
|
type: "file"
|
|
618
768
|
});
|
|
619
769
|
if (filePath) {
|
|
@@ -630,137 +780,80 @@ var VirtualFileSystem = class {
|
|
|
630
780
|
/**
|
|
631
781
|
* Writes a file to the virtual file system (VFS).
|
|
632
782
|
*
|
|
633
|
-
* @param
|
|
783
|
+
* @param path - The path to the file.
|
|
634
784
|
* @param data - The contents of the file.
|
|
635
785
|
* @param options - Optional parameters for writing the file.
|
|
636
786
|
* @returns A promise that resolves when the file is written.
|
|
637
787
|
*/
|
|
638
|
-
async writeFile(
|
|
639
|
-
const
|
|
640
|
-
if (!this.
|
|
641
|
-
await this.mkdir(filePathFns.findFilePath(
|
|
788
|
+
async writeFile(path, data = "", options = "utf8") {
|
|
789
|
+
const formattedPath = this.formatPath(path);
|
|
790
|
+
if (!this.isDirectory(filePathFns.findFilePath(formattedPath))) {
|
|
791
|
+
await this.mkdir(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
642
792
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
793
|
+
let code = isPowerLinesWriteFileData(data) ? data.code : data;
|
|
794
|
+
if ((!isPowerlinesWriteFileOptions(options) || !options.skipFormat) && isSetString.isSetString(code)) {
|
|
795
|
+
const resolvedConfig = await prettier.resolveConfig(formattedPath);
|
|
796
|
+
if (resolvedConfig) {
|
|
797
|
+
code = await prettier.format(code, {
|
|
798
|
+
absolutePath: formattedPath,
|
|
799
|
+
...resolvedConfig
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
804
|
+
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)})`);
|
|
805
|
+
this.meta[formattedPath] = {
|
|
806
|
+
path: formattedPath,
|
|
807
|
+
code,
|
|
808
|
+
mode: outputMode,
|
|
809
|
+
variant: "normal",
|
|
810
|
+
...isPowerLinesWriteFileData(data) ? data : {}
|
|
811
|
+
};
|
|
812
|
+
this.clearResolverCache(formattedPath);
|
|
813
|
+
const ifs = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
647
814
|
if (isFunction.isFunction(ifs.promises.writeFile)) {
|
|
648
|
-
return ifs.promises.writeFile(
|
|
649
|
-
"mode"
|
|
650
|
-
]));
|
|
815
|
+
return ifs.promises.writeFile(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
|
|
651
816
|
}
|
|
652
|
-
return ifs.writeFileSync(
|
|
653
|
-
"mode"
|
|
654
|
-
]));
|
|
817
|
+
return ifs.writeFileSync(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
|
|
655
818
|
}
|
|
656
819
|
/**
|
|
657
820
|
* Synchronously writes a file to the virtual file system (VFS).
|
|
658
821
|
*
|
|
659
|
-
* @param
|
|
822
|
+
* @param path - The file to write.
|
|
660
823
|
* @param data - The contents of the file.
|
|
661
824
|
* @param options - Optional parameters for writing the file.
|
|
662
825
|
*/
|
|
663
|
-
writeFileSync(
|
|
664
|
-
const
|
|
665
|
-
if (!this.
|
|
666
|
-
this.mkdirSync(filePathFns.findFilePath(
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
this
|
|
670
|
-
this.
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
826
|
+
writeFileSync(path, data = "", options = "utf8") {
|
|
827
|
+
const formattedPath = this.formatPath(path);
|
|
828
|
+
if (!this.isDirectory(filePathFns.findFilePath(formattedPath))) {
|
|
829
|
+
this.mkdirSync(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
830
|
+
}
|
|
831
|
+
const code = isPowerLinesWriteFileData(data) ? data.code : data;
|
|
832
|
+
const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
833
|
+
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)})`);
|
|
834
|
+
this.meta[formattedPath] = {
|
|
835
|
+
path: formattedPath,
|
|
836
|
+
code,
|
|
837
|
+
mode: outputMode,
|
|
838
|
+
variant: "normal",
|
|
839
|
+
...isPowerLinesWriteFileData(data) ? data : {}
|
|
840
|
+
};
|
|
841
|
+
this.clearResolverCache(formattedPath);
|
|
842
|
+
const writeStream = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
|
|
674
843
|
try {
|
|
675
|
-
writeStream.write(
|
|
844
|
+
writeStream.write(code);
|
|
676
845
|
} finally {
|
|
677
846
|
writeStream.close();
|
|
678
847
|
}
|
|
679
848
|
}
|
|
680
849
|
/**
|
|
681
|
-
* Writes a runtime file to the virtual file system (VFS).
|
|
682
|
-
*
|
|
683
|
-
* @param id - The unique identifier for the runtime file.
|
|
684
|
-
* @param path - The path to the runtime file.
|
|
685
|
-
* @param contents - The contents of the runtime file.
|
|
686
|
-
* @param options - Optional parameters for writing the runtime file.
|
|
687
|
-
* @returns A promise that resolves when the file is written.
|
|
688
|
-
*/
|
|
689
|
-
async writeBuiltinFile(id, path, contents, options = {}) {
|
|
690
|
-
const formattedId = this.formatRuntimeId(id);
|
|
691
|
-
const absolutePath = this.formatAbsoluteFilePath(toFilePath(path));
|
|
692
|
-
this.builtinIdMap.set(formattedId, absolutePath);
|
|
693
|
-
let data = contents;
|
|
694
|
-
if (!options.skipFormat) {
|
|
695
|
-
data = await prettier.format(contents, {
|
|
696
|
-
absolutePath,
|
|
697
|
-
...await prettier.resolveConfig(absolutePath)
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
const _options = defu3__default.default(isSetString.isSetString(options) ? {} : options ?? {}, {
|
|
701
|
-
encoding: isSetString.isSetString(options) ? options : "utf8",
|
|
702
|
-
mode: "virtual"
|
|
703
|
-
});
|
|
704
|
-
this.#log(types.LogLevelLabel.DEBUG, `Writing runtime file ${absolutePath} (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(data)).size)}) to ${this.resolveOutputMode(absolutePath, _options) === "fs" ? "disk" : "memory"}`);
|
|
705
|
-
return this.writeFile(absolutePath, data, _options);
|
|
706
|
-
}
|
|
707
|
-
/**
|
|
708
|
-
* Adds an entry file to the virtual file system.
|
|
709
|
-
*
|
|
710
|
-
* @param name - The file name or absolute path of the entry module.
|
|
711
|
-
* @param contents - The contents of the entry file.
|
|
712
|
-
* @param options - Optional parameters for writing the entry file.
|
|
713
|
-
*/
|
|
714
|
-
async writeEntryFile(name, contents, options = {}) {
|
|
715
|
-
const absolutePath = this.formatAbsoluteFilePath(isType.isAbsolutePath(toFilePath(name)) ? toFilePath(name) : toFilePath(joinPaths.joinPaths(this.#context.entryPath, name)));
|
|
716
|
-
let data = contents;
|
|
717
|
-
if (!options.skipFormat) {
|
|
718
|
-
data = await prettier.format(contents, {
|
|
719
|
-
absolutePath,
|
|
720
|
-
...await prettier.resolveConfig(absolutePath)
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
const _options = defu3__default.default(isSetString.isSetString(options) ? {} : options ?? {}, {
|
|
724
|
-
encoding: isSetString.isSetString(options) ? options : "utf8",
|
|
725
|
-
mode: "virtual"
|
|
726
|
-
});
|
|
727
|
-
this.#log(types.LogLevelLabel.DEBUG, `Writing entry file ${absolutePath} (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(data)).size)}) to ${this.resolveOutputMode(absolutePath, _options) === "fs" ? "disk" : "virtual memory"}`);
|
|
728
|
-
return this.writeFile(absolutePath, data, _options);
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* Writes a file to disk from the physical file system (on disk).
|
|
732
|
-
*
|
|
733
|
-
* @param path - The path to the file to write.
|
|
734
|
-
* @param contents - The contents of the file to write.
|
|
735
|
-
* @param options - Optional parameters for writing the file.
|
|
736
|
-
* @returns A promise that resolves when the file is written.
|
|
737
|
-
*/
|
|
738
|
-
async writeFileToDisk(path, contents, options = {}) {
|
|
739
|
-
const absolutePath = this.formatAbsoluteFilePath(toFilePath(path));
|
|
740
|
-
let data = contents;
|
|
741
|
-
if (!options.skipFormat) {
|
|
742
|
-
const resolvedConfig = await prettier.resolveConfig(absolutePath);
|
|
743
|
-
if (resolvedConfig) {
|
|
744
|
-
data = await prettier.format(contents, {
|
|
745
|
-
absolutePath,
|
|
746
|
-
...resolvedConfig
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
return this.writeFile(absolutePath, data, defu3__default.default({
|
|
751
|
-
mode: "fs"
|
|
752
|
-
}, isSetString.isSetString(options) ? {} : options ?? {}, {
|
|
753
|
-
encoding: isSetString.isSetString(options) ? options : "utf8"
|
|
754
|
-
}));
|
|
755
|
-
}
|
|
756
|
-
/**
|
|
757
850
|
* Synchronously checks if a file exists in the virtual file system (VFS).
|
|
758
851
|
*
|
|
759
852
|
* @param pathOrId - The path or ID of the file to check.
|
|
760
853
|
* @returns `true` if the file exists, otherwise `false`.
|
|
761
854
|
*/
|
|
762
855
|
existsSync(pathOrId) {
|
|
763
|
-
return this.
|
|
856
|
+
return this.resolve(pathOrId) !== false;
|
|
764
857
|
}
|
|
765
858
|
/**
|
|
766
859
|
* Checks if a file exists in the virtual file system (VFS).
|
|
@@ -768,32 +861,22 @@ var VirtualFileSystem = class {
|
|
|
768
861
|
* @remarks
|
|
769
862
|
* This is a base method used by {@link existsSync} - it does not try to resolve the path prior to checking if it exists or not.
|
|
770
863
|
*
|
|
771
|
-
* @param
|
|
864
|
+
* @param pathOrId - The path of the file to check.
|
|
772
865
|
* @returns `true` if the file exists, otherwise `false`.
|
|
773
866
|
*/
|
|
774
|
-
|
|
775
|
-
const
|
|
776
|
-
return
|
|
867
|
+
isFile(pathOrId) {
|
|
868
|
+
const resolved = this.resolve(pathOrId);
|
|
869
|
+
return !!(resolved && (this.#virtualFS.existsSync(resolved) && this.#virtualFS.lstatSync(resolved).isFile() || this.#fs.existsSync(resolved) && this.#fs.lstatSync(resolved).isFile() || this.resolveFS(resolved).existsSync(resolved) && this.resolveFS(resolved).lstatSync(resolved).isFile()));
|
|
777
870
|
}
|
|
778
871
|
/**
|
|
779
872
|
* Checks if a directory exists in the virtual file system (VFS).
|
|
780
873
|
*
|
|
781
|
-
* @param
|
|
874
|
+
* @param pathOrId - The path of the directory to check.
|
|
782
875
|
* @returns `true` if the directory exists, otherwise `false`.
|
|
783
876
|
*/
|
|
784
|
-
|
|
785
|
-
const
|
|
786
|
-
return this.#virtualFS.existsSync(
|
|
787
|
-
}
|
|
788
|
-
/**
|
|
789
|
-
* Checks if a path exists in the virtual file system (VFS).
|
|
790
|
-
*
|
|
791
|
-
* @param path - The path to check.
|
|
792
|
-
* @returns `true` if the path exists, otherwise `false`.
|
|
793
|
-
*/
|
|
794
|
-
pathExistsSync(path) {
|
|
795
|
-
const formattedPath = this.formatAbsoluteFilePath(toFilePath(path));
|
|
796
|
-
return this.isValidBuiltinId(formattedPath) || this.#virtualFS.existsSync(formattedPath) || this.#fs.existsSync(formattedPath) || this.resolveFS(path).existsSync(formattedPath);
|
|
877
|
+
isDirectory(pathOrId) {
|
|
878
|
+
const resolved = this.resolve(pathOrId);
|
|
879
|
+
return !!(resolved && (this.#virtualFS.existsSync(resolved) && this.#virtualFS.lstatSync(resolved).isDirectory() || this.#fs.existsSync(resolved) && this.#fs.lstatSync(resolved).isDirectory() || this.resolveFS(resolved).existsSync(resolved) && this.resolveFS(resolved).lstatSync(resolved).isDirectory()));
|
|
797
880
|
}
|
|
798
881
|
/**
|
|
799
882
|
* Retrieves the status of a file in the virtual file system (VFS).
|
|
@@ -802,7 +885,7 @@ var VirtualFileSystem = class {
|
|
|
802
885
|
* @returns A promise that resolves to the file's status information, or false if the file does not exist.
|
|
803
886
|
*/
|
|
804
887
|
async stat(pathOrId, options) {
|
|
805
|
-
return this.resolveFS(pathOrId).promises.stat(this.
|
|
888
|
+
return this.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
806
889
|
}
|
|
807
890
|
/**
|
|
808
891
|
* Synchronously retrieves the status of a file in the virtual file system (VFS).
|
|
@@ -811,7 +894,7 @@ var VirtualFileSystem = class {
|
|
|
811
894
|
* @returns The file's status information, or false if the file does not exist.
|
|
812
895
|
*/
|
|
813
896
|
statSync(pathOrId) {
|
|
814
|
-
return this.resolveFS(pathOrId).statSync(this.
|
|
897
|
+
return this.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
|
|
815
898
|
}
|
|
816
899
|
/**
|
|
817
900
|
* Retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
@@ -820,7 +903,7 @@ var VirtualFileSystem = class {
|
|
|
820
903
|
* @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
|
|
821
904
|
*/
|
|
822
905
|
async lstat(pathOrId, options) {
|
|
823
|
-
return this.resolveFS(pathOrId).promises.lstat(this.
|
|
906
|
+
return this.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
824
907
|
}
|
|
825
908
|
/**
|
|
826
909
|
* Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
@@ -829,23 +912,7 @@ var VirtualFileSystem = class {
|
|
|
829
912
|
* @returns The symbolic link's status information, or false if the link does not exist.
|
|
830
913
|
*/
|
|
831
914
|
lstatSync(pathOrId, options) {
|
|
832
|
-
return this.resolveFS(pathOrId).lstatSync(this.
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
* Resolves a path or ID to a runtime file id in the virtual file system.
|
|
836
|
-
*
|
|
837
|
-
* @param pathOrId - The path or id of the file to resolve.
|
|
838
|
-
* @returns The resolved id of the runtime file if it exists, otherwise false.
|
|
839
|
-
*/
|
|
840
|
-
resolveId(pathOrId) {
|
|
841
|
-
if (this.builtinIdMap.has(this.formatRuntimeId(toFilePath(pathOrId)))) {
|
|
842
|
-
return this.formatRuntimeId(toFilePath(pathOrId));
|
|
843
|
-
}
|
|
844
|
-
const filePath = this.resolvePath(toFilePath(pathOrId));
|
|
845
|
-
if (filePath) {
|
|
846
|
-
return this.builtinIdMap.keys().find((id) => this.builtinIdMap.get(id) === filePath) || false;
|
|
847
|
-
}
|
|
848
|
-
return false;
|
|
915
|
+
return this.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
|
|
849
916
|
}
|
|
850
917
|
/**
|
|
851
918
|
* Resolves a path based on TypeScript's `tsconfig.json` paths.
|
|
@@ -858,9 +925,9 @@ var VirtualFileSystem = class {
|
|
|
858
925
|
resolveTsconfigPath(path) {
|
|
859
926
|
if (this.#context.tsconfig.options.paths) {
|
|
860
927
|
for (const tsconfigPathKey of Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")))) {
|
|
861
|
-
const resolvedPath = this.#context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath) => this.
|
|
928
|
+
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));
|
|
862
929
|
if (resolvedPath) {
|
|
863
|
-
return this.
|
|
930
|
+
return this.formatPath(resolvedPath) === this.formatPath(path) ? this.formatPath(resolvedPath) : this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), "")));
|
|
864
931
|
}
|
|
865
932
|
}
|
|
866
933
|
}
|
|
@@ -890,7 +957,7 @@ var VirtualFileSystem = class {
|
|
|
890
957
|
* @returns The resolved real path if it exists, otherwise undefined.
|
|
891
958
|
*/
|
|
892
959
|
realpathSync(pathOrId) {
|
|
893
|
-
const filePath = this.
|
|
960
|
+
const filePath = this.resolve(toFilePath(pathOrId));
|
|
894
961
|
if (!filePath) {
|
|
895
962
|
throw new Error(`File not found: ${toFilePath(pathOrId)}`);
|
|
896
963
|
}
|
|
@@ -903,24 +970,18 @@ var VirtualFileSystem = class {
|
|
|
903
970
|
* @param options - Optional parameters for resolving the path, such as whether to include the file extension.
|
|
904
971
|
* @returns The resolved file path if it exists, otherwise undefined.
|
|
905
972
|
*/
|
|
906
|
-
|
|
907
|
-
const
|
|
908
|
-
const resolverKey = `${
|
|
973
|
+
resolve(pathOrId, options = {}) {
|
|
974
|
+
const formattedPathOrId = toFilePath(pathOrId);
|
|
975
|
+
const resolverKey = `${formattedPathOrId}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash.murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
|
|
909
976
|
if (this.#cachedResolver.has(resolverKey)) {
|
|
910
977
|
return this.#cachedResolver.get(resolverKey);
|
|
911
|
-
} else if (this.#cachedFS.has(formattedPath)) {
|
|
912
|
-
return formattedPath;
|
|
913
978
|
}
|
|
914
|
-
let result =
|
|
915
|
-
if (
|
|
916
|
-
result = this.
|
|
917
|
-
} else {
|
|
918
|
-
result = this.resolvePathName(formattedPath, options);
|
|
979
|
+
let result = this.resolveId(formattedPathOrId);
|
|
980
|
+
if (!result) {
|
|
981
|
+
result = this.resolvePath(formattedPathOrId, options);
|
|
919
982
|
}
|
|
920
983
|
if (!result) {
|
|
921
984
|
result = false;
|
|
922
|
-
} else {
|
|
923
|
-
result = toFilePath(result);
|
|
924
985
|
}
|
|
925
986
|
if (result && options.withExtension === false) {
|
|
926
987
|
return result.replace(/\.[m|c]?[t|j]sx?$/, "");
|
|
@@ -929,16 +990,12 @@ var VirtualFileSystem = class {
|
|
|
929
990
|
return result;
|
|
930
991
|
}
|
|
931
992
|
/**
|
|
932
|
-
*
|
|
993
|
+
* Retrieves the partial metadata for all files in the virtual file system (VFS).
|
|
933
994
|
*
|
|
934
|
-
* @
|
|
935
|
-
* @returns The formatted file path.
|
|
995
|
+
* @returns A record containing the partial metadata for all files.
|
|
936
996
|
*/
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
throw new Error(`Invalid path provided. Expected a string or a valid file path.`);
|
|
940
|
-
}
|
|
941
|
-
return path.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "");
|
|
997
|
+
getPartialMeta() {
|
|
998
|
+
return Object.fromEntries(Object.entries(this.#meta).filter(([_, data]) => isSetObject.isSetObject(data)));
|
|
942
999
|
}
|
|
943
1000
|
/**
|
|
944
1001
|
* Converts a relative path to an absolute path based on the workspace and project root.
|
|
@@ -946,56 +1003,67 @@ var VirtualFileSystem = class {
|
|
|
946
1003
|
* @param path - The relative path to convert.
|
|
947
1004
|
* @returns The absolute path.
|
|
948
1005
|
*/
|
|
949
|
-
|
|
950
|
-
const formattedPath =
|
|
1006
|
+
formatPath(path) {
|
|
1007
|
+
const formattedPath = toFilePath(path);
|
|
951
1008
|
if (isType.isAbsolutePath(formattedPath) || formattedPath.startsWith(this.#context.workspaceConfig.workspaceRoot)) {
|
|
952
1009
|
return formattedPath;
|
|
953
1010
|
} else if (formattedPath.startsWith(this.#context.config.projectRoot)) {
|
|
954
1011
|
return joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, formattedPath);
|
|
955
1012
|
}
|
|
956
1013
|
return formattedPath;
|
|
957
|
-
}
|
|
1014
|
+
}
|
|
958
1015
|
/**
|
|
959
|
-
* Formats a
|
|
1016
|
+
* Formats a file id by removing the file extension and prepending the runtime prefix.
|
|
960
1017
|
*
|
|
961
|
-
* @param id - The
|
|
962
|
-
* @returns The formatted
|
|
1018
|
+
* @param id - The file ID to format.
|
|
1019
|
+
* @returns The formatted file ID.
|
|
963
1020
|
*/
|
|
964
|
-
|
|
965
|
-
|
|
1021
|
+
formatId(id) {
|
|
1022
|
+
const formattedId = toFilePath(id);
|
|
1023
|
+
return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileExtensionSafe(formattedId), "")}`;
|
|
966
1024
|
}
|
|
967
1025
|
/**
|
|
968
|
-
* Resolves
|
|
1026
|
+
* Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
969
1027
|
*
|
|
970
|
-
* @param
|
|
971
|
-
* @returns The resolved file
|
|
1028
|
+
* @param id - The id to resolve.
|
|
1029
|
+
* @returns The resolved file id if it exists, otherwise undefined.
|
|
972
1030
|
*/
|
|
973
|
-
|
|
974
|
-
if (
|
|
975
|
-
return false;
|
|
1031
|
+
resolveId(id) {
|
|
1032
|
+
if (this.#ids[this.formatId(id)]) {
|
|
1033
|
+
return this.#ids[this.formatId(id)] || false;
|
|
976
1034
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1035
|
+
return false;
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
|
|
1039
|
+
*
|
|
1040
|
+
* @param path - The path to resolve.
|
|
1041
|
+
* @param options - Optional parameters for resolving the path.
|
|
1042
|
+
* @returns The resolved file path if it exists, otherwise undefined.
|
|
1043
|
+
*/
|
|
1044
|
+
resolvePath(path, options = {}) {
|
|
1045
|
+
if (isType.isAbsolutePath(path)) {
|
|
1046
|
+
if (this.#existsSync(path)) {
|
|
1047
|
+
return path;
|
|
980
1048
|
}
|
|
981
|
-
const result = checkVariants(
|
|
1049
|
+
const result = this.checkVariants(path);
|
|
982
1050
|
if (result) {
|
|
983
1051
|
return result;
|
|
984
1052
|
}
|
|
985
1053
|
}
|
|
986
|
-
for (const
|
|
987
|
-
const request = joinPaths.joinPaths(
|
|
988
|
-
if (
|
|
1054
|
+
for (const parentPath of this.resolveParentPaths(path, options.paths)) {
|
|
1055
|
+
const request = joinPaths.joinPaths(parentPath, path);
|
|
1056
|
+
if (this.#existsSync(request)) {
|
|
989
1057
|
return request;
|
|
990
1058
|
}
|
|
991
|
-
const result = checkVariants(request
|
|
1059
|
+
const result = this.checkVariants(request);
|
|
992
1060
|
if (result) {
|
|
993
1061
|
return result;
|
|
994
1062
|
}
|
|
995
1063
|
}
|
|
996
1064
|
return false;
|
|
997
1065
|
}
|
|
998
|
-
resolveParentPaths(request,
|
|
1066
|
+
resolveParentPaths(request, parents = []) {
|
|
999
1067
|
let paths = [
|
|
1000
1068
|
this.#context.workspaceConfig.workspaceRoot,
|
|
1001
1069
|
joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
|
|
@@ -1013,7 +1081,7 @@ var VirtualFileSystem = class {
|
|
|
1013
1081
|
ret.push(path);
|
|
1014
1082
|
}
|
|
1015
1083
|
return ret;
|
|
1016
|
-
},
|
|
1084
|
+
}, parents.filter(Boolean).map((p) => this.formatPath(p)));
|
|
1017
1085
|
}
|
|
1018
1086
|
/**
|
|
1019
1087
|
* Select the file system module to use for the operation based on the path or URL.
|
|
@@ -1044,7 +1112,7 @@ var VirtualFileSystem = class {
|
|
|
1044
1112
|
} 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))) {
|
|
1045
1113
|
return "fs";
|
|
1046
1114
|
}
|
|
1047
|
-
return
|
|
1115
|
+
return void 0;
|
|
1048
1116
|
}
|
|
1049
1117
|
/**
|
|
1050
1118
|
* Clears the resolver cache for a given path.
|
|
@@ -1054,208 +1122,93 @@ var VirtualFileSystem = class {
|
|
|
1054
1122
|
clearResolverCache(path) {
|
|
1055
1123
|
this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
|
|
1056
1124
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
chunkPK6SKIKE_cjs.__name(toFilePath, "toFilePath");
|
|
1070
|
-
var FS_METHODS = [
|
|
1071
|
-
"mkdir",
|
|
1072
|
-
"mkdirSync",
|
|
1073
|
-
"rmdir",
|
|
1074
|
-
"rmdirSync",
|
|
1075
|
-
"unlink",
|
|
1076
|
-
"unlinkSync",
|
|
1077
|
-
"existsSync",
|
|
1078
|
-
"realpathSync",
|
|
1079
|
-
"writeFileSync",
|
|
1080
|
-
"readFileSync",
|
|
1081
|
-
"readdirSync",
|
|
1082
|
-
"createWriteStream",
|
|
1083
|
-
"WriteStream",
|
|
1084
|
-
"createReadStream",
|
|
1085
|
-
"ReadStream"
|
|
1086
|
-
];
|
|
1087
|
-
var FS_PROMISE_METHODS = [
|
|
1088
|
-
"mkdir",
|
|
1089
|
-
"rm",
|
|
1090
|
-
"rmdir",
|
|
1091
|
-
"unlink",
|
|
1092
|
-
"writeFile",
|
|
1093
|
-
"readFile",
|
|
1094
|
-
"readdir",
|
|
1095
|
-
"stat",
|
|
1096
|
-
"lstat"
|
|
1097
|
-
];
|
|
1098
|
-
function cloneFS(originalFS) {
|
|
1099
|
-
const clonedFS = {
|
|
1100
|
-
...originalFS,
|
|
1101
|
-
promises: {
|
|
1102
|
-
...originalFS.promises ?? {}
|
|
1125
|
+
/**
|
|
1126
|
+
* Check if the file exists with different variants (index, extensions).
|
|
1127
|
+
*
|
|
1128
|
+
* @param request - The request path to check.
|
|
1129
|
+
* @param parentPath - An optional parent path to prepend to the request.
|
|
1130
|
+
* @returns The file path if it exists, otherwise false.
|
|
1131
|
+
*/
|
|
1132
|
+
checkVariants(request, parentPath) {
|
|
1133
|
+
const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
|
|
1134
|
+
let file = this.checkExtensions(path);
|
|
1135
|
+
if (file) {
|
|
1136
|
+
return file;
|
|
1103
1137
|
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
clonedFS[method] = originalFS[method];
|
|
1138
|
+
file = this.checkIndex(path);
|
|
1139
|
+
if (file) {
|
|
1140
|
+
return file;
|
|
1108
1141
|
}
|
|
1142
|
+
return false;
|
|
1109
1143
|
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1144
|
+
/**
|
|
1145
|
+
* Check if the index file exists in the given request path.
|
|
1146
|
+
*
|
|
1147
|
+
* @param request - The request path to check.
|
|
1148
|
+
* @returns The index file path if it exists, otherwise false.
|
|
1149
|
+
*/
|
|
1150
|
+
checkIndex(request) {
|
|
1151
|
+
let file = joinPaths.joinPaths(request, "index");
|
|
1152
|
+
if (this.#existsSync(file)) {
|
|
1153
|
+
return file;
|
|
1116
1154
|
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
clonedFS[prop] = clonedFS[prop].bind(originalFS);
|
|
1121
|
-
if (isFunction.isFunction(clonedFS.promises[prop])) {
|
|
1122
|
-
clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
|
|
1123
|
-
}
|
|
1155
|
+
file = this.checkExtensions(file);
|
|
1156
|
+
if (file) {
|
|
1157
|
+
return file;
|
|
1124
1158
|
}
|
|
1159
|
+
return false;
|
|
1125
1160
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1161
|
+
/**
|
|
1162
|
+
* Check if the file exists with different extensions.
|
|
1163
|
+
*
|
|
1164
|
+
* @param request - The request path to check.
|
|
1165
|
+
* @param vfs - The file system module to use for checking file existence.
|
|
1166
|
+
* @returns The file path if it exists with any of the checked extensions, otherwise false.
|
|
1167
|
+
*/
|
|
1168
|
+
checkExtensions(request) {
|
|
1169
|
+
let file = `${request}.ts`;
|
|
1170
|
+
if (this.#existsSync(file)) {
|
|
1171
|
+
return file;
|
|
1129
1172
|
}
|
|
1173
|
+
file = `${request}.mts`;
|
|
1174
|
+
if (this.#existsSync(file)) {
|
|
1175
|
+
return file;
|
|
1176
|
+
}
|
|
1177
|
+
file = `${request}.cts`;
|
|
1178
|
+
if (this.#existsSync(file)) {
|
|
1179
|
+
return file;
|
|
1180
|
+
}
|
|
1181
|
+
file = `${request}.tsx`;
|
|
1182
|
+
if (this.#existsSync(file)) {
|
|
1183
|
+
return file;
|
|
1184
|
+
}
|
|
1185
|
+
file = `${request}.js`;
|
|
1186
|
+
if (this.#existsSync(file)) {
|
|
1187
|
+
return file;
|
|
1188
|
+
}
|
|
1189
|
+
file = `${request}.mjs`;
|
|
1190
|
+
if (this.#existsSync(file)) {
|
|
1191
|
+
return file;
|
|
1192
|
+
}
|
|
1193
|
+
file = `${request}.cjs`;
|
|
1194
|
+
if (this.#existsSync(file)) {
|
|
1195
|
+
return file;
|
|
1196
|
+
}
|
|
1197
|
+
file = `${request}.jsx`;
|
|
1198
|
+
if (this.#existsSync(file)) {
|
|
1199
|
+
return file;
|
|
1200
|
+
}
|
|
1201
|
+
file = `${request}.json`;
|
|
1202
|
+
if (this.#existsSync(file)) {
|
|
1203
|
+
return file;
|
|
1204
|
+
}
|
|
1205
|
+
file = `${request}.d.ts`;
|
|
1206
|
+
if (this.#existsSync(file)) {
|
|
1207
|
+
return file;
|
|
1208
|
+
}
|
|
1209
|
+
return false;
|
|
1130
1210
|
}
|
|
1131
|
-
|
|
1132
|
-
}
|
|
1133
|
-
chunkPK6SKIKE_cjs.__name(cloneFS, "cloneFS");
|
|
1134
|
-
function patchFS(originalFS, vfs) {
|
|
1135
|
-
const clonedFS = cloneFS(originalFS);
|
|
1136
|
-
originalFS.mkdirSync = (file, options) => vfs.mkdirSync(toFilePath(file), options);
|
|
1137
|
-
originalFS.mkdir = (file, options, callback) => vfs.mkdir(toFilePath(file), options, callback);
|
|
1138
|
-
originalFS.promises.mkdir = async (file, options) => vfs.mkdir(toFilePath(file), options);
|
|
1139
|
-
originalFS.unlinkSync = (file) => vfs.unlinkSync(toFilePath(file));
|
|
1140
|
-
originalFS.promises.rm = async (file, options) => vfs.rm(toFilePath(file), options);
|
|
1141
|
-
originalFS.promises.unlink = async (file) => vfs.unlink(toFilePath(file));
|
|
1142
|
-
originalFS.existsSync = (file) => vfs.existsSync(toFilePath(file));
|
|
1143
|
-
Object.defineProperty(originalFS, "realpathSync", {
|
|
1144
|
-
value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.realpathSync(toFilePath(file), options), "value")
|
|
1145
|
-
});
|
|
1146
|
-
originalFS.writeFileSync = (file, data, options) => vfs.writeFileSync(toFilePath(file), data, options);
|
|
1147
|
-
originalFS.promises.writeFile = async (file, data, options) => vfs.writeFile(toFilePath(file), data, options);
|
|
1148
|
-
originalFS.readFileSync = (file, options) => vfs.readFileSync(toFilePath(file), options);
|
|
1149
|
-
originalFS.promises.readFile = (file, options) => vfs.readFile(toFilePath(file), options);
|
|
1150
|
-
originalFS.readdirSync = (file, options) => vfs.readdirSync(toFilePath(file), options);
|
|
1151
|
-
originalFS.promises.readdir = (file, options) => vfs.readdir(toFilePath(file), options);
|
|
1152
|
-
Object.defineProperty(originalFS, "statSync", {
|
|
1153
|
-
value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.statSync(toFilePath(file), options), "value")
|
|
1154
|
-
});
|
|
1155
|
-
originalFS.stat = (file, options) => vfs.statSync(toFilePath(file), options);
|
|
1156
|
-
originalFS.promises.stat = (file, options) => vfs.stat(toFilePath(file), options);
|
|
1157
|
-
Object.defineProperty(originalFS, "lstatSync", {
|
|
1158
|
-
value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.lstatSync(toFilePath(file), options), "value")
|
|
1159
|
-
});
|
|
1160
|
-
originalFS.lstat = (file, options) => vfs.lstatSync(toFilePath(file), options);
|
|
1161
|
-
originalFS.promises.lstat = (file, options) => vfs.lstat(toFilePath(file), options);
|
|
1162
|
-
return () => {
|
|
1163
|
-
originalFS.mkdirSync = clonedFS.mkdirSync;
|
|
1164
|
-
originalFS.mkdir = clonedFS.mkdir;
|
|
1165
|
-
originalFS.promises.mkdir = clonedFS.promises.mkdir;
|
|
1166
|
-
originalFS.unlinkSync = clonedFS.unlinkSync;
|
|
1167
|
-
originalFS.promises.rm = clonedFS.promises.rm;
|
|
1168
|
-
originalFS.promises.unlink = clonedFS.promises.unlink;
|
|
1169
|
-
originalFS.existsSync = clonedFS.existsSync;
|
|
1170
|
-
originalFS.realpathSync = clonedFS.realpathSync;
|
|
1171
|
-
originalFS.writeFileSync = clonedFS.writeFileSync;
|
|
1172
|
-
originalFS.promises.writeFile = clonedFS.promises.writeFile;
|
|
1173
|
-
originalFS.readFileSync = clonedFS.readFileSync;
|
|
1174
|
-
originalFS.promises.readFile = clonedFS.promises.readFile;
|
|
1175
|
-
originalFS.readdirSync = clonedFS.readdirSync;
|
|
1176
|
-
originalFS.promises.readdir = clonedFS.promises.readdir;
|
|
1177
|
-
Object.defineProperty(originalFS, "statSync", {
|
|
1178
|
-
value: clonedFS.statSync
|
|
1179
|
-
});
|
|
1180
|
-
originalFS.stat = clonedFS.stat;
|
|
1181
|
-
originalFS.promises.stat = clonedFS.promises.stat;
|
|
1182
|
-
Object.defineProperty(originalFS, "lstatSync", {
|
|
1183
|
-
value: clonedFS.lstatSync
|
|
1184
|
-
});
|
|
1185
|
-
originalFS.lstat = clonedFS.lstat;
|
|
1186
|
-
originalFS.promises.lstat = clonedFS.promises.lstat;
|
|
1187
|
-
};
|
|
1188
|
-
}
|
|
1189
|
-
chunkPK6SKIKE_cjs.__name(patchFS, "patchFS");
|
|
1190
|
-
function checkVariants(request, vfs, parentPath) {
|
|
1191
|
-
const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
|
|
1192
|
-
let file = checkExtensions(path, vfs);
|
|
1193
|
-
if (file) {
|
|
1194
|
-
return file;
|
|
1195
|
-
}
|
|
1196
|
-
file = checkIndex(path, vfs);
|
|
1197
|
-
if (file) {
|
|
1198
|
-
return file;
|
|
1199
|
-
}
|
|
1200
|
-
return false;
|
|
1201
|
-
}
|
|
1202
|
-
chunkPK6SKIKE_cjs.__name(checkVariants, "checkVariants");
|
|
1203
|
-
function checkIndex(request, vfs) {
|
|
1204
|
-
let file = joinPaths.joinPaths(request, "index");
|
|
1205
|
-
if (vfs.fileExistsSync(file)) {
|
|
1206
|
-
return file;
|
|
1207
|
-
}
|
|
1208
|
-
file = checkExtensions(file, vfs);
|
|
1209
|
-
if (file) {
|
|
1210
|
-
return file;
|
|
1211
|
-
}
|
|
1212
|
-
return false;
|
|
1213
|
-
}
|
|
1214
|
-
chunkPK6SKIKE_cjs.__name(checkIndex, "checkIndex");
|
|
1215
|
-
function checkExtensions(request, vfs) {
|
|
1216
|
-
let file = `${request}.ts`;
|
|
1217
|
-
if (vfs.fileExistsSync(file)) {
|
|
1218
|
-
return file;
|
|
1219
|
-
}
|
|
1220
|
-
file = `${request}.mts`;
|
|
1221
|
-
if (vfs.fileExistsSync(file)) {
|
|
1222
|
-
return file;
|
|
1223
|
-
}
|
|
1224
|
-
file = `${request}.cts`;
|
|
1225
|
-
if (vfs.fileExistsSync(file)) {
|
|
1226
|
-
return file;
|
|
1227
|
-
}
|
|
1228
|
-
file = `${request}.tsx`;
|
|
1229
|
-
if (vfs.fileExistsSync(file)) {
|
|
1230
|
-
return file;
|
|
1231
|
-
}
|
|
1232
|
-
file = `${request}.js`;
|
|
1233
|
-
if (vfs.fileExistsSync(file)) {
|
|
1234
|
-
return file;
|
|
1235
|
-
}
|
|
1236
|
-
file = `${request}.mjs`;
|
|
1237
|
-
if (vfs.fileExistsSync(file)) {
|
|
1238
|
-
return file;
|
|
1239
|
-
}
|
|
1240
|
-
file = `${request}.cjs`;
|
|
1241
|
-
if (vfs.fileExistsSync(file)) {
|
|
1242
|
-
return file;
|
|
1243
|
-
}
|
|
1244
|
-
file = `${request}.jsx`;
|
|
1245
|
-
if (vfs.fileExistsSync(file)) {
|
|
1246
|
-
return file;
|
|
1247
|
-
}
|
|
1248
|
-
file = `${request}.json`;
|
|
1249
|
-
if (vfs.fileExistsSync(file)) {
|
|
1250
|
-
return file;
|
|
1251
|
-
}
|
|
1252
|
-
file = `${request}.d.ts`;
|
|
1253
|
-
if (vfs.fileExistsSync(file)) {
|
|
1254
|
-
return file;
|
|
1255
|
-
}
|
|
1256
|
-
return false;
|
|
1257
|
-
}
|
|
1258
|
-
chunkPK6SKIKE_cjs.__name(checkExtensions, "checkExtensions");
|
|
1211
|
+
};
|
|
1259
1212
|
function createVfs(context) {
|
|
1260
1213
|
const vfs = new VirtualFileSystem(context);
|
|
1261
1214
|
return vfs;
|
|
@@ -1400,10 +1353,10 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1400
1353
|
workspaceRoot: this.workspaceConfig?.workspaceRoot,
|
|
1401
1354
|
projectRoot: this.config?.projectRoot
|
|
1402
1355
|
}, {
|
|
1403
|
-
maxLength:
|
|
1356
|
+
maxLength: chunkQ2RUDKWY_cjs.PROJECT_ROOT_HASH_LENGTH
|
|
1404
1357
|
}),
|
|
1405
1358
|
configHash: murmurhash.murmurhash(this.config, {
|
|
1406
|
-
maxLength:
|
|
1359
|
+
maxLength: chunkQ2RUDKWY_cjs.CACHE_HASH_LENGTH
|
|
1407
1360
|
}),
|
|
1408
1361
|
builtinIdMap: {},
|
|
1409
1362
|
virtualFiles: {}
|
|
@@ -1465,7 +1418,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1465
1418
|
* Get the path to the data directory for the project
|
|
1466
1419
|
*/
|
|
1467
1420
|
get dataPath() {
|
|
1468
|
-
return join.joinPaths(this.envPaths.data, "projects",
|
|
1421
|
+
return join.joinPaths(this.envPaths.data, "projects", chunkQ2RUDKWY_cjs.getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash));
|
|
1469
1422
|
}
|
|
1470
1423
|
/**
|
|
1471
1424
|
* Get the path to the cache directory for the project
|
|
@@ -1475,7 +1428,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1475
1428
|
checksum: this.#checksum,
|
|
1476
1429
|
config: this.meta.configHash
|
|
1477
1430
|
}, {
|
|
1478
|
-
maxLength:
|
|
1431
|
+
maxLength: chunkQ2RUDKWY_cjs.CACHE_HASH_LENGTH
|
|
1479
1432
|
}));
|
|
1480
1433
|
}
|
|
1481
1434
|
/**
|
|
@@ -1491,6 +1444,57 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1491
1444
|
return getWorkspaceRoot.relativeToWorkspaceRoot(this.config.projectRoot);
|
|
1492
1445
|
}
|
|
1493
1446
|
/**
|
|
1447
|
+
* The builtin module id that exist in the Powerlines virtual file system
|
|
1448
|
+
*/
|
|
1449
|
+
get builtins() {
|
|
1450
|
+
return Object.values(this.fs.meta).filter((meta) => meta && meta.variant === "builtin").map((meta) => meta?.id).filter(Boolean);
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* Get the project root relative to the workspace root
|
|
1454
|
+
*/
|
|
1455
|
+
async getBuiltins() {
|
|
1456
|
+
return Promise.all(Object.entries(this.fs.meta).filter(([, meta]) => meta && meta.variant === "builtin").map(async ([path, meta]) => {
|
|
1457
|
+
const code = await this.fs.readFile(path);
|
|
1458
|
+
return {
|
|
1459
|
+
...meta,
|
|
1460
|
+
path,
|
|
1461
|
+
code
|
|
1462
|
+
};
|
|
1463
|
+
}));
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
1467
|
+
*
|
|
1468
|
+
* @param code - The source code of the entry file
|
|
1469
|
+
* @param path - A path to write the entry file to
|
|
1470
|
+
* @param options - Optional write file options
|
|
1471
|
+
*/
|
|
1472
|
+
async writeEntry(code, path, options = {}) {
|
|
1473
|
+
return this.fs.writeFile(isType.isAbsolute(path) ? path : append.appendPath(path, this.entryPath), {
|
|
1474
|
+
code,
|
|
1475
|
+
variant: "entry"
|
|
1476
|
+
}, defu3__default.default(options, {
|
|
1477
|
+
mode: this.config.output.mode
|
|
1478
|
+
}));
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
1482
|
+
*
|
|
1483
|
+
* @param code - The source code of the builtin file
|
|
1484
|
+
* @param id - The unique identifier of the builtin file
|
|
1485
|
+
* @param path - An optional path to write the builtin file to
|
|
1486
|
+
* @param options - Optional write file options
|
|
1487
|
+
*/
|
|
1488
|
+
async writeBuiltin(code, id, path, options = {}) {
|
|
1489
|
+
return this.fs.writeFile(path ? isType.isAbsolute(path) ? path : join.joinPaths(this.builtinsPath, path) : append.appendPath(id, this.builtinsPath), {
|
|
1490
|
+
id,
|
|
1491
|
+
code,
|
|
1492
|
+
variant: "builtin"
|
|
1493
|
+
}, defu3__default.default(options, {
|
|
1494
|
+
mode: this.config.output.mode
|
|
1495
|
+
}));
|
|
1496
|
+
}
|
|
1497
|
+
/**
|
|
1494
1498
|
* Parses the source code and returns a {@link ParseResult} object.
|
|
1495
1499
|
*
|
|
1496
1500
|
* @param code - The source code to parse.
|
|
@@ -1628,7 +1632,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
1628
1632
|
if (exists.existsSync(packageJsonPath)) {
|
|
1629
1633
|
this.packageJson = await json.readJsonFile(packageJsonPath);
|
|
1630
1634
|
}
|
|
1631
|
-
this.#checksum = await
|
|
1635
|
+
this.#checksum = await chunkQ2RUDKWY_cjs.getChecksum(cacheKey.projectRoot);
|
|
1632
1636
|
this.resolver = createResolver({
|
|
1633
1637
|
workspaceRoot: this.workspaceConfig.workspaceRoot,
|
|
1634
1638
|
projectRoot: cacheKey.projectRoot,
|
|
@@ -2097,7 +2101,7 @@ function resolveModulePath(nodePath, state) {
|
|
|
2097
2101
|
return;
|
|
2098
2102
|
}
|
|
2099
2103
|
const sourcePath = nodePath.node.value;
|
|
2100
|
-
const resolvedPath = state.context?.fs.
|
|
2104
|
+
const resolvedPath = state.context?.fs.resolve(sourcePath);
|
|
2101
2105
|
if (resolvedPath) {
|
|
2102
2106
|
nodePath.replaceWith(t__namespace.stringLiteral(
|
|
2103
2107
|
// Remove the file extension if it exists
|
|
@@ -2198,8 +2202,9 @@ var moduleResolverBabelPlugin = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((contex
|
|
|
2198
2202
|
async function generateTypes(context) {
|
|
2199
2203
|
context.log(types.LogLevelLabel.TRACE, `Preparing the TypeScript definitions for the Powerlines project.`);
|
|
2200
2204
|
context.log(types.LogLevelLabel.TRACE, "Transforming built-ins runtime modules files.");
|
|
2201
|
-
const builtinFiles = await
|
|
2202
|
-
|
|
2205
|
+
const builtinFiles = await context.getBuiltins();
|
|
2206
|
+
const builtinFilePaths = await Promise.all(builtinFiles.map(async (file) => {
|
|
2207
|
+
const result = await core.transformAsync(file.code.toString(), {
|
|
2203
2208
|
highlightCode: true,
|
|
2204
2209
|
code: true,
|
|
2205
2210
|
ast: false,
|
|
@@ -2227,14 +2232,14 @@ async function generateTypes(context) {
|
|
|
2227
2232
|
throw new Error(`Powerlines - Generate Types failed to compile ${file.id}`);
|
|
2228
2233
|
}
|
|
2229
2234
|
context.log(types.LogLevelLabel.TRACE, `Writing transformed built-in runtime file ${file.id}.`);
|
|
2230
|
-
await context.
|
|
2235
|
+
await context.writeBuiltin(result.code, file.id, file.path);
|
|
2231
2236
|
return file.path;
|
|
2232
2237
|
}));
|
|
2233
2238
|
const typescriptPath = await resolve.resolvePackage("typescript");
|
|
2234
2239
|
if (!typescriptPath) {
|
|
2235
2240
|
throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
|
|
2236
2241
|
}
|
|
2237
|
-
const files =
|
|
2242
|
+
const files = builtinFilePaths.reduce((ret, fileName) => {
|
|
2238
2243
|
const formatted = replace.replacePath(fileName, context.workspaceConfig.workspaceRoot);
|
|
2239
2244
|
if (!ret.includes(formatted)) {
|
|
2240
2245
|
ret.push(formatted);
|
|
@@ -2269,9 +2274,9 @@ async function generateTypes(context) {
|
|
|
2269
2274
|
const emitResult = program.emit(void 0, (fileName, text, _, __, sourceFiles, _data) => {
|
|
2270
2275
|
const sourceFile2 = sourceFiles?.[0];
|
|
2271
2276
|
if (sourceFile2?.fileName && !fileName.endsWith(".map")) {
|
|
2272
|
-
if (
|
|
2277
|
+
if (builtinFiles.some((file) => file.id === sourceFile2.fileName || file.path === sourceFile2.fileName)) {
|
|
2273
2278
|
builtinModules += `
|
|
2274
|
-
declare module "${context.fs.
|
|
2279
|
+
declare module "${context.fs.resolve(sourceFile2.fileName)}" {
|
|
2275
2280
|
${text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
|
|
2276
2281
|
}
|
|
2277
2282
|
`;
|
|
@@ -2297,7 +2302,7 @@ declare module "${context.fs.resolveId(sourceFile2.fileName)}" {
|
|
|
2297
2302
|
${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : diagnosticMessage}`);
|
|
2298
2303
|
}
|
|
2299
2304
|
context.log(types.LogLevelLabel.TRACE, `Generating TypeScript declaration file in ${context.config.output.dts}.`);
|
|
2300
|
-
const sourceFile =
|
|
2305
|
+
const sourceFile = chunkUQJWVRRE_cjs.getSourceFile(String(context.config.output.dts), `/// <reference types="powerlines/shared" />${context.config.build.platform !== "neutral" ? `
|
|
2301
2306
|
/// <reference types="powerlines/${context.config.build.platform}" />` : ""}
|
|
2302
2307
|
|
|
2303
2308
|
${chunkMFC7UJHT_cjs.getFileHeader(context, {
|
|
@@ -2310,7 +2315,9 @@ ${builtinModules}`.replace(
|
|
|
2310
2315
|
/import\s*(?:type\s*)?\{?[\w,\s]*(?:\}\s*)?from\s*(?:'|")@?[a-zA-Z0-9-\\/.]*(?:'|");?/g,
|
|
2311
2316
|
""
|
|
2312
2317
|
).replaceAll("#private;", "").replace(/__Ω/g, ""));
|
|
2313
|
-
await context.fs.
|
|
2318
|
+
await context.fs.writeFile(sourceFile.id, chunkUQJWVRRE_cjs.getString(sourceFile.code), {
|
|
2319
|
+
mode: "fs"
|
|
2320
|
+
});
|
|
2314
2321
|
}
|
|
2315
2322
|
chunkPK6SKIKE_cjs.__name(generateTypes, "generateTypes");
|
|
2316
2323
|
async function installPackage(context, packageName, dev = false) {
|
|
@@ -2474,7 +2481,9 @@ async function initializeTsconfig(context) {
|
|
|
2474
2481
|
const tsconfigFilePath = chunkLJZEN4HP_cjs.getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
2475
2482
|
context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
|
|
2476
2483
|
context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
|
|
2477
|
-
await context.fs.
|
|
2484
|
+
await context.fs.writeFile(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson), {
|
|
2485
|
+
mode: "fs"
|
|
2486
|
+
});
|
|
2478
2487
|
context.tsconfig = chunkLJZEN4HP_cjs.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
|
|
2479
2488
|
}
|
|
2480
2489
|
chunkPK6SKIKE_cjs.__name(initializeTsconfig, "initializeTsconfig");
|
|
@@ -2523,7 +2532,7 @@ async function resolveTsconfig(context) {
|
|
|
2523
2532
|
`).join("\n")}
|
|
2524
2533
|
`);
|
|
2525
2534
|
}
|
|
2526
|
-
await
|
|
2535
|
+
await chunkRQICHHZM_cjs.writeFile(context.log, context.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(updateTsconfigJson));
|
|
2527
2536
|
context.tsconfig = chunkLJZEN4HP_cjs.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
2528
2537
|
if (!context.tsconfig) {
|
|
2529
2538
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
@@ -2598,8 +2607,8 @@ ${context.entry.map((entry) => `- ${entry.input.file || entry.file}${entry.outpu
|
|
|
2598
2607
|
context.log(types.LogLevelLabel.TRACE, `Powerlines configuration has been resolved:
|
|
2599
2608
|
|
|
2600
2609
|
${console.formatLogMessage(context.config)}`);
|
|
2601
|
-
context.fs[
|
|
2602
|
-
await
|
|
2610
|
+
context.fs[chunkQ2RUDKWY_cjs.__VFS_INIT__]();
|
|
2611
|
+
await chunkQ2RUDKWY_cjs.writeMetaFile(context);
|
|
2603
2612
|
context.persistedMeta = context.meta;
|
|
2604
2613
|
if (!exists.existsSync(context.cachePath)) {
|
|
2605
2614
|
await helpers.createDirectory(context.cachePath);
|
|
@@ -2610,11 +2619,6 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
2610
2619
|
await this.callPreHook(context, "prepare");
|
|
2611
2620
|
if (context.config.projectType === "application") {
|
|
2612
2621
|
context.log(types.LogLevelLabel.TRACE, "Generating built-in barrel file");
|
|
2613
|
-
await context.fs.writeBuiltinFile("index", joinPaths.joinPaths(context.builtinsPath, "index.ts"), `
|
|
2614
|
-
${chunkMFC7UJHT_cjs.getFileHeader(context)}
|
|
2615
|
-
|
|
2616
|
-
${(await context.fs.listBuiltinFiles()).filter((file) => !isParentPath.isParentPath(file.path, joinPaths.joinPaths(context.builtinsPath, "log")) && !isParentPath.isParentPath(file.path, joinPaths.joinPaths(context.builtinsPath, "storage"))).map((file) => `export * from "./${replace.replacePath(file.path, context.builtinsPath).replace(`.${filePathFns.findFileExtensionSafe(file.path)}`, "")}";`).join("\n")}
|
|
2617
|
-
`);
|
|
2618
2622
|
}
|
|
2619
2623
|
if (context.config.output.dts !== false) {
|
|
2620
2624
|
await generateTypes(context);
|
|
@@ -2625,8 +2629,8 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
2625
2629
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
2626
2630
|
}
|
|
2627
2631
|
await this.callPostHook(context, "prepare");
|
|
2628
|
-
await
|
|
2629
|
-
context.fs[
|
|
2632
|
+
await chunkQ2RUDKWY_cjs.writeMetaFile(context);
|
|
2633
|
+
context.fs[chunkQ2RUDKWY_cjs.__VFS_REVERT__]();
|
|
2630
2634
|
});
|
|
2631
2635
|
this.context.log(types.LogLevelLabel.INFO, "Powerlines API has been prepared successfully");
|
|
2632
2636
|
}
|
|
@@ -2649,7 +2653,7 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
2649
2653
|
for (const file of files) {
|
|
2650
2654
|
context.log(types.LogLevelLabel.TRACE, `Adding template file: ${file}`);
|
|
2651
2655
|
const template = Handlebars__default.default.compile(file);
|
|
2652
|
-
await
|
|
2656
|
+
await chunkRQICHHZM_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
2653
2657
|
}
|
|
2654
2658
|
await this.callNormalHook(context, "new");
|
|
2655
2659
|
if (context.config.projectType === "application") {
|
|
@@ -2657,14 +2661,14 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
2657
2661
|
for (const file of files2) {
|
|
2658
2662
|
context.log(types.LogLevelLabel.TRACE, `Adding application template file: ${file}`);
|
|
2659
2663
|
const template = Handlebars__default.default.compile(file);
|
|
2660
|
-
await
|
|
2664
|
+
await chunkRQICHHZM_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
2661
2665
|
}
|
|
2662
2666
|
} else {
|
|
2663
2667
|
const files2 = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/library/**/*.hbs"));
|
|
2664
2668
|
for (const file of files2) {
|
|
2665
2669
|
context.log(types.LogLevelLabel.TRACE, `Adding library template file: ${file}`);
|
|
2666
2670
|
const template = Handlebars__default.default.compile(file);
|
|
2667
|
-
await
|
|
2671
|
+
await chunkRQICHHZM_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
2668
2672
|
}
|
|
2669
2673
|
}
|
|
2670
2674
|
await this.callPostHook(context, "new");
|
|
@@ -2785,7 +2789,7 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
2785
2789
|
this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution started");
|
|
2786
2790
|
await this.#executeEnvironments(async (context) => {
|
|
2787
2791
|
await this.callHook(context, "finalize");
|
|
2788
|
-
context.fs[
|
|
2792
|
+
context.fs[chunkQ2RUDKWY_cjs.__VFS_REVERT__]();
|
|
2789
2793
|
});
|
|
2790
2794
|
this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution completed");
|
|
2791
2795
|
}
|
|
@@ -3073,7 +3077,7 @@ function createUnpluginFactory(variant, decorate) {
|
|
|
3073
3077
|
async function resolveId(id, importer, options = {
|
|
3074
3078
|
isEntry: false
|
|
3075
3079
|
}) {
|
|
3076
|
-
return
|
|
3080
|
+
return chunk7EAV6Q7B_cjs.handleResolveId(api.context, {
|
|
3077
3081
|
id,
|
|
3078
3082
|
importer,
|
|
3079
3083
|
options
|
|
@@ -3088,9 +3092,7 @@ function createUnpluginFactory(variant, decorate) {
|
|
|
3088
3092
|
async function load(id) {
|
|
3089
3093
|
const environment = await api.context.getEnvironment();
|
|
3090
3094
|
if (id) {
|
|
3091
|
-
const resolvedPath = environment.fs.
|
|
3092
|
-
type: "file"
|
|
3093
|
-
});
|
|
3095
|
+
const resolvedPath = environment.fs.resolve(id);
|
|
3094
3096
|
if (resolvedPath) {
|
|
3095
3097
|
return environment.fs.readFile(resolvedPath);
|
|
3096
3098
|
}
|
|
@@ -3109,15 +3111,15 @@ function createUnpluginFactory(variant, decorate) {
|
|
|
3109
3111
|
async function transform(code, id) {
|
|
3110
3112
|
const environment = await api.context.getEnvironment();
|
|
3111
3113
|
let transformed = code;
|
|
3112
|
-
let result2 = await api.callPreHook(environment, "transform",
|
|
3114
|
+
let result2 = await api.callPreHook(environment, "transform", chunkUQJWVRRE_cjs.getString(transformed), id);
|
|
3113
3115
|
if (result2) {
|
|
3114
3116
|
transformed = result2;
|
|
3115
3117
|
}
|
|
3116
|
-
result2 = await api.callNormalHook(environment, "transform",
|
|
3118
|
+
result2 = await api.callNormalHook(environment, "transform", chunkUQJWVRRE_cjs.getString(transformed), id);
|
|
3117
3119
|
if (result2) {
|
|
3118
3120
|
transformed = result2;
|
|
3119
3121
|
}
|
|
3120
|
-
result2 = await api.callPostHook(environment, "transform",
|
|
3122
|
+
result2 = await api.callPostHook(environment, "transform", chunkUQJWVRRE_cjs.getString(transformed), id);
|
|
3121
3123
|
if (result2) {
|
|
3122
3124
|
transformed = result2;
|
|
3123
3125
|
}
|
|
@@ -3167,5 +3169,5 @@ function createUnpluginFactory(variant, decorate) {
|
|
|
3167
3169
|
chunkPK6SKIKE_cjs.__name(createUnpluginFactory, "createUnpluginFactory");
|
|
3168
3170
|
|
|
3169
3171
|
exports.createUnpluginFactory = createUnpluginFactory;
|
|
3170
|
-
//# sourceMappingURL=chunk-
|
|
3171
|
-
//# sourceMappingURL=chunk-
|
|
3172
|
+
//# sourceMappingURL=chunk-M7WHFUKR.cjs.map
|
|
3173
|
+
//# sourceMappingURL=chunk-M7WHFUKR.cjs.map
|