powerlines 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.cjs +14 -0
- package/dist/{internal/api.d.cts → api.d.cts} +14 -14
- package/dist/{internal/api.d.ts → api.d.ts} +14 -14
- package/dist/api.js +5 -0
- package/dist/astro.cjs +12 -14
- package/dist/astro.d.cts +6 -6
- package/dist/astro.d.ts +6 -6
- package/dist/astro.js +9 -11
- package/dist/chunk-22MUBUHP.cjs +10 -0
- package/dist/chunk-2NO7N5OW.cjs +2 -0
- package/dist/chunk-3AEMPMJA.js +29 -0
- package/dist/{chunk-BHP6KBGK.js → chunk-53SIK3PC.js} +2 -4
- package/dist/chunk-7464OF2J.cjs +10 -0
- package/dist/chunk-7GYTTM4M.cjs +2 -0
- package/dist/{chunk-SY7N6FC3.js → chunk-7TKF67GW.js} +1 -3
- package/dist/chunk-AENPRFWJ.cjs +2 -0
- package/dist/chunk-AWZEALXL.cjs +32 -0
- package/dist/chunk-BUR2JQ6G.cjs +11 -0
- package/dist/{chunk-RU6BHTIP.cjs → chunk-C3O6OZ75.cjs} +4 -6
- package/dist/{chunk-BOIEJ5I6.js → chunk-CEMWMWEY.js} +3 -5
- package/dist/chunk-CJSGAITR.js +9 -0
- package/dist/{chunk-6TJGZR5X.js → chunk-CWCEYGLM.js} +1 -4
- package/dist/chunk-DRXFQCNC.js +1 -0
- package/dist/{chunk-V7LXFIGK.js → chunk-DTVAXYH7.js} +19 -4
- package/dist/{chunk-APVMN2H7.cjs → chunk-ETKZMGLN.cjs} +0 -2
- package/dist/{chunk-UZQYBO6Z.cjs → chunk-F5NKLRZD.cjs} +2 -5
- package/dist/{chunk-5VPVJHJO.cjs → chunk-FCTNMPJF.cjs} +0 -2
- package/dist/chunk-FNZDWE4L.js +1 -0
- package/dist/{chunk-WCTOTE3T.cjs → chunk-FSZEVJIL.cjs} +31 -16
- package/dist/chunk-FUXITWBD.cjs +10 -0
- package/dist/{chunk-A3BBPLTY.js → chunk-G45EBQMJ.js} +1 -3
- package/dist/chunk-GHJU2KGP.cjs +2 -0
- package/dist/chunk-H26QYGLD.cjs +10 -0
- package/dist/chunk-HQFZ64VC.cjs +2 -0
- package/dist/chunk-J4BQZHTQ.js +1 -0
- package/dist/chunk-JGB5YQ2U.js +1 -0
- package/dist/{chunk-EBMELFCF.js → chunk-JQCWV4DT.js} +0 -2
- package/dist/chunk-KALR2O2F.cjs +2 -0
- package/dist/chunk-KIKTWMI3.cjs +2 -0
- package/dist/{chunk-ZP5QLZQ2.js → chunk-KQPL2ZMU.js} +2 -4
- package/dist/{chunk-ELHJY5WG.cjs → chunk-KZMYPV7R.cjs} +7 -9
- package/dist/{chunk-RBRFT2R6.js → chunk-LQEDMNSD.js} +1 -3
- package/dist/{chunk-FANQC345.cjs → chunk-LZM7R4YU.cjs} +6 -8
- package/dist/{chunk-L3DAMAEC.js → chunk-MQXT2JKH.js} +2 -4
- package/dist/{chunk-4HGQJ4KR.js → chunk-OBYFBPPO.js} +0 -2
- package/dist/chunk-OO3YXM72.js +1 -0
- package/dist/chunk-P3BPRVO6.cjs +22 -0
- package/dist/chunk-QE3WGMAP.js +1 -0
- package/dist/{chunk-P4BOYWXT.js → chunk-REW4ZSBN.js} +522 -507
- package/dist/{chunk-22K72CJ5.cjs → chunk-RF6RSWD4.cjs} +0 -2
- package/dist/{chunk-7QVYU63E.js → chunk-SHUYVCID.js} +0 -2
- package/dist/chunk-SMNKPH4T.js +1 -0
- package/dist/{chunk-PK6SKIKE.cjs → chunk-USNT2KNT.cjs} +0 -2
- package/dist/chunk-V3MLQDZQ.js +1 -0
- package/dist/{chunk-ZQ7U35QZ.js → chunk-VBAXXI72.js} +1 -3
- package/dist/{chunk-7UIYU6SC.js → chunk-VIRLWSS6.js} +2 -4
- package/dist/{chunk-SIZKRND7.js → chunk-W5X3ZEZ5.js} +0 -2
- package/dist/{chunk-LO77RPRV.js → chunk-WJ4CZKXY.js} +0 -2
- package/dist/chunk-WWJBVH7C.cjs +17 -0
- package/dist/chunk-XLRMX2NL.cjs +10 -0
- package/dist/{chunk-YIWHO6SW.cjs → chunk-XP7OML7S.cjs} +0 -2
- package/dist/chunk-XVLT2RQ2.js +1 -0
- package/dist/{chunk-V5D5NVV7.cjs → chunk-XWSGD2C3.cjs} +4 -6
- package/dist/chunk-YRJ4MLVL.cjs +2 -0
- package/dist/{chunk-MAEKW52U.js → chunk-YWJMO2CR.js} +3 -5
- package/dist/chunk-ZC43PZXS.cjs +2 -0
- package/dist/{chunk-NGKWITCO.js → chunk-ZCO7TMWP.js} +1 -3
- package/dist/{chunk-PJRHRDLS.cjs → chunk-ZJSWJ27U.cjs} +591 -578
- package/dist/config.cjs +11 -0
- package/dist/{define-config.d.cts → config.d.cts} +4 -4
- package/dist/{define-config.d.ts → config.d.ts} +4 -4
- package/dist/config.js +2 -0
- package/dist/esbuild.cjs +11 -13
- package/dist/esbuild.d.cts +6 -6
- package/dist/esbuild.d.ts +6 -6
- package/dist/esbuild.js +8 -10
- package/dist/farm.cjs +7 -9
- package/dist/farm.d.cts +6 -6
- package/dist/farm.d.ts +6 -6
- package/dist/farm.js +6 -8
- package/dist/{hooks-q1Az_C64.d.ts → hooks-ByM-4_UN.d.ts} +1 -1
- package/dist/{hooks-Wrj1dKJ9.d.cts → hooks-DcH9z5L5.d.cts} +1 -1
- package/dist/index.cjs +43 -51
- package/dist/index.d.cts +11 -12
- package/dist/index.d.ts +11 -12
- package/dist/index.js +31 -35
- package/dist/lib/build/esbuild.cjs +6 -8
- package/dist/lib/build/esbuild.d.cts +3 -2
- package/dist/lib/build/esbuild.d.ts +3 -2
- package/dist/lib/build/esbuild.js +3 -5
- package/dist/lib/build/index.cjs +27 -29
- package/dist/lib/build/index.d.cts +4 -3
- package/dist/lib/build/index.d.ts +4 -3
- package/dist/lib/build/index.js +11 -13
- package/dist/lib/build/rolldown.cjs +4 -6
- package/dist/lib/build/rolldown.d.cts +3 -2
- package/dist/lib/build/rolldown.d.ts +3 -2
- package/dist/lib/build/rolldown.js +3 -5
- package/dist/lib/build/rollup.cjs +4 -6
- package/dist/lib/build/rollup.d.cts +3 -2
- package/dist/lib/build/rollup.d.ts +3 -2
- package/dist/lib/build/rollup.js +2 -4
- package/dist/lib/build/rspack.cjs +3 -5
- package/dist/lib/build/rspack.d.cts +3 -2
- package/dist/lib/build/rspack.d.ts +3 -2
- package/dist/lib/build/rspack.js +2 -4
- package/dist/lib/build/tsup.cjs +7 -9
- package/dist/lib/build/tsup.d.cts +3 -2
- package/dist/lib/build/tsup.d.ts +3 -2
- package/dist/lib/build/tsup.js +4 -6
- package/dist/lib/build/unbuild.cjs +7 -9
- package/dist/lib/build/unbuild.d.cts +4 -3
- package/dist/lib/build/unbuild.d.ts +4 -3
- package/dist/lib/build/unbuild.js +4 -6
- package/dist/lib/build/vite.cjs +6 -8
- package/dist/lib/build/vite.d.cts +3 -2
- package/dist/lib/build/vite.d.ts +3 -2
- package/dist/lib/build/vite.js +4 -6
- package/dist/lib/build/webpack.cjs +3 -5
- package/dist/lib/build/webpack.d.cts +3 -2
- package/dist/lib/build/webpack.d.ts +3 -2
- package/dist/lib/build/webpack.js +2 -4
- package/dist/lib/{chunk-RQICHHZM.cjs → chunk-2NZADVP5.cjs} +2 -4
- package/dist/lib/{chunk-UQJWVRRE.cjs → chunk-3OCI4TH7.cjs} +4 -6
- package/dist/lib/{chunk-MFC7UJHT.cjs → chunk-4NHFXDTQ.cjs} +3 -5
- package/dist/lib/{chunk-LBMMBFQE.js → chunk-4ZOJG7G7.js} +20 -10
- package/dist/lib/{chunk-V2T4H24I.js → chunk-54XNJQTH.js} +1 -3
- package/dist/lib/{chunk-JTUL3477.cjs → chunk-5EXW3ZRC.cjs} +3 -5
- package/dist/lib/{chunk-LEIOWD2W.js → chunk-633SP5HS.js} +2 -4
- package/dist/lib/{chunk-YVDJCVE5.cjs → chunk-67IBLMW6.cjs} +10 -12
- package/dist/lib/{chunk-3I2YOM2E.js → chunk-6BEYR6PG.js} +4 -7
- package/dist/lib/{chunk-GWYTWFZE.cjs → chunk-6G7CP6RO.cjs} +4 -6
- package/dist/lib/{chunk-MAHHHINV.js → chunk-6RLV3FIS.js} +2 -4
- package/dist/lib/{chunk-MVQSM5WM.cjs → chunk-7JTHFA7I.cjs} +23 -13
- package/dist/lib/{chunk-7EAV6Q7B.cjs → chunk-7K7JH3DF.cjs} +2 -4
- package/dist/lib/{chunk-VJN72T2O.js → chunk-7OHD3BD4.js} +1 -3
- package/dist/lib/{chunk-Q3KJZ3B5.js → chunk-7Y5MJRWF.js} +8 -10
- package/dist/lib/{chunk-Q2L3FNJO.js → chunk-ADKYAHF5.js} +2 -4
- package/dist/lib/{chunk-XZD7S5TU.cjs → chunk-AOKLB4V2.cjs} +2 -4
- package/dist/lib/{chunk-LJZEN4HP.cjs → chunk-BQU53ZNB.cjs} +7 -9
- package/dist/lib/{chunk-6IJTWIVJ.cjs → chunk-CGYAL3S2.cjs} +3 -5
- package/dist/lib/{chunk-ESYYL5UH.js → chunk-CXRSMYEX.js} +1 -3
- package/dist/lib/{chunk-7LLECRBP.cjs → chunk-DQ5JBYIN.cjs} +6 -8
- package/dist/lib/chunk-EJ25PQEL.cjs +2 -0
- package/dist/lib/{chunk-35EO5Y7R.js → chunk-ENRLU4UR.js} +1 -3
- package/dist/lib/{chunk-KSBESEOF.js → chunk-EQKS6CLU.js} +2 -4
- package/dist/lib/{chunk-V5OY4ALI.cjs → chunk-F7IDAYLH.cjs} +2 -4
- package/dist/lib/{chunk-5PNLONNN.cjs → chunk-FOC3UTXQ.cjs} +4 -6
- package/dist/lib/{chunk-7R23HVGQ.js → chunk-GANVMM73.js} +1 -3
- package/dist/lib/{chunk-KOCDKJDJ.js → chunk-GRJJZ5VJ.js} +1 -3
- package/dist/lib/chunk-H5JWMXTZ.js +1 -0
- package/dist/lib/{chunk-62ZJYXT3.cjs → chunk-H7A5QVLY.cjs} +5 -7
- package/dist/lib/chunk-HMO3LAYL.js +1 -0
- package/dist/lib/{chunk-RLMEYZ5I.cjs → chunk-IBPA3VN5.cjs} +15 -17
- package/dist/lib/{chunk-6BRTJXZ2.js → chunk-IPOD734M.js} +324 -221
- package/dist/lib/{chunk-LYD5OTBI.cjs → chunk-ISLUSDCG.cjs} +422 -319
- package/dist/lib/{chunk-632PWWU7.cjs → chunk-JA4HSQRN.cjs} +3 -5
- package/dist/lib/{chunk-IK3ABDPP.cjs → chunk-JG4IL7XL.cjs} +2 -4
- package/dist/lib/{chunk-OF5IJ4WG.js → chunk-JU4J5H6E.js} +2 -4
- package/dist/lib/{chunk-LTVWU4J2.js → chunk-KXCEN6Y4.js} +1 -3
- package/dist/lib/{chunk-W4OMKQ7W.cjs → chunk-LJ4WO7TW.cjs} +5 -7
- package/dist/lib/{chunk-BEKLDCTV.cjs → chunk-LPKZKRBW.cjs} +26 -14
- package/dist/lib/{chunk-PXSRMP4E.js → chunk-M263EZ4F.js} +1 -3
- package/dist/lib/{chunk-4XUVP2LL.cjs → chunk-MZJWK36Q.cjs} +2 -4
- package/dist/lib/{chunk-367E23MI.js → chunk-NDYKRNPQ.js} +1 -3
- package/dist/lib/{chunk-NE46WXNJ.js → chunk-NST5TNW6.js} +1 -3
- package/dist/lib/{chunk-ODJBZ6PS.js → chunk-NUDYDRYO.js} +3 -5
- package/dist/lib/{chunk-RXQWNSZX.js → chunk-NWAD7K4D.js} +1 -3
- package/dist/lib/{chunk-STAKGAWR.js → chunk-NZLZLQX2.js} +19 -7
- package/dist/lib/{chunk-GJNFAFKR.cjs → chunk-P3ZIYYSC.cjs} +6 -9
- package/dist/lib/{chunk-CAPN4FSS.js → chunk-Q3ERHHXJ.js} +3 -5
- package/dist/lib/chunk-RJ4277VZ.cjs +2 -0
- package/dist/lib/{chunk-7QVYU63E.js → chunk-SHUYVCID.js} +0 -2
- package/dist/lib/{chunk-YF3YHK4X.js → chunk-SYHVP3OW.js} +1 -3
- package/dist/lib/{chunk-NANLYIUO.cjs → chunk-T6KEXFRH.cjs} +8 -10
- package/dist/lib/{chunk-HQ6TGY34.js → chunk-TANQDHYY.js} +1 -3
- package/dist/lib/{chunk-BW3VFCTS.cjs → chunk-TNHDC2ZQ.cjs} +7 -9
- package/dist/lib/{chunk-ZP7PDTVE.cjs → chunk-UDJ37BEE.cjs} +17 -19
- package/dist/lib/{chunk-PK6SKIKE.cjs → chunk-USNT2KNT.cjs} +0 -2
- package/dist/lib/{chunk-U36VZLW6.cjs → chunk-VQ7CXQLT.cjs} +10 -12
- package/dist/lib/chunk-VVSEE3JE.cjs +2 -0
- package/dist/lib/{chunk-YBIWVB66.js → chunk-WFUO3YPK.js} +1 -3
- package/dist/lib/{chunk-MGEZC2RV.cjs → chunk-XW5TELHB.cjs} +6 -8
- package/dist/lib/{chunk-OO4BIM7N.js → chunk-YOENMDZY.js} +1 -3
- package/dist/lib/chunk-ZBLDAREE.js +1 -0
- package/dist/lib/{chunk-56LQSSQ3.js → chunk-ZPIKFR7Z.js} +4 -6
- package/dist/lib/{config-Ro14HmyO.d.cts → config-AKuoTngV.d.cts} +57 -13
- package/dist/lib/{config-DnifzkPt.d.ts → config-BxVBOnAV.d.ts} +57 -13
- package/dist/lib/config-file.cjs +4 -6
- package/dist/lib/config-file.d.cts +7 -5
- package/dist/lib/config-file.d.ts +7 -5
- package/dist/lib/config-file.js +2 -4
- package/dist/lib/create-program.cjs +3 -5
- package/dist/lib/create-program.d.cts +3 -2
- package/dist/lib/create-program.d.ts +3 -2
- package/dist/lib/create-program.js +2 -4
- package/dist/lib/entry.cjs +10 -12
- package/dist/lib/entry.d.cts +3 -2
- package/dist/lib/entry.d.ts +3 -2
- package/dist/lib/entry.js +2 -4
- package/dist/lib/{hooks-B6Ow5MtE.d.ts → hooks-BKZwFaZD.d.ts} +1 -1
- package/dist/lib/{hooks-CM-BbMzz.d.cts → hooks-D3P6aPKT.d.cts} +1 -1
- package/dist/lib/index.cjs +74 -129
- package/dist/lib/index.d.cts +13 -15
- package/dist/lib/index.d.ts +13 -15
- package/dist/lib/index.js +25 -28
- package/dist/lib/logger.cjs +4 -6
- package/dist/lib/logger.d.cts +4 -4
- package/dist/lib/logger.d.ts +4 -4
- package/dist/lib/logger.js +2 -4
- package/dist/lib/typescript/compiler-host.cjs +21 -23
- package/dist/lib/typescript/compiler-host.d.cts +4 -5
- package/dist/lib/typescript/compiler-host.d.ts +4 -5
- package/dist/lib/typescript/compiler-host.js +3 -5
- package/dist/lib/typescript/import-transformer.cjs +4 -6
- package/dist/lib/typescript/import-transformer.d.cts +3 -2
- package/dist/lib/typescript/import-transformer.d.ts +3 -2
- package/dist/lib/typescript/import-transformer.js +1 -3
- package/dist/lib/typescript/index.cjs +17 -19
- package/dist/lib/typescript/index.d.cts +5 -4
- package/dist/lib/typescript/index.d.ts +5 -4
- package/dist/lib/typescript/index.js +5 -7
- package/dist/lib/typescript/isolated-decl.cjs +3 -5
- package/dist/lib/typescript/isolated-decl.d.cts +1 -2
- package/dist/lib/typescript/isolated-decl.d.ts +1 -2
- package/dist/lib/typescript/isolated-decl.js +2 -4
- package/dist/lib/typescript/program.cjs +7 -9
- package/dist/lib/typescript/program.d.cts +4 -5
- package/dist/lib/typescript/program.d.ts +4 -5
- package/dist/lib/typescript/program.js +2 -4
- package/dist/lib/typescript/tsconfig.cjs +8 -10
- package/dist/lib/typescript/tsconfig.js +2 -4
- package/dist/lib/unplugin/factory.cjs +12 -15
- package/dist/lib/unplugin/factory.d.cts +10 -9
- package/dist/lib/unplugin/factory.d.ts +10 -9
- package/dist/lib/unplugin/factory.js +11 -14
- package/dist/lib/unplugin/index.cjs +16 -19
- package/dist/lib/unplugin/index.d.cts +6 -5
- package/dist/lib/unplugin/index.d.ts +6 -5
- package/dist/lib/unplugin/index.js +13 -16
- package/dist/lib/unplugin/plugin.cjs +6 -8
- package/dist/lib/unplugin/plugin.d.cts +4 -4
- package/dist/lib/unplugin/plugin.d.ts +4 -4
- package/dist/lib/unplugin/plugin.js +5 -7
- package/dist/lib/unplugin/resolve-id.cjs +3 -5
- package/dist/lib/unplugin/resolve-id.d.cts +4 -5
- package/dist/lib/unplugin/resolve-id.d.ts +4 -5
- package/dist/lib/unplugin/resolve-id.js +2 -4
- package/dist/lib/utilities/bundle.cjs +6 -8
- package/dist/lib/utilities/bundle.d.cts +3 -2
- package/dist/lib/utilities/bundle.d.ts +3 -2
- package/dist/lib/utilities/bundle.js +5 -7
- package/dist/lib/utilities/cache.cjs +5 -7
- package/dist/lib/utilities/cache.d.cts +32 -1
- package/dist/lib/utilities/cache.d.ts +32 -1
- package/dist/lib/utilities/cache.js +3 -5
- package/dist/lib/utilities/file-header.cjs +4 -6
- package/dist/lib/utilities/file-header.d.cts +4 -4
- package/dist/lib/utilities/file-header.d.ts +4 -4
- package/dist/lib/utilities/file-header.js +2 -4
- package/dist/lib/utilities/index.cjs +36 -91
- package/dist/lib/utilities/index.d.cts +6 -8
- package/dist/lib/utilities/index.d.ts +6 -8
- package/dist/lib/utilities/index.js +15 -18
- package/dist/lib/utilities/meta.cjs +9 -11
- package/dist/lib/utilities/meta.d.cts +4 -4
- package/dist/lib/utilities/meta.d.ts +4 -4
- package/dist/lib/utilities/meta.js +2 -4
- package/dist/lib/utilities/resolve-path.cjs +3 -5
- package/dist/lib/utilities/resolve-path.d.cts +3 -2
- package/dist/lib/utilities/resolve-path.d.ts +3 -2
- package/dist/lib/utilities/resolve-path.js +2 -4
- package/dist/lib/utilities/resolve.cjs +7 -9
- package/dist/lib/utilities/resolve.d.cts +3 -2
- package/dist/lib/utilities/resolve.d.ts +3 -2
- package/dist/lib/utilities/resolve.js +6 -8
- package/dist/lib/utilities/source-file.cjs +5 -7
- package/dist/lib/utilities/source-file.d.cts +31 -1
- package/dist/lib/utilities/source-file.d.ts +31 -1
- package/dist/lib/utilities/source-file.js +2 -4
- package/dist/lib/utilities/source-map.cjs +3 -5
- package/dist/lib/utilities/source-map.d.cts +33 -2
- package/dist/lib/utilities/source-map.d.ts +33 -2
- package/dist/lib/utilities/source-map.js +2 -4
- package/dist/lib/utilities/worker.cjs +5 -7
- package/dist/lib/utilities/worker.d.cts +4 -4
- package/dist/lib/utilities/worker.d.ts +4 -4
- package/dist/lib/utilities/worker.js +3 -5
- package/dist/lib/utilities/write-file.cjs +3 -5
- package/dist/lib/utilities/write-file.d.cts +3 -2
- package/dist/lib/utilities/write-file.d.ts +3 -2
- package/dist/lib/utilities/write-file.js +2 -4
- package/dist/next.cjs +11 -13
- package/dist/next.js +8 -10
- package/dist/nuxt.cjs +13 -15
- package/dist/nuxt.d.cts +2 -2
- package/dist/nuxt.d.ts +2 -2
- package/dist/nuxt.js +10 -12
- package/dist/{chunk-KMLFL4CW.js → plugin-utils/chunk-3G5FJKN2.js} +1 -3
- package/dist/plugin-utils/chunk-HHFA3IEZ.js +51 -0
- package/dist/{chunk-4AKYOJXA.cjs → plugin-utils/chunk-MIKPJJNG.cjs} +2 -4
- package/dist/{lib/chunk-RK2VVGL6.cjs → plugin-utils/chunk-MQOW6ENT.cjs} +15 -17
- package/dist/{lib/chunk-UGRFAVAJ.js → plugin-utils/chunk-PK6PYFWY.js} +2 -4
- package/dist/plugin-utils/chunk-SHUYVCID.js +4 -0
- package/dist/plugin-utils/chunk-USNT2KNT.cjs +6 -0
- package/dist/plugin-utils/chunk-YKIS7BLU.cjs +53 -0
- package/dist/plugin-utils/config-ClPkPCYC.d.cts +1309 -0
- package/dist/plugin-utils/config-ClPkPCYC.d.ts +1309 -0
- package/dist/plugin-utils/extend.cjs +11 -0
- package/dist/{extend-plugin.d.ts → plugin-utils/extend.d.cts} +6 -23
- package/dist/{extend-plugin.d.cts → plugin-utils/extend.d.ts} +6 -23
- package/dist/plugin-utils/extend.js +2 -0
- package/dist/plugin-utils/get-config-path.cjs +11 -0
- package/dist/plugin-utils/get-config-path.d.cts +32 -0
- package/dist/plugin-utils/get-config-path.d.ts +32 -0
- package/dist/plugin-utils/get-config-path.js +2 -0
- package/dist/{lib/utilities/plugin-helpers.cjs → plugin-utils/helpers.cjs} +15 -17
- package/dist/{lib/utilities/plugin-helpers.d.ts → plugin-utils/helpers.d.cts} +13 -14
- package/dist/{lib/utilities/plugin-helpers.d.cts → plugin-utils/helpers.d.ts} +13 -14
- package/dist/{lib/utilities/plugin-helpers.js → plugin-utils/helpers.js} +2 -4
- package/dist/plugin-utils/index.cjs +69 -0
- package/dist/plugin-utils/index.d.cts +24 -0
- package/dist/plugin-utils/index.d.ts +24 -0
- package/dist/plugin-utils/index.js +4 -0
- package/dist/{resolved-DtY60yLh.d.cts → resolved-CugLn_3B.d.cts} +52 -251
- package/dist/{resolved-wPXZS7aW.d.ts → resolved-DnI1mqEb.d.ts} +52 -251
- package/dist/rolldown.cjs +10 -12
- package/dist/rolldown.d.cts +6 -6
- package/dist/rolldown.d.ts +6 -6
- package/dist/rolldown.js +7 -9
- package/dist/rollup.cjs +10 -12
- package/dist/rollup.d.cts +6 -6
- package/dist/rollup.d.ts +6 -6
- package/dist/rollup.js +7 -9
- package/dist/rspack.cjs +10 -12
- package/dist/rspack.d.cts +6 -6
- package/dist/rspack.d.ts +6 -6
- package/dist/rspack.js +7 -9
- package/dist/tsup.cjs +12 -14
- package/dist/tsup.js +9 -11
- package/dist/types/babel.cjs +1 -3
- package/dist/types/babel.d.cts +4 -4
- package/dist/types/babel.d.ts +4 -4
- package/dist/types/babel.js +1 -3
- package/dist/types/build.cjs +1 -3
- package/dist/types/build.d.cts +4 -29
- package/dist/types/build.d.ts +4 -29
- package/dist/types/build.js +1 -3
- package/dist/types/commands.cjs +3 -5
- package/dist/types/commands.d.cts +3 -3
- package/dist/types/commands.d.ts +3 -3
- package/dist/types/commands.js +2 -4
- package/dist/types/config.cjs +1 -3
- package/dist/types/config.d.cts +3 -3
- package/dist/types/config.d.ts +3 -3
- package/dist/types/config.js +1 -3
- package/dist/types/context.cjs +3 -5
- package/dist/types/context.d.cts +3 -3
- package/dist/types/context.d.ts +3 -3
- package/dist/types/context.js +2 -4
- package/dist/types/hooks.cjs +1 -3
- package/dist/types/hooks.d.cts +4 -4
- package/dist/types/hooks.d.ts +4 -4
- package/dist/types/hooks.js +1 -3
- package/dist/types/index.cjs +23 -26
- package/dist/types/index.d.cts +8 -8
- package/dist/types/index.d.ts +8 -8
- package/dist/types/index.js +14 -17
- package/dist/types/internal.cjs +0 -2
- package/dist/types/internal.d.cts +6 -8
- package/dist/types/internal.d.ts +6 -8
- package/dist/types/internal.js +0 -2
- package/dist/types/plugin.cjs +3 -5
- package/dist/types/plugin.d.cts +3 -3
- package/dist/types/plugin.d.ts +3 -3
- package/dist/types/plugin.js +2 -4
- package/dist/types/resolved.cjs +1 -3
- package/dist/types/resolved.d.cts +4 -4
- package/dist/types/resolved.d.ts +4 -4
- package/dist/types/resolved.js +1 -3
- package/dist/types/tsconfig.cjs +1 -3
- package/dist/types/tsconfig.d.cts +1 -8
- package/dist/types/tsconfig.d.ts +1 -8
- package/dist/types/tsconfig.js +1 -3
- package/dist/types/typedoc.cjs +1 -3
- package/dist/types/typedoc.d.cts +1 -3
- package/dist/types/typedoc.d.ts +1 -3
- package/dist/types/typedoc.js +1 -3
- package/dist/types/unplugin.cjs +1 -3
- package/dist/types/unplugin.d.cts +5 -8
- package/dist/types/unplugin.d.ts +5 -8
- package/dist/types/unplugin.js +1 -3
- package/dist/types/vfs.cjs +8 -10
- package/dist/types/vfs.d.cts +1 -14
- package/dist/types/vfs.d.ts +1 -14
- package/dist/types/vfs.js +2 -4
- package/dist/unloader.cjs +10 -12
- package/dist/unloader.d.cts +6 -6
- package/dist/unloader.d.ts +6 -6
- package/dist/unloader.js +7 -9
- package/dist/unplugin.cjs +22 -24
- package/dist/unplugin.d.cts +6 -6
- package/dist/unplugin.d.ts +6 -6
- package/dist/unplugin.js +19 -21
- package/dist/vite.cjs +11 -13
- package/dist/vite.d.cts +6 -6
- package/dist/vite.d.ts +6 -6
- package/dist/vite.js +8 -10
- package/dist/webpack.cjs +10 -12
- package/dist/webpack.d.cts +6 -6
- package/dist/webpack.d.ts +6 -6
- package/dist/webpack.js +7 -9
- package/package.json +59 -54
- package/dist/chunk-2VIXD2XB.js +0 -3
- package/dist/chunk-4JCNAKOE.cjs +0 -4
- package/dist/chunk-6ZGIV2SU.cjs +0 -4
- package/dist/chunk-7BZQBW77.cjs +0 -4
- package/dist/chunk-7MTW3KR2.cjs +0 -12
- package/dist/chunk-7WMWRX2S.cjs +0 -12
- package/dist/chunk-AFJCY3R6.js +0 -3
- package/dist/chunk-AXIRZAL7.js +0 -3
- package/dist/chunk-DELRP3WY.js +0 -31
- package/dist/chunk-DFLNRC3B.cjs +0 -4
- package/dist/chunk-DS7OM4NX.cjs +0 -4
- package/dist/chunk-DURCSSLV.js +0 -3
- package/dist/chunk-GC3BRYAK.cjs +0 -13
- package/dist/chunk-GIE6OE3X.js +0 -3
- package/dist/chunk-GV3S7ZR3.cjs +0 -34
- package/dist/chunk-HJW7OH6E.js +0 -3
- package/dist/chunk-IHUNA3MO.cjs +0 -4
- package/dist/chunk-LC6FLEJS.cjs +0 -12
- package/dist/chunk-MXJWCZDP.cjs +0 -12
- package/dist/chunk-OC7CCD5M.cjs +0 -19
- package/dist/chunk-OYASPHNL.js +0 -3
- package/dist/chunk-Q7EJVZVI.cjs +0 -4
- package/dist/chunk-SNARILEC.cjs +0 -24
- package/dist/chunk-TLHFXGYV.js +0 -3
- package/dist/chunk-VNRXLY2T.js +0 -3
- package/dist/chunk-VQCQRLGM.cjs +0 -4
- package/dist/chunk-WD4363UW.cjs +0 -12
- package/dist/chunk-XBF43VLE.cjs +0 -4
- package/dist/chunk-XZO6ZJQP.cjs +0 -4
- package/dist/chunk-YZCTXGFH.js +0 -11
- package/dist/chunk-Z5H7LD6W.js +0 -3
- package/dist/define-config.cjs +0 -13
- package/dist/define-config.js +0 -4
- package/dist/extend-plugin.cjs +0 -13
- package/dist/extend-plugin.js +0 -4
- package/dist/internal/api.cjs +0 -16
- package/dist/internal/api.cjs.map +0 -1
- package/dist/internal/api.js +0 -7
- package/dist/internal/api.js.map +0 -1
- package/dist/lib/build/esbuild.cjs.map +0 -1
- package/dist/lib/build/esbuild.js.map +0 -1
- package/dist/lib/build/index.cjs.map +0 -1
- package/dist/lib/build/index.js.map +0 -1
- package/dist/lib/build/rolldown.cjs.map +0 -1
- package/dist/lib/build/rolldown.js.map +0 -1
- package/dist/lib/build/rollup.cjs.map +0 -1
- package/dist/lib/build/rollup.js.map +0 -1
- package/dist/lib/build/rspack.cjs.map +0 -1
- package/dist/lib/build/rspack.js.map +0 -1
- package/dist/lib/build/tsup.cjs.map +0 -1
- package/dist/lib/build/tsup.js.map +0 -1
- package/dist/lib/build/unbuild.cjs.map +0 -1
- package/dist/lib/build/unbuild.js.map +0 -1
- package/dist/lib/build/vite.cjs.map +0 -1
- package/dist/lib/build/vite.js.map +0 -1
- package/dist/lib/build/webpack.cjs.map +0 -1
- package/dist/lib/build/webpack.js.map +0 -1
- package/dist/lib/chunk-35EO5Y7R.js.map +0 -1
- package/dist/lib/chunk-367E23MI.js.map +0 -1
- package/dist/lib/chunk-3GMJQ5G3.cjs +0 -4
- package/dist/lib/chunk-3GMJQ5G3.cjs.map +0 -1
- package/dist/lib/chunk-3I2YOM2E.js.map +0 -1
- package/dist/lib/chunk-4BPHC6QQ.js +0 -3
- package/dist/lib/chunk-4BPHC6QQ.js.map +0 -1
- package/dist/lib/chunk-4XUVP2LL.cjs.map +0 -1
- package/dist/lib/chunk-56LQSSQ3.js.map +0 -1
- package/dist/lib/chunk-5PNLONNN.cjs.map +0 -1
- package/dist/lib/chunk-62ZJYXT3.cjs.map +0 -1
- package/dist/lib/chunk-632PWWU7.cjs.map +0 -1
- package/dist/lib/chunk-6BRTJXZ2.js.map +0 -1
- package/dist/lib/chunk-6IJTWIVJ.cjs.map +0 -1
- package/dist/lib/chunk-7EAV6Q7B.cjs.map +0 -1
- package/dist/lib/chunk-7LLECRBP.cjs.map +0 -1
- package/dist/lib/chunk-7QVYU63E.js.map +0 -1
- package/dist/lib/chunk-7R23HVGQ.js.map +0 -1
- package/dist/lib/chunk-BEKLDCTV.cjs.map +0 -1
- package/dist/lib/chunk-BW3VFCTS.cjs.map +0 -1
- package/dist/lib/chunk-CAPN4FSS.js.map +0 -1
- package/dist/lib/chunk-ESYYL5UH.js.map +0 -1
- package/dist/lib/chunk-GJNFAFKR.cjs.map +0 -1
- package/dist/lib/chunk-GWYTWFZE.cjs.map +0 -1
- package/dist/lib/chunk-HJWJNSSZ.js +0 -3
- package/dist/lib/chunk-HJWJNSSZ.js.map +0 -1
- package/dist/lib/chunk-HQ6TGY34.js.map +0 -1
- package/dist/lib/chunk-IK3ABDPP.cjs.map +0 -1
- package/dist/lib/chunk-JTUL3477.cjs.map +0 -1
- package/dist/lib/chunk-KOCDKJDJ.js.map +0 -1
- package/dist/lib/chunk-KSBESEOF.js.map +0 -1
- package/dist/lib/chunk-LBMMBFQE.js.map +0 -1
- package/dist/lib/chunk-LEIOWD2W.js.map +0 -1
- package/dist/lib/chunk-LJZEN4HP.cjs.map +0 -1
- package/dist/lib/chunk-LTVWU4J2.js.map +0 -1
- package/dist/lib/chunk-LYD5OTBI.cjs.map +0 -1
- package/dist/lib/chunk-MAHHHINV.js.map +0 -1
- package/dist/lib/chunk-MFC7UJHT.cjs.map +0 -1
- package/dist/lib/chunk-MGEZC2RV.cjs.map +0 -1
- package/dist/lib/chunk-MVQSM5WM.cjs.map +0 -1
- package/dist/lib/chunk-NANLYIUO.cjs.map +0 -1
- package/dist/lib/chunk-NE46WXNJ.js.map +0 -1
- package/dist/lib/chunk-ODJBZ6PS.js.map +0 -1
- package/dist/lib/chunk-OF5IJ4WG.js.map +0 -1
- package/dist/lib/chunk-OO4BIM7N.js.map +0 -1
- package/dist/lib/chunk-PEZXLKQD.cjs +0 -4
- package/dist/lib/chunk-PEZXLKQD.cjs.map +0 -1
- package/dist/lib/chunk-PK6SKIKE.cjs.map +0 -1
- package/dist/lib/chunk-PXSRMP4E.js.map +0 -1
- package/dist/lib/chunk-Q2L3FNJO.js.map +0 -1
- package/dist/lib/chunk-Q3KJZ3B5.js.map +0 -1
- package/dist/lib/chunk-RK2VVGL6.cjs.map +0 -1
- package/dist/lib/chunk-RLMEYZ5I.cjs.map +0 -1
- package/dist/lib/chunk-RQICHHZM.cjs.map +0 -1
- package/dist/lib/chunk-RXQWNSZX.js.map +0 -1
- package/dist/lib/chunk-STAKGAWR.js.map +0 -1
- package/dist/lib/chunk-U36VZLW6.cjs.map +0 -1
- package/dist/lib/chunk-UGRFAVAJ.js.map +0 -1
- package/dist/lib/chunk-UQJWVRRE.cjs.map +0 -1
- package/dist/lib/chunk-V2T4H24I.js.map +0 -1
- package/dist/lib/chunk-V5OY4ALI.cjs.map +0 -1
- package/dist/lib/chunk-VJN72T2O.js.map +0 -1
- package/dist/lib/chunk-W4OMKQ7W.cjs.map +0 -1
- package/dist/lib/chunk-XGH6JWRO.js +0 -3
- package/dist/lib/chunk-XGH6JWRO.js.map +0 -1
- package/dist/lib/chunk-XQMVE2NH.cjs +0 -4
- package/dist/lib/chunk-XQMVE2NH.cjs.map +0 -1
- package/dist/lib/chunk-XZD7S5TU.cjs.map +0 -1
- package/dist/lib/chunk-YBIWVB66.js.map +0 -1
- package/dist/lib/chunk-YF3YHK4X.js.map +0 -1
- package/dist/lib/chunk-YVDJCVE5.cjs.map +0 -1
- package/dist/lib/chunk-ZP7PDTVE.cjs.map +0 -1
- package/dist/lib/compiler-CuQLTmTB.d.cts +0 -32
- package/dist/lib/compiler-CuQLTmTB.d.ts +0 -32
- package/dist/lib/config-file.cjs.map +0 -1
- package/dist/lib/config-file.js.map +0 -1
- package/dist/lib/create-program.cjs.map +0 -1
- package/dist/lib/create-program.js.map +0 -1
- package/dist/lib/entry.cjs.map +0 -1
- package/dist/lib/entry.js.map +0 -1
- package/dist/lib/index.cjs.map +0 -1
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/logger.cjs.map +0 -1
- package/dist/lib/logger.js.map +0 -1
- package/dist/lib/typescript/compiler-host.cjs.map +0 -1
- package/dist/lib/typescript/compiler-host.js.map +0 -1
- package/dist/lib/typescript/import-transformer.cjs.map +0 -1
- package/dist/lib/typescript/import-transformer.js.map +0 -1
- package/dist/lib/typescript/index.cjs.map +0 -1
- package/dist/lib/typescript/index.js.map +0 -1
- package/dist/lib/typescript/isolated-decl.cjs.map +0 -1
- package/dist/lib/typescript/isolated-decl.js.map +0 -1
- package/dist/lib/typescript/program.cjs.map +0 -1
- package/dist/lib/typescript/program.js.map +0 -1
- package/dist/lib/typescript/tsconfig.cjs.map +0 -1
- package/dist/lib/typescript/tsconfig.js.map +0 -1
- package/dist/lib/unplugin/factory.cjs.map +0 -1
- package/dist/lib/unplugin/factory.js.map +0 -1
- package/dist/lib/unplugin/index.cjs.map +0 -1
- package/dist/lib/unplugin/index.js.map +0 -1
- package/dist/lib/unplugin/plugin.cjs.map +0 -1
- package/dist/lib/unplugin/plugin.js.map +0 -1
- package/dist/lib/unplugin/resolve-id.cjs.map +0 -1
- package/dist/lib/unplugin/resolve-id.js.map +0 -1
- package/dist/lib/utilities/bundle.cjs.map +0 -1
- package/dist/lib/utilities/bundle.js.map +0 -1
- package/dist/lib/utilities/cache.cjs.map +0 -1
- package/dist/lib/utilities/cache.js.map +0 -1
- package/dist/lib/utilities/file-header.cjs.map +0 -1
- package/dist/lib/utilities/file-header.js.map +0 -1
- package/dist/lib/utilities/index.cjs.map +0 -1
- package/dist/lib/utilities/index.js.map +0 -1
- package/dist/lib/utilities/meta.cjs.map +0 -1
- package/dist/lib/utilities/meta.js.map +0 -1
- package/dist/lib/utilities/plugin-helpers.cjs.map +0 -1
- package/dist/lib/utilities/plugin-helpers.js.map +0 -1
- package/dist/lib/utilities/resolve-path.cjs.map +0 -1
- package/dist/lib/utilities/resolve-path.js.map +0 -1
- package/dist/lib/utilities/resolve.cjs.map +0 -1
- package/dist/lib/utilities/resolve.js.map +0 -1
- package/dist/lib/utilities/source-file.cjs.map +0 -1
- package/dist/lib/utilities/source-file.js.map +0 -1
- package/dist/lib/utilities/source-map.cjs.map +0 -1
- package/dist/lib/utilities/source-map.js.map +0 -1
- package/dist/lib/utilities/worker.cjs.map +0 -1
- package/dist/lib/utilities/worker.js.map +0 -1
- package/dist/lib/utilities/write-file.cjs.map +0 -1
- package/dist/lib/utilities/write-file.js.map +0 -1
- package/dist/types/babel.cjs.map +0 -1
- package/dist/types/babel.js.map +0 -1
- package/dist/types/build.cjs.map +0 -1
- package/dist/types/build.js.map +0 -1
- package/dist/types/commands.cjs.map +0 -1
- package/dist/types/commands.js.map +0 -1
- package/dist/types/compiler.cjs +0 -6
- package/dist/types/compiler.cjs.map +0 -1
- package/dist/types/compiler.d.cts +0 -38
- package/dist/types/compiler.d.ts +0 -38
- package/dist/types/compiler.js +0 -3
- package/dist/types/compiler.js.map +0 -1
- package/dist/types/config.cjs.map +0 -1
- package/dist/types/config.js.map +0 -1
- package/dist/types/context.cjs.map +0 -1
- package/dist/types/context.js.map +0 -1
- package/dist/types/hooks.cjs.map +0 -1
- package/dist/types/hooks.js.map +0 -1
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/internal.cjs.map +0 -1
- package/dist/types/internal.js.map +0 -1
- package/dist/types/plugin.cjs.map +0 -1
- package/dist/types/plugin.js.map +0 -1
- package/dist/types/resolved.cjs.map +0 -1
- package/dist/types/resolved.js.map +0 -1
- package/dist/types/tsconfig.cjs.map +0 -1
- package/dist/types/tsconfig.js.map +0 -1
- package/dist/types/typedoc.cjs.map +0 -1
- package/dist/types/typedoc.js.map +0 -1
- package/dist/types/unplugin.cjs.map +0 -1
- package/dist/types/unplugin.js.map +0 -1
- package/dist/types/vfs.cjs.map +0 -1
- package/dist/types/vfs.js.map +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PLUGIN_NON_HOOK_FIELDS } from './chunk-
|
|
2
|
-
import { __VFS_CACHE__, __VFS_RESOLVER__, __VFS_VIRTUAL__, __VFS_UNIFIED__, __VFS_INIT__, __VFS_REVERT__ } from './chunk-
|
|
3
|
-
import { SUPPORTED_COMMANDS } from './chunk-
|
|
4
|
-
import { __name } from './chunk-
|
|
1
|
+
import { PLUGIN_NON_HOOK_FIELDS } from './chunk-JQCWV4DT.js';
|
|
2
|
+
import { __VFS_CACHE__, __VFS_RESOLVER__, __VFS_VIRTUAL__, __VFS_UNIFIED__, __VFS_INIT__, __VFS_REVERT__ } from './chunk-OBYFBPPO.js';
|
|
3
|
+
import { SUPPORTED_COMMANDS } from './chunk-WJ4CZKXY.js';
|
|
4
|
+
import { __name } from './chunk-SHUYVCID.js';
|
|
5
|
+
import { transformAsync } from '@babel/core';
|
|
5
6
|
import { formatLogMessage } from '@storm-software/config-tools/logger/console';
|
|
6
7
|
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
7
8
|
import { toArray } from '@stryke/convert/to-array';
|
|
@@ -11,8 +12,9 @@ import { createDirectory } from '@stryke/fs/helpers';
|
|
|
11
12
|
import { install } from '@stryke/fs/install';
|
|
12
13
|
import { listFiles, listFilesSync } from '@stryke/fs/list-files';
|
|
13
14
|
import { isPackageExists, isPackageListed, doesPackageMatch, getPackageListing } from '@stryke/fs/package-fns';
|
|
15
|
+
import { resolvePackage } from '@stryke/fs/resolve';
|
|
14
16
|
import { joinPaths } from '@stryke/path/join-paths';
|
|
15
|
-
import { replacePath } from '@stryke/path/replace';
|
|
17
|
+
import { replacePath, replaceExtension } from '@stryke/path/replace';
|
|
16
18
|
import { isError } from '@stryke/type-checks/is-error';
|
|
17
19
|
import { isFunction } from '@stryke/type-checks/is-function';
|
|
18
20
|
import { isNumber } from '@stryke/type-checks/is-number';
|
|
@@ -21,27 +23,21 @@ import { isSet } from '@stryke/type-checks/is-set';
|
|
|
21
23
|
import { isSetObject } from '@stryke/type-checks/is-set-object';
|
|
22
24
|
import { isSetString } from '@stryke/type-checks/is-set-string';
|
|
23
25
|
import chalk5 from 'chalk';
|
|
26
|
+
import defu4, { defu } from 'defu';
|
|
24
27
|
import Handlebars from 'handlebars';
|
|
25
|
-
import {
|
|
26
|
-
import
|
|
27
|
-
import defu5, { defu } from 'defu';
|
|
28
|
-
import ts2, { createProgram, createCompilerHost, getPreEmitDiagnostics, getLineAndCharacterOfPosition, flattenDiagnosticMessageText } from 'typescript';
|
|
29
|
-
import '@stryke/fs/remove-file';
|
|
30
|
-
import { hashDirectory } from '@stryke/hash/hash-files';
|
|
31
|
-
import { getUnique, getUniqueBy } from '@stryke/helpers/get-unique';
|
|
32
|
-
import { findFilePath, findFileDotExtensionSafe, hasFileExtension, findFileExtensionSafe, relativePath, findFileName } from '@stryke/path/file-path-fns';
|
|
33
|
-
import { kebabCase } from '@stryke/string-format/kebab-case';
|
|
34
|
-
import { isUndefined } from '@stryke/type-checks/is-undefined';
|
|
35
|
-
import { writeFile as writeFile$1 } from '@stryke/fs/write-file';
|
|
36
|
-
import { resolveConfig, format } from 'prettier';
|
|
37
|
-
import { resolvePackage } from '@stryke/fs/resolve';
|
|
28
|
+
import { declare } from '@babel/helper-plugin-utils';
|
|
29
|
+
import * as t from '@babel/types';
|
|
38
30
|
import { getWorkspaceConfig } from '@storm-software/config-tools/get-config';
|
|
39
31
|
import { loadConfig } from 'c12';
|
|
40
32
|
import { titleCase } from '@stryke/string-format/title-case';
|
|
41
33
|
import { getEnvPaths } from '@stryke/env/get-env-paths';
|
|
42
34
|
import { relativeToWorkspaceRoot } from '@stryke/fs/get-workspace-root';
|
|
35
|
+
import { readJsonFile, readJsonFileSync } from '@stryke/fs/json';
|
|
43
36
|
import { murmurhash } from '@stryke/hash/murmurhash';
|
|
37
|
+
import { getUnique, getUniqueBy } from '@stryke/helpers/get-unique';
|
|
44
38
|
import { omit } from '@stryke/helpers/omit';
|
|
39
|
+
import { appendPath } from '@stryke/path/append';
|
|
40
|
+
import { findFilePath, findFileDotExtensionSafe, hasFileExtension, relativePath, findFileName } from '@stryke/path/file-path-fns';
|
|
45
41
|
import { isAbsolutePath, isAbsolute } from '@stryke/path/is-type';
|
|
46
42
|
import { joinPaths as joinPaths$1 } from '@stryke/path/join';
|
|
47
43
|
import { isNull } from '@stryke/type-checks/is-null';
|
|
@@ -49,9 +45,14 @@ import { isString } from '@stryke/type-checks/is-string';
|
|
|
49
45
|
import { uuid } from '@stryke/unique-id/uuid';
|
|
50
46
|
import { parseAsync } from 'oxc-parser';
|
|
51
47
|
import { parseTypeDefinition } from '@stryke/convert/parse-type-definition';
|
|
48
|
+
import { isFile } from '@stryke/fs/is-file';
|
|
52
49
|
import { getLogFn, getLogLevel } from '@storm-software/config-tools/logger';
|
|
53
50
|
import { getColor } from '@storm-software/config-tools/utilities/colors';
|
|
54
51
|
import { noop } from '@stryke/helpers/noop';
|
|
52
|
+
import '@stryke/fs/remove-file';
|
|
53
|
+
import { hashDirectory } from '@stryke/hash/hash-files';
|
|
54
|
+
import { kebabCase } from '@stryke/string-format/kebab-case';
|
|
55
|
+
import { isUndefined } from '@stryke/type-checks/is-undefined';
|
|
55
56
|
import { createJiti } from 'jiti';
|
|
56
57
|
import { bufferToString } from '@stryke/convert/buffer-to-string';
|
|
57
58
|
import { isParentPath } from '@stryke/path/is-parent-path';
|
|
@@ -60,206 +61,119 @@ import { isBuffer } from '@stryke/type-checks/is-buffer';
|
|
|
60
61
|
import { Volume } from 'memfs';
|
|
61
62
|
import { Blob } from 'node:buffer';
|
|
62
63
|
import fs from 'node:fs';
|
|
64
|
+
import { resolveConfig, format } from 'prettier';
|
|
63
65
|
import { Union } from 'unionfs';
|
|
64
66
|
import { isObject } from '@stryke/type-checks/is-object';
|
|
65
|
-
import {
|
|
66
|
-
import { readFileIfExistingSync } from '@stryke/fs/read-file';
|
|
67
|
-
import MagicString from 'magic-string';
|
|
68
|
-
import { declare } from '@babel/helper-plugin-utils';
|
|
69
|
-
import * as t from '@babel/types';
|
|
67
|
+
import ts2, { createProgram, createCompilerHost, getPreEmitDiagnostics, getLineAndCharacterOfPosition, flattenDiagnosticMessageText } from 'typescript';
|
|
70
68
|
import { getPackageName, hasPackageVersion, getPackageVersion } from '@stryke/string-format/package';
|
|
71
69
|
import { getObjectDiff } from '@donedeal0/superdiff';
|
|
72
70
|
import { loadTsConfig } from '@stryke/fs/tsconfig';
|
|
73
71
|
import { StormJSON } from '@stryke/json/storm-json';
|
|
72
|
+
import { writeFile as writeFile$1 } from '@stryke/fs/write-file';
|
|
74
73
|
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
tsconfigFilePath = appendPath(tsconfig, projectRoot);
|
|
79
|
-
if (!existsSync(tsconfigFilePath)) {
|
|
80
|
-
tsconfigFilePath = appendPath(tsconfig, workspaceRoot);
|
|
81
|
-
if (!existsSync(tsconfigFilePath)) {
|
|
82
|
-
tsconfigFilePath = appendPath(tsconfig, joinPaths(workspaceRoot, projectRoot));
|
|
83
|
-
if (!existsSync(tsconfigFilePath)) {
|
|
84
|
-
throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${tsconfig}, ${appendPath(tsconfig, projectRoot)}, ${appendPath(tsconfig, workspaceRoot)}, or ${tsconfigFilePath}`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return tsconfigFilePath;
|
|
90
|
-
}
|
|
91
|
-
__name(getTsconfigFilePath, "getTsconfigFilePath");
|
|
92
|
-
function findMatch(tsconfigType, types, extensions = [
|
|
93
|
-
".ts",
|
|
94
|
-
".tsx",
|
|
95
|
-
".d.ts"
|
|
96
|
-
]) {
|
|
97
|
-
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}`));
|
|
98
|
-
}
|
|
99
|
-
__name(findMatch, "findMatch");
|
|
100
|
-
function findIncludeMatch(tsconfigType, types) {
|
|
101
|
-
return findMatch(tsconfigType, types, [
|
|
102
|
-
".ts",
|
|
103
|
-
".tsx",
|
|
104
|
-
".d.ts",
|
|
105
|
-
".js",
|
|
106
|
-
".jsx",
|
|
107
|
-
".mjs",
|
|
108
|
-
".cjs",
|
|
109
|
-
".mts",
|
|
110
|
-
".cts",
|
|
111
|
-
"/*.ts",
|
|
112
|
-
"/*.tsx",
|
|
113
|
-
"/*.d.ts",
|
|
114
|
-
"/*.js",
|
|
115
|
-
"/*.jsx",
|
|
116
|
-
"/*.mjs",
|
|
117
|
-
"/*.cjs",
|
|
118
|
-
"/*.mts",
|
|
119
|
-
"/*.cts",
|
|
120
|
-
"/**/*.ts",
|
|
121
|
-
"/**/*.tsx",
|
|
122
|
-
"/**/*.d.ts",
|
|
123
|
-
"/**/*.js",
|
|
124
|
-
"/**/*.jsx",
|
|
125
|
-
"/**/*.mjs",
|
|
126
|
-
"/**/*.cjs",
|
|
127
|
-
"/**/*.mts",
|
|
128
|
-
"/**/*.cts"
|
|
129
|
-
]);
|
|
130
|
-
}
|
|
131
|
-
__name(findIncludeMatch, "findIncludeMatch");
|
|
132
|
-
function isIncludeMatchFound(tsconfigType, types) {
|
|
133
|
-
return findIncludeMatch(tsconfigType, types) !== void 0;
|
|
134
|
-
}
|
|
135
|
-
__name(isIncludeMatchFound, "isIncludeMatchFound");
|
|
136
|
-
function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfigRaw = {}, originalTsconfigJson, host = ts2.sys) {
|
|
137
|
-
const tsconfigFilePath = getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
|
|
138
|
-
const tsconfigJson = readJsonFileSync(tsconfigFilePath);
|
|
139
|
-
if (!tsconfigJson) {
|
|
140
|
-
throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${joinPaths(projectRoot, tsconfig ?? "tsconfig.json")}`);
|
|
74
|
+
function resolveModulePath(nodePath, state) {
|
|
75
|
+
if (!t.isStringLiteral(nodePath.node)) {
|
|
76
|
+
return;
|
|
141
77
|
}
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
78
|
+
const sourcePath = nodePath.node.value;
|
|
79
|
+
const resolvedPath = state.context?.fs.resolve(sourcePath);
|
|
80
|
+
if (resolvedPath) {
|
|
81
|
+
nodePath.replaceWith(t.stringLiteral(
|
|
82
|
+
// Remove the file extension if it exists
|
|
83
|
+
resolvedPath.replace(/\.(?:ts|mts|cts)x?$/, "")
|
|
84
|
+
));
|
|
148
85
|
}
|
|
149
|
-
return {
|
|
150
|
-
...parsedCommandLine,
|
|
151
|
-
originalTsconfigJson: originalTsconfigJson ?? tsconfigJson,
|
|
152
|
-
tsconfigJson,
|
|
153
|
-
tsconfigFilePath
|
|
154
|
-
};
|
|
155
86
|
}
|
|
156
|
-
__name(
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const metaFilePath = joinPaths(context.dataPath, "meta.json");
|
|
180
|
-
context.log(LogLevelLabel.DEBUG, `Writing runtime metadata to ${metaFilePath}`);
|
|
181
|
-
await context.fs.writeFile(metaFilePath, JSON.stringify({
|
|
182
|
-
...context.meta,
|
|
183
|
-
virtualFiles: context.fs[__VFS_VIRTUAL__].toJSON(context.artifactsPath),
|
|
184
|
-
virtualFilesMeta: context.fs.getPartialMeta()
|
|
185
|
-
}, null, 2), {
|
|
186
|
-
mode: "fs"
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
__name(writeMetaFile, "writeMetaFile");
|
|
190
|
-
function isPlugin(value) {
|
|
191
|
-
return isSetObject(value) && "name" in value && isSetString(value.name) && (isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction(value.applyToEnvironment)) && (isUndefined(value.dedupe) || "dedupe" in value && isFunction(value.dedupe)) && (isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) && SUPPORTED_COMMANDS.every((command) => isUndefined(value[command]) || command in value && (isFunction(value[command]) || isSetObject(value[command]) && "handler" in value[command] && isFunction(value[command].handler)));
|
|
192
|
-
}
|
|
193
|
-
__name(isPlugin, "isPlugin");
|
|
194
|
-
function isPluginConfigObject(value) {
|
|
195
|
-
return isSetObject(value) && "plugin" in value && ((isSetString(value.plugin) || isFunction(value.plugin)) && "options" in value && isSetObject(value.options) || isPlugin(value.plugin));
|
|
196
|
-
}
|
|
197
|
-
__name(isPluginConfigObject, "isPluginConfigObject");
|
|
198
|
-
function isPluginConfigTuple(value) {
|
|
199
|
-
return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString(value[0]) || isFunction(value[0])) && value.length > 1 && isSetObject(value[1]) || isPlugin(value[0]));
|
|
200
|
-
}
|
|
201
|
-
__name(isPluginConfigTuple, "isPluginConfigTuple");
|
|
202
|
-
function isPluginConfig(value) {
|
|
203
|
-
return isSetString(value) || isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
|
|
204
|
-
}
|
|
205
|
-
__name(isPluginConfig, "isPluginConfig");
|
|
206
|
-
function isPluginHookFunction(value) {
|
|
207
|
-
return isFunction(value) || isSetObject(value) && "handler" in value && isFunction(value.handler);
|
|
208
|
-
}
|
|
209
|
-
__name(isPluginHookFunction, "isPluginHookFunction");
|
|
210
|
-
function isPluginHookObject(value) {
|
|
211
|
-
return isSetObject(value) && "handler" in value && isFunction(value.handler);
|
|
212
|
-
}
|
|
213
|
-
__name(isPluginHookObject, "isPluginHookObject");
|
|
214
|
-
function isPluginHook(value) {
|
|
215
|
-
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
216
|
-
}
|
|
217
|
-
__name(isPluginHook, "isPluginHook");
|
|
218
|
-
function getHookHandler(pluginHook) {
|
|
219
|
-
return isFunction(pluginHook) ? pluginHook : pluginHook.handler;
|
|
220
|
-
}
|
|
221
|
-
__name(getHookHandler, "getHookHandler");
|
|
222
|
-
function isHookExternal(hook) {
|
|
223
|
-
return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
|
|
224
|
-
}
|
|
225
|
-
__name(isHookExternal, "isHookExternal");
|
|
226
|
-
function checkDedupe(plugin, plugins) {
|
|
227
|
-
return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
228
|
-
}
|
|
229
|
-
__name(checkDedupe, "checkDedupe");
|
|
230
|
-
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
231
|
-
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
|
|
232
|
-
hooksList.push(isFunction(pluginHook) ? {
|
|
233
|
-
plugin,
|
|
234
|
-
handler: getHookHandler(pluginHook).bind(context)
|
|
235
|
-
} : {
|
|
236
|
-
plugin,
|
|
237
|
-
...pluginHook,
|
|
238
|
-
handler: getHookHandler(pluginHook).bind(context)
|
|
239
|
-
});
|
|
87
|
+
__name(resolveModulePath, "resolveModulePath");
|
|
88
|
+
var TRANSFORM_FUNCTIONS = [
|
|
89
|
+
"require",
|
|
90
|
+
"require.resolve",
|
|
91
|
+
"System.import",
|
|
92
|
+
// Jest methods
|
|
93
|
+
"jest.genMockFromModule",
|
|
94
|
+
"jest.mock",
|
|
95
|
+
"jest.unmock",
|
|
96
|
+
"jest.doMock",
|
|
97
|
+
// eslint-disable-next-line @cspell/spellchecker
|
|
98
|
+
"jest.dontMock",
|
|
99
|
+
"jest.setMock",
|
|
100
|
+
"jest.requireActual",
|
|
101
|
+
"jest.requireMock",
|
|
102
|
+
// Older Jest methods
|
|
103
|
+
"require.requireActual",
|
|
104
|
+
"require.requireMock"
|
|
105
|
+
];
|
|
106
|
+
function matchesPattern(state, calleePath, pattern) {
|
|
107
|
+
const { node } = calleePath;
|
|
108
|
+
if (t.isMemberExpression(node)) {
|
|
109
|
+
return calleePath.matchesPattern(pattern);
|
|
240
110
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
async function writeFile(log, filepath, content, skipFormat = false) {
|
|
244
|
-
try {
|
|
245
|
-
if (skipFormat) {
|
|
246
|
-
await writeFile$1(filepath, content);
|
|
247
|
-
} else {
|
|
248
|
-
const config = await resolveConfig(filepath);
|
|
249
|
-
const formatted = await format(content, {
|
|
250
|
-
...config ?? {},
|
|
251
|
-
filepath
|
|
252
|
-
});
|
|
253
|
-
await writeFile$1(filepath, formatted || "");
|
|
254
|
-
}
|
|
255
|
-
} catch (error) {
|
|
256
|
-
log(LogLevelLabel.ERROR, `Failed to write file ${filepath} to disk
|
|
257
|
-
${error?.message ? error.message : ""}`);
|
|
111
|
+
if (!t.isIdentifier(node) || pattern.includes(".")) {
|
|
112
|
+
return false;
|
|
258
113
|
}
|
|
114
|
+
const name = pattern.split(".")[0];
|
|
115
|
+
return node.name === name;
|
|
259
116
|
}
|
|
260
|
-
__name(
|
|
117
|
+
__name(matchesPattern, "matchesPattern");
|
|
118
|
+
var importVisitors = {
|
|
119
|
+
CallExpression: /* @__PURE__ */ __name((nodePath, state) => {
|
|
120
|
+
if (state.moduleResolverVisited.has(nodePath)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const calleePath = nodePath.get("callee");
|
|
124
|
+
if (calleePath && TRANSFORM_FUNCTIONS.some((pattern) => matchesPattern(state, calleePath, pattern)) || t.isImport(nodePath.node.callee)) {
|
|
125
|
+
state.moduleResolverVisited.add(nodePath);
|
|
126
|
+
resolveModulePath(nodePath.get("arguments.0"), state);
|
|
127
|
+
}
|
|
128
|
+
}, "CallExpression"),
|
|
129
|
+
// eslint-disable-next-line ts/naming-convention
|
|
130
|
+
"ImportDeclaration|ExportDeclaration|ExportAllDeclaration": /* @__PURE__ */ __name((nodePath, state) => {
|
|
131
|
+
if (!nodePath || !nodePath.get("source") || state.moduleResolverVisited.has(nodePath)) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
state.moduleResolverVisited.add(nodePath);
|
|
135
|
+
resolveModulePath(nodePath.get("source"), state);
|
|
136
|
+
}, "ImportDeclaration|ExportDeclaration|ExportAllDeclaration")
|
|
137
|
+
};
|
|
138
|
+
var moduleResolverBabelPlugin = /* @__PURE__ */ __name((context) => {
|
|
139
|
+
return declare(/* @__PURE__ */ __name(function builder(api) {
|
|
140
|
+
let moduleResolverVisited = /* @__PURE__ */ new Set();
|
|
141
|
+
return {
|
|
142
|
+
name: "powerlines:module-resolver",
|
|
143
|
+
manipulateOptions(opts) {
|
|
144
|
+
opts.filename ??= "unknown";
|
|
145
|
+
},
|
|
146
|
+
pre() {
|
|
147
|
+
moduleResolverVisited = /* @__PURE__ */ new Set();
|
|
148
|
+
},
|
|
149
|
+
visitor: {
|
|
150
|
+
Program: {
|
|
151
|
+
enter(programPath, state) {
|
|
152
|
+
programPath.traverse(importVisitors, {
|
|
153
|
+
...state,
|
|
154
|
+
context,
|
|
155
|
+
moduleResolverVisited,
|
|
156
|
+
api
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
exit(programPath, state) {
|
|
160
|
+
programPath.traverse(importVisitors, {
|
|
161
|
+
...state,
|
|
162
|
+
context,
|
|
163
|
+
moduleResolverVisited,
|
|
164
|
+
api
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
post() {
|
|
170
|
+
moduleResolverVisited.clear();
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}, "builder"));
|
|
174
|
+
}, "moduleResolverBabelPlugin");
|
|
261
175
|
async function loadWorkspaceConfig(workspaceRoot, cwd) {
|
|
262
|
-
return
|
|
176
|
+
return defu4({
|
|
263
177
|
workspaceRoot
|
|
264
178
|
}, await getWorkspaceConfig(true, {
|
|
265
179
|
cwd,
|
|
@@ -268,9 +182,9 @@ async function loadWorkspaceConfig(workspaceRoot, cwd) {
|
|
|
268
182
|
}));
|
|
269
183
|
}
|
|
270
184
|
__name(loadWorkspaceConfig, "loadWorkspaceConfig");
|
|
271
|
-
async function loadUserConfigFile(projectRoot, jiti, command, mode, configFile) {
|
|
185
|
+
async function loadUserConfigFile(projectRoot, jiti, command, mode, configFile, framework = "powerlines") {
|
|
272
186
|
let resolvedUserConfig = {};
|
|
273
|
-
const resolvedUserConfigFile = configFile && existsSync(configFile) ? configFile : configFile && existsSync(joinPaths(projectRoot, configFile)) ? joinPaths(projectRoot, configFile) : existsSync(joinPaths(projectRoot,
|
|
187
|
+
const resolvedUserConfigFile = configFile && existsSync(configFile) ? configFile : configFile && existsSync(joinPaths(projectRoot, configFile)) ? joinPaths(projectRoot, configFile) : existsSync(joinPaths(projectRoot, `${framework}.config.ts`)) ? joinPaths(projectRoot, `${framework}.config.ts`) : existsSync(joinPaths(projectRoot, `${framework}.config.js`)) ? joinPaths(projectRoot, `${framework}.config.js`) : existsSync(joinPaths(projectRoot, `${framework}.config.mts`)) ? joinPaths(projectRoot, `${framework}.config.mts`) : existsSync(joinPaths(projectRoot, `${framework}.config.mjs`)) ? joinPaths(projectRoot, `${framework}.config.mjs`) : void 0;
|
|
274
188
|
if (resolvedUserConfigFile) {
|
|
275
189
|
const resolved = await jiti.import(jiti.esmResolve(resolvedUserConfigFile));
|
|
276
190
|
if (resolved) {
|
|
@@ -294,14 +208,14 @@ async function loadUserConfigFile(projectRoot, jiti, command, mode, configFile)
|
|
|
294
208
|
}
|
|
295
209
|
const result = await loadConfig({
|
|
296
210
|
cwd: projectRoot,
|
|
297
|
-
name:
|
|
211
|
+
name: framework,
|
|
298
212
|
envName: mode,
|
|
299
213
|
globalRc: true,
|
|
300
214
|
packageJson: true,
|
|
301
215
|
dotenv: true,
|
|
302
216
|
jiti
|
|
303
217
|
});
|
|
304
|
-
return
|
|
218
|
+
return defu4(resolvedUserConfig, isSetObject(result?.config) ? {
|
|
305
219
|
...result.config,
|
|
306
220
|
...result
|
|
307
221
|
} : {});
|
|
@@ -309,7 +223,7 @@ async function loadUserConfigFile(projectRoot, jiti, command, mode, configFile)
|
|
|
309
223
|
__name(loadUserConfigFile, "loadUserConfigFile");
|
|
310
224
|
var DEFAULT_ENVIRONMENT = "default";
|
|
311
225
|
function createEnvironment(name, userConfig) {
|
|
312
|
-
return
|
|
226
|
+
return defu4(userConfig.environments?.[name] ?? {}, {
|
|
313
227
|
name,
|
|
314
228
|
title: userConfig.title || titleCase(userConfig.name),
|
|
315
229
|
ssr: false,
|
|
@@ -364,7 +278,7 @@ function resolveEntryInput(context, typeDefinition) {
|
|
|
364
278
|
}
|
|
365
279
|
__name(resolveEntryInput, "resolveEntryInput");
|
|
366
280
|
function resolveEntryOutput(context, typeDefinition) {
|
|
367
|
-
return joinPaths(replacePath(replacePath(replacePath(replacePath(typeDefinition.file, joinPaths(context.workspaceConfig.workspaceRoot, context.config.sourceRoot)), joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)), context.config.sourceRoot), context.config.projectRoot))
|
|
281
|
+
return replaceExtension(joinPaths(replacePath(replacePath(replacePath(replacePath(typeDefinition.file, joinPaths(context.workspaceConfig.workspaceRoot, context.config.sourceRoot)), joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)), context.config.sourceRoot), context.config.projectRoot)));
|
|
368
282
|
}
|
|
369
283
|
__name(resolveEntryOutput, "resolveEntryOutput");
|
|
370
284
|
function resolveEntry(context, typeDefinition) {
|
|
@@ -379,7 +293,14 @@ __name(resolveEntry, "resolveEntry");
|
|
|
379
293
|
function resolveEntriesSync(context, typeDefinitions) {
|
|
380
294
|
return typeDefinitions.map((typeDefinition) => {
|
|
381
295
|
const parsed = parseTypeDefinition(typeDefinition);
|
|
382
|
-
|
|
296
|
+
const filePath = appendPath(parsed.file, context.config.projectRoot);
|
|
297
|
+
if (isFile(filePath)) {
|
|
298
|
+
return resolveEntry(context, {
|
|
299
|
+
file: replacePath(filePath, context.config.projectRoot),
|
|
300
|
+
name: parsed.name
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
return listFilesSync(filePath).map((file) => resolveEntry(context, {
|
|
383
304
|
file,
|
|
384
305
|
name: parsed.name
|
|
385
306
|
}));
|
|
@@ -430,8 +351,94 @@ var BADGE_COLORS = [
|
|
|
430
351
|
var extendLog = /* @__PURE__ */ __name((logFn, name) => {
|
|
431
352
|
return (type, ...args) => logFn(type, ` ${chalk5.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase(name)} `)} ${args.join(" ")} `);
|
|
432
353
|
}, "extendLog");
|
|
354
|
+
var PROJECT_ROOT_HASH_LENGTH = 45;
|
|
355
|
+
var CACHE_HASH_LENGTH = 62;
|
|
356
|
+
function getPrefixedProjectRootHash(name, projectRootHash) {
|
|
357
|
+
const combined = `${kebabCase(name)}_${projectRootHash}`;
|
|
358
|
+
return combined.length > PROJECT_ROOT_HASH_LENGTH ? combined.slice(0, PROJECT_ROOT_HASH_LENGTH) : combined;
|
|
359
|
+
}
|
|
360
|
+
__name(getPrefixedProjectRootHash, "getPrefixedProjectRootHash");
|
|
361
|
+
async function getChecksum(path) {
|
|
362
|
+
return hashDirectory(path, {
|
|
363
|
+
ignore: [
|
|
364
|
+
"node_modules",
|
|
365
|
+
".git",
|
|
366
|
+
".nx",
|
|
367
|
+
".cache",
|
|
368
|
+
".storm",
|
|
369
|
+
"tmp",
|
|
370
|
+
"dist"
|
|
371
|
+
]
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
__name(getChecksum, "getChecksum");
|
|
375
|
+
async function writeMetaFile(context) {
|
|
376
|
+
const metaFilePath = joinPaths(context.dataPath, "meta.json");
|
|
377
|
+
context.log(LogLevelLabel.DEBUG, `Writing runtime metadata to ${metaFilePath}`);
|
|
378
|
+
await context.fs.writeFile(metaFilePath, JSON.stringify({
|
|
379
|
+
...context.meta,
|
|
380
|
+
virtualFiles: context.fs[__VFS_VIRTUAL__].toJSON(context.artifactsPath),
|
|
381
|
+
virtualFilesMeta: context.fs.getPartialMeta()
|
|
382
|
+
}, null, 2), {
|
|
383
|
+
mode: "fs"
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
__name(writeMetaFile, "writeMetaFile");
|
|
387
|
+
function isPlugin(value) {
|
|
388
|
+
return isSetObject(value) && "name" in value && isSetString(value.name) && (isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction(value.applyToEnvironment)) && (isUndefined(value.dedupe) || "dedupe" in value && isFunction(value.dedupe)) && (isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) && SUPPORTED_COMMANDS.every((command) => isUndefined(value[command]) || command in value && (isFunction(value[command]) || isSetObject(value[command]) && "handler" in value[command] && isFunction(value[command].handler)));
|
|
389
|
+
}
|
|
390
|
+
__name(isPlugin, "isPlugin");
|
|
391
|
+
function isPluginConfigObject(value) {
|
|
392
|
+
return isSetObject(value) && "plugin" in value && ((isSetString(value.plugin) || isFunction(value.plugin)) && "options" in value && isSetObject(value.options) || isPlugin(value.plugin));
|
|
393
|
+
}
|
|
394
|
+
__name(isPluginConfigObject, "isPluginConfigObject");
|
|
395
|
+
function isPluginConfigTuple(value) {
|
|
396
|
+
return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString(value[0]) || isFunction(value[0])) && value.length > 1 && isSetObject(value[1]) || isPlugin(value[0]));
|
|
397
|
+
}
|
|
398
|
+
__name(isPluginConfigTuple, "isPluginConfigTuple");
|
|
399
|
+
function isPluginConfig(value) {
|
|
400
|
+
return isSetString(value) || isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
|
|
401
|
+
}
|
|
402
|
+
__name(isPluginConfig, "isPluginConfig");
|
|
403
|
+
function isPluginHookFunction(value) {
|
|
404
|
+
return isFunction(value) || isSetObject(value) && "handler" in value && isFunction(value.handler);
|
|
405
|
+
}
|
|
406
|
+
__name(isPluginHookFunction, "isPluginHookFunction");
|
|
407
|
+
function isPluginHookObject(value) {
|
|
408
|
+
return isSetObject(value) && "handler" in value && isFunction(value.handler);
|
|
409
|
+
}
|
|
410
|
+
__name(isPluginHookObject, "isPluginHookObject");
|
|
411
|
+
function isPluginHook(value) {
|
|
412
|
+
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
413
|
+
}
|
|
414
|
+
__name(isPluginHook, "isPluginHook");
|
|
415
|
+
function getHookHandler(pluginHook) {
|
|
416
|
+
return isFunction(pluginHook) ? pluginHook : pluginHook.handler;
|
|
417
|
+
}
|
|
418
|
+
__name(getHookHandler, "getHookHandler");
|
|
419
|
+
function isHookExternal(hook) {
|
|
420
|
+
return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
|
|
421
|
+
}
|
|
422
|
+
__name(isHookExternal, "isHookExternal");
|
|
423
|
+
function checkDedupe(plugin, plugins) {
|
|
424
|
+
return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
425
|
+
}
|
|
426
|
+
__name(checkDedupe, "checkDedupe");
|
|
427
|
+
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
428
|
+
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
|
|
429
|
+
hooksList.push(isFunction(pluginHook) ? {
|
|
430
|
+
plugin,
|
|
431
|
+
handler: getHookHandler(pluginHook).bind(context)
|
|
432
|
+
} : {
|
|
433
|
+
plugin,
|
|
434
|
+
...pluginHook,
|
|
435
|
+
handler: getHookHandler(pluginHook).bind(context)
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
__name(addPluginHook, "addPluginHook");
|
|
433
440
|
function resolveOptions(options) {
|
|
434
|
-
return
|
|
441
|
+
return defu4(options, {
|
|
435
442
|
interopDefault: true,
|
|
436
443
|
fsCache: options.mode !== "development" ? joinPaths(options.cacheDir, "jiti") : false,
|
|
437
444
|
moduleCache: options.mode !== "development"
|
|
@@ -919,7 +926,7 @@ var VirtualFileSystem = class {
|
|
|
919
926
|
return;
|
|
920
927
|
}
|
|
921
928
|
this.#log(LogLevelLabel.TRACE, `Synchronously removing directory: ${formattedPath}`);
|
|
922
|
-
this.resolveFS(path, options).rmdirSync(formattedPath,
|
|
929
|
+
this.resolveFS(path, options).rmdirSync(formattedPath, defu4(options, {
|
|
923
930
|
recursive: true
|
|
924
931
|
}));
|
|
925
932
|
this.#cachedFS.delete(formattedPath);
|
|
@@ -939,14 +946,14 @@ var VirtualFileSystem = class {
|
|
|
939
946
|
}
|
|
940
947
|
this.#log(LogLevelLabel.TRACE, `Removing directory: ${formattedPath}`);
|
|
941
948
|
if (isFunction(this.resolveFS(path, options).promises.rm)) {
|
|
942
|
-
await this.resolveFS(path, options).promises.rm(formattedPath,
|
|
949
|
+
await this.resolveFS(path, options).promises.rm(formattedPath, defu4(options, {
|
|
943
950
|
force: true,
|
|
944
951
|
recursive: true
|
|
945
952
|
}));
|
|
946
953
|
this.#cachedFS.delete(formattedPath);
|
|
947
954
|
this.clearResolverCache(formattedPath);
|
|
948
955
|
} else {
|
|
949
|
-
this.rmdirSync(formattedPath,
|
|
956
|
+
this.rmdirSync(formattedPath, defu4(options ?? {}, {
|
|
950
957
|
force: true,
|
|
951
958
|
recursive: true
|
|
952
959
|
}));
|
|
@@ -989,7 +996,7 @@ var VirtualFileSystem = class {
|
|
|
989
996
|
mkdirSync(path, options = {}) {
|
|
990
997
|
const filePath = toFilePath(path);
|
|
991
998
|
this.clearResolverCache(filePath);
|
|
992
|
-
return this.resolveFS(filePath, options).mkdirSync(filePath,
|
|
999
|
+
return this.resolveFS(filePath, options).mkdirSync(filePath, defu4(options ?? {}, {
|
|
993
1000
|
recursive: true
|
|
994
1001
|
}));
|
|
995
1002
|
}
|
|
@@ -1004,11 +1011,11 @@ var VirtualFileSystem = class {
|
|
|
1004
1011
|
let result;
|
|
1005
1012
|
const filePath = toFilePath(path);
|
|
1006
1013
|
if (isFunction(this.resolveFS(filePath, options).promises.mkdir)) {
|
|
1007
|
-
result = await this.resolveFS(filePath, options).promises.mkdir(filePath,
|
|
1014
|
+
result = await this.resolveFS(filePath, options).promises.mkdir(filePath, defu4(options ?? {}, {
|
|
1008
1015
|
recursive: true
|
|
1009
1016
|
}));
|
|
1010
1017
|
} else {
|
|
1011
|
-
result = this.resolveFS(filePath, options).mkdirSync(filePath,
|
|
1018
|
+
result = this.resolveFS(filePath, options).mkdirSync(filePath, defu4(options ?? {}, {
|
|
1012
1019
|
recursive: true
|
|
1013
1020
|
}));
|
|
1014
1021
|
}
|
|
@@ -1950,7 +1957,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1950
1957
|
return this.fs.writeFile(isAbsolute(path) ? path : appendPath(path, this.entryPath), {
|
|
1951
1958
|
code,
|
|
1952
1959
|
variant: "entry"
|
|
1953
|
-
},
|
|
1960
|
+
}, defu4(options, {
|
|
1954
1961
|
mode: this.config.output.mode
|
|
1955
1962
|
}));
|
|
1956
1963
|
}
|
|
@@ -1967,7 +1974,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1967
1974
|
id,
|
|
1968
1975
|
code,
|
|
1969
1976
|
variant: "builtin"
|
|
1970
|
-
},
|
|
1977
|
+
}, defu4(options, {
|
|
1971
1978
|
mode: this.config.output.mode
|
|
1972
1979
|
}));
|
|
1973
1980
|
}
|
|
@@ -1989,7 +1996,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
1989
1996
|
options
|
|
1990
1997
|
});
|
|
1991
1998
|
}
|
|
1992
|
-
const result = await parseAsync(id, code,
|
|
1999
|
+
const result = await parseAsync(id, code, defu4(options ?? {}, {
|
|
1993
2000
|
lang: hasFileExtension(id) ? void 0 : "ts",
|
|
1994
2001
|
astType: hasFileExtension(id) ? void 0 : "ts",
|
|
1995
2002
|
sourceType: "module",
|
|
@@ -2091,6 +2098,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2091
2098
|
mode: (config.mode ?? this.config.mode) || this.workspaceConfig.mode,
|
|
2092
2099
|
skipCache: config.skipCache ?? this.config.skipCache ?? false,
|
|
2093
2100
|
configFile: config.configFile ?? this.config.configFile,
|
|
2101
|
+
framework: config.framework ?? this.config.framework ?? "powerlines",
|
|
2094
2102
|
command: this.config.inlineConfig?.command
|
|
2095
2103
|
};
|
|
2096
2104
|
if (configCache.has(cacheKey)) {
|
|
@@ -2117,7 +2125,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2117
2125
|
mode: cacheKey.mode,
|
|
2118
2126
|
skipCache: cacheKey.skipCache
|
|
2119
2127
|
});
|
|
2120
|
-
const userConfig = await loadUserConfigFile(cacheKey.projectRoot, this.resolver, cacheKey.command, cacheKey.mode, cacheKey.configFile);
|
|
2128
|
+
const userConfig = await loadUserConfigFile(cacheKey.projectRoot, this.resolver, cacheKey.command, cacheKey.mode, cacheKey.configFile, cacheKey.framework);
|
|
2121
2129
|
this.mergeUserConfig(userConfig.config);
|
|
2122
2130
|
configCache.set(cacheKey, {
|
|
2123
2131
|
projectJson: this.projectJson,
|
|
@@ -2128,7 +2136,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2128
2136
|
});
|
|
2129
2137
|
}
|
|
2130
2138
|
if (isSetObject(config)) {
|
|
2131
|
-
this.resolvedConfig =
|
|
2139
|
+
this.resolvedConfig = defu4({
|
|
2132
2140
|
inlineConfig: this.config.inlineConfig,
|
|
2133
2141
|
userConfig: this.config.userConfig
|
|
2134
2142
|
}, options.isHighPriority ? this.#getConfigProps(config) : {}, {
|
|
@@ -2224,7 +2232,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
|
|
|
2224
2232
|
}, []);
|
|
2225
2233
|
}
|
|
2226
2234
|
mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
|
|
2227
|
-
this.config.userConfig =
|
|
2235
|
+
this.config.userConfig = defu4({
|
|
2228
2236
|
entry: Array.isArray(from.entry) && from.entry.length > 0 ? from.entry : Array.isArray(into?.entry) && into.entry.length > 0 ? into.entry : []
|
|
2229
2237
|
}, omit(from ?? {}, [
|
|
2230
2238
|
"entry"
|
|
@@ -2529,271 +2537,60 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
2529
2537
|
context.plugins = [];
|
|
2530
2538
|
for (const plugin of this.plugins) {
|
|
2531
2539
|
await context.addPlugin(plugin);
|
|
2532
|
-
}
|
|
2533
|
-
return context;
|
|
2534
|
-
}
|
|
2535
|
-
async addPlugin(plugin) {
|
|
2536
|
-
this.plugins.push(plugin);
|
|
2537
|
-
await Promise.all(Object.keys(this.environments).map(async (name) => {
|
|
2538
|
-
await this.environments[name].addPlugin(plugin);
|
|
2539
|
-
}));
|
|
2540
|
-
}
|
|
2541
|
-
async getEnvironment(name) {
|
|
2542
|
-
let environment;
|
|
2543
|
-
if (name) {
|
|
2544
|
-
environment = this.environments[name];
|
|
2545
|
-
}
|
|
2546
|
-
if (Object.keys(this.environments).length === 1) {
|
|
2547
|
-
environment = this.environments[Object.keys(this.environments)[0]];
|
|
2548
|
-
this.log(LogLevelLabel.DEBUG, `Applying the only configured environment: ${chalk5.bold.cyanBright(environment?.environment.name)}`);
|
|
2549
|
-
}
|
|
2550
|
-
if (!environment) {
|
|
2551
|
-
if (name) {
|
|
2552
|
-
throw new Error(`Environment "${name}" not found.`);
|
|
2553
|
-
}
|
|
2554
|
-
environment = await this.in(createDefaultEnvironment(this.config.userConfig));
|
|
2555
|
-
this.log(LogLevelLabel.WARN, `No environment specified, and no default environment found. Using a temporary default environment: ${chalk5.bold.cyanBright(environment?.environment.name)}`);
|
|
2556
|
-
}
|
|
2557
|
-
return environment;
|
|
2558
|
-
}
|
|
2559
|
-
async getEnvironmentSafe(name) {
|
|
2560
|
-
try {
|
|
2561
|
-
return await this.getEnvironment(name);
|
|
2562
|
-
} catch {
|
|
2563
|
-
return void 0;
|
|
2564
|
-
}
|
|
2565
|
-
}
|
|
2566
|
-
};
|
|
2567
|
-
function getBaseFileHeader(context) {
|
|
2568
|
-
return `
|
|
2569
|
-
// Generated with ${titleCase(context.config.framework)}
|
|
2570
|
-
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
2571
|
-
`;
|
|
2572
|
-
}
|
|
2573
|
-
__name(getBaseFileHeader, "getBaseFileHeader");
|
|
2574
|
-
function getFileHeader(context, options = {}) {
|
|
2575
|
-
const { directive = null, prettierIgnore = false } = options;
|
|
2576
|
-
return `/* eslint-disable */
|
|
2577
|
-
// biome-ignore lint: disable
|
|
2578
|
-
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `
|
|
2579
|
-
|
|
2580
|
-
${directive}
|
|
2581
|
-
` : "\n"}
|
|
2582
|
-
${getBaseFileHeader(context)}
|
|
2583
|
-
|
|
2584
|
-
`;
|
|
2585
|
-
}
|
|
2586
|
-
__name(getFileHeader, "getFileHeader");
|
|
2587
|
-
function getString(code) {
|
|
2588
|
-
if (!code) {
|
|
2589
|
-
return "";
|
|
2590
|
-
}
|
|
2591
|
-
if (isString(code)) {
|
|
2592
|
-
return code;
|
|
2593
|
-
}
|
|
2594
|
-
if (isSetObject(code) && "code" in code) {
|
|
2595
|
-
return code.code;
|
|
2596
|
-
}
|
|
2597
|
-
return code.toString();
|
|
2598
|
-
}
|
|
2599
|
-
__name(getString, "getString");
|
|
2600
|
-
function getMagicString(code) {
|
|
2601
|
-
if (isString(code)) {
|
|
2602
|
-
return new MagicString(code);
|
|
2603
|
-
}
|
|
2604
|
-
return code;
|
|
2605
|
-
}
|
|
2606
|
-
__name(getMagicString, "getMagicString");
|
|
2607
|
-
function getSourceFile(code, id) {
|
|
2608
|
-
const content = code ?? readFileIfExistingSync(id);
|
|
2609
|
-
return {
|
|
2610
|
-
id,
|
|
2611
|
-
code: getMagicString(content),
|
|
2612
|
-
env: []
|
|
2613
|
-
};
|
|
2614
|
-
}
|
|
2615
|
-
__name(getSourceFile, "getSourceFile");
|
|
2616
|
-
function resolveModulePath(nodePath, state) {
|
|
2617
|
-
if (!t.isStringLiteral(nodePath.node)) {
|
|
2618
|
-
return;
|
|
2619
|
-
}
|
|
2620
|
-
const sourcePath = nodePath.node.value;
|
|
2621
|
-
const resolvedPath = state.context?.fs.resolve(sourcePath);
|
|
2622
|
-
if (resolvedPath) {
|
|
2623
|
-
nodePath.replaceWith(t.stringLiteral(
|
|
2624
|
-
// Remove the file extension if it exists
|
|
2625
|
-
resolvedPath.replace(/\.(?:ts|mts|cts)x?$/, "")
|
|
2626
|
-
));
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
__name(resolveModulePath, "resolveModulePath");
|
|
2630
|
-
var TRANSFORM_FUNCTIONS = [
|
|
2631
|
-
"require",
|
|
2632
|
-
"require.resolve",
|
|
2633
|
-
"System.import",
|
|
2634
|
-
// Jest methods
|
|
2635
|
-
"jest.genMockFromModule",
|
|
2636
|
-
"jest.mock",
|
|
2637
|
-
"jest.unmock",
|
|
2638
|
-
"jest.doMock",
|
|
2639
|
-
// eslint-disable-next-line @cspell/spellchecker
|
|
2640
|
-
"jest.dontMock",
|
|
2641
|
-
"jest.setMock",
|
|
2642
|
-
"jest.requireActual",
|
|
2643
|
-
"jest.requireMock",
|
|
2644
|
-
// Older Jest methods
|
|
2645
|
-
"require.requireActual",
|
|
2646
|
-
"require.requireMock"
|
|
2647
|
-
];
|
|
2648
|
-
function matchesPattern(state, calleePath, pattern) {
|
|
2649
|
-
const { node } = calleePath;
|
|
2650
|
-
if (t.isMemberExpression(node)) {
|
|
2651
|
-
return calleePath.matchesPattern(pattern);
|
|
2540
|
+
}
|
|
2541
|
+
return context;
|
|
2652
2542
|
}
|
|
2653
|
-
|
|
2654
|
-
|
|
2543
|
+
async addPlugin(plugin) {
|
|
2544
|
+
this.plugins.push(plugin);
|
|
2545
|
+
await Promise.all(Object.keys(this.environments).map(async (name) => {
|
|
2546
|
+
await this.environments[name].addPlugin(plugin);
|
|
2547
|
+
}));
|
|
2655
2548
|
}
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
var importVisitors = {
|
|
2661
|
-
CallExpression: /* @__PURE__ */ __name((nodePath, state) => {
|
|
2662
|
-
if (state.moduleResolverVisited.has(nodePath)) {
|
|
2663
|
-
return;
|
|
2664
|
-
}
|
|
2665
|
-
const calleePath = nodePath.get("callee");
|
|
2666
|
-
if (calleePath && TRANSFORM_FUNCTIONS.some((pattern) => matchesPattern(state, calleePath, pattern)) || t.isImport(nodePath.node.callee)) {
|
|
2667
|
-
state.moduleResolverVisited.add(nodePath);
|
|
2668
|
-
resolveModulePath(nodePath.get("arguments.0"), state);
|
|
2549
|
+
async getEnvironment(name) {
|
|
2550
|
+
let environment;
|
|
2551
|
+
if (name) {
|
|
2552
|
+
environment = this.environments[name];
|
|
2669
2553
|
}
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
if (!nodePath || !nodePath.get("source") || state.moduleResolverVisited.has(nodePath)) {
|
|
2674
|
-
return;
|
|
2554
|
+
if (Object.keys(this.environments).length === 1) {
|
|
2555
|
+
environment = this.environments[Object.keys(this.environments)[0]];
|
|
2556
|
+
this.log(LogLevelLabel.DEBUG, `Applying the only configured environment: ${chalk5.bold.cyanBright(environment?.environment.name)}`);
|
|
2675
2557
|
}
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
};
|
|
2680
|
-
var moduleResolverBabelPlugin = /* @__PURE__ */ __name((context) => {
|
|
2681
|
-
return declare(/* @__PURE__ */ __name(function builder(api) {
|
|
2682
|
-
let moduleResolverVisited = /* @__PURE__ */ new Set();
|
|
2683
|
-
return {
|
|
2684
|
-
name: "powerlines:module-resolver",
|
|
2685
|
-
manipulateOptions(opts) {
|
|
2686
|
-
opts.filename ??= "unknown";
|
|
2687
|
-
},
|
|
2688
|
-
pre() {
|
|
2689
|
-
moduleResolverVisited = /* @__PURE__ */ new Set();
|
|
2690
|
-
},
|
|
2691
|
-
visitor: {
|
|
2692
|
-
Program: {
|
|
2693
|
-
enter(programPath, state) {
|
|
2694
|
-
programPath.traverse(importVisitors, {
|
|
2695
|
-
...state,
|
|
2696
|
-
context,
|
|
2697
|
-
moduleResolverVisited,
|
|
2698
|
-
api
|
|
2699
|
-
});
|
|
2700
|
-
},
|
|
2701
|
-
exit(programPath, state) {
|
|
2702
|
-
programPath.traverse(importVisitors, {
|
|
2703
|
-
...state,
|
|
2704
|
-
context,
|
|
2705
|
-
moduleResolverVisited,
|
|
2706
|
-
api
|
|
2707
|
-
});
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
},
|
|
2711
|
-
post() {
|
|
2712
|
-
moduleResolverVisited.clear();
|
|
2558
|
+
if (!environment) {
|
|
2559
|
+
if (name) {
|
|
2560
|
+
throw new Error(`Environment "${name}" not found.`);
|
|
2713
2561
|
}
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
}, "moduleResolverBabelPlugin");
|
|
2717
|
-
|
|
2718
|
-
// src/internal/helpers/generate-types.ts
|
|
2719
|
-
async function generateTypes(context) {
|
|
2720
|
-
context.log(LogLevelLabel.TRACE, `Preparing the TypeScript definitions for the Powerlines project.`);
|
|
2721
|
-
context.log(LogLevelLabel.TRACE, "Transforming built-ins runtime modules files.");
|
|
2722
|
-
const builtinFiles = await context.getBuiltins();
|
|
2723
|
-
const builtinFilePaths = await Promise.all(builtinFiles.map(async (file) => {
|
|
2724
|
-
const result = await transformAsync(file.code.toString(), {
|
|
2725
|
-
highlightCode: true,
|
|
2726
|
-
code: true,
|
|
2727
|
-
ast: false,
|
|
2728
|
-
cloneInputAst: false,
|
|
2729
|
-
comments: true,
|
|
2730
|
-
sourceType: "module",
|
|
2731
|
-
configFile: false,
|
|
2732
|
-
babelrc: false,
|
|
2733
|
-
envName: context.config.mode,
|
|
2734
|
-
caller: {
|
|
2735
|
-
name: "powerlines"
|
|
2736
|
-
},
|
|
2737
|
-
...context.config.transform.babel,
|
|
2738
|
-
filename: file.path,
|
|
2739
|
-
plugins: [
|
|
2740
|
-
[
|
|
2741
|
-
"@babel/plugin-syntax-typescript"
|
|
2742
|
-
],
|
|
2743
|
-
[
|
|
2744
|
-
moduleResolverBabelPlugin(context)
|
|
2745
|
-
]
|
|
2746
|
-
]
|
|
2747
|
-
});
|
|
2748
|
-
if (!result?.code) {
|
|
2749
|
-
throw new Error(`Powerlines - Generate Types failed to compile ${file.id}`);
|
|
2562
|
+
environment = await this.in(createDefaultEnvironment(this.config.userConfig));
|
|
2563
|
+
this.log(LogLevelLabel.WARN, `No environment specified, and no default environment found. Using a temporary default environment: ${chalk5.bold.cyanBright(environment?.environment.name)}`);
|
|
2750
2564
|
}
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
compilerOptions: {
|
|
2771
|
-
strict: false,
|
|
2772
|
-
noEmit: false,
|
|
2773
|
-
declaration: true,
|
|
2774
|
-
declarationMap: false,
|
|
2775
|
-
emitDeclarationOnly: true,
|
|
2776
|
-
skipLibCheck: true
|
|
2777
|
-
},
|
|
2778
|
-
exclude: [
|
|
2779
|
-
"node_modules",
|
|
2780
|
-
"dist"
|
|
2781
|
-
],
|
|
2782
|
-
include: files
|
|
2783
|
-
}, context.config.tsconfigRaw ?? {}));
|
|
2784
|
-
resolvedTsconfig.options.configFilePath = joinPaths(context.workspaceConfig.workspaceRoot, context.tsconfig.tsconfigFilePath);
|
|
2785
|
-
resolvedTsconfig.options.pathsBasePath = context.workspaceConfig.workspaceRoot;
|
|
2786
|
-
resolvedTsconfig.options.suppressOutputPathCheck = true;
|
|
2565
|
+
return environment;
|
|
2566
|
+
}
|
|
2567
|
+
async getEnvironmentSafe(name) {
|
|
2568
|
+
try {
|
|
2569
|
+
return await this.getEnvironment(name);
|
|
2570
|
+
} catch {
|
|
2571
|
+
return void 0;
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
};
|
|
2575
|
+
function formatTypes(code) {
|
|
2576
|
+
return code.replace(
|
|
2577
|
+
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
|
2578
|
+
/import\s*(?:type\s*)?\{?[\w,\s]*(?:\}\s*)?from\s*(?:'|")@?[a-zA-Z0-9-\\/.]*(?:'|");?/g,
|
|
2579
|
+
""
|
|
2580
|
+
).replaceAll("#private;", "").replace(/__Ω/g, "");
|
|
2581
|
+
}
|
|
2582
|
+
__name(formatTypes, "formatTypes");
|
|
2583
|
+
async function emitTypes(context, tsconfig, files) {
|
|
2787
2584
|
context.log(LogLevelLabel.TRACE, "Creating the TypeScript compiler host");
|
|
2788
|
-
const program = createProgram(files,
|
|
2789
|
-
context.log(LogLevelLabel.TRACE, `Running TypeScript compiler
|
|
2585
|
+
const program = createProgram(files, tsconfig.options, createCompilerHost(tsconfig.options));
|
|
2586
|
+
context.log(LogLevelLabel.TRACE, `Running the TypeScript compiler for ${context.builtins.length} built-in runtime files.`);
|
|
2790
2587
|
let builtinModules = "";
|
|
2791
2588
|
const emitResult = program.emit(void 0, (fileName, text, _, __, sourceFiles, _data) => {
|
|
2792
|
-
const
|
|
2793
|
-
if (
|
|
2794
|
-
if (
|
|
2589
|
+
const sourceFile = sourceFiles?.[0];
|
|
2590
|
+
if (sourceFile?.fileName && !fileName.endsWith(".map")) {
|
|
2591
|
+
if (context.builtins.some((file) => file === sourceFile.fileName || context.fs.meta[file]?.id && context.fs.meta[file]?.id === sourceFile.fileName)) {
|
|
2795
2592
|
builtinModules += `
|
|
2796
|
-
declare module "${context.fs.resolve(
|
|
2593
|
+
declare module "${context.fs.resolve(sourceFile.fileName)}" {
|
|
2797
2594
|
${text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
|
|
2798
2595
|
}
|
|
2799
2596
|
`;
|
|
@@ -2818,25 +2615,9 @@ declare module "${context.fs.resolve(sourceFile2.fileName)}" {
|
|
|
2818
2615
|
|
|
2819
2616
|
${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : diagnosticMessage}`);
|
|
2820
2617
|
}
|
|
2821
|
-
|
|
2822
|
-
const sourceFile = getSourceFile(String(context.config.output.dts), `/// <reference types="powerlines/shared" />${context.config.build.platform !== "neutral" ? `
|
|
2823
|
-
/// <reference types="powerlines/${context.config.build.platform}" />` : ""}
|
|
2824
|
-
|
|
2825
|
-
${getFileHeader(context, {
|
|
2826
|
-
directive: null,
|
|
2827
|
-
prettierIgnore: false
|
|
2828
|
-
})}
|
|
2829
|
-
|
|
2830
|
-
${builtinModules}`.replace(
|
|
2831
|
-
// eslint-disable-next-line regexp/no-super-linear-backtracking
|
|
2832
|
-
/import\s*(?:type\s*)?\{?[\w,\s]*(?:\}\s*)?from\s*(?:'|")@?[a-zA-Z0-9-\\/.]*(?:'|");?/g,
|
|
2833
|
-
""
|
|
2834
|
-
).replaceAll("#private;", "").replace(/__Ω/g, ""));
|
|
2835
|
-
await context.fs.writeFile(sourceFile.id, getString(sourceFile.code), {
|
|
2836
|
-
mode: "fs"
|
|
2837
|
-
});
|
|
2618
|
+
return formatTypes(builtinModules);
|
|
2838
2619
|
}
|
|
2839
|
-
__name(
|
|
2620
|
+
__name(emitTypes, "emitTypes");
|
|
2840
2621
|
async function installPackage(context, packageName, dev = false) {
|
|
2841
2622
|
if (!await isPackageListed(getPackageName(packageName), {
|
|
2842
2623
|
cwd: context.config.projectRoot
|
|
@@ -2872,7 +2653,12 @@ __name(installPackage, "installPackage");
|
|
|
2872
2653
|
async function installDependencies(context) {
|
|
2873
2654
|
context.log(LogLevelLabel.TRACE, `Checking and installing missing project dependencies.`);
|
|
2874
2655
|
context.dependencies ??= {};
|
|
2875
|
-
context.
|
|
2656
|
+
context.devDependencies ??= {};
|
|
2657
|
+
if (Object.keys(context.dependencies).length === 0 && Object.keys(context.devDependencies).length === 0) {
|
|
2658
|
+
context.log(LogLevelLabel.TRACE, `No dependencies or devDependencies to install. Skipping installation step.`);
|
|
2659
|
+
return;
|
|
2660
|
+
}
|
|
2661
|
+
context.log(LogLevelLabel.DEBUG, `The following packages are required:
|
|
2876
2662
|
Dependencies:
|
|
2877
2663
|
${Object.entries(context.dependencies).map(([name, version]) => `- ${name}@${String(version)}`).join(" \n")}
|
|
2878
2664
|
|
|
@@ -2884,6 +2670,108 @@ ${Object.entries(context.devDependencies).map(([name, version]) => `- ${name}@${
|
|
|
2884
2670
|
]);
|
|
2885
2671
|
}
|
|
2886
2672
|
__name(installDependencies, "installDependencies");
|
|
2673
|
+
function getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig = "tsconfig.json") {
|
|
2674
|
+
let tsconfigFilePath = tsconfig;
|
|
2675
|
+
if (!existsSync(tsconfigFilePath)) {
|
|
2676
|
+
tsconfigFilePath = appendPath(tsconfig, projectRoot);
|
|
2677
|
+
if (!existsSync(tsconfigFilePath)) {
|
|
2678
|
+
tsconfigFilePath = appendPath(tsconfig, workspaceRoot);
|
|
2679
|
+
if (!existsSync(tsconfigFilePath)) {
|
|
2680
|
+
tsconfigFilePath = appendPath(tsconfig, joinPaths(workspaceRoot, projectRoot));
|
|
2681
|
+
if (!existsSync(tsconfigFilePath)) {
|
|
2682
|
+
throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${tsconfig}, ${appendPath(tsconfig, projectRoot)}, ${appendPath(tsconfig, workspaceRoot)}, or ${tsconfigFilePath}`);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
return tsconfigFilePath;
|
|
2688
|
+
}
|
|
2689
|
+
__name(getTsconfigFilePath, "getTsconfigFilePath");
|
|
2690
|
+
function findMatch(tsconfigType, types, extensions = [
|
|
2691
|
+
".ts",
|
|
2692
|
+
".tsx",
|
|
2693
|
+
".d.ts"
|
|
2694
|
+
]) {
|
|
2695
|
+
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}`));
|
|
2696
|
+
}
|
|
2697
|
+
__name(findMatch, "findMatch");
|
|
2698
|
+
function findIncludeMatch(tsconfigType, types) {
|
|
2699
|
+
return findMatch(tsconfigType, types, [
|
|
2700
|
+
".ts",
|
|
2701
|
+
".tsx",
|
|
2702
|
+
".d.ts",
|
|
2703
|
+
".js",
|
|
2704
|
+
".jsx",
|
|
2705
|
+
".mjs",
|
|
2706
|
+
".cjs",
|
|
2707
|
+
".mts",
|
|
2708
|
+
".cts",
|
|
2709
|
+
"/*.ts",
|
|
2710
|
+
"/*.tsx",
|
|
2711
|
+
"/*.d.ts",
|
|
2712
|
+
"/*.js",
|
|
2713
|
+
"/*.jsx",
|
|
2714
|
+
"/*.mjs",
|
|
2715
|
+
"/*.cjs",
|
|
2716
|
+
"/*.mts",
|
|
2717
|
+
"/*.cts",
|
|
2718
|
+
"/**/*.ts",
|
|
2719
|
+
"/**/*.tsx",
|
|
2720
|
+
"/**/*.d.ts",
|
|
2721
|
+
"/**/*.js",
|
|
2722
|
+
"/**/*.jsx",
|
|
2723
|
+
"/**/*.mjs",
|
|
2724
|
+
"/**/*.cjs",
|
|
2725
|
+
"/**/*.mts",
|
|
2726
|
+
"/**/*.cts"
|
|
2727
|
+
]);
|
|
2728
|
+
}
|
|
2729
|
+
__name(findIncludeMatch, "findIncludeMatch");
|
|
2730
|
+
function isIncludeMatchFound(tsconfigType, types) {
|
|
2731
|
+
return findIncludeMatch(tsconfigType, types) !== void 0;
|
|
2732
|
+
}
|
|
2733
|
+
__name(isIncludeMatchFound, "isIncludeMatchFound");
|
|
2734
|
+
function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfigRaw = {}, originalTsconfigJson, host = ts2.sys) {
|
|
2735
|
+
const tsconfigFilePath = getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
|
|
2736
|
+
const tsconfigJson = readJsonFileSync(tsconfigFilePath);
|
|
2737
|
+
if (!tsconfigJson) {
|
|
2738
|
+
throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${joinPaths(projectRoot, tsconfig ?? "tsconfig.json")}`);
|
|
2739
|
+
}
|
|
2740
|
+
const parsedCommandLine = ts2.parseJsonConfigFileContent(defu4(tsconfigRaw ?? {}, tsconfigJson), host, appendPath(projectRoot, workspaceRoot));
|
|
2741
|
+
if (parsedCommandLine.errors.length > 0) {
|
|
2742
|
+
const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:
|
|
2743
|
+
${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && error.code ? `[${error.category}-${error.code}]: ` : "") + error.messageText.toString()}`).join("\n")}
|
|
2744
|
+
`;
|
|
2745
|
+
throw new Error(errorMessage);
|
|
2746
|
+
}
|
|
2747
|
+
return {
|
|
2748
|
+
...parsedCommandLine,
|
|
2749
|
+
originalTsconfigJson: originalTsconfigJson ?? tsconfigJson,
|
|
2750
|
+
tsconfigJson,
|
|
2751
|
+
tsconfigFilePath
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
__name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
|
|
2755
|
+
async function writeFile(log, filepath, content, skipFormat = false) {
|
|
2756
|
+
try {
|
|
2757
|
+
if (skipFormat) {
|
|
2758
|
+
await writeFile$1(filepath, content);
|
|
2759
|
+
} else {
|
|
2760
|
+
const config = await resolveConfig(filepath);
|
|
2761
|
+
const formatted = await format(content, {
|
|
2762
|
+
...config ?? {},
|
|
2763
|
+
filepath
|
|
2764
|
+
});
|
|
2765
|
+
await writeFile$1(filepath, formatted || "");
|
|
2766
|
+
}
|
|
2767
|
+
} catch (error) {
|
|
2768
|
+
log(LogLevelLabel.ERROR, `Failed to write file ${filepath} to disk
|
|
2769
|
+
${error?.message ? error.message : ""}`);
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
__name(writeFile, "writeFile");
|
|
2773
|
+
|
|
2774
|
+
// src/internal/helpers/resolve-tsconfig.ts
|
|
2887
2775
|
async function resolveTsconfigChanges(context) {
|
|
2888
2776
|
const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw);
|
|
2889
2777
|
const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
@@ -3058,8 +2946,28 @@ async function resolveTsconfig(context) {
|
|
|
3058
2946
|
context.tsconfig.tsconfigJson.compilerOptions.strict = false;
|
|
3059
2947
|
}
|
|
3060
2948
|
__name(resolveTsconfig, "resolveTsconfig");
|
|
2949
|
+
function getBaseFileHeader(context) {
|
|
2950
|
+
return `
|
|
2951
|
+
// Generated with ${titleCase(context.config.framework)}
|
|
2952
|
+
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
2953
|
+
`;
|
|
2954
|
+
}
|
|
2955
|
+
__name(getBaseFileHeader, "getBaseFileHeader");
|
|
2956
|
+
function getFileHeader(context, options = {}) {
|
|
2957
|
+
const { directive = null, prettierIgnore = false } = options;
|
|
2958
|
+
return `/* eslint-disable */
|
|
2959
|
+
// biome-ignore lint: disable
|
|
2960
|
+
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `
|
|
2961
|
+
|
|
2962
|
+
${directive}
|
|
2963
|
+
` : "\n"}
|
|
2964
|
+
${getBaseFileHeader(context)}
|
|
2965
|
+
|
|
2966
|
+
`;
|
|
2967
|
+
}
|
|
2968
|
+
__name(getFileHeader, "getFileHeader");
|
|
3061
2969
|
|
|
3062
|
-
// src/
|
|
2970
|
+
// src/api.ts
|
|
3063
2971
|
var PowerlinesAPI = class _PowerlinesAPI {
|
|
3064
2972
|
static {
|
|
3065
2973
|
__name(this, "PowerlinesAPI");
|
|
@@ -3134,13 +3042,122 @@ ${formatLogMessage(context.config)}`);
|
|
|
3134
3042
|
await createDirectory(context.dataPath);
|
|
3135
3043
|
}
|
|
3136
3044
|
await this.callPreHook(context, "prepare");
|
|
3137
|
-
|
|
3138
|
-
context.log(LogLevelLabel.TRACE, "Generating built-in barrel file");
|
|
3139
|
-
}
|
|
3045
|
+
await this.callNormalHook(context, "prepare");
|
|
3140
3046
|
if (context.config.output.dts !== false) {
|
|
3141
|
-
|
|
3047
|
+
context.log(LogLevelLabel.TRACE, `Preparing the TypeScript definitions for the Powerlines project.`);
|
|
3048
|
+
context.log(LogLevelLabel.TRACE, "Transforming built-ins runtime modules files.");
|
|
3049
|
+
const builtinFilePaths = await Promise.all((await context.getBuiltins()).map(async (file) => {
|
|
3050
|
+
const result2 = await transformAsync(file.code.toString(), {
|
|
3051
|
+
highlightCode: true,
|
|
3052
|
+
code: true,
|
|
3053
|
+
ast: false,
|
|
3054
|
+
cloneInputAst: false,
|
|
3055
|
+
comments: true,
|
|
3056
|
+
sourceType: "module",
|
|
3057
|
+
configFile: false,
|
|
3058
|
+
babelrc: false,
|
|
3059
|
+
envName: context.config.mode,
|
|
3060
|
+
caller: {
|
|
3061
|
+
name: "powerlines"
|
|
3062
|
+
},
|
|
3063
|
+
...context.config.transform.babel,
|
|
3064
|
+
filename: file.path,
|
|
3065
|
+
plugins: [
|
|
3066
|
+
[
|
|
3067
|
+
"@babel/plugin-syntax-typescript"
|
|
3068
|
+
],
|
|
3069
|
+
[
|
|
3070
|
+
moduleResolverBabelPlugin(context)
|
|
3071
|
+
]
|
|
3072
|
+
]
|
|
3073
|
+
});
|
|
3074
|
+
if (!result2?.code) {
|
|
3075
|
+
throw new Error(`Powerlines - Generate Types failed to compile ${file.id}`);
|
|
3076
|
+
}
|
|
3077
|
+
context.log(LogLevelLabel.TRACE, `Writing transformed built-in runtime file ${file.id}.`);
|
|
3078
|
+
await context.writeBuiltin(result2.code, file.id, file.path);
|
|
3079
|
+
return file.path;
|
|
3080
|
+
}));
|
|
3081
|
+
const typescriptPath = await resolvePackage("typescript");
|
|
3082
|
+
if (!typescriptPath) {
|
|
3083
|
+
throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
|
|
3084
|
+
}
|
|
3085
|
+
const files = builtinFilePaths.reduce((ret, fileName) => {
|
|
3086
|
+
const formatted = replacePath(fileName, context.workspaceConfig.workspaceRoot);
|
|
3087
|
+
if (!ret.includes(formatted)) {
|
|
3088
|
+
ret.push(formatted);
|
|
3089
|
+
}
|
|
3090
|
+
return ret;
|
|
3091
|
+
}, [
|
|
3092
|
+
joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")
|
|
3093
|
+
]);
|
|
3094
|
+
context.log(LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
|
|
3095
|
+
const resolvedTsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath, defu4({
|
|
3096
|
+
compilerOptions: {
|
|
3097
|
+
strict: false,
|
|
3098
|
+
noEmit: false,
|
|
3099
|
+
declaration: true,
|
|
3100
|
+
declarationMap: false,
|
|
3101
|
+
emitDeclarationOnly: true,
|
|
3102
|
+
skipLibCheck: true
|
|
3103
|
+
},
|
|
3104
|
+
exclude: [
|
|
3105
|
+
"node_modules",
|
|
3106
|
+
"dist"
|
|
3107
|
+
],
|
|
3108
|
+
include: files
|
|
3109
|
+
}, context.config.tsconfigRaw ?? {}));
|
|
3110
|
+
resolvedTsconfig.options.configFilePath = joinPaths(context.workspaceConfig.workspaceRoot, context.tsconfig.tsconfigFilePath);
|
|
3111
|
+
resolvedTsconfig.options.pathsBasePath = context.workspaceConfig.workspaceRoot;
|
|
3112
|
+
resolvedTsconfig.options.suppressOutputPathCheck = true;
|
|
3113
|
+
let generatedTypes = await emitTypes(context, resolvedTsconfig, files);
|
|
3114
|
+
context.log(LogLevelLabel.TRACE, `Generating TypeScript declaration file in ${context.config.output.dts}.`);
|
|
3115
|
+
const directives = [];
|
|
3116
|
+
let result = await this.callPreHook(context, "generateTypes", generatedTypes);
|
|
3117
|
+
if (result) {
|
|
3118
|
+
if (isSetObject(result)) {
|
|
3119
|
+
generatedTypes = result.code;
|
|
3120
|
+
if (Array.isArray(result.directives) && result.directives.length > 0) {
|
|
3121
|
+
directives.push(...result.directives);
|
|
3122
|
+
}
|
|
3123
|
+
} else if (isSetString(result)) {
|
|
3124
|
+
generatedTypes = result;
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
result = await this.callNormalHook(context, "generateTypes", generatedTypes);
|
|
3128
|
+
if (result) {
|
|
3129
|
+
if (isSetObject(result)) {
|
|
3130
|
+
generatedTypes = result.code;
|
|
3131
|
+
if (Array.isArray(result.directives) && result.directives.length > 0) {
|
|
3132
|
+
directives.push(...result.directives);
|
|
3133
|
+
}
|
|
3134
|
+
} else if (isSetString(result)) {
|
|
3135
|
+
generatedTypes = result;
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
result = await this.callPostHook(context, "generateTypes", generatedTypes);
|
|
3139
|
+
if (result) {
|
|
3140
|
+
if (isSetObject(result)) {
|
|
3141
|
+
generatedTypes = result.code;
|
|
3142
|
+
if (Array.isArray(result.directives) && result.directives.length > 0) {
|
|
3143
|
+
directives.push(...result.directives);
|
|
3144
|
+
}
|
|
3145
|
+
} else if (isSetString(result)) {
|
|
3146
|
+
generatedTypes = result;
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
await context.fs.writeFile(context.config.output.dts, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
|
|
3150
|
+
|
|
3151
|
+
` : ""}${getFileHeader(context, {
|
|
3152
|
+
directive: null,
|
|
3153
|
+
prettierIgnore: false
|
|
3154
|
+
})}
|
|
3155
|
+
|
|
3156
|
+
${formatTypes(generatedTypes)}
|
|
3157
|
+
`, {
|
|
3158
|
+
mode: "fs"
|
|
3159
|
+
});
|
|
3142
3160
|
}
|
|
3143
|
-
await this.callNormalHook(context, "prepare");
|
|
3144
3161
|
context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
|
|
3145
3162
|
if (!context.tsconfig) {
|
|
3146
3163
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
@@ -3565,6 +3582,4 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
3565
3582
|
}
|
|
3566
3583
|
};
|
|
3567
3584
|
|
|
3568
|
-
export { PowerlinesAPI, createLog
|
|
3569
|
-
//# sourceMappingURL=chunk-P4BOYWXT.js.map
|
|
3570
|
-
//# sourceMappingURL=chunk-P4BOYWXT.js.map
|
|
3585
|
+
export { PowerlinesAPI, createLog };
|