powerlines 0.14.1 → 0.14.4
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/README.md +30 -21
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/_virtual/_rolldown/runtime.mjs +36 -0
- package/dist/api.cjs +10 -0
- package/dist/api.d.cts +2 -0
- package/dist/api.d.mts +2 -0
- package/dist/api.mjs +3 -0
- package/dist/astro.cjs +24 -28
- package/dist/astro.d.cts +14 -47
- package/dist/astro.d.cts.map +1 -0
- package/dist/astro.d.mts +25 -0
- package/dist/astro.d.mts.map +1 -0
- package/dist/astro.mjs +25 -0
- package/dist/astro.mjs.map +1 -0
- package/dist/config.cjs +9 -0
- package/dist/config.d.cts +1 -0
- package/dist/config.d.mts +1 -0
- package/dist/config.mjs +3 -0
- package/dist/constants.cjs +9 -0
- package/dist/constants.d.cts +1 -0
- package/dist/constants.d.mts +1 -0
- package/dist/constants.mjs +3 -0
- package/dist/context.cjs +9 -0
- package/dist/context.d.cts +1 -0
- package/dist/context.d.mts +1 -0
- package/dist/context.mjs +3 -0
- package/dist/engine.cjs +30 -0
- package/dist/engine.d.cts +24 -0
- package/dist/engine.d.cts.map +1 -0
- package/dist/engine.d.mts +24 -0
- package/dist/engine.d.mts.map +1 -0
- package/dist/engine.mjs +29 -0
- package/dist/engine.mjs.map +1 -0
- package/dist/esbuild.cjs +51 -23
- package/dist/esbuild.d.cts +13 -45
- package/dist/esbuild.d.cts.map +1 -0
- package/dist/esbuild.d.mts +25 -0
- package/dist/esbuild.d.mts.map +1 -0
- package/dist/esbuild.mjs +43 -0
- package/dist/esbuild.mjs.map +1 -0
- package/dist/farm.cjs +26 -18
- package/dist/farm.d.cts +15 -47
- package/dist/farm.d.cts.map +1 -0
- package/dist/farm.d.mts +25 -0
- package/dist/farm.d.mts.map +1 -0
- package/dist/farm.mjs +26 -0
- package/dist/farm.mjs.map +1 -0
- package/dist/index.cjs +40 -91
- package/dist/index.d.cts +21 -60
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +26 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +34 -0
- package/dist/index.mjs.map +1 -0
- package/dist/next.cjs +35 -27
- package/dist/next.d.cts +6 -4
- package/dist/next.d.cts.map +1 -0
- package/dist/{next.d.ts → next.d.mts} +6 -4
- package/dist/next.d.mts.map +1 -0
- package/dist/next.mjs +36 -0
- package/dist/next.mjs.map +1 -0
- package/dist/nuxt.cjs +44 -29
- package/dist/nuxt.d.cts +19 -10
- package/dist/nuxt.d.cts.map +1 -0
- package/dist/nuxt.d.mts +29 -0
- package/dist/nuxt.d.mts.map +1 -0
- package/dist/nuxt.mjs +44 -0
- package/dist/nuxt.mjs.map +1 -0
- package/dist/package.cjs +18 -0
- package/dist/package.mjs +7 -0
- package/dist/package.mjs.map +1 -0
- package/dist/plugin-utils.cjs +9 -0
- package/dist/plugin-utils.d.cts +1 -0
- package/dist/plugin-utils.d.mts +1 -0
- package/dist/plugin-utils.mjs +3 -0
- package/dist/rolldown.cjs +43 -22
- package/dist/rolldown.d.cts +10 -43
- package/dist/rolldown.d.cts.map +1 -0
- package/dist/rolldown.d.mts +24 -0
- package/dist/rolldown.d.mts.map +1 -0
- package/dist/rolldown.mjs +35 -0
- package/dist/rolldown.mjs.map +1 -0
- package/dist/rollup.cjs +34 -22
- package/dist/rollup.d.cts +11 -43
- package/dist/rollup.d.cts.map +1 -0
- package/dist/rollup.d.mts +25 -0
- package/dist/rollup.d.mts.map +1 -0
- package/dist/rollup.mjs +26 -0
- package/dist/rollup.mjs.map +1 -0
- package/dist/rspack.cjs +34 -22
- package/dist/rspack.d.cts +14 -46
- package/dist/rspack.d.cts.map +1 -0
- package/dist/rspack.d.mts +25 -0
- package/dist/rspack.d.mts.map +1 -0
- package/dist/rspack.mjs +26 -0
- package/dist/rspack.mjs.map +1 -0
- package/dist/schemas.cjs +9 -0
- package/dist/schemas.d.cts +1 -0
- package/dist/schemas.d.mts +1 -0
- package/dist/schemas.mjs +3 -0
- package/dist/storage.cjs +9 -0
- package/dist/storage.d.cts +1 -0
- package/dist/storage.d.mts +1 -0
- package/dist/storage.mjs +3 -0
- package/dist/tsdown.cjs +96 -0
- package/dist/tsdown.d.cts +31 -0
- package/dist/tsdown.d.cts.map +1 -0
- package/dist/tsdown.d.mts +31 -0
- package/dist/tsdown.d.mts.map +1 -0
- package/dist/tsdown.mjs +82 -0
- package/dist/tsdown.mjs.map +1 -0
- package/dist/tsup.cjs +67 -24
- package/dist/tsup.d.cts +12 -8
- package/dist/tsup.d.cts.map +1 -0
- package/dist/{tsup.d.ts → tsup.d.mts} +12 -8
- package/dist/tsup.d.mts.map +1 -0
- package/dist/tsup.mjs +59 -0
- package/dist/tsup.mjs.map +1 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +8 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +8 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +1 -0
- package/dist/typescript.cjs +9 -0
- package/dist/typescript.d.cts +1 -0
- package/dist/typescript.d.mts +1 -0
- package/dist/typescript.mjs +3 -0
- package/dist/unbuild.cjs +17 -0
- package/dist/unbuild.d.cts +2 -0
- package/dist/unbuild.d.mts +2 -0
- package/dist/unbuild.mjs +3 -0
- package/dist/unloader.cjs +23 -26
- package/dist/unloader.d.cts +11 -45
- package/dist/unloader.d.cts.map +1 -0
- package/dist/unloader.d.mts +22 -0
- package/dist/unloader.d.mts.map +1 -0
- package/dist/unloader.mjs +23 -0
- package/dist/unloader.mjs.map +1 -0
- package/dist/unplugin.cjs +105 -37
- package/dist/unplugin.d.cts +9 -69
- package/dist/unplugin.d.cts.map +1 -0
- package/dist/unplugin.d.mts +17 -0
- package/dist/unplugin.d.mts.map +1 -0
- package/dist/unplugin.mjs +101 -0
- package/dist/unplugin.mjs.map +1 -0
- package/dist/utils.cjs +25 -0
- package/dist/utils.d.cts +3 -0
- package/dist/utils.d.mts +3 -0
- package/dist/utils.mjs +7 -0
- package/dist/vite.cjs +76 -24
- package/dist/vite.d.cts +12 -44
- package/dist/vite.d.cts.map +1 -0
- package/dist/vite.d.mts +25 -0
- package/dist/vite.d.mts.map +1 -0
- package/dist/vite.mjs +66 -0
- package/dist/vite.mjs.map +1 -0
- package/dist/webpack.cjs +34 -23
- package/dist/webpack.d.cts +10 -43
- package/dist/webpack.d.cts.map +1 -0
- package/dist/webpack.d.mts +24 -0
- package/dist/webpack.d.mts.map +1 -0
- package/dist/webpack.mjs +25 -0
- package/dist/webpack.mjs.map +1 -0
- package/files/application/README.md.hbs +16 -42
- package/files/application/package.json.hbs +7 -28
- package/files/common/jest.config.ts.hbs +2 -3
- package/files/common/tsconfig.json.hbs +5 -10
- package/files/common/tsconfig.spec.json.hbs +3 -13
- package/files/library/README.md.hbs +11 -34
- package/files/library/package.json.hbs +9 -32
- package/package.json +253 -342
- package/schemas/fs.capnp +42 -0
- package/dist/astro.d.ts +0 -58
- package/dist/astro.js +0 -11
- package/dist/babel-types.d.ts +0 -292
- package/dist/chunk-22K72CJ5.cjs +0 -18
- package/dist/chunk-2OGPXWHG.js +0 -21
- package/dist/chunk-2VIXD2XB.js +0 -3
- package/dist/chunk-3IM6CTCB.cjs +0 -12
- package/dist/chunk-4AKYOJXA.cjs +0 -20
- package/dist/chunk-4FZTGBHW.cjs +0 -12
- package/dist/chunk-4HGQJ4KR.js +0 -11
- package/dist/chunk-4JCNAKOE.cjs +0 -4
- package/dist/chunk-5A5AK6JI.js +0 -31
- package/dist/chunk-5S33UKRI.js +0 -9
- package/dist/chunk-5VPVJHJO.cjs +0 -18
- package/dist/chunk-6TJGZR5X.js +0 -46
- package/dist/chunk-6ZGIV2SU.cjs +0 -4
- package/dist/chunk-7BZQBW77.cjs +0 -4
- package/dist/chunk-7GVRTQLJ.js +0 -16
- package/dist/chunk-7HF3SEKY.cjs +0 -24
- package/dist/chunk-7QQZH7V2.js +0 -9
- package/dist/chunk-7QVYU63E.js +0 -6
- package/dist/chunk-AFJCY3R6.js +0 -3
- package/dist/chunk-APVMN2H7.cjs +0 -14
- package/dist/chunk-AXIRZAL7.js +0 -3
- package/dist/chunk-DFLNRC3B.cjs +0 -4
- package/dist/chunk-DS7OM4NX.cjs +0 -4
- package/dist/chunk-DURCSSLV.js +0 -3
- package/dist/chunk-EBMELFCF.js +0 -12
- package/dist/chunk-GC3BRYAK.cjs +0 -13
- package/dist/chunk-GIE6OE3X.js +0 -3
- package/dist/chunk-HJW7OH6E.js +0 -3
- package/dist/chunk-IHUNA3MO.cjs +0 -4
- package/dist/chunk-KMLFL4CW.js +0 -14
- package/dist/chunk-LO77RPRV.js +0 -16
- package/dist/chunk-M6XRJI44.js +0 -9
- package/dist/chunk-MW2CYPK5.cjs +0 -34
- package/dist/chunk-N2RUZCWA.js +0 -9
- package/dist/chunk-N6L2CYXV.js +0 -21
- package/dist/chunk-NVNMK4CE.js +0 -39
- package/dist/chunk-O7GICJVN.cjs +0 -116
- package/dist/chunk-OYASPHNL.js +0 -3
- package/dist/chunk-P4BOYWXT.js +0 -3570
- package/dist/chunk-PJRHRDLS.cjs +0 -3602
- package/dist/chunk-PK6SKIKE.cjs +0 -8
- package/dist/chunk-Q7EJVZVI.cjs +0 -4
- package/dist/chunk-RIOZPUCZ.cjs +0 -34
- package/dist/chunk-SIZKRND7.js +0 -12
- package/dist/chunk-TLHFXGYV.js +0 -3
- package/dist/chunk-TLRPAJU2.cjs +0 -12
- package/dist/chunk-TSWMWZ4U.cjs +0 -12
- package/dist/chunk-UFEM5JTE.cjs +0 -42
- package/dist/chunk-UZQYBO6Z.cjs +0 -52
- package/dist/chunk-V7LXFIGK.js +0 -199
- package/dist/chunk-VNRXLY2T.js +0 -3
- package/dist/chunk-VQCQRLGM.cjs +0 -4
- package/dist/chunk-WA6IOZHV.js +0 -109
- package/dist/chunk-WCTOTE3T.cjs +0 -201
- package/dist/chunk-XBF43VLE.cjs +0 -4
- package/dist/chunk-XZO6ZJQP.cjs +0 -4
- package/dist/chunk-Y5CDUGSN.cjs +0 -12
- package/dist/chunk-YFP5GQWW.js +0 -9
- package/dist/chunk-YIWHO6SW.cjs +0 -14
- package/dist/chunk-YQXNZNGK.js +0 -31
- package/dist/chunk-YTOIG4CV.cjs +0 -24
- package/dist/chunk-YZCTXGFH.js +0 -11
- package/dist/chunk-Z5H7LD6W.js +0 -3
- package/dist/chunk-ZEJHPSLK.cjs +0 -19
- package/dist/define-config.cjs +0 -13
- package/dist/define-config.d.cts +0 -50
- package/dist/define-config.d.ts +0 -50
- package/dist/define-config.js +0 -4
- package/dist/esbuild.d.ts +0 -57
- package/dist/esbuild.js +0 -10
- package/dist/extend-plugin.cjs +0 -13
- package/dist/extend-plugin.d.cts +0 -48
- package/dist/extend-plugin.d.ts +0 -48
- package/dist/extend-plugin.js +0 -4
- package/dist/farm.d.ts +0 -57
- package/dist/farm.js +0 -14
- package/dist/hooks-Wrj1dKJ9.d.cts +0 -28
- package/dist/hooks-q1Az_C64.d.ts +0 -28
- package/dist/index.d.ts +0 -65
- package/dist/index.js +0 -40
- package/dist/internal/api.cjs +0 -16
- package/dist/internal/api.cjs.map +0 -1
- package/dist/internal/api.d.cts +0 -192
- package/dist/internal/api.d.ts +0 -192
- package/dist/internal/api.js +0 -7
- package/dist/internal/api.js.map +0 -1
- package/dist/lib/build/esbuild.cjs +0 -22
- package/dist/lib/build/esbuild.cjs.map +0 -1
- package/dist/lib/build/esbuild.d.cts +0 -51
- package/dist/lib/build/esbuild.d.ts +0 -51
- package/dist/lib/build/esbuild.js +0 -5
- package/dist/lib/build/esbuild.js.map +0 -1
- package/dist/lib/build/index.cjs +0 -82
- package/dist/lib/build/index.cjs.map +0 -1
- package/dist/lib/build/index.d.cts +0 -41
- package/dist/lib/build/index.d.ts +0 -41
- package/dist/lib/build/index.js +0 -13
- package/dist/lib/build/index.js.map +0 -1
- package/dist/lib/build/rolldown.cjs +0 -14
- package/dist/lib/build/rolldown.cjs.map +0 -1
- package/dist/lib/build/rolldown.d.cts +0 -42
- package/dist/lib/build/rolldown.d.ts +0 -42
- package/dist/lib/build/rolldown.js +0 -5
- package/dist/lib/build/rolldown.js.map +0 -1
- package/dist/lib/build/rollup.cjs +0 -17
- package/dist/lib/build/rollup.cjs.map +0 -1
- package/dist/lib/build/rollup.d.cts +0 -49
- package/dist/lib/build/rollup.d.ts +0 -49
- package/dist/lib/build/rollup.js +0 -4
- package/dist/lib/build/rollup.js.map +0 -1
- package/dist/lib/build/rspack.cjs +0 -13
- package/dist/lib/build/rspack.cjs.map +0 -1
- package/dist/lib/build/rspack.d.cts +0 -42
- package/dist/lib/build/rspack.d.ts +0 -42
- package/dist/lib/build/rspack.js +0 -4
- package/dist/lib/build/rspack.js.map +0 -1
- package/dist/lib/build/tsup.cjs +0 -23
- package/dist/lib/build/tsup.cjs.map +0 -1
- package/dist/lib/build/tsup.d.cts +0 -51
- package/dist/lib/build/tsup.d.ts +0 -51
- package/dist/lib/build/tsup.js +0 -6
- package/dist/lib/build/tsup.js.map +0 -1
- package/dist/lib/build/unbuild.cjs +0 -23
- package/dist/lib/build/unbuild.cjs.map +0 -1
- package/dist/lib/build/unbuild.d.cts +0 -63
- package/dist/lib/build/unbuild.d.ts +0 -63
- package/dist/lib/build/unbuild.js +0 -6
- package/dist/lib/build/unbuild.js.map +0 -1
- package/dist/lib/build/vite.cjs +0 -19
- package/dist/lib/build/vite.cjs.map +0 -1
- package/dist/lib/build/vite.d.cts +0 -43
- package/dist/lib/build/vite.d.ts +0 -43
- package/dist/lib/build/vite.js +0 -6
- package/dist/lib/build/vite.js.map +0 -1
- package/dist/lib/build/webpack.cjs +0 -13
- package/dist/lib/build/webpack.cjs.map +0 -1
- package/dist/lib/build/webpack.d.cts +0 -42
- package/dist/lib/build/webpack.d.ts +0 -42
- package/dist/lib/build/webpack.js +0 -4
- package/dist/lib/build/webpack.js.map +0 -1
- package/dist/lib/chunk-35EO5Y7R.js +0 -50
- package/dist/lib/chunk-35EO5Y7R.js.map +0 -1
- package/dist/lib/chunk-367E23MI.js +0 -48
- 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 +0 -58
- 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 +0 -39
- package/dist/lib/chunk-4XUVP2LL.cjs.map +0 -1
- package/dist/lib/chunk-56LQSSQ3.js +0 -62
- package/dist/lib/chunk-56LQSSQ3.js.map +0 -1
- package/dist/lib/chunk-5PNLONNN.cjs +0 -30
- package/dist/lib/chunk-5PNLONNN.cjs.map +0 -1
- package/dist/lib/chunk-62ZJYXT3.cjs +0 -54
- package/dist/lib/chunk-62ZJYXT3.cjs.map +0 -1
- package/dist/lib/chunk-632PWWU7.cjs +0 -57
- package/dist/lib/chunk-632PWWU7.cjs.map +0 -1
- package/dist/lib/chunk-6BRTJXZ2.js +0 -3333
- package/dist/lib/chunk-6BRTJXZ2.js.map +0 -1
- package/dist/lib/chunk-6IJTWIVJ.cjs +0 -107
- package/dist/lib/chunk-6IJTWIVJ.cjs.map +0 -1
- package/dist/lib/chunk-7EAV6Q7B.cjs +0 -78
- package/dist/lib/chunk-7EAV6Q7B.cjs.map +0 -1
- package/dist/lib/chunk-7LLECRBP.cjs +0 -41
- package/dist/lib/chunk-7LLECRBP.cjs.map +0 -1
- package/dist/lib/chunk-7QVYU63E.js +0 -6
- package/dist/lib/chunk-7QVYU63E.js.map +0 -1
- package/dist/lib/chunk-7R23HVGQ.js +0 -27
- package/dist/lib/chunk-7R23HVGQ.js.map +0 -1
- package/dist/lib/chunk-BEKLDCTV.cjs +0 -95
- package/dist/lib/chunk-BEKLDCTV.cjs.map +0 -1
- package/dist/lib/chunk-BW3VFCTS.cjs +0 -110
- package/dist/lib/chunk-BW3VFCTS.cjs.map +0 -1
- package/dist/lib/chunk-CAPN4FSS.js +0 -152
- package/dist/lib/chunk-CAPN4FSS.js.map +0 -1
- package/dist/lib/chunk-ESYYL5UH.js +0 -105
- package/dist/lib/chunk-ESYYL5UH.js.map +0 -1
- package/dist/lib/chunk-GJNFAFKR.cjs +0 -66
- package/dist/lib/chunk-GJNFAFKR.cjs.map +0 -1
- package/dist/lib/chunk-GWYTWFZE.cjs +0 -72
- 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 +0 -27
- package/dist/lib/chunk-HQ6TGY34.js.map +0 -1
- package/dist/lib/chunk-IK3ABDPP.cjs +0 -64
- package/dist/lib/chunk-IK3ABDPP.cjs.map +0 -1
- package/dist/lib/chunk-JTUL3477.cjs +0 -137
- package/dist/lib/chunk-JTUL3477.cjs.map +0 -1
- package/dist/lib/chunk-KOCDKJDJ.js +0 -96
- package/dist/lib/chunk-KOCDKJDJ.js.map +0 -1
- package/dist/lib/chunk-KSBESEOF.js +0 -169
- package/dist/lib/chunk-KSBESEOF.js.map +0 -1
- package/dist/lib/chunk-LBMMBFQE.js +0 -65
- package/dist/lib/chunk-LBMMBFQE.js.map +0 -1
- package/dist/lib/chunk-LEIOWD2W.js +0 -28
- package/dist/lib/chunk-LEIOWD2W.js.map +0 -1
- package/dist/lib/chunk-LJZEN4HP.cjs +0 -110
- package/dist/lib/chunk-LJZEN4HP.cjs.map +0 -1
- package/dist/lib/chunk-LTVWU4J2.js +0 -47
- package/dist/lib/chunk-LTVWU4J2.js.map +0 -1
- package/dist/lib/chunk-LYD5OTBI.cjs +0 -3362
- package/dist/lib/chunk-LYD5OTBI.cjs.map +0 -1
- package/dist/lib/chunk-MAHHHINV.js +0 -67
- package/dist/lib/chunk-MAHHHINV.js.map +0 -1
- package/dist/lib/chunk-MFC7UJHT.cjs +0 -30
- package/dist/lib/chunk-MFC7UJHT.cjs.map +0 -1
- package/dist/lib/chunk-MGEZC2RV.cjs +0 -69
- package/dist/lib/chunk-MGEZC2RV.cjs.map +0 -1
- package/dist/lib/chunk-MVQSM5WM.cjs +0 -73
- package/dist/lib/chunk-MVQSM5WM.cjs.map +0 -1
- package/dist/lib/chunk-NANLYIUO.cjs +0 -70
- package/dist/lib/chunk-NANLYIUO.cjs.map +0 -1
- package/dist/lib/chunk-NE46WXNJ.js +0 -58
- package/dist/lib/chunk-NE46WXNJ.js.map +0 -1
- package/dist/lib/chunk-ODJBZ6PS.js +0 -39
- package/dist/lib/chunk-ODJBZ6PS.js.map +0 -1
- package/dist/lib/chunk-OF5IJ4WG.js +0 -65
- package/dist/lib/chunk-OF5IJ4WG.js.map +0 -1
- package/dist/lib/chunk-OO4BIM7N.js +0 -98
- 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 +0 -8
- package/dist/lib/chunk-PK6SKIKE.cjs.map +0 -1
- package/dist/lib/chunk-PXSRMP4E.js +0 -39
- package/dist/lib/chunk-PXSRMP4E.js.map +0 -1
- package/dist/lib/chunk-Q2L3FNJO.js +0 -120
- package/dist/lib/chunk-Q2L3FNJO.js.map +0 -1
- package/dist/lib/chunk-Q3KJZ3B5.js +0 -161
- package/dist/lib/chunk-Q3KJZ3B5.js.map +0 -1
- package/dist/lib/chunk-RK2VVGL6.cjs +0 -107
- package/dist/lib/chunk-RK2VVGL6.cjs.map +0 -1
- package/dist/lib/chunk-RLMEYZ5I.cjs +0 -167
- package/dist/lib/chunk-RLMEYZ5I.cjs.map +0 -1
- package/dist/lib/chunk-RQICHHZM.cjs +0 -29
- package/dist/lib/chunk-RQICHHZM.cjs.map +0 -1
- package/dist/lib/chunk-RXQWNSZX.js +0 -37
- package/dist/lib/chunk-RXQWNSZX.js.map +0 -1
- package/dist/lib/chunk-STAKGAWR.js +0 -86
- package/dist/lib/chunk-STAKGAWR.js.map +0 -1
- package/dist/lib/chunk-U36VZLW6.cjs +0 -172
- package/dist/lib/chunk-U36VZLW6.cjs.map +0 -1
- package/dist/lib/chunk-UGRFAVAJ.js +0 -93
- package/dist/lib/chunk-UGRFAVAJ.js.map +0 -1
- package/dist/lib/chunk-UQJWVRRE.cjs +0 -47
- package/dist/lib/chunk-UQJWVRRE.cjs.map +0 -1
- package/dist/lib/chunk-V2T4H24I.js +0 -156
- package/dist/lib/chunk-V2T4H24I.js.map +0 -1
- package/dist/lib/chunk-V5OY4ALI.cjs +0 -56
- package/dist/lib/chunk-V5OY4ALI.cjs.map +0 -1
- package/dist/lib/chunk-VJN72T2O.js +0 -50
- package/dist/lib/chunk-VJN72T2O.js.map +0 -1
- package/dist/lib/chunk-W4OMKQ7W.cjs +0 -128
- 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 +0 -53
- package/dist/lib/chunk-XZD7S5TU.cjs.map +0 -1
- package/dist/lib/chunk-YBIWVB66.js +0 -76
- package/dist/lib/chunk-YBIWVB66.js.map +0 -1
- package/dist/lib/chunk-YF3YHK4X.js +0 -127
- package/dist/lib/chunk-YF3YHK4X.js.map +0 -1
- package/dist/lib/chunk-YVDJCVE5.cjs +0 -160
- package/dist/lib/chunk-YVDJCVE5.cjs.map +0 -1
- package/dist/lib/chunk-ZP7PDTVE.cjs +0 -167
- 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-DnifzkPt.d.ts +0 -1474
- package/dist/lib/config-Ro14HmyO.d.cts +0 -1474
- package/dist/lib/config-file.cjs +0 -17
- package/dist/lib/config-file.cjs.map +0 -1
- package/dist/lib/config-file.d.cts +0 -57
- package/dist/lib/config-file.d.ts +0 -57
- package/dist/lib/config-file.js +0 -4
- package/dist/lib/config-file.js.map +0 -1
- package/dist/lib/create-program.cjs +0 -13
- package/dist/lib/create-program.cjs.map +0 -1
- package/dist/lib/create-program.d.cts +0 -42
- package/dist/lib/create-program.d.ts +0 -42
- package/dist/lib/create-program.js +0 -4
- package/dist/lib/create-program.js.map +0 -1
- package/dist/lib/entry.cjs +0 -41
- package/dist/lib/entry.cjs.map +0 -1
- package/dist/lib/entry.d.cts +0 -69
- package/dist/lib/entry.d.ts +0 -69
- package/dist/lib/entry.js +0 -4
- package/dist/lib/entry.js.map +0 -1
- package/dist/lib/hooks-B6Ow5MtE.d.ts +0 -28
- package/dist/lib/hooks-CM-BbMzz.d.cts +0 -28
- package/dist/lib/index.cjs +0 -281
- package/dist/lib/index.cjs.map +0 -1
- package/dist/lib/index.d.cts +0 -57
- package/dist/lib/index.d.ts +0 -57
- package/dist/lib/index.js +0 -28
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/logger.cjs +0 -17
- package/dist/lib/logger.cjs.map +0 -1
- package/dist/lib/logger.d.cts +0 -51
- package/dist/lib/logger.d.ts +0 -51
- package/dist/lib/logger.js +0 -4
- package/dist/lib/logger.js.map +0 -1
- package/dist/lib/tsconfig-Bz-CiFqD.d.cts +0 -68
- package/dist/lib/tsconfig-Bz-CiFqD.d.ts +0 -68
- package/dist/lib/typescript/compiler-host.cjs +0 -166
- package/dist/lib/typescript/compiler-host.cjs.map +0 -1
- package/dist/lib/typescript/compiler-host.d.cts +0 -64
- package/dist/lib/typescript/compiler-host.d.ts +0 -64
- package/dist/lib/typescript/compiler-host.js +0 -158
- package/dist/lib/typescript/compiler-host.js.map +0 -1
- package/dist/lib/typescript/import-transformer.cjs +0 -51
- package/dist/lib/typescript/import-transformer.cjs.map +0 -1
- package/dist/lib/typescript/import-transformer.d.cts +0 -36
- package/dist/lib/typescript/import-transformer.d.ts +0 -36
- package/dist/lib/typescript/import-transformer.js +0 -49
- package/dist/lib/typescript/import-transformer.js.map +0 -1
- package/dist/lib/typescript/index.cjs +0 -60
- package/dist/lib/typescript/index.cjs.map +0 -1
- package/dist/lib/typescript/index.d.cts +0 -35
- package/dist/lib/typescript/index.d.ts +0 -35
- package/dist/lib/typescript/index.js +0 -7
- package/dist/lib/typescript/index.js.map +0 -1
- package/dist/lib/typescript/isolated-decl.cjs +0 -13
- package/dist/lib/typescript/isolated-decl.cjs.map +0 -1
- package/dist/lib/typescript/isolated-decl.d.cts +0 -11
- package/dist/lib/typescript/isolated-decl.d.ts +0 -11
- package/dist/lib/typescript/isolated-decl.js +0 -4
- package/dist/lib/typescript/isolated-decl.js.map +0 -1
- package/dist/lib/typescript/program.cjs +0 -29
- package/dist/lib/typescript/program.cjs.map +0 -1
- package/dist/lib/typescript/program.d.cts +0 -69
- package/dist/lib/typescript/program.d.ts +0 -69
- package/dist/lib/typescript/program.js +0 -4
- package/dist/lib/typescript/program.js.map +0 -1
- package/dist/lib/typescript/tsconfig.cjs +0 -33
- package/dist/lib/typescript/tsconfig.cjs.map +0 -1
- package/dist/lib/typescript/tsconfig.d.cts +0 -61
- package/dist/lib/typescript/tsconfig.d.ts +0 -61
- package/dist/lib/typescript/tsconfig.js +0 -4
- package/dist/lib/typescript/tsconfig.js.map +0 -1
- package/dist/lib/unplugin/factory.cjs +0 -23
- package/dist/lib/unplugin/factory.cjs.map +0 -1
- package/dist/lib/unplugin/factory.d.cts +0 -200
- package/dist/lib/unplugin/factory.d.ts +0 -200
- package/dist/lib/unplugin/factory.js +0 -14
- package/dist/lib/unplugin/factory.js.map +0 -1
- package/dist/lib/unplugin/index.cjs +0 -33
- package/dist/lib/unplugin/index.cjs.map +0 -1
- package/dist/lib/unplugin/index.d.cts +0 -36
- package/dist/lib/unplugin/index.d.ts +0 -36
- package/dist/lib/unplugin/index.js +0 -16
- package/dist/lib/unplugin/index.js.map +0 -1
- package/dist/lib/unplugin/plugin.cjs +0 -16
- package/dist/lib/unplugin/plugin.cjs.map +0 -1
- package/dist/lib/unplugin/plugin.d.cts +0 -55
- package/dist/lib/unplugin/plugin.d.ts +0 -55
- package/dist/lib/unplugin/plugin.js +0 -7
- package/dist/lib/unplugin/plugin.js.map +0 -1
- package/dist/lib/unplugin/resolve-id.cjs +0 -13
- package/dist/lib/unplugin/resolve-id.cjs.map +0 -1
- package/dist/lib/unplugin/resolve-id.d.cts +0 -60
- package/dist/lib/unplugin/resolve-id.d.ts +0 -60
- package/dist/lib/unplugin/resolve-id.js +0 -4
- package/dist/lib/unplugin/resolve-id.js.map +0 -1
- package/dist/lib/utilities/bundle.cjs +0 -16
- package/dist/lib/utilities/bundle.cjs.map +0 -1
- package/dist/lib/utilities/bundle.d.cts +0 -44
- package/dist/lib/utilities/bundle.d.ts +0 -44
- package/dist/lib/utilities/bundle.js +0 -7
- package/dist/lib/utilities/bundle.js.map +0 -1
- package/dist/lib/utilities/cache.cjs +0 -18
- package/dist/lib/utilities/cache.cjs.map +0 -1
- package/dist/lib/utilities/cache.d.cts +0 -7
- package/dist/lib/utilities/cache.d.ts +0 -7
- package/dist/lib/utilities/cache.js +0 -5
- package/dist/lib/utilities/cache.js.map +0 -1
- package/dist/lib/utilities/file-header.cjs +0 -17
- package/dist/lib/utilities/file-header.cjs.map +0 -1
- package/dist/lib/utilities/file-header.d.cts +0 -42
- package/dist/lib/utilities/file-header.d.ts +0 -42
- package/dist/lib/utilities/file-header.js +0 -4
- package/dist/lib/utilities/file-header.js.map +0 -1
- package/dist/lib/utilities/index.cjs +0 -159
- package/dist/lib/utilities/index.cjs.map +0 -1
- package/dist/lib/utilities/index.d.cts +0 -45
- package/dist/lib/utilities/index.d.ts +0 -45
- package/dist/lib/utilities/index.js +0 -18
- package/dist/lib/utilities/index.js.map +0 -1
- package/dist/lib/utilities/meta.cjs +0 -37
- package/dist/lib/utilities/meta.cjs.map +0 -1
- package/dist/lib/utilities/meta.d.cts +0 -68
- package/dist/lib/utilities/meta.d.ts +0 -68
- package/dist/lib/utilities/meta.js +0 -4
- package/dist/lib/utilities/meta.js.map +0 -1
- package/dist/lib/utilities/plugin-helpers.cjs +0 -61
- package/dist/lib/utilities/plugin-helpers.cjs.map +0 -1
- package/dist/lib/utilities/plugin-helpers.d.cts +0 -153
- package/dist/lib/utilities/plugin-helpers.d.ts +0 -153
- package/dist/lib/utilities/plugin-helpers.js +0 -4
- package/dist/lib/utilities/plugin-helpers.js.map +0 -1
- package/dist/lib/utilities/resolve-path.cjs +0 -13
- package/dist/lib/utilities/resolve-path.cjs.map +0 -1
- package/dist/lib/utilities/resolve-path.d.cts +0 -43
- package/dist/lib/utilities/resolve-path.d.ts +0 -43
- package/dist/lib/utilities/resolve-path.js +0 -4
- package/dist/lib/utilities/resolve-path.js.map +0 -1
- package/dist/lib/utilities/resolve.cjs +0 -17
- package/dist/lib/utilities/resolve.cjs.map +0 -1
- package/dist/lib/utilities/resolve.d.cts +0 -44
- package/dist/lib/utilities/resolve.d.ts +0 -44
- package/dist/lib/utilities/resolve.js +0 -8
- package/dist/lib/utilities/resolve.js.map +0 -1
- package/dist/lib/utilities/source-file.cjs +0 -21
- package/dist/lib/utilities/source-file.cjs.map +0 -1
- package/dist/lib/utilities/source-file.d.cts +0 -28
- package/dist/lib/utilities/source-file.d.ts +0 -28
- package/dist/lib/utilities/source-file.js +0 -4
- package/dist/lib/utilities/source-file.js.map +0 -1
- package/dist/lib/utilities/source-map.cjs +0 -13
- package/dist/lib/utilities/source-map.cjs.map +0 -1
- package/dist/lib/utilities/source-map.d.cts +0 -14
- package/dist/lib/utilities/source-map.d.ts +0 -14
- package/dist/lib/utilities/source-map.js +0 -4
- package/dist/lib/utilities/source-map.js.map +0 -1
- package/dist/lib/utilities/worker.cjs +0 -18
- package/dist/lib/utilities/worker.cjs.map +0 -1
- package/dist/lib/utilities/worker.d.cts +0 -58
- package/dist/lib/utilities/worker.d.ts +0 -58
- package/dist/lib/utilities/worker.js +0 -5
- package/dist/lib/utilities/worker.js.map +0 -1
- package/dist/lib/utilities/write-file.cjs +0 -13
- package/dist/lib/utilities/write-file.cjs.map +0 -1
- package/dist/lib/utilities/write-file.d.cts +0 -44
- package/dist/lib/utilities/write-file.d.ts +0 -44
- package/dist/lib/utilities/write-file.js +0 -4
- package/dist/lib/utilities/write-file.js.map +0 -1
- package/dist/next.js +0 -10
- package/dist/nuxt.d.ts +0 -20
- package/dist/nuxt.js +0 -12
- package/dist/resolved-DtY60yLh.d.cts +0 -1351
- package/dist/resolved-wPXZS7aW.d.ts +0 -1351
- package/dist/rolldown.d.ts +0 -57
- package/dist/rolldown.js +0 -9
- package/dist/rollup.d.ts +0 -57
- package/dist/rollup.js +0 -9
- package/dist/rspack.d.ts +0 -57
- package/dist/rspack.js +0 -9
- package/dist/tsup.js +0 -11
- package/dist/types/babel.cjs +0 -6
- package/dist/types/babel.cjs.map +0 -1
- package/dist/types/babel.d.cts +0 -38
- package/dist/types/babel.d.ts +0 -38
- package/dist/types/babel.js +0 -3
- package/dist/types/babel.js.map +0 -1
- package/dist/types/build.cjs +0 -6
- package/dist/types/build.cjs.map +0 -1
- package/dist/types/build.d.cts +0 -111
- package/dist/types/build.d.ts +0 -111
- package/dist/types/build.js +0 -3
- package/dist/types/build.js.map +0 -1
- package/dist/types/commands.cjs +0 -13
- package/dist/types/commands.cjs.map +0 -1
- package/dist/types/commands.d.cts +0 -38
- package/dist/types/commands.d.ts +0 -38
- package/dist/types/commands.js +0 -4
- 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 +0 -6
- package/dist/types/config.cjs.map +0 -1
- package/dist/types/config.d.cts +0 -38
- package/dist/types/config.d.ts +0 -38
- package/dist/types/config.js +0 -3
- package/dist/types/config.js.map +0 -1
- package/dist/types/context.cjs +0 -13
- package/dist/types/context.cjs.map +0 -1
- package/dist/types/context.d.cts +0 -38
- package/dist/types/context.d.ts +0 -38
- package/dist/types/context.js +0 -4
- package/dist/types/context.js.map +0 -1
- package/dist/types/hooks.cjs +0 -6
- package/dist/types/hooks.cjs.map +0 -1
- package/dist/types/hooks.d.cts +0 -38
- package/dist/types/hooks.d.ts +0 -38
- package/dist/types/hooks.js +0 -3
- package/dist/types/hooks.js.map +0 -1
- package/dist/types/index.cjs +0 -58
- package/dist/types/index.cjs.map +0 -1
- package/dist/types/index.d.cts +0 -42
- package/dist/types/index.d.ts +0 -42
- package/dist/types/index.js +0 -17
- package/dist/types/index.js.map +0 -1
- package/dist/types/internal.cjs +0 -4
- package/dist/types/internal.cjs.map +0 -1
- package/dist/types/internal.d.cts +0 -61
- package/dist/types/internal.d.ts +0 -61
- package/dist/types/internal.js +0 -3
- package/dist/types/internal.js.map +0 -1
- package/dist/types/plugin.cjs +0 -13
- package/dist/types/plugin.cjs.map +0 -1
- package/dist/types/plugin.d.cts +0 -38
- package/dist/types/plugin.d.ts +0 -38
- package/dist/types/plugin.js +0 -4
- package/dist/types/plugin.js.map +0 -1
- package/dist/types/resolved.cjs +0 -6
- package/dist/types/resolved.cjs.map +0 -1
- package/dist/types/resolved.d.cts +0 -38
- package/dist/types/resolved.d.ts +0 -38
- package/dist/types/resolved.js +0 -3
- package/dist/types/resolved.js.map +0 -1
- package/dist/types/tsconfig.cjs +0 -6
- package/dist/types/tsconfig.cjs.map +0 -1
- package/dist/types/tsconfig.d.cts +0 -75
- package/dist/types/tsconfig.d.ts +0 -75
- package/dist/types/tsconfig.js +0 -3
- package/dist/types/tsconfig.js.map +0 -1
- package/dist/types/typedoc.cjs +0 -6
- package/dist/types/typedoc.cjs.map +0 -1
- package/dist/types/typedoc.d.cts +0 -25
- package/dist/types/typedoc.d.ts +0 -25
- package/dist/types/typedoc.js +0 -3
- package/dist/types/typedoc.js.map +0 -1
- package/dist/types/unplugin.cjs +0 -6
- package/dist/types/unplugin.cjs.map +0 -1
- package/dist/types/unplugin.d.cts +0 -54
- package/dist/types/unplugin.d.ts +0 -54
- package/dist/types/unplugin.js +0 -3
- package/dist/types/unplugin.js.map +0 -1
- package/dist/types/vfs.cjs +0 -33
- package/dist/types/vfs.cjs.map +0 -1
- package/dist/types/vfs.d.cts +0 -408
- package/dist/types/vfs.d.ts +0 -408
- package/dist/types/vfs.js +0 -4
- package/dist/types/vfs.js.map +0 -1
- package/dist/unloader.d.ts +0 -56
- package/dist/unloader.js +0 -9
- package/dist/unplugin.d.ts +0 -77
- package/dist/unplugin.js +0 -21
- package/dist/vite.d.ts +0 -57
- package/dist/vite.js +0 -10
- package/dist/webpack.d.ts +0 -57
- package/dist/webpack.js +0 -9
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk632PWWU7_cjs = require('./chunk-632PWWU7.cjs');
|
|
4
|
-
var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
|
|
5
|
-
var types = require('@storm-software/config-tools/types');
|
|
6
|
-
var filePathFns = require('@stryke/path/file-path-fns');
|
|
7
|
-
var defu = require('defu');
|
|
8
|
-
var jestWorker = require('jest-worker');
|
|
9
|
-
var stream = require('stream');
|
|
10
|
-
|
|
11
|
-
var RESTARTED = Symbol("restarted");
|
|
12
|
-
var cleanupWorkers = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((worker) => {
|
|
13
|
-
for (const curWorker of worker._workerPool?._workers || []) {
|
|
14
|
-
curWorker._child?.kill("SIGINT");
|
|
15
|
-
}
|
|
16
|
-
}, "cleanupWorkers");
|
|
17
|
-
var Worker = class {
|
|
18
|
-
static {
|
|
19
|
-
chunkPK6SKIKE_cjs.__name(this, "Worker");
|
|
20
|
-
}
|
|
21
|
-
workerPath;
|
|
22
|
-
options;
|
|
23
|
-
#worker;
|
|
24
|
-
#log;
|
|
25
|
-
constructor(workerPath, options) {
|
|
26
|
-
this.workerPath = workerPath;
|
|
27
|
-
this.options = options;
|
|
28
|
-
const { timeout, onRestart, name, context, ...farmOptions } = this.options;
|
|
29
|
-
this.#log = chunk632PWWU7_cjs.createLog(name || workerPath);
|
|
30
|
-
let restartPromise;
|
|
31
|
-
let resolveRestartPromise;
|
|
32
|
-
let activeTasks = 0;
|
|
33
|
-
this.#worker = void 0;
|
|
34
|
-
process.on("exit", () => {
|
|
35
|
-
this.close();
|
|
36
|
-
});
|
|
37
|
-
const createWorker2 = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(() => {
|
|
38
|
-
this.#worker = new jestWorker.Worker(workerPath, {
|
|
39
|
-
...farmOptions,
|
|
40
|
-
forkOptions: {
|
|
41
|
-
...farmOptions.forkOptions,
|
|
42
|
-
env: {
|
|
43
|
-
...farmOptions.forkOptions?.env ?? {},
|
|
44
|
-
...process.env,
|
|
45
|
-
POWERLINES_LOCAL: process.env.POWERLINES_LOCAL || "0"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
maxRetries: 0
|
|
49
|
-
});
|
|
50
|
-
restartPromise = new Promise((resolve) => {
|
|
51
|
-
resolveRestartPromise = resolve;
|
|
52
|
-
});
|
|
53
|
-
if (!farmOptions.enableWorkerThreads) {
|
|
54
|
-
for (const worker of this.#worker._workerPool?._workers || []) {
|
|
55
|
-
worker._child?.on("exit", (code, signal) => {
|
|
56
|
-
if ((code || signal && signal !== "SIGINT") && this.#worker) {
|
|
57
|
-
this.#log(types.LogLevelLabel.ERROR, `${this.options.name} worker exited with code: ${code} and signal: ${signal}`);
|
|
58
|
-
process.exit(code ?? 1);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
worker._child?.on("message", ([, data]) => {
|
|
62
|
-
if (data && typeof data === "object" && "type" in data && data.type === "activity") {
|
|
63
|
-
onActivity();
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
let aborted = false;
|
|
69
|
-
const onActivityAbort = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(() => {
|
|
70
|
-
if (!aborted) {
|
|
71
|
-
this.options.onActivityAbort?.();
|
|
72
|
-
aborted = true;
|
|
73
|
-
}
|
|
74
|
-
}, "onActivityAbort");
|
|
75
|
-
const abortActivityStreamOnLog = new stream.Transform({
|
|
76
|
-
transform(_chunk, _encoding, callback) {
|
|
77
|
-
onActivityAbort();
|
|
78
|
-
callback();
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
this.#worker.getStdout().pipe(abortActivityStreamOnLog);
|
|
82
|
-
this.#worker.getStderr().pipe(abortActivityStreamOnLog);
|
|
83
|
-
this.#worker.getStdout().pipe(process.stdout);
|
|
84
|
-
this.#worker.getStderr().pipe(process.stderr);
|
|
85
|
-
}, "createWorker");
|
|
86
|
-
createWorker2();
|
|
87
|
-
const onHanging = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(() => {
|
|
88
|
-
const worker = this.#worker;
|
|
89
|
-
if (!worker) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const resolve = resolveRestartPromise;
|
|
93
|
-
createWorker2();
|
|
94
|
-
this.#log(types.LogLevelLabel.WARN, `Sending SIGTERM signal to static worker due to timeout${timeout ? ` of ${timeout / 1e3} seconds` : ""}. Subsequent errors may be a result of the worker exiting.`);
|
|
95
|
-
void worker.end().then(() => {
|
|
96
|
-
resolve(RESTARTED);
|
|
97
|
-
});
|
|
98
|
-
}, "onHanging");
|
|
99
|
-
let hangingTimer = false;
|
|
100
|
-
const onActivity = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(() => {
|
|
101
|
-
if (hangingTimer) {
|
|
102
|
-
clearTimeout(hangingTimer);
|
|
103
|
-
}
|
|
104
|
-
if (this.options.onActivity) {
|
|
105
|
-
this.options.onActivity();
|
|
106
|
-
}
|
|
107
|
-
hangingTimer = activeTasks > 0 && setTimeout(onHanging, timeout);
|
|
108
|
-
}, "onActivity");
|
|
109
|
-
for (const method of farmOptions.exposedMethods) {
|
|
110
|
-
if (method.startsWith("_")) {
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
this[method] = timeout ? async (...args) => {
|
|
114
|
-
activeTasks++;
|
|
115
|
-
try {
|
|
116
|
-
let attempts = 0;
|
|
117
|
-
for (; ; ) {
|
|
118
|
-
onActivity();
|
|
119
|
-
const params = defu.defu(args.length > 0 && args[0] ? args[0] : {}, context ?? {});
|
|
120
|
-
const result = await Promise.race([
|
|
121
|
-
// eslint-disable-next-line ts/no-unsafe-call
|
|
122
|
-
this.#worker[method](...params),
|
|
123
|
-
restartPromise
|
|
124
|
-
]);
|
|
125
|
-
if (result !== RESTARTED) {
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
if (onRestart) {
|
|
129
|
-
onRestart(method, args, ++attempts);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
} finally {
|
|
133
|
-
activeTasks--;
|
|
134
|
-
onActivity();
|
|
135
|
-
}
|
|
136
|
-
} : this.#worker[method].bind(this.#worker);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
async end() {
|
|
140
|
-
const worker = this.#worker;
|
|
141
|
-
if (!worker) {
|
|
142
|
-
throw new Error("Farm is ended, no more calls can be done to it");
|
|
143
|
-
}
|
|
144
|
-
cleanupWorkers(worker);
|
|
145
|
-
this.#worker = void 0;
|
|
146
|
-
return worker.end();
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Quietly end the worker if it exists
|
|
150
|
-
*/
|
|
151
|
-
close() {
|
|
152
|
-
if (this.#worker) {
|
|
153
|
-
cleanupWorkers(this.#worker);
|
|
154
|
-
void this.#worker.end();
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
function createWorker(workerPath, exposedMethods, numWorkers = 1) {
|
|
159
|
-
return new Worker(workerPath, {
|
|
160
|
-
name: filePathFns.findFileName(workerPath, {
|
|
161
|
-
withExtension: false
|
|
162
|
-
}),
|
|
163
|
-
exposedMethods,
|
|
164
|
-
numWorkers
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
chunkPK6SKIKE_cjs.__name(createWorker, "createWorker");
|
|
168
|
-
|
|
169
|
-
exports.Worker = Worker;
|
|
170
|
-
exports.createWorker = createWorker;
|
|
171
|
-
//# sourceMappingURL=chunk-U36VZLW6.cjs.map
|
|
172
|
-
//# sourceMappingURL=chunk-U36VZLW6.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utilities/worker.ts"],"names":["RESTARTED","Symbol","cleanupWorkers","worker","curWorker","_workerPool","_workers","_child","kill","Worker","workerPath","options","timeout","onRestart","name","context","farmOptions","createLog","restartPromise","resolveRestartPromise","activeTasks","undefined","process","on","close","createWorker","__name","JestWorker","forkOptions","env","POWERLINES_LOCAL","maxRetries","Promise","resolve","enableWorkerThreads","code","signal","LogLevelLabel","ERROR","exit","data","type","onActivity","aborted","onActivityAbort","abortActivityStreamOnLog","Transform","transform","_chunk","_encoding","callback","getStdout","pipe","getStderr","stdout","stderr","onHanging","WARN","end","then","hangingTimer","clearTimeout","setTimeout","method","exposedMethods","startsWith","args","attempts","params","defu","length","result","race","bind","Error","numWorkers","findFileName","withExtension"],"mappings":";;;;;;;;;;AAuCA,IAAMA,SAAAA,GAAYC,OAAO,WAAA,CAAA;AAEzB,IAAMC,cAAAA,6CAAkBC,MAAAA,KAAAA;AACtB,EAAA,KAAA,MAAWC,SAAAA,IAAeD,MAAAA,CAAeE,WAAAA,EAAaC,QAAAA,IAAY,EAAA,EAE7D;AACHF,IAAAA,SAAAA,CAAUG,MAAAA,EAAQC,KAAK,QAAA,CAAA;AACzB,EAAA;AACF,CAAA,EANuB,gBAAA,CAAA;AAQhB,IAAMC,SAAN,MAAMA;E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AA,SAAA;AACE/C,UAAAA,WAAAA,EAAAA;AACAsB,UAAAA,UAAAA,EAAAA;AACF,QAAA;AACF,MAAA,CAAA,GAEC,KAAK,OAAA,CAAgBqB,MAAAA,CAAAA,CAAQU,IAAAA,CAAK,KAAK,OAAO,CAAA;AACrD,IAAA;AACF,EAAA;AAEA,EAAA,MAAaf,GAAAA,GAAqC;AAChD,IAAA,MAAMvD,SAAS,IAAA,CAAK,OAAA;AACpB,IAAA,IAAI,CAACA,MAAAA,EAAQ;AACX,MAAA,MAAM,IAAIuE,MAAM,gDAAA,CAAA;AAClB,IAAA;AAEAxE,IAAAA,cAAAA,CAAeC,MAAAA,CAAAA;AACf,IAAA,IAAA,CAAK,OAAA,GAAUkB,MAAAA;AACf,IAAA,OAAOlB,OAAOuD,GAAAA,EAAG;AACnB,EAAA;;;;EAKOlC,KAAAA,GAAc;AACnB,IAAA,IAAI,KAAK,OAAA,EAAS;AAChBtB,MAAAA,cAAAA,CAAe,KAAK,OAAO,CAAA;AAC3B,MAAA,KAAK,IAAA,CAAK,QAAQwD,GAAAA,EAAG;AACvB,IAAA;AACF,EAAA;AACF;AAEO,SAASjC,YAAAA,CAGdf,UAAAA,EACAsD,cAAAA,EACAW,UAAAA,GAAa,CAAA,EAAC;AAEd,EAAA,OAAO,IAAIlE,OAAOC,UAAAA,EAAY;AAC5BI,IAAAA,IAAAA,EAAM8D,yBAAalE,UAAAA,EAAY;MAC7BmE,aAAAA,EAAe;KACjB,CAAA;AACAb,IAAAA,cAAAA;AACAW,IAAAA;GACF,CAAA;AACF;AAdgBlD,wBAAAA,CAAAA,YAAAA,EAAAA,cAAAA,CAAAA","file":"chunk-U36VZLW6.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { defu } from \"defu\";\nimport { Worker as JestWorker } from \"jest-worker\";\nimport type { ChildProcess } from \"node:child_process\";\nimport { Transform } from \"node:stream\";\nimport { LogFn } from \"../../types/config\";\nimport { WorkerProcess } from \"../../types/context\";\nimport { createLog } from \"../logger\";\n\nexport type WorkerOptions = ConstructorParameters<typeof JestWorker>[1] & {\n name?: string;\n timeout?: number;\n onActivity?: () => void;\n onActivityAbort?: () => void;\n onRestart?: (method: string, args: any[], attempts: number) => void;\n exposedMethods: ReadonlyArray<string>;\n enableWorkerThreads?: boolean;\n context?: Record<string, any>;\n};\n\nconst RESTARTED = Symbol(\"restarted\");\n\nconst cleanupWorkers = (worker: JestWorker) => {\n for (const curWorker of ((worker as any)._workerPool?._workers || []) as {\n _child?: ChildProcess;\n }[]) {\n curWorker._child?.kill(\"SIGINT\");\n }\n};\n\nexport class Worker {\n #worker: JestWorker | undefined;\n\n #log: LogFn;\n\n public constructor(\n protected workerPath: string,\n protected options: WorkerOptions\n ) {\n const { timeout, onRestart, name, context, ...farmOptions } = this.options;\n\n this.#log = createLog(name || workerPath);\n\n let restartPromise: Promise<typeof RESTARTED>;\n let resolveRestartPromise: (arg: typeof RESTARTED) => void;\n let activeTasks = 0;\n\n this.#worker = undefined;\n\n // ensure we end workers if they weren't before exit\n process.on(\"exit\", () => {\n this.close();\n });\n\n const createWorker = () => {\n this.#worker = new JestWorker(workerPath, {\n ...farmOptions,\n forkOptions: {\n ...farmOptions.forkOptions,\n env: {\n ...((farmOptions.forkOptions?.env ?? {}) as any),\n ...process.env,\n POWERLINES_LOCAL: process.env.POWERLINES_LOCAL || \"0\"\n }\n },\n maxRetries: 0\n });\n restartPromise = new Promise(resolve => {\n resolveRestartPromise = resolve;\n });\n\n /**\n * Jest Worker has two worker types, ChildProcessWorker (uses child_process) and NodeThreadWorker (uses worker_threads)\n * Powerlines uses ChildProcessWorker by default, but it can be switched to NodeThreadWorker with an experimental flag\n *\n * We only want to handle ChildProcessWorker's orphan process issue, so we access the private property \"_child\":\n * https://github.com/facebook/jest/blob/b38d7d345a81d97d1dc3b68b8458b1837fbf19be/packages/jest-worker/src/workers/ChildProcessWorker.ts\n *\n * But this property is not available in NodeThreadWorker, so we need to check if we are using ChildProcessWorker\n */\n if (!farmOptions.enableWorkerThreads) {\n for (const worker of ((this.#worker as any)._workerPool?._workers ||\n []) as {\n _child?: ChildProcess;\n }[]) {\n worker._child?.on(\"exit\", (code, signal) => {\n if ((code || (signal && signal !== \"SIGINT\")) && this.#worker) {\n this.#log(\n LogLevelLabel.ERROR,\n `${this.options.name} worker exited with code: ${code} and signal: ${signal}`\n );\n\n // if a child process doesn't exit gracefully, we want to bubble up the exit code to the parent process\n process.exit(code ?? 1);\n }\n });\n\n // if a child process emits a particular message, we track that as activity\n // so the parent process can keep track of progress\n worker._child?.on(\"message\", ([, data]: [number, unknown]) => {\n if (\n data &&\n typeof data === \"object\" &&\n \"type\" in data &&\n data.type === \"activity\"\n ) {\n // eslint-disable-next-line ts/no-use-before-define\n onActivity();\n }\n });\n }\n }\n\n let aborted = false;\n const onActivityAbort = () => {\n if (!aborted) {\n this.options.onActivityAbort?.();\n aborted = true;\n }\n };\n\n // Listen to the worker's stdout and stderr, if there's any thing logged, abort the activity first\n const abortActivityStreamOnLog = new Transform({\n transform(_chunk, _encoding, callback) {\n onActivityAbort();\n callback();\n }\n });\n // Stop the activity if there's any output from the worker\n this.#worker.getStdout().pipe(abortActivityStreamOnLog);\n this.#worker.getStderr().pipe(abortActivityStreamOnLog);\n\n // Pipe the worker's stdout and stderr to the parent process\n this.#worker.getStdout().pipe(process.stdout);\n this.#worker.getStderr().pipe(process.stderr);\n };\n createWorker();\n\n const onHanging = () => {\n const worker = this.#worker;\n if (!worker) {\n return;\n }\n\n const resolve = resolveRestartPromise;\n createWorker();\n\n this.#log(\n LogLevelLabel.WARN,\n `Sending SIGTERM signal to static worker due to timeout${\n timeout ? ` of ${timeout / 1000} seconds` : \"\"\n }. Subsequent errors may be a result of the worker exiting.`\n );\n\n void worker.end().then(() => {\n resolve(RESTARTED);\n });\n };\n\n let hangingTimer: NodeJS.Timeout | false = false;\n\n const onActivity = () => {\n if (hangingTimer) {\n clearTimeout(hangingTimer);\n }\n if (this.options.onActivity) {\n this.options.onActivity();\n }\n\n hangingTimer = activeTasks > 0 && setTimeout(onHanging, timeout);\n };\n\n for (const method of farmOptions.exposedMethods) {\n if (method.startsWith(\"_\")) {\n continue;\n }\n\n (this as any)[method] = timeout\n ? async (...args: any[]) => {\n activeTasks++;\n try {\n let attempts = 0;\n for (;;) {\n onActivity();\n\n const params = defu(\n args.length > 0 && args[0] ? args[0] : {},\n context ?? {}\n );\n\n const result = await Promise.race([\n // eslint-disable-next-line ts/no-unsafe-call\n (this.#worker as any)[method](...params),\n restartPromise\n ]);\n if (result !== RESTARTED) {\n return result;\n }\n if (onRestart) {\n onRestart(method, args, ++attempts);\n }\n }\n } finally {\n activeTasks--;\n onActivity();\n }\n }\n : // eslint-disable-next-line ts/no-unsafe-call\n (this.#worker as any)[method].bind(this.#worker);\n }\n }\n\n public async end(): ReturnType<JestWorker[\"end\"]> {\n const worker = this.#worker;\n if (!worker) {\n throw new Error(\"Farm is ended, no more calls can be done to it\");\n }\n\n cleanupWorkers(worker);\n this.#worker = undefined;\n return worker.end();\n }\n\n /**\n * Quietly end the worker if it exists\n */\n public close(): void {\n if (this.#worker) {\n cleanupWorkers(this.#worker);\n void this.#worker.end();\n }\n }\n}\n\nexport function createWorker<\n TExposedMethods extends ReadonlyArray<string> = ReadonlyArray<string>\n>(\n workerPath: string,\n exposedMethods: TExposedMethods,\n numWorkers = 1\n): WorkerProcess<TExposedMethods> {\n return new Worker(workerPath, {\n name: findFileName(workerPath, {\n withExtension: false\n }),\n exposedMethods,\n numWorkers\n }) as WorkerProcess<TExposedMethods>;\n}\n"]}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-7QVYU63E.js';
|
|
2
|
-
import { isFunction } from '@stryke/type-checks/is-function';
|
|
3
|
-
import { isSetObject } from '@stryke/type-checks/is-set-object';
|
|
4
|
-
import { isSetString } from '@stryke/type-checks/is-set-string';
|
|
5
|
-
import { isUndefined } from '@stryke/type-checks/is-undefined';
|
|
6
|
-
|
|
7
|
-
// src/types/commands.ts
|
|
8
|
-
var SUPPORTED_COMMANDS = [
|
|
9
|
-
"new",
|
|
10
|
-
"clean",
|
|
11
|
-
"prepare",
|
|
12
|
-
"lint",
|
|
13
|
-
"test",
|
|
14
|
-
"build",
|
|
15
|
-
"docs",
|
|
16
|
-
"release",
|
|
17
|
-
"finalize"
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
// src/lib/utilities/plugin-helpers.ts
|
|
21
|
-
function isPlugin(value) {
|
|
22
|
-
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)));
|
|
23
|
-
}
|
|
24
|
-
__name(isPlugin, "isPlugin");
|
|
25
|
-
function isPluginConfigObject(value) {
|
|
26
|
-
return isSetObject(value) && "plugin" in value && ((isSetString(value.plugin) || isFunction(value.plugin)) && "options" in value && isSetObject(value.options) || isPlugin(value.plugin));
|
|
27
|
-
}
|
|
28
|
-
__name(isPluginConfigObject, "isPluginConfigObject");
|
|
29
|
-
function isPluginConfigTuple(value) {
|
|
30
|
-
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]));
|
|
31
|
-
}
|
|
32
|
-
__name(isPluginConfigTuple, "isPluginConfigTuple");
|
|
33
|
-
function isPluginConfig(value) {
|
|
34
|
-
return isSetString(value) || isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
|
|
35
|
-
}
|
|
36
|
-
__name(isPluginConfig, "isPluginConfig");
|
|
37
|
-
function isPluginHookFunction(value) {
|
|
38
|
-
return isFunction(value) || isSetObject(value) && "handler" in value && isFunction(value.handler);
|
|
39
|
-
}
|
|
40
|
-
__name(isPluginHookFunction, "isPluginHookFunction");
|
|
41
|
-
function isPluginHookObject(value) {
|
|
42
|
-
return isSetObject(value) && "handler" in value && isFunction(value.handler);
|
|
43
|
-
}
|
|
44
|
-
__name(isPluginHookObject, "isPluginHookObject");
|
|
45
|
-
function isPluginHook(value) {
|
|
46
|
-
return isPluginHookFunction(value) || isPluginHookObject(value);
|
|
47
|
-
}
|
|
48
|
-
__name(isPluginHook, "isPluginHook");
|
|
49
|
-
function getHookHandler(pluginHook) {
|
|
50
|
-
return isFunction(pluginHook) ? pluginHook : pluginHook.handler;
|
|
51
|
-
}
|
|
52
|
-
__name(getHookHandler, "getHookHandler");
|
|
53
|
-
function extractPluginHook(context, plugin, hook) {
|
|
54
|
-
const pluginHook = plugin[hook];
|
|
55
|
-
if (!isPluginHook(pluginHook)) {
|
|
56
|
-
return void 0;
|
|
57
|
-
}
|
|
58
|
-
return isFunction(pluginHook) ? {
|
|
59
|
-
normal: pluginHook.bind(context)
|
|
60
|
-
} : {
|
|
61
|
-
[pluginHook.order ? pluginHook.order : "normal"]: pluginHook.handler.bind(context)
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
__name(extractPluginHook, "extractPluginHook");
|
|
65
|
-
function isHookExternal(hook) {
|
|
66
|
-
return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
|
|
67
|
-
}
|
|
68
|
-
__name(isHookExternal, "isHookExternal");
|
|
69
|
-
function isHookInternal(hook) {
|
|
70
|
-
return !isHookExternal(hook);
|
|
71
|
-
}
|
|
72
|
-
__name(isHookInternal, "isHookInternal");
|
|
73
|
-
function checkDedupe(plugin, plugins) {
|
|
74
|
-
return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
|
|
75
|
-
}
|
|
76
|
-
__name(checkDedupe, "checkDedupe");
|
|
77
|
-
function addPluginHook(context, plugin, pluginHook, hooksList) {
|
|
78
|
-
if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
|
|
79
|
-
hooksList.push(isFunction(pluginHook) ? {
|
|
80
|
-
plugin,
|
|
81
|
-
handler: getHookHandler(pluginHook).bind(context)
|
|
82
|
-
} : {
|
|
83
|
-
plugin,
|
|
84
|
-
...pluginHook,
|
|
85
|
-
handler: getHookHandler(pluginHook).bind(context)
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
__name(addPluginHook, "addPluginHook");
|
|
90
|
-
|
|
91
|
-
export { addPluginHook, checkDedupe, extractPluginHook, getHookHandler, isHookExternal, isHookInternal, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookFunction, isPluginHookObject };
|
|
92
|
-
//# sourceMappingURL=chunk-UGRFAVAJ.js.map
|
|
93
|
-
//# sourceMappingURL=chunk-UGRFAVAJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/commands.ts","../../src/lib/utilities/plugin-helpers.ts"],"names":["SUPPORTED_COMMANDS","isPlugin","value","isSetObject","isSetString","name","isUndefined","applyToEnvironment","isFunction","dedupe","dependsOn","Array","isArray","every","isPluginConfig","command","handler","isPluginConfigObject","plugin","options","isPluginConfigTuple","length","isPluginHookFunction","isPluginHookObject","isPluginHook","getHookHandler","pluginHook","extractPluginHook","context","hook","undefined","normal","bind","order","isHookExternal","startsWith","isHookInternal","checkDedupe","plugins","some","p","addPluginHook","hooksList","map","push"],"mappings":";;;;;;;AAsBO,IAAMA,kBAAAA,GAAqB;AAChC,EAAA,KAAA;AACA,EAAA,OAAA;AACA,EAAA,SAAA;AACA,EAAA,MAAA;AACA,EAAA,MAAA;AACA,EAAA,OAAA;AACA,EAAA,MAAA;AACA,EAAA,SAAA;AACA,EAAA;;;;ACcK,SAASC,SAEdC,KAAAA,EAAc;AACd,EAAA,OACEC,WAAAA,CAAYD,KAAAA,CAAAA,IACZ,MAAA,IAAUA,SACVE,WAAAA,CAAYF,KAAAA,CAAMG,IAAI,CAAA,KACrBC,YACEJ,KAAAA,CAAiDK,kBAAkB,CAAA,IAEnE,oBAAA,IAAwBL,SACvBM,UAAAA,CAAWN,KAAAA,CAAMK,kBAAkB,CAAA,CAAA,KACtCD,YAAaJ,KAAAA,CAAiDO,MAAM,CAAA,IAClE,QAAA,IAAYP,SAASM,UAAAA,CAAWN,KAAAA,CAAMO,MAAM,CAAA,CAAA,KAC9CH,YAAaJ,KAAAA,CAAiDQ,SAAS,CAAA,IACrE,WAAA,IAAeR,SACdS,KAAAA,CAAMC,OAAAA,CAAQV,KAAAA,CAAMQ,SAAS,KAC7BR,KAAAA,CAAMQ,SAAAA,CAAUG,KAAAA,CAAMC,cAAAA,MAC1Bd,kBAAAA,CAAmBa,KAAAA,CACjBE,CAAAA,OAAAA,KACET,YACGJ,KAAAA,CAAiDa,OAAAA,CAAQ,CAAA,IAE3DA,WAAWb,KAAAA,KACTM,UAAAA,CAAYN,KAAAA,CAA8Ba,OAAAA,CAAQ,CAAA,IAChDZ,WAAAA,CAAaD,KAAAA,CAA8Ba,OAAAA,CAAQ,CAAA,IAClD,SAA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V,MAAAA,EACAQ,UAAAA,EACAgB,SAAAA,EAAgE;AAEhE,EAAA,IACE,CAACL,WAAAA,CACCnB,MAAAA,EACAwB,SAAAA,CAAUC,GAAAA,CAAId,CAAAA,IAAAA,KAAQA,IAAAA,CAAKX,MAAM,CAAA,CAAA,EAEnC;AACAwB,IAAAA,SAAAA,CAAUE,IAAAA,CACRpC,UAAAA,CAAWkB,UAAAA,CAAAA,GACP;AACER,MAAAA,MAAAA;AACAF,MAAAA,OAAAA,EAASS,cAAAA,CAAeC,UAAAA,CAAAA,CAAYM,IAAAA,CAAKJ,OAAAA;KAC3C,GACA;AACEV,MAAAA,MAAAA;MACA,GAAGQ,UAAAA;AACHV,MAAAA,OAAAA,EAASS,cAAAA,CAAeC,UAAAA,CAAAA,CAAYM,IAAAA,CAAKJ,OAAAA;KAC3C,CAAA;AAER,EAAA;AACF;AAzBgBa,MAAAA,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA","file":"chunk-UGRFAVAJ.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ArrayValues } from \"@stryke/types/array\";\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { Context } from \"./context\";\n\nexport const SUPPORTED_COMMANDS = [\n \"new\",\n \"clean\",\n \"prepare\",\n \"lint\",\n \"test\",\n \"build\",\n \"docs\",\n \"release\",\n \"finalize\"\n] as const;\n\nexport type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;\nexport type Commands<TContext extends Context = Context> = Record<\n CommandType,\n (this: TContext) => MaybePromise<void>\n>;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport { SUPPORTED_COMMANDS } from \"../../types/commands\";\nimport {\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple\n} from \"../../types/config\";\nimport { PluginContext } from \"../../types/context\";\nimport {\n BaseHookKeys,\n BaseHooksListItem,\n ExternalHookKeys,\n HookKeys\n} from \"../../types/hooks\";\nimport { Plugin, PluginHook, PluginHookObject } from \"../../types/plugin\";\nimport { ResolvedConfig } from \"../../types/resolved\";\n\n/**\n * Type guard to check if an object is a {@link Plugin}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link Plugin}, false otherwise\n */\nexport function isPlugin<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(value: unknown): value is Plugin<PluginContext<TResolvedConfig>> {\n return (\n isSetObject(value) &&\n \"name\" in value &&\n isSetString(value.name) &&\n (isUndefined(\n (value as Plugin<PluginContext<TResolvedConfig>>).applyToEnvironment\n ) ||\n (\"applyToEnvironment\" in value &&\n isFunction(value.applyToEnvironment))) &&\n (isUndefined((value as Plugin<PluginContext<TResolvedConfig>>).dedupe) ||\n (\"dedupe\" in value && isFunction(value.dedupe))) &&\n (isUndefined((value as Plugin<PluginContext<TResolvedConfig>>).dependsOn) ||\n (\"dependsOn\" in value &&\n Array.isArray(value.dependsOn) &&\n value.dependsOn.every(isPluginConfig))) &&\n SUPPORTED_COMMANDS.every(\n command =>\n isUndefined(\n (value as Plugin<PluginContext<TResolvedConfig>>)[command]\n ) ||\n (command in value &&\n (isFunction((value as Record<string, any>)[command]) ||\n (isSetObject((value as Record<string, any>)[command]) &&\n \"handler\" in (value as Record<string, any>)[command] &&\n isFunction((value as Record<string, any>)[command].handler))))\n )\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigObject}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigObject}, false otherwise\n */\nexport function isPluginConfigObject(\n value: unknown\n): value is PluginConfigObject {\n return (\n isSetObject(value) &&\n \"plugin\" in value &&\n (((isSetString(value.plugin) || isFunction(value.plugin)) &&\n \"options\" in value &&\n isSetObject(value.options)) ||\n isPlugin(value.plugin))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigTuple}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigTuple}, false otherwise\n */\nexport function isPluginConfigTuple(\n value: unknown\n): value is PluginConfigTuple {\n return (\n Array.isArray(value) &&\n (value.length === 1 || value.length === 2) &&\n (((isSetString(value[0]) || isFunction(value[0])) &&\n value.length > 1 &&\n isSetObject(value[1])) ||\n isPlugin(value[0]))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfig}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfig}, false otherwise\n */\nexport function isPluginConfig(value: unknown): value is PluginConfig {\n return (\n isSetString(value) ||\n isFunction(value) ||\n isPlugin(value) ||\n isPluginConfigObject(value) ||\n isPluginConfigTuple(value)\n );\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookFunction(value: unknown): value is AnyFunction {\n return (\n isFunction(value) ||\n (isSetObject(value) && \"handler\" in value && isFunction(value.handler))\n );\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookObject(\n value: unknown\n): value is PluginHookObject<AnyFunction> {\n return isSetObject(value) && \"handler\" in value && isFunction(value.handler);\n}\n\n/**\n * Type guard to check if an object is a {@link PluginHook}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginHook}, false otherwise\n */\nexport function isPluginHook(value: unknown): value is PluginHook<AnyFunction> {\n return isPluginHookFunction(value) || isPluginHookObject(value);\n}\n\n/**\n * Extract the hook handler function from a plugin hook\n *\n * @param pluginHook - The plugin hook to extract the handler function from\n * @returns The hook handler function\n */\nexport function getHookHandler(\n pluginHook: PluginHook<AnyFunction>\n): AnyFunction {\n return isFunction(pluginHook) ? pluginHook : pluginHook.handler;\n}\n\n/**\n * Extract a plugin hook from a plugin\n *\n * @param context - The build context\n * @param plugin - The plugin to extract the hook from\n * @param hook - The name of the hook to extract\n * @returns The extracted hook, or undefined if the hook does not exist\n */\nexport function extractPluginHook<\n TContext extends PluginContext = PluginContext,\n TPlugin extends Plugin<TContext> = Plugin<TContext>\n>(context: TContext, plugin: TPlugin, hook: BaseHookKeys<TContext>) {\n const pluginHook = plugin[hook];\n if (!isPluginHook(pluginHook)) {\n return undefined;\n }\n\n return isFunction(pluginHook)\n ? {\n normal: pluginHook.bind(context)\n }\n : {\n [pluginHook.order ? pluginHook.order : \"normal\"]:\n pluginHook.handler.bind(context)\n };\n}\n\n/**\n * Check if a hook is external.\n *\n * @param hook - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isHookExternal(hook: HookKeys): hook is ExternalHookKeys {\n return (\n hook.startsWith(\"vite:\") ||\n hook.startsWith(\"esbuild:\") ||\n hook.startsWith(\"rolldown:\") ||\n hook.startsWith(\"rollup:\") ||\n hook.startsWith(\"webpack:\") ||\n hook.startsWith(\"rspack:\") ||\n hook.startsWith(\"farm:\")\n );\n}\n\n/**\n * Check if a hook is internal.\n *\n * @param hook - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isHookInternal(hook: HookKeys): hook is BaseHookKeys {\n return !isHookExternal(hook);\n}\n\n/**\n * Check if a plugin should be deduplicated.\n *\n * @param plugin - The plugin to check\n * @param plugins - The list of plugins to check against\n * @returns True if the plugin should be deduplicated, false otherwise\n */\nexport function checkDedupe<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends\n PluginContext<TResolvedConfig> = PluginContext<TResolvedConfig>\n>(plugin: Plugin<TContext>, plugins: Plugin<TContext>[]) {\n return (\n plugin.dedupe === false ||\n plugins.some(\n p =>\n p.dedupe !== false &&\n ((isFunction(p.dedupe) && p.dedupe(plugin)) || p.name === plugin.name)\n )\n );\n}\n\n/**\n * Add a plugin hook to the hooks list.\n *\n * @param context - The plugin context\n * @param plugin - The plugin to add the hook from\n * @param pluginHook - The plugin hook to add\n * @param hooksList - The list of hooks to add to\n */\nexport function addPluginHook<TContext extends PluginContext = PluginContext>(\n context: TContext,\n plugin: Plugin<TContext>,\n pluginHook: PluginHook<AnyFunction>,\n hooksList: BaseHooksListItem<TContext, BaseHookKeys<TContext>>[]\n) {\n if (\n !checkDedupe(\n plugin,\n hooksList.map(hook => hook.plugin)\n )\n ) {\n hooksList.push(\n isFunction(pluginHook)\n ? {\n plugin,\n handler: getHookHandler(pluginHook).bind(context)\n }\n : {\n plugin,\n ...pluginHook,\n handler: getHookHandler(pluginHook).bind(context)\n }\n );\n }\n}\n"]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
|
|
4
|
-
var readFile = require('@stryke/fs/read-file');
|
|
5
|
-
var isSetObject = require('@stryke/type-checks/is-set-object');
|
|
6
|
-
var isString = require('@stryke/type-checks/is-string');
|
|
7
|
-
var MagicString = require('magic-string');
|
|
8
|
-
|
|
9
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
|
|
11
|
-
var MagicString__default = /*#__PURE__*/_interopDefault(MagicString);
|
|
12
|
-
|
|
13
|
-
function getString(code) {
|
|
14
|
-
if (!code) {
|
|
15
|
-
return "";
|
|
16
|
-
}
|
|
17
|
-
if (isString.isString(code)) {
|
|
18
|
-
return code;
|
|
19
|
-
}
|
|
20
|
-
if (isSetObject.isSetObject(code) && "code" in code) {
|
|
21
|
-
return code.code;
|
|
22
|
-
}
|
|
23
|
-
return code.toString();
|
|
24
|
-
}
|
|
25
|
-
chunkPK6SKIKE_cjs.__name(getString, "getString");
|
|
26
|
-
function getMagicString(code) {
|
|
27
|
-
if (isString.isString(code)) {
|
|
28
|
-
return new MagicString__default.default(code);
|
|
29
|
-
}
|
|
30
|
-
return code;
|
|
31
|
-
}
|
|
32
|
-
chunkPK6SKIKE_cjs.__name(getMagicString, "getMagicString");
|
|
33
|
-
function getSourceFile(code, id) {
|
|
34
|
-
const content = code ?? readFile.readFileIfExistingSync(id);
|
|
35
|
-
return {
|
|
36
|
-
id,
|
|
37
|
-
code: getMagicString(content),
|
|
38
|
-
env: []
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
chunkPK6SKIKE_cjs.__name(getSourceFile, "getSourceFile");
|
|
42
|
-
|
|
43
|
-
exports.getMagicString = getMagicString;
|
|
44
|
-
exports.getSourceFile = getSourceFile;
|
|
45
|
-
exports.getString = getString;
|
|
46
|
-
//# sourceMappingURL=chunk-UQJWVRRE.cjs.map
|
|
47
|
-
//# sourceMappingURL=chunk-UQJWVRRE.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utilities/source-file.ts"],"names":["getString","code","isString","isSetObject","toString","getMagicString","MagicString","getSourceFile","id","content","readFileIfExistingSync","env"],"mappings":";;;;;;;;;;;;AA+BO,SAASA,UACdC,IAAAA,EAA4C;AAE5C,EAAA,IAAI,CAACA,IAAAA,EAAM;AACT,IAAA,OAAO,EAAA;AACT,EAAA;AAEA,EAAA,IAAIC,iBAAAA,CAASD,IAAAA,CAAAA,EAAO;AAClB,IAAA,OAAOA,IAAAA;AACT,EAAA;AAEA,EAAA,IAAIE,uBAAAA,CAAYF,IAAAA,CAAAA,IAAS,MAAA,IAAUA,IAAAA,EAAM;AACvC,IAAA,OAAOA,IAAAA,CAAKA,IAAAA;AACd,EAAA;AAEA,EAAA,OAAOA,KAAKG,QAAAA,EAAQ;AACtB;AAhBgBJ,wBAAAA,CAAAA,SAAAA,EAAAA,WAAAA,CAAAA;AAwBT,SAASK,eAAeJ,IAAAA,EAA0B;AACvD,EAAA,IAAIC,iBAAAA,CAASD,IAAAA,CAAAA,EAAO;AAClB,IAAA,OAAO,IAAIK,6BAAYL,IAAAA,CAAAA;AACzB,EAAA;AAEA,EAAA,OAAOA,IAAAA;AACT;AANgBI,wBAAAA,CAAAA,cAAAA,EAAAA,gBAAAA,CAAAA;AAeT,SAASE,aAAAA,CACdN,MACAO,EAAAA,EAAU;AAEV,EAAA,MAAMC,OAAAA,GAAUR,IAAAA,IAAQS,+BAAAA,CAAuBF,EAAAA,CAAAA;AAE/C,EAAA,OAAO;AACLA,IAAAA,EAAAA;AACAP,IAAAA,IAAAA,EAAMI,eAAeI,OAAAA,CAAAA;AACrBE,IAAAA,GAAAA,EAAK;AACP,GAAA;AACF;AAXgBJ,wBAAAA,CAAAA,aAAAA,EAAAA,eAAAA,CAAAA","file":"chunk-UQJWVRRE.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { readFileIfExistingSync } from \"@stryke/fs/read-file\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport MagicString from \"magic-string\";\nimport { TransformResult } from \"unplugin\";\nimport { SourceFile } from \"../../types/compiler\";\n\n/**\n * Get the string from the source.\n *\n * @param code - The source string or magic string.\n * @returns The source string.\n */\nexport function getString(\n code: string | MagicString | TransformResult\n): string {\n if (!code) {\n return \"\";\n }\n\n if (isString(code)) {\n return code;\n }\n\n if (isSetObject(code) && \"code\" in code) {\n return code.code;\n }\n\n return code.toString();\n}\n\n/**\n * Get the magic string.\n *\n * @param code - The source string or magic string.\n * @returns The magic string.\n */\nexport function getMagicString(code: string | MagicString): MagicString {\n if (isString(code)) {\n return new MagicString(code);\n }\n\n return code;\n}\n\n/**\n * Get the source file.\n *\n * @param code - The source code.\n * @param id - The name of the file.\n * @returns The source file.\n */\nexport function getSourceFile(\n code: string | MagicString,\n id: string\n): SourceFile {\n const content = code ?? readFileIfExistingSync(id);\n\n return {\n id,\n code: getMagicString(content),\n env: []\n };\n}\n"]}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { __name } from './chunk-7QVYU63E.js';
|
|
2
|
-
import { listFiles } from '@stryke/fs/list-files';
|
|
3
|
-
import { readFile } from '@stryke/fs/read-file';
|
|
4
|
-
import { resolvePackage } from '@stryke/fs/resolve';
|
|
5
|
-
import { findFileName } from '@stryke/path/file-path-fns';
|
|
6
|
-
import { joinPaths } from '@stryke/path/join-paths';
|
|
7
|
-
import defu from 'defu';
|
|
8
|
-
import { minimatch } from 'minimatch';
|
|
9
|
-
import ts from 'typescript';
|
|
10
|
-
|
|
11
|
-
var SourcesMap = Map;
|
|
12
|
-
async function loadLibFiles() {
|
|
13
|
-
const libLocation = await resolvePackage("typescript");
|
|
14
|
-
if (!libLocation) {
|
|
15
|
-
throw new Error("Could not resolve TypeScript package location.");
|
|
16
|
-
}
|
|
17
|
-
const libFiles = await listFiles(joinPaths(libLocation, "lib", "**", "lib.*.d.ts"));
|
|
18
|
-
if (libFiles.length === 0) {
|
|
19
|
-
throw new Error("No TypeScript library files found.");
|
|
20
|
-
}
|
|
21
|
-
const lib = /* @__PURE__ */ new Map();
|
|
22
|
-
for (const file of libFiles) {
|
|
23
|
-
lib.set(`/node_modules/typescript/lib/${findFileName(file)}`, await readFile(file));
|
|
24
|
-
}
|
|
25
|
-
return lib;
|
|
26
|
-
}
|
|
27
|
-
__name(loadLibFiles, "loadLibFiles");
|
|
28
|
-
function getDefaultCompilerOptions() {
|
|
29
|
-
return {
|
|
30
|
-
...ts.getDefaultCompilerOptions(),
|
|
31
|
-
jsx: ts.JsxEmit.React,
|
|
32
|
-
strict: true,
|
|
33
|
-
esModuleInterop: true,
|
|
34
|
-
module: ts.ModuleKind.ESNext,
|
|
35
|
-
suppressOutputPathCheck: true,
|
|
36
|
-
skipLibCheck: true,
|
|
37
|
-
skipDefaultLibCheck: true,
|
|
38
|
-
moduleResolution: ts.ModuleResolutionKind.Node10
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
__name(getDefaultCompilerOptions, "getDefaultCompilerOptions");
|
|
42
|
-
async function createVirtualProgram(rootNames, context, compilerOptions = {}) {
|
|
43
|
-
const options = defu(compilerOptions, getDefaultCompilerOptions());
|
|
44
|
-
const host = {
|
|
45
|
-
name: "storm-vfs",
|
|
46
|
-
root: context.workspaceConfig.workspaceRoot,
|
|
47
|
-
...ts.sys,
|
|
48
|
-
realpath: /* @__PURE__ */ __name((path) => {
|
|
49
|
-
if (context.fs.existsSync(path)) {
|
|
50
|
-
return context.fs.resolve(path);
|
|
51
|
-
}
|
|
52
|
-
return ts.sys.realpath?.(path) ?? path;
|
|
53
|
-
}, "realpath"),
|
|
54
|
-
getCurrentDirectory() {
|
|
55
|
-
return context.workspaceConfig.workspaceRoot;
|
|
56
|
-
},
|
|
57
|
-
getCanonicalFileName(fileName) {
|
|
58
|
-
return fileName;
|
|
59
|
-
},
|
|
60
|
-
getDefaultLibFileName(_options) {
|
|
61
|
-
return ts.getDefaultLibFileName(options);
|
|
62
|
-
},
|
|
63
|
-
getDefaultLibLocation() {
|
|
64
|
-
return "/";
|
|
65
|
-
},
|
|
66
|
-
getNewLine() {
|
|
67
|
-
return "\n";
|
|
68
|
-
},
|
|
69
|
-
useCaseSensitiveFileNames() {
|
|
70
|
-
return true;
|
|
71
|
-
},
|
|
72
|
-
fileExists(fileName) {
|
|
73
|
-
return context.fs.existsSync(fileName);
|
|
74
|
-
},
|
|
75
|
-
readFile(fileName) {
|
|
76
|
-
if (context.fs.existsSync(fileName)) {
|
|
77
|
-
return context.fs.readFileSync(fileName);
|
|
78
|
-
}
|
|
79
|
-
return void 0;
|
|
80
|
-
},
|
|
81
|
-
readDirectory: /* @__PURE__ */ __name((path, extensions = [], exclude = [], include = []) => {
|
|
82
|
-
let results = [];
|
|
83
|
-
if (context.fs.existsSync(path)) {
|
|
84
|
-
results = context.fs.readdirSync(path, {
|
|
85
|
-
encoding: "utf8",
|
|
86
|
-
recursive: true
|
|
87
|
-
});
|
|
88
|
-
if (extensions.length > 0) {
|
|
89
|
-
results = results.filter((file) => extensions.some((ext) => file.endsWith(ext.startsWith(".") ? ext : `.${ext}`)));
|
|
90
|
-
}
|
|
91
|
-
if (exclude.length > 0) {
|
|
92
|
-
results = results.filter((file) => !exclude.some((pattern) => minimatch(file, pattern)));
|
|
93
|
-
}
|
|
94
|
-
if (include.length > 0) {
|
|
95
|
-
results = results.filter((file) => include.some((pattern) => minimatch(file, pattern)));
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return results;
|
|
99
|
-
}, "readDirectory"),
|
|
100
|
-
writeFile(fileName, data) {
|
|
101
|
-
context.fs.writeFileSync(fileName, data);
|
|
102
|
-
},
|
|
103
|
-
resolvePath: /* @__PURE__ */ __name((fileName) => {
|
|
104
|
-
if (context.fs.existsSync(fileName)) {
|
|
105
|
-
return context.fs.resolve(fileName);
|
|
106
|
-
}
|
|
107
|
-
return ts.sys.resolvePath(fileName);
|
|
108
|
-
}, "resolvePath"),
|
|
109
|
-
getSourceFile(fileName, languageVersionOrOptions, _, shouldCreateNewSourceFile) {
|
|
110
|
-
if (context.fs.existsSync(fileName)) {
|
|
111
|
-
return ts.createSourceFile(fileName, context.fs.readFileSync(fileName), languageVersionOrOptions ?? compilerOptions.target ?? getDefaultCompilerOptions().target, false);
|
|
112
|
-
} else if (shouldCreateNewSourceFile) {
|
|
113
|
-
const sourceFile = ts.createSourceFile(fileName, "", languageVersionOrOptions ?? compilerOptions.target ?? getDefaultCompilerOptions().target, false);
|
|
114
|
-
context.fs.writeFileSync(fileName, sourceFile.text);
|
|
115
|
-
return sourceFile;
|
|
116
|
-
}
|
|
117
|
-
return void 0;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
return ts.createProgram(rootNames, options, host);
|
|
121
|
-
}
|
|
122
|
-
__name(createVirtualProgram, "createVirtualProgram");
|
|
123
|
-
function createVirtualCompilerHost(context, sys, compilerOptions) {
|
|
124
|
-
return {
|
|
125
|
-
compilerHost: {
|
|
126
|
-
...sys,
|
|
127
|
-
getCanonicalFileName: /* @__PURE__ */ __name((fileName) => fileName, "getCanonicalFileName"),
|
|
128
|
-
getDefaultLibFileName: /* @__PURE__ */ __name(() => `/${ts.getDefaultLibFileName(compilerOptions)}`, "getDefaultLibFileName"),
|
|
129
|
-
// getDefaultLibLocation: () => '/',
|
|
130
|
-
getNewLine: /* @__PURE__ */ __name(() => sys.newLine, "getNewLine"),
|
|
131
|
-
getSourceFile: /* @__PURE__ */ __name((fileName, languageVersionOrOptions) => {
|
|
132
|
-
const resolved = context.fs.resolve(fileName);
|
|
133
|
-
if (resolved && context.fs.existsSync(resolved)) {
|
|
134
|
-
return context.fs.readFileSync(resolved);
|
|
135
|
-
}
|
|
136
|
-
return ts.createSourceFile(fileName, sys.readFile(fileName), languageVersionOrOptions ?? compilerOptions.target, false);
|
|
137
|
-
}, "getSourceFile"),
|
|
138
|
-
useCaseSensitiveFileNames: /* @__PURE__ */ __name(() => sys.useCaseSensitiveFileNames, "useCaseSensitiveFileNames")
|
|
139
|
-
},
|
|
140
|
-
updateFile: /* @__PURE__ */ __name((sourceFile) => {
|
|
141
|
-
const alreadyExists = context.fs.existsSync(sourceFile.fileName);
|
|
142
|
-
sys.writeFile(sourceFile.fileName, sourceFile.text);
|
|
143
|
-
return alreadyExists;
|
|
144
|
-
}, "updateFile"),
|
|
145
|
-
deleteFile: /* @__PURE__ */ __name((sourceFile) => {
|
|
146
|
-
const alreadyExists = context.fs.existsSync(sourceFile.fileName);
|
|
147
|
-
sys.deleteFile(sourceFile.fileName);
|
|
148
|
-
return alreadyExists;
|
|
149
|
-
}, "deleteFile")
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
__name(createVirtualCompilerHost, "createVirtualCompilerHost");
|
|
153
|
-
|
|
154
|
-
export { SourcesMap, createVirtualCompilerHost, createVirtualProgram, getDefaultCompilerOptions, loadLibFiles };
|
|
155
|
-
//# sourceMappingURL=chunk-V2T4H24I.js.map
|
|
156
|
-
//# sourceMappingURL=chunk-V2T4H24I.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/typescript/program.ts"],"names":["SourcesMap","Map","loadLibFiles","libLocation","resolvePackage","Error","libFiles","listFiles","joinPaths","length","lib","file","set","findFileName","readFile","getDefaultCompilerOptions","ts","jsx","JsxEmit","React","strict","esModuleInterop","module","ModuleKind","ESNext","suppressOutputPathCheck","skipLibCheck","skipDefaultLibCheck","moduleResolution","ModuleResolutionKind","Node10","createVirtualProgram","rootNames","context","compilerOptions","options","defu","host","name","root","workspaceConfig","workspaceRoot","sys","realpath","path","fs","existsSync","resolve","getCurrentDirectory","getCanonicalFileName","fileName","getDefaultLibFileName","_options","getDefaultLibLocation","getNewLine","useCaseSensitiveFileNames","fileExists","readFileSync","undefined","readDirectory","extensions","exclude","include","results","readdirSync","encoding","recursive","filter","some","ext","endsWith","startsWith","pattern","minimatch","writeFile","data","writeFileSync","resolvePath","getSourceFile","languageVersionOrOptions","_","shouldCreateNewSourceFile","createSourceFile","target","sourceFile","text","createProgram","createVirtualCompilerHost","compilerHost","newLine","resolved","updateFile","alreadyExists","deleteFile"],"mappings":";;;;;;;;;;AA4BO,IAAMA,UAAAA,GAAaC;AAI1B,eAAsBC,YAAAA,GAAAA;AACpB,EAAA,MAAMC,WAAAA,GAAc,MAAMC,cAAAA,CAAe,YAAA,CAAA;AACzC,EAAA,IAAI,CAACD,WAAAA,EAAa;AAChB,IAAA,MAAM,IAAIE,MAAM,gDAAA,CAAA;AAClB,EAAA;AAEA,EAAA,MAAMC,QAAAA,GAAW,MAAMC,SAAAA,CACrBC,SAAAA,CAAUL,aAAa,KAAA,EAAO,IAAA,EAAM,YAAA,CAAA,CAAA;AAEtC,EAAA,IAAIG,QAAAA,CAASG,WAAW,CAAA,EAAG;AACzB,IAAA,MAAM,IAAIJ,MAAM,oCAAA,CAAA;AAClB,EAAA;AAEA,EAAA,MAAMK,GAAAA,uBAAsBT,GAAAA,EAAAA;AAC5B,EAAA,KAAA,MAAWU,QAAQL,QAAAA,EAAU;AAC3BI,IAAAA,GAAAA,CAAIE,GAAAA,CACF,gCAAgCC,YAAAA,CAAaF,IAAAA,CAAAA,CAAAA,CAAAA,EAC7C,MAAMG,QAAAA,CAASH,IAAAA,CAAAA,CAAAA;AAEnB,EAAA;AAEA,EAAA,OAAOD,GAAAA;AACT;AAtBsBR,MAAAA,CAAAA,YAAAA,EAAAA,cAAAA,CAAAA;AAyBf,SAASa,yBAAAA,GAAAA;AACd,EAAA,OAAO;AACL,IAAA,GAAGC,GAAGD,yBAAAA,EAAyB;AAC/BE,IAAAA,GAAAA,EAAKD,GAAGE,OAAAA,CAAQC,KAAAA;IAChBC,MAAAA,EAAQ,IAAA;IACRC,eAAAA,EAAiB,IAAA;AACjBC,IAAAA,MAAAA,EAAQN,GA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A,OAAO0C,aAAAA;IACT,CAAA,EAJYR,YAAAA;AAKd,GAAA;AACF;AA1CgBG,MAAAA,CAAAA,yBAAAA,EAAAA,2BAAAA,CAAAA","file":"chunk-V2T4H24I.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { readFile } from \"@stryke/fs/read-file\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { minimatch } from \"minimatch\";\nimport ts, { CompilerOptions } from \"typescript\";\nimport { Context } from \"../../types/context\";\n\nexport const SourcesMap = Map<string, string>;\n// eslint-disable-next-line ts/no-redeclare\nexport type SourcesMap = InstanceType<typeof SourcesMap>;\n\nexport async function loadLibFiles(): Promise<SourcesMap> {\n const libLocation = await resolvePackage(\"typescript\");\n if (!libLocation) {\n throw new Error(\"Could not resolve TypeScript package location.\");\n }\n\n const libFiles = await listFiles(\n joinPaths(libLocation, \"lib\", \"**\", \"lib.*.d.ts\")\n );\n if (libFiles.length === 0) {\n throw new Error(\"No TypeScript library files found.\");\n }\n\n const lib: SourcesMap = new Map();\n for (const file of libFiles) {\n lib.set(\n `/node_modules/typescript/lib/${findFileName(file)}`,\n await readFile(file)\n );\n }\n\n return lib;\n}\n\n/** The default compiler options if TypeScript could ever change the compiler options */\nexport function getDefaultCompilerOptions(): CompilerOptions {\n return {\n ...ts.getDefaultCompilerOptions(),\n jsx: ts.JsxEmit.React,\n strict: true,\n esModuleInterop: true,\n module: ts.ModuleKind.ESNext,\n suppressOutputPathCheck: true,\n skipLibCheck: true,\n skipDefaultLibCheck: true,\n moduleResolution: ts.ModuleResolutionKind.Node10\n };\n}\n\n/**\n * Creates a TypeScript program from in-memory, virtual source files.\n *\n * @param rootNames - An array of root file names to include in the program.\n * @param context - The context containing options and environment paths.\n * @param compilerOptions - Optional TypeScript compiler options. Defaults to the standard TypeScript options\n * @returns A TypeScript program instance that can be used for type checking, emitting, etc.\n * @throws If the provided library files are not in the expected format or if the TypeScript package cannot be resolved.\n */\nexport async function createVirtualProgram(\n rootNames: readonly string[],\n context: Context,\n compilerOptions: ts.CompilerOptions = {}\n): Promise<ts.Program> {\n const options = defu(compilerOptions, getDefaultCompilerOptions());\n\n const host = {\n name: \"storm-vfs\",\n root: context.workspaceConfig.workspaceRoot,\n ...ts.sys,\n realpath: (path: string) => {\n if (context.fs.existsSync(path)) {\n return context.fs.resolve(path);\n }\n\n return ts.sys.realpath?.(path) ?? path;\n },\n getCurrentDirectory(): string {\n return context.workspaceConfig.workspaceRoot;\n },\n getCanonicalFileName(fileName: string): string {\n return fileName;\n },\n getDefaultLibFileName(_options: ts.CompilerOptions): string {\n return ts.getDefaultLibFileName(options);\n },\n getDefaultLibLocation(): string {\n return \"/\";\n },\n getNewLine(): string {\n return \"\\n\";\n },\n useCaseSensitiveFileNames(): boolean {\n return true;\n },\n fileExists(fileName: string): boolean {\n return context.fs.existsSync(fileName);\n },\n readFile(fileName: string): string | undefined {\n if (context.fs.existsSync(fileName)) {\n return context.fs.readFileSync(fileName);\n }\n\n return undefined;\n },\n readDirectory: (\n path: string,\n extensions: readonly string[] = [],\n exclude: readonly string[] = [],\n include: readonly string[] = []\n ) => {\n let results = [] as string[];\n if (context.fs.existsSync(path)) {\n results = context.fs.readdirSync(path, {\n encoding: \"utf8\",\n recursive: true\n });\n\n if (extensions.length > 0) {\n results = results.filter(file =>\n extensions.some(ext =>\n file.endsWith(ext.startsWith(\".\") ? ext : `.${ext}`)\n )\n );\n }\n\n if (exclude.length > 0) {\n results = results.filter(\n file => !exclude.some(pattern => minimatch(file, pattern))\n );\n }\n\n if (include.length > 0) {\n results = results.filter(file =>\n include.some(pattern => minimatch(file, pattern))\n );\n }\n }\n\n return results;\n },\n writeFile(fileName: string, data: string): void {\n context.fs.writeFileSync(fileName, data);\n },\n resolvePath: (fileName: string): string => {\n if (context.fs.existsSync(fileName)) {\n return context.fs.resolve(fileName) as string;\n }\n\n return ts.sys.resolvePath(fileName);\n },\n getSourceFile(\n fileName: string,\n languageVersionOrOptions: ts.ScriptTarget | ts.CreateSourceFileOptions,\n _?: (message: string) => void,\n shouldCreateNewSourceFile?: boolean\n ): ts.SourceFile | undefined {\n if (context.fs.existsSync(fileName)) {\n return ts.createSourceFile(\n fileName,\n context.fs.readFileSync(fileName)!,\n languageVersionOrOptions ??\n compilerOptions.target ??\n getDefaultCompilerOptions().target!,\n false\n );\n } else if (shouldCreateNewSourceFile) {\n const sourceFile = ts.createSourceFile(\n fileName,\n \"\",\n languageVersionOrOptions ??\n compilerOptions.target ??\n getDefaultCompilerOptions().target!,\n false\n );\n context.fs.writeFileSync(fileName, sourceFile.text);\n return sourceFile;\n }\n\n return undefined;\n }\n } as ts.CompilerHost;\n\n return ts.createProgram(rootNames, options, host);\n}\n\ninterface VirtualCompilerHostReturn {\n compilerHost: ts.CompilerHost;\n updateFile: (sourceFile: ts.SourceFile) => boolean;\n deleteFile: (sourceFile: ts.SourceFile) => boolean;\n}\n\n/**\n * Creates an in-memory CompilerHost -which is essentially an extra wrapper to System\n * which works with TypeScript objects - returns both a compiler host, and a way to add new SourceFile\n * instances to the in-memory file system.\n */\nexport function createVirtualCompilerHost(\n context: Context,\n sys: ts.System,\n compilerOptions: ts.CompilerOptions\n) {\n return {\n compilerHost: {\n ...sys,\n getCanonicalFileName: fileName => fileName,\n getDefaultLibFileName: () =>\n `/${ts.getDefaultLibFileName(compilerOptions)}`, // '/lib.d.ts',\n // getDefaultLibLocation: () => '/',\n getNewLine: () => sys.newLine,\n getSourceFile: (\n fileName: string,\n languageVersionOrOptions: ts.ScriptTarget | ts.CreateSourceFileOptions\n ) => {\n const resolved = context.fs.resolve(fileName);\n if (resolved && context.fs.existsSync(resolved)) {\n return context.fs.readFileSync(resolved);\n }\n\n return ts.createSourceFile(\n fileName,\n sys.readFile(fileName)!,\n languageVersionOrOptions ?? compilerOptions.target,\n false\n );\n },\n useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames\n },\n updateFile: sourceFile => {\n const alreadyExists = context.fs.existsSync(sourceFile.fileName);\n sys.writeFile(sourceFile.fileName, sourceFile.text);\n return alreadyExists;\n },\n deleteFile: sourceFile => {\n const alreadyExists = context.fs.existsSync(sourceFile.fileName);\n sys.deleteFile!(sourceFile.fileName);\n return alreadyExists;\n }\n } as VirtualCompilerHostReturn;\n}\n"]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
|
|
4
|
-
var joinPaths = require('@stryke/path/join-paths');
|
|
5
|
-
var defu = require('defu');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var defu__default = /*#__PURE__*/_interopDefault(defu);
|
|
10
|
-
|
|
11
|
-
function extractWebpackConfig(context) {
|
|
12
|
-
return defu__default.default({
|
|
13
|
-
resolve: {
|
|
14
|
-
alias: context.builtins.reduce((ret, id) => {
|
|
15
|
-
const path = context.fs.ids[id];
|
|
16
|
-
if (path) {
|
|
17
|
-
ret[id] = path;
|
|
18
|
-
}
|
|
19
|
-
return ret;
|
|
20
|
-
}, {})
|
|
21
|
-
}
|
|
22
|
-
}, context.config.build.variant === "webpack" ? context.config.override : {}, {
|
|
23
|
-
external: context.config.build.external,
|
|
24
|
-
noExternal: context.config.build.noExternal,
|
|
25
|
-
skipNodeModulesBundle: context.config.build.skipNodeModulesBundle
|
|
26
|
-
}, {
|
|
27
|
-
output: {
|
|
28
|
-
path: joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.outputPath)
|
|
29
|
-
},
|
|
30
|
-
name: context.config.name,
|
|
31
|
-
node: context.config.build.platform === "node" ? {
|
|
32
|
-
__dirname: true,
|
|
33
|
-
__filename: true,
|
|
34
|
-
global: true
|
|
35
|
-
} : false,
|
|
36
|
-
mode: context.config.mode === "development" ? "development" : "production",
|
|
37
|
-
cache: {
|
|
38
|
-
type: "filesystem",
|
|
39
|
-
cacheDirectory: joinPaths.joinPaths(context.cachePath, "webpack", "cache")
|
|
40
|
-
},
|
|
41
|
-
recordsInputPath: joinPaths.joinPaths(context.cachePath, "webpack", ".webpack-records.json"),
|
|
42
|
-
recordsOutputPath: joinPaths.joinPaths(context.cachePath, "webpack", ".webpack-records.json"),
|
|
43
|
-
context: joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot),
|
|
44
|
-
noExternal: context.builtins
|
|
45
|
-
}, context.config.build.variant === "webpack" ? context.config.build : {}, {
|
|
46
|
-
devtool: context.config.mode !== "development" ? false : "source-map",
|
|
47
|
-
optimization: {
|
|
48
|
-
minimize: context.config.mode !== "development"
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
chunkPK6SKIKE_cjs.__name(extractWebpackConfig, "extractWebpackConfig");
|
|
53
|
-
|
|
54
|
-
exports.extractWebpackConfig = extractWebpackConfig;
|
|
55
|
-
//# sourceMappingURL=chunk-V5OY4ALI.cjs.map
|
|
56
|
-
//# sourceMappingURL=chunk-V5OY4ALI.cjs.map
|