@powerlines/plugin-rollup 0.7.67 → 0.7.69

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.
Files changed (128) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +1 -0
  2. package/dist/helpers/index.cjs +1 -1
  3. package/dist/helpers/index.d.cts +1 -3
  4. package/dist/helpers/index.d.mts +1 -3
  5. package/dist/helpers/index.mjs +1 -1
  6. package/dist/helpers/unplugin.cjs +1 -1
  7. package/dist/helpers/unplugin.d.cts +6 -2
  8. package/dist/helpers/unplugin.d.mts +6 -2
  9. package/dist/helpers/unplugin.mjs +1 -1
  10. package/dist/index.cjs +1 -1
  11. package/dist/index.d.cts +3 -4
  12. package/dist/index.d.mts +5 -5
  13. package/dist/index.mjs +1 -1
  14. package/dist/powerlines/schemas/fs.cjs +1 -0
  15. package/dist/powerlines/schemas/fs.mjs +1 -0
  16. package/dist/powerlines/src/api.cjs +11 -0
  17. package/dist/powerlines/src/api.mjs +1 -0
  18. package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +1 -0
  19. package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +1 -0
  20. package/dist/powerlines/src/internal/helpers/environment.cjs +1 -0
  21. package/dist/powerlines/src/internal/helpers/environment.mjs +1 -0
  22. package/dist/powerlines/src/internal/helpers/generate-types.cjs +8 -0
  23. package/dist/powerlines/src/internal/helpers/generate-types.mjs +8 -0
  24. package/dist/powerlines/src/internal/helpers/hooks.cjs +1 -0
  25. package/dist/powerlines/src/internal/helpers/hooks.mjs +1 -0
  26. package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +3 -0
  27. package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +3 -0
  28. package/dist/powerlines/src/internal/helpers/install.cjs +1 -0
  29. package/dist/powerlines/src/internal/helpers/install.mjs +1 -0
  30. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +8 -0
  31. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +8 -0
  32. package/dist/powerlines/src/internal/helpers/resolver.cjs +1 -0
  33. package/dist/powerlines/src/internal/helpers/resolver.mjs +1 -0
  34. package/dist/powerlines/src/lib/build/rollup.cjs +1 -0
  35. package/dist/powerlines/src/lib/build/rollup.mjs +1 -0
  36. package/dist/powerlines/src/lib/config-file.cjs +1 -0
  37. package/dist/powerlines/src/lib/config-file.mjs +1 -0
  38. package/dist/powerlines/src/lib/contexts/api-context.cjs +1 -0
  39. package/dist/powerlines/src/lib/contexts/api-context.mjs +1 -0
  40. package/dist/powerlines/src/lib/contexts/context.cjs +1 -0
  41. package/dist/powerlines/src/lib/contexts/context.mjs +1 -0
  42. package/dist/powerlines/src/lib/contexts/environment-context.cjs +1 -0
  43. package/dist/powerlines/src/lib/contexts/environment-context.mjs +1 -0
  44. package/dist/powerlines/src/lib/contexts/plugin-context.cjs +1 -0
  45. package/dist/powerlines/src/lib/contexts/plugin-context.mjs +1 -0
  46. package/dist/powerlines/src/lib/entry.cjs +1 -0
  47. package/dist/powerlines/src/lib/entry.mjs +1 -0
  48. package/dist/powerlines/src/lib/fs/helpers.cjs +1 -0
  49. package/dist/powerlines/src/lib/fs/helpers.mjs +1 -0
  50. package/dist/powerlines/src/lib/fs/storage/base.cjs +1 -0
  51. package/dist/powerlines/src/lib/fs/storage/base.mjs +1 -0
  52. package/dist/powerlines/src/lib/fs/storage/file-system.cjs +1 -0
  53. package/dist/powerlines/src/lib/fs/storage/file-system.mjs +1 -0
  54. package/dist/powerlines/src/lib/fs/storage/virtual.cjs +1 -0
  55. package/dist/powerlines/src/lib/fs/storage/virtual.mjs +1 -0
  56. package/dist/powerlines/src/lib/fs/vfs.cjs +1 -0
  57. package/dist/powerlines/src/lib/fs/vfs.mjs +1 -0
  58. package/dist/powerlines/src/lib/logger.cjs +1 -0
  59. package/dist/powerlines/src/lib/logger.mjs +1 -0
  60. package/dist/powerlines/src/lib/typescript/ts-morph.cjs +1 -0
  61. package/dist/powerlines/src/lib/typescript/ts-morph.mjs +1 -0
  62. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +4 -0
  63. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +4 -0
  64. package/dist/powerlines/src/lib/unplugin/factory.cjs +1 -0
  65. package/dist/powerlines/src/lib/unplugin/factory.mjs +1 -0
  66. package/dist/powerlines/src/lib/unplugin/helpers.cjs +1 -0
  67. package/dist/powerlines/src/lib/unplugin/helpers.mjs +1 -0
  68. package/dist/powerlines/src/lib/unplugin/index.cjs +1 -0
  69. package/dist/powerlines/src/lib/unplugin/index.mjs +1 -0
  70. package/dist/powerlines/src/lib/unplugin/plugin.cjs +6 -0
  71. package/dist/powerlines/src/lib/unplugin/plugin.mjs +6 -0
  72. package/dist/powerlines/src/lib/utilities/file-header.cjs +10 -0
  73. package/dist/powerlines/src/lib/utilities/file-header.mjs +10 -0
  74. package/dist/powerlines/src/lib/utilities/meta.cjs +1 -0
  75. package/dist/powerlines/src/lib/utilities/meta.mjs +1 -0
  76. package/dist/powerlines/src/lib/utilities/source-file.cjs +1 -0
  77. package/dist/powerlines/src/lib/utilities/source-file.mjs +1 -0
  78. package/dist/powerlines/src/plugin-utils/helpers.cjs +1 -0
  79. package/dist/powerlines/src/plugin-utils/helpers.mjs +1 -0
  80. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
  81. package/dist/powerlines/src/plugin-utils/paths.mjs +1 -0
  82. package/dist/powerlines/src/types/babel.d.mts +4 -0
  83. package/dist/powerlines/src/types/build.d.cts +146 -0
  84. package/dist/powerlines/src/types/build.d.mts +146 -0
  85. package/dist/powerlines/src/types/commands.cjs +1 -0
  86. package/dist/powerlines/src/types/commands.d.cts +8 -0
  87. package/dist/powerlines/src/types/commands.d.mts +9 -0
  88. package/dist/powerlines/src/types/commands.mjs +1 -0
  89. package/dist/powerlines/src/types/config.d.cts +346 -0
  90. package/dist/powerlines/src/types/config.d.mts +348 -0
  91. package/dist/powerlines/src/types/context.d.cts +347 -0
  92. package/dist/powerlines/src/types/context.d.mts +349 -0
  93. package/dist/powerlines/src/types/fs.d.cts +458 -0
  94. package/dist/powerlines/src/types/fs.d.mts +458 -0
  95. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  96. package/dist/powerlines/src/types/plugin.cjs +1 -0
  97. package/dist/powerlines/src/types/plugin.d.cts +232 -0
  98. package/dist/powerlines/src/types/plugin.d.mts +232 -0
  99. package/dist/powerlines/src/types/plugin.mjs +1 -0
  100. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  101. package/dist/powerlines/src/types/resolved.d.mts +83 -0
  102. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  103. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  104. package/dist/types/index.cjs +0 -1
  105. package/dist/types/index.d.cts +1 -2
  106. package/dist/types/index.d.mts +1 -2
  107. package/dist/types/index.mjs +1 -1
  108. package/dist/types/plugin.cjs +0 -1
  109. package/dist/types/plugin.d.cts +12 -1
  110. package/dist/types/plugin.d.mts +12 -1
  111. package/dist/types/plugin.mjs +1 -1
  112. package/package.json +10 -10
  113. package/dist/helpers-CRPRhztf.mjs +0 -1
  114. package/dist/helpers-LF26RHol.cjs +0 -0
  115. package/dist/index-9iG2qHLe.d.mts +0 -1
  116. package/dist/index-D4ELpJXS.d.cts +0 -1
  117. package/dist/index-D6CnpA_r.d.cts +0 -1
  118. package/dist/index-DL0uimUT.d.mts +0 -1
  119. package/dist/plugin-2kQDVrv-.d.mts +0 -1655
  120. package/dist/plugin-BIHcT_Lx.d.cts +0 -1652
  121. package/dist/plugin-BjiGfRHE.mjs +0 -1
  122. package/dist/plugin-pBKbb5K9.cjs +0 -0
  123. package/dist/types-n6NgD0QK.mjs +0 -1
  124. package/dist/types-o3zWarRp.cjs +0 -0
  125. package/dist/unplugin-CRR6mSrS.cjs +0 -44
  126. package/dist/unplugin-DiEsuWSK.d.cts +0 -7
  127. package/dist/unplugin-Rgj8lLxv.mjs +0 -6
  128. package/dist/unplugin-RsllU1Bh.d.mts +0 -7
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
@@ -1 +1 @@
1
- const e=require(`../unplugin-CRR6mSrS.cjs`);require(`../helpers-LF26RHol.cjs`),exports.createRollupPlugin=e.t;
1
+ const e=require(`./unplugin.cjs`);exports.createRollupPlugin=e.createRollupPlugin;
@@ -1,4 +1,2 @@
1
- import "../plugin-BIHcT_Lx.cjs";
2
- import { t as createRollupPlugin } from "../unplugin-DiEsuWSK.cjs";
3
- import "../index-D6CnpA_r.cjs";
1
+ import { createRollupPlugin } from "./unplugin.cjs";
4
2
  export { createRollupPlugin };
@@ -1,4 +1,2 @@
1
- import "../plugin-2kQDVrv-.mjs";
2
- import { t as createRollupPlugin } from "../unplugin-RsllU1Bh.mjs";
3
- import "../index-DL0uimUT.mjs";
1
+ import { createRollupPlugin } from "./unplugin.mjs";
4
2
  export { createRollupPlugin };
