powerlines 0.24.9 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-C32Buv5_.d.ts → api-DEktSZK8.d.cts} +1 -1
- package/dist/{api-wzd5AREv.d.cts → api-j14_4IBd.d.ts} +1 -1
- package/dist/api.cjs +8 -6
- package/dist/api.d.cts +20 -22
- package/dist/api.d.ts +20 -22
- package/dist/api.js +7 -5
- package/dist/astro.cjs +12 -10
- package/dist/astro.d.cts +19 -21
- package/dist/astro.d.ts +19 -21
- package/dist/astro.js +10 -8
- package/dist/{chunk-JKBJF3UI.js → chunk-2MYPFASJ.js} +2 -0
- package/dist/chunk-2VIXD2XB.js +3 -0
- package/dist/chunk-4JCNAKOE.cjs +4 -0
- package/dist/{chunk-JQCWV4DT.js → chunk-57XOTOOZ.js} +2 -0
- package/dist/{chunk-ABWNIXFZ.js → chunk-67XQ6U3Z.js} +5 -3
- package/dist/chunk-6ZGIV2SU.cjs +4 -0
- package/dist/chunk-7BZQBW77.cjs +4 -0
- package/dist/{chunk-SHUYVCID.js → chunk-7QVYU63E.js} +2 -0
- package/dist/{chunk-PVUETJ3T.cjs → chunk-AEGD6URX.cjs} +9 -7
- package/dist/chunk-AFJCY3R6.js +3 -0
- package/dist/chunk-AXIRZAL7.js +3 -0
- package/dist/{chunk-S5YGX5GU.js → chunk-BGVUPIUF.js} +3 -1
- package/dist/chunk-BTNHSS2P.cjs +13 -0
- package/dist/chunk-DFLNRC3B.cjs +4 -0
- package/dist/chunk-DS7OM4NX.cjs +4 -0
- package/dist/{chunk-W5X3ZEZ5.js → chunk-EBXVKPUX.js} +2 -0
- package/dist/chunk-GIE6OE3X.js +3 -0
- package/dist/chunk-HJW7OH6E.js +3 -0
- package/dist/{chunk-5IBA5HC2.cjs → chunk-HTJKPEWU.cjs} +6 -4
- package/dist/chunk-HY5THHOG.cjs +12 -0
- package/dist/chunk-IHUNA3MO.cjs +4 -0
- package/dist/chunk-JU2HWIWS.js +12 -0
- package/dist/{chunk-4ZYG5R5M.cjs → chunk-KRKQGXVU.cjs} +13 -11
- package/dist/{chunk-357MDCVI.js → chunk-LZFTQGQG.js} +901 -932
- package/dist/chunk-MBBNZS6K.cjs +16 -0
- package/dist/chunk-OYASPHNL.js +3 -0
- package/dist/chunk-PCCFAZML.js +3 -0
- package/dist/{chunk-USNT2KNT.cjs → chunk-PK6SKIKE.cjs} +2 -0
- package/dist/chunk-Q7EJVZVI.cjs +4 -0
- package/dist/{chunk-CJSGAITR.js → chunk-S7MXT5A2.js} +3 -1
- package/dist/{chunk-UWEARQIV.js → chunk-SWN5KDZD.js} +6 -4
- package/dist/{chunk-C4CJ7YAI.js → chunk-T64XX2K5.js} +4 -2
- package/dist/chunk-TLHFXGYV.js +3 -0
- package/dist/chunk-VNRXLY2T.js +3 -0
- package/dist/chunk-VQCQRLGM.cjs +4 -0
- package/dist/{chunk-ETKZMGLN.cjs → chunk-XH2XKGPW.cjs} +2 -0
- package/dist/chunk-XZO6ZJQP.cjs +4 -0
- package/dist/{chunk-Q4DVMLUP.cjs → chunk-YTLBMDJR.cjs} +9 -7
- package/dist/{chunk-XP7OML7S.cjs → chunk-YUX7LOBU.cjs} +2 -0
- package/dist/{chunk-PT24UOCD.cjs → chunk-YWJHR2FX.cjs} +970 -1004
- package/dist/chunk-YZZUOOPS.cjs +4 -0
- package/dist/chunk-Z5H7LD6W.js +3 -0
- package/dist/{chunk-VBR53KGY.js → chunk-Z5UEYORO.js} +5 -3
- package/dist/{chunk-PAMSESZV.cjs → chunk-Z6ARQDHR.cjs} +2 -0
- package/dist/config.cjs +5 -3
- package/dist/config.d.cts +19 -21
- package/dist/config.d.ts +19 -21
- package/dist/config.js +4 -2
- package/dist/{resolved-CSqGKlA5.d.cts → context-BEIQBYYw.d.cts} +850 -851
- package/dist/{resolved-BABoCnXm.d.ts → context-C0ODYfUe.d.ts} +850 -851
- package/dist/esbuild.cjs +13 -11
- package/dist/esbuild.d.cts +19 -21
- package/dist/esbuild.d.ts +19 -21
- package/dist/esbuild.js +10 -8
- package/dist/farm.cjs +9 -7
- package/dist/farm.d.cts +19 -21
- package/dist/farm.d.ts +19 -21
- package/dist/farm.js +8 -6
- package/dist/index.cjs +39 -41
- package/dist/index.d.cts +30 -55
- package/dist/index.d.ts +30 -55
- package/dist/index.js +20 -18
- package/dist/lib/{api-DcMDyPIg.d.ts → api-_Nk6Y2ez.d.cts} +1 -1
- package/dist/lib/{api-B7dqvw6M.d.cts → api-_X9QoW9Y.d.ts} +1 -1
- package/dist/lib/build/esbuild.cjs +5 -5
- package/dist/lib/build/esbuild.d.cts +2 -2
- package/dist/lib/build/esbuild.d.ts +2 -2
- package/dist/lib/build/esbuild.js +2 -2
- package/dist/lib/build/index.cjs +25 -25
- package/dist/lib/build/index.d.cts +4 -4
- package/dist/lib/build/index.d.ts +4 -4
- package/dist/lib/build/index.js +9 -9
- package/dist/lib/build/rolldown.cjs +3 -3
- package/dist/lib/build/rolldown.d.cts +2 -2
- package/dist/lib/build/rolldown.d.ts +2 -2
- package/dist/lib/build/rolldown.js +2 -2
- package/dist/lib/build/rollup.cjs +3 -3
- package/dist/lib/build/rollup.d.cts +2 -2
- package/dist/lib/build/rollup.d.ts +2 -2
- package/dist/lib/build/rollup.js +1 -1
- package/dist/lib/build/rspack.cjs +2 -2
- package/dist/lib/build/rspack.d.cts +2 -2
- package/dist/lib/build/rspack.d.ts +2 -2
- package/dist/lib/build/rspack.js +1 -1
- package/dist/lib/build/tsup.cjs +6 -6
- package/dist/lib/build/tsup.d.cts +2 -2
- package/dist/lib/build/tsup.d.ts +2 -2
- package/dist/lib/build/tsup.js +3 -3
- package/dist/lib/build/unbuild.cjs +5 -5
- package/dist/lib/build/unbuild.d.cts +4 -4
- package/dist/lib/build/unbuild.d.ts +4 -4
- package/dist/lib/build/unbuild.js +2 -2
- package/dist/lib/build/vite.cjs +5 -5
- package/dist/lib/build/vite.d.cts +2 -2
- package/dist/lib/build/vite.d.ts +2 -2
- package/dist/lib/build/vite.js +3 -3
- package/dist/lib/build/webpack.cjs +2 -2
- package/dist/lib/build/webpack.d.cts +2 -2
- package/dist/lib/build/webpack.d.ts +2 -2
- package/dist/lib/build/webpack.js +1 -1
- package/dist/lib/chunk-3T56KQ7U.cjs +49 -0
- package/dist/lib/{chunk-PZLO6FZW.js → chunk-3W53W5J2.js} +2 -2
- package/dist/lib/chunk-4W6WV35V.js +108 -0
- package/dist/lib/chunk-6OYSDQXE.cjs +139 -0
- package/dist/lib/{chunk-EV357RFB.cjs → chunk-7MHUTBEC.cjs} +1 -3
- package/dist/lib/{chunk-A2NFSQ5K.js → chunk-7OVZZWGY.js} +1 -1
- package/dist/lib/chunk-A2NW7WAN.js +47 -0
- package/dist/lib/chunk-D6MI2V6R.cjs +115 -0
- package/dist/lib/{chunk-VHLINWXG.js → chunk-DLVVEHMU.js} +1 -1
- package/dist/lib/{chunk-XLYMVIVD.cjs → chunk-DNQBXFNE.cjs} +10 -10
- package/dist/lib/{chunk-UGVHYKKN.js → chunk-DYLE5FD3.js} +39 -2
- package/dist/lib/{chunk-AKBAX4FH.js → chunk-EN52JYUK.js} +1 -1
- package/dist/lib/{chunk-JYDGFQIV.cjs → chunk-F2CXZUSB.cjs} +1 -1
- package/dist/lib/{chunk-7VJ42H2I.cjs → chunk-HRRI4KOM.cjs} +1 -3
- package/dist/lib/{chunk-LPRZ3HD4.cjs → chunk-IXTLRVAK.cjs} +3 -3
- package/dist/lib/{chunk-SYF7QG2J.js → chunk-J3BW52BU.js} +1 -1
- package/dist/lib/chunk-KFDNKOXM.js +56 -0
- package/dist/lib/chunk-L56XA427.js +137 -0
- package/dist/lib/{chunk-6PPZCPME.cjs → chunk-LOW2TIQ6.cjs} +2 -2
- package/dist/lib/{chunk-TMZCGC5U.js → chunk-MI55FDCZ.js} +1 -1
- package/dist/lib/{chunk-DUZJ7ZF2.cjs → chunk-MKKWFHGE.cjs} +2 -2
- package/dist/lib/{chunk-ISBHXSDH.cjs → chunk-N5XEKCVW.cjs} +1 -1
- package/dist/lib/{chunk-XZFEHPYE.js → chunk-N5YLKWC2.js} +1 -1
- package/dist/lib/chunk-NIRFKQAD.js +845 -0
- package/dist/lib/{chunk-YMHOAMCU.cjs → chunk-NLJR4WIX.cjs} +41 -4
- package/dist/lib/{chunk-L3HESXYF.cjs → chunk-NUE5DIH3.cjs} +3 -3
- package/dist/lib/chunk-OBA5U4Y2.js +1059 -0
- package/dist/lib/{chunk-FQLZZYYO.js → chunk-OEF6EHQV.js} +1 -3
- package/dist/lib/{chunk-WTTBXYFQ.js → chunk-OFXWRM3U.js} +2 -2
- package/dist/lib/chunk-ONETLSPO.js +85 -0
- package/dist/lib/{chunk-2OV26JXJ.cjs → chunk-PQRWG64T.cjs} +3 -3
- package/dist/lib/chunk-R33US3PV.cjs +1081 -0
- package/dist/lib/{chunk-Z74G7RN3.cjs → chunk-SFEEJZLK.cjs} +32 -38
- package/dist/lib/{chunk-H6EOZSIZ.js → chunk-TAVG226Z.js} +1 -1
- package/dist/lib/{chunk-DALRRHB4.cjs → chunk-TSFG3WEA.cjs} +1 -1
- package/dist/lib/{chunk-RMA2PMP7.cjs → chunk-TZCC5IWH.cjs} +3 -3
- package/dist/lib/chunk-VHCBD2IS.js +149 -0
- package/dist/lib/{chunk-HY6DNFCT.js → chunk-VODWHWD6.js} +2 -2
- package/dist/lib/{chunk-2X5DUDNT.js → chunk-W6GWSJ22.js} +2 -2
- package/dist/lib/chunk-WBSA6OG6.cjs +860 -0
- package/dist/lib/{chunk-TOCNXURI.cjs → chunk-WCXA5WFX.cjs} +4 -4
- package/dist/lib/{chunk-6I5PL7H2.js → chunk-WGSZ4X6N.js} +1 -3
- package/dist/lib/{chunk-FBRJW4AY.js → chunk-WLDQUTFD.js} +23 -29
- package/dist/lib/{chunk-AOHJEL2Q.js → chunk-WOKPJMGJ.js} +3 -3
- package/dist/lib/{chunk-TDJNFAOV.cjs → chunk-X6JDYLWM.cjs} +1 -1
- package/dist/lib/chunk-XLHFUATD.cjs +151 -0
- package/dist/lib/chunk-XUYQYUWZ.cjs +87 -0
- package/dist/lib/chunk-YYEAV24J.cjs +67 -0
- package/dist/lib/{config-Cobl3YxA.d.ts → config-B1TbvPos.d.ts} +60 -477
- package/dist/lib/config-file.d.cts +2 -2
- package/dist/lib/config-file.d.ts +2 -2
- package/dist/lib/{config-BgeSOU_x.d.cts → config-k7pxzq2C.d.cts} +60 -477
- package/dist/lib/contexts/api-context.cjs +12 -7
- package/dist/lib/contexts/api-context.d.cts +27 -4
- package/dist/lib/contexts/api-context.d.ts +27 -4
- package/dist/lib/contexts/api-context.js +11 -6
- package/dist/lib/contexts/context.cjs +10 -5
- package/dist/lib/contexts/context.d.cts +7 -7
- package/dist/lib/contexts/context.d.ts +7 -7
- package/dist/lib/contexts/context.js +9 -4
- package/dist/lib/contexts/environment-context.cjs +11 -6
- package/dist/lib/contexts/environment-context.d.cts +4 -4
- package/dist/lib/contexts/environment-context.d.ts +4 -4
- package/dist/lib/contexts/environment-context.js +10 -5
- package/dist/lib/contexts/index.cjs +14 -9
- package/dist/lib/contexts/index.d.cts +4 -4
- package/dist/lib/contexts/index.d.ts +4 -4
- package/dist/lib/contexts/index.js +11 -6
- package/dist/lib/contexts/plugin-context.d.cts +4 -4
- package/dist/lib/contexts/plugin-context.d.ts +4 -4
- package/dist/lib/entry.cjs +9 -9
- package/dist/lib/entry.d.cts +2 -2
- package/dist/lib/entry.d.ts +2 -2
- package/dist/lib/entry.js +1 -1
- package/dist/lib/fs/helpers.cjs +47 -0
- package/dist/lib/fs/helpers.d.cts +74 -0
- package/dist/lib/fs/helpers.d.ts +74 -0
- package/dist/lib/fs/helpers.js +2 -0
- package/dist/lib/fs/index.cjs +17 -0
- package/dist/lib/fs/index.d.cts +33 -0
- package/dist/lib/fs/index.d.ts +33 -0
- package/dist/lib/fs/index.js +8 -0
- package/dist/lib/fs/storage/base.cjs +11 -0
- package/dist/lib/fs/storage/base.d.cts +138 -0
- package/dist/lib/fs/storage/base.d.ts +138 -0
- package/dist/lib/fs/storage/base.js +2 -0
- package/dist/lib/fs/storage/file-system.cjs +13 -0
- package/dist/lib/fs/storage/file-system.d.cts +90 -0
- package/dist/lib/fs/storage/file-system.d.ts +90 -0
- package/dist/lib/fs/storage/file-system.js +4 -0
- package/dist/lib/fs/storage/index.cjs +22 -0
- package/dist/lib/fs/storage/index.d.cts +6 -0
- package/dist/lib/fs/storage/index.d.ts +6 -0
- package/dist/lib/fs/storage/index.js +5 -0
- package/dist/lib/fs/storage/virtual.cjs +12 -0
- package/dist/lib/fs/storage/virtual.d.cts +66 -0
- package/dist/lib/fs/storage/virtual.d.ts +66 -0
- package/dist/lib/fs/storage/virtual.js +3 -0
- package/dist/lib/fs/vfs.cjs +16 -0
- package/dist/lib/fs/vfs.d.cts +247 -0
- package/dist/lib/fs/vfs.d.ts +247 -0
- package/dist/lib/fs/vfs.js +7 -0
- package/dist/lib/fs-Dg-aTfiN.d.cts +378 -0
- package/dist/lib/fs-Dg-aTfiN.d.ts +378 -0
- package/dist/lib/index.cjs +70 -76
- package/dist/lib/index.d.cts +18 -356
- package/dist/lib/index.d.ts +18 -356
- package/dist/lib/index.js +21 -15
- package/dist/lib/{internal-C4LRBm2o.d.cts → internal-BL418sdB.d.cts} +2 -2
- package/dist/lib/{internal-BgqhTTai.d.ts → internal-mNVkKh_3.d.ts} +2 -2
- package/dist/lib/logger.d.cts +2 -2
- package/dist/lib/logger.d.ts +2 -2
- package/dist/lib/typescript/import-transformer.cjs +7 -45
- package/dist/lib/typescript/import-transformer.d.cts +2 -2
- package/dist/lib/typescript/import-transformer.d.ts +2 -2
- package/dist/lib/typescript/import-transformer.js +2 -47
- package/dist/lib/typescript/index.cjs +10 -22
- package/dist/lib/typescript/index.d.cts +4 -4
- package/dist/lib/typescript/index.d.ts +4 -4
- package/dist/lib/typescript/index.js +2 -2
- package/dist/lib/typescript/ts-morph.cjs +6 -2
- package/dist/lib/typescript/ts-morph.d.cts +28 -4
- package/dist/lib/typescript/ts-morph.d.ts +28 -4
- package/dist/lib/typescript/ts-morph.js +1 -1
- package/dist/lib/unplugin/factory.cjs +14 -9
- package/dist/lib/unplugin/factory.d.cts +4 -4
- package/dist/lib/unplugin/factory.d.ts +4 -4
- package/dist/lib/unplugin/factory.js +13 -8
- package/dist/lib/unplugin/helpers.d.cts +2 -2
- package/dist/lib/unplugin/helpers.d.ts +2 -2
- package/dist/lib/unplugin/index.cjs +17 -12
- package/dist/lib/unplugin/index.d.cts +4 -4
- package/dist/lib/unplugin/index.d.ts +4 -4
- package/dist/lib/unplugin/index.js +15 -10
- package/dist/lib/unplugin/plugin.cjs +2 -2
- package/dist/lib/unplugin/plugin.d.cts +4 -4
- package/dist/lib/unplugin/plugin.d.ts +4 -4
- package/dist/lib/unplugin/plugin.js +1 -1
- package/dist/lib/{unplugin-BjKSIVn4.d.cts → unplugin-D2hRHNBc.d.cts} +2 -2
- package/dist/lib/{unplugin-CFcDbneD.d.ts → unplugin-_98FcnXX.d.ts} +2 -2
- package/dist/lib/utilities/bundle.cjs +4 -4
- package/dist/lib/utilities/bundle.d.cts +2 -2
- package/dist/lib/utilities/bundle.d.ts +2 -2
- package/dist/lib/utilities/bundle.js +3 -3
- package/dist/lib/utilities/cache.d.cts +2 -2
- package/dist/lib/utilities/cache.d.ts +2 -2
- package/dist/lib/utilities/file-header.d.cts +2 -2
- package/dist/lib/utilities/file-header.d.ts +2 -2
- package/dist/lib/utilities/index.cjs +27 -27
- package/dist/lib/utilities/index.d.cts +2 -2
- package/dist/lib/utilities/index.d.ts +2 -2
- package/dist/lib/utilities/index.js +6 -6
- package/dist/lib/utilities/meta.cjs +7 -7
- package/dist/lib/utilities/meta.d.cts +2 -2
- package/dist/lib/utilities/meta.d.ts +2 -2
- package/dist/lib/utilities/meta.js +1 -1
- package/dist/lib/utilities/resolve.cjs +5 -5
- package/dist/lib/utilities/resolve.d.cts +2 -2
- package/dist/lib/utilities/resolve.d.ts +2 -2
- package/dist/lib/utilities/resolve.js +4 -4
- package/dist/lib/utilities/source-file.d.cts +2 -2
- package/dist/lib/utilities/source-file.d.ts +2 -2
- package/dist/lib/utilities/source-map.d.cts +2 -2
- package/dist/lib/utilities/source-map.d.ts +2 -2
- package/dist/lib/utilities/worker.d.cts +2 -2
- package/dist/lib/utilities/worker.d.ts +2 -2
- package/dist/lib/utilities/write-file.d.cts +2 -2
- package/dist/lib/utilities/write-file.d.ts +2 -2
- package/dist/next.cjs +11 -9
- package/dist/next.js +9 -7
- package/dist/nuxt.cjs +13 -11
- package/dist/nuxt.js +11 -9
- package/dist/plugin-utils/{chunk-JHTLGE4X.js → chunk-K2GWRZPV.js} +1 -1
- package/dist/plugin-utils/{chunk-HSYQWNIH.cjs → chunk-VWFJOPKC.cjs} +1 -1
- package/dist/plugin-utils/{context-BITGF5LZ.d.ts → context-BEwPhwiP.d.cts} +189 -232
- package/dist/plugin-utils/{context-BITGF5LZ.d.cts → context-BEwPhwiP.d.ts} +189 -232
- package/dist/plugin-utils/context-helpers.d.cts +1 -2
- package/dist/plugin-utils/context-helpers.d.ts +1 -2
- package/dist/plugin-utils/enforce.d.cts +1 -2
- package/dist/plugin-utils/enforce.d.ts +1 -2
- package/dist/plugin-utils/extend.d.cts +1 -2
- package/dist/plugin-utils/extend.d.ts +1 -2
- package/dist/plugin-utils/get-config-path.d.cts +1 -2
- package/dist/plugin-utils/get-config-path.d.ts +1 -2
- package/dist/plugin-utils/helpers.d.cts +1 -2
- package/dist/plugin-utils/helpers.d.ts +1 -2
- package/dist/plugin-utils/index.cjs +2 -2
- package/dist/plugin-utils/index.d.cts +1 -2
- package/dist/plugin-utils/index.d.ts +1 -2
- package/dist/plugin-utils/index.js +1 -1
- package/dist/plugin-utils/merge.d.cts +1 -2
- package/dist/plugin-utils/merge.d.ts +1 -2
- package/dist/plugin-utils/paths.cjs +2 -2
- package/dist/plugin-utils/paths.d.cts +2 -3
- package/dist/plugin-utils/paths.d.ts +2 -3
- package/dist/plugin-utils/paths.js +1 -1
- package/dist/rolldown.cjs +9 -7
- package/dist/rolldown.d.cts +19 -21
- package/dist/rolldown.d.ts +19 -21
- package/dist/rolldown.js +8 -6
- package/dist/rollup.cjs +9 -7
- package/dist/rollup.d.cts +19 -21
- package/dist/rollup.d.ts +19 -21
- package/dist/rollup.js +8 -6
- package/dist/rspack.cjs +9 -7
- package/dist/rspack.d.cts +18 -20
- package/dist/rspack.d.ts +18 -20
- package/dist/rspack.js +8 -6
- package/dist/tsup.cjs +12 -10
- package/dist/tsup.js +10 -8
- package/dist/types/api.cjs +3 -1
- package/dist/types/api.cjs.map +1 -0
- package/dist/types/api.d.cts +20 -22
- package/dist/types/api.d.ts +20 -22
- package/dist/types/api.js +3 -1
- package/dist/types/api.js.map +1 -0
- package/dist/types/babel.cjs +3 -1
- package/dist/types/babel.cjs.map +1 -0
- package/dist/types/babel.d.cts +17 -19
- package/dist/types/babel.d.ts +17 -19
- package/dist/types/babel.js +3 -1
- package/dist/types/babel.js.map +1 -0
- package/dist/types/build.cjs +3 -1
- package/dist/types/build.cjs.map +1 -0
- package/dist/types/build.js +3 -1
- package/dist/types/build.js.map +1 -0
- package/dist/types/commands.cjs +5 -3
- package/dist/types/commands.cjs.map +1 -0
- package/dist/types/commands.d.cts +18 -20
- package/dist/types/commands.d.ts +18 -20
- package/dist/types/commands.js +4 -2
- package/dist/types/commands.js.map +1 -0
- package/dist/types/config.cjs +3 -1
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.cts +2 -4
- package/dist/types/config.d.ts +2 -4
- package/dist/types/config.js +3 -1
- package/dist/types/config.js.map +1 -0
- package/dist/types/context.cjs +5 -3
- package/dist/types/context.cjs.map +1 -0
- package/dist/types/context.d.cts +8 -10
- package/dist/types/context.d.ts +8 -10
- package/dist/types/context.js +4 -2
- package/dist/types/context.js.map +1 -0
- package/dist/types/fs.cjs +10 -4
- package/dist/types/fs.cjs.map +1 -0
- package/dist/types/fs.d.cts +138 -184
- package/dist/types/fs.d.ts +138 -184
- package/dist/types/fs.js +4 -2
- package/dist/types/fs.js.map +1 -0
- package/dist/types/hooks.cjs +3 -1
- package/dist/types/hooks.cjs.map +1 -0
- package/dist/types/hooks.d.cts +19 -21
- package/dist/types/hooks.d.ts +19 -21
- package/dist/types/hooks.js +3 -1
- package/dist/types/hooks.js.map +1 -0
- package/dist/types/index.cjs +26 -20
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +13 -15
- package/dist/types/index.d.ts +13 -15
- package/dist/types/index.js +17 -15
- package/dist/types/index.js.map +1 -0
- package/dist/types/internal.cjs +2 -0
- package/dist/types/internal.cjs.map +1 -0
- package/dist/types/internal.d.cts +20 -22
- package/dist/types/internal.d.ts +20 -22
- package/dist/types/internal.js +2 -0
- package/dist/types/internal.js.map +1 -0
- package/dist/types/plugin.cjs +5 -3
- package/dist/types/plugin.cjs.map +1 -0
- package/dist/types/plugin.d.cts +9 -11
- package/dist/types/plugin.d.ts +9 -11
- package/dist/types/plugin.js +4 -2
- package/dist/types/plugin.js.map +1 -0
- package/dist/types/resolved.cjs +3 -1
- package/dist/types/resolved.cjs.map +1 -0
- package/dist/types/resolved.d.cts +7 -9
- package/dist/types/resolved.d.ts +7 -9
- package/dist/types/resolved.js +3 -1
- package/dist/types/resolved.js.map +1 -0
- package/dist/types/tsconfig.cjs +3 -1
- package/dist/types/tsconfig.cjs.map +1 -0
- package/dist/types/tsconfig.js +3 -1
- package/dist/types/tsconfig.js.map +1 -0
- package/dist/types/typedoc.cjs +3 -1
- package/dist/types/typedoc.cjs.map +1 -0
- package/dist/types/typedoc.js +3 -1
- package/dist/types/typedoc.js.map +1 -0
- package/dist/types/unplugin.cjs +3 -1
- package/dist/types/unplugin.cjs.map +1 -0
- package/dist/types/unplugin.d.cts +11 -13
- package/dist/types/unplugin.d.ts +11 -13
- package/dist/types/unplugin.js +3 -1
- package/dist/types/unplugin.js.map +1 -0
- package/dist/unloader.cjs +9 -7
- package/dist/unloader.d.cts +19 -21
- package/dist/unloader.d.ts +19 -21
- package/dist/unloader.js +8 -6
- package/dist/unplugin.cjs +20 -20
- package/dist/unplugin.d.cts +19 -21
- package/dist/unplugin.d.ts +19 -21
- package/dist/unplugin.js +10 -10
- package/dist/vite.cjs +13 -11
- package/dist/vite.d.cts +19 -21
- package/dist/vite.d.ts +19 -21
- package/dist/vite.js +10 -8
- package/dist/webpack.cjs +12 -10
- package/dist/webpack.d.cts +19 -21
- package/dist/webpack.d.ts +19 -21
- package/dist/webpack.js +9 -7
- package/package.json +78 -25
- package/schemas/fs.capnp +4 -59
- package/dist/chunk-2NO7N5OW.cjs +0 -2
- package/dist/chunk-7GYTTM4M.cjs +0 -2
- package/dist/chunk-AENPRFWJ.cjs +0 -2
- package/dist/chunk-AYKZK666.cjs +0 -8
- package/dist/chunk-BUR2JQ6G.cjs +0 -11
- package/dist/chunk-DRXFQCNC.js +0 -1
- package/dist/chunk-DTXP5O7S.cjs +0 -10
- package/dist/chunk-FNZDWE4L.js +0 -1
- package/dist/chunk-GHJU2KGP.cjs +0 -2
- package/dist/chunk-GRU7B3QM.cjs +0 -2
- package/dist/chunk-HQFZ64VC.cjs +0 -2
- package/dist/chunk-J4BQZHTQ.js +0 -1
- package/dist/chunk-JGB5YQ2U.js +0 -1
- package/dist/chunk-KALR2O2F.cjs +0 -2
- package/dist/chunk-OO3YXM72.js +0 -1
- package/dist/chunk-QE3WGMAP.js +0 -1
- package/dist/chunk-SMNKPH4T.js +0 -1
- package/dist/chunk-T2P533I5.js +0 -1
- package/dist/chunk-V3MLQDZQ.js +0 -1
- package/dist/chunk-VT7NVLLU.js +0 -5
- package/dist/chunk-YRJ4MLVL.cjs +0 -2
- package/dist/chunk-ZC43PZXS.cjs +0 -2
- package/dist/lib/chunk-3MZQ4MQX.cjs +0 -2360
- package/dist/lib/chunk-5JAFU45Z.js +0 -2324
- package/dist/lib/chunk-HAXL7QE7.js +0 -154
- package/dist/lib/chunk-SAS5EPBD.cjs +0 -107
- package/dist/lib/chunk-WUYK74EH.cjs +0 -165
- package/dist/lib/chunk-YQ3ODCHV.js +0 -105
- package/dist/lib/typescript/compiler-host.cjs +0 -164
- package/dist/lib/typescript/compiler-host.d.cts +0 -63
- package/dist/lib/typescript/compiler-host.d.ts +0 -63
- package/dist/lib/typescript/compiler-host.js +0 -156
- package/dist/lib/typescript/program.cjs +0 -27
- package/dist/lib/typescript/program.d.cts +0 -68
- package/dist/lib/typescript/program.d.ts +0 -68
- package/dist/lib/typescript/program.js +0 -2
- /package/dist/{chunk-2NCILNCH.cjs → lib/chunk-K2SFTPN3.cjs} +0 -0
- /package/dist/{chunk-BLNT5INX.js → lib/chunk-NQAHFTUW.js} +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkXH2XKGPW_cjs = require('./chunk-XH2XKGPW.cjs');
|
|
4
|
+
var chunkZ6ARQDHR_cjs = require('./chunk-Z6ARQDHR.cjs');
|
|
5
|
+
var chunkMBBNZS6K_cjs = require('./chunk-MBBNZS6K.cjs');
|
|
6
|
+
var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
|
|
7
7
|
var core = require('@babel/core');
|
|
8
8
|
var console = require('@storm-software/config-tools/logger/console');
|
|
9
9
|
var types = require('@storm-software/config-tools/types');
|
|
10
10
|
var toArray = require('@stryke/convert/to-array');
|
|
11
11
|
var copyFile = require('@stryke/fs/copy-file');
|
|
12
|
+
var helpers = require('@stryke/fs/helpers');
|
|
12
13
|
var install = require('@stryke/fs/install');
|
|
13
14
|
var listFiles = require('@stryke/fs/list-files');
|
|
14
15
|
var packageFns = require('@stryke/fs/package-fns');
|
|
@@ -28,7 +29,9 @@ var Handlebars = require('handlebars');
|
|
|
28
29
|
var helperPluginUtils = require('@babel/helper-plugin-utils');
|
|
29
30
|
var t = require('@babel/types');
|
|
30
31
|
var ts = require('typescript');
|
|
31
|
-
var
|
|
32
|
+
var join = require('@stryke/path/join');
|
|
33
|
+
var defu7 = require('defu');
|
|
34
|
+
var tsMorph = require('ts-morph');
|
|
32
35
|
var _package = require('@stryke/string-format/package');
|
|
33
36
|
var superdiff = require('@donedeal0/superdiff');
|
|
34
37
|
var json = require('@stryke/fs/json');
|
|
@@ -47,7 +50,6 @@ var murmurhash = require('@stryke/hash/murmurhash');
|
|
|
47
50
|
var getUnique = require('@stryke/helpers/get-unique');
|
|
48
51
|
var omit = require('@stryke/helpers/omit');
|
|
49
52
|
var isType = require('@stryke/path/is-type');
|
|
50
|
-
var join = require('@stryke/path/join');
|
|
51
53
|
var isNull = require('@stryke/type-checks/is-null');
|
|
52
54
|
var isString = require('@stryke/type-checks/is-string');
|
|
53
55
|
var uuid = require('@stryke/unique-id/uuid');
|
|
@@ -57,22 +59,20 @@ var isUndefined = require('@stryke/type-checks/is-undefined');
|
|
|
57
59
|
var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
|
|
58
60
|
var isFile = require('@stryke/fs/is-file');
|
|
59
61
|
var $ = require('@stryke/capnp');
|
|
60
|
-
var bufferToString = require('@stryke/convert/buffer-to-string');
|
|
61
62
|
var buffer = require('@stryke/fs/buffer');
|
|
62
63
|
var correctPath = require('@stryke/path/correct-path');
|
|
64
|
+
var isParentPath = require('@stryke/path/is-parent-path');
|
|
63
65
|
var prettyBytes = require('@stryke/string-format/pretty-bytes');
|
|
64
|
-
var isBuffer = require('@stryke/type-checks/is-buffer');
|
|
65
66
|
var flatCache = require('flat-cache');
|
|
66
67
|
var buffer$1 = require('buffer');
|
|
67
|
-
var _fs = require('fs');
|
|
68
68
|
var logger = require('@storm-software/config-tools/logger');
|
|
69
69
|
var colors = require('@storm-software/config-tools/utilities/colors');
|
|
70
70
|
var noop = require('@stryke/helpers/noop');
|
|
71
71
|
var slash = require('@stryke/path/slash');
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
var
|
|
75
|
-
var
|
|
72
|
+
var readFile = require('@stryke/fs/read-file');
|
|
73
|
+
var fs = require('fs');
|
|
74
|
+
var promises = require('fs/promises');
|
|
75
|
+
var path = require('path');
|
|
76
76
|
require('@stryke/fs/remove-file');
|
|
77
77
|
var kebabCase = require('@stryke/string-format/kebab-case');
|
|
78
78
|
var isObject = require('@stryke/type-checks/is-object');
|
|
@@ -101,9 +101,8 @@ var chalk5__default = /*#__PURE__*/_interopDefault(chalk5);
|
|
|
101
101
|
var Handlebars__default = /*#__PURE__*/_interopDefault(Handlebars);
|
|
102
102
|
var t__namespace = /*#__PURE__*/_interopNamespace(t);
|
|
103
103
|
var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
104
|
-
var
|
|
104
|
+
var defu7__default = /*#__PURE__*/_interopDefault(defu7);
|
|
105
105
|
var $__namespace = /*#__PURE__*/_interopNamespace($);
|
|
106
|
-
var _fs__default = /*#__PURE__*/_interopDefault(_fs);
|
|
107
106
|
|
|
108
107
|
function resolveModulePath(nodePath, state) {
|
|
109
108
|
if (!t__namespace.isStringLiteral(nodePath.node)) {
|
|
@@ -118,7 +117,7 @@ function resolveModulePath(nodePath, state) {
|
|
|
118
117
|
));
|
|
119
118
|
}
|
|
120
119
|
}
|
|
121
|
-
|
|
120
|
+
chunkPK6SKIKE_cjs.__name(resolveModulePath, "resolveModulePath");
|
|
122
121
|
var TRANSFORM_FUNCTIONS = [
|
|
123
122
|
"require",
|
|
124
123
|
"require.resolve",
|
|
@@ -148,9 +147,9 @@ function matchesPattern(state, calleePath, pattern) {
|
|
|
148
147
|
const name = pattern.split(".")[0];
|
|
149
148
|
return node.name === name;
|
|
150
149
|
}
|
|
151
|
-
|
|
150
|
+
chunkPK6SKIKE_cjs.__name(matchesPattern, "matchesPattern");
|
|
152
151
|
var importVisitors = {
|
|
153
|
-
CallExpression: /* @__PURE__ */
|
|
152
|
+
CallExpression: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((nodePath, state) => {
|
|
154
153
|
if (state.moduleResolverVisited.has(nodePath)) {
|
|
155
154
|
return;
|
|
156
155
|
}
|
|
@@ -161,7 +160,7 @@ var importVisitors = {
|
|
|
161
160
|
}
|
|
162
161
|
}, "CallExpression"),
|
|
163
162
|
// eslint-disable-next-line ts/naming-convention
|
|
164
|
-
"ImportDeclaration|ExportDeclaration|ExportAllDeclaration": /* @__PURE__ */
|
|
163
|
+
"ImportDeclaration|ExportDeclaration|ExportAllDeclaration": /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((nodePath, state) => {
|
|
165
164
|
if (!nodePath || !nodePath.get("source") || state.moduleResolverVisited.has(nodePath)) {
|
|
166
165
|
return;
|
|
167
166
|
}
|
|
@@ -169,8 +168,8 @@ var importVisitors = {
|
|
|
169
168
|
resolveModulePath(nodePath.get("source"), state);
|
|
170
169
|
}, "ImportDeclaration|ExportDeclaration|ExportAllDeclaration")
|
|
171
170
|
};
|
|
172
|
-
var moduleResolverBabelPlugin = /* @__PURE__ */
|
|
173
|
-
return helperPluginUtils.declare(/* @__PURE__ */
|
|
171
|
+
var moduleResolverBabelPlugin = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((context) => {
|
|
172
|
+
return helperPluginUtils.declare(/* @__PURE__ */ chunkPK6SKIKE_cjs.__name(function builder(api) {
|
|
174
173
|
let moduleResolverVisited = /* @__PURE__ */ new Set();
|
|
175
174
|
return {
|
|
176
175
|
name: "powerlines:module-resolver",
|
|
@@ -206,6 +205,108 @@ var moduleResolverBabelPlugin = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((contex
|
|
|
206
205
|
};
|
|
207
206
|
}, "builder"));
|
|
208
207
|
}, "moduleResolverBabelPlugin");
|
|
208
|
+
var VirtualFileSystemHost = class extends tsMorph.InMemoryFileSystemHost {
|
|
209
|
+
static {
|
|
210
|
+
chunkPK6SKIKE_cjs.__name(this, "VirtualFileSystemHost");
|
|
211
|
+
}
|
|
212
|
+
#context;
|
|
213
|
+
constructor(context) {
|
|
214
|
+
super();
|
|
215
|
+
this.#context = context;
|
|
216
|
+
}
|
|
217
|
+
deleteSync(path) {
|
|
218
|
+
this.#context.fs.removeSync(path);
|
|
219
|
+
}
|
|
220
|
+
readDirSync(dirPath) {
|
|
221
|
+
return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {
|
|
222
|
+
const fullPath = this.#context.fs.resolveSync(join.joinPaths(dirPath, entry));
|
|
223
|
+
if (fullPath) {
|
|
224
|
+
ret.push({
|
|
225
|
+
name: entry,
|
|
226
|
+
isDirectory: this.#context.fs.existsSync(fullPath),
|
|
227
|
+
isFile: this.#context.fs.existsSync(fullPath),
|
|
228
|
+
isSymlink: false
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return ret;
|
|
232
|
+
}, []);
|
|
233
|
+
}
|
|
234
|
+
async readFile(filePath) {
|
|
235
|
+
if (!this.#context.fs.existsSync(filePath)) {
|
|
236
|
+
throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
|
|
237
|
+
}
|
|
238
|
+
return await this.#context.fs.read(filePath);
|
|
239
|
+
}
|
|
240
|
+
readFileSync(filePath) {
|
|
241
|
+
if (!this.#context.fs.existsSync(filePath)) {
|
|
242
|
+
throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
|
|
243
|
+
}
|
|
244
|
+
return this.#context.fs.readSync(filePath);
|
|
245
|
+
}
|
|
246
|
+
async writeFile(filePath, fileText) {
|
|
247
|
+
return this.#context.fs.write(filePath, fileText);
|
|
248
|
+
}
|
|
249
|
+
writeFileSync(filePath, fileText) {
|
|
250
|
+
this.#context.fs.writeSync(filePath, fileText);
|
|
251
|
+
}
|
|
252
|
+
async mkdir(_dirPath) {
|
|
253
|
+
}
|
|
254
|
+
mkdirSync(_dirPath) {
|
|
255
|
+
}
|
|
256
|
+
async move(srcPath, destPath) {
|
|
257
|
+
await this.#context.fs.move(srcPath, destPath);
|
|
258
|
+
}
|
|
259
|
+
moveSync(srcPath, destPath) {
|
|
260
|
+
this.#context.fs.moveSync(srcPath, destPath);
|
|
261
|
+
}
|
|
262
|
+
async copy(srcPath, destPath) {
|
|
263
|
+
await this.#context.fs.copy(srcPath, destPath);
|
|
264
|
+
}
|
|
265
|
+
copySync(srcPath, destPath) {
|
|
266
|
+
this.#context.fs.copySync(srcPath, destPath);
|
|
267
|
+
}
|
|
268
|
+
async fileExists(filePath) {
|
|
269
|
+
return this.#context.fs.exists(filePath);
|
|
270
|
+
}
|
|
271
|
+
fileExistsSync(filePath) {
|
|
272
|
+
return this.#context.fs.existsSync(filePath);
|
|
273
|
+
}
|
|
274
|
+
async directoryExists(dirPath) {
|
|
275
|
+
return this.#context.fs.exists(dirPath);
|
|
276
|
+
}
|
|
277
|
+
directoryExistsSync(dirPath) {
|
|
278
|
+
return this.#context.fs.existsSync(dirPath);
|
|
279
|
+
}
|
|
280
|
+
realpathSync(path) {
|
|
281
|
+
return this.#context.fs.resolveSync(path) || path;
|
|
282
|
+
}
|
|
283
|
+
getCurrentDirectory() {
|
|
284
|
+
return this.#context.workspaceConfig.workspaceRoot;
|
|
285
|
+
}
|
|
286
|
+
async glob(patterns) {
|
|
287
|
+
return this.#context.fs.glob(patterns);
|
|
288
|
+
}
|
|
289
|
+
globSync(patterns) {
|
|
290
|
+
return this.#context.fs.globSync(patterns);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
function createProgram(context, override) {
|
|
294
|
+
context.log(types.LogLevelLabel.TRACE, `Creating ts-morph Project instance with configuration from: ${context.tsconfig.tsconfigFilePath}.`);
|
|
295
|
+
const project = new tsMorph.Project(defu7__default.default(override ?? {}, {
|
|
296
|
+
skipAddingFilesFromTsConfig: false,
|
|
297
|
+
tsConfigFilePath: context.tsconfig.tsconfigFilePath,
|
|
298
|
+
fileSystem: new VirtualFileSystemHost(context),
|
|
299
|
+
compilerOptions: defu7__default.default(context.tsconfig.options ?? {}, {
|
|
300
|
+
lib: [
|
|
301
|
+
"lib.esnext.full.d.ts"
|
|
302
|
+
]
|
|
303
|
+
})
|
|
304
|
+
}));
|
|
305
|
+
return project;
|
|
306
|
+
}
|
|
307
|
+
chunkPK6SKIKE_cjs.__name(createProgram, "createProgram");
|
|
308
|
+
|
|
309
|
+
// src/internal/helpers/generate-types.ts
|
|
209
310
|
function formatTypes(code) {
|
|
210
311
|
return code.replace(
|
|
211
312
|
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
|
@@ -213,11 +314,14 @@ function formatTypes(code) {
|
|
|
213
314
|
""
|
|
214
315
|
).replaceAll("#private;", "").replace(/__Ω/g, "");
|
|
215
316
|
}
|
|
216
|
-
|
|
317
|
+
chunkPK6SKIKE_cjs.__name(formatTypes, "formatTypes");
|
|
217
318
|
async function emitTypes(context, files) {
|
|
218
319
|
context.log(types.LogLevelLabel.TRACE, `Running the TypeScript compiler for ${files.length} generated runtime files.`);
|
|
219
|
-
|
|
220
|
-
|
|
320
|
+
const program = createProgram(context, {
|
|
321
|
+
skipAddingFilesFromTsConfig: true
|
|
322
|
+
});
|
|
323
|
+
program.addSourceFilesAtPaths(files);
|
|
324
|
+
const result = program.emitToMemory({
|
|
221
325
|
emitOnlyDtsFiles: true
|
|
222
326
|
});
|
|
223
327
|
let builtinModules = "";
|
|
@@ -249,7 +353,7 @@ ${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : dia
|
|
|
249
353
|
}
|
|
250
354
|
return formatTypes(builtinModules);
|
|
251
355
|
}
|
|
252
|
-
|
|
356
|
+
chunkPK6SKIKE_cjs.__name(emitTypes, "emitTypes");
|
|
253
357
|
async function callHook(context, hook, options, ...args) {
|
|
254
358
|
const handlers = context.selectHooks(hook, options);
|
|
255
359
|
if (handlers.length > 0) {
|
|
@@ -277,14 +381,14 @@ async function callHook(context, hook, options, ...args) {
|
|
|
277
381
|
if (definedResults.length > 0) {
|
|
278
382
|
let mergedResult = void 0;
|
|
279
383
|
for (const result of definedResults) {
|
|
280
|
-
mergedResult =
|
|
384
|
+
mergedResult = defu7.defu(result, mergedResult ?? {});
|
|
281
385
|
}
|
|
282
386
|
return mergedResult;
|
|
283
387
|
}
|
|
284
388
|
}
|
|
285
389
|
return void 0;
|
|
286
390
|
}
|
|
287
|
-
|
|
391
|
+
chunkPK6SKIKE_cjs.__name(callHook, "callHook");
|
|
288
392
|
async function installPackage(context, packageName, dev = false) {
|
|
289
393
|
if (!await packageFns.isPackageListed(_package.getPackageName(packageName), {
|
|
290
394
|
cwd: context.config.projectRoot
|
|
@@ -314,7 +418,7 @@ async function installPackage(context, packageName, dev = false) {
|
|
|
314
418
|
}
|
|
315
419
|
}
|
|
316
420
|
}
|
|
317
|
-
|
|
421
|
+
chunkPK6SKIKE_cjs.__name(installPackage, "installPackage");
|
|
318
422
|
|
|
319
423
|
// src/internal/helpers/install-dependencies.ts
|
|
320
424
|
async function installDependencies(context) {
|
|
@@ -336,7 +440,7 @@ ${Object.entries(context.devDependencies).map(([name, version]) => `- ${name}@${
|
|
|
336
440
|
Promise.all(Object.entries(context.devDependencies).map(async ([name, version]) => installPackage(context, `${_package.getPackageName(name)}@${String(version)}`, true)))
|
|
337
441
|
]);
|
|
338
442
|
}
|
|
339
|
-
|
|
443
|
+
chunkPK6SKIKE_cjs.__name(installDependencies, "installDependencies");
|
|
340
444
|
function getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
|
|
341
445
|
let tsconfigFilePath;
|
|
342
446
|
if (tsconfig) {
|
|
@@ -355,7 +459,7 @@ function getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
|
|
|
355
459
|
}
|
|
356
460
|
return tsconfigFilePath;
|
|
357
461
|
}
|
|
358
|
-
|
|
462
|
+
chunkPK6SKIKE_cjs.__name(getTsconfigFilePath, "getTsconfigFilePath");
|
|
359
463
|
function tryTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
|
|
360
464
|
let tsconfigFilePath = tsconfig;
|
|
361
465
|
if (!exists.existsSync(tsconfigFilePath)) {
|
|
@@ -369,7 +473,7 @@ function tryTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
|
|
|
369
473
|
}
|
|
370
474
|
return tsconfigFilePath;
|
|
371
475
|
}
|
|
372
|
-
|
|
476
|
+
chunkPK6SKIKE_cjs.__name(tryTsconfigFilePath, "tryTsconfigFilePath");
|
|
373
477
|
function findMatch(tsconfigType, types, extensions = [
|
|
374
478
|
".ts",
|
|
375
479
|
".tsx",
|
|
@@ -377,7 +481,7 @@ function findMatch(tsconfigType, types, extensions = [
|
|
|
377
481
|
]) {
|
|
378
482
|
return types.find((type) => tsconfigType?.toString().toLowerCase() === type?.toString().toLowerCase() || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}` || `./${tsconfigType?.toString().toLowerCase()}` === type?.toString().toLowerCase() || extensions.some((ext) => `${tsconfigType?.toString().toLowerCase()}${ext}` === type?.toString().toLowerCase() || `${tsconfigType?.toString().toLowerCase()}${ext}` === `./${type?.toString().toLowerCase()}` || `${type?.toString().toLowerCase()}${ext}` === `./${tsconfigType?.toString().toLowerCase()}` || tsconfigType?.toString().toLowerCase() === `${type?.toString().toLowerCase()}${ext}` || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}${ext}` || type?.toString().toLowerCase() === `./${tsconfigType?.toString().toLowerCase()}${ext}`));
|
|
379
483
|
}
|
|
380
|
-
|
|
484
|
+
chunkPK6SKIKE_cjs.__name(findMatch, "findMatch");
|
|
381
485
|
function findIncludeMatch(tsconfigType, types) {
|
|
382
486
|
return findMatch(tsconfigType, types, [
|
|
383
487
|
".ts",
|
|
@@ -409,18 +513,18 @@ function findIncludeMatch(tsconfigType, types) {
|
|
|
409
513
|
"/**/*.cts"
|
|
410
514
|
]);
|
|
411
515
|
}
|
|
412
|
-
|
|
516
|
+
chunkPK6SKIKE_cjs.__name(findIncludeMatch, "findIncludeMatch");
|
|
413
517
|
function isIncludeMatchFound(tsconfigType, types) {
|
|
414
518
|
return findIncludeMatch(tsconfigType, types) !== void 0;
|
|
415
519
|
}
|
|
416
|
-
|
|
520
|
+
chunkPK6SKIKE_cjs.__name(isIncludeMatchFound, "isIncludeMatchFound");
|
|
417
521
|
function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfigRaw = {}, originalTsconfigJson, host = ts__default.default.sys) {
|
|
418
522
|
const tsconfigFilePath = getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
|
|
419
523
|
const tsconfigJson = json.readJsonFileSync(tsconfigFilePath);
|
|
420
524
|
if (!tsconfigJson) {
|
|
421
525
|
throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${joinPaths.joinPaths(projectRoot, tsconfig ?? "tsconfig.json")}`);
|
|
422
526
|
}
|
|
423
|
-
const parsedCommandLine = ts__default.default.parseJsonConfigFileContent(
|
|
527
|
+
const parsedCommandLine = ts__default.default.parseJsonConfigFileContent(defu7__default.default(tsconfigRaw ?? {}, tsconfigJson), host, append.appendPath(projectRoot, workspaceRoot));
|
|
424
528
|
if (parsedCommandLine.errors.length > 0) {
|
|
425
529
|
const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:
|
|
426
530
|
${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && error.code ? `[${error.category}-${error.code}]: ` : "") + error.messageText.toString()}`).join("\n")}
|
|
@@ -434,7 +538,7 @@ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && err
|
|
|
434
538
|
tsconfigFilePath
|
|
435
539
|
};
|
|
436
540
|
}
|
|
437
|
-
|
|
541
|
+
chunkPK6SKIKE_cjs.__name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
|
|
438
542
|
async function writeFile(log, filepath, content, skipFormat = false) {
|
|
439
543
|
try {
|
|
440
544
|
if (skipFormat) {
|
|
@@ -452,7 +556,7 @@ async function writeFile(log, filepath, content, skipFormat = false) {
|
|
|
452
556
|
${error?.message ? error.message : ""}`);
|
|
453
557
|
}
|
|
454
558
|
}
|
|
455
|
-
|
|
559
|
+
chunkPK6SKIKE_cjs.__name(writeFile, "writeFile");
|
|
456
560
|
|
|
457
561
|
// src/internal/helpers/resolve-tsconfig.ts
|
|
458
562
|
async function resolveTsconfigChanges(context) {
|
|
@@ -461,9 +565,6 @@ async function resolveTsconfigChanges(context) {
|
|
|
461
565
|
const tsconfigJson = await json.readJsonFile(tsconfigFilePath);
|
|
462
566
|
tsconfigJson.compilerOptions ??= {};
|
|
463
567
|
if (context.config.output.dts !== false) {
|
|
464
|
-
if (filePathFns.findFileExtension(context.dtsPath) !== "d.ts" && filePathFns.findFileExtension(context.dtsPath) !== "d.cts" && filePathFns.findFileExtension(context.dtsPath) !== "d.mts") {
|
|
465
|
-
context.config.output.dts = joinPaths.joinPaths(context.dtsPath, "powerlines.d.ts");
|
|
466
|
-
}
|
|
467
568
|
const dtsRelativePath = joinPaths.joinPaths(filePathFns.relativePath(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot), filePathFns.findFilePath(context.dtsPath)), filePathFns.findFileName(context.dtsPath));
|
|
468
569
|
if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [
|
|
469
570
|
context.dtsPath,
|
|
@@ -496,7 +597,7 @@ async function resolveTsconfigChanges(context) {
|
|
|
496
597
|
}
|
|
497
598
|
return tsconfigJson;
|
|
498
599
|
}
|
|
499
|
-
|
|
600
|
+
chunkPK6SKIKE_cjs.__name(resolveTsconfigChanges, "resolveTsconfigChanges");
|
|
500
601
|
async function initializeTsconfig(context) {
|
|
501
602
|
context.log(types.LogLevelLabel.TRACE, "Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.");
|
|
502
603
|
if (!packageFns.isPackageExists("typescript")) {
|
|
@@ -506,12 +607,10 @@ async function initializeTsconfig(context) {
|
|
|
506
607
|
context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
|
|
507
608
|
context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
|
|
508
609
|
context.log(types.LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
|
|
509
|
-
await context.
|
|
510
|
-
mode: "fs"
|
|
511
|
-
});
|
|
610
|
+
await writeFile(context.log, tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson));
|
|
512
611
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
|
|
513
612
|
}
|
|
514
|
-
|
|
613
|
+
chunkPK6SKIKE_cjs.__name(initializeTsconfig, "initializeTsconfig");
|
|
515
614
|
async function resolveTsconfig(context) {
|
|
516
615
|
const updateTsconfigJson = await json.readJsonFile(context.tsconfig.tsconfigFilePath);
|
|
517
616
|
if (updateTsconfigJson?.compilerOptions?.types && Array.isArray(updateTsconfigJson.compilerOptions.types) && !updateTsconfigJson.compilerOptions.types.length) {
|
|
@@ -529,7 +628,7 @@ async function resolveTsconfig(context) {
|
|
|
529
628
|
}
|
|
530
629
|
});
|
|
531
630
|
const changes = [];
|
|
532
|
-
const getChanges = /* @__PURE__ */
|
|
631
|
+
const getChanges = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((difference, property) => {
|
|
533
632
|
if (difference.status === "added" || difference.status === "deleted" || difference.status === "updated") {
|
|
534
633
|
if (difference.diff) {
|
|
535
634
|
for (const diff of difference.diff) {
|
|
@@ -565,10 +664,10 @@ async function resolveTsconfig(context) {
|
|
|
565
664
|
context.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
566
665
|
context.tsconfig.tsconfigJson.compilerOptions.strict = false;
|
|
567
666
|
}
|
|
568
|
-
|
|
667
|
+
chunkPK6SKIKE_cjs.__name(resolveTsconfig, "resolveTsconfig");
|
|
569
668
|
var DEFAULT_ENVIRONMENT = "default";
|
|
570
669
|
function createEnvironment(name, userConfig) {
|
|
571
|
-
return
|
|
670
|
+
return defu7__default.default(userConfig.environments?.[name] ?? {}, {
|
|
572
671
|
name,
|
|
573
672
|
title: userConfig.title || titleCase.titleCase(userConfig.name),
|
|
574
673
|
ssr: false,
|
|
@@ -606,13 +705,13 @@ function createEnvironment(name, userConfig) {
|
|
|
606
705
|
} : void 0
|
|
607
706
|
}, userConfig);
|
|
608
707
|
}
|
|
609
|
-
|
|
708
|
+
chunkPK6SKIKE_cjs.__name(createEnvironment, "createEnvironment");
|
|
610
709
|
function createDefaultEnvironment(userConfig) {
|
|
611
710
|
return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);
|
|
612
711
|
}
|
|
613
|
-
|
|
712
|
+
chunkPK6SKIKE_cjs.__name(createDefaultEnvironment, "createDefaultEnvironment");
|
|
614
713
|
async function loadWorkspaceConfig(workspaceRoot, cwd) {
|
|
615
|
-
return
|
|
714
|
+
return defu7__default.default({
|
|
616
715
|
workspaceRoot
|
|
617
716
|
}, await getConfig.getWorkspaceConfig(true, {
|
|
618
717
|
cwd,
|
|
@@ -620,7 +719,7 @@ async function loadWorkspaceConfig(workspaceRoot, cwd) {
|
|
|
620
719
|
useDefault: true
|
|
621
720
|
}));
|
|
622
721
|
}
|
|
623
|
-
|
|
722
|
+
chunkPK6SKIKE_cjs.__name(loadWorkspaceConfig, "loadWorkspaceConfig");
|
|
624
723
|
async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mode = "production", configFile, framework = "powerlines") {
|
|
625
724
|
let resolvedUserConfig = {};
|
|
626
725
|
let resolvedUserConfigFile;
|
|
@@ -660,73 +759,72 @@ async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mod
|
|
|
660
759
|
dotenv: true,
|
|
661
760
|
jiti
|
|
662
761
|
});
|
|
663
|
-
return
|
|
762
|
+
return defu7__default.default(resolvedUserConfig, isSetObject.isSetObject(result?.config) ? {
|
|
664
763
|
...result.config,
|
|
665
764
|
...result
|
|
666
765
|
} : {});
|
|
667
766
|
}
|
|
668
|
-
|
|
767
|
+
chunkPK6SKIKE_cjs.__name(loadUserConfigFile, "loadUserConfigFile");
|
|
669
768
|
function resolveOptions(options) {
|
|
670
|
-
return
|
|
671
|
-
debug: options.logLevel === "trace",
|
|
769
|
+
return defu7__default.default(options, {
|
|
672
770
|
interopDefault: true,
|
|
673
771
|
fsCache: options.mode !== "development" ? joinPaths.joinPaths(options.cacheDir, "jiti") : false,
|
|
674
772
|
moduleCache: options.mode !== "development"
|
|
675
773
|
});
|
|
676
774
|
}
|
|
677
|
-
|
|
775
|
+
chunkPK6SKIKE_cjs.__name(resolveOptions, "resolveOptions");
|
|
678
776
|
function createPluginResolver(options) {
|
|
679
777
|
return jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({
|
|
680
778
|
...options
|
|
681
779
|
}));
|
|
682
780
|
}
|
|
683
|
-
|
|
781
|
+
chunkPK6SKIKE_cjs.__name(createPluginResolver, "createPluginResolver");
|
|
684
782
|
function createResolver(options) {
|
|
685
783
|
const baseResolver = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions(options));
|
|
686
784
|
baseResolver.plugin = createPluginResolver(options);
|
|
687
785
|
return baseResolver;
|
|
688
786
|
}
|
|
689
|
-
|
|
787
|
+
chunkPK6SKIKE_cjs.__name(createResolver, "createResolver");
|
|
690
788
|
function isPlugin(value) {
|
|
691
|
-
return isSetObject.isSetObject(value) && "name" in value && isSetString.isSetString(value.name) && (isUndefined.isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction.isFunction(value.applyToEnvironment)) && (isUndefined.isUndefined(value.dedupe) || "dedupe" in value && isFunction.isFunction(value.dedupe)) && (isUndefined.isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) &&
|
|
789
|
+
return isSetObject.isSetObject(value) && "name" in value && isSetString.isSetString(value.name) && (isUndefined.isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction.isFunction(value.applyToEnvironment)) && (isUndefined.isUndefined(value.dedupe) || "dedupe" in value && isFunction.isFunction(value.dedupe)) && (isUndefined.isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) && chunkZ6ARQDHR_cjs.SUPPORTED_COMMANDS.every((command) => isUndefined.isUndefined(value[command]) || command in value && (isFunction.isFunction(value[command]) || isSetObject.isSetObject(value[command]) && "handler" in value[command] && isFunction.isFunction(value[command].handler)));
|
|
692
790
|
}
|
|
693
|
-
|
|
791
|
+
chunkPK6SKIKE_cjs.__name(isPlugin, "isPlugin");
|
|
694
792
|
function isPluginConfigObject(value) {
|
|
695
793
|
return isSetObject.isSetObject(value) && "plugin" in value && ((isSetString.isSetString(value.plugin) || isFunction.isFunction(value.plugin)) && "options" in value && isSetObject.isSetObject(value.options) || isPlugin(value.plugin));
|
|
696
794
|
}
|
|
697
|
-
|
|
795
|
+
chunkPK6SKIKE_cjs.__name(isPluginConfigObject, "isPluginConfigObject");
|
|
698
796
|
function isPluginConfigTuple(value) {
|
|
699
797
|
return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString.isSetString(value[0]) || isFunction.isFunction(value[0])) && value.length > 1 && isSetObject.isSetObject(value[1]) || isPlugin(value[0]));
|
|
700
798
|
}
|
|
701
|
-
|
|
799
|
+
chunkPK6SKIKE_cjs.__name(isPluginConfigTuple, "isPluginConfigTuple");
|
|
702
800
|
function isPluginConfig(value) {
|
|
703
801
|
return isSetString.isSetString(value) || isFunction.isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
|
|
704
802
|
}
|
|
705
|
-
|
|
803
|
+
chunkPK6SKIKE_cjs.__name(isPluginConfig, "isPluginConfig");
|
|
706
804
|
function isPluginHookFunction(value) {
|
|
707
805
|
return isFunction.isFunction(value) || isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
|
|
708
806
|
}
|
|
709
|
-
|
|
807
|
+
chunkPK6SKIKE_cjs.__name(isPluginHookFunction, "isPluginHookFunction");
|
|
710
808
|
function isPluginHookObject(value) {
|
|
711
809
|
return isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
|
|
712
810
|
}
|
|
713
|
-
|
|
811
|
+
chunkPK6SKIKE_cjs.__name(isPluginHookObject, "isPluginHookObject");
|
|
714
812
|
function isPluginHook(value) {
|
|
715
813
|
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
716
814
|
}
|
|
717
|
-
|
|
815
|
+
chunkPK6SKIKE_cjs.__name(isPluginHook, "isPluginHook");
|
|
718
816
|
function getHookHandler(pluginHook) {
|
|
719
817
|
return isFunction.isFunction(pluginHook) ? pluginHook : pluginHook.handler;
|
|
720
818
|
}
|
|
721
|
-
|
|
819
|
+
chunkPK6SKIKE_cjs.__name(getHookHandler, "getHookHandler");
|
|
722
820
|
function isHookExternal(hook) {
|
|
723
821
|
return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
|
|
724
822
|
}
|
|
725
|
-
|
|
823
|
+
chunkPK6SKIKE_cjs.__name(isHookExternal, "isHookExternal");
|
|
726
824
|
function checkDedupe(plugin, plugins) {
|
|
727
825
|
return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction.isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
728
826
|
}
|
|
729
|
-
|
|
827
|
+
chunkPK6SKIKE_cjs.__name(checkDedupe, "checkDedupe");
|
|
730
828
|
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
731
829
|
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
|
|
732
830
|
hooksList.push(isFunction.isFunction(pluginHook) ? {
|
|
@@ -739,29 +837,29 @@ function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
|
739
837
|
});
|
|
740
838
|
}
|
|
741
839
|
}
|
|
742
|
-
|
|
840
|
+
chunkPK6SKIKE_cjs.__name(addPluginHook, "addPluginHook");
|
|
743
841
|
function replacePathTokens(context, path) {
|
|
744
842
|
if (!path) {
|
|
745
843
|
return path;
|
|
746
844
|
}
|
|
747
|
-
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{
|
|
845
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replace.replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replace.replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replace.replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
748
846
|
}
|
|
749
|
-
|
|
847
|
+
chunkPK6SKIKE_cjs.__name(replacePathTokens, "replacePathTokens");
|
|
750
848
|
function resolveEntryInputFile(context, typeDefinition) {
|
|
751
849
|
return replace.replacePath(typeDefinition.file, joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot));
|
|
752
850
|
}
|
|
753
|
-
|
|
851
|
+
chunkPK6SKIKE_cjs.__name(resolveEntryInputFile, "resolveEntryInputFile");
|
|
754
852
|
function resolveEntryInput(context, typeDefinition) {
|
|
755
853
|
return {
|
|
756
854
|
file: resolveEntryInputFile(context, typeDefinition),
|
|
757
855
|
name: typeDefinition.name
|
|
758
856
|
};
|
|
759
857
|
}
|
|
760
|
-
|
|
858
|
+
chunkPK6SKIKE_cjs.__name(resolveEntryInput, "resolveEntryInput");
|
|
761
859
|
function resolveEntryOutput(context, typeDefinition) {
|
|
762
860
|
return replace.replaceExtension(replace.replacePath(replace.replacePath(replace.replacePath(replace.replacePath(replace.replacePath(typeDefinition.file, joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.sourceRoot)), joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)), context.config.sourceRoot), context.config.projectRoot), replace.replacePath(context.config.sourceRoot, context.config.projectRoot)));
|
|
763
861
|
}
|
|
764
|
-
|
|
862
|
+
chunkPK6SKIKE_cjs.__name(resolveEntryOutput, "resolveEntryOutput");
|
|
765
863
|
function resolveEntry(context, typeDefinition) {
|
|
766
864
|
const input = resolveEntryInput(context, typeDefinition);
|
|
767
865
|
return {
|
|
@@ -770,7 +868,7 @@ function resolveEntry(context, typeDefinition) {
|
|
|
770
868
|
output: resolveEntryOutput(context, typeDefinition)
|
|
771
869
|
};
|
|
772
870
|
}
|
|
773
|
-
|
|
871
|
+
chunkPK6SKIKE_cjs.__name(resolveEntry, "resolveEntry");
|
|
774
872
|
function resolveEntriesSync(context, typeDefinitions) {
|
|
775
873
|
return typeDefinitions.map((entry) => isString.isString(entry) ? replacePathTokens(context, entry) : replacePathTokens(context, entry.file)).map((typeDefinition) => {
|
|
776
874
|
const parsed = parseTypeDefinition.parseTypeDefinition(typeDefinition);
|
|
@@ -787,30 +885,17 @@ function resolveEntriesSync(context, typeDefinitions) {
|
|
|
787
885
|
}));
|
|
788
886
|
}).flat().filter(Boolean);
|
|
789
887
|
}
|
|
790
|
-
|
|
888
|
+
chunkPK6SKIKE_cjs.__name(resolveEntriesSync, "resolveEntriesSync");
|
|
791
889
|
function getUniqueEntries(entries = []) {
|
|
792
890
|
return getUnique.getUniqueBy(toArray.toArray(entries), (item) => isSetString.isSetString(item) ? item : murmurhash.murmurhash(item ?? {}, {
|
|
793
891
|
maxLength: 24
|
|
794
892
|
}));
|
|
795
893
|
}
|
|
796
|
-
|
|
894
|
+
chunkPK6SKIKE_cjs.__name(getUniqueEntries, "getUniqueEntries");
|
|
797
895
|
var _capnpFileId = BigInt("0xa56c61324b9d6e49");
|
|
798
|
-
var FileType = {
|
|
799
|
-
NORMAL: 0,
|
|
800
|
-
BUILTIN: 1,
|
|
801
|
-
ENTRY: 2,
|
|
802
|
-
CHUNK: 3,
|
|
803
|
-
PREBUILT: 4,
|
|
804
|
-
ASSET: 5
|
|
805
|
-
};
|
|
806
|
-
var PreserveSignatureType = {
|
|
807
|
-
STRICT: 0,
|
|
808
|
-
ALLOW_EXTENSION: 1,
|
|
809
|
-
EXPORTS_ONLY: 2
|
|
810
|
-
};
|
|
811
896
|
var FileMetadata_KeyValuePair = class extends $__namespace.Struct {
|
|
812
897
|
static {
|
|
813
|
-
|
|
898
|
+
chunkPK6SKIKE_cjs.__name(this, "FileMetadata_KeyValuePair");
|
|
814
899
|
}
|
|
815
900
|
static _capnp = {
|
|
816
901
|
displayName: "KeyValuePair",
|
|
@@ -835,13 +920,13 @@ var FileMetadata_KeyValuePair = class extends $__namespace.Struct {
|
|
|
835
920
|
};
|
|
836
921
|
var FileMetadata = class _FileMetadata extends $__namespace.Struct {
|
|
837
922
|
static {
|
|
838
|
-
|
|
923
|
+
chunkPK6SKIKE_cjs.__name(this, "FileMetadata");
|
|
839
924
|
}
|
|
840
925
|
static KeyValuePair = FileMetadata_KeyValuePair;
|
|
841
926
|
static _capnp = {
|
|
842
927
|
displayName: "FileMetadata",
|
|
843
928
|
id: "8e2cab5d7e28c7b3",
|
|
844
|
-
size: new $__namespace.ObjectSize(8,
|
|
929
|
+
size: new $__namespace.ObjectSize(8, 3),
|
|
845
930
|
defaultType: "normal"
|
|
846
931
|
};
|
|
847
932
|
static _Properties;
|
|
@@ -856,7 +941,7 @@ var FileMetadata = class _FileMetadata extends $__namespace.Struct {
|
|
|
856
941
|
$__namespace.utils.setText(0, value, this);
|
|
857
942
|
}
|
|
858
943
|
/**
|
|
859
|
-
* The
|
|
944
|
+
* The timestamp representing the file's creation date.
|
|
860
945
|
*
|
|
861
946
|
*/
|
|
862
947
|
get type() {
|
|
@@ -866,16 +951,6 @@ var FileMetadata = class _FileMetadata extends $__namespace.Struct {
|
|
|
866
951
|
$__namespace.utils.setText(1, value, this);
|
|
867
952
|
}
|
|
868
953
|
/**
|
|
869
|
-
* The timestamp representing the file's creation date.
|
|
870
|
-
*
|
|
871
|
-
*/
|
|
872
|
-
get mode() {
|
|
873
|
-
return $__namespace.utils.getText(2, this);
|
|
874
|
-
}
|
|
875
|
-
set mode(value) {
|
|
876
|
-
$__namespace.utils.setText(2, value, this);
|
|
877
|
-
}
|
|
878
|
-
/**
|
|
879
954
|
* Additional metadata associated with the file.
|
|
880
955
|
*
|
|
881
956
|
*/
|
|
@@ -886,22 +961,22 @@ var FileMetadata = class _FileMetadata extends $__namespace.Struct {
|
|
|
886
961
|
$__namespace.utils.setUint32(0, value, this);
|
|
887
962
|
}
|
|
888
963
|
_adoptProperties(value) {
|
|
889
|
-
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(
|
|
964
|
+
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(2, this));
|
|
890
965
|
}
|
|
891
966
|
_disownProperties() {
|
|
892
967
|
return $__namespace.utils.disown(this.properties);
|
|
893
968
|
}
|
|
894
969
|
get properties() {
|
|
895
|
-
return $__namespace.utils.getList(
|
|
970
|
+
return $__namespace.utils.getList(2, _FileMetadata._Properties, this);
|
|
896
971
|
}
|
|
897
972
|
_hasProperties() {
|
|
898
|
-
return !$__namespace.utils.isNull($__namespace.utils.getPointer(
|
|
973
|
+
return !$__namespace.utils.isNull($__namespace.utils.getPointer(2, this));
|
|
899
974
|
}
|
|
900
975
|
_initProperties(length) {
|
|
901
|
-
return $__namespace.utils.initList(
|
|
976
|
+
return $__namespace.utils.initList(2, _FileMetadata._Properties, length, this);
|
|
902
977
|
}
|
|
903
978
|
set properties(value) {
|
|
904
|
-
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(
|
|
979
|
+
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
|
|
905
980
|
}
|
|
906
981
|
toString() {
|
|
907
982
|
return "FileMetadata_" + super.toString();
|
|
@@ -909,7 +984,7 @@ var FileMetadata = class _FileMetadata extends $__namespace.Struct {
|
|
|
909
984
|
};
|
|
910
985
|
var FileId = class extends $__namespace.Struct {
|
|
911
986
|
static {
|
|
912
|
-
|
|
987
|
+
chunkPK6SKIKE_cjs.__name(this, "FileId");
|
|
913
988
|
}
|
|
914
989
|
static _capnp = {
|
|
915
990
|
displayName: "FileId",
|
|
@@ -936,13 +1011,13 @@ var FileId = class extends $__namespace.Struct {
|
|
|
936
1011
|
return "FileId_" + super.toString();
|
|
937
1012
|
}
|
|
938
1013
|
};
|
|
939
|
-
var
|
|
1014
|
+
var FileStorage = class extends $__namespace.Struct {
|
|
940
1015
|
static {
|
|
941
|
-
|
|
1016
|
+
chunkPK6SKIKE_cjs.__name(this, "FileStorage");
|
|
942
1017
|
}
|
|
943
1018
|
static _capnp = {
|
|
944
|
-
displayName: "
|
|
945
|
-
id: "
|
|
1019
|
+
displayName: "FileStorage",
|
|
1020
|
+
id: "9dca66ac858c9ebe",
|
|
946
1021
|
size: new $__namespace.ObjectSize(0, 2)
|
|
947
1022
|
};
|
|
948
1023
|
/**
|
|
@@ -962,12 +1037,12 @@ var FileData = class extends $__namespace.Struct {
|
|
|
962
1037
|
$__namespace.utils.setText(1, value, this);
|
|
963
1038
|
}
|
|
964
1039
|
toString() {
|
|
965
|
-
return "
|
|
1040
|
+
return "FileStorage_" + super.toString();
|
|
966
1041
|
}
|
|
967
1042
|
};
|
|
968
1043
|
var FileSystem = class _FileSystem extends $__namespace.Struct {
|
|
969
1044
|
static {
|
|
970
|
-
|
|
1045
|
+
chunkPK6SKIKE_cjs.__name(this, "FileSystem");
|
|
971
1046
|
}
|
|
972
1047
|
static _capnp = {
|
|
973
1048
|
displayName: "FileSystem",
|
|
@@ -975,7 +1050,7 @@ var FileSystem = class _FileSystem extends $__namespace.Struct {
|
|
|
975
1050
|
size: new $__namespace.ObjectSize(0, 3)
|
|
976
1051
|
};
|
|
977
1052
|
static _Ids;
|
|
978
|
-
static
|
|
1053
|
+
static _Storage;
|
|
979
1054
|
static _Metadata;
|
|
980
1055
|
_adoptIds(value) {
|
|
981
1056
|
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(0, this));
|
|
@@ -995,22 +1070,22 @@ var FileSystem = class _FileSystem extends $__namespace.Struct {
|
|
|
995
1070
|
set ids(value) {
|
|
996
1071
|
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(0, this));
|
|
997
1072
|
}
|
|
998
|
-
|
|
1073
|
+
_adoptStorage(value) {
|
|
999
1074
|
$__namespace.utils.adopt(value, $__namespace.utils.getPointer(1, this));
|
|
1000
1075
|
}
|
|
1001
|
-
|
|
1002
|
-
return $__namespace.utils.disown(this.
|
|
1076
|
+
_disownStorage() {
|
|
1077
|
+
return $__namespace.utils.disown(this.storage);
|
|
1003
1078
|
}
|
|
1004
|
-
get
|
|
1005
|
-
return $__namespace.utils.getList(1, _FileSystem.
|
|
1079
|
+
get storage() {
|
|
1080
|
+
return $__namespace.utils.getList(1, _FileSystem._Storage, this);
|
|
1006
1081
|
}
|
|
1007
|
-
|
|
1082
|
+
_hasStorage() {
|
|
1008
1083
|
return !$__namespace.utils.isNull($__namespace.utils.getPointer(1, this));
|
|
1009
1084
|
}
|
|
1010
|
-
|
|
1011
|
-
return $__namespace.utils.initList(1, _FileSystem.
|
|
1085
|
+
_initStorage(length) {
|
|
1086
|
+
return $__namespace.utils.initList(1, _FileSystem._Storage, length, this);
|
|
1012
1087
|
}
|
|
1013
|
-
set
|
|
1088
|
+
set storage(value) {
|
|
1014
1089
|
$__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(1, this));
|
|
1015
1090
|
}
|
|
1016
1091
|
_adoptMetadata(value) {
|
|
@@ -1037,9 +1112,9 @@ var FileSystem = class _FileSystem extends $__namespace.Struct {
|
|
|
1037
1112
|
};
|
|
1038
1113
|
FileMetadata._Properties = $__namespace.CompositeList(FileMetadata_KeyValuePair);
|
|
1039
1114
|
FileSystem._Ids = $__namespace.CompositeList(FileId);
|
|
1040
|
-
FileSystem.
|
|
1115
|
+
FileSystem._Storage = $__namespace.CompositeList(FileStorage);
|
|
1041
1116
|
FileSystem._Metadata = $__namespace.CompositeList(FileMetadata);
|
|
1042
|
-
var createLog = /* @__PURE__ */
|
|
1117
|
+
var createLog = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((name, options = {}) => {
|
|
1043
1118
|
const logLevel = options.logLevel === null ? types.LogLevelLabel.SILENT : options.logLevel || types.LogLevelLabel.INFO;
|
|
1044
1119
|
if (logLevel === types.LogLevelLabel.SILENT) {
|
|
1045
1120
|
return noop.noop;
|
|
@@ -1074,319 +1149,399 @@ var BADGE_COLORS = [
|
|
|
1074
1149
|
"#FACC15",
|
|
1075
1150
|
"#34D399"
|
|
1076
1151
|
];
|
|
1077
|
-
var extendLog = /* @__PURE__ */
|
|
1152
|
+
var extendLog = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((logFn, name) => {
|
|
1078
1153
|
return (type, ...args) => logFn(type, ` ${chalk5__default.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase.titleCase(name)} `)} ${args.join(" ")} `);
|
|
1079
1154
|
}, "extendLog");
|
|
1080
|
-
function
|
|
1081
|
-
return
|
|
1082
|
-
}
|
|
1083
|
-
chunkUSNT2KNT_cjs.__name(isBufferEncoding, "isBufferEncoding");
|
|
1084
|
-
function isPowerlinesWriteFileOptions(options) {
|
|
1085
|
-
return !isBufferEncoding(options) && isSetObject.isSetObject(options) && "mode" in options && (options.mode === "fs" || options.mode === "virtual");
|
|
1155
|
+
function isFileError(err) {
|
|
1156
|
+
return isError.isError(err) && "code" in err && err.code;
|
|
1086
1157
|
}
|
|
1087
|
-
|
|
1088
|
-
function
|
|
1089
|
-
return
|
|
1158
|
+
chunkPK6SKIKE_cjs.__name(isFileError, "isFileError");
|
|
1159
|
+
function ignoreNotfound(err) {
|
|
1160
|
+
return isFileError(err) && (err.code === "ENOENT" || err.code === "EISDIR" ? null : err);
|
|
1090
1161
|
}
|
|
1091
|
-
|
|
1162
|
+
chunkPK6SKIKE_cjs.__name(ignoreNotfound, "ignoreNotfound");
|
|
1092
1163
|
function toFilePath(path) {
|
|
1093
1164
|
return correctPath.correctPath(slash.slash(path?.toString() || ".").replace(/^file:\/\//, ""));
|
|
1094
1165
|
}
|
|
1095
|
-
|
|
1096
|
-
var FS_METHODS = [
|
|
1097
|
-
"mkdir",
|
|
1098
|
-
"mkdirSync",
|
|
1099
|
-
"rmdir",
|
|
1100
|
-
"rmdirSync",
|
|
1101
|
-
"unlink",
|
|
1102
|
-
"unlinkSync",
|
|
1103
|
-
"existsSync",
|
|
1104
|
-
"realpathSync",
|
|
1105
|
-
"writeFileSync",
|
|
1106
|
-
"readFileSync",
|
|
1107
|
-
"readdirSync",
|
|
1108
|
-
"createWriteStream",
|
|
1109
|
-
"WriteStream",
|
|
1110
|
-
"createReadStream",
|
|
1111
|
-
"ReadStream"
|
|
1112
|
-
];
|
|
1113
|
-
var FS_PROMISE_METHODS = [
|
|
1114
|
-
"mkdir",
|
|
1115
|
-
"rm",
|
|
1116
|
-
"rmdir",
|
|
1117
|
-
"unlink",
|
|
1118
|
-
"writeFile",
|
|
1119
|
-
"readFile",
|
|
1120
|
-
"readdir",
|
|
1121
|
-
"stat",
|
|
1122
|
-
"lstat"
|
|
1123
|
-
];
|
|
1124
|
-
function cloneFS(originalFS) {
|
|
1125
|
-
const clonedFS = {
|
|
1126
|
-
...originalFS,
|
|
1127
|
-
promises: {
|
|
1128
|
-
...originalFS.promises ?? {}
|
|
1129
|
-
}
|
|
1130
|
-
};
|
|
1131
|
-
for (const method of FS_METHODS) {
|
|
1132
|
-
if (originalFS[method]) {
|
|
1133
|
-
clonedFS[method] = originalFS[method];
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
originalFS.promises ??= {};
|
|
1137
|
-
for (const method of FS_PROMISE_METHODS) {
|
|
1138
|
-
if (originalFS.promises[method]) {
|
|
1139
|
-
clonedFS.promises ??= {};
|
|
1140
|
-
clonedFS.promises[method] = originalFS.promises[method];
|
|
1141
|
-
clonedFS[method] = originalFS.promises[method];
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
for (const prop in clonedFS) {
|
|
1145
|
-
if (isFunction.isFunction(clonedFS[prop])) {
|
|
1146
|
-
clonedFS[prop] = clonedFS[prop].bind(originalFS);
|
|
1147
|
-
if (isFunction.isFunction(clonedFS.promises[prop])) {
|
|
1148
|
-
clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
for (const prop in clonedFS.promises) {
|
|
1153
|
-
if (isFunction.isFunction(clonedFS.promises[prop])) {
|
|
1154
|
-
clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
return clonedFS;
|
|
1158
|
-
}
|
|
1159
|
-
chunkUSNT2KNT_cjs.__name(cloneFS, "cloneFS");
|
|
1160
|
-
function patchFS(originalFS, vfs) {
|
|
1161
|
-
const clonedFS = cloneFS(originalFS);
|
|
1162
|
-
originalFS.mkdirSync = (file, options) => vfs.mkdirSync(toFilePath(file), options);
|
|
1163
|
-
originalFS.mkdir = (file, options, callback) => vfs.mkdir(toFilePath(file), options, callback);
|
|
1164
|
-
originalFS.promises.mkdir = async (file, options) => vfs.mkdir(toFilePath(file), options);
|
|
1165
|
-
originalFS.unlinkSync = (file) => vfs.unlinkSync(toFilePath(file));
|
|
1166
|
-
originalFS.promises.rm = async (file, options) => vfs.rm(toFilePath(file), options);
|
|
1167
|
-
originalFS.promises.unlink = async (file) => vfs.unlink(toFilePath(file));
|
|
1168
|
-
originalFS.existsSync = (file) => vfs.existsSync(toFilePath(file));
|
|
1169
|
-
Object.defineProperty(originalFS, "realpathSync", {
|
|
1170
|
-
value: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((file, options) => vfs.realpathSync(toFilePath(file), options), "value")
|
|
1171
|
-
});
|
|
1172
|
-
originalFS.writeFileSync = (file, data, options) => vfs.writeFileSync(toFilePath(file), data, options);
|
|
1173
|
-
originalFS.promises.writeFile = async (file, data, options) => vfs.writeFile(toFilePath(file), data, options);
|
|
1174
|
-
originalFS.readFileSync = (file, options) => vfs.readFileSync(toFilePath(file), options);
|
|
1175
|
-
originalFS.promises.readFile = (file, options) => vfs.readFile(toFilePath(file), options);
|
|
1176
|
-
originalFS.readdirSync = (file, options) => vfs.readdirSync(toFilePath(file), options);
|
|
1177
|
-
originalFS.promises.readdir = (file, options) => vfs.readdir(toFilePath(file), options);
|
|
1178
|
-
Object.defineProperty(originalFS, "statSync", {
|
|
1179
|
-
value: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((file, options) => vfs.statSync(toFilePath(file), options), "value")
|
|
1180
|
-
});
|
|
1181
|
-
originalFS.stat = (file, options) => vfs.statSync(toFilePath(file), options);
|
|
1182
|
-
originalFS.promises.stat = (file, options) => vfs.stat(toFilePath(file), options);
|
|
1183
|
-
Object.defineProperty(originalFS, "lstatSync", {
|
|
1184
|
-
value: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((file, options) => vfs.lstatSync(toFilePath(file), options), "value")
|
|
1185
|
-
});
|
|
1186
|
-
originalFS.lstat = (file, options) => vfs.lstatSync(toFilePath(file), options);
|
|
1187
|
-
originalFS.promises.lstat = (file, options) => vfs.lstat(toFilePath(file), options);
|
|
1188
|
-
return () => {
|
|
1189
|
-
originalFS.mkdirSync = clonedFS.mkdirSync;
|
|
1190
|
-
originalFS.mkdir = clonedFS.mkdir;
|
|
1191
|
-
originalFS.promises.mkdir = clonedFS.promises.mkdir;
|
|
1192
|
-
originalFS.unlinkSync = clonedFS.unlinkSync;
|
|
1193
|
-
originalFS.promises.rm = clonedFS.promises.rm;
|
|
1194
|
-
originalFS.promises.unlink = clonedFS.promises.unlink;
|
|
1195
|
-
originalFS.existsSync = clonedFS.existsSync;
|
|
1196
|
-
originalFS.realpathSync = clonedFS.realpathSync;
|
|
1197
|
-
originalFS.writeFileSync = clonedFS.writeFileSync;
|
|
1198
|
-
originalFS.promises.writeFile = clonedFS.promises.writeFile;
|
|
1199
|
-
originalFS.readFileSync = clonedFS.readFileSync;
|
|
1200
|
-
originalFS.promises.readFile = clonedFS.promises.readFile;
|
|
1201
|
-
originalFS.readdirSync = clonedFS.readdirSync;
|
|
1202
|
-
originalFS.promises.readdir = clonedFS.promises.readdir;
|
|
1203
|
-
Object.defineProperty(originalFS, "statSync", {
|
|
1204
|
-
value: clonedFS.statSync
|
|
1205
|
-
});
|
|
1206
|
-
originalFS.stat = clonedFS.stat;
|
|
1207
|
-
originalFS.promises.stat = clonedFS.promises.stat;
|
|
1208
|
-
Object.defineProperty(originalFS, "lstatSync", {
|
|
1209
|
-
value: clonedFS.lstatSync
|
|
1210
|
-
});
|
|
1211
|
-
originalFS.lstat = clonedFS.lstat;
|
|
1212
|
-
originalFS.promises.lstat = clonedFS.promises.lstat;
|
|
1213
|
-
};
|
|
1214
|
-
}
|
|
1215
|
-
chunkUSNT2KNT_cjs.__name(patchFS, "patchFS");
|
|
1166
|
+
chunkPK6SKIKE_cjs.__name(toFilePath, "toFilePath");
|
|
1216
1167
|
function isValidId(id, prefix = "powerlines") {
|
|
1217
1168
|
return id.replace(/^\\0/, "").startsWith(`${prefix.replace(/:$/, "")}`);
|
|
1218
1169
|
}
|
|
1219
|
-
|
|
1170
|
+
chunkPK6SKIKE_cjs.__name(isValidId, "isValidId");
|
|
1220
1171
|
function normalizeId(id, prefix = "powerlines") {
|
|
1221
1172
|
return `${prefix.replace(/:$/, "")}:${toFilePath(id).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(toFilePath(id)), "")}`;
|
|
1222
1173
|
}
|
|
1223
|
-
|
|
1174
|
+
chunkPK6SKIKE_cjs.__name(normalizeId, "normalizeId");
|
|
1224
1175
|
function normalizePath(path, builtinsPath, prefix = "powerlines") {
|
|
1225
|
-
return isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
|
|
1176
|
+
return isType.isAbsolutePath(path) ? path : isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
|
|
1226
1177
|
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1178
|
+
chunkPK6SKIKE_cjs.__name(normalizePath, "normalizePath");
|
|
1179
|
+
function normalizeKey(key, sep = ":") {
|
|
1180
|
+
if (!key) {
|
|
1181
|
+
return "";
|
|
1182
|
+
}
|
|
1183
|
+
return key.replace(/[:/\\]/g, sep).replace(/^[:/\\]|[:/\\]$/g, "");
|
|
1184
|
+
}
|
|
1185
|
+
chunkPK6SKIKE_cjs.__name(normalizeKey, "normalizeKey");
|
|
1186
|
+
function filterKeyByBase(key, base) {
|
|
1187
|
+
if (base) {
|
|
1188
|
+
return key.startsWith(base) && key[key.length - 1] !== "$";
|
|
1189
|
+
}
|
|
1190
|
+
return key[key.length - 1] !== "$";
|
|
1191
|
+
}
|
|
1192
|
+
chunkPK6SKIKE_cjs.__name(filterKeyByBase, "filterKeyByBase");
|
|
1193
|
+
var BaseStorageAdapter = class {
|
|
1229
1194
|
static {
|
|
1230
|
-
|
|
1195
|
+
chunkPK6SKIKE_cjs.__name(this, "BaseStorageAdapter");
|
|
1231
1196
|
}
|
|
1232
1197
|
/**
|
|
1233
|
-
*
|
|
1198
|
+
* Indicates whether the storage adapter has been disposed.
|
|
1234
1199
|
*/
|
|
1235
|
-
#
|
|
1200
|
+
#isDisposed = false;
|
|
1236
1201
|
/**
|
|
1237
|
-
*
|
|
1202
|
+
* Configuration options for the storage adapter.
|
|
1238
1203
|
*/
|
|
1239
|
-
|
|
1204
|
+
options;
|
|
1240
1205
|
/**
|
|
1241
|
-
*
|
|
1206
|
+
* Constructor for the BaseStorageAdapter.
|
|
1207
|
+
*
|
|
1208
|
+
* @param options - Configuration options for the storage adapter.
|
|
1242
1209
|
*/
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
}
|
|
1250
|
-
return result;
|
|
1210
|
+
constructor(options = {
|
|
1211
|
+
base: "/"
|
|
1212
|
+
}) {
|
|
1213
|
+
this.options = options;
|
|
1214
|
+
this.options.base = path.resolve(options.base);
|
|
1215
|
+
this.options.isReadOnly = !!options.isReadOnly;
|
|
1251
1216
|
}
|
|
1252
1217
|
/**
|
|
1253
|
-
*
|
|
1218
|
+
* Asynchronously checks if a key exists in the storage.
|
|
1219
|
+
*
|
|
1220
|
+
* @param key - The key to check for existence.
|
|
1221
|
+
* @returns A promise that resolves to `true` if the key exists, otherwise `false`.
|
|
1254
1222
|
*/
|
|
1255
|
-
|
|
1256
|
-
return this
|
|
1223
|
+
async exists(key) {
|
|
1224
|
+
return this.existsSync(key);
|
|
1257
1225
|
}
|
|
1258
1226
|
/**
|
|
1259
|
-
*
|
|
1227
|
+
* Asynchronously retrieves the value associated with a given key.
|
|
1228
|
+
*
|
|
1229
|
+
* @param key - The key whose value is to be retrieved.
|
|
1230
|
+
* @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.
|
|
1260
1231
|
*/
|
|
1261
|
-
get
|
|
1262
|
-
return this
|
|
1232
|
+
async get(key) {
|
|
1233
|
+
return this.getSync(key);
|
|
1263
1234
|
}
|
|
1264
1235
|
/**
|
|
1265
|
-
*
|
|
1236
|
+
* Asynchronously sets the value for a given key.
|
|
1266
1237
|
*
|
|
1267
|
-
* @param
|
|
1268
|
-
* @param
|
|
1238
|
+
* @param key - The key to set the value for.
|
|
1239
|
+
* @param value - The value to set.
|
|
1269
1240
|
*/
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
if (!this.#physicalFS.existsSync(this.#context.dataPath)) {
|
|
1274
|
-
this.#physicalFS.mkdirSync(this.#context.dataPath, {
|
|
1275
|
-
recursive: true
|
|
1276
|
-
});
|
|
1241
|
+
async set(key, value) {
|
|
1242
|
+
if (!this.options.isReadOnly) {
|
|
1243
|
+
this.setSync(key, value);
|
|
1277
1244
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Asynchronously removes a key from the storage.
|
|
1248
|
+
*
|
|
1249
|
+
* @param key - The key to remove.
|
|
1250
|
+
*/
|
|
1251
|
+
async remove(key) {
|
|
1252
|
+
if (!this.options.isReadOnly) {
|
|
1253
|
+
this.removeSync(key);
|
|
1287
1254
|
}
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
this.#virtualFS.mkdirSync(this.#context.builtinsPath, {
|
|
1300
|
-
recursive: true
|
|
1301
|
-
});
|
|
1302
|
-
}
|
|
1303
|
-
if (!this.#virtualFS.existsSync(this.#context.entryPath)) {
|
|
1304
|
-
this.#virtualFS.mkdirSync(this.#context.entryPath, {
|
|
1305
|
-
recursive: true
|
|
1306
|
-
});
|
|
1307
|
-
}
|
|
1308
|
-
if (!this.#virtualFS.existsSync(this.#context.dtsPath)) {
|
|
1309
|
-
this.#virtualFS.mkdirSync(this.#context.dtsPath, {
|
|
1310
|
-
recursive: true
|
|
1311
|
-
});
|
|
1312
|
-
}
|
|
1313
|
-
} else if (this.#context.config.projectType === "application") {
|
|
1314
|
-
if (!this.#physicalFS.existsSync(this.#context.artifactsPath)) {
|
|
1315
|
-
this.#physicalFS.mkdirSync(this.#context.artifactsPath, {
|
|
1316
|
-
recursive: true
|
|
1317
|
-
});
|
|
1318
|
-
}
|
|
1319
|
-
if (!this.#physicalFS.existsSync(this.#context.builtinsPath)) {
|
|
1320
|
-
this.#physicalFS.mkdirSync(this.#context.builtinsPath, {
|
|
1321
|
-
recursive: true
|
|
1322
|
-
});
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Synchronously removes all entries from the storage that match the provided base path.
|
|
1258
|
+
*
|
|
1259
|
+
* @param base - The base path to clear keys from.
|
|
1260
|
+
*/
|
|
1261
|
+
clearSync(base) {
|
|
1262
|
+
if (!this.options.isReadOnly) {
|
|
1263
|
+
const keys = this.listSync(base || this.options.base);
|
|
1264
|
+
if (!keys.length) {
|
|
1265
|
+
return;
|
|
1323
1266
|
}
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1267
|
+
keys.map((key) => this.removeSync(base && !key.startsWith(base) ? join.joinPaths(base, key) : key));
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Asynchronously removes all entries from the storage that match the provided base path.
|
|
1272
|
+
*
|
|
1273
|
+
* @param base - The base path to clear keys from.
|
|
1274
|
+
* @returns A promise that resolves when the operation is complete.
|
|
1275
|
+
*/
|
|
1276
|
+
async clear(base) {
|
|
1277
|
+
if (!this.options.isReadOnly) {
|
|
1278
|
+
const keys = await this.list(base || this.options.base);
|
|
1279
|
+
if (!keys.length) {
|
|
1280
|
+
return;
|
|
1328
1281
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1282
|
+
await Promise.all(keys.map(async (key) => this.remove(base && !key.startsWith(base) ? join.joinPaths(base, key) : key)));
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Asynchronously lists all keys under a given base path.
|
|
1287
|
+
*
|
|
1288
|
+
* @param base - The base path to list keys from.
|
|
1289
|
+
* @returns A promise that resolves to an array of keys under the specified base path.
|
|
1290
|
+
*/
|
|
1291
|
+
async list(base) {
|
|
1292
|
+
return this.listSync(base);
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Disposes of the storage adapter, releasing any held resources.
|
|
1296
|
+
*
|
|
1297
|
+
* @returns A promise that resolves when the disposal is complete.
|
|
1298
|
+
*/
|
|
1299
|
+
dispose() {
|
|
1300
|
+
return Promise.resolve();
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Async dispose method to clean up resources.
|
|
1304
|
+
*
|
|
1305
|
+
* @returns A promise that resolves when disposal is complete.
|
|
1306
|
+
*/
|
|
1307
|
+
async [Symbol.asyncDispose]() {
|
|
1308
|
+
return this._dispose();
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Resolves a given key to its full path within the storage adapter.
|
|
1312
|
+
*
|
|
1313
|
+
* @param key - The key to resolve.
|
|
1314
|
+
* @returns The resolved full path for the key.
|
|
1315
|
+
*/
|
|
1316
|
+
resolve(key = this.options.base) {
|
|
1317
|
+
if (/\.\.:|\.\.$/.test(key)) {
|
|
1318
|
+
throw new Error(`[${this.name}]: Invalid key: ${JSON.stringify(key)} provided to storage adapter.`);
|
|
1319
|
+
}
|
|
1320
|
+
return append.appendPath(correctPath.correctPath(key).replace(/:/g, "/"), this.options.base);
|
|
1321
|
+
}
|
|
1322
|
+
/**
|
|
1323
|
+
* Disposes of the storage adapter, releasing any held resources.
|
|
1324
|
+
*
|
|
1325
|
+
* @returns A promise that resolves when the disposal is complete.
|
|
1326
|
+
*/
|
|
1327
|
+
async _dispose() {
|
|
1328
|
+
if (!this.#isDisposed) {
|
|
1329
|
+
await Promise.resolve(this.dispose());
|
|
1330
|
+
this.#isDisposed = true;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1335
|
+
// src/lib/fs/storage/file-system.ts
|
|
1336
|
+
var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
1337
|
+
static {
|
|
1338
|
+
chunkPK6SKIKE_cjs.__name(this, "FileSystemStorageAdapter");
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* A name identifying the storage adapter type.
|
|
1342
|
+
*/
|
|
1343
|
+
name = "file-system";
|
|
1344
|
+
/**
|
|
1345
|
+
* Constructor for the FileSystemStorageAdapter.
|
|
1346
|
+
*
|
|
1347
|
+
* @param options - Configuration options for the storage adapter.
|
|
1348
|
+
*/
|
|
1349
|
+
constructor(options) {
|
|
1350
|
+
super(options);
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Synchronously checks if a key exists in the storage.
|
|
1354
|
+
*
|
|
1355
|
+
* @param key - The key to check for existence.
|
|
1356
|
+
* @returns Returns `true` if the key exists, otherwise `false`.
|
|
1357
|
+
*/
|
|
1358
|
+
existsSync(key) {
|
|
1359
|
+
return exists.existsSync(this.resolve(key));
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Asynchronously checks if a key exists in the storage.
|
|
1363
|
+
*
|
|
1364
|
+
* @param key - The key to check for existence.
|
|
1365
|
+
* @returns A promise that resolves to `true` if the key exists, otherwise `false`.
|
|
1366
|
+
*/
|
|
1367
|
+
async exists(key) {
|
|
1368
|
+
return exists.exists(this.resolve(key));
|
|
1369
|
+
}
|
|
1370
|
+
/**
|
|
1371
|
+
* Synchronously retrieves the value associated with a given key.
|
|
1372
|
+
*
|
|
1373
|
+
* @param key - The key whose value is to be retrieved.
|
|
1374
|
+
* @returns The value associated with the key, or `null` if the key does not exist.
|
|
1375
|
+
*/
|
|
1376
|
+
getSync(key) {
|
|
1377
|
+
return readFile.readFileSync(this.resolve(key));
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Asynchronously retrieves the value associated with a given key.
|
|
1381
|
+
*
|
|
1382
|
+
* @param key - The key whose value is to be retrieved.
|
|
1383
|
+
* @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.
|
|
1384
|
+
*/
|
|
1385
|
+
async get(key) {
|
|
1386
|
+
return readFile.readFile(this.resolve(key));
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Synchronously sets the value for a given key.
|
|
1390
|
+
*
|
|
1391
|
+
* @param key - The key to set the value for.
|
|
1392
|
+
* @param value - The value to set.
|
|
1393
|
+
*/
|
|
1394
|
+
setSync(key, value) {
|
|
1395
|
+
if (!this.options.isReadOnly) {
|
|
1396
|
+
return writeFile$1.writeFileSync(this.resolve(key), value);
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Asynchronously sets the value for a given key.
|
|
1401
|
+
*
|
|
1402
|
+
* @param key - The key to set the value for.
|
|
1403
|
+
* @param value - The value to set.
|
|
1404
|
+
*/
|
|
1405
|
+
async set(key, value) {
|
|
1406
|
+
if (!this.options.isReadOnly) {
|
|
1407
|
+
return writeFile$1.writeFile(this.resolve(key), value);
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Synchronously removes a key from the storage.
|
|
1412
|
+
*
|
|
1413
|
+
* @param key - The key to remove.
|
|
1414
|
+
*/
|
|
1415
|
+
removeSync(key) {
|
|
1416
|
+
if (!this.options.isReadOnly) {
|
|
1417
|
+
try {
|
|
1418
|
+
return fs.unlinkSync(this.resolve(key));
|
|
1419
|
+
} catch (err) {
|
|
1420
|
+
return ignoreNotfound(err);
|
|
1333
1421
|
}
|
|
1334
1422
|
}
|
|
1335
1423
|
}
|
|
1336
1424
|
/**
|
|
1337
|
-
*
|
|
1425
|
+
* Asynchronously removes a key from the storage.
|
|
1338
1426
|
*
|
|
1339
|
-
* @param
|
|
1340
|
-
* @param options - Options for the operation, such as output mode.
|
|
1341
|
-
* @returns The file system module used for the operation.
|
|
1427
|
+
* @param key - The key to remove.
|
|
1342
1428
|
*/
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
return {
|
|
1347
|
-
...this.#virtualFS,
|
|
1348
|
-
mode: "virtual"
|
|
1349
|
-
};
|
|
1350
|
-
} else if (mode === "fs") {
|
|
1351
|
-
return {
|
|
1352
|
-
...this.#physicalFS,
|
|
1353
|
-
mode: "fs"
|
|
1354
|
-
};
|
|
1429
|
+
async remove(key) {
|
|
1430
|
+
if (!this.options.isReadOnly) {
|
|
1431
|
+
return promises.unlink(this.resolve(key)).catch(ignoreNotfound);
|
|
1355
1432
|
}
|
|
1356
|
-
return {
|
|
1357
|
-
...this,
|
|
1358
|
-
mode: this.#context.config.output.mode
|
|
1359
|
-
};
|
|
1360
1433
|
}
|
|
1361
1434
|
/**
|
|
1362
|
-
*
|
|
1435
|
+
* Lists all keys under a given base path synchronously.
|
|
1363
1436
|
*
|
|
1364
|
-
* @param
|
|
1365
|
-
* @
|
|
1366
|
-
* @returns The file system module used for the operation.
|
|
1437
|
+
* @param base - The base path to list keys from.
|
|
1438
|
+
* @returns An array of keys under the specified base path.
|
|
1367
1439
|
*/
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
return
|
|
1371
|
-
|
|
1372
|
-
|
|
1440
|
+
listSync(base) {
|
|
1441
|
+
try {
|
|
1442
|
+
return listFiles.listFilesSync(this.resolve(base), {
|
|
1443
|
+
ignore: this.options.ignore
|
|
1444
|
+
});
|
|
1445
|
+
} catch (err) {
|
|
1446
|
+
return ignoreNotfound(err) ?? [];
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Asynchronously lists all keys under a given base path.
|
|
1451
|
+
*
|
|
1452
|
+
* @param base - The base path to list keys from.
|
|
1453
|
+
* @returns A promise that resolves to an array of keys under the specified base path.
|
|
1454
|
+
*/
|
|
1455
|
+
async list(base) {
|
|
1456
|
+
return listFiles.listFiles(this.resolve(base), {
|
|
1457
|
+
ignore: this.options.ignore
|
|
1458
|
+
}).catch(ignoreNotfound).then((r) => r || []);
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
var VirtualStorageAdapter = class extends BaseStorageAdapter {
|
|
1462
|
+
static {
|
|
1463
|
+
chunkPK6SKIKE_cjs.__name(this, "VirtualStorageAdapter");
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* A name identifying the storage adapter type.
|
|
1467
|
+
*/
|
|
1468
|
+
name = "virtual";
|
|
1469
|
+
/**
|
|
1470
|
+
* In-memory data storage.
|
|
1471
|
+
*/
|
|
1472
|
+
data = /* @__PURE__ */ new Map();
|
|
1473
|
+
/**
|
|
1474
|
+
* Constructor for the VirtualStorageAdapter.
|
|
1475
|
+
*
|
|
1476
|
+
* @param options - Configuration options for the storage adapter.
|
|
1477
|
+
*/
|
|
1478
|
+
constructor(options) {
|
|
1479
|
+
super(options);
|
|
1480
|
+
}
|
|
1481
|
+
/**
|
|
1482
|
+
* Synchronously checks if a key exists in the storage.
|
|
1483
|
+
*
|
|
1484
|
+
* @param key - The key to check for existence.
|
|
1485
|
+
* @returns Returns `true` if the key exists, otherwise `false`.
|
|
1486
|
+
*/
|
|
1487
|
+
existsSync(key) {
|
|
1488
|
+
return this.data.has(this.resolve(key));
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Synchronously retrieves the value associated with a given key.
|
|
1492
|
+
*
|
|
1493
|
+
* @param key - The key whose value is to be retrieved.
|
|
1494
|
+
* @returns The value associated with the key, or `null` if the key does not exist.
|
|
1495
|
+
*/
|
|
1496
|
+
getSync(key) {
|
|
1497
|
+
return this.data.get(this.resolve(key)) ?? null;
|
|
1498
|
+
}
|
|
1499
|
+
/**
|
|
1500
|
+
* Synchronously sets the value for a given key.
|
|
1501
|
+
*
|
|
1502
|
+
* @param key - The key to set the value for.
|
|
1503
|
+
* @param value - The value to set.
|
|
1504
|
+
*/
|
|
1505
|
+
setSync(key, value) {
|
|
1506
|
+
if (!this.options.isReadOnly) {
|
|
1507
|
+
this.data.set(this.resolve(key), value);
|
|
1373
1508
|
}
|
|
1374
|
-
return void 0;
|
|
1375
1509
|
}
|
|
1376
1510
|
/**
|
|
1377
|
-
*
|
|
1511
|
+
* Synchronously removes a key from the storage.
|
|
1378
1512
|
*
|
|
1379
|
-
* @
|
|
1513
|
+
* @param key - The key to remove.
|
|
1380
1514
|
*/
|
|
1381
|
-
|
|
1382
|
-
|
|
1515
|
+
removeSync(key) {
|
|
1516
|
+
if (!this.options.isReadOnly) {
|
|
1517
|
+
this.data.delete(this.resolve(key));
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
/**
|
|
1521
|
+
* Lists all keys under a given base path synchronously.
|
|
1522
|
+
*
|
|
1523
|
+
* @param base - The base path to list keys from.
|
|
1524
|
+
* @returns An array of keys under the specified base path.
|
|
1525
|
+
*/
|
|
1526
|
+
listSync(base) {
|
|
1527
|
+
return [
|
|
1528
|
+
...this.data.keys().filter((key) => !base ? true : isParentPath.isParentPath(key, this.resolve(base)))
|
|
1529
|
+
];
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Disposes of the storage adapter, releasing any held resources.
|
|
1533
|
+
*
|
|
1534
|
+
* @returns A promise that resolves when the disposal is complete.
|
|
1535
|
+
*/
|
|
1536
|
+
async dispose() {
|
|
1537
|
+
return this.clear();
|
|
1383
1538
|
}
|
|
1384
1539
|
};
|
|
1385
1540
|
|
|
1386
1541
|
// src/lib/fs/vfs.ts
|
|
1387
1542
|
var VirtualFileSystem = class _VirtualFileSystem {
|
|
1388
1543
|
static {
|
|
1389
|
-
|
|
1544
|
+
chunkPK6SKIKE_cjs.__name(this, "VirtualFileSystem");
|
|
1390
1545
|
}
|
|
1391
1546
|
/**
|
|
1392
1547
|
* A map of virtual file IDs to their associated metadata.
|
|
@@ -1401,29 +1556,23 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1401
1556
|
*/
|
|
1402
1557
|
#paths;
|
|
1403
1558
|
/**
|
|
1404
|
-
* A cache for module resolution results.
|
|
1405
|
-
*/
|
|
1406
|
-
#resolverCache;
|
|
1407
|
-
/**
|
|
1408
1559
|
* The unified volume that combines the virtual file system with the real file system.
|
|
1409
1560
|
*
|
|
1410
1561
|
* @remarks
|
|
1411
1562
|
* This volume allows for seamless access to both virtual and real files.
|
|
1412
1563
|
*/
|
|
1413
|
-
#
|
|
1564
|
+
#storage = {
|
|
1565
|
+
"": new FileSystemStorageAdapter()
|
|
1566
|
+
};
|
|
1414
1567
|
/**
|
|
1415
|
-
*
|
|
1568
|
+
* A cache for module resolution results.
|
|
1416
1569
|
*/
|
|
1417
|
-
#
|
|
1570
|
+
#resolverCache;
|
|
1418
1571
|
/**
|
|
1419
1572
|
* Indicator specifying if the virtual file system (VFS) is disposed
|
|
1420
1573
|
*/
|
|
1421
1574
|
#isDisposed = false;
|
|
1422
1575
|
/**
|
|
1423
|
-
* Function to revert require patch
|
|
1424
|
-
*/
|
|
1425
|
-
#revert;
|
|
1426
|
-
/**
|
|
1427
1576
|
* The context of the virtual file system.
|
|
1428
1577
|
*/
|
|
1429
1578
|
#context;
|
|
@@ -1432,15 +1581,6 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1432
1581
|
*/
|
|
1433
1582
|
#log;
|
|
1434
1583
|
/**
|
|
1435
|
-
* Checks if a path exists in the virtual file system (VFS).
|
|
1436
|
-
*
|
|
1437
|
-
* @param path - The path to check.
|
|
1438
|
-
* @returns `true` if the path exists, otherwise `false`.
|
|
1439
|
-
*/
|
|
1440
|
-
#existsSync(path) {
|
|
1441
|
-
return this.#unifiedFS.virtual.existsSync(this.#normalizePath(path)) || this.#unifiedFS.physical.existsSync(this.#normalizePath(path)) || this.#unifiedFS.resolveFS(path).existsSync(this.#normalizePath(path));
|
|
1442
|
-
}
|
|
1443
|
-
/**
|
|
1444
1584
|
* Normalizes a given module id by resolving it against the built-ins path.
|
|
1445
1585
|
*
|
|
1446
1586
|
* @param id - The module id to normalize.
|
|
@@ -1469,6 +1609,43 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1469
1609
|
return new RegExp(`^${this.#normalizePath(path).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
|
|
1470
1610
|
}
|
|
1471
1611
|
/**
|
|
1612
|
+
* Gets the storage adapter and relative key for a given key.
|
|
1613
|
+
*
|
|
1614
|
+
* @param key - The key to get the storage adapter for.
|
|
1615
|
+
* @returns The storage adapter and relative key for the given key.
|
|
1616
|
+
*/
|
|
1617
|
+
#getStorage(key) {
|
|
1618
|
+
const path = this.resolveSync(this.#normalizePath(key)) || key;
|
|
1619
|
+
for (const base of Object.keys(this.#storage).filter(Boolean).sort().reverse()) {
|
|
1620
|
+
if (isParentPath.isParentPath(path, base)) {
|
|
1621
|
+
return {
|
|
1622
|
+
base,
|
|
1623
|
+
relativeKey: replace.replacePath(path, base),
|
|
1624
|
+
adapter: this.#storage[base]
|
|
1625
|
+
};
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
return {
|
|
1629
|
+
base: "",
|
|
1630
|
+
relativeKey: path,
|
|
1631
|
+
adapter: this.#storage[""]
|
|
1632
|
+
};
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Gets all storage adapters that match a given base key.
|
|
1636
|
+
*
|
|
1637
|
+
* @param base - The base key to match storage adapters against.
|
|
1638
|
+
* @param includeParent - Whether to include parent storage adapters.
|
|
1639
|
+
* @returns An array of storage adapters that match the given base key.
|
|
1640
|
+
*/
|
|
1641
|
+
#getStorages(base = "", includeParent = false) {
|
|
1642
|
+
return Object.keys(this.#storage).sort().reverse().filter((key) => isParentPath.isParentPath(key, base) || includeParent && isParentPath.isParentPath(base, key)).map((key) => ({
|
|
1643
|
+
relativeBase: base.length > key.length ? base.slice(key.length) : void 0,
|
|
1644
|
+
base: key,
|
|
1645
|
+
adapter: this.#storage[key]
|
|
1646
|
+
}));
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1472
1649
|
* Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
1473
1650
|
*
|
|
1474
1651
|
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
@@ -1478,7 +1655,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1478
1655
|
if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.dataPath, "fs.bin"))) {
|
|
1479
1656
|
const buffer$1 = await buffer.readFileBuffer(joinPaths.joinPaths(context.dataPath, "fs.bin"));
|
|
1480
1657
|
const message2 = new $__namespace.Message(buffer$1, false);
|
|
1481
|
-
|
|
1658
|
+
const fs = message2.getRoot(FileSystem);
|
|
1659
|
+
const result = new _VirtualFileSystem(context, fs);
|
|
1660
|
+
if (fs._hasStorage() && fs.storage.length > 0) {
|
|
1661
|
+
await Promise.all(fs.storage.values().map(async (file) => {
|
|
1662
|
+
await result.write(file.path, file.code);
|
|
1663
|
+
}));
|
|
1664
|
+
}
|
|
1482
1665
|
}
|
|
1483
1666
|
const message = new $__namespace.Message();
|
|
1484
1667
|
return new _VirtualFileSystem(context, message.initRoot(FileSystem));
|
|
@@ -1493,7 +1676,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1493
1676
|
if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.dataPath, "fs.bin"))) {
|
|
1494
1677
|
const buffer$1 = buffer.readFileBufferSync(joinPaths.joinPaths(context.dataPath, "fs.bin"));
|
|
1495
1678
|
const message2 = new $__namespace.Message(buffer$1, false);
|
|
1496
|
-
|
|
1679
|
+
const fs = message2.getRoot(FileSystem);
|
|
1680
|
+
const result = new _VirtualFileSystem(context, fs);
|
|
1681
|
+
if (fs._hasStorage() && fs.storage.length > 0) {
|
|
1682
|
+
fs.storage.values().map((file) => {
|
|
1683
|
+
result.writeSync(file.path, file.code);
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1497
1686
|
}
|
|
1498
1687
|
const message = new $__namespace.Message();
|
|
1499
1688
|
return new _VirtualFileSystem(context, message.initRoot(FileSystem));
|
|
@@ -1503,7 +1692,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1503
1692
|
*/
|
|
1504
1693
|
get metadata() {
|
|
1505
1694
|
return new Proxy(this.#metadata, {
|
|
1506
|
-
get: /* @__PURE__ */
|
|
1695
|
+
get: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
|
|
1507
1696
|
return target[this.#normalizeId(prop)];
|
|
1508
1697
|
}, "get")
|
|
1509
1698
|
});
|
|
@@ -1513,7 +1702,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1513
1702
|
*/
|
|
1514
1703
|
get ids() {
|
|
1515
1704
|
return new Proxy(this.#paths, {
|
|
1516
|
-
get: /* @__PURE__ */
|
|
1705
|
+
get: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
|
|
1517
1706
|
return target[this.#normalizePath(prop)];
|
|
1518
1707
|
}, "get")
|
|
1519
1708
|
});
|
|
@@ -1523,11 +1712,14 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1523
1712
|
*/
|
|
1524
1713
|
get paths() {
|
|
1525
1714
|
return new Proxy(this.#paths, {
|
|
1526
|
-
get: /* @__PURE__ */
|
|
1715
|
+
get: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
|
|
1527
1716
|
return target[this.#normalizeId(prop)];
|
|
1528
1717
|
}, "get")
|
|
1529
1718
|
});
|
|
1530
1719
|
}
|
|
1720
|
+
/**
|
|
1721
|
+
* Gets the resolver cache.
|
|
1722
|
+
*/
|
|
1531
1723
|
get resolverCache() {
|
|
1532
1724
|
if (!this.#resolverCache) {
|
|
1533
1725
|
this.#resolverCache = flatCache.create({
|
|
@@ -1546,16 +1738,34 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1546
1738
|
* @param context - The context of the virtual file system, typically containing options and logging functions.
|
|
1547
1739
|
* @param fs - A buffer containing the serialized virtual file system data.
|
|
1548
1740
|
*/
|
|
1549
|
-
constructor(context,
|
|
1741
|
+
constructor(context, fs) {
|
|
1550
1742
|
this.#context = context;
|
|
1551
|
-
|
|
1743
|
+
if (isSetObject.isSetObject(this.#context.config.output.storage)) {
|
|
1744
|
+
this.#storage = {
|
|
1745
|
+
...this.#storage,
|
|
1746
|
+
...this.#context.config.output.storage
|
|
1747
|
+
};
|
|
1748
|
+
}
|
|
1749
|
+
this.#storage.virtual ??= new VirtualStorageAdapter({
|
|
1750
|
+
base: "/_virtual"
|
|
1751
|
+
});
|
|
1752
|
+
if (this.#context.config.output.storage !== chunkMBBNZS6K_cjs.StoragePreset.FS) {
|
|
1753
|
+
this.#storage[this.#context.artifactsPath] ??= new VirtualStorageAdapter({
|
|
1754
|
+
base: this.#context.artifactsPath
|
|
1755
|
+
});
|
|
1756
|
+
this.#storage[this.#context.builtinsPath] ??= new VirtualStorageAdapter({
|
|
1757
|
+
base: this.#context.builtinsPath
|
|
1758
|
+
});
|
|
1759
|
+
this.#storage[this.#context.entryPath] ??= new VirtualStorageAdapter({
|
|
1760
|
+
base: this.#context.entryPath
|
|
1761
|
+
});
|
|
1762
|
+
}
|
|
1552
1763
|
this.#metadata = {};
|
|
1553
|
-
if (
|
|
1554
|
-
this.#metadata =
|
|
1764
|
+
if (fs._hasMetadata()) {
|
|
1765
|
+
this.#metadata = fs.metadata.values().reduce((ret, metadata) => {
|
|
1555
1766
|
ret[metadata.id] = {
|
|
1556
1767
|
id: metadata.id,
|
|
1557
1768
|
type: metadata.type,
|
|
1558
|
-
mode: metadata.mode,
|
|
1559
1769
|
timestamp: metadata.timestamp || Date.now(),
|
|
1560
1770
|
properties: metadata._hasProperties() ? metadata.properties.values().reduce((ret2, item) => {
|
|
1561
1771
|
ret2[item.key] = item.value;
|
|
@@ -1567,12 +1777,12 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1567
1777
|
}
|
|
1568
1778
|
this.#ids = {};
|
|
1569
1779
|
this.#paths = {};
|
|
1570
|
-
if (
|
|
1571
|
-
this.#ids =
|
|
1780
|
+
if (fs._hasIds()) {
|
|
1781
|
+
this.#ids = fs.ids.values().reduce((ret, identifier) => {
|
|
1572
1782
|
ret[identifier.path] ??= identifier.id;
|
|
1573
1783
|
return ret;
|
|
1574
1784
|
}, {});
|
|
1575
|
-
this.#paths =
|
|
1785
|
+
this.#paths = fs.ids.values().reduce((ret, identifier) => {
|
|
1576
1786
|
ret[identifier.id] ??= identifier.path;
|
|
1577
1787
|
return ret;
|
|
1578
1788
|
}, {});
|
|
@@ -1580,187 +1790,123 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1580
1790
|
this.#log = extendLog(this.#context.log, "file-system");
|
|
1581
1791
|
}
|
|
1582
1792
|
/**
|
|
1583
|
-
*
|
|
1584
|
-
*
|
|
1585
|
-
* @param pathOrId - The path or id to check.
|
|
1586
|
-
* @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
1587
|
-
*/
|
|
1588
|
-
isVirtual(pathOrId, importer, options = {}) {
|
|
1589
|
-
if (!pathOrId) {
|
|
1590
|
-
return false;
|
|
1591
|
-
}
|
|
1592
|
-
const resolvedPath = this.resolveSync(pathOrId, importer, options);
|
|
1593
|
-
if (!resolvedPath) {
|
|
1594
|
-
return false;
|
|
1595
|
-
}
|
|
1596
|
-
return this.metadata[resolvedPath]?.mode === "virtual";
|
|
1597
|
-
}
|
|
1598
|
-
/**
|
|
1599
|
-
* Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
1600
|
-
*
|
|
1601
|
-
* @param pathOrId - The path or id to check.
|
|
1602
|
-
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
1603
|
-
*/
|
|
1604
|
-
isPhysical(pathOrId, importer, options = {}) {
|
|
1605
|
-
if (!pathOrId) {
|
|
1606
|
-
return false;
|
|
1607
|
-
}
|
|
1608
|
-
const resolvedPath = this.resolveSync(pathOrId, importer, options);
|
|
1609
|
-
if (!resolvedPath) {
|
|
1610
|
-
return false;
|
|
1611
|
-
}
|
|
1612
|
-
return this.metadata[resolvedPath]?.mode === "fs";
|
|
1613
|
-
}
|
|
1614
|
-
/**
|
|
1615
|
-
* Lists files in a given path.
|
|
1616
|
-
*
|
|
1617
|
-
* @param path - The path to list files from.
|
|
1618
|
-
* @param options - Options for listing files, such as encoding and recursion.
|
|
1619
|
-
* @returns An array of file names in the specified path.
|
|
1620
|
-
*/
|
|
1621
|
-
readdirSync(path, options = "utf8") {
|
|
1622
|
-
return this.#unifiedFS.resolveFS(path).readdirSync(toFilePath(path), options);
|
|
1623
|
-
}
|
|
1624
|
-
/**
|
|
1625
|
-
* Removes a file in the virtual file system (VFS).
|
|
1793
|
+
* Asynchronously checks if a file exists in the virtual file system (VFS).
|
|
1626
1794
|
*
|
|
1627
|
-
* @param path - The path to
|
|
1628
|
-
|
|
1629
|
-
unlinkSync(path, options) {
|
|
1630
|
-
if (!this.isFile(this.#normalizePath(path))) {
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1633
|
-
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${this.#normalizePath(path)}`);
|
|
1634
|
-
this.#unifiedFS.resolveFS(path, options).unlinkSync(this.#normalizePath(path));
|
|
1635
|
-
if (this.#ids[this.#normalizePath(path)] && this.#metadata[this.#ids[this.#normalizePath(path)]]) {
|
|
1636
|
-
delete this.#metadata[this.#ids[this.#normalizePath(path)]];
|
|
1637
|
-
delete this.#ids[this.#normalizePath(path)];
|
|
1638
|
-
delete this.#paths[this.#normalizeId(path)];
|
|
1639
|
-
this.#resolverCache.delete(this.#normalizePath(path));
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
/**
|
|
1643
|
-
* Removes a file in the virtual file system (VFS).
|
|
1644
|
-
*
|
|
1645
|
-
* @param path - The path to create the directory at.
|
|
1795
|
+
* @param path - The path to the file.
|
|
1796
|
+
* @returns A promise that resolves to `true` if the file exists, otherwise `false`.
|
|
1646
1797
|
*/
|
|
1647
|
-
async
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
}
|
|
1651
|
-
this.#log(types.LogLevelLabel.TRACE, `Removing file: ${this.#normalizePath(path)}`);
|
|
1652
|
-
if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.unlink)) {
|
|
1653
|
-
await this.#unifiedFS.resolveFS(path, options).promises.unlink(this.#normalizePath(path));
|
|
1654
|
-
if (this.#ids[this.#normalizePath(path)] && this.#metadata[this.#ids[this.#normalizePath(path)]]) {
|
|
1655
|
-
delete this.#metadata[this.#ids[this.#normalizePath(path)]];
|
|
1656
|
-
}
|
|
1657
|
-
} else {
|
|
1658
|
-
this.unlinkSync(this.#normalizePath(path), options);
|
|
1659
|
-
}
|
|
1798
|
+
async exists(path) {
|
|
1799
|
+
const { relativeKey, adapter } = this.#getStorage(path);
|
|
1800
|
+
return adapter.exists(relativeKey);
|
|
1660
1801
|
}
|
|
1661
1802
|
/**
|
|
1662
|
-
*
|
|
1803
|
+
* Synchronously checks if a file exists in the virtual file system (VFS).
|
|
1663
1804
|
*
|
|
1664
|
-
* @param path - The path to
|
|
1665
|
-
* @
|
|
1805
|
+
* @param path - The path to the file.
|
|
1806
|
+
* @returns `true` if the file exists, otherwise `false`.
|
|
1666
1807
|
*/
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
}
|
|
1671
|
-
this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${this.#normalizePath(path)}`);
|
|
1672
|
-
this.#unifiedFS.resolveFS(path, options).rmdirSync(this.#normalizePath(path), defu6__default.default(options, {
|
|
1673
|
-
recursive: true
|
|
1674
|
-
}));
|
|
1808
|
+
existsSync(path) {
|
|
1809
|
+
const { relativeKey, adapter } = this.#getStorage(path);
|
|
1810
|
+
return adapter.existsSync(relativeKey);
|
|
1675
1811
|
}
|
|
1676
1812
|
/**
|
|
1677
|
-
*
|
|
1813
|
+
* Checks if a file is virtual in the virtual file system (VFS).
|
|
1678
1814
|
*
|
|
1679
|
-
* @param path - The path to
|
|
1680
|
-
* @
|
|
1681
|
-
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
1815
|
+
* @param path - The path to the file.
|
|
1816
|
+
* @returns `true` if the file is virtual, otherwise `false`.
|
|
1682
1817
|
*/
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${this.#normalizePath(path)}`);
|
|
1688
|
-
if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.rm)) {
|
|
1689
|
-
await this.#unifiedFS.resolveFS(path, options).promises.rm(this.#normalizePath(path), defu6__default.default(options, {
|
|
1690
|
-
force: true,
|
|
1691
|
-
recursive: true
|
|
1692
|
-
}));
|
|
1693
|
-
} else {
|
|
1694
|
-
this.rmdirSync(this.#normalizePath(path), defu6__default.default(options ?? {}, {
|
|
1695
|
-
force: true,
|
|
1696
|
-
recursive: true
|
|
1697
|
-
}));
|
|
1818
|
+
isVirtual(path) {
|
|
1819
|
+
const resolved = this.resolveSync(path);
|
|
1820
|
+
if (!resolved) {
|
|
1821
|
+
return false;
|
|
1698
1822
|
}
|
|
1823
|
+
return this.#getStorage(resolved)?.adapter?.name === "virtual";
|
|
1699
1824
|
}
|
|
1700
1825
|
/**
|
|
1701
|
-
*
|
|
1826
|
+
* Lists files in a given path.
|
|
1702
1827
|
*
|
|
1703
|
-
* @param path - The path to
|
|
1704
|
-
* @
|
|
1705
|
-
* @returns A promise that resolves when the file is removed.
|
|
1828
|
+
* @param path - The path to list files from.
|
|
1829
|
+
* @returns An array of file names in the specified path.
|
|
1706
1830
|
*/
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1831
|
+
listSync(path) {
|
|
1832
|
+
let maskedMounts = [];
|
|
1833
|
+
const allKeys = [];
|
|
1834
|
+
for (const storage of this.#getStorages(path, true)) {
|
|
1835
|
+
for (const key of storage.adapter.listSync(storage.relativeBase)) {
|
|
1836
|
+
if (!maskedMounts.some((p) => `${storage.base}${normalizeKey(key)}`.startsWith(p))) {
|
|
1837
|
+
allKeys.push(`${storage.base}${normalizeKey(key)}`);
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
maskedMounts = [
|
|
1841
|
+
storage.base,
|
|
1842
|
+
...maskedMounts.filter((p) => !p.startsWith(storage.base))
|
|
1843
|
+
];
|
|
1711
1844
|
}
|
|
1712
|
-
return
|
|
1845
|
+
return allKeys.filter((key) => filterKeyByBase(key, path));
|
|
1713
1846
|
}
|
|
1714
1847
|
/**
|
|
1715
|
-
*
|
|
1848
|
+
* Lists files in a given path.
|
|
1716
1849
|
*
|
|
1717
|
-
* @param path - The path to
|
|
1718
|
-
* @
|
|
1850
|
+
* @param path - The path to list files from.
|
|
1851
|
+
* @returns An array of file names in the specified path.
|
|
1719
1852
|
*/
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1853
|
+
async list(path) {
|
|
1854
|
+
let maskedMounts = [];
|
|
1855
|
+
const allKeys = [];
|
|
1856
|
+
for (const storage of this.#getStorages(path, true)) {
|
|
1857
|
+
for (const key of await storage.adapter.list(storage.relativeBase)) {
|
|
1858
|
+
if (!maskedMounts.some((p) => `${storage.base}${normalizeKey(key)}`.startsWith(p))) {
|
|
1859
|
+
allKeys.push(`${storage.base}${normalizeKey(key)}`);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
maskedMounts = [
|
|
1863
|
+
storage.base,
|
|
1864
|
+
...maskedMounts.filter((p) => !p.startsWith(storage.base))
|
|
1865
|
+
];
|
|
1724
1866
|
}
|
|
1725
|
-
return
|
|
1867
|
+
return allKeys.filter((key) => filterKeyByBase(key, path));
|
|
1726
1868
|
}
|
|
1727
1869
|
/**
|
|
1728
|
-
*
|
|
1870
|
+
* Removes a file in the virtual file system (VFS).
|
|
1729
1871
|
*
|
|
1730
1872
|
* @param path - The path to create the directory at.
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1873
|
+
*/
|
|
1874
|
+
async remove(path) {
|
|
1875
|
+
const normalizedPath = this.#normalizePath(path);
|
|
1876
|
+
this.#log(types.LogLevelLabel.TRACE, `Removing file: ${normalizedPath}`);
|
|
1877
|
+
const { relativeKey, adapter } = this.#getStorage(normalizedPath);
|
|
1878
|
+
if (filePathFns.hasFileExtension(normalizedPath)) {
|
|
1879
|
+
await adapter.remove(relativeKey);
|
|
1880
|
+
} else {
|
|
1881
|
+
await adapter.clear(relativeKey);
|
|
1882
|
+
}
|
|
1883
|
+
const id = this.#ids[normalizedPath];
|
|
1884
|
+
if (id && this.#metadata[id]) {
|
|
1885
|
+
delete this.#metadata[id];
|
|
1886
|
+
delete this.#ids[normalizedPath];
|
|
1887
|
+
delete this.#paths[id];
|
|
1888
|
+
}
|
|
1740
1889
|
}
|
|
1741
1890
|
/**
|
|
1742
|
-
*
|
|
1891
|
+
* Removes a file in the virtual file system (VFS).
|
|
1743
1892
|
*
|
|
1744
1893
|
* @param path - The path to create the directory at.
|
|
1745
|
-
* @param options - Options for creating the directory.
|
|
1746
|
-
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
1747
1894
|
*/
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
recursive: true
|
|
1755
|
-
}));
|
|
1895
|
+
removeSync(path) {
|
|
1896
|
+
const normalizedPath = this.#normalizePath(path);
|
|
1897
|
+
this.#log(types.LogLevelLabel.TRACE, `Removing file: ${normalizedPath}`);
|
|
1898
|
+
const { relativeKey, adapter } = this.#getStorage(normalizedPath);
|
|
1899
|
+
if (filePathFns.hasFileExtension(normalizedPath)) {
|
|
1900
|
+
adapter.removeSync(relativeKey);
|
|
1756
1901
|
} else {
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1902
|
+
adapter.clearSync(relativeKey);
|
|
1903
|
+
}
|
|
1904
|
+
const id = this.#ids[normalizedPath];
|
|
1905
|
+
if (id && this.#metadata[id]) {
|
|
1906
|
+
delete this.#metadata[id];
|
|
1907
|
+
delete this.#ids[normalizedPath];
|
|
1908
|
+
delete this.#paths[id];
|
|
1762
1909
|
}
|
|
1763
|
-
return result;
|
|
1764
1910
|
}
|
|
1765
1911
|
/**
|
|
1766
1912
|
* Glob files in the virtual file system (VFS) based on the provided pattern(s).
|
|
@@ -1782,38 +1928,14 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1782
1928
|
const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
|
|
1783
1929
|
const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
|
|
1784
1930
|
const baseDir = firstGlobIdx === -1 ? filePathFns.findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
let entries = [];
|
|
1791
|
-
try {
|
|
1792
|
-
entries = await this.readdir(dir);
|
|
1793
|
-
} catch {
|
|
1794
|
-
continue;
|
|
1795
|
-
}
|
|
1796
|
-
for (const entry of entries) {
|
|
1797
|
-
const full = this.#normalizePath(joinPaths.joinPaths(dir, entry));
|
|
1798
|
-
let stats;
|
|
1799
|
-
try {
|
|
1800
|
-
stats = this.#unifiedFS.lstatSync(full);
|
|
1801
|
-
} catch {
|
|
1802
|
-
stats = void 0;
|
|
1803
|
-
}
|
|
1804
|
-
if (!stats) continue;
|
|
1805
|
-
if (stats.isDirectory()) {
|
|
1806
|
-
stack.push(full);
|
|
1807
|
-
} else if (stats.isFile()) {
|
|
1808
|
-
if (this.#buildRegex(absPattern).test(full)) {
|
|
1809
|
-
const resolved = this.resolveSync(full);
|
|
1810
|
-
if (resolved && !results.includes(resolved)) {
|
|
1811
|
-
results.push(resolved);
|
|
1812
|
-
}
|
|
1813
|
-
}
|
|
1931
|
+
await Promise.all((await this.list(baseDir && isType.isAbsolutePath(baseDir) ? baseDir : this.#context.workspaceConfig.workspaceRoot)).map(async (file) => {
|
|
1932
|
+
if (this.#buildRegex(absPattern).test(file)) {
|
|
1933
|
+
const resolved = this.resolveSync(file);
|
|
1934
|
+
if (resolved && !results.includes(resolved)) {
|
|
1935
|
+
results.push(resolved);
|
|
1814
1936
|
}
|
|
1815
1937
|
}
|
|
1816
|
-
}
|
|
1938
|
+
}));
|
|
1817
1939
|
}
|
|
1818
1940
|
return results;
|
|
1819
1941
|
}
|
|
@@ -1837,35 +1959,12 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1837
1959
|
const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
|
|
1838
1960
|
const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
|
|
1839
1961
|
const baseDir = firstGlobIdx === -1 ? filePathFns.findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
try {
|
|
1847
|
-
entries = this.readdirSync(dir);
|
|
1848
|
-
} catch {
|
|
1849
|
-
continue;
|
|
1850
|
-
}
|
|
1851
|
-
for (const entry of entries) {
|
|
1852
|
-
const full = this.#normalizePath(joinPaths.joinPaths(dir, entry));
|
|
1853
|
-
let stats;
|
|
1854
|
-
try {
|
|
1855
|
-
stats = this.#unifiedFS.lstatSync(full);
|
|
1856
|
-
} catch {
|
|
1857
|
-
stats = void 0;
|
|
1858
|
-
}
|
|
1859
|
-
if (!stats) continue;
|
|
1860
|
-
if (stats.isDirectory()) {
|
|
1861
|
-
stack.push(full);
|
|
1862
|
-
} else if (stats.isFile()) {
|
|
1863
|
-
if (this.#buildRegex(absPattern).test(full)) {
|
|
1864
|
-
const resolved = this.resolveSync(full);
|
|
1865
|
-
if (resolved && !results.includes(resolved)) {
|
|
1866
|
-
results.push(resolved);
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1962
|
+
const files = this.listSync(baseDir && isType.isAbsolutePath(baseDir) ? baseDir : this.#context.workspaceConfig.workspaceRoot);
|
|
1963
|
+
for (const file of files) {
|
|
1964
|
+
if (this.#buildRegex(absPattern).test(file)) {
|
|
1965
|
+
const resolved = this.resolveSync(file);
|
|
1966
|
+
if (resolved && !results.includes(resolved)) {
|
|
1967
|
+
results.push(resolved);
|
|
1869
1968
|
}
|
|
1870
1969
|
}
|
|
1871
1970
|
}
|
|
@@ -1873,36 +1972,27 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1873
1972
|
return results;
|
|
1874
1973
|
}
|
|
1875
1974
|
/**
|
|
1876
|
-
* Moves a file from one path to another in the virtual file system (VFS).
|
|
1877
|
-
*
|
|
1878
|
-
* @param srcPath - The source path to move
|
|
1879
|
-
* @param destPath - The destination path to move to
|
|
1880
|
-
*/
|
|
1881
|
-
async move(srcPath, destPath) {
|
|
1882
|
-
const content = await this.readFile(srcPath);
|
|
1883
|
-
await this.writeFile(destPath, content);
|
|
1884
|
-
await this.rm(srcPath);
|
|
1885
|
-
}
|
|
1886
|
-
/**
|
|
1887
|
-
* Synchronously moves a file from one path to another in the virtual file system (VFS).
|
|
1888
|
-
*
|
|
1889
|
-
* @param srcPath - The source path to move
|
|
1890
|
-
* @param destPath - The destination path to move to
|
|
1891
|
-
*/
|
|
1892
|
-
moveSync(srcPath, destPath) {
|
|
1893
|
-
const content = this.readFileSync(srcPath);
|
|
1894
|
-
this.writeFileSync(destPath, content);
|
|
1895
|
-
this.rmSync(srcPath);
|
|
1896
|
-
}
|
|
1897
|
-
/**
|
|
1898
1975
|
* Copies a file from one path to another in the virtual file system (VFS).
|
|
1899
1976
|
*
|
|
1900
1977
|
* @param srcPath - The source path to copy
|
|
1901
1978
|
* @param destPath - The destination path to copy to
|
|
1902
1979
|
*/
|
|
1903
1980
|
async copy(srcPath, destPath) {
|
|
1904
|
-
|
|
1905
|
-
|
|
1981
|
+
if (filePathFns.hasFileExtension(srcPath)) {
|
|
1982
|
+
const content = await this.read(srcPath);
|
|
1983
|
+
if (content !== void 0) {
|
|
1984
|
+
await this.write(filePathFns.hasFileExtension(destPath) ? destPath : joinPaths.joinPaths(destPath, filePathFns.findFileName(srcPath)), content);
|
|
1985
|
+
}
|
|
1986
|
+
} else {
|
|
1987
|
+
await Promise.all((await this.list(srcPath)).map(async (file) => {
|
|
1988
|
+
const relativePath2 = file.replace(this.#normalizePath(srcPath), "");
|
|
1989
|
+
const destinationPath = this.#normalizePath(append.appendPath(destPath, relativePath2));
|
|
1990
|
+
const content = await this.read(file);
|
|
1991
|
+
if (content !== void 0) {
|
|
1992
|
+
await this.write(destinationPath, content);
|
|
1993
|
+
}
|
|
1994
|
+
}));
|
|
1995
|
+
}
|
|
1906
1996
|
}
|
|
1907
1997
|
/**
|
|
1908
1998
|
* Synchronously copies a file from one path to another in the virtual file system (VFS).
|
|
@@ -1911,51 +2001,85 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1911
2001
|
* @param destPath - The destination path to copy to
|
|
1912
2002
|
*/
|
|
1913
2003
|
copySync(srcPath, destPath) {
|
|
1914
|
-
|
|
1915
|
-
|
|
2004
|
+
if (filePathFns.hasFileExtension(srcPath)) {
|
|
2005
|
+
const content = this.readSync(srcPath);
|
|
2006
|
+
if (content !== void 0) {
|
|
2007
|
+
this.writeSync(filePathFns.hasFileExtension(destPath) ? destPath : joinPaths.joinPaths(destPath, filePathFns.findFileName(srcPath)), content);
|
|
2008
|
+
}
|
|
2009
|
+
} else {
|
|
2010
|
+
this.listSync(srcPath).forEach((file) => {
|
|
2011
|
+
const relativePath2 = file.replace(this.#normalizePath(srcPath), "");
|
|
2012
|
+
const destinationPath = this.#normalizePath(append.appendPath(destPath, relativePath2));
|
|
2013
|
+
const content = this.readSync(file);
|
|
2014
|
+
if (content !== void 0) {
|
|
2015
|
+
this.writeSync(destinationPath, content);
|
|
2016
|
+
}
|
|
2017
|
+
});
|
|
2018
|
+
}
|
|
1916
2019
|
}
|
|
1917
2020
|
/**
|
|
1918
|
-
*
|
|
2021
|
+
* Moves a file (or files) from one path to another in the virtual file system (VFS).
|
|
1919
2022
|
*
|
|
1920
|
-
* @param
|
|
1921
|
-
* @param
|
|
1922
|
-
|
|
2023
|
+
* @param srcPath - The source path to move
|
|
2024
|
+
* @param destPath - The destination path to move to
|
|
2025
|
+
*/
|
|
2026
|
+
async move(srcPath, destPath) {
|
|
2027
|
+
if (filePathFns.hasFileExtension(srcPath)) {
|
|
2028
|
+
await this.copy(srcPath, destPath);
|
|
2029
|
+
await this.remove(srcPath);
|
|
2030
|
+
} else {
|
|
2031
|
+
await Promise.all((await this.list(srcPath)).map(async (file) => {
|
|
2032
|
+
await this.copy(file, destPath);
|
|
2033
|
+
await this.remove(file);
|
|
2034
|
+
}));
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* Synchronously moves a file (or files) from one path to another in the virtual file system (VFS).
|
|
2039
|
+
*
|
|
2040
|
+
* @param srcPath - The source path to move
|
|
2041
|
+
* @param destPath - The destination path to move to
|
|
1923
2042
|
*/
|
|
1924
|
-
|
|
1925
|
-
|
|
2043
|
+
moveSync(srcPath, destPath) {
|
|
2044
|
+
if (filePathFns.hasFileExtension(srcPath)) {
|
|
2045
|
+
this.copySync(srcPath, destPath);
|
|
2046
|
+
this.removeSync(srcPath);
|
|
2047
|
+
} else {
|
|
2048
|
+
this.listSync(srcPath).forEach((file) => {
|
|
2049
|
+
this.copySync(file, destPath);
|
|
2050
|
+
this.removeSync(file);
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
1926
2053
|
}
|
|
1927
2054
|
/**
|
|
1928
2055
|
* Asynchronously reads a file from the virtual file system (VFS).
|
|
1929
2056
|
*
|
|
1930
|
-
* @param
|
|
2057
|
+
* @param path - The path or ID of the file to read.
|
|
1931
2058
|
* @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
|
|
1932
2059
|
*/
|
|
1933
|
-
async
|
|
1934
|
-
const filePath = await this.resolve(
|
|
1935
|
-
if (filePath
|
|
1936
|
-
|
|
1937
|
-
if (isFunction.isFunction(this.#unifiedFS.resolveFS(filePath).promises.readFile)) {
|
|
1938
|
-
result = (await this.#unifiedFS.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
|
|
1939
|
-
} else {
|
|
1940
|
-
result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
|
|
1941
|
-
}
|
|
1942
|
-
return isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
|
|
2060
|
+
async read(path) {
|
|
2061
|
+
const filePath = await this.resolve(path);
|
|
2062
|
+
if (!filePath) {
|
|
2063
|
+
return void 0;
|
|
1943
2064
|
}
|
|
1944
|
-
|
|
2065
|
+
const { relativeKey, adapter } = this.#getStorage(filePath);
|
|
2066
|
+
this.#log(types.LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
|
|
2067
|
+
return await adapter.get(relativeKey) ?? void 0;
|
|
1945
2068
|
}
|
|
1946
2069
|
/**
|
|
1947
2070
|
* Synchronously reads a file from the virtual file system (VFS).
|
|
1948
2071
|
*
|
|
1949
|
-
* @param
|
|
2072
|
+
* @param path - The path or ID of the file to read.
|
|
1950
2073
|
* @returns The contents of the file as a string, or undefined if the file does not exist.
|
|
1951
2074
|
*/
|
|
1952
|
-
|
|
1953
|
-
const filePath = this.resolveSync(
|
|
1954
|
-
if (filePath
|
|
1955
|
-
|
|
1956
|
-
return isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
|
|
2075
|
+
readSync(path) {
|
|
2076
|
+
const filePath = this.resolveSync(path);
|
|
2077
|
+
if (!filePath) {
|
|
2078
|
+
return void 0;
|
|
1957
2079
|
}
|
|
1958
|
-
|
|
2080
|
+
const { relativeKey, adapter } = this.#getStorage(filePath);
|
|
2081
|
+
this.#log(types.LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
|
|
2082
|
+
return adapter.getSync(relativeKey) ?? void 0;
|
|
1959
2083
|
}
|
|
1960
2084
|
/**
|
|
1961
2085
|
* Writes a file to the virtual file system (VFS).
|
|
@@ -1965,41 +2089,28 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1965
2089
|
* @param options - Optional parameters for writing the file.
|
|
1966
2090
|
* @returns A promise that resolves when the file is written.
|
|
1967
2091
|
*/
|
|
1968
|
-
async
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
}
|
|
1972
|
-
const metadata = isVirtualFileData(data) ? data : {};
|
|
1973
|
-
metadata.id = this.#normalizeId(path);
|
|
1974
|
-
let code = isVirtualFileData(data) ? metadata.code : data;
|
|
1975
|
-
if ((!isPowerlinesWriteFileOptions(options) || !options.skipFormat) && isSetString.isSetString(code)) {
|
|
2092
|
+
async write(path, data = "", options = {}) {
|
|
2093
|
+
let code = data;
|
|
2094
|
+
if (!options.skipFormat) {
|
|
1976
2095
|
const resolvedConfig = await prettier.resolveConfig(this.#normalizePath(path));
|
|
1977
2096
|
if (resolvedConfig) {
|
|
1978
|
-
code = await prettier.format(
|
|
2097
|
+
code = await prettier.format(data, {
|
|
1979
2098
|
absolutePath: this.#normalizePath(path),
|
|
1980
2099
|
...resolvedConfig
|
|
1981
2100
|
});
|
|
1982
2101
|
}
|
|
1983
2102
|
}
|
|
1984
|
-
const
|
|
1985
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)}
|
|
1986
|
-
|
|
1987
|
-
|
|
2103
|
+
const { relativeKey, adapter } = this.#getStorage(path);
|
|
2104
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
|
|
2105
|
+
const id = options?.meta?.id || this.#normalizeId(path);
|
|
2106
|
+
this.#metadata[id] = {
|
|
1988
2107
|
variant: "normal",
|
|
1989
2108
|
timestamp: Date.now(),
|
|
1990
|
-
...
|
|
2109
|
+
...options.meta ?? {}
|
|
1991
2110
|
};
|
|
1992
|
-
this.#paths[
|
|
1993
|
-
this.#ids[this.#normalizePath(path)] =
|
|
1994
|
-
|
|
1995
|
-
if (isFunction.isFunction(ifs.promises.writeFile)) {
|
|
1996
|
-
return ifs.promises.writeFile(this.#normalizePath(path), code, isSetObject.isSetObject(options) ? omit.omit(options, [
|
|
1997
|
-
"mode"
|
|
1998
|
-
]) : "utf8");
|
|
1999
|
-
}
|
|
2000
|
-
return ifs.writeFileSync(this.#normalizePath(path), code, isSetObject.isSetObject(options) ? omit.omit(options, [
|
|
2001
|
-
"mode"
|
|
2002
|
-
]) : "utf8");
|
|
2111
|
+
this.#paths[id] = this.#normalizePath(path);
|
|
2112
|
+
this.#ids[this.#normalizePath(path)] = id;
|
|
2113
|
+
return adapter.set(relativeKey, code);
|
|
2003
2114
|
}
|
|
2004
2115
|
/**
|
|
2005
2116
|
* Synchronously writes a file to the virtual file system (VFS).
|
|
@@ -2008,38 +2119,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2008
2119
|
* @param data - The contents of the file.
|
|
2009
2120
|
* @param options - Optional parameters for writing the file.
|
|
2010
2121
|
*/
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
metadata.id = this.#normalizeId(path);
|
|
2017
|
-
const code = isVirtualFileData(data) ? metadata.code : data;
|
|
2018
|
-
const outputMode = this.#unifiedFS.resolveMode(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
|
|
2019
|
-
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
|
|
2020
|
-
this.#metadata[metadata.id] = {
|
|
2021
|
-
mode: outputMode,
|
|
2122
|
+
writeSync(path, data = "", options = {}) {
|
|
2123
|
+
const { relativeKey, adapter } = this.#getStorage(path);
|
|
2124
|
+
this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(data)).size)})`);
|
|
2125
|
+
const id = options?.meta?.id || this.#normalizeId(path);
|
|
2126
|
+
this.#metadata[id] = {
|
|
2022
2127
|
variant: "normal",
|
|
2023
2128
|
timestamp: Date.now(),
|
|
2024
|
-
...
|
|
2129
|
+
...options.meta ?? {}
|
|
2025
2130
|
};
|
|
2026
|
-
this.#paths[
|
|
2027
|
-
this.#ids[this.#normalizePath(path)] =
|
|
2028
|
-
|
|
2029
|
-
try {
|
|
2030
|
-
writeStream.write(code);
|
|
2031
|
-
} finally {
|
|
2032
|
-
writeStream.close();
|
|
2033
|
-
}
|
|
2034
|
-
}
|
|
2035
|
-
/**
|
|
2036
|
-
* Synchronously checks if a file exists in the virtual file system (VFS).
|
|
2037
|
-
*
|
|
2038
|
-
* @param pathOrId - The path or ID of the file to check.
|
|
2039
|
-
* @returns `true` if the file exists, otherwise `false`.
|
|
2040
|
-
*/
|
|
2041
|
-
existsSync(pathOrId) {
|
|
2042
|
-
return !!this.resolveSync(pathOrId);
|
|
2131
|
+
this.#paths[id] = this.#normalizePath(path);
|
|
2132
|
+
this.#ids[this.#normalizePath(path)] = id;
|
|
2133
|
+
return adapter.setSync(relativeKey, data);
|
|
2043
2134
|
}
|
|
2044
2135
|
/**
|
|
2045
2136
|
* Retrieves the metadata of a file in the virtual file system (VFS).
|
|
@@ -2055,78 +2146,6 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2055
2146
|
return void 0;
|
|
2056
2147
|
}
|
|
2057
2148
|
/**
|
|
2058
|
-
* Checks if a file exists in the virtual file system (VFS).
|
|
2059
|
-
*
|
|
2060
|
-
* @remarks
|
|
2061
|
-
* 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.
|
|
2062
|
-
*
|
|
2063
|
-
* @param pathOrId - The path of the file to check.
|
|
2064
|
-
* @returns `true` if the file exists, otherwise `false`.
|
|
2065
|
-
*/
|
|
2066
|
-
isFile(pathOrId) {
|
|
2067
|
-
const resolved = this.resolveSync(pathOrId);
|
|
2068
|
-
return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isFile() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isFile() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isFile()));
|
|
2069
|
-
}
|
|
2070
|
-
/**
|
|
2071
|
-
* Checks if a directory exists in the virtual file system (VFS).
|
|
2072
|
-
*
|
|
2073
|
-
* @param pathOrId - The path of the directory to check.
|
|
2074
|
-
* @returns `true` if the directory exists, otherwise `false`.
|
|
2075
|
-
*/
|
|
2076
|
-
isDirectory(pathOrId) {
|
|
2077
|
-
const resolved = this.resolveSync(pathOrId);
|
|
2078
|
-
return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isDirectory() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isDirectory() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isDirectory()));
|
|
2079
|
-
}
|
|
2080
|
-
/**
|
|
2081
|
-
* Retrieves the status of a file in the virtual file system (VFS).
|
|
2082
|
-
*
|
|
2083
|
-
* @param pathOrId - The path or ID of the file to retrieve status for.
|
|
2084
|
-
* @returns A promise that resolves to the file's status information, or false if the file does not exist.
|
|
2085
|
-
*/
|
|
2086
|
-
async stat(pathOrId, options) {
|
|
2087
|
-
return this.#unifiedFS.resolveFS(pathOrId).promises.stat(await this.resolve(pathOrId) || pathOrId, options);
|
|
2088
|
-
}
|
|
2089
|
-
/**
|
|
2090
|
-
* Synchronously retrieves the status of a file in the virtual file system (VFS).
|
|
2091
|
-
*
|
|
2092
|
-
* @param pathOrId - The path or ID of the file to retrieve status for.
|
|
2093
|
-
* @returns The file's status information, or false if the file does not exist.
|
|
2094
|
-
*/
|
|
2095
|
-
statSync(pathOrId) {
|
|
2096
|
-
return this.#unifiedFS.resolveFS(pathOrId).statSync(this.resolveSync(pathOrId) || pathOrId);
|
|
2097
|
-
}
|
|
2098
|
-
/**
|
|
2099
|
-
* Retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
2100
|
-
*
|
|
2101
|
-
* @param pathOrId - The path or ID of the symbolic link to retrieve status for.
|
|
2102
|
-
* @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
|
|
2103
|
-
*/
|
|
2104
|
-
async lstat(pathOrId, options) {
|
|
2105
|
-
return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(await this.resolve(pathOrId) || pathOrId, options);
|
|
2106
|
-
}
|
|
2107
|
-
/**
|
|
2108
|
-
* Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
|
|
2109
|
-
*
|
|
2110
|
-
* @param pathOrId - The path or ID of the symbolic link to retrieve status for.
|
|
2111
|
-
* @returns The symbolic link's status information, or false if the link does not exist.
|
|
2112
|
-
*/
|
|
2113
|
-
lstatSync(pathOrId, options) {
|
|
2114
|
-
return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.resolveSync(pathOrId) || pathOrId, options);
|
|
2115
|
-
}
|
|
2116
|
-
/**
|
|
2117
|
-
* Resolves a path or ID to its real path in the virtual file system (VFS).
|
|
2118
|
-
*
|
|
2119
|
-
* @param pathOrId - The path or ID to resolve.
|
|
2120
|
-
* @returns The resolved real path if it exists, otherwise undefined.
|
|
2121
|
-
*/
|
|
2122
|
-
realpathSync(pathOrId) {
|
|
2123
|
-
const filePath = this.resolveSync(pathOrId);
|
|
2124
|
-
if (!filePath) {
|
|
2125
|
-
throw new Error(`File not found: ${pathOrId}`);
|
|
2126
|
-
}
|
|
2127
|
-
return filePath;
|
|
2128
|
-
}
|
|
2129
|
-
/**
|
|
2130
2149
|
* A helper function to resolve modules in the virtual file system (VFS).
|
|
2131
2150
|
*
|
|
2132
2151
|
* @remarks
|
|
@@ -2143,9 +2162,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2143
2162
|
* @returns A promise that resolves to the resolved module path.
|
|
2144
2163
|
*/
|
|
2145
2164
|
async resolve(id, importer, options = {}) {
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2165
|
+
if (isType.isAbsolutePath(id)) {
|
|
2166
|
+
return id;
|
|
2167
|
+
}
|
|
2168
|
+
let result;
|
|
2169
|
+
if (!this.#context.config.skipCache) {
|
|
2170
|
+
result = this.resolverCache.get(this.#normalizeId(id));
|
|
2171
|
+
if (result) {
|
|
2172
|
+
return result;
|
|
2173
|
+
}
|
|
2149
2174
|
}
|
|
2150
2175
|
result = this.paths[this.#normalizeId(id)];
|
|
2151
2176
|
if (!result) {
|
|
@@ -2160,8 +2185,10 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2160
2185
|
for (const combination of resolve.getResolutionCombinations(id, {
|
|
2161
2186
|
paths
|
|
2162
2187
|
})) {
|
|
2163
|
-
|
|
2188
|
+
const { relativeKey, adapter } = this.#getStorage(combination);
|
|
2189
|
+
if (await adapter.exists(relativeKey)) {
|
|
2164
2190
|
result = combination;
|
|
2191
|
+
break;
|
|
2165
2192
|
}
|
|
2166
2193
|
}
|
|
2167
2194
|
try {
|
|
@@ -2173,7 +2200,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2173
2200
|
}
|
|
2174
2201
|
if (result) {
|
|
2175
2202
|
result = correctPath.toAbsolutePath(append.appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
|
|
2176
|
-
this.
|
|
2203
|
+
if (!this.#context.config.skipCache) {
|
|
2204
|
+
this.resolverCache.set(this.#normalizeId(id), result);
|
|
2205
|
+
}
|
|
2177
2206
|
}
|
|
2178
2207
|
return result;
|
|
2179
2208
|
}
|
|
@@ -2194,9 +2223,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2194
2223
|
* @returns The resolved module path.
|
|
2195
2224
|
*/
|
|
2196
2225
|
resolveSync(id, importer, options = {}) {
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2226
|
+
if (isType.isAbsolutePath(id)) {
|
|
2227
|
+
return id;
|
|
2228
|
+
}
|
|
2229
|
+
let result;
|
|
2230
|
+
if (!this.#context.config.skipCache) {
|
|
2231
|
+
result = this.resolverCache.get(this.#normalizeId(id));
|
|
2232
|
+
if (result) {
|
|
2233
|
+
return result;
|
|
2234
|
+
}
|
|
2200
2235
|
}
|
|
2201
2236
|
result = this.paths[this.#normalizeId(id)];
|
|
2202
2237
|
if (!result) {
|
|
@@ -2205,14 +2240,16 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2205
2240
|
paths.push(importer);
|
|
2206
2241
|
}
|
|
2207
2242
|
paths.push(this.#context.workspaceConfig.workspaceRoot);
|
|
2208
|
-
paths.push(
|
|
2209
|
-
paths.push(
|
|
2210
|
-
paths.push(...Object.keys(this.#context.tsconfig
|
|
2243
|
+
paths.push(append.appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
2244
|
+
paths.push(append.appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
|
|
2245
|
+
paths.push(...Object.keys(this.#context.tsconfig.options.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
|
|
2211
2246
|
for (const combination of resolve.getResolutionCombinations(id, {
|
|
2212
2247
|
paths
|
|
2213
2248
|
})) {
|
|
2214
|
-
|
|
2249
|
+
const { relativeKey, adapter } = this.#getStorage(combination);
|
|
2250
|
+
if (adapter.existsSync(relativeKey)) {
|
|
2215
2251
|
result = combination;
|
|
2252
|
+
break;
|
|
2216
2253
|
}
|
|
2217
2254
|
}
|
|
2218
2255
|
try {
|
|
@@ -2224,7 +2261,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2224
2261
|
}
|
|
2225
2262
|
if (result) {
|
|
2226
2263
|
result = correctPath.toAbsolutePath(append.appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
|
|
2227
|
-
this.
|
|
2264
|
+
if (!this.#context.config.skipCache) {
|
|
2265
|
+
this.resolverCache.set(this.#normalizeId(id), result);
|
|
2266
|
+
}
|
|
2228
2267
|
}
|
|
2229
2268
|
return result;
|
|
2230
2269
|
}
|
|
@@ -2235,27 +2274,27 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2235
2274
|
if (!this.#isDisposed) {
|
|
2236
2275
|
this.#isDisposed = true;
|
|
2237
2276
|
this.#log(types.LogLevelLabel.DEBUG, "Disposing virtual file system...");
|
|
2238
|
-
await this.
|
|
2277
|
+
await this.remove(joinPaths.joinPaths(this.#context.dataPath, "fs.bin"));
|
|
2239
2278
|
const message = new $__namespace.Message();
|
|
2240
|
-
const
|
|
2241
|
-
const
|
|
2242
|
-
const
|
|
2243
|
-
|
|
2244
|
-
const
|
|
2279
|
+
const fs = message.initRoot(FileSystem);
|
|
2280
|
+
const paths = await this.list();
|
|
2281
|
+
const storage = fs._initStorage(paths.length);
|
|
2282
|
+
await Promise.all(paths.map(async (path, index) => {
|
|
2283
|
+
const code = await this.read(path);
|
|
2284
|
+
const fd = storage.get(index);
|
|
2245
2285
|
fd.path = path;
|
|
2246
2286
|
fd.code = code || "";
|
|
2247
|
-
});
|
|
2248
|
-
const ids =
|
|
2287
|
+
}));
|
|
2288
|
+
const ids = fs._initIds(Object.keys(this.ids).length);
|
|
2249
2289
|
Object.entries(this.ids).filter(([, path]) => path).forEach(([id, path], index) => {
|
|
2250
2290
|
const fileId = ids.get(index);
|
|
2251
2291
|
fileId.id = id;
|
|
2252
2292
|
fileId.path = path;
|
|
2253
2293
|
});
|
|
2254
|
-
const metadata =
|
|
2294
|
+
const metadata = fs._initMetadata(Object.keys(this.metadata).length);
|
|
2255
2295
|
Object.entries(this.metadata).filter(([, value]) => value).forEach(([id, value], index) => {
|
|
2256
2296
|
const fileMetadata = metadata.get(index);
|
|
2257
2297
|
fileMetadata.id = id;
|
|
2258
|
-
fileMetadata.mode = value.mode;
|
|
2259
2298
|
fileMetadata.type = value.type;
|
|
2260
2299
|
fileMetadata.timestamp = value.timestamp ?? BigInt(Date.now());
|
|
2261
2300
|
if (value.properties) {
|
|
@@ -2268,155 +2307,59 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2268
2307
|
}
|
|
2269
2308
|
});
|
|
2270
2309
|
await buffer.writeFileBuffer(joinPaths.joinPaths(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
|
|
2271
|
-
this.#
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2310
|
+
if (!this.#context.config.skipCache) {
|
|
2311
|
+
this.#resolverCache.save(true);
|
|
2312
|
+
}
|
|
2313
|
+
await Promise.all(this.#getStorages().map(async (storage2) => storage2.adapter.dispose()));
|
|
2314
|
+
this.#log(types.LogLevelLabel.TRACE, "Virtual file system has been disposed.");
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
// /**
|
|
2318
|
+
// * Initializes the virtual file system (VFS) by patching the file system module if necessary.
|
|
2319
|
+
// */
|
|
2320
|
+
// public [__VFS_PATCH__]() {
|
|
2321
|
+
// if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
2322
|
+
// this.#revert = patchFS(fs, this);
|
|
2323
|
+
// this.#isPatched = true;
|
|
2324
|
+
// }
|
|
2325
|
+
// }
|
|
2326
|
+
// /**
|
|
2327
|
+
// * Reverts the file system module to its original state if it was previously patched.
|
|
2328
|
+
// */
|
|
2329
|
+
// public [__VFS_REVERT__]() {
|
|
2330
|
+
// if (this.#isPatched && this.#context.config.output.mode !== "fs") {
|
|
2331
|
+
// if (!this.#revert) {
|
|
2332
|
+
// throw new Error(
|
|
2333
|
+
// "Attempting to revert File System patch prior to calling `__init__` function"
|
|
2334
|
+
// );
|
|
2335
|
+
// }
|
|
2336
|
+
// this.#revert?.();
|
|
2337
|
+
// this.#isPatched = false;
|
|
2338
|
+
// }
|
|
2339
|
+
// }
|
|
2296
2340
|
async [Symbol.asyncDispose]() {
|
|
2297
2341
|
return this.dispose();
|
|
2298
2342
|
}
|
|
2299
2343
|
};
|
|
2300
|
-
var VirtualFileSystemHost = class VirtualFileSystemHost2 extends tsMorph.InMemoryFileSystemHost {
|
|
2301
|
-
static {
|
|
2302
|
-
chunkUSNT2KNT_cjs.__name(this, "VirtualFileSystemHost");
|
|
2303
|
-
}
|
|
2304
|
-
#fs;
|
|
2305
|
-
constructor(fs2) {
|
|
2306
|
-
super();
|
|
2307
|
-
this.#fs = fs2;
|
|
2308
|
-
}
|
|
2309
|
-
deleteSync(path) {
|
|
2310
|
-
this.#fs.rmSync(path);
|
|
2311
|
-
}
|
|
2312
|
-
readDirSync(dirPath) {
|
|
2313
|
-
return this.#fs.readdirSync(dirPath).reduce((ret, entry) => {
|
|
2314
|
-
const fullPath = this.#fs.resolveSync(join.joinPaths(dirPath, entry));
|
|
2315
|
-
if (fullPath) {
|
|
2316
|
-
ret.push({
|
|
2317
|
-
name: entry,
|
|
2318
|
-
isDirectory: this.#fs.isDirectory(fullPath),
|
|
2319
|
-
isFile: this.#fs.isFile(fullPath),
|
|
2320
|
-
isSymlink: false
|
|
2321
|
-
});
|
|
2322
|
-
}
|
|
2323
|
-
return ret;
|
|
2324
|
-
}, []);
|
|
2325
|
-
}
|
|
2326
|
-
async readFile(filePath) {
|
|
2327
|
-
if (!this.#fs.existsSync(filePath)) {
|
|
2328
|
-
throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
|
|
2329
|
-
}
|
|
2330
|
-
return await this.#fs.readFile(filePath);
|
|
2331
|
-
}
|
|
2332
|
-
readFileSync(filePath) {
|
|
2333
|
-
if (!this.#fs.existsSync(filePath)) {
|
|
2334
|
-
throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
|
|
2335
|
-
}
|
|
2336
|
-
return this.#fs.readFileSync(filePath);
|
|
2337
|
-
}
|
|
2338
|
-
async writeFile(filePath, fileText) {
|
|
2339
|
-
return this.#fs.writeFile(filePath, fileText);
|
|
2340
|
-
}
|
|
2341
|
-
writeFileSync(filePath, fileText) {
|
|
2342
|
-
this.#fs.writeFileSync(filePath, fileText);
|
|
2343
|
-
}
|
|
2344
|
-
async mkdir(dirPath) {
|
|
2345
|
-
await this.#fs.mkdir(dirPath);
|
|
2346
|
-
}
|
|
2347
|
-
mkdirSync(dirPath) {
|
|
2348
|
-
this.#fs.mkdirSync(dirPath);
|
|
2349
|
-
}
|
|
2350
|
-
async move(srcPath, destPath) {
|
|
2351
|
-
await this.#fs.move(srcPath, destPath);
|
|
2352
|
-
}
|
|
2353
|
-
moveSync(srcPath, destPath) {
|
|
2354
|
-
this.#fs.moveSync(srcPath, destPath);
|
|
2355
|
-
}
|
|
2356
|
-
async copy(srcPath, destPath) {
|
|
2357
|
-
await this.#fs.copy(srcPath, destPath);
|
|
2358
|
-
}
|
|
2359
|
-
copySync(srcPath, destPath) {
|
|
2360
|
-
this.#fs.copySync(srcPath, destPath);
|
|
2361
|
-
}
|
|
2362
|
-
async fileExists(filePath) {
|
|
2363
|
-
return this.#fs.isFile(filePath);
|
|
2364
|
-
}
|
|
2365
|
-
fileExistsSync(filePath) {
|
|
2366
|
-
return this.#fs.isFile(filePath);
|
|
2367
|
-
}
|
|
2368
|
-
async directoryExists(dirPath) {
|
|
2369
|
-
return this.#fs.isDirectory(dirPath);
|
|
2370
|
-
}
|
|
2371
|
-
directoryExistsSync(dirPath) {
|
|
2372
|
-
return this.#fs.isDirectory(dirPath);
|
|
2373
|
-
}
|
|
2374
|
-
realpathSync(path) {
|
|
2375
|
-
return this.#fs.resolveSync(path) || path;
|
|
2376
|
-
}
|
|
2377
|
-
getCurrentDirectory() {
|
|
2378
|
-
return "/";
|
|
2379
|
-
}
|
|
2380
|
-
async glob(patterns) {
|
|
2381
|
-
return this.#fs.glob(patterns);
|
|
2382
|
-
}
|
|
2383
|
-
globSync(patterns) {
|
|
2384
|
-
return this.#fs.globSync(patterns);
|
|
2385
|
-
}
|
|
2386
|
-
};
|
|
2387
|
-
function createProgram(context, override) {
|
|
2388
|
-
const project = new tsMorph.Project({
|
|
2389
|
-
compilerOptions: {
|
|
2390
|
-
...context.tsconfig.options
|
|
2391
|
-
},
|
|
2392
|
-
tsConfigFilePath: context.tsconfig.tsconfigFilePath,
|
|
2393
|
-
fileSystem: new VirtualFileSystemHost(context.fs),
|
|
2394
|
-
...override
|
|
2395
|
-
});
|
|
2396
|
-
return project;
|
|
2397
|
-
}
|
|
2398
|
-
chunkUSNT2KNT_cjs.__name(createProgram, "createProgram");
|
|
2399
2344
|
var PROJECT_ROOT_HASH_LENGTH = 45;
|
|
2400
2345
|
var CACHE_HASH_LENGTH = 62;
|
|
2401
2346
|
function getPrefixedProjectRootHash(name, projectRootHash) {
|
|
2402
2347
|
const combined = `${kebabCase.kebabCase(name)}_${projectRootHash}`;
|
|
2403
2348
|
return combined.length > PROJECT_ROOT_HASH_LENGTH ? combined.slice(0, PROJECT_ROOT_HASH_LENGTH) : combined;
|
|
2404
2349
|
}
|
|
2405
|
-
|
|
2350
|
+
chunkPK6SKIKE_cjs.__name(getPrefixedProjectRootHash, "getPrefixedProjectRootHash");
|
|
2406
2351
|
async function writeMetaFile(context) {
|
|
2407
2352
|
const metaFilePath = joinPaths.joinPaths(context.dataPath, "meta.json");
|
|
2408
2353
|
context.log(types.LogLevelLabel.DEBUG, `Writing runtime metadata to ${metaFilePath}`);
|
|
2409
|
-
await context.fs.
|
|
2410
|
-
mode: "fs"
|
|
2411
|
-
});
|
|
2354
|
+
await context.fs.write(metaFilePath, JSON.stringify(context.meta, null, 2));
|
|
2412
2355
|
}
|
|
2413
|
-
|
|
2356
|
+
chunkPK6SKIKE_cjs.__name(writeMetaFile, "writeMetaFile");
|
|
2414
2357
|
|
|
2415
2358
|
// src/lib/contexts/context.ts
|
|
2416
2359
|
var configCache = /* @__PURE__ */ new WeakMap();
|
|
2417
2360
|
var PowerlinesContext = class _PowerlinesContext {
|
|
2418
2361
|
static {
|
|
2419
|
-
|
|
2362
|
+
chunkPK6SKIKE_cjs.__name(this, "PowerlinesContext");
|
|
2420
2363
|
}
|
|
2421
2364
|
/**
|
|
2422
2365
|
* Internal reference to the API instance
|
|
@@ -2611,7 +2554,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2611
2554
|
* Get the path to the artifacts directory for the project
|
|
2612
2555
|
*/
|
|
2613
2556
|
get artifactsPath() {
|
|
2614
|
-
return join.joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, this.config.output.
|
|
2557
|
+
return join.joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, this.config.output.artifactsPath);
|
|
2615
2558
|
}
|
|
2616
2559
|
/**
|
|
2617
2560
|
* Get the path to the builtin modules used by the project
|
|
@@ -2751,7 +2694,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2751
2694
|
if (!resolvedId) {
|
|
2752
2695
|
return void 0;
|
|
2753
2696
|
}
|
|
2754
|
-
const code = await this.fs.
|
|
2697
|
+
const code = await this.fs.read(resolvedId);
|
|
2755
2698
|
if (!code) {
|
|
2756
2699
|
return void 0;
|
|
2757
2700
|
}
|
|
@@ -2765,7 +2708,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2765
2708
|
*/
|
|
2766
2709
|
async getBuiltins() {
|
|
2767
2710
|
return Promise.all(Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.type === "builtin").map(async ([path, meta]) => {
|
|
2768
|
-
const code = await this.fs.
|
|
2711
|
+
const code = await this.fs.read(path);
|
|
2769
2712
|
return {
|
|
2770
2713
|
...meta,
|
|
2771
2714
|
path,
|
|
@@ -2781,11 +2724,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2781
2724
|
* @param options - Optional write file options
|
|
2782
2725
|
*/
|
|
2783
2726
|
async emitEntry(code, path, options = {}) {
|
|
2784
|
-
return this.fs.
|
|
2785
|
-
code,
|
|
2727
|
+
return this.fs.write(isType.isAbsolute(path) ? path : append.appendPath(path, this.entryPath), code, defu7__default.default(options, {
|
|
2786
2728
|
type: "entry"
|
|
2787
|
-
}, defu6__default.default(options, {
|
|
2788
|
-
mode: this.config.output.mode
|
|
2789
2729
|
}));
|
|
2790
2730
|
}
|
|
2791
2731
|
/**
|
|
@@ -2797,12 +2737,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2797
2737
|
* @param options - Optional write file options
|
|
2798
2738
|
*/
|
|
2799
2739
|
async emitBuiltin(code, id, path, options = {}) {
|
|
2800
|
-
return this.fs.
|
|
2801
|
-
id,
|
|
2802
|
-
code,
|
|
2740
|
+
return this.fs.write(path ? isType.isAbsolute(path) ? path : join.joinPaths(this.builtinsPath, path) : append.appendPath(id, this.builtinsPath), code, defu7__default.default(options, {
|
|
2803
2741
|
type: "builtin"
|
|
2804
|
-
}, defu6__default.default(options, {
|
|
2805
|
-
mode: this.config.output.mode
|
|
2806
2742
|
}));
|
|
2807
2743
|
}
|
|
2808
2744
|
/**
|
|
@@ -2996,9 +2932,9 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2996
2932
|
userConfig
|
|
2997
2933
|
});
|
|
2998
2934
|
}
|
|
2999
|
-
|
|
2935
|
+
config.tsconfig ??= getTsconfigFilePath(this.workspaceConfig.workspaceRoot, cacheKey.projectRoot, config.tsconfig);
|
|
3000
2936
|
if (isSetObject.isSetObject(config)) {
|
|
3001
|
-
this.resolvedConfig =
|
|
2937
|
+
this.resolvedConfig = defu7__default.default({
|
|
3002
2938
|
inlineConfig: this.config.inlineConfig,
|
|
3003
2939
|
userConfig: this.config.userConfig
|
|
3004
2940
|
}, options.isHighPriority ? this.#getConfigProps(config) : {}, {
|
|
@@ -3013,12 +2949,11 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3013
2949
|
version: this.packageJson?.version,
|
|
3014
2950
|
description: this.packageJson?.description,
|
|
3015
2951
|
sourceRoot: this.projectJson?.sourceRoot || append.appendPath("src", cacheKey.projectRoot),
|
|
3016
|
-
output: {
|
|
2952
|
+
output: defu7__default.default(config.output ?? {}, {
|
|
3017
2953
|
outputPath: cacheKey.projectRoot ? join.joinPaths(this.workspaceConfig?.directories?.build || "dist", cacheKey.projectRoot) : this.workspaceConfig?.directories?.build || "dist",
|
|
3018
|
-
|
|
2954
|
+
artifactsPath: join.joinPaths(cacheKey.projectRoot, `.${config.framework ?? "powerlines"}`),
|
|
3019
2955
|
dts: join.joinPaths(cacheKey.projectRoot, `${config.framework ?? "powerlines"}.d.ts`),
|
|
3020
2956
|
builtinPrefix: config.framework ?? "powerlines",
|
|
3021
|
-
artifactsFolder: join.joinPaths(cacheKey.projectRoot, `.${config.framework ?? "powerlines"}`),
|
|
3022
2957
|
assets: [
|
|
3023
2958
|
{
|
|
3024
2959
|
glob: "LICENSE"
|
|
@@ -3032,7 +2967,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3032
2967
|
glob: "package.json"
|
|
3033
2968
|
}
|
|
3034
2969
|
]
|
|
3035
|
-
}
|
|
2970
|
+
})
|
|
3036
2971
|
}, options.isHighPriority ? {} : this.#getConfigProps(config), {
|
|
3037
2972
|
inlineConfig: {},
|
|
3038
2973
|
userConfig: {},
|
|
@@ -3077,10 +3012,10 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3077
3012
|
])));
|
|
3078
3013
|
if (this.config.projectRoot && this.config.projectRoot !== "." && this.config.projectRoot !== "./" && this.config.projectRoot !== this.workspaceConfig.workspaceRoot) {
|
|
3079
3014
|
this.config.output.outputPath ??= join.joinPaths("dist", this.config.projectRoot);
|
|
3080
|
-
this.config.output.
|
|
3015
|
+
this.config.output.buildPath ??= join.joinPaths(this.config.projectRoot, "dist");
|
|
3081
3016
|
} else {
|
|
3082
3017
|
this.config.output.outputPath ??= "dist";
|
|
3083
|
-
this.config.output.
|
|
3018
|
+
this.config.output.buildPath ??= "dist";
|
|
3084
3019
|
}
|
|
3085
3020
|
this.config.output.assets = getUnique.getUnique(this.config.output.assets.map((asset) => {
|
|
3086
3021
|
return {
|
|
@@ -3118,7 +3053,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3118
3053
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
3119
3054
|
}
|
|
3120
3055
|
mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
|
|
3121
|
-
this.config.userConfig =
|
|
3056
|
+
this.config.userConfig = defu7__default.default({
|
|
3122
3057
|
entry: Array.isArray(from.entry) && from.entry.length > 0 ? from.entry : Array.isArray(into?.entry) && into.entry.length > 0 ? into.entry : []
|
|
3123
3058
|
}, omit.omit(from ?? {}, [
|
|
3124
3059
|
"entry"
|
|
@@ -3138,11 +3073,11 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3138
3073
|
}
|
|
3139
3074
|
};
|
|
3140
3075
|
function createPluginContext(plugin, environment) {
|
|
3141
|
-
const normalizeMessage = /* @__PURE__ */
|
|
3076
|
+
const normalizeMessage = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((message) => {
|
|
3142
3077
|
return isString.isString(message) ? message : message.message;
|
|
3143
3078
|
}, "normalizeMessage");
|
|
3144
3079
|
const log = environment.extendLog(plugin.name);
|
|
3145
|
-
const callHookFn = /* @__PURE__ */
|
|
3080
|
+
const callHookFn = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(async (hook, options, ...args) => {
|
|
3146
3081
|
return callHook(environment, hook, {
|
|
3147
3082
|
sequential: true,
|
|
3148
3083
|
...options
|
|
@@ -3209,12 +3144,12 @@ function createPluginContext(plugin, environment) {
|
|
|
3209
3144
|
}
|
|
3210
3145
|
});
|
|
3211
3146
|
}
|
|
3212
|
-
|
|
3147
|
+
chunkPK6SKIKE_cjs.__name(createPluginContext, "createPluginContext");
|
|
3213
3148
|
|
|
3214
3149
|
// src/lib/contexts/environment-context.ts
|
|
3215
3150
|
var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends PowerlinesContext {
|
|
3216
3151
|
static {
|
|
3217
|
-
|
|
3152
|
+
chunkPK6SKIKE_cjs.__name(this, "PowerlinesEnvironmentContext");
|
|
3218
3153
|
}
|
|
3219
3154
|
/**
|
|
3220
3155
|
* The hooks registered by plugins in this environment
|
|
@@ -3267,7 +3202,7 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends P
|
|
|
3267
3202
|
plugin: resolvedPlugin,
|
|
3268
3203
|
context
|
|
3269
3204
|
});
|
|
3270
|
-
this.#hooks = Object.keys(resolvedPlugin).filter((key) => !
|
|
3205
|
+
this.#hooks = Object.keys(resolvedPlugin).filter((key) => !chunkXH2XKGPW_cjs.PLUGIN_NON_HOOK_FIELDS.includes(key)).reduce((ret, key) => {
|
|
3271
3206
|
const hook = key;
|
|
3272
3207
|
const pluginHook = resolvedPlugin[hook];
|
|
3273
3208
|
if (!isPluginHook(pluginHook)) {
|
|
@@ -3341,7 +3276,7 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends P
|
|
|
3341
3276
|
// src/lib/contexts/api-context.ts
|
|
3342
3277
|
var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext {
|
|
3343
3278
|
static {
|
|
3344
|
-
|
|
3279
|
+
chunkPK6SKIKE_cjs.__name(this, "PowerlinesAPIContext");
|
|
3345
3280
|
}
|
|
3346
3281
|
#environments = {};
|
|
3347
3282
|
#plugins = [];
|
|
@@ -3414,12 +3349,49 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
3414
3349
|
}
|
|
3415
3350
|
return context;
|
|
3416
3351
|
}
|
|
3352
|
+
/**
|
|
3353
|
+
* Update the context using a new user configuration options
|
|
3354
|
+
*
|
|
3355
|
+
* @param userConfig - The new user configuration options.
|
|
3356
|
+
*/
|
|
3357
|
+
async withUserConfig(userConfig, options = {
|
|
3358
|
+
isHighPriority: true
|
|
3359
|
+
}) {
|
|
3360
|
+
await super.withUserConfig(userConfig, options);
|
|
3361
|
+
await Promise.all(Object.keys(this.#environments).map(async (name) => {
|
|
3362
|
+
await this.#environments[name].withUserConfig(userConfig, options);
|
|
3363
|
+
}));
|
|
3364
|
+
}
|
|
3365
|
+
/**
|
|
3366
|
+
* Update the context using a new inline configuration options
|
|
3367
|
+
*
|
|
3368
|
+
* @param inlineConfig - The new inline configuration options.
|
|
3369
|
+
*/
|
|
3370
|
+
async withInlineConfig(inlineConfig, options = {
|
|
3371
|
+
isHighPriority: true
|
|
3372
|
+
}) {
|
|
3373
|
+
await super.withInlineConfig(inlineConfig, options);
|
|
3374
|
+
await Promise.all(Object.keys(this.#environments).map(async (name) => {
|
|
3375
|
+
await this.#environments[name].withInlineConfig(inlineConfig, options);
|
|
3376
|
+
}));
|
|
3377
|
+
}
|
|
3378
|
+
/**
|
|
3379
|
+
* Add a plugin to the API context and all environments
|
|
3380
|
+
*
|
|
3381
|
+
* @param plugin - The plugin to add.
|
|
3382
|
+
*/
|
|
3417
3383
|
async addPlugin(plugin) {
|
|
3418
3384
|
this.plugins.push(plugin);
|
|
3419
3385
|
await Promise.all(Object.keys(this.environments).map(async (name) => {
|
|
3420
3386
|
await this.environments[name].addPlugin(plugin);
|
|
3421
3387
|
}));
|
|
3422
3388
|
}
|
|
3389
|
+
/**
|
|
3390
|
+
* Get an environment by name, or the default environment if no name is provided
|
|
3391
|
+
*
|
|
3392
|
+
* @param name - The name of the environment to retrieve.
|
|
3393
|
+
* @returns The requested environment context.
|
|
3394
|
+
*/
|
|
3423
3395
|
async getEnvironment(name) {
|
|
3424
3396
|
let environment;
|
|
3425
3397
|
if (name) {
|
|
@@ -3452,7 +3424,7 @@ function getBaseFileHeader(context) {
|
|
|
3452
3424
|
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
3453
3425
|
`;
|
|
3454
3426
|
}
|
|
3455
|
-
|
|
3427
|
+
chunkPK6SKIKE_cjs.__name(getBaseFileHeader, "getBaseFileHeader");
|
|
3456
3428
|
function getFileHeader(context, options = {}) {
|
|
3457
3429
|
const { directive = null, prettierIgnore = false } = options;
|
|
3458
3430
|
return `/* eslint-disable */
|
|
@@ -3465,12 +3437,12 @@ ${getBaseFileHeader(context)}
|
|
|
3465
3437
|
|
|
3466
3438
|
`;
|
|
3467
3439
|
}
|
|
3468
|
-
|
|
3440
|
+
chunkPK6SKIKE_cjs.__name(getFileHeader, "getFileHeader");
|
|
3469
3441
|
|
|
3470
3442
|
// src/api.ts
|
|
3471
3443
|
var PowerlinesAPI = class _PowerlinesAPI {
|
|
3472
3444
|
static {
|
|
3473
|
-
|
|
3445
|
+
chunkPK6SKIKE_cjs.__name(this, "PowerlinesAPI");
|
|
3474
3446
|
}
|
|
3475
3447
|
/**
|
|
3476
3448
|
* The Powerlines context
|
|
@@ -3541,21 +3513,17 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3541
3513
|
await writeMetaFile(context);
|
|
3542
3514
|
context.persistedMeta = context.meta;
|
|
3543
3515
|
if (!context.fs.existsSync(context.cachePath)) {
|
|
3544
|
-
await
|
|
3545
|
-
mode: "fs"
|
|
3546
|
-
});
|
|
3516
|
+
await helpers.createDirectory(context.cachePath);
|
|
3547
3517
|
}
|
|
3548
3518
|
if (!context.fs.existsSync(context.dataPath)) {
|
|
3549
|
-
await
|
|
3550
|
-
mode: "fs"
|
|
3551
|
-
});
|
|
3519
|
+
await helpers.createDirectory(context.dataPath);
|
|
3552
3520
|
}
|
|
3553
3521
|
await this.callPreHook(context, "prepare");
|
|
3554
3522
|
await this.callNormalHook(context, "prepare");
|
|
3555
3523
|
if (context.config.output.dts !== false) {
|
|
3556
3524
|
context.log(types.LogLevelLabel.TRACE, `Preparing the TypeScript definitions for the Powerlines project.`);
|
|
3557
3525
|
if (context.fs.existsSync(context.dtsPath)) {
|
|
3558
|
-
await context.fs.
|
|
3526
|
+
await context.fs.remove(context.dtsPath);
|
|
3559
3527
|
}
|
|
3560
3528
|
context.log(types.LogLevelLabel.TRACE, "Transforming built-ins runtime modules files.");
|
|
3561
3529
|
const builtinFilePaths = await Promise.all((await context.getBuiltins()).map(async (file) => {
|
|
@@ -3642,7 +3610,7 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3642
3610
|
generatedTypes = result;
|
|
3643
3611
|
}
|
|
3644
3612
|
}
|
|
3645
|
-
await context.fs.
|
|
3613
|
+
await context.fs.write(context.dtsPath, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
|
|
3646
3614
|
|
|
3647
3615
|
` : ""}${getFileHeader(context, {
|
|
3648
3616
|
directive: null,
|
|
@@ -3650,9 +3618,7 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
3650
3618
|
})}
|
|
3651
3619
|
|
|
3652
3620
|
${formatTypes(generatedTypes)}
|
|
3653
|
-
|
|
3654
|
-
mode: "fs"
|
|
3655
|
-
});
|
|
3621
|
+
`);
|
|
3656
3622
|
}
|
|
3657
3623
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
3658
3624
|
if (!context.tsconfig) {
|
|
@@ -3720,8 +3686,8 @@ ${formatTypes(generatedTypes)}
|
|
|
3720
3686
|
await this.prepare(inlineConfig);
|
|
3721
3687
|
await this.#executeEnvironments(async (context) => {
|
|
3722
3688
|
this.context.log(types.LogLevelLabel.TRACE, "Cleaning the project's dist and artifacts directories.");
|
|
3723
|
-
await context.fs.
|
|
3724
|
-
await context.fs.
|
|
3689
|
+
await context.fs.remove(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.buildPath));
|
|
3690
|
+
await context.fs.remove(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.artifactsPath));
|
|
3725
3691
|
await callHook(context, "clean", {
|
|
3726
3692
|
sequential: true
|
|
3727
3693
|
});
|
|
@@ -3763,11 +3729,11 @@ ${formatTypes(generatedTypes)}
|
|
|
3763
3729
|
await this.#executeEnvironments(async (context) => {
|
|
3764
3730
|
await this.callPreHook(context, "build");
|
|
3765
3731
|
await this.callNormalHook(context, "build");
|
|
3766
|
-
if (context.config.output.
|
|
3767
|
-
const sourcePath = append.appendPath(context.config.output.
|
|
3732
|
+
if (context.config.output.buildPath !== context.config.output.outputPath) {
|
|
3733
|
+
const sourcePath = append.appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot);
|
|
3768
3734
|
const destinationPath = joinPaths.joinPaths(append.appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot), "dist");
|
|
3769
3735
|
if (sourcePath !== destinationPath) {
|
|
3770
|
-
context.log(types.LogLevelLabel.INFO, `Copying build output files from project's build directory (${context.config.output.
|
|
3736
|
+
context.log(types.LogLevelLabel.INFO, `Copying build output files from project's build directory (${context.config.output.buildPath}) to the workspace's output directory (${context.config.output.outputPath}).`);
|
|
3771
3737
|
await copyFile.copyFiles({
|
|
3772
3738
|
input: sourcePath,
|
|
3773
3739
|
glob: "**/*"
|
|
@@ -4097,14 +4063,14 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
4097
4063
|
}
|
|
4098
4064
|
};
|
|
4099
4065
|
|
|
4100
|
-
exports.FileData = FileData;
|
|
4101
4066
|
exports.FileId = FileId;
|
|
4102
4067
|
exports.FileMetadata = FileMetadata;
|
|
4103
4068
|
exports.FileMetadata_KeyValuePair = FileMetadata_KeyValuePair;
|
|
4069
|
+
exports.FileStorage = FileStorage;
|
|
4104
4070
|
exports.FileSystem = FileSystem;
|
|
4105
|
-
exports.FileType = FileType;
|
|
4106
4071
|
exports.PowerlinesAPI = PowerlinesAPI;
|
|
4107
|
-
exports.PreserveSignatureType = PreserveSignatureType;
|
|
4108
4072
|
exports._capnpFileId = _capnpFileId;
|
|
4109
4073
|
exports.createLog = createLog;
|
|
4110
4074
|
exports.extendLog = extendLog;
|
|
4075
|
+
//# sourceMappingURL=chunk-YWJHR2FX.cjs.map
|
|
4076
|
+
//# sourceMappingURL=chunk-YWJHR2FX.cjs.map
|