@@ -1 +1 @@
1
- import{t as e}from"../unplugin-Rgj8lLxv.mjs";import"../helpers-CRPRhztf.mjs";export{e as createRollupPlugin};
1
+ import{createRollupPlugin as e}from"./unplugin.mjs";export{e as createRollupPlugin};
@@ -1 +1 @@
1
- const e=require(`../unplugin-CRR6mSrS.cjs`);exports.createRollupPlugin=e.t;
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../powerlines/src/lib/unplugin/plugin.cjs`);require(`../powerlines/src/lib/unplugin/index.cjs`);let n=require(`unplugin`);function r(e){return(0,n.createEsbuildPlugin)(t.createUnplugin(e))({})}exports.createRollupPlugin=r;
@@ -1,3 +1,7 @@
1
- import "../plugin-BIHcT_Lx.cjs";
2
- import { t as createRollupPlugin } from "../unplugin-DiEsuWSK.cjs";
1
+ import { RollupPluginContext } from "../types/plugin.cjs";
2
+ import * as esbuild0 from "esbuild";
3
+
4
+ //#region src/helpers/unplugin.d.ts
5
+ declare function createRollupPlugin(context: RollupPluginContext): esbuild0.Plugin;
6
+ //#endregion
3
7
  export { createRollupPlugin };
@@ -1,3 +1,7 @@
1
- import "../plugin-2kQDVrv-.mjs";
2
- import { t as createRollupPlugin } from "../unplugin-RsllU1Bh.mjs";
1
+ import { RollupPluginContext } from "../types/plugin.mjs";
2
+ import * as esbuild0 from "esbuild";
3
+
4
+ //#region src/helpers/unplugin.d.ts
5
+ declare function createRollupPlugin(context: RollupPluginContext): esbuild0.Plugin;
6
+ //#endregion
3
7
  export { createRollupPlugin };
@@ -1 +1 @@
1
- import{t as e}from"../unplugin-Rgj8lLxv.mjs";export{e as createRollupPlugin};
1
+ import{createUnplugin as e}from"../powerlines/src/lib/unplugin/plugin.mjs";import"../powerlines/src/lib/unplugin/index.mjs";import{createEsbuildPlugin as t}from"unplugin";function n(n){return t(e(n))({})}export{n as createRollupPlugin};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./unplugin-CRR6mSrS.cjs`);require(`./helpers-LF26RHol.cjs`),require(`./plugin-pBKbb5K9.cjs`),require(`./types-o3zWarRp.cjs`);let t=require(`@stryke/convert/to-array`),n=require(`defu`);n=e.n(n);let r=require(`@rollup/plugin-alias`);r=e.n(r);let i=require(`@rollup/plugin-babel`),a=require(`@rollup/plugin-inject`);a=e.n(a);let o=require(`@rollup/plugin-node-resolve`);o=e.n(o);let s=require(`@rollup/plugin-replace`);s=e.n(s);let c=require(`@stryke/helpers/omit`),l=require(`@stryke/path/join-paths`),u=require(`@stryke/type-checks/is-function`),d=require(`@stryke/type-checks/is-string`),f=require(`node:fs`),p=require(`rollup-plugin-typescript2`);p=e.n(p);let m=require(`rollup`);const h={name:`powerlines:dts-bundle`,async generateBundle(e,t){for(let[,e]of Object.entries(t)){if(e.type===`asset`||!e.isEntry||e.facadeModuleId==null)continue;let t=e.fileName.replace(/(?:\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/,`.d.ts`),n=JSON.stringify(`./${e.facadeModuleId.replace(/\.[cm]?[jt]sx?$/,``)}`);this.emitFile({type:`asset`,fileName:t,source:e.exports.includes(`default`)?`export * from ${n};\nexport { default } from ${n};\n`:`export * from ${n};\n`})}}};function g(e){return(0,n.default)({input:(0,f.globSync)((0,t.toArray)(e.config.entry).map(e=>(0,d.isString)(e)?e:e.file)).flat(),external:(n,r,i)=>{let a=e.config.build.variant===`rollup`&&e.config.build.override.external?(0,u.isFunction)(e.config.build.override.external)?e.config.build.override.external:n=>(0,t.toArray)(e.config.build.override.external).includes(n):e.config.build.variant===`vite`&&e.config.build.override.build?.rollupOptions?.external?(0,u.isFunction)(e.config.build.override.build?.rollupOptions?.external)?e.config.build.override.build?.rollupOptions?.external:n=>(0,t.toArray)(e.config.build?.build?.rollupOptions?.external).includes(n):e.config.build.variant===`rollup`&&e.config.build.external?(0,u.isFunction)(e.config.build.external)?e.config.build.external:n=>(0,t.toArray)(e.config.build.external).includes(n):e.config.build.variant===`vite`&&e.config.build.build?.rollupOptions?.external?(0,u.isFunction)(e.config.build.build?.rollupOptions?.external)?e.config.build.build?.rollupOptions?.external:n=>(0,t.toArray)(e.config.build?.build?.rollupOptions?.external).includes(n):void 0;return(0,u.isFunction)(a)&&a(n,r,i)||e.config.build.external&&(0,t.toArray)(e.config.build.external).includes(n)?!0:e.config.build.noExternal&&(0,t.toArray)(e.config.build.noExternal).includes(n)?!1:e.builtins.includes(n)?e.config.projectType!==`application`:!e.config.build.skipNodeModulesBundle},plugins:[(0,p.default)({check:!1,tsconfig:e.tsconfig.tsconfigFilePath}),e.config.build.define&&Object.keys(e.config.build.define).length>0&&(0,s.default)({sourceMap:e.config.mode===`development`,preventAssignment:!0,...e.config.build.define??{}}),e.config.build.inject&&Object.keys(e.config.build.inject).length>0&&(0,a.default)({sourceMap:e.config.mode===`development`,...e.config.build.inject}),(0,r.default)({entries:e.builtins.reduce((t,n)=>{if(!t.find(e=>e.find===n)){let r=e.fs.ids[n];r&&t.push({find:n,replacement:r})}return t},e.config.build.alias?Array.isArray(e.config.build.alias)?e.config.build.alias:Object.entries(e.config.build.alias).reduce((e,[t,n])=>(e.find(e=>e.find===t)||e.push({find:t,replacement:n}),e),[]):[])}),(0,i.getBabelInputPlugin)((0,n.default)(e.config.transform.babel,{caller:{name:`powerlines`,supportsStaticESM:!0},cwd:e.config.projectRoot,babelrc:!1,extensions:[`.js`,`.jsx`,`.ts`,`.tsx`],babelHelpers:`bundled`,skipPreflightCheck:!0,exclude:/node_modules/})),(0,o.default)({moduleDirectories:[`node_modules`],preferBuiltins:!0}),h].filter(Boolean)},e.config.build.variant===`rollup`?e.config.build.override:{},e.config.build.variant===`vite`?e.config.build.override.build?.rollupOptions:{},e.config.build.variant===`rollup`?(0,c.omit)(e.config.build,[`override`,`variant`]):{},e.config.build.variant===`vite`?e.config.build.build?.rollupOptions:{},{cache:e.config.skipCache?!1:(0,l.joinPaths)(e.cachePath,`rollup`),logLevel:e.config.logLevel,output:[{dir:e.config.output.buildPath,format:`es`,entryFileNames:`[name].js`,preserveModules:!0,sourcemap:e.config.mode===`development`},{dir:e.config.output.buildPath,format:`cjs`,entryFileNames:`[name].cjs`,preserveModules:!0,sourcemap:e.config.mode===`development`}]})}const _=(r={})=>({name:`rollup`,config(){return{output:{format:[`cjs`,`esm`]},build:{...r,variant:`rollup`}}},async build(){let r=await(0,m.rollup)((0,n.default)({plugins:[e.t(this)]},g(this)));await Promise.all((0,t.toArray)(this.config.output.format).map(async e=>r.write({format:e})))}});var v=_;exports.createRollupPlugin=e.t,exports.default=v,exports.plugin=_;
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./powerlines/src/lib/build/rollup.cjs`),n=require(`./helpers/unplugin.cjs`);require(`./helpers/index.cjs`);let r=require(`@stryke/convert/to-array`),i=require(`defu`);i=e.__toESM(i);let a=require(`rollup`);const o=(e={})=>({name:`rollup`,config(){return{output:{format:[`cjs`,`esm`]},build:{...e,variant:`rollup`}}},async build(){let e=await(0,a.rollup)((0,i.default)({plugins:[n.createRollupPlugin(this)]},t.extractRollupConfig(this)));await Promise.all((0,r.toArray)(this.config.output.format).map(async t=>e.write({format:t})))}});var s=o;exports.createRollupPlugin=n.createRollupPlugin,exports.default=s,exports.plugin=o;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,6 @@
1
- import { a as __ΩRollupPluginOptions, i as __ΩRollupPluginContext, n as RollupPluginOptions, o as __ΩRollupPluginResolvedConfig, r as RollupPluginResolvedConfig, s as Plugin, t as RollupPluginContext } from "./plugin-BIHcT_Lx.cjs";
2
- import { t as createRollupPlugin } from "./unplugin-DiEsuWSK.cjs";
3
- import "./index-D6CnpA_r.cjs";
4
- import "./index-D4ELpJXS.cjs";
1
+ import { Plugin } from "./powerlines/src/types/plugin.cjs";
2
+ import { RollupPluginContext, RollupPluginOptions, RollupPluginResolvedConfig, __ΩRollupPluginContext, __ΩRollupPluginOptions, __ΩRollupPluginResolvedConfig } from "./types/plugin.cjs";
3
+ import { createRollupPlugin } from "./helpers/unplugin.cjs";
5
4
 
6
5
  //#region src/index.d.ts
7
6
 
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { a as __ΩRollupPluginOptions, i as __ΩRollupPluginContext, n as RollupPluginOptions, o as __ΩRollupPluginResolvedConfig, r as RollupPluginResolvedConfig, s as Plugin, t as RollupPluginContext } from "./plugin-2kQDVrv-.mjs";
2
- import { t as createRollupPlugin } from "./unplugin-RsllU1Bh.mjs";
3
- import "./index-DL0uimUT.mjs";
4
- import "./index-9iG2qHLe.mjs";
1
+ import { Plugin } from "./powerlines/src/types/plugin.mjs";
2
+ import { RollupPluginContext, RollupPluginOptions, RollupPluginResolvedConfig, __ΩRollupPluginContext, __ΩRollupPluginOptions, __ΩRollupPluginResolvedConfig } from "./types/plugin.mjs";
3
+ import { createRollupPlugin } from "./helpers/unplugin.mjs";
4
+ import "./helpers/index.mjs";
5
+ import "./types/index.mjs";
5
6
 
6
7
  //#region src/index.d.ts
7
-
8
8
  /**
9
9
  * A Powerlines plugin to assist in developing other Powerlines plugins.
10
10
  */
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./unplugin-Rgj8lLxv.mjs";import"./helpers-CRPRhztf.mjs";import"./plugin-BjiGfRHE.mjs";import"./types-n6NgD0QK.mjs";import{toArray as t}from"@stryke/convert/to-array";import n from"defu";import r from"@rollup/plugin-alias";import{getBabelInputPlugin as i}from"@rollup/plugin-babel";import a from"@rollup/plugin-inject";import o from"@rollup/plugin-node-resolve";import s from"@rollup/plugin-replace";import{omit as c}from"@stryke/helpers/omit";import{joinPaths as l}from"@stryke/path/join-paths";import{isFunction as u}from"@stryke/type-checks/is-function";import{isString as d}from"@stryke/type-checks/is-string";import{globSync as f}from"node:fs";import p from"rollup-plugin-typescript2";import{rollup as m}from"rollup";const h={name:`powerlines:dts-bundle`,async generateBundle(e,t){for(let[,e]of Object.entries(t)){if(e.type===`asset`||!e.isEntry||e.facadeModuleId==null)continue;let t=e.fileName.replace(/(?:\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/,`.d.ts`),n=JSON.stringify(`./${e.facadeModuleId.replace(/\.[cm]?[jt]sx?$/,``)}`);this.emitFile({type:`asset`,fileName:t,source:e.exports.includes(`default`)?`export * from ${n};\nexport { default } from ${n};\n`:`export * from ${n};\n`})}}};function g(e){return n({input:f(t(e.config.entry).map(e=>d(e)?e:e.file)).flat(),external:(n,r,i)=>{let a=e.config.build.variant===`rollup`&&e.config.build.override.external?u(e.config.build.override.external)?e.config.build.override.external:n=>t(e.config.build.override.external).includes(n):e.config.build.variant===`vite`&&e.config.build.override.build?.rollupOptions?.external?u(e.config.build.override.build?.rollupOptions?.external)?e.config.build.override.build?.rollupOptions?.external:n=>t(e.config.build?.build?.rollupOptions?.external).includes(n):e.config.build.variant===`rollup`&&e.config.build.external?u(e.config.build.external)?e.config.build.external:n=>t(e.config.build.external).includes(n):e.config.build.variant===`vite`&&e.config.build.build?.rollupOptions?.external?u(e.config.build.build?.rollupOptions?.external)?e.config.build.build?.rollupOptions?.external:n=>t(e.config.build?.build?.rollupOptions?.external).includes(n):void 0;return u(a)&&a(n,r,i)||e.config.build.external&&t(e.config.build.external).includes(n)?!0:e.config.build.noExternal&&t(e.config.build.noExternal).includes(n)?!1:e.builtins.includes(n)?e.config.projectType!==`application`:!e.config.build.skipNodeModulesBundle},plugins:[p({check:!1,tsconfig:e.tsconfig.tsconfigFilePath}),e.config.build.define&&Object.keys(e.config.build.define).length>0&&s({sourceMap:e.config.mode===`development`,preventAssignment:!0,...e.config.build.define??{}}),e.config.build.inject&&Object.keys(e.config.build.inject).length>0&&a({sourceMap:e.config.mode===`development`,...e.config.build.inject}),r({entries:e.builtins.reduce((t,n)=>{if(!t.find(e=>e.find===n)){let r=e.fs.ids[n];r&&t.push({find:n,replacement:r})}return t},e.config.build.alias?Array.isArray(e.config.build.alias)?e.config.build.alias:Object.entries(e.config.build.alias).reduce((e,[t,n])=>(e.find(e=>e.find===t)||e.push({find:t,replacement:n}),e),[]):[])}),i(n(e.config.transform.babel,{caller:{name:`powerlines`,supportsStaticESM:!0},cwd:e.config.projectRoot,babelrc:!1,extensions:[`.js`,`.jsx`,`.ts`,`.tsx`],babelHelpers:`bundled`,skipPreflightCheck:!0,exclude:/node_modules/})),o({moduleDirectories:[`node_modules`],preferBuiltins:!0}),h].filter(Boolean)},e.config.build.variant===`rollup`?e.config.build.override:{},e.config.build.variant===`vite`?e.config.build.override.build?.rollupOptions:{},e.config.build.variant===`rollup`?c(e.config.build,[`override`,`variant`]):{},e.config.build.variant===`vite`?e.config.build.build?.rollupOptions:{},{cache:e.config.skipCache?!1:l(e.cachePath,`rollup`),logLevel:e.config.logLevel,output:[{dir:e.config.output.buildPath,format:`es`,entryFileNames:`[name].js`,preserveModules:!0,sourcemap:e.config.mode===`development`},{dir:e.config.output.buildPath,format:`cjs`,entryFileNames:`[name].cjs`,preserveModules:!0,sourcemap:e.config.mode===`development`}]})}const _=(r={})=>({name:`rollup`,config(){return{output:{format:[`cjs`,`esm`]},build:{...r,variant:`rollup`}}},async build(){let r=await m(n({plugins:[e(this)]},g(this)));await Promise.all(t(this.config.output.format).map(async e=>r.write({format:e})))}});var v=_;export{e as createRollupPlugin,v as default,_ as plugin};
1
+ import{extractRollupConfig as e}from"./powerlines/src/lib/build/rollup.mjs";import{createRollupPlugin as t}from"./helpers/unplugin.mjs";import"./helpers/index.mjs";import{toArray as n}from"@stryke/convert/to-array";import r from"defu";import{rollup as i}from"rollup";const a=(a={})=>({name:`rollup`,config(){return{output:{format:[`cjs`,`esm`]},build:{...a,variant:`rollup`}}},async build(){let a=await i(r({plugins:[t(this)]},e(this)));await Promise.all(n(this.config.output.format).map(async e=>a.write({format:e})))}});var o=a;export{t as createRollupPlugin,o as default,a as plugin};
@@ -0,0 +1 @@
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/capnp`);t=e.__toESM(t);var n=class extends t.Struct{static _capnp={displayName:`KeyValuePair`,id:`eabb26cf58b2a14c`,size:new t.ObjectSize(0,2)};get key(){return t.utils.getText(0,this)}set key(e){t.utils.setText(0,e,this)}get value(){return t.utils.getText(1,this)}set value(e){t.utils.setText(1,e,this)}toString(){return`FileMetadata_KeyValuePair_`+super.toString()}},r=class e extends t.Struct{static KeyValuePair=n;static _capnp={displayName:`FileMetadata`,id:`8e2cab5d7e28c7b3`,size:new t.ObjectSize(8,3),defaultType:`normal`};static _Properties;get id(){return t.utils.getText(0,this)}set id(e){t.utils.setText(0,e,this)}get type(){return t.utils.getText(1,this,e._capnp.defaultType)}set type(e){t.utils.setText(1,e,this)}get timestamp(){return t.utils.getUint32(0,this)}set timestamp(e){t.utils.setUint32(0,e,this)}_adoptProperties(e){t.utils.adopt(e,t.utils.getPointer(2,this))}_disownProperties(){return t.utils.disown(this.properties)}get properties(){return t.utils.getList(2,e._Properties,this)}_hasProperties(){return!t.utils.isNull(t.utils.getPointer(2,this))}_initProperties(n){return t.utils.initList(2,e._Properties,n,this)}set properties(e){t.utils.copyFrom(e,t.utils.getPointer(2,this))}toString(){return`FileMetadata_`+super.toString()}},i=class extends t.Struct{static _capnp={displayName:`FileId`,id:`990d6a471072f997`,size:new t.ObjectSize(0,2)};get id(){return t.utils.getText(0,this)}set id(e){t.utils.setText(0,e,this)}get path(){return t.utils.getText(1,this)}set path(e){t.utils.setText(1,e,this)}toString(){return`FileId_`+super.toString()}},a=class extends t.Struct{static _capnp={displayName:`FileStorage`,id:`9dca66ac858c9ebe`,size:new t.ObjectSize(0,2)};get path(){return t.utils.getText(0,this)}set path(e){t.utils.setText(0,e,this)}get code(){return t.utils.getText(1,this)}set code(e){t.utils.setText(1,e,this)}toString(){return`FileStorage_`+super.toString()}},o=class e extends t.Struct{static _capnp={displayName:`FileSystem`,id:`ae0c23d43e56abcf`,size:new t.ObjectSize(0,3)};static _Ids;static _Storage;static _Metadata;_adoptIds(e){t.utils.adopt(e,t.utils.getPointer(0,this))}_disownIds(){return t.utils.disown(this.ids)}get ids(){return t.utils.getList(0,e._Ids,this)}_hasIds(){return!t.utils.isNull(t.utils.getPointer(0,this))}_initIds(n){return t.utils.initList(0,e._Ids,n,this)}set ids(e){t.utils.copyFrom(e,t.utils.getPointer(0,this))}_adoptStorage(e){t.utils.adopt(e,t.utils.getPointer(1,this))}_disownStorage(){return t.utils.disown(this.storage)}get storage(){return t.utils.getList(1,e._Storage,this)}_hasStorage(){return!t.utils.isNull(t.utils.getPointer(1,this))}_initStorage(n){return t.utils.initList(1,e._Storage,n,this)}set storage(e){t.utils.copyFrom(e,t.utils.getPointer(1,this))}_adoptMetadata(e){t.utils.adopt(e,t.utils.getPointer(2,this))}_disownMetadata(){return t.utils.disown(this.metadata)}get metadata(){return t.utils.getList(2,e._Metadata,this)}_hasMetadata(){return!t.utils.isNull(t.utils.getPointer(2,this))}_initMetadata(n){return t.utils.initList(2,e._Metadata,n,this)}set metadata(e){t.utils.copyFrom(e,t.utils.getPointer(2,this))}toString(){return`FileSystem_`+super.toString()}};r._Properties=t.CompositeList(n),o._Ids=t.CompositeList(i),o._Storage=t.CompositeList(a),o._Metadata=t.CompositeList(r),exports.FileSystem=o;
@@ -0,0 +1 @@
1
+ import*as e from"@stryke/capnp";var t=class extends e.Struct{static _capnp={displayName:`KeyValuePair`,id:`eabb26cf58b2a14c`,size:new e.ObjectSize(0,2)};get key(){return e.utils.getText(0,this)}set key(t){e.utils.setText(0,t,this)}get value(){return e.utils.getText(1,this)}set value(t){e.utils.setText(1,t,this)}toString(){return`FileMetadata_KeyValuePair_`+super.toString()}},n=class n extends e.Struct{static KeyValuePair=t;static _capnp={displayName:`FileMetadata`,id:`8e2cab5d7e28c7b3`,size:new e.ObjectSize(8,3),defaultType:`normal`};static _Properties;get id(){return e.utils.getText(0,this)}set id(t){e.utils.setText(0,t,this)}get type(){return e.utils.getText(1,this,n._capnp.defaultType)}set type(t){e.utils.setText(1,t,this)}get timestamp(){return e.utils.getUint32(0,this)}set timestamp(t){e.utils.setUint32(0,t,this)}_adoptProperties(t){e.utils.adopt(t,e.utils.getPointer(2,this))}_disownProperties(){return e.utils.disown(this.properties)}get properties(){return e.utils.getList(2,n._Properties,this)}_hasProperties(){return!e.utils.isNull(e.utils.getPointer(2,this))}_initProperties(t){return e.utils.initList(2,n._Properties,t,this)}set properties(t){e.utils.copyFrom(t,e.utils.getPointer(2,this))}toString(){return`FileMetadata_`+super.toString()}},r=class extends e.Struct{static _capnp={displayName:`FileId`,id:`990d6a471072f997`,size:new e.ObjectSize(0,2)};get id(){return e.utils.getText(0,this)}set id(t){e.utils.setText(0,t,this)}get path(){return e.utils.getText(1,this)}set path(t){e.utils.setText(1,t,this)}toString(){return`FileId_`+super.toString()}},i=class extends e.Struct{static _capnp={displayName:`FileStorage`,id:`9dca66ac858c9ebe`,size:new e.ObjectSize(0,2)};get path(){return e.utils.getText(0,this)}set path(t){e.utils.setText(0,t,this)}get code(){return e.utils.getText(1,this)}set code(t){e.utils.setText(1,t,this)}toString(){return`FileStorage_`+super.toString()}},a=class t extends e.Struct{static _capnp={displayName:`FileSystem`,id:`ae0c23d43e56abcf`,size:new e.ObjectSize(0,3)};static _Ids;static _Storage;static _Metadata;_adoptIds(t){e.utils.adopt(t,e.utils.getPointer(0,this))}_disownIds(){return e.utils.disown(this.ids)}get ids(){return e.utils.getList(0,t._Ids,this)}_hasIds(){return!e.utils.isNull(e.utils.getPointer(0,this))}_initIds(n){return e.utils.initList(0,t._Ids,n,this)}set ids(t){e.utils.copyFrom(t,e.utils.getPointer(0,this))}_adoptStorage(t){e.utils.adopt(t,e.utils.getPointer(1,this))}_disownStorage(){return e.utils.disown(this.storage)}get storage(){return e.utils.getList(1,t._Storage,this)}_hasStorage(){return!e.utils.isNull(e.utils.getPointer(1,this))}_initStorage(n){return e.utils.initList(1,t._Storage,n,this)}set storage(t){e.utils.copyFrom(t,e.utils.getPointer(1,this))}_adoptMetadata(t){e.utils.adopt(t,e.utils.getPointer(2,this))}_disownMetadata(){return e.utils.disown(this.metadata)}get metadata(){return e.utils.getList(2,t._Metadata,this)}_hasMetadata(){return!e.utils.isNull(e.utils.getPointer(2,this))}_initMetadata(n){return e.utils.initList(2,t._Metadata,n,this)}set metadata(t){e.utils.copyFrom(t,e.utils.getPointer(2,this))}toString(){return`FileSystem_`+super.toString()}};n._Properties=e.CompositeList(t),a._Ids=e.CompositeList(r),a._Storage=e.CompositeList(i),a._Metadata=e.CompositeList(n);export{a as FileSystem};
@@ -0,0 +1,11 @@
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./internal/babel/module-resolver-plugin.cjs`),n=require(`./internal/helpers/generate-types.cjs`),r=require(`./internal/helpers/hooks.cjs`),i=require(`./internal/helpers/install-dependencies.cjs`),a=require(`./lib/typescript/tsconfig.cjs`),o=require(`./internal/helpers/resolve-tsconfig.cjs`),s=require(`./plugin-utils/helpers.cjs`),c=require(`./lib/utilities/meta.cjs`),l=require(`./lib/contexts/api-context.cjs`),u=require(`./lib/utilities/file-header.cjs`);let d=require(`@stryke/convert/to-array`),f=require(`@stryke/path/join-paths`),p=require(`@stryke/type-checks/is-function`),m=require(`@storm-software/config-tools/types`),h=require(`@babel/core`),g=require(`@storm-software/config-tools/logger/console`),_=require(`@stryke/fs/helpers`),v=require(`@stryke/fs/install`),y=require(`@stryke/fs/list-files`),b=require(`@stryke/fs/package-fns`),x=require(`@stryke/fs/resolve`),S=require(`@stryke/path/append`),C=require(`@stryke/path/replace`),w=require(`@stryke/type-checks/is-error`),T=require(`@stryke/type-checks/is-number`),E=require(`@stryke/type-checks/is-object`),D=require(`@stryke/type-checks/is-promise`),O=require(`@stryke/type-checks/is-set`),k=require(`@stryke/type-checks/is-set-object`),A=require(`@stryke/type-checks/is-set-string`),j=require(`chalk`);j=e.__toESM(j);let M=require(`handlebars`);M=e.__toESM(M);var N=class e{#e;get context(){return this.#e}constructor(e){this.#e=e}static async from(t,n){let r=new e(await l.PowerlinesAPIContext.from(t,n));r.#e.$$internal={api:r,addPlugin:r.#r.bind(r)};for(let e of r.context.config.plugins??[])await r.#r(e);r.context.plugins.length===0&&r.context.log(m.LogLevelLabel.WARN,`No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.`);let i=await r.callHook(`config`,{environment:await r.context.getEnvironment(),sequential:!0,result:`merge`});return await r.context.withUserConfig(i,{isHighPriority:!1}),r}async prepare(e={command:`prepare`}){this.context.log(m.LogLevelLabel.TRACE,` 🏗️ Preparing the Powerlines project`),this.context.log(m.LogLevelLabel.TRACE,` ⚙️ Aggregating configuration options for the Powerlines project`),await this.context.withInlineConfig(e),await this.#n(async e=>{if(e.log(m.LogLevelLabel.TRACE,`Initializing the processing options for the Powerlines project.`),await this.callHook(`configResolved`,{environment:e,order:`pre`}),await o.initializeTsconfig(e),await this.callHook(`configResolved`,{environment:e,order:`normal`}),e.log(m.LogLevelLabel.DEBUG,`The configuration provided ${(0,d.toArray)(e.config.entry).length} entry point(s), Powerlines has found ${e.entry.length} entry files(s) for the ${e.config.title} project${e.entry.length>0&&e.entry.length<10?`: \n${e.entry.map(e=>`- ${e.input.file||e.file}${e.output?` -> ${e.output}`:``}`).join(`
2
+ `)}`:``}.`),await o.resolveTsconfig(e),await i.installDependencies(e),await this.callHook(`configResolved`,{environment:e,order:`post`}),e.log(m.LogLevelLabel.TRACE,`Powerlines configuration has been resolved: \n\n${(0,g.formatLogMessage)(e.config)}`),e.fs.existsSync(e.cachePath)||await(0,_.createDirectory)(e.cachePath),e.fs.existsSync(e.dataPath)||await(0,_.createDirectory)(e.dataPath),await this.callHook(`prepare`,{environment:e,order:`pre`}),await this.callHook(`prepare`,{environment:e,order:`normal`}),e.config.output.dts!==!1){e.log(m.LogLevelLabel.TRACE,`Preparing the TypeScript definitions for the Powerlines project.`),e.fs.existsSync(e.dtsPath)&&await e.fs.remove(e.dtsPath),e.log(m.LogLevelLabel.TRACE,`Transforming built-ins runtime modules files.`);let r=await Promise.all((await e.getBuiltins()).map(async n=>{let r=await(0,h.transformAsync)(n.code.toString(),{highlightCode:!0,code:!0,ast:!1,cloneInputAst:!1,comments:!0,sourceType:`module`,configFile:!1,babelrc:!1,envName:e.config.mode,caller:{name:`powerlines`},...e.config.transform.babel,filename:n.path,plugins:[[`@babel/plugin-syntax-typescript`],[t.moduleResolverBabelPlugin(e)]]});if(!r?.code)throw Error(`Powerlines - Generate Types failed to compile ${n.id}`);return e.log(m.LogLevelLabel.TRACE,`Writing transformed built-in runtime file ${n.id}.`),await e.emitBuiltin(r.code,n.id,n.path),n.path}));if(!await(0,x.resolvePackage)(`typescript`))throw Error(`Could not resolve TypeScript package location. Please ensure TypeScript is installed.`);let i=r.reduce((t,n)=>{let r=(0,C.replacePath)(n,e.workspaceConfig.workspaceRoot);return t.includes(r)||t.push(r),t},[]);e.log(m.LogLevelLabel.TRACE,`Parsing TypeScript configuration for the Powerlines project.`);let s=await n.emitTypes(e,i);e.log(m.LogLevelLabel.TRACE,`Generating TypeScript declaration file ${e.dtsPath}.`);let c=[],l=e=>(0,E.isObject)(e)?e.code:e,d=await this.callHook(`types`,{environment:e,sequential:!0,order:`pre`,result:`merge`,asNextParam:l},s);if(d&&((0,k.isSetObject)(d)?(s=d.code,Array.isArray(d.directives)&&d.directives.length>0&&c.push(...d.directives)):(0,A.isSetString)(d)&&(s=d)),d=await this.callHook(`types`,{environment:e,sequential:!0,order:`normal`,result:`merge`,asNextParam:l},s),d&&((0,k.isSetObject)(d)?(s=d.code,Array.isArray(d.directives)&&d.directives.length>0&&c.push(...d.directives)):(0,A.isSetString)(d)&&(s=d)),d=await this.callHook(`types`,{environment:e,sequential:!0,order:`post`,result:`merge`,asNextParam:l},s),d&&((0,k.isSetObject)(d)?(s=d.code,Array.isArray(d.directives)&&d.directives.length>0&&c.push(...d.directives)):(0,A.isSetString)(d)&&(s=d)),s?.trim()||c.length>0)await e.fs.write(e.dtsPath,`${c?`${c.map(e=>`/// <reference types="${e}" />`).join(`
3
+ `)}
4
+
5
+ `:``}${u.getFileHeader(e,{directive:null,prettierIgnore:!1})}
6
+
7
+ ${n.formatTypes(s)}
8
+ `);else{let t=o.getTsconfigDtsPath(e);if(e.tsconfig.tsconfigJson.include&&a.isIncludeMatchFound(t,e.tsconfig.tsconfigJson.include)){let n=t.startsWith(`./`)?t.slice(2):t;e.tsconfig.tsconfigJson.include=e.tsconfig.tsconfigJson.include.filter(e=>e?.toString()!==n),await e.fs.write(e.tsconfig.tsconfigFilePath,JSON.stringify(e.tsconfig.tsconfigJson,null,2))}}}if(e.tsconfig=a.getParsedTypeScriptConfig(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.config.tsconfig),!e.tsconfig)throw Error(`Failed to parse the TypeScript configuration file.`);await this.callHook(`prepare`,{environment:e,order:`post`}),await c.writeMetaFile(e),e.persistedMeta=e.meta}),this.context.log(m.LogLevelLabel.INFO,`Powerlines API has been prepared successfully`)}async new(e){this.context.log(m.LogLevelLabel.INFO,`🆕 Creating a new Powerlines project`),await this.prepare(e),await this.#n(async e=>{e.log(m.LogLevelLabel.TRACE,`Initializing the processing options for the Powerlines project.`),await this.callHook(`new`,{environment:e,order:`pre`});let t=await(0,y.listFiles)((0,f.joinPaths)(e.powerlinesPath,`files/common/**/*.hbs`));for(let n of t){e.log(m.LogLevelLabel.TRACE,`Adding template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,f.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}if(await this.callHook(`new`,{environment:e,order:`normal`}),e.config.projectType===`application`){let t=await(0,y.listFiles)((0,f.joinPaths)(e.powerlinesPath,`files/application/**/*.hbs`));for(let n of t){e.log(m.LogLevelLabel.TRACE,`Adding application template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,f.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}else{let t=await(0,y.listFiles)((0,f.joinPaths)(e.powerlinesPath,`files/library/**/*.hbs`));for(let n of t){e.log(m.LogLevelLabel.TRACE,`Adding library template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,f.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}await this.callHook(`new`,{environment:e,order:`post`})}),this.context.log(m.LogLevelLabel.TRACE,`Powerlines - New command completed`)}async clean(e={command:`clean`}){this.context.log(m.LogLevelLabel.INFO,`🧹 Cleaning the previous Powerlines artifacts`),await this.prepare(e),await this.#n(async e=>{this.context.log(m.LogLevelLabel.TRACE,`Cleaning the project's dist and artifacts directories.`),await e.fs.remove((0,f.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.buildPath)),await e.fs.remove((0,f.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.artifactsPath)),await this.callHook(`clean`,{environment:e,sequential:!1})}),this.context.log(m.LogLevelLabel.TRACE,`Powerlines - Clean command completed`)}async lint(e={command:`lint`}){this.context.log(m.LogLevelLabel.INFO,`📋 Linting the Powerlines project`),await this.prepare(e),await this.#n(async e=>{e.config.lint!==!1&&await this.callHook(`lint`,{environment:e,sequential:!1})}),this.context.log(m.LogLevelLabel.TRACE,`Powerlines linting completed`)}async build(e={command:`build`}){this.context.log(m.LogLevelLabel.INFO,`📦 Building the Powerlines project`),await this.prepare(e),await this.#n(async e=>{if(await this.callHook(`build`,{environment:e,order:`pre`}),await this.callHook(`build`,{environment:e,order:`normal`}),e.config.output.buildPath!==e.config.output.outputPath){let t=(0,S.appendPath)(e.config.output.buildPath,e.workspaceConfig.workspaceRoot),n=(0,f.joinPaths)((0,S.appendPath)(e.config.output.outputPath,e.workspaceConfig.workspaceRoot),`dist`);t!==n&&(e.log(m.LogLevelLabel.INFO,`Copying build output files from project's build directory (${e.config.output.buildPath}) to the workspace's output directory (${e.config.output.outputPath}).`),await e.fs.copy(t,n))}await Promise.all(e.config.output.assets.map(async t=>{e.log(m.LogLevelLabel.DEBUG,`Copying asset(s): ${j.default.redBright(e.workspaceConfig.workspaceRoot===t.input?t.glob:(0,f.joinPaths)((0,C.replacePath)(t.input,e.workspaceConfig.workspaceRoot),t.glob))} -> ${j.default.greenBright((0,f.joinPaths)((0,C.replacePath)(t.output,e.workspaceConfig.workspaceRoot),t.glob))} ${Array.isArray(t.ignore)&&t.ignore.length>0?` (ignoring: ${t.ignore.map(e=>j.default.yellowBright(e)).join(`, `)})`:``}`),await e.fs.copy(t,t.output)})),await this.callHook(`build`,{environment:e,order:`post`})}),this.context.log(m.LogLevelLabel.TRACE,`Powerlines build completed`)}async docs(e={command:`docs`}){this.context.log(m.LogLevelLabel.INFO,`📓 Generating documentation for the Powerlines project`),await this.prepare(e),await this.#n(async t=>{t.log(m.LogLevelLabel.TRACE,`Writing documentation for the Powerlines project artifacts.`),await this.prepare(e),await this.#n(async e=>{await this.callHook(`docs`,{environment:e})})}),this.#e.log(m.LogLevelLabel.TRACE,`Powerlines documentation generation completed`)}async deploy(e={command:`deploy`}){this.context.log(m.LogLevelLabel.INFO,`📦 Deploying the Powerlines project`),await this.prepare(e),await this.#n(async e=>{await this.callHook(`deploy`,{environment:e})}),this.context.log(m.LogLevelLabel.TRACE,`Powerlines deploy completed`)}async finalize(){this.context.log(m.LogLevelLabel.TRACE,`Powerlines finalize execution started`),await this.#n(async e=>{await this.callHook(`finalize`,{environment:e}),await e.fs.dispose()}),this.context.log(m.LogLevelLabel.TRACE,`Powerlines finalize execution completed`)}async callHook(e,t,...n){return r.callHook((0,k.isSetObject)(t?.environment)?t.environment:await this.#e.getEnvironment(t?.environment),e,{sequential:!0,...t},...n)}async[Symbol.asyncDispose](){await this.finalize()}async#t(){return!this.context.config.environments||Object.keys(this.context.config.environments).length<=1?(this.context.log(m.LogLevelLabel.DEBUG,`No environments are configured for this Powerlines project. Using the default environment.`),[await this.context.getEnvironment()]):(this.context.log(m.LogLevelLabel.DEBUG,`Found ${Object.keys(this.context.config.environments).length} configured environment(s) for this Powerlines project.`),(await Promise.all(Object.entries(this.context.config.environments).map(async([e,t])=>{if(!await this.context.getEnvironmentSafe(e)){let n=await this.callHook(`configEnvironment`,{environment:e},e,t);n&&(this.context.environments[e]=await this.context.in(n))}return this.context.environments[e]}))).filter(e=>(0,O.isSet)(e)))}async#n(e){await Promise.all((await this.#t()).map(async t=>Promise.resolve(e(t))))}async#r(e){if(e){let t=await this.#i(e);if(!t)return;if(t.dependsOn)for(let e of t.dependsOn)await this.#r(e);this.context.log(m.LogLevelLabel.DEBUG,`Successfully initialized the ${j.default.bold.cyanBright(t.name)} plugin`),await this.context.addPlugin(t)}}async#i(e){let t=e;if((0,D.isPromiseLike)(e)&&(t=await Promise.resolve(e)),!s.isPluginConfig(t))throw Error(`Invalid plugin specified in the configuration - ${JSON.stringify(t)}. Please ensure the value is a plugin name, an object with the \`plugin\` and \`props\` properties, or an instance of \`Plugin\`.`);let n;if(s.isPlugin(t))n=t;else if((0,p.isFunction)(t))n=await Promise.resolve(t());else if((0,A.isSetString)(t)){let e=await this.#a(t);n=(0,p.isFunction)(e)?await Promise.resolve(e()):e}else if(s.isPluginConfigTuple(t)||s.isPluginConfigObject(t)){let e,r;if(s.isPluginConfigTuple(t)?(e=t[0],r=t?.length===2?t[1]:void 0):(e=t.plugin,r=t.options),(0,A.isSetString)(e)){let t=await this.#a(e);n=(0,p.isFunction)(t)?await Promise.resolve(r?t(r):t()):t}else (0,p.isFunction)(e)?n=await Promise.resolve(e(r)):s.isPlugin(e)&&(n=e)}if(!n)throw Error(`The plugin configuration ${JSON.stringify(t)} is invalid. This configuration must point to a valid Powerlines plugin module.`);if(!s.isPlugin(n))throw Error(`The plugin option ${JSON.stringify(n)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`);return s.checkDedupe(n,this.context.plugins)?(this.context.log(m.LogLevelLabel.TRACE,`Duplicate ${j.default.bold.cyanBright(n.name)} plugin dependency detected - Skipping initialization.`),null):(this.context.log(m.LogLevelLabel.TRACE,`Initializing the ${j.default.bold.cyanBright(n.name)} plugin...`),n)}async#a(e){if(e.startsWith(`@`)&&e.split(`/`).filter(Boolean).length>2){let t=e.split(`/`).filter(Boolean);e=`${t[0]}/${t[1]}`}let t=(0,b.isPackageExists)(e,{paths:[this.context.workspaceConfig.workspaceRoot,this.context.config.projectRoot]});if(!t&&this.context.config.skipInstalls!==!0){this.#e.log(m.LogLevelLabel.WARN,`The plugin package "${e}" is not installed. It will be installed automatically.`);let t=await(0,v.install)(e,{cwd:this.context.config.projectRoot});if((0,T.isNumber)(t.exitCode)&&t.exitCode>0)throw this.#e.log(m.LogLevelLabel.ERROR,t.stderr),Error(`An error occurred while installing the build plugin package "${e}" `)}try{let t=await this.context.resolver.plugin.import(this.context.resolver.plugin.esmResolve((0,f.joinPaths)(e,`plugin`))),n=t.plugin??t.default;if(!n)throw Error(`The plugin package "${e}" does not export a valid module.`);return n}catch(n){try{let t=await this.context.resolver.plugin.import(this.context.resolver.plugin.esmResolve(e)),n=t.plugin??t.default;if(!n)throw Error(`The plugin package "${e}" does not export a valid module.`);return n}catch{throw t?Error(`An error occurred while importing the build plugin package "${e}":
9
+ ${(0,w.isError)(n)?n.message:String(n)}
10
+
11
+ Note: Please ensure the plugin package's default export is a class that extends \`Plugin\` with a constructor that excepts a single arguments of type \`PluginOptions\`.`):Error(`The plugin package "${e}" is not installed. Please install the package using the command: "npm install ${e} --save-dev"`)}}}};
@@ -0,0 +1 @@
1
+ import{moduleResolverBabelPlugin as e}from"./internal/babel/module-resolver-plugin.mjs";import{emitTypes as t,formatTypes as n}from"./internal/helpers/generate-types.mjs";import{callHook as r}from"./internal/helpers/hooks.mjs";import{installDependencies as i}from"./internal/helpers/install-dependencies.mjs";import{getParsedTypeScriptConfig as a,isIncludeMatchFound as o}from"./lib/typescript/tsconfig.mjs";import{getTsconfigDtsPath as s,initializeTsconfig as c,resolveTsconfig as l}from"./internal/helpers/resolve-tsconfig.mjs";import{checkDedupe as u,isPlugin as d,isPluginConfig as f,isPluginConfigObject as p,isPluginConfigTuple as m}from"./plugin-utils/helpers.mjs";import{writeMetaFile as h}from"./lib/utilities/meta.mjs";import{PowerlinesAPIContext as g}from"./lib/contexts/api-context.mjs";import{getFileHeader as _}from"./lib/utilities/file-header.mjs";import{toArray as v}from"@stryke/convert/to-array";import{joinPaths as y}from"@stryke/path/join-paths";import{isFunction as b}from"@stryke/type-checks/is-function";import{LogLevelLabel as x}from"@storm-software/config-tools/types";import{transformAsync as S}from"@babel/core";import{formatLogMessage as C}from"@storm-software/config-tools/logger/console";import{createDirectory as w}from"@stryke/fs/helpers";import{install as T}from"@stryke/fs/install";import{listFiles as E}from"@stryke/fs/list-files";import{isPackageExists as D}from"@stryke/fs/package-fns";import{resolvePackage as O}from"@stryke/fs/resolve";import{appendPath as k}from"@stryke/path/append";import{replacePath as A}from"@stryke/path/replace";import{isError as j}from"@stryke/type-checks/is-error";import{isNumber as M}from"@stryke/type-checks/is-number";import{isObject as N}from"@stryke/type-checks/is-object";import{isPromiseLike as P}from"@stryke/type-checks/is-promise";import{isSet as F}from"@stryke/type-checks/is-set";import{isSetObject as I}from"@stryke/type-checks/is-set-object";import{isSetString as L}from"@stryke/type-checks/is-set-string";import R from"chalk";import z from"handlebars";Symbol.asyncDispose;export{};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@babel/helper-plugin-utils`),n=require(`@babel/types`);n=e.__toESM(n);function r(e,t){if(!n.isStringLiteral(e.node))return;let r=e.node.value,i=t.context?.fs.resolveSync(r);i&&e.replaceWith(n.stringLiteral(i.replace(/\.(?:ts|mts|cts)x?$/,``)))}const i=[`require`,`require.resolve`,`System.import`,`jest.genMockFromModule`,`jest.mock`,`jest.unmock`,`jest.doMock`,`jest.dontMock`,`jest.setMock`,`jest.requireActual`,`jest.requireMock`,`require.requireActual`,`require.requireMock`];function a(e,t,r){let{node:i}=t;if(n.isMemberExpression(i))return t.matchesPattern(r);if(!n.isIdentifier(i)||r.includes(`.`))return!1;let a=r.split(`.`)[0];return i.name===a}const o={CallExpression:(e,t)=>{if(t.moduleResolverVisited.has(e))return;let o=e.get(`callee`);(o&&i.some(e=>a(t,o,e))||n.isImport(e.node.callee))&&(t.moduleResolverVisited.add(e),r(e.get(`arguments.0`),t))},"ImportDeclaration|ExportDeclaration|ExportAllDeclaration":(e,t)=>{!e||!e.get(`source`)||t.moduleResolverVisited.has(e)||(t.moduleResolverVisited.add(e),r(e.get(`source`),t))}},s=e=>(0,t.declare)(function(t){let n=new Set;return{name:`powerlines:module-resolver`,manipulateOptions(e){e.filename??=`unknown`},pre(){n=new Set},visitor:{Program:{enter(r,i){r.traverse(o,{...i,context:e,moduleResolverVisited:n,api:t})},exit(r,i){r.traverse(o,{...i,context:e,moduleResolverVisited:n,api:t})}}},post(){n.clear()}}});exports.moduleResolverBabelPlugin=s;
@@ -0,0 +1 @@
1
+ import{declare as e}from"@babel/helper-plugin-utils";import*as t from"@babel/types";function n(e,n){if(!t.isStringLiteral(e.node))return;let r=e.node.value,i=n.context?.fs.resolveSync(r);i&&e.replaceWith(t.stringLiteral(i.replace(/\.(?:ts|mts|cts)x?$/,``)))}const r=[`require`,`require.resolve`,`System.import`,`jest.genMockFromModule`,`jest.mock`,`jest.unmock`,`jest.doMock`,`jest.dontMock`,`jest.setMock`,`jest.requireActual`,`jest.requireMock`,`require.requireActual`,`require.requireMock`];function i(e,n,r){let{node:i}=n;if(t.isMemberExpression(i))return n.matchesPattern(r);if(!t.isIdentifier(i)||r.includes(`.`))return!1;let a=r.split(`.`)[0];return i.name===a}const a={CallExpression:(e,a)=>{if(a.moduleResolverVisited.has(e))return;let o=e.get(`callee`);(o&&r.some(e=>i(a,o,e))||t.isImport(e.node.callee))&&(a.moduleResolverVisited.add(e),n(e.get(`arguments.0`),a))},"ImportDeclaration|ExportDeclaration|ExportAllDeclaration":(e,t)=>{!e||!e.get(`source`)||t.moduleResolverVisited.has(e)||(t.moduleResolverVisited.add(e),n(e.get(`source`),t))}},o=t=>e(function(e){let n=new Set;return{name:`powerlines:module-resolver`,manipulateOptions(e){e.filename??=`unknown`},pre(){n=new Set},visitor:{Program:{enter(r,i){r.traverse(a,{...i,context:t,moduleResolverVisited:n,api:e})},exit(r,i){r.traverse(a,{...i,context:t,moduleResolverVisited:n,api:e})}}},post(){n.clear()}}});export{o as moduleResolverBabelPlugin};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`defu`);t=e.__toESM(t);let n=require(`@stryke/string-format/title-case`);const r=`default`;function i(e,r){return(0,t.default)(r.environments?.[e]??{},{name:e,title:r.title||(0,n.titleCase)(r.name),ssr:!1,mainFields:r.build?.platform===`browser`?[`browser`,`module`,`jsnext:main`,`jsnext`]:[`module`,`jsnext:main`,`jsnext`],extensions:[`.mjs`,`.js`,`.mts`,`.ts`,`.jsx`,`.tsx`,`.json`],consumer:r.build?.platform===`browser`?`client`:`server`,preview:r.build?.platform===`browser`?{port:5173,open:!0,strictPort:!1,host:`localhost`,allowedHosts:[`.`],cors:!0,headers:{}}:void 0},r)}function a(e){return i(`default`,e)}exports.createDefaultEnvironment=a,exports.createEnvironment=i;
@@ -0,0 +1 @@
1
+ import e from"defu";import{titleCase as t}from"@stryke/string-format/title-case";function n(n,r){return e(r.environments?.[n]??{},{name:n,title:r.title||t(r.name),ssr:!1,mainFields:r.build?.platform===`browser`?[`browser`,`module`,`jsnext:main`,`jsnext`]:[`module`,`jsnext:main`,`jsnext`],extensions:[`.mjs`,`.js`,`.mts`,`.ts`,`.jsx`,`.tsx`,`.json`],consumer:r.build?.platform===`browser`?`client`:`server`,preview:r.build?.platform===`browser`?{port:5173,open:!0,strictPort:!1,host:`localhost`,allowedHosts:[`.`],cors:!0,headers:{}}:void 0},r)}function r(e){return n(`default`,e)}export{r as createDefaultEnvironment,n as createEnvironment};
@@ -0,0 +1,8 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../lib/typescript/ts-morph.cjs`);let n=require(`@storm-software/config-tools/types`),r=require(`typescript`);function i(e){return e.replace(/import\s*(?:type\s*)?\{?[\w,\s]*(?:\}\s*)?from\s*(?:'|")@?[a-zA-Z0-9-\\/.]*(?:'|");?/g,``).replaceAll(`#private;`,``).replace(/__Ω/g,``)}async function a(e,a){e.log(n.LogLevelLabel.TRACE,`Running the TypeScript compiler for ${a.length} generated runtime files.`);let o=t.createProgram(e,{skipAddingFilesFromTsConfig:!0});o.addSourceFilesAtPaths(a);let s=o.emitToMemory({emitOnlyDtsFiles:!0}),c=``;for(let t of s.getFiles())if(!t.filePath.endsWith(`.map`)&&e.builtins.some(n=>n===t.filePath||e.fs.metadata[n]?.id&&e.fs.metadata[n]?.id===t.filePath)){let n=await e.fs.resolve(t.filePath);c+=`
2
+ declare module "${n}" {
3
+ ${t.text.trim().replace(/^\s*export\s*declare\s*/gm,`export `).replace(/^\s*declare\s*/gm,``)}
4
+ }
5
+ `}let l=[];s.getDiagnostics().forEach(e=>{e.getSourceFile()?.getBaseName()?l.push(`${e.getSourceFile()?.getBaseName()} (${(e.getLineNumber()??0)+1}): ${(0,r.flattenDiagnosticMessageText)(e.getMessageText().toString(),`
6
+ `)}`):l.push((0,r.flattenDiagnosticMessageText)(e.getMessageText().toString(),`
7
+ `))});let u=l.join(`
8
+ `);if(u)throw Error(`TypeScript compilation failed: \n\n${u.length>5e3?`${u.slice(0,5e3)}...`:u}`);return i(c)}exports.emitTypes=a,exports.formatTypes=i;
@@ -0,0 +1,8 @@
1
+ import{createProgram as e}from"../../lib/typescript/ts-morph.mjs";import{LogLevelLabel as t}from"@storm-software/config-tools/types";import{flattenDiagnosticMessageText as n}from"typescript";function r(e){return e.replace(/import\s*(?:type\s*)?\{?[\w,\s]*(?:\}\s*)?from\s*(?:'|")@?[a-zA-Z0-9-\\/.]*(?:'|");?/g,``).replaceAll(`#private;`,``).replace(/__Ω/g,``)}async function i(i,a){i.log(t.TRACE,`Running the TypeScript compiler for ${a.length} generated runtime files.`);let o=e(i,{skipAddingFilesFromTsConfig:!0});o.addSourceFilesAtPaths(a);let s=o.emitToMemory({emitOnlyDtsFiles:!0}),c=``;for(let e of s.getFiles())if(!e.filePath.endsWith(`.map`)&&i.builtins.some(t=>t===e.filePath||i.fs.metadata[t]?.id&&i.fs.metadata[t]?.id===e.filePath)){let t=await i.fs.resolve(e.filePath);c+=`
2
+ declare module "${t}" {
3
+ ${e.text.trim().replace(/^\s*export\s*declare\s*/gm,`export `).replace(/^\s*declare\s*/gm,``)}
4
+ }
5
+ `}let l=[];s.getDiagnostics().forEach(e=>{e.getSourceFile()?.getBaseName()?l.push(`${e.getSourceFile()?.getBaseName()} (${(e.getLineNumber()??0)+1}): ${n(e.getMessageText().toString(),`
6
+ `)}`):l.push(n(e.getMessageText().toString(),`
7
+ `))});let u=l.join(`
8
+ `);if(u)throw Error(`TypeScript compilation failed: \n\n${u.length>5e3?`${u.slice(0,5e3)}...`:u}`);return r(c)}export{i as emitTypes,r as formatTypes};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`defu`),n=require(`@stryke/type-checks/is-function`),r=require(`@stryke/type-checks/is-string`),i=require(`@storm-software/config-tools/types`),a=require(`@stryke/type-checks/is-object`),o=require(`@stryke/type-checks/is-set`),s=require(`chalk`);s=e.__toESM(s);const c=(0,t.createDefu)((e,t,n)=>(0,r.isString)(e[t])&&(0,r.isString)(n)?(e[t]=`${e[t]||``}\n${n||``}`.trim(),!0):!1);async function l(e,l,u,...d){let f=e.selectHooks(l,u);if(f.length>0){e.log(i.LogLevelLabel.DEBUG,` 🧩 Calling plugin hook: ${s.default.bold.cyanBright(`${l}${u?.order?` (${u.order})`:``}`)}`);let p=[];if(u?.sequential===!1)p=await Promise.all(f.map(async e=>{if(!(0,n.isFunction)(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);return Promise.resolve(e.handle.apply(e.context,[...d]))}));else for(let e of f){if(!(0,n.isFunction)(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);if(u?.result===`first`||u?.asNextParam===!1){if(p.push(await Promise.resolve(e.handle.apply(e.context,[...d]))),u?.result===`first`&&(0,o.isSet)(p[p.length-1]))break}else{let t=[...d];p.length>0&&t.length>0&&(t[0]=(0,n.isFunction)(u.asNextParam)?await Promise.resolve(u.asNextParam(p[0])):p[0]);let i=await Promise.resolve(e.handle.apply(e.context,[...t]));i&&(u?.result===`last`?p=[i]:(0,r.isString)(i)?p=[`${(0,r.isString)(p[0])&&p[0]||``}\n${i||``}`.trim()]:(0,a.isObject)(i)&&(p=[c(i,p[0]??{})]))}}let m=p.filter(e=>(0,o.isSet)(e));if(m.length>0){let e;for(let n of m)e=(0,t.defu)(n,e??{});return e}}}exports.callHook=l;
@@ -0,0 +1 @@
1
+ import{createDefu as e,defu as t}from"defu";import{isFunction as n}from"@stryke/type-checks/is-function";import{isString as r}from"@stryke/type-checks/is-string";import{LogLevelLabel as i}from"@storm-software/config-tools/types";import{isObject as a}from"@stryke/type-checks/is-object";import{isSet as o}from"@stryke/type-checks/is-set";import s from"chalk";const c=e((e,t,n)=>r(e[t])&&r(n)?(e[t]=`${e[t]||``}\n${n||``}`.trim(),!0):!1);async function l(e,l,u,...d){let f=e.selectHooks(l,u);if(f.length>0){e.log(i.DEBUG,` 🧩 Calling plugin hook: ${s.bold.cyanBright(`${l}${u?.order?` (${u.order})`:``}`)}`);let p=[];if(u?.sequential===!1)p=await Promise.all(f.map(async e=>{if(!n(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);return Promise.resolve(e.handle.apply(e.context,[...d]))}));else for(let e of f){if(!n(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);if(u?.result===`first`||u?.asNextParam===!1){if(p.push(await Promise.resolve(e.handle.apply(e.context,[...d]))),u?.result===`first`&&o(p[p.length-1]))break}else{let t=[...d];p.length>0&&t.length>0&&(t[0]=n(u.asNextParam)?await Promise.resolve(u.asNextParam(p[0])):p[0]);let i=await Promise.resolve(e.handle.apply(e.context,[...t]));i&&(u?.result===`last`?p=[i]:r(i)?p=[`${r(p[0])&&p[0]||``}\n${i||``}`.trim()]:a(i)&&(p=[c(i,p[0]??{})]))}}let m=p.filter(e=>o(e));if(m.length>0){let e;for(let n of m)e=t(n,e??{});return e}}}export{l as callHook};
@@ -0,0 +1,3 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`./install.cjs`);let n=require(`@storm-software/config-tools/types`),r=require(`@stryke/string-format/package`);async function i(e){if(e.log(n.LogLevelLabel.TRACE,`Checking and installing missing project dependencies.`),e.dependencies??={},e.devDependencies??={},Object.keys(e.dependencies).length===0&&Object.keys(e.devDependencies).length===0){e.log(n.LogLevelLabel.TRACE,`No dependencies or devDependencies to install. Skipping installation step.`);return}e.log(n.LogLevelLabel.DEBUG,`The following packages are required: \nDependencies: \n${Object.entries(e.dependencies).map(([e,t])=>`- ${e}@${String(t)}`).join(`
2
+ `)}\n\nDevDependencies: \n${Object.entries(e.devDependencies).map(([e,t])=>`- ${e}@${String(t)}`).join(`
3
+ `)}`),await Promise.all([Promise.all(Object.entries(e.dependencies).map(async([n,i])=>t.installPackage(e,`${(0,r.getPackageName)(n)}@${String(i)}`,!1))),Promise.all(Object.entries(e.devDependencies).map(async([n,i])=>t.installPackage(e,`${(0,r.getPackageName)(n)}@${String(i)}`,!0)))])}exports.installDependencies=i;
@@ -0,0 +1,3 @@
1
+ import{installPackage as e}from"./install.mjs";import{LogLevelLabel as t}from"@storm-software/config-tools/types";import{getPackageName as n}from"@stryke/string-format/package";async function r(r){if(r.log(t.TRACE,`Checking and installing missing project dependencies.`),r.dependencies??={},r.devDependencies??={},Object.keys(r.dependencies).length===0&&Object.keys(r.devDependencies).length===0){r.log(t.TRACE,`No dependencies or devDependencies to install. Skipping installation step.`);return}r.log(t.DEBUG,`The following packages are required: \nDependencies: \n${Object.entries(r.dependencies).map(([e,t])=>`- ${e}@${String(t)}`).join(`
2
+ `)}\n\nDevDependencies: \n${Object.entries(r.devDependencies).map(([e,t])=>`- ${e}@${String(t)}`).join(`
3
+ `)}`),await Promise.all([Promise.all(Object.entries(r.dependencies).map(async([t,i])=>e(r,`${n(t)}@${String(i)}`,!1))),Promise.all(Object.entries(r.devDependencies).map(async([t,i])=>e(r,`${n(t)}@${String(i)}`,!0)))])}export{r as installDependencies};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`@stryke/fs/install`),r=require(`@stryke/fs/package-fns`),i=require(`@stryke/type-checks/is-number`),a=require(`@stryke/string-format/package`);async function o(e,o,s=!1){if(await(0,r.isPackageListed)((0,a.getPackageName)(o),{cwd:e.config.projectRoot})){if((0,a.hasPackageVersion)(o)&&!process.env.POWERLINES_SKIP_VERSION_CHECK&&!await(0,r.doesPackageMatch)((0,a.getPackageName)(o),(0,a.getPackageVersion)(o),e.config.projectRoot)){let n=await(0,r.getPackageListing)((0,a.getPackageName)(o),{cwd:e.config.projectRoot});!n?.version.startsWith(`catalog:`)&&!n?.version.startsWith(`workspace:`)&&e.log(t.LogLevelLabel.WARN,`The package "${(0,a.getPackageName)(o)}" is installed but does not match the expected version ${(0,a.getPackageVersion)(o)} (installed version: ${n?.version||`<Unknown>`}). Please ensure this is intentional before proceeding. Note: You can skip this validation with the "STORM_STACK_SKIP_VERSION_CHECK" environment variable.`)}}else if(e.config.skipInstalls!==!0){e.log(t.LogLevelLabel.WARN,`The package "${o}" is not installed. It will be installed automatically.`);let r=await(0,n.install)(o,{cwd:e.config.projectRoot,dev:s});if((0,i.isNumber)(r.exitCode)&&r.exitCode>0)throw e.log(t.LogLevelLabel.ERROR,r.stderr),Error(`An error occurred while installing the package "${o}"`)}else e.log(t.LogLevelLabel.WARN,`The package "${o}" is not installed. Since the "skipInstalls" option is set to true, it will not be installed automatically.`)}exports.installPackage=o;
@@ -0,0 +1 @@
1
+ import{LogLevelLabel as e}from"@storm-software/config-tools/types";import{install as t}from"@stryke/fs/install";import{doesPackageMatch as n,getPackageListing as r,isPackageListed as i}from"@stryke/fs/package-fns";import{isNumber as a}from"@stryke/type-checks/is-number";import{getPackageName as o,getPackageVersion as s,hasPackageVersion as c}from"@stryke/string-format/package";async function l(l,u,d=!1){if(await i(o(u),{cwd:l.config.projectRoot})){if(c(u)&&!process.env.POWERLINES_SKIP_VERSION_CHECK&&!await n(o(u),s(u),l.config.projectRoot)){let t=await r(o(u),{cwd:l.config.projectRoot});!t?.version.startsWith(`catalog:`)&&!t?.version.startsWith(`workspace:`)&&l.log(e.WARN,`The package "${o(u)}" is installed but does not match the expected version ${s(u)} (installed version: ${t?.version||`<Unknown>`}). Please ensure this is intentional before proceeding. Note: You can skip this validation with the "STORM_STACK_SKIP_VERSION_CHECK" environment variable.`)}}else if(l.config.skipInstalls!==!0){l.log(e.WARN,`The package "${u}" is not installed. It will be installed automatically.`);let n=await t(u,{cwd:l.config.projectRoot,dev:d});if(a(n.exitCode)&&n.exitCode>0)throw l.log(e.ERROR,n.stderr),Error(`An error occurred while installing the package "${u}"`)}else l.log(e.WARN,`The package "${u}" is not installed. Since the "skipInstalls" option is set to true, it will not be installed automatically.`)}export{l as installPackage};
@@ -0,0 +1,8 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../lib/typescript/tsconfig.cjs`);let n=require(`@stryke/path/join-paths`),r=require(`@storm-software/config-tools/types`),i=require(`@stryke/fs/package-fns`),a=require(`chalk`);a=e.__toESM(a);let o=require(`@donedeal0/superdiff`),s=require(`@stryke/fs/json`),c=require(`@stryke/json/storm-json`),l=require(`@stryke/path/file-path-fns`),u=require(`@stryke/string-format/title-case`);function d(e){return(0,n.joinPaths)((0,l.relativePath)((0,n.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot),(0,l.findFilePath)(e.dtsPath)),(0,l.findFileName)(e.dtsPath))}async function f(e){let n=t.getParsedTypeScriptConfig(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.config.tsconfig,e.config.tsconfigRaw),r=await(0,s.readJsonFile)(t.getTsconfigFilePath(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.config.tsconfig));if(r.compilerOptions??={},e.config.output.dts!==!1){let n=d(e);r.include?.some(r=>t.isIncludeMatchFound(r,[e.dtsPath,n]))||(r.include??=[],r.include.push(n.startsWith(`./`)?n.slice(2):n))}return n.options.lib?.some(e=>[`lib.esnext.d.ts`,`lib.es2021.d.ts`,`lib.es2022.d.ts`,`lib.es2023.d.ts`].includes(e.toLowerCase()))||(r.compilerOptions.lib??=[],r.compilerOptions.lib.push(`esnext`)),n.options.esModuleInterop!==!0&&(r.compilerOptions.esModuleInterop=!0),n.options.isolatedModules!==!0&&(r.compilerOptions.isolatedModules=!0),e.config.build.platform===`node`&&(n.options.types?.some(e=>e.toLowerCase()===`node`||e.toLowerCase()===`@types/node`)||(r.compilerOptions.types??=[],r.compilerOptions.types.push(`node`))),r}async function p(e){if(e.log(r.LogLevelLabel.TRACE,`Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.`),!(0,i.isPackageExists)(`typescript`))throw Error(`The TypeScript package is not installed. Please install the package using the command: "npm install typescript --save-dev"`);let n=t.getTsconfigFilePath(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.config.tsconfig);e.tsconfig.originalTsconfigJson=await(0,s.readJsonFile)(n),e.tsconfig.tsconfigJson=await f(e),e.log(r.LogLevelLabel.TRACE,`Writing updated TypeScript configuration (tsconfig.json) file to disk.`),await e.fs.write(n,c.StormJSON.stringify(e.tsconfig.tsconfigJson)),e.tsconfig=t.getParsedTypeScriptConfig(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.config.tsconfig,e.config.tsconfigRaw,e.tsconfig.originalTsconfigJson)}async function m(e){let n=await(0,s.readJsonFile)(e.tsconfig.tsconfigFilePath);n?.compilerOptions?.types&&Array.isArray(n.compilerOptions.types)&&!n.compilerOptions.types.length&&delete n.compilerOptions.types;let i=(0,o.getObjectDiff)(e.tsconfig.originalTsconfigJson,n,{ignoreArrayOrder:!0,showOnly:{statuses:[`added`,`deleted`,`updated`],granularity:`deep`}}),l=[],d=(e,t)=>{if(e.status===`added`||e.status===`deleted`||e.status===`updated`)if(e.diff)for(let n of e.diff)d(n,t?`${t}.${e.property}`:e.property);else l.push({field:t?`${t}.${e.property}`:e.property,status:e.status,previous:e.status===`added`?`---`:c.StormJSON.stringify(e.previousValue),current:e.status===`deleted`?`---`:c.StormJSON.stringify(e.currentValue)})};for(let e of i.diff)d(e);if(l.length>0&&e.log(r.LogLevelLabel.WARN,`Updating the following configuration values in "${e.tsconfig.tsconfigFilePath}" file:
2
+
3
+ ${l.map((e,t)=>`${a.default.bold.whiteBright(`${t+1}. ${(0,u.titleCase)(e.status)} the ${e.field} field: `)}
4
+ ${a.default.red(` - Previous: ${e.previous} `)}
5
+ ${a.default.green(` - Updated: ${e.current} `)}
6
+ `).join(`
7
+ `)}
8
+ `),await e.fs.write(e.tsconfig.tsconfigFilePath,c.StormJSON.stringify(n)),e.tsconfig=t.getParsedTypeScriptConfig(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.config.tsconfig),!e.tsconfig)throw Error(`Failed to parse the TypeScript configuration file.`)}exports.getTsconfigDtsPath=d,exports.initializeTsconfig=p,exports.resolveTsconfig=m;
@@ -0,0 +1,8 @@
1
+ import{getParsedTypeScriptConfig as e,getTsconfigFilePath as t,isIncludeMatchFound as n}from"../../lib/typescript/tsconfig.mjs";import{joinPaths as r}from"@stryke/path/join-paths";import{LogLevelLabel as i}from"@storm-software/config-tools/types";import{isPackageExists as a}from"@stryke/fs/package-fns";import o from"chalk";import{getObjectDiff as s}from"@donedeal0/superdiff";import{readJsonFile as c}from"@stryke/fs/json";import{StormJSON as l}from"@stryke/json/storm-json";import{findFileName as u,findFilePath as d,relativePath as f}from"@stryke/path/file-path-fns";import{titleCase as p}from"@stryke/string-format/title-case";function m(e){return r(f(r(e.workspaceConfig.workspaceRoot,e.config.projectRoot),d(e.dtsPath)),u(e.dtsPath))}async function h(r){let i=e(r.workspaceConfig.workspaceRoot,r.config.projectRoot,r.config.tsconfig,r.config.tsconfigRaw),a=await c(t(r.workspaceConfig.workspaceRoot,r.config.projectRoot,r.config.tsconfig));if(a.compilerOptions??={},r.config.output.dts!==!1){let e=m(r);a.include?.some(t=>n(t,[r.dtsPath,e]))||(a.include??=[],a.include.push(e.startsWith(`./`)?e.slice(2):e))}return i.options.lib?.some(e=>[`lib.esnext.d.ts`,`lib.es2021.d.ts`,`lib.es2022.d.ts`,`lib.es2023.d.ts`].includes(e.toLowerCase()))||(a.compilerOptions.lib??=[],a.compilerOptions.lib.push(`esnext`)),i.options.esModuleInterop!==!0&&(a.compilerOptions.esModuleInterop=!0),i.options.isolatedModules!==!0&&(a.compilerOptions.isolatedModules=!0),r.config.build.platform===`node`&&(i.options.types?.some(e=>e.toLowerCase()===`node`||e.toLowerCase()===`@types/node`)||(a.compilerOptions.types??=[],a.compilerOptions.types.push(`node`))),a}async function g(n){if(n.log(i.TRACE,`Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.`),!a(`typescript`))throw Error(`The TypeScript package is not installed. Please install the package using the command: "npm install typescript --save-dev"`);let r=t(n.workspaceConfig.workspaceRoot,n.config.projectRoot,n.config.tsconfig);n.tsconfig.originalTsconfigJson=await c(r),n.tsconfig.tsconfigJson=await h(n),n.log(i.TRACE,`Writing updated TypeScript configuration (tsconfig.json) file to disk.`),await n.fs.write(r,l.stringify(n.tsconfig.tsconfigJson)),n.tsconfig=e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,n.config.tsconfig,n.config.tsconfigRaw,n.tsconfig.originalTsconfigJson)}async function _(t){let n=await c(t.tsconfig.tsconfigFilePath);n?.compilerOptions?.types&&Array.isArray(n.compilerOptions.types)&&!n.compilerOptions.types.length&&delete n.compilerOptions.types;let r=s(t.tsconfig.originalTsconfigJson,n,{ignoreArrayOrder:!0,showOnly:{statuses:[`added`,`deleted`,`updated`],granularity:`deep`}}),a=[],u=(e,t)=>{if(e.status===`added`||e.status===`deleted`||e.status===`updated`)if(e.diff)for(let n of e.diff)u(n,t?`${t}.${e.property}`:e.property);else a.push({field:t?`${t}.${e.property}`:e.property,status:e.status,previous:e.status===`added`?`---`:l.stringify(e.previousValue),current:e.status===`deleted`?`---`:l.stringify(e.currentValue)})};for(let e of r.diff)u(e);if(a.length>0&&t.log(i.WARN,`Updating the following configuration values in "${t.tsconfig.tsconfigFilePath}" file:
2
+
3
+ ${a.map((e,t)=>`${o.bold.whiteBright(`${t+1}. ${p(e.status)} the ${e.field} field: `)}
4
+ ${o.red(` - Previous: ${e.previous} `)}
5
+ ${o.green(` - Updated: ${e.current} `)}
6
+ `).join(`
7
+ `)}
8
+ `),await t.fs.write(t.tsconfig.tsconfigFilePath,l.stringify(n)),t.tsconfig=e(t.workspaceConfig.workspaceRoot,t.config.projectRoot,t.config.tsconfig),!t.tsconfig)throw Error(`Failed to parse the TypeScript configuration file.`)}export{m as getTsconfigDtsPath,g as initializeTsconfig,_ as resolveTsconfig};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`defu`);t=e.__toESM(t);let n=require(`@stryke/path/join-paths`),r=require(`jiti`);function i(e){return(0,t.default)(e,{interopDefault:!0,fsCache:e.mode===`development`?!1:(0,n.joinPaths)(e.cacheDir,`jiti`),moduleCache:e.mode!==`development`})}function a(e){return(0,r.createJiti)((0,n.joinPaths)(e.workspaceRoot,e.projectRoot),i({...e}))}function o(e){let t=(0,r.createJiti)((0,n.joinPaths)(e.workspaceRoot,e.projectRoot),i(e));return t.plugin=a(e),t}exports.createResolver=o;
@@ -0,0 +1 @@
1
+ import e from"defu";import{joinPaths as t}from"@stryke/path/join-paths";import{createJiti as n}from"jiti";function r(n){return e(n,{interopDefault:!0,fsCache:n.mode===`development`?!1:t(n.cacheDir,`jiti`),moduleCache:n.mode!==`development`})}function i(e){return n(t(e.workspaceRoot,e.projectRoot),r({...e}))}function a(e){let a=n(t(e.workspaceRoot,e.projectRoot),r(e));return a.plugin=i(e),a}export{a as createResolver};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/convert/to-array`),n=require(`defu`);n=e.__toESM(n);let r=require(`@rollup/plugin-alias`);r=e.__toESM(r);let i=require(`@rollup/plugin-babel`),a=require(`@rollup/plugin-inject`);a=e.__toESM(a);let o=require(`@rollup/plugin-node-resolve`);o=e.__toESM(o);let s=require(`@rollup/plugin-replace`);s=e.__toESM(s);let c=require(`@stryke/helpers/omit`),l=require(`@stryke/path/join-paths`),u=require(`@stryke/type-checks/is-function`),d=require(`@stryke/type-checks/is-string`),f=require(`node:fs`),p=require(`rollup-plugin-typescript2`);p=e.__toESM(p);const m={name:`powerlines:dts-bundle`,async generateBundle(e,t){for(let[,e]of Object.entries(t)){if(e.type===`asset`||!e.isEntry||e.facadeModuleId==null)continue;let t=e.fileName.replace(/(?:\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/,`.d.ts`),n=JSON.stringify(`./${e.facadeModuleId.replace(/\.[cm]?[jt]sx?$/,``)}`);this.emitFile({type:`asset`,fileName:t,source:e.exports.includes(`default`)?`export * from ${n};\nexport { default } from ${n};\n`:`export * from ${n};\n`})}}};function h(e){return(0,n.default)({input:(0,f.globSync)((0,t.toArray)(e.config.entry).map(e=>(0,d.isString)(e)?e:e.file)).flat(),external:(n,r,i)=>{let a=e.config.build.variant===`rollup`&&e.config.build.override.external?(0,u.isFunction)(e.config.build.override.external)?e.config.build.override.external:n=>(0,t.toArray)(e.config.build.override.external).includes(n):e.config.build.variant===`vite`&&e.config.build.override.build?.rollupOptions?.external?(0,u.isFunction)(e.config.build.override.build?.rollupOptions?.external)?e.config.build.override.build?.rollupOptions?.external:n=>(0,t.toArray)(e.config.build?.build?.rollupOptions?.external).includes(n):e.config.build.variant===`rollup`&&e.config.build.external?(0,u.isFunction)(e.config.build.external)?e.config.build.external:n=>(0,t.toArray)(e.config.build.external).includes(n):e.config.build.variant===`vite`&&e.config.build.build?.rollupOptions?.external?(0,u.isFunction)(e.config.build.build?.rollupOptions?.external)?e.config.build.build?.rollupOptions?.external:n=>(0,t.toArray)(e.config.build?.build?.rollupOptions?.external).includes(n):void 0;return(0,u.isFunction)(a)&&a(n,r,i)||e.config.build.external&&(0,t.toArray)(e.config.build.external).includes(n)?!0:e.config.build.noExternal&&(0,t.toArray)(e.config.build.noExternal).includes(n)?!1:e.builtins.includes(n)?e.config.projectType!==`application`:!e.config.build.skipNodeModulesBundle},plugins:[(0,p.default)({check:!1,tsconfig:e.tsconfig.tsconfigFilePath}),e.config.build.define&&Object.keys(e.config.build.define).length>0&&(0,s.default)({sourceMap:e.config.mode===`development`,preventAssignment:!0,...e.config.build.define??{}}),e.config.build.inject&&Object.keys(e.config.build.inject).length>0&&(0,a.default)({sourceMap:e.config.mode===`development`,...e.config.build.inject}),(0,r.default)({entries:e.builtins.reduce((t,n)=>{if(!t.find(e=>e.find===n)){let r=e.fs.ids[n];r&&t.push({find:n,replacement:r})}return t},e.config.build.alias?Array.isArray(e.config.build.alias)?e.config.build.alias:Object.entries(e.config.build.alias).reduce((e,[t,n])=>(e.find(e=>e.find===t)||e.push({find:t,replacement:n}),e),[]):[])}),(0,i.getBabelInputPlugin)((0,n.default)(e.config.transform.babel,{caller:{name:`powerlines`,supportsStaticESM:!0},cwd:e.config.projectRoot,babelrc:!1,extensions:[`.js`,`.jsx`,`.ts`,`.tsx`],babelHelpers:`bundled`,skipPreflightCheck:!0,exclude:/node_modules/})),(0,o.default)({moduleDirectories:[`node_modules`],preferBuiltins:!0}),m].filter(Boolean)},e.config.build.variant===`rollup`?e.config.build.override:{},e.config.build.variant===`vite`?e.config.build.override.build?.rollupOptions:{},e.config.build.variant===`rollup`?(0,c.omit)(e.config.build,[`override`,`variant`]):{},e.config.build.variant===`vite`?e.config.build.build?.rollupOptions:{},{cache:e.config.skipCache?!1:(0,l.joinPaths)(e.cachePath,`rollup`),logLevel:e.config.logLevel,output:[{dir:e.config.output.buildPath,format:`es`,entryFileNames:`[name].js`,preserveModules:!0,sourcemap:e.config.mode===`development`},{dir:e.config.output.buildPath,format:`cjs`,entryFileNames:`[name].cjs`,preserveModules:!0,sourcemap:e.config.mode===`development`}]})}exports.extractRollupConfig=h;
@@ -0,0 +1 @@
1
+ import{toArray as e}from"@stryke/convert/to-array";import t from"defu";import n from"@rollup/plugin-alias";import{getBabelInputPlugin as r}from"@rollup/plugin-babel";import i from"@rollup/plugin-inject";import a from"@rollup/plugin-node-resolve";import o from"@rollup/plugin-replace";import{omit as s}from"@stryke/helpers/omit";import{joinPaths as c}from"@stryke/path/join-paths";import{isFunction as l}from"@stryke/type-checks/is-function";import{isString as u}from"@stryke/type-checks/is-string";import{globSync as d}from"node:fs";import f from"rollup-plugin-typescript2";const p={name:`powerlines:dts-bundle`,async generateBundle(e,t){for(let[,e]of Object.entries(t)){if(e.type===`asset`||!e.isEntry||e.facadeModuleId==null)continue;let t=e.fileName.replace(/(?:\.cjs|\.mjs|\.esm\.js|\.cjs\.js|\.mjs\.js|\.js)$/,`.d.ts`),n=JSON.stringify(`./${e.facadeModuleId.replace(/\.[cm]?[jt]sx?$/,``)}`);this.emitFile({type:`asset`,fileName:t,source:e.exports.includes(`default`)?`export * from ${n};\nexport { default } from ${n};\n`:`export * from ${n};\n`})}}};function m(m){return t({input:d(e(m.config.entry).map(e=>u(e)?e:e.file)).flat(),external:(t,n,r)=>{let i=m.config.build.variant===`rollup`&&m.config.build.override.external?l(m.config.build.override.external)?m.config.build.override.external:t=>e(m.config.build.override.external).includes(t):m.config.build.variant===`vite`&&m.config.build.override.build?.rollupOptions?.external?l(m.config.build.override.build?.rollupOptions?.external)?m.config.build.override.build?.rollupOptions?.external:t=>e(m.config.build?.build?.rollupOptions?.external).includes(t):m.config.build.variant===`rollup`&&m.config.build.external?l(m.config.build.external)?m.config.build.external:t=>e(m.config.build.external).includes(t):m.config.build.variant===`vite`&&m.config.build.build?.rollupOptions?.external?l(m.config.build.build?.rollupOptions?.external)?m.config.build.build?.rollupOptions?.external:t=>e(m.config.build?.build?.rollupOptions?.external).includes(t):void 0;return l(i)&&i(t,n,r)||m.config.build.external&&e(m.config.build.external).includes(t)?!0:m.config.build.noExternal&&e(m.config.build.noExternal).includes(t)?!1:m.builtins.includes(t)?m.config.projectType!==`application`:!m.config.build.skipNodeModulesBundle},plugins:[f({check:!1,tsconfig:m.tsconfig.tsconfigFilePath}),m.config.build.define&&Object.keys(m.config.build.define).length>0&&o({sourceMap:m.config.mode===`development`,preventAssignment:!0,...m.config.build.define??{}}),m.config.build.inject&&Object.keys(m.config.build.inject).length>0&&i({sourceMap:m.config.mode===`development`,...m.config.build.inject}),n({entries:m.builtins.reduce((e,t)=>{if(!e.find(e=>e.find===t)){let n=m.fs.ids[t];n&&e.push({find:t,replacement:n})}return e},m.config.build.alias?Array.isArray(m.config.build.alias)?m.config.build.alias:Object.entries(m.config.build.alias).reduce((e,[t,n])=>(e.find(e=>e.find===t)||e.push({find:t,replacement:n}),e),[]):[])}),r(t(m.config.transform.babel,{caller:{name:`powerlines`,supportsStaticESM:!0},cwd:m.config.projectRoot,babelrc:!1,extensions:[`.js`,`.jsx`,`.ts`,`.tsx`],babelHelpers:`bundled`,skipPreflightCheck:!0,exclude:/node_modules/})),a({moduleDirectories:[`node_modules`],preferBuiltins:!0}),p].filter(Boolean)},m.config.build.variant===`rollup`?m.config.build.override:{},m.config.build.variant===`vite`?m.config.build.override.build?.rollupOptions:{},m.config.build.variant===`rollup`?s(m.config.build,[`override`,`variant`]):{},m.config.build.variant===`vite`?m.config.build.build?.rollupOptions:{},{cache:m.config.skipCache?!1:c(m.cachePath,`rollup`),logLevel:m.config.logLevel,output:[{dir:m.config.output.buildPath,format:`es`,entryFileNames:`[name].js`,preserveModules:!0,sourcemap:m.config.mode===`development`},{dir:m.config.output.buildPath,format:`cjs`,entryFileNames:`[name].cjs`,preserveModules:!0,sourcemap:m.config.mode===`development`}]})}export{m as extractRollupConfig};
@@ -0,0 +1 @@
1
+ const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`defu`);t=e.__toESM(t);let n=require(`@stryke/path/join-paths`),r=require(`@stryke/type-checks/is-function`),i=require(`@stryke/path/append`),a=require(`@stryke/path/replace`),o=require(`@stryke/type-checks/is-set-object`),s=require(`@stryke/fs/exists`),c=require(`@storm-software/config-tools/get-config`),l=require(`c12`);async function u(e,n){return(0,t.default)({workspaceRoot:e},await(0,c.getWorkspaceConfig)(!0,{cwd:n,workspaceRoot:e,useDefault:!0}))}async function d(e,c,u,d,f=`production`,p,m=`powerlines`){let h={},g;if(p&&(g=(0,s.existsSync)((0,a.replacePath)(p,e))?(0,a.replacePath)(p,e):(0,s.existsSync)((0,n.joinPaths)((0,i.appendPath)(e,c),(0,a.replacePath)(p,e)))?(0,n.joinPaths)((0,i.appendPath)(e,c),(0,a.replacePath)(p,e)):(0,s.existsSync)((0,n.joinPaths)((0,i.appendPath)(e,c),p))?(0,n.joinPaths)((0,i.appendPath)(e,c),p):void 0),g||=(0,s.existsSync)((0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.${f}.config.ts`))?(0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.${f}.config.ts`):(0,s.existsSync)((0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.${f}.config.js`))?(0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.${f}.config.js`):(0,s.existsSync)((0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.${f}.config.mts`))?(0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.${f}.config.mts`):(0,s.existsSync)((0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.${f}.config.mjs`))?(0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.${f}.config.mjs`):(0,s.existsSync)((0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.config.ts`))?(0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.config.ts`):(0,s.existsSync)((0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.config.js`))?(0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.config.js`):(0,s.existsSync)((0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.config.mts`))?(0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.config.mts`):(0,s.existsSync)((0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.config.mjs`))?(0,n.joinPaths)((0,i.appendPath)(e,c),`${m}.config.mjs`):void 0,g){let e=await u.import(u.esmResolve(g));if(e){let t={};(0,r.isFunction)(e)&&(t=await Promise.resolve(e({command:d,mode:f,isSsrBuild:!1,isPreview:!1}))),(0,o.isSetObject)(t)&&(h={...t,config:t,configFile:g})}}let _=await(0,l.loadConfig)({cwd:e,name:m,envName:f,globalRc:!0,packageJson:!0,dotenv:!0,jiti:u});return(0,t.default)(h,(0,o.isSetObject)(_?.config)?{..._.config,..._}:{})}exports.loadUserConfigFile=d,exports.loadWorkspaceConfig=u;
@@ -0,0 +1 @@
1
+ import e from"defu";import{joinPaths as t}from"@stryke/path/join-paths";import{isFunction as n}from"@stryke/type-checks/is-function";import{appendPath as r}from"@stryke/path/append";import{replacePath as i}from"@stryke/path/replace";import{isSetObject as a}from"@stryke/type-checks/is-set-object";import{existsSync as o}from"@stryke/fs/exists";import{getWorkspaceConfig as s}from"@storm-software/config-tools/get-config";import{loadConfig as c}from"c12";async function l(t,n){return e({workspaceRoot:t},await s(!0,{cwd:n,workspaceRoot:t,useDefault:!0}))}async function u(s,l,u,d,f=`production`,p,m=`powerlines`){let h={},g;if(p&&(g=o(i(p,s))?i(p,s):o(t(r(s,l),i(p,s)))?t(r(s,l),i(p,s)):o(t(r(s,l),p))?t(r(s,l),p):void 0),g||=o(t(r(s,l),`${m}.${f}.config.ts`))?t(r(s,l),`${m}.${f}.config.ts`):o(t(r(s,l),`${m}.${f}.config.js`))?t(r(s,l),`${m}.${f}.config.js`):o(t(r(s,l),`${m}.${f}.config.mts`))?t(r(s,l),`${m}.${f}.config.mts`):o(t(r(s,l),`${m}.${f}.config.mjs`))?t(r(s,l),`${m}.${f}.config.mjs`):o(t(r(s,l),`${m}.config.ts`))?t(r(s,l),`${m}.config.ts`):o(t(r(s,l),`${m}.config.js`))?t(r(s,l),`${m}.config.js`):o(t(r(s,l),`${m}.config.mts`))?t(r(s,l),`${m}.config.mts`):o(t(r(s,l),`${m}.config.mjs`))?t(r(s,l),`${m}.config.mjs`):void 0,g){let e=await u.import(u.esmResolve(g));if(e){let t={};n(e)&&(t=await Promise.resolve(e({command:d,mode:f,isSsrBuild:!1,isPreview:!1}))),a(t)&&(h={...t,config:t,configFile:g})}}let _=await c({cwd:s,name:m,envName:f,globalRc:!0,packageJson:!0,dotenv:!0,jiti:u});return e(h,a(_?.config)?{..._.config,..._}:{})}export{u as loadUserConfigFile,l as loadWorkspaceConfig};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../internal/helpers/environment.cjs`),n=require(`../config-file.cjs`),r=require(`./context.cjs`),i=require(`./environment-context.cjs`);let a=require(`@stryke/convert/to-array`),o=require(`@storm-software/config-tools/types`),s=require(`@stryke/fs/resolve`),c=require(`@stryke/type-checks/is-set-object`),l=require(`chalk`);l=e.__toESM(l);var u=class e extends r.PowerlinesContext{#e={};#t=[];#n;static async from(t,r){let i=new e(await n.loadWorkspaceConfig(t,r.root));await i.withUserConfig(r);let a=await(0,s.resolvePackage)(`powerlines`);if(!a)throw Error("Could not resolve `powerlines` package location.");return i.powerlinesPath=a,i}get $$internal(){return super.$$internal}set $$internal(e){super.$$internal=e;for(let e of Object.values(this.environments))e.$$internal=super.$$internal}get environments(){return this.#e}get log(){return this.#n||=this.createLog(`engine`),this.#n}get plugins(){return this.#t}constructor(e){super(e)}async init(e={}){await super.init(e),await Promise.all((0,a.toArray)(this.config.userConfig.environments&&Object.keys(this.config.userConfig.environments).length>0?Object.keys(this.config.userConfig.environments).map(e=>t.createEnvironment(e,this.config.userConfig)):t.createDefaultEnvironment(this.config.userConfig)).map(async e=>{this.#e[e.name]=await this.in(e)}))}async in(e){let t;t=this.environments[e.name]?this.environments[e.name]:await i.PowerlinesEnvironmentContext.fromConfig(this.workspaceConfig,this.config),(0,c.isSetObject)(this.config.inlineConfig)&&await t.withInlineConfig(this.config.inlineConfig),t.environment=e,t.plugins=[];for(let e of this.plugins)await t.addPlugin(e);return t}async withUserConfig(e,t={isHighPriority:!0}){await super.withUserConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withUserConfig(e,t)}))}async withInlineConfig(e,t={isHighPriority:!0}){await super.withInlineConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withInlineConfig(e,t)}))}async addPlugin(e){this.plugins.push(e),await Promise.all(Object.keys(this.environments).map(async t=>{await this.environments[t].addPlugin(e)}))}async getEnvironment(e){let n;if(e&&(n=this.environments[e]),Object.keys(this.environments).length===1&&(n=this.environments[Object.keys(this.environments)[0]],this.log(o.LogLevelLabel.DEBUG,`Applying the only configured environment: ${l.default.bold.cyanBright(n?.environment.name)}`)),!n){if(e)throw Error(`Environment "${e}" not found.`);n=await this.in(t.createDefaultEnvironment(this.config.userConfig)),this.log(o.LogLevelLabel.WARN,`No environment specified, and no default environment found. Using a temporary default environment: ${l.default.bold.cyanBright(n?.environment.name)}`)}return n}async getEnvironmentSafe(e){try{return await this.getEnvironment(e)}catch{return}}};exports.PowerlinesAPIContext=u;
@@ -0,0 +1 @@
1
+ import{createDefaultEnvironment as e,createEnvironment as t}from"../../internal/helpers/environment.mjs";import{loadWorkspaceConfig as n}from"../config-file.mjs";import{PowerlinesContext as r}from"./context.mjs";import{PowerlinesEnvironmentContext as i}from"./environment-context.mjs";import{toArray as a}from"@stryke/convert/to-array";import{LogLevelLabel as o}from"@storm-software/config-tools/types";import{resolvePackage as s}from"@stryke/fs/resolve";import{isSetObject as c}from"@stryke/type-checks/is-set-object";import l from"chalk";var u=class u extends r{#e={};#t=[];#n;static async from(e,t){let r=new u(await n(e,t.root));await r.withUserConfig(t);let i=await s(`powerlines`);if(!i)throw Error("Could not resolve `powerlines` package location.");return r.powerlinesPath=i,r}get $$internal(){return super.$$internal}set $$internal(e){super.$$internal=e;for(let e of Object.values(this.environments))e.$$internal=super.$$internal}get environments(){return this.#e}get log(){return this.#n||=this.createLog(`engine`),this.#n}get plugins(){return this.#t}constructor(e){super(e)}async init(n={}){await super.init(n),await Promise.all(a(this.config.userConfig.environments&&Object.keys(this.config.userConfig.environments).length>0?Object.keys(this.config.userConfig.environments).map(e=>t(e,this.config.userConfig)):e(this.config.userConfig)).map(async e=>{this.#e[e.name]=await this.in(e)}))}async in(e){let t;t=this.environments[e.name]?this.environments[e.name]:await i.fromConfig(this.workspaceConfig,this.config),c(this.config.inlineConfig)&&await t.withInlineConfig(this.config.inlineConfig),t.environment=e,t.plugins=[];for(let e of this.plugins)await t.addPlugin(e);return t}async withUserConfig(e,t={isHighPriority:!0}){await super.withUserConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withUserConfig(e,t)}))}async withInlineConfig(e,t={isHighPriority:!0}){await super.withInlineConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withInlineConfig(e,t)}))}async addPlugin(e){this.plugins.push(e),await Promise.all(Object.keys(this.environments).map(async t=>{await this.environments[t].addPlugin(e)}))}async getEnvironment(t){let n;if(t&&(n=this.environments[t]),Object.keys(this.environments).length===1&&(n=this.environments[Object.keys(this.environments)[0]],this.log(o.DEBUG,`Applying the only configured environment: ${l.bold.cyanBright(n?.environment.name)}`)),!n){if(t)throw Error(`Environment "${t}" not found.`);n=await this.in(e(this.config.userConfig)),this.log(o.WARN,`No environment specified, and no default environment found. Using a temporary default environment: ${l.bold.cyanBright(n?.environment.name)}`)}return n}async getEnvironmentSafe(e){try{return await this.getEnvironment(e)}catch{return}}};export{u as PowerlinesAPIContext};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../typescript/ts-morph.cjs`),n=require(`../typescript/tsconfig.cjs`),r=require(`../config-file.cjs`),i=require(`../../internal/helpers/resolver.cjs`),a=require(`../../plugin-utils/helpers.cjs`),o=require(`../../plugin-utils/paths.cjs`),s=require(`../entry.cjs`),c=require(`../logger.cjs`),l=require(`../fs/vfs.cjs`),u=require(`../utilities/meta.cjs`);let d=require(`@stryke/convert/to-array`),f=require(`defu`);f=e.__toESM(f);let p=require(`@stryke/helpers/omit`),m=require(`@stryke/type-checks/is-string`),h=require(`@storm-software/config-tools/types`),g=require(`@stryke/fs/get-workspace-root`),_=require(`@stryke/fs/resolve`),v=require(`@stryke/path/append`),y=require(`@stryke/path/replace`),b=require(`@stryke/type-checks/is-set-object`),x=require(`@stryke/type-checks/is-set-string`),S=require(`@stryke/fs/json`),C=require(`@stryke/json/storm-json`),w=require(`@stryke/string-format/title-case`),T=require(`@stryke/fs/exists`),E=require(`@stryke/env/get-env-paths`),D=require(`@stryke/hash/hash-files`),O=require(`@stryke/hash/murmurhash`),k=require(`@stryke/helpers/get-unique`),A=require(`@stryke/http/fetch`),j=require(`@stryke/path/is-type`),M=require(`@stryke/path/join`),N=require(`@stryke/type-checks/is-null`),P=require(`@stryke/unique-id/uuid`),F=require(`bundle-require`),I=require(`flat-cache`),L=require(`oxc-parser`),R=require(`undici`);const z=new WeakMap;(0,R.setGlobalDispatcher)(new R.Agent({keepAliveTimeout:1e4}).compose(R.interceptors.retry({maxRetries:3,minTimeout:1e3,maxTimeout:1e4,timeoutFactor:2,retryAfter:!0})));var B=class e{#e={};#t;#n=null;#r=(0,P.uuid)();#i=(0,P.uuid)();#a=Date.now();#o;#s;#c;#l;#u;#d;#f(e={}){return{variant:e.build?.variant,projectType:e.type,projectRoot:e.root,name:e.name,title:e.title,description:e.description,sourceRoot:e.sourceRoot,configFile:e.configFile,customLogger:e.customLogger,logLevel:e.logLevel,tsconfig:e.tsconfig,tsconfigRaw:e.tsconfigRaw,skipCache:e.skipCache,skipInstalls:e.skipInstalls,entry:e.entry,output:e.output,plugins:e.plugins,mode:e.mode,lint:e.lint,transform:e.transform,build:e.build,framework:e.framework,...e}}static async from(t,n){let i=new e(await r.loadWorkspaceConfig(t,n.root));await i.withUserConfig(n);let a=await(0,_.resolvePackage)(`powerlines`);if(!a)throw Error("Could not resolve `powerlines` package location.");return i.powerlinesPath=a,i}dependencies={};devDependencies={};persistedMeta=void 0;powerlinesPath;packageJson;projectJson=void 0;resolver;resolvePatterns=[];get $$internal(){return this.#e}set $$internal(e){this.#e=e}get entry(){return s.resolveEntriesSync(this,(0,d.toArray)(this.config.entry))}get tsconfig(){return this.#c||(this.tsconfig={tsconfigFilePath:this.config.tsconfig}),this.#c}set tsconfig(e){this.#c=e,this.resolvePatterns=(0,F.tsconfigPathsToRegExp)(e?.options?.paths??{})}get fs(){return this.#s||=l.VirtualFileSystem.createSync(this),this.#s}get checksum(){return this.#n}get meta(){return{buildId:this.#r,releaseId:this.#i,checksum:this.#n,timestamp:this.#a,projectRootHash:(0,O.murmurhash)({workspaceRoot:this.workspaceConfig?.workspaceRoot,projectRoot:this.config?.projectRoot},{maxLength:u.PROJECT_ROOT_HASH_LENGTH}),configHash:(0,O.murmurhash)(this.config,{maxLength:u.CACHE_HASH_LENGTH})}}get config(){return this.resolvedConfig??{}}get log(){return this.logFn||=this.createLog(),this.logFn}get workspaceConfig(){return this.#t}get envPaths(){return this.#o||=(0,E.getEnvPaths)({orgId:`storm-software`,appId:`powerlines`,workspaceRoot:this.workspaceConfig.workspaceRoot}),this.#o}get artifactsPath(){return(0,M.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot,this.config.output.artifactsPath)}get builtinsPath(){return(0,M.joinPaths)(this.artifactsPath,`builtins`)}get entryPath(){return(0,M.joinPaths)(this.artifactsPath,`entry`)}get dataPath(){return(0,M.joinPaths)(this.envPaths.data,`projects`,u.getPrefixedProjectRootHash(this.config.name,this.meta.projectRootHash))}get cachePath(){return(0,M.joinPaths)(this.envPaths.cache,`projects`,(0,O.murmurhash)({checksum:this.#n,config:this.meta.configHash},{maxLength:u.CACHE_HASH_LENGTH}))}get dtsPath(){return this.config.output.dts?(0,v.appendPath)(this.config.output.dts,this.workspaceConfig.workspaceRoot):(0,M.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`powerlines.d.ts`)}get relativeToWorkspaceRoot(){return(0,g.relativeToWorkspaceRoot)(this.config.projectRoot)}get builtins(){return Object.values(this.fs.metadata).filter(e=>e&&e.type===`builtin`).map(e=>e?.id).filter(Boolean)}get program(){return this.#l||=t.createProgram(this,{skipAddingFilesFromTsConfig:!0}),this.#l}get parserCache(){return this.#u||=(0,I.create)({cacheId:`parser`,cacheDir:this.cachePath,ttl:7200*1e3,lruSize:5e3,persistInterval:250}),this.#u}get requestCache(){return this.#d||=(0,I.create)({cacheId:`http`,cacheDir:this.cachePath,ttl:300*1e3,lruSize:5e3,persistInterval:250}),this.#d}async fetch(e,t={}){let n=(0,O.murmurhash)({input:e.toString(),options:JSON.stringify(t)});if(!this.config.skipCache&&!t.skipCache){let e=this.requestCache.get(n);if(e)return new R.Response(e.body,{status:e.status,statusText:e.statusText,headers:e.headers})}let r=await(0,A.fetchRequest)(e,{timeout:12e3,...t}),i={body:await r.text(),status:r.status,statusText:r.statusText,headers:Object.fromEntries(r.headers.entries())};if(!this.config.skipCache&&!t.skipCache)try{this.requestCache.set(n,i)}catch{}return new R.Response(i.body,{status:i.status,statusText:i.statusText,headers:i.headers})}async parse(e,t={}){let n=(0,O.murmurhash)({code:e,options:t}),r;return!this.config.skipCache&&(r=this.parserCache.get(n),r)?r:(r=await(0,L.parse)(`source.${t.lang||`ts`}`,e,{...t,sourceType:`module`,showSemanticErrors:this.config.mode===`development`}),this.config.skipCache||this.parserCache.set(n,r),r)}async resolve(e,t,n={}){let r=e;if(this.config.build.alias)if(Array.isArray(this.config.build.alias)){let e=this.config.build.alias.find(e=>(0,F.match)(r,[e.find]));e&&(r=e.replacement)}else (0,b.isSetObject)(this.config.build.alias)&&this.config.build.alias[e]&&(r=this.config.build.alias[e]);if(this.fs.isVirtual(r)){let e=await this.fs.resolve(r,t,{conditions:this.config.build.conditions,extensions:this.config.build.extensions,...n});return e?{id:`\0${e}`,external:this.config.projectType!==`application`}:void 0}if(this.config.build.skipNodeModulesBundle){if((0,F.match)(r,this.resolvePatterns)||(0,F.match)(r,this.config.build.noExternal))return;if((0,F.match)(r,this.config.build.external)||r.startsWith(`node:`)||!/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(r))return{id:r,external:!0}}else{if((0,F.match)(r,this.config.build.noExternal))return;if((0,F.match)(r,this.config.build.external)||r.startsWith(`node:`))return{id:r,external:!0}}}async load(e){let t=await this.fs.resolve(e);if(!t)return;let n=await this.fs.read(t);if(n)return{code:n,map:null}}async getBuiltins(){return Promise.all(Object.entries(this.fs.metadata).filter(([,e])=>e&&e.type===`builtin`).map(async([e,t])=>{let n=await this.fs.read(e);return{...t,path:e,code:n}}))}async emitEntry(e,t,n={}){return this.fs.write((0,j.isAbsolute)(t)?t:(0,v.appendPath)(t,this.entryPath),e,(0,f.default)(n,{type:`entry`}))}async emitBuiltin(e,t,n,r={}){return this.fs.write(n?(0,j.isAbsolute)(n)?n:(0,M.joinPaths)(this.builtinsPath,n):(0,v.appendPath)(t,this.builtinsPath),e,(0,f.default)(r,{type:`builtin`}))}async withUserConfig(e,t={isHighPriority:!0}){this.mergeUserConfig(e),await this.init(this.config.userConfig,t)}async withInlineConfig(e,t={isHighPriority:!0}){if(this.config.inlineConfig=e,e.command===`new`){let e=(0,M.joinPaths)(this.workspaceConfig.workspaceRoot,`package.json`);if(!(0,T.existsSync)(e))throw Error(`The workspace package.json file could not be found at ${e}`);this.packageJson=await(0,S.readJsonFile)(e),this.workspaceConfig.repository??=(0,x.isSetString)(this.packageJson?.repository)?this.packageJson.repository:this.packageJson?.repository?.url}await this.init(this.config.inlineConfig,t)}fatal(e){this.log(h.LogLevelLabel.FATAL,(0,m.isString)(e)?e:C.StormJSON.stringify(e))}error(e){this.log(h.LogLevelLabel.ERROR,(0,m.isString)(e)?e:C.StormJSON.stringify(e))}warn(e){this.log(h.LogLevelLabel.WARN,(0,m.isString)(e)?e:C.StormJSON.stringify(e))}info(e){this.log(h.LogLevelLabel.INFO,(0,m.isString)(e)?e:C.StormJSON.stringify(e))}debug(e){this.log(h.LogLevelLabel.DEBUG,(0,m.isString)(e)?e:C.StormJSON.stringify(e))}trace(e){this.log(h.LogLevelLabel.TRACE,(0,m.isString)(e)?e:C.StormJSON.stringify(e))}createLog(e=null){return c.createLog(e,{...this.config,logLevel:(0,N.isNull)(this.config.logLevel)?`silent`:this.config.logLevel})}extendLog(e){return c.extendLog(this.log,e)}async generateChecksum(e=this.config.projectRoot){return this.#n=await(0,D.hashDirectory)(e,{ignore:[`node_modules`,`.git`,`.nx`,`.cache`,`.storm`,`tmp`,`dist`]}),this.#n}constructor(e){this.#t=e,this.#o=(0,E.getEnvPaths)({orgId:`storm-software`,appId:`powerlines`,workspaceRoot:e.workspaceRoot})}resolvedConfig={};logFn;async init(e={},t={isHighPriority:!0}){let c={projectRoot:e.root??this.config.projectRoot??this.config.userConfig?.root??this.config.inlineConfig?.root,mode:(e.mode??this.config.mode)||this.workspaceConfig.mode,skipCache:e.skipCache??this.config.skipCache??!1,configFile:e.configFile??this.config.configFile,framework:e.framework??this.config.framework??`powerlines`,command:this.config.inlineConfig?.command};if(z.has(c)){let e=z.get(c);this.projectJson=e.projectJson,this.packageJson=e.packageJson,this.#n=e.checksum,this.resolver=e.resolver,this.mergeUserConfig(e.userConfig.config,this.config.userConfig)}else{let t=(0,M.joinPaths)(c.projectRoot,`project.json`);(0,T.existsSync)(t)&&(this.projectJson=await(0,S.readJsonFile)(t));let n=(0,M.joinPaths)(c.projectRoot,`package.json`);(0,T.existsSync)(n)&&(this.packageJson=await(0,S.readJsonFile)(n)),this.#n=await this.generateChecksum(c.projectRoot),this.resolver=i.createResolver({workspaceRoot:this.workspaceConfig.workspaceRoot,projectRoot:c.projectRoot,cacheDir:this.cachePath,mode:c.mode,logLevel:e.logLevel||this.config?.logLevel||this.workspaceConfig.logLevel||`info`,skipCache:c.skipCache});let a=await r.loadUserConfigFile(c.projectRoot,this.workspaceConfig.workspaceRoot,this.resolver,c.command,c.mode,c.configFile,c.framework);this.mergeUserConfig(a.config),z.set(c,{projectJson:this.projectJson,packageJson:this.packageJson,checksum:this.#n,resolver:this.resolver,userConfig:a})}e.tsconfig??=n.getTsconfigFilePath(this.workspaceConfig.workspaceRoot,c.projectRoot,e.tsconfig),(0,b.isSetObject)(e)&&(this.resolvedConfig=(0,f.default)({inlineConfig:this.config.inlineConfig,userConfig:this.config.userConfig},t.isHighPriority?this.#f(e):{},{command:this.config.inlineConfig?.command,...this.#f(this.config.inlineConfig)},this.#f(this.config.userConfig),{mode:this.workspaceConfig?.mode,logLevel:this.workspaceConfig?.logLevel,skipCache:this.workspaceConfig?.skipCache},{name:this.projectJson?.name||this.packageJson?.name,version:this.packageJson?.version,description:this.packageJson?.description,sourceRoot:this.projectJson?.sourceRoot||(0,v.appendPath)(`src`,c.projectRoot),output:(0,f.default)(e.output??{},{outputPath:c.projectRoot?(0,M.joinPaths)(this.workspaceConfig?.directories?.build||`dist`,c.projectRoot):this.workspaceConfig?.directories?.build||`dist`,artifactsPath:(0,M.joinPaths)(c.projectRoot,`.${e.framework??`powerlines`}`),dts:(0,M.joinPaths)(c.projectRoot,`${e.framework??`powerlines`}.d.ts`),builtinPrefix:e.framework??`powerlines`,assets:[{glob:`LICENSE`},{input:c.projectRoot,glob:`*.md`},{input:c.projectRoot,glob:`package.json`}]})},t.isHighPriority?{}:this.#f(e),{inlineConfig:{},userConfig:{},framework:`powerlines`,platform:`neutral`,mode:`production`,projectType:`application`,logLevel:`info`,preview:!1,environments:{},transform:{babel:{plugins:[],presets:[]}},lint:{eslint:{}},build:{target:`esnext`,override:{}}})),this.config.entry=s.getUniqueEntries(this.config.entry),this.config.name?.startsWith(`@`)&&this.config.name.split(`/`).filter(Boolean).length>1&&(this.config.name=this.config.name.split(`/`).filter(Boolean)[1]),this.config.title??=(0,w.titleCase)(this.config.name),this.config.userConfig.build?.external&&(this.config.userConfig.build.external=(0,k.getUnique)(this.config.userConfig.build.external)),this.config.userConfig.build?.noExternal&&(this.config.userConfig.build.noExternal=(0,k.getUnique)(this.config.userConfig.build.noExternal)),this.config.build.external&&(this.config.build.external=(0,k.getUnique)(this.config.build.external)),this.config.build.noExternal&&(this.config.build.noExternal=(0,k.getUnique)(this.config.build.noExternal)),this.config.output.format=(0,k.getUnique)((0,d.toArray)(this.config.output?.format??(this.config.projectType===`library`?[`cjs`,`esm`]:[`esm`]))),this.config.projectRoot&&this.config.projectRoot!==`.`&&this.config.projectRoot!==`./`&&this.config.projectRoot!==this.workspaceConfig.workspaceRoot?(this.config.output.outputPath??=(0,M.joinPaths)(`dist`,this.config.projectRoot),this.config.output.buildPath??=(0,M.joinPaths)(this.config.projectRoot,`dist`)):(this.config.output.outputPath??=`dist`,this.config.output.buildPath??=`dist`),this.config.output.assets=(0,k.getUnique)(this.config.output.assets.map(e=>({glob:(0,b.isSetObject)(e)?e.glob:e,input:(0,m.isString)(e)||!e.input||e.input===`.`||e.input===`/`||e.input===`./`?this.workspaceConfig.workspaceRoot:(0,v.appendPath)(e.input,this.workspaceConfig.workspaceRoot),output:(0,v.appendPath)((0,b.isSetObject)(e)&&e.output?(0,M.joinPaths)(this.config.output.outputPath,(0,y.replacePath)(e.output,this.config.output.outputPath)):this.config.output.outputPath,this.workspaceConfig.workspaceRoot),ignore:(0,b.isSetObject)(e)&&e.ignore?(0,d.toArray)(e.ignore):void 0}))),this.config.plugins=(this.config.plugins??[]).filter(Boolean).reduce((e,t)=>(a.isPlugin(t)&&a.checkDedupe(t,e.filter(e=>a.isPlugin(e)))||e.push(t),e),[]),this.config.tsconfig&&(this.config.tsconfig=o.replacePathTokens(this,this.config.tsconfig)),this.config.output.dts&&(this.config.output.dts=o.replacePathTokens(this,this.config.output.dts)),this.config.build.polyfill&&(this.config.build.polyfill=this.config.build.polyfill.map(e=>o.replacePathTokens(this,e))),this.config.output.assets&&(this.config.output.assets=this.config.output.assets.map(e=>({...e,glob:o.replacePathTokens(this,e.glob),ignore:e.ignore?e.ignore.map(e=>o.replacePathTokens(this,e)):void 0,input:o.replacePathTokens(this,e.input),output:o.replacePathTokens(this,e.output)}))),this.#s??=await l.VirtualFileSystem.create(this)}mergeUserConfig(e={},t=this.config.userConfig??{}){this.config.userConfig=(0,f.default)({entry:Array.isArray(e.entry)&&e.entry.length>0?e.entry:Array.isArray(t?.entry)&&t.entry.length>0?t.entry:[]},(0,p.omit)(e??{},[`entry`]),(0,p.omit)(t??{},[`entry`])),this.config.userConfig.output?.format&&(this.config.userConfig.output.format=(0,k.getUnique)((0,d.toArray)(this.config.userConfig.output?.format))),this.config.userConfig.plugins=(this.config.userConfig.plugins??[]).filter(Boolean).reduce((e,t)=>(a.isPlugin(t)&&a.checkDedupe(t,e.filter(e=>a.isPlugin(e)))||e.push(t),e),[])}};exports.PowerlinesContext=B;
@@ -0,0 +1 @@
1
+ import{createProgram as e}from"../typescript/ts-morph.mjs";import{getTsconfigFilePath as t}from"../typescript/tsconfig.mjs";import{loadUserConfigFile as n,loadWorkspaceConfig as r}from"../config-file.mjs";import{createResolver as i}from"../../internal/helpers/resolver.mjs";import{checkDedupe as a,isPlugin as o}from"../../plugin-utils/helpers.mjs";import{replacePathTokens as s}from"../../plugin-utils/paths.mjs";import{getUniqueEntries as c,resolveEntriesSync as l}from"../entry.mjs";import{createLog as u,extendLog as d}from"../logger.mjs";import{VirtualFileSystem as f}from"../fs/vfs.mjs";import{CACHE_HASH_LENGTH as p,PROJECT_ROOT_HASH_LENGTH as m,getPrefixedProjectRootHash as h}from"../utilities/meta.mjs";import{toArray as g}from"@stryke/convert/to-array";import _ from"defu";import{omit as v}from"@stryke/helpers/omit";import{isString as y}from"@stryke/type-checks/is-string";import{LogLevelLabel as b}from"@storm-software/config-tools/types";import{relativeToWorkspaceRoot as x}from"@stryke/fs/get-workspace-root";import{resolvePackage as S}from"@stryke/fs/resolve";import{appendPath as C}from"@stryke/path/append";import{replacePath as w}from"@stryke/path/replace";import{isSetObject as T}from"@stryke/type-checks/is-set-object";import{isSetString as E}from"@stryke/type-checks/is-set-string";import{readJsonFile as D}from"@stryke/fs/json";import{StormJSON as O}from"@stryke/json/storm-json";import{titleCase as k}from"@stryke/string-format/title-case";import{existsSync as A}from"@stryke/fs/exists";import{getEnvPaths as j}from"@stryke/env/get-env-paths";import{hashDirectory as M}from"@stryke/hash/hash-files";import{murmurhash as N}from"@stryke/hash/murmurhash";import{getUnique as P}from"@stryke/helpers/get-unique";import{fetchRequest as F}from"@stryke/http/fetch";import{isAbsolute as I}from"@stryke/path/is-type";import{joinPaths as L}from"@stryke/path/join";import{isNull as R}from"@stryke/type-checks/is-null";import{uuid as z}from"@stryke/unique-id/uuid";import{match as B,tsconfigPathsToRegExp as V}from"bundle-require";import{create as H}from"flat-cache";import{parse as U}from"oxc-parser";import{Agent as W,Response as G,interceptors as K,setGlobalDispatcher as q}from"undici";const J=new WeakMap;q(new W({keepAliveTimeout:1e4}).compose(K.retry({maxRetries:3,minTimeout:1e3,maxTimeout:1e4,timeoutFactor:2,retryAfter:!0})));var Y=class W{#e={};#t;#n=null;#r=z();#i=z();#a=Date.now();#o;#s;#c;#l;#u;#d;#f(e={}){return{variant:e.build?.variant,projectType:e.type,projectRoot:e.root,name:e.name,title:e.title,description:e.description,sourceRoot:e.sourceRoot,configFile:e.configFile,customLogger:e.customLogger,logLevel:e.logLevel,tsconfig:e.tsconfig,tsconfigRaw:e.tsconfigRaw,skipCache:e.skipCache,skipInstalls:e.skipInstalls,entry:e.entry,output:e.output,plugins:e.plugins,mode:e.mode,lint:e.lint,transform:e.transform,build:e.build,framework:e.framework,...e}}static async from(e,t){let n=new W(await r(e,t.root));await n.withUserConfig(t);let i=await S(`powerlines`);if(!i)throw Error("Could not resolve `powerlines` package location.");return n.powerlinesPath=i,n}dependencies={};devDependencies={};persistedMeta=void 0;powerlinesPath;packageJson;projectJson=void 0;resolver;resolvePatterns=[];get $$internal(){return this.#e}set $$internal(e){this.#e=e}get entry(){return l(this,g(this.config.entry))}get tsconfig(){return this.#c||(this.tsconfig={tsconfigFilePath:this.config.tsconfig}),this.#c}set tsconfig(e){this.#c=e,this.resolvePatterns=V(e?.options?.paths??{})}get fs(){return this.#s||=f.createSync(this),this.#s}get checksum(){return this.#n}get meta(){return{buildId:this.#r,releaseId:this.#i,checksum:this.#n,timestamp:this.#a,projectRootHash:N({workspaceRoot:this.workspaceConfig?.workspaceRoot,projectRoot:this.config?.projectRoot},{maxLength:m}),configHash:N(this.config,{maxLength:p})}}get config(){return this.resolvedConfig??{}}get log(){return this.logFn||=this.createLog(),this.logFn}get workspaceConfig(){return this.#t}get envPaths(){return this.#o||=j({orgId:`storm-software`,appId:`powerlines`,workspaceRoot:this.workspaceConfig.workspaceRoot}),this.#o}get artifactsPath(){return L(this.workspaceConfig.workspaceRoot,this.config.projectRoot,this.config.output.artifactsPath)}get builtinsPath(){return L(this.artifactsPath,`builtins`)}get entryPath(){return L(this.artifactsPath,`entry`)}get dataPath(){return L(this.envPaths.data,`projects`,h(this.config.name,this.meta.projectRootHash))}get cachePath(){return L(this.envPaths.cache,`projects`,N({checksum:this.#n,config:this.meta.configHash},{maxLength:p}))}get dtsPath(){return this.config.output.dts?C(this.config.output.dts,this.workspaceConfig.workspaceRoot):L(this.workspaceConfig.workspaceRoot,this.config.projectRoot,`powerlines.d.ts`)}get relativeToWorkspaceRoot(){return x(this.config.projectRoot)}get builtins(){return Object.values(this.fs.metadata).filter(e=>e&&e.type===`builtin`).map(e=>e?.id).filter(Boolean)}get program(){return this.#l||=e(this,{skipAddingFilesFromTsConfig:!0}),this.#l}get parserCache(){return this.#u||=H({cacheId:`parser`,cacheDir:this.cachePath,ttl:7200*1e3,lruSize:5e3,persistInterval:250}),this.#u}get requestCache(){return this.#d||=H({cacheId:`http`,cacheDir:this.cachePath,ttl:300*1e3,lruSize:5e3,persistInterval:250}),this.#d}async fetch(e,t={}){let n=N({input:e.toString(),options:JSON.stringify(t)});if(!this.config.skipCache&&!t.skipCache){let e=this.requestCache.get(n);if(e)return new G(e.body,{status:e.status,statusText:e.statusText,headers:e.headers})}let r=await F(e,{timeout:12e3,...t}),i={body:await r.text(),status:r.status,statusText:r.statusText,headers:Object.fromEntries(r.headers.entries())};if(!this.config.skipCache&&!t.skipCache)try{this.requestCache.set(n,i)}catch{}return new G(i.body,{status:i.status,statusText:i.statusText,headers:i.headers})}async parse(e,t={}){let n=N({code:e,options:t}),r;return!this.config.skipCache&&(r=this.parserCache.get(n),r)?r:(r=await U(`source.${t.lang||`ts`}`,e,{...t,sourceType:`module`,showSemanticErrors:this.config.mode===`development`}),this.config.skipCache||this.parserCache.set(n,r),r)}async resolve(e,t,n={}){let r=e;if(this.config.build.alias)if(Array.isArray(this.config.build.alias)){let e=this.config.build.alias.find(e=>B(r,[e.find]));e&&(r=e.replacement)}else T(this.config.build.alias)&&this.config.build.alias[e]&&(r=this.config.build.alias[e]);if(this.fs.isVirtual(r)){let e=await this.fs.resolve(r,t,{conditions:this.config.build.conditions,extensions:this.config.build.extensions,...n});return e?{id:`\0${e}`,external:this.config.projectType!==`application`}:void 0}if(this.config.build.skipNodeModulesBundle){if(B(r,this.resolvePatterns)||B(r,this.config.build.noExternal))return;if(B(r,this.config.build.external)||r.startsWith(`node:`)||!/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(r))return{id:r,external:!0}}else{if(B(r,this.config.build.noExternal))return;if(B(r,this.config.build.external)||r.startsWith(`node:`))return{id:r,external:!0}}}async load(e){let t=await this.fs.resolve(e);if(!t)return;let n=await this.fs.read(t);if(n)return{code:n,map:null}}async getBuiltins(){return Promise.all(Object.entries(this.fs.metadata).filter(([,e])=>e&&e.type===`builtin`).map(async([e,t])=>{let n=await this.fs.read(e);return{...t,path:e,code:n}}))}async emitEntry(e,t,n={}){return this.fs.write(I(t)?t:C(t,this.entryPath),e,_(n,{type:`entry`}))}async emitBuiltin(e,t,n,r={}){return this.fs.write(n?I(n)?n:L(this.builtinsPath,n):C(t,this.builtinsPath),e,_(r,{type:`builtin`}))}async withUserConfig(e,t={isHighPriority:!0}){this.mergeUserConfig(e),await this.init(this.config.userConfig,t)}async withInlineConfig(e,t={isHighPriority:!0}){if(this.config.inlineConfig=e,e.command===`new`){let e=L(this.workspaceConfig.workspaceRoot,`package.json`);if(!A(e))throw Error(`The workspace package.json file could not be found at ${e}`);this.packageJson=await D(e),this.workspaceConfig.repository??=E(this.packageJson?.repository)?this.packageJson.repository:this.packageJson?.repository?.url}await this.init(this.config.inlineConfig,t)}fatal(e){this.log(b.FATAL,y(e)?e:O.stringify(e))}error(e){this.log(b.ERROR,y(e)?e:O.stringify(e))}warn(e){this.log(b.WARN,y(e)?e:O.stringify(e))}info(e){this.log(b.INFO,y(e)?e:O.stringify(e))}debug(e){this.log(b.DEBUG,y(e)?e:O.stringify(e))}trace(e){this.log(b.TRACE,y(e)?e:O.stringify(e))}createLog(e=null){return u(e,{...this.config,logLevel:R(this.config.logLevel)?`silent`:this.config.logLevel})}extendLog(e){return d(this.log,e)}async generateChecksum(e=this.config.projectRoot){return this.#n=await M(e,{ignore:[`node_modules`,`.git`,`.nx`,`.cache`,`.storm`,`tmp`,`dist`]}),this.#n}constructor(e){this.#t=e,this.#o=j({orgId:`storm-software`,appId:`powerlines`,workspaceRoot:e.workspaceRoot})}resolvedConfig={};logFn;async init(e={},r={isHighPriority:!0}){let l={projectRoot:e.root??this.config.projectRoot??this.config.userConfig?.root??this.config.inlineConfig?.root,mode:(e.mode??this.config.mode)||this.workspaceConfig.mode,skipCache:e.skipCache??this.config.skipCache??!1,configFile:e.configFile??this.config.configFile,framework:e.framework??this.config.framework??`powerlines`,command:this.config.inlineConfig?.command};if(J.has(l)){let e=J.get(l);this.projectJson=e.projectJson,this.packageJson=e.packageJson,this.#n=e.checksum,this.resolver=e.resolver,this.mergeUserConfig(e.userConfig.config,this.config.userConfig)}else{let t=L(l.projectRoot,`project.json`);A(t)&&(this.projectJson=await D(t));let r=L(l.projectRoot,`package.json`);A(r)&&(this.packageJson=await D(r)),this.#n=await this.generateChecksum(l.projectRoot),this.resolver=i({workspaceRoot:this.workspaceConfig.workspaceRoot,projectRoot:l.projectRoot,cacheDir:this.cachePath,mode:l.mode,logLevel:e.logLevel||this.config?.logLevel||this.workspaceConfig.logLevel||`info`,skipCache:l.skipCache});let a=await n(l.projectRoot,this.workspaceConfig.workspaceRoot,this.resolver,l.command,l.mode,l.configFile,l.framework);this.mergeUserConfig(a.config),J.set(l,{projectJson:this.projectJson,packageJson:this.packageJson,checksum:this.#n,resolver:this.resolver,userConfig:a})}e.tsconfig??=t(this.workspaceConfig.workspaceRoot,l.projectRoot,e.tsconfig),T(e)&&(this.resolvedConfig=_({inlineConfig:this.config.inlineConfig,userConfig:this.config.userConfig},r.isHighPriority?this.#f(e):{},{command:this.config.inlineConfig?.command,...this.#f(this.config.inlineConfig)},this.#f(this.config.userConfig),{mode:this.workspaceConfig?.mode,logLevel:this.workspaceConfig?.logLevel,skipCache:this.workspaceConfig?.skipCache},{name:this.projectJson?.name||this.packageJson?.name,version:this.packageJson?.version,description:this.packageJson?.description,sourceRoot:this.projectJson?.sourceRoot||C(`src`,l.projectRoot),output:_(e.output??{},{outputPath:l.projectRoot?L(this.workspaceConfig?.directories?.build||`dist`,l.projectRoot):this.workspaceConfig?.directories?.build||`dist`,artifactsPath:L(l.projectRoot,`.${e.framework??`powerlines`}`),dts:L(l.projectRoot,`${e.framework??`powerlines`}.d.ts`),builtinPrefix:e.framework??`powerlines`,assets:[{glob:`LICENSE`},{input:l.projectRoot,glob:`*.md`},{input:l.projectRoot,glob:`package.json`}]})},r.isHighPriority?{}:this.#f(e),{inlineConfig:{},userConfig:{},framework:`powerlines`,platform:`neutral`,mode:`production`,projectType:`application`,logLevel:`info`,preview:!1,environments:{},transform:{babel:{plugins:[],presets:[]}},lint:{eslint:{}},build:{target:`esnext`,override:{}}})),this.config.entry=c(this.config.entry),this.config.name?.startsWith(`@`)&&this.config.name.split(`/`).filter(Boolean).length>1&&(this.config.name=this.config.name.split(`/`).filter(Boolean)[1]),this.config.title??=k(this.config.name),this.config.userConfig.build?.external&&(this.config.userConfig.build.external=P(this.config.userConfig.build.external)),this.config.userConfig.build?.noExternal&&(this.config.userConfig.build.noExternal=P(this.config.userConfig.build.noExternal)),this.config.build.external&&(this.config.build.external=P(this.config.build.external)),this.config.build.noExternal&&(this.config.build.noExternal=P(this.config.build.noExternal)),this.config.output.format=P(g(this.config.output?.format??(this.config.projectType===`library`?[`cjs`,`esm`]:[`esm`]))),this.config.projectRoot&&this.config.projectRoot!==`.`&&this.config.projectRoot!==`./`&&this.config.projectRoot!==this.workspaceConfig.workspaceRoot?(this.config.output.outputPath??=L(`dist`,this.config.projectRoot),this.config.output.buildPath??=L(this.config.projectRoot,`dist`)):(this.config.output.outputPath??=`dist`,this.config.output.buildPath??=`dist`),this.config.output.assets=P(this.config.output.assets.map(e=>({glob:T(e)?e.glob:e,input:y(e)||!e.input||e.input===`.`||e.input===`/`||e.input===`./`?this.workspaceConfig.workspaceRoot:C(e.input,this.workspaceConfig.workspaceRoot),output:C(T(e)&&e.output?L(this.config.output.outputPath,w(e.output,this.config.output.outputPath)):this.config.output.outputPath,this.workspaceConfig.workspaceRoot),ignore:T(e)&&e.ignore?g(e.ignore):void 0}))),this.config.plugins=(this.config.plugins??[]).filter(Boolean).reduce((e,t)=>(o(t)&&a(t,e.filter(e=>o(e)))||e.push(t),e),[]),this.config.tsconfig&&(this.config.tsconfig=s(this,this.config.tsconfig)),this.config.output.dts&&(this.config.output.dts=s(this,this.config.output.dts)),this.config.build.polyfill&&(this.config.build.polyfill=this.config.build.polyfill.map(e=>s(this,e))),this.config.output.assets&&(this.config.output.assets=this.config.output.assets.map(e=>({...e,glob:s(this,e.glob),ignore:e.ignore?e.ignore.map(e=>s(this,e)):void 0,input:s(this,e.input),output:s(this,e.output)}))),this.#s??=await f.create(this)}mergeUserConfig(e={},t=this.config.userConfig??{}){this.config.userConfig=_({entry:Array.isArray(e.entry)&&e.entry.length>0?e.entry:Array.isArray(t?.entry)&&t.entry.length>0?t.entry:[]},v(e??{},[`entry`]),v(t??{},[`entry`])),this.config.userConfig.output?.format&&(this.config.userConfig.output.format=P(g(this.config.userConfig.output?.format))),this.config.userConfig.plugins=(this.config.userConfig.plugins??[]).filter(Boolean).reduce((e,t)=>(o(t)&&a(t,e.filter(e=>o(e)))||e.push(t),e),[])}};export{Y as PowerlinesContext};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../plugin-utils/helpers.cjs`),n=require(`./context.cjs`),r=require(`../../types/plugin.cjs`),i=require(`./plugin-context.cjs`);let a=require(`@stryke/type-checks/is-function`),o=require(`@stryke/fs/resolve`),s=require(`@stryke/type-checks/is-object`);var c=class e extends n.PowerlinesContext{#e={};static async fromConfig(t,n){let r=new e(n,t);await r.init();let i=await(0,o.resolvePackage)(`powerlines`);if(!i)throw Error("Could not resolve `powerlines` package location.");return r.powerlinesPath=i,r}environment;plugins=[];get config(){return super.config}get hooks(){return this.#e}async addPlugin(e){let n=e;if((0,a.isFunction)(e.applyToEnvironment)){let r=await Promise.resolve(e.applyToEnvironment(this.environment));if(!r||(0,s.isObject)(r)&&Object.keys(r).length===0)return;if(t.isPluginConfig(r))return this.$$internal.addPlugin(r);n=t.isPlugin(r)?r:e}let o=i.createPluginContext(n,this);this.plugins.push({plugin:n,context:o}),this.#e=Object.keys(n).filter(e=>!r.PLUGIN_NON_HOOK_FIELDS.includes(e)).reduce((e,r)=>{let i=r,s=n[i];if(!t.isPluginHook(s))return e;if(t.isHookExternal(i))e[i]??=[],e[i].push({plugin:n,hook:t.getHookHandler(s).bind(o)});else{if(e[i]??={},n.enforce)return e[i][`${n.enforce}Enforced`]??=[],t.addPluginHook(o,n,s,e[i][`${n.enforce}Enforced`]),e;if((0,a.isFunction)(s)||!s.order)return e[i].normal??=[],t.addPluginHook(o,n,s,e[i].normal),e;e[i][`${s.order}Ordered`]??=[],t.addPluginHook(o,n,s,e[i][`${s.order}Ordered`])}return e},this.hooks)}selectHooks(e,n){let r=[];if(this.hooks[e])if(t.isHookExternal(e))r.push(...this.hooks[e].map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}));else{let t=this.hooks[e];n?.order?n?.order===`pre`?(r.push(...(t.preOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),r.push(...(t.preEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):n?.order===`post`?(r.push(...(t.postOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),r.push(...(t.postEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):r.push(...(t.normal??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})):(r.push(...this.selectHooks(e,{order:`pre`})),r.push(...this.selectHooks(e,{order:`normal`})),r.push(...this.selectHooks(e,{order:`post`})))}return r}constructor(e,t){super(t),this.resolvedConfig=e}};exports.PowerlinesEnvironmentContext=c;
@@ -0,0 +1 @@
1
+ import{addPluginHook as e,getHookHandler as t,isHookExternal as n,isPlugin as r,isPluginConfig as i,isPluginHook as a}from"../../plugin-utils/helpers.mjs";import{PowerlinesContext as o}from"./context.mjs";import{PLUGIN_NON_HOOK_FIELDS as s}from"../../types/plugin.mjs";import{createPluginContext as c}from"./plugin-context.mjs";import{isFunction as l}from"@stryke/type-checks/is-function";import{resolvePackage as u}from"@stryke/fs/resolve";import{isObject as d}from"@stryke/type-checks/is-object";var f=class f extends o{#e={};static async fromConfig(e,t){let n=new f(t,e);await n.init();let r=await u(`powerlines`);if(!r)throw Error("Could not resolve `powerlines` package location.");return n.powerlinesPath=r,n}environment;plugins=[];get config(){return super.config}get hooks(){return this.#e}async addPlugin(o){let u=o;if(l(o.applyToEnvironment)){let e=await Promise.resolve(o.applyToEnvironment(this.environment));if(!e||d(e)&&Object.keys(e).length===0)return;if(i(e))return this.$$internal.addPlugin(e);u=r(e)?e:o}let f=c(u,this);this.plugins.push({plugin:u,context:f}),this.#e=Object.keys(u).filter(e=>!s.includes(e)).reduce((r,i)=>{let o=i,s=u[o];if(!a(s))return r;if(n(o))r[o]??=[],r[o].push({plugin:u,hook:t(s).bind(f)});else{if(r[o]??={},u.enforce)return r[o][`${u.enforce}Enforced`]??=[],e(f,u,s,r[o][`${u.enforce}Enforced`]),r;if(l(s)||!s.order)return r[o].normal??=[],e(f,u,s,r[o].normal),r;r[o][`${s.order}Ordered`]??=[],e(f,u,s,r[o][`${s.order}Ordered`])}return r},this.hooks)}selectHooks(e,t){let r=[];if(this.hooks[e])if(n(e))r.push(...this.hooks[e].map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}));else{let n=this.hooks[e];t?.order?t?.order===`pre`?(r.push(...(n.preOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),r.push(...(n.preEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):t?.order===`post`?(r.push(...(n.postOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),r.push(...(n.postEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):r.push(...(n.normal??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})):(r.push(...this.selectHooks(e,{order:`pre`})),r.push(...this.selectHooks(e,{order:`normal`})),r.push(...this.selectHooks(e,{order:`post`})))}return r}constructor(e,t){super(t),this.resolvedConfig=e}};export{f as PowerlinesEnvironmentContext};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/type-checks/is-string`),n=require(`@storm-software/config-tools/types`);function r(e,r){let i=e=>(0,t.isString)(e)?e:e.message,a=r.extendLog(e.name),o=async(e,t,...n)=>r.$$internal.api.callHook(e,{sequential:!0,result:`merge`,...t,environment:r},...n);return new Proxy({},{get(e,t){return t===`$$internal`?{...r.$$internal,environment:r,callHook:o}:t===`log`||t===`logger`?a:t===`error`?e=>{a(n.LogLevelLabel.ERROR,i(e))}:t===`warn`?e=>{a(n.LogLevelLabel.WARN,i(e))}:t===`info`?e=>{a(n.LogLevelLabel.INFO,i(e))}:t===`debug`?e=>{a(n.LogLevelLabel.DEBUG,i(e))}:t===`trace`?e=>{a(n.LogLevelLabel.TRACE,i(e))}:r[t]},set(e,t,i){return[`$$internal`,`environment`,`config`,`log`,`logger`,`error`,`warn`,`plugins`,`hooks`,`addPlugin`,`selectHooks`].includes(t)?(a(n.LogLevelLabel.WARN,`Cannot set read-only property "${String(t)}"`),!1):(r[t]=i,!0)}})}exports.createPluginContext=r;
@@ -0,0 +1 @@
1
+ import{isString as e}from"@stryke/type-checks/is-string";import{LogLevelLabel as t}from"@storm-software/config-tools/types";function n(n,r){let i=t=>e(t)?t:t.message,a=r.extendLog(n.name),o=async(e,t,...n)=>r.$$internal.api.callHook(e,{sequential:!0,result:`merge`,...t,environment:r},...n);return new Proxy({},{get(e,n){return n===`$$internal`?{...r.$$internal,environment:r,callHook:o}:n===`log`||n===`logger`?a:n===`error`?e=>{a(t.ERROR,i(e))}:n===`warn`?e=>{a(t.WARN,i(e))}:n===`info`?e=>{a(t.INFO,i(e))}:n===`debug`?e=>{a(t.DEBUG,i(e))}:n===`trace`?e=>{a(t.TRACE,i(e))}:r[n]},set(e,n,i){return[`$$internal`,`environment`,`config`,`log`,`logger`,`error`,`warn`,`plugins`,`hooks`,`addPlugin`,`selectHooks`].includes(n)?(a(t.WARN,`Cannot set read-only property "${String(n)}"`),!1):(r[n]=i,!0)}})}export{n as createPluginContext};
@@ -0,0 +1 @@
1
+ const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../plugin-utils/paths.cjs`);let n=require(`@stryke/convert/to-array`),r=require(`@stryke/path/join-paths`),i=require(`@stryke/type-checks/is-string`),a=require(`@stryke/fs/list-files`),o=require(`@stryke/path/append`),s=require(`@stryke/path/replace`),c=require(`@stryke/type-checks/is-set-string`),l=require(`@stryke/hash/murmurhash`),u=require(`@stryke/helpers/get-unique`),d=require(`@stryke/convert/parse-type-definition`),f=require(`@stryke/fs/is-file`);function p(e,t){return(0,s.replacePath)(t.file,(0,r.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot))}function m(e,t){return{file:p(e,t),name:t.name}}function h(e,t){return(0,s.replaceExtension)((0,s.replacePath)((0,s.replacePath)((0,s.replacePath)((0,s.replacePath)((0,s.replacePath)(t.file,(0,r.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.sourceRoot)),(0,r.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot)),e.config.sourceRoot),e.config.projectRoot),(0,s.replacePath)(e.config.sourceRoot,e.config.projectRoot)))}function g(e,t){let n=m(e,t);return{...n,input:n,output:h(e,t)}}function _(e,n){return n.map(n=>(0,i.isString)(n)?t.replacePathTokens(e,n):t.replacePathTokens(e,n.file)).map(t=>{let n=(0,d.parseTypeDefinition)(t),r=(0,o.appendPath)(n.file,e.config.projectRoot);return(0,f.isFile)(r)?g(e,{file:(0,s.replacePath)(r,e.config.projectRoot),name:n.name}):(0,a.listFilesSync)(r).map(t=>g(e,{file:t,name:n.name}))}).flat().filter(Boolean)}function v(e=[]){return(0,u.getUniqueBy)((0,n.toArray)(e),e=>(0,c.isSetString)(e)?e:(0,l.murmurhash)(e??{},{maxLength:24}))}exports.getUniqueEntries=v,exports.resolveEntriesSync=_;
@@ -0,0 +1 @@
1
+ import{replacePathTokens as e}from"../plugin-utils/paths.mjs";import{toArray as t}from"@stryke/convert/to-array";import{joinPaths as n}from"@stryke/path/join-paths";import{isString as r}from"@stryke/type-checks/is-string";import{listFiles as i,listFilesSync as a}from"@stryke/fs/list-files";import{appendPath as o}from"@stryke/path/append";import{replaceExtension as s,replacePath as c}from"@stryke/path/replace";import{isSetString as l}from"@stryke/type-checks/is-set-string";import{murmurhash as u}from"@stryke/hash/murmurhash";import{getUniqueBy as d}from"@stryke/helpers/get-unique";import{parseTypeDefinition as f}from"@stryke/convert/parse-type-definition";import{isFile as p}from"@stryke/fs/is-file";function m(e,t){return c(t.file,n(e.workspaceConfig.workspaceRoot,e.config.projectRoot))}function h(e,t){return{file:m(e,t),name:t.name}}function g(e,t){return s(c(c(c(c(c(t.file,n(e.workspaceConfig.workspaceRoot,e.config.sourceRoot)),n(e.workspaceConfig.workspaceRoot,e.config.projectRoot)),e.config.sourceRoot),e.config.projectRoot),c(e.config.sourceRoot,e.config.projectRoot)))}function _(e,t){let n=h(e,t);return{...n,input:n,output:g(e,t)}}function v(t,n){return n.map(n=>r(n)?e(t,n):e(t,n.file)).map(e=>{let n=f(e),r=o(n.file,t.config.projectRoot);return p(r)?_(t,{file:c(r,t.config.projectRoot),name:n.name}):a(r).map(e=>_(t,{file:e,name:n.name}))}).flat().filter(Boolean)}function y(e=[]){return d(t(e),e=>l(e)?e:u(e??{},{maxLength:24}))}export{y as getUniqueEntries,v as resolveEntriesSync};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/convert/to-array`),n=require(`@stryke/type-checks/is-error`),r=require(`@stryke/type-checks/is-set-object`),i=require(`@stryke/type-checks/is-set-string`),a=require(`@stryke/path/file-path-fns`),o=require(`@stryke/helpers/get-unique`),s=require(`@stryke/path/is-type`),c=require(`@stryke/path/join`),l=require(`@stryke/path/correct-path`),u=require(`@stryke/path/slash`);function d(e){return(0,n.isError)(e)&&`code`in e&&e.code}function f(e){return d(e)&&(e.code===`ENOENT`||e.code===`EISDIR`?null:e)}function p(e){return(0,l.correctPath)((0,u.slash)(e?.toString()||`.`).replace(/^file:\/\//,``))}function m(e,t=`powerlines`){return e.replace(/^\\0/,``).startsWith(`${t.replace(/:$/,``)}`)}function h(e,t=`powerlines`){return`${t.replace(/:$/,``)}:${p(e).replace(RegExp(`^${t.replace(/:$/,``)}:`),``).replace(/^\\0/,``).replace((0,a.findFileDotExtensionSafe)(p(e)),``)}`}function g(e,t,n=`powerlines`){return(0,s.isAbsolutePath)(e)?e:m(p(e),n)?h(p(e),n).replace(RegExp(`^${n.replace(/:$/,``)}:`),t):p(e)}function _(e,n){return(0,o.getUnique)((0,t.toArray)(n).map(t=>(0,r.isSetObject)(t)&&((0,i.isSetString)(t.input)||(0,i.isSetString)(t.glob))?(0,c.joinPaths)(t.input||e,t.glob||`**/*`):(0,i.isSetString)(t)?t:void 0).filter(i.isSetString))}exports.ignoreNotfound=f,exports.normalizeGlobPatterns=_,exports.normalizeId=h,exports.normalizePath=g;
@@ -0,0 +1 @@
1
+ import{toArray as e}from"@stryke/convert/to-array";import{isError as t}from"@stryke/type-checks/is-error";import{isSetObject as n}from"@stryke/type-checks/is-set-object";import{isSetString as r}from"@stryke/type-checks/is-set-string";import{findFileDotExtensionSafe as i}from"@stryke/path/file-path-fns";import{getUnique as a}from"@stryke/helpers/get-unique";import{isAbsolutePath as o}from"@stryke/path/is-type";import{joinPaths as s}from"@stryke/path/join";import{correctPath as c}from"@stryke/path/correct-path";import{slash as l}from"@stryke/path/slash";function u(e){return t(e)&&`code`in e&&e.code}function d(e){return u(e)&&(e.code===`ENOENT`||e.code===`EISDIR`?null:e)}function f(e){return c(l(e?.toString()||`.`).replace(/^file:\/\//,``))}function p(e,t=`powerlines`){return e.replace(/^\\0/,``).startsWith(`${t.replace(/:$/,``)}`)}function m(e,t=`powerlines`){return`${t.replace(/:$/,``)}:${f(e).replace(RegExp(`^${t.replace(/:$/,``)}:`),``).replace(/^\\0/,``).replace(i(f(e)),``)}`}function h(e,t,n=`powerlines`){return o(e)?e:p(f(e),n)?m(f(e),n).replace(RegExp(`^${n.replace(/:$/,``)}:`),t):f(e)}function g(t,i){return a(e(i).map(e=>n(e)&&(r(e.input)||r(e.glob))?s(e.input||t,e.glob||`**/*`):r(e)?e:void 0).filter(r))}export{d as ignoreNotfound,g as normalizeGlobPatterns,m as normalizeId,h as normalizePath};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/append`),n=require(`@stryke/path/join`),r=require(`@stryke/path/correct-path`),i=require(`node:path`);var a=class{#e=!1;options;constructor(e={base:`/`}){this.options=e,this.options.base=(0,i.resolve)(e.base),this.options.isReadOnly=!!e.isReadOnly}async exists(e){return this.existsSync(e)}async get(e){return this.getSync(e)}async set(e,t){this.options.isReadOnly||this.setSync(e,t)}mkdirSync(e){}async mkdir(e){return Promise.resolve(this.mkdirSync(e))}async remove(e){this.options.isReadOnly||this.removeSync(e)}clearSync(e){if(!this.options.isReadOnly){let t=this.listSync(e||this.options.base);if(!t.length)return;t.map(t=>this.removeSync(e&&!t.startsWith(e)?(0,n.joinPaths)(e,t):t))}}async clear(e){if(!this.options.isReadOnly){let t=await this.list(e||this.options.base);if(!t.length)return;await Promise.all(t.map(async t=>this.remove(e&&!t.startsWith(e)?(0,n.joinPaths)(e,t):t)))}}async list(e){return this.listSync(e)}isDirectorySync(e){return!1}async isDirectory(e){return Promise.resolve(this.isDirectorySync(e))}isFileSync(e){return this.existsSync(e)&&!this.isDirectorySync(e)}async isFile(e){return Promise.resolve(this.isFileSync(e))}dispose(){return Promise.resolve()}async[Symbol.asyncDispose](){return this._dispose()}resolve(e=this.options.base){if(/\.\.:|\.\.$/.test(e))throw Error(`[${this.name}]: Invalid key: ${JSON.stringify(e)} provided to storage adapter.`);return(0,t.appendPath)((0,r.correctPath)(e).replace(/:/g,`/`),this.options.base)}async _dispose(){this.#e||=(await Promise.resolve(this.dispose()),!0)}};exports.BaseStorageAdapter=a;
@@ -0,0 +1 @@
1
+ import{appendPath as e}from"@stryke/path/append";import{joinPaths as t}from"@stryke/path/join";import{correctPath as n}from"@stryke/path/correct-path";import{resolve as r}from"node:path";var i=class{#e=!1;options;constructor(e={base:`/`}){this.options=e,this.options.base=r(e.base),this.options.isReadOnly=!!e.isReadOnly}async exists(e){return this.existsSync(e)}async get(e){return this.getSync(e)}async set(e,t){this.options.isReadOnly||this.setSync(e,t)}mkdirSync(e){}async mkdir(e){return Promise.resolve(this.mkdirSync(e))}async remove(e){this.options.isReadOnly||this.removeSync(e)}clearSync(e){if(!this.options.isReadOnly){let n=this.listSync(e||this.options.base);if(!n.length)return;n.map(n=>this.removeSync(e&&!n.startsWith(e)?t(e,n):n))}}async clear(e){if(!this.options.isReadOnly){let n=await this.list(e||this.options.base);if(!n.length)return;await Promise.all(n.map(async n=>this.remove(e&&!n.startsWith(e)?t(e,n):n)))}}async list(e){return this.listSync(e)}isDirectorySync(e){return!1}async isDirectory(e){return Promise.resolve(this.isDirectorySync(e))}isFileSync(e){return this.existsSync(e)&&!this.isDirectorySync(e)}async isFile(e){return Promise.resolve(this.isFileSync(e))}dispose(){return Promise.resolve()}async[Symbol.asyncDispose](){return this._dispose()}resolve(t=this.options.base){if(/\.\.:|\.\.$/.test(t))throw Error(`[${this.name}]: Invalid key: ${JSON.stringify(t)} provided to storage adapter.`);return e(n(t).replace(/:/g,`/`),this.options.base)}async _dispose(){this.#e||=(await Promise.resolve(this.dispose()),!0)}};export{i as BaseStorageAdapter};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../../_virtual/rolldown_runtime.cjs`),t=require(`../helpers.cjs`),n=require(`./base.cjs`);let r=require(`node:fs`),i=require(`@stryke/fs/helpers`),a=require(`@stryke/fs/list-files`),o=require(`@stryke/fs/exists`),s=require(`@stryke/fs/is-file`),c=require(`@stryke/fs/read-file`),l=require(`@stryke/fs/write-file`),u=require(`node:fs/promises`);var d=class extends n.BaseStorageAdapter{name=`file-system`;constructor(e){super(e)}existsSync(e){return(0,o.existsSync)(this.resolve(e))}async exists(e){return(0,o.exists)(this.resolve(e))}getSync(e){return(0,c.readFileSync)(this.resolve(e))}async get(e){return(0,c.readFile)(this.resolve(e))}setSync(e,t){if(!this.options.isReadOnly)return(0,l.writeFileSync)(this.resolve(e),t)}async set(e,t){if(!this.options.isReadOnly)return(0,l.writeFile)(this.resolve(e),t)}removeSync(e){if(!this.options.isReadOnly)try{return(0,r.unlinkSync)(this.resolve(e))}catch(e){return t.ignoreNotfound(e)}}async remove(e){if(!this.options.isReadOnly)return(0,u.unlink)(this.resolve(e)).catch(t.ignoreNotfound)}mkdirSync(e){(0,i.createDirectorySync)(this.resolve(e))}async mkdir(e){await(0,i.createDirectory)(this.resolve(e))}listSync(e){try{return(0,a.listFilesSync)(this.resolve(e),{ignore:this.options.ignore})}catch(e){return t.ignoreNotfound(e)??[]}}async list(e){return(0,a.listFiles)(this.resolve(e),{ignore:this.options.ignore}).catch(t.ignoreNotfound).then(e=>e||[])}isDirectorySync(e){return(0,s.isDirectory)(this.resolve(e))}isFileSync(e){return!(0,s.isFile)(this.resolve(e))}};exports.FileSystemStorageAdapter=d;
@@ -0,0 +1 @@
1
+ import{ignoreNotfound as e}from"../helpers.mjs";import{BaseStorageAdapter as t}from"./base.mjs";import{unlinkSync as n}from"node:fs";import{createDirectory as r,createDirectorySync as i}from"@stryke/fs/helpers";import{listFiles as a,listFilesSync as o}from"@stryke/fs/list-files";import{exists as s,existsSync as c}from"@stryke/fs/exists";import{isDirectory as l,isFile as u}from"@stryke/fs/is-file";import{readFile as d,readFileSync as f}from"@stryke/fs/read-file";import{writeFile as p,writeFileSync as m}from"@stryke/fs/write-file";import{unlink as h}from"node:fs/promises";var g=class extends t{name=`file-system`;constructor(e){super(e)}existsSync(e){return c(this.resolve(e))}async exists(e){return s(this.resolve(e))}getSync(e){return f(this.resolve(e))}async get(e){return d(this.resolve(e))}setSync(e,t){if(!this.options.isReadOnly)return m(this.resolve(e),t)}async set(e,t){if(!this.options.isReadOnly)return p(this.resolve(e),t)}removeSync(t){if(!this.options.isReadOnly)try{return n(this.resolve(t))}catch(t){return e(t)}}async remove(t){if(!this.options.isReadOnly)return h(this.resolve(t)).catch(e)}mkdirSync(e){i(this.resolve(e))}async mkdir(e){await r(this.resolve(e))}listSync(t){try{return o(this.resolve(t),{ignore:this.options.ignore})}catch(t){return e(t)??[]}}async list(t){return a(this.resolve(t),{ignore:this.options.ignore}).catch(e).then(e=>e||[])}isDirectorySync(e){return l(this.resolve(e))}isFileSync(e){return!u(this.resolve(e))}};export{g as FileSystemStorageAdapter};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../../_virtual/rolldown_runtime.cjs`),t=require(`./base.cjs`);let n=require(`@stryke/path/is-parent-path`);var r=class extends t.BaseStorageAdapter{name=`virtual`;data=new Map;constructor(e){super(e)}existsSync(e){return this.data.has(this.resolve(e))}getSync(e){return this.data.get(this.resolve(e))??null}setSync(e,t){this.options.isReadOnly||this.data.set(this.resolve(e),t)}removeSync(e){this.options.isReadOnly||this.data.delete(this.resolve(e))}listSync(e){return[...this.data.keys().filter(t=>e?(0,n.isParentPath)(t,this.resolve(e)):!0)]}async dispose(){return this.clear()}};exports.VirtualStorageAdapter=r;
@@ -0,0 +1 @@
1
+ import{BaseStorageAdapter as e}from"./base.mjs";import{isParentPath as t}from"@stryke/path/is-parent-path";var n=class extends e{name=`virtual`;data=new Map;constructor(e){super(e)}existsSync(e){return this.data.has(this.resolve(e))}getSync(e){return this.data.get(this.resolve(e))??null}setSync(e,t){this.options.isReadOnly||this.data.set(this.resolve(e),t)}removeSync(e){this.options.isReadOnly||this.data.delete(this.resolve(e))}listSync(e){return[...this.data.keys().filter(n=>e?t(n,this.resolve(e)):!0)]}async dispose(){return this.clear()}};export{n as VirtualStorageAdapter};