powerlines 0.31.3 → 0.31.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-jh6FfpWH.d.cts → api-BHNP4L9F.d.cts} +1 -1
- package/dist/{api-CUkLQTDA.d.ts → api-CRSOph63.d.ts} +1 -1
- package/dist/api.cjs +3 -3
- package/dist/api.d.cts +2 -2
- package/dist/api.d.ts +2 -2
- package/dist/api.js +2 -2
- package/dist/astro.cjs +5 -5
- package/dist/astro.d.cts +1 -1
- package/dist/astro.d.ts +1 -1
- package/dist/astro.js +4 -4
- package/dist/chunk-2TPZV3VK.cjs +12 -0
- package/dist/chunk-45YZCBHR.cjs +12 -0
- package/dist/{chunk-EQDVR454.js → chunk-DZY3LNTY.js} +3 -3
- package/dist/{chunk-XFG6A5WA.js → chunk-EMIKBRCT.js} +3 -3
- package/dist/{chunk-ICSRPUJ6.js → chunk-FJ5JKE4N.js} +3 -3
- package/dist/{chunk-4EGBX7D5.js → chunk-JGSCIWFQ.js} +2 -2
- package/dist/{chunk-Y3L2CLY3.js → chunk-NGRCYHUU.js} +3 -3
- package/dist/{chunk-6RXJFMRQ.cjs → chunk-OENQ5VVB.cjs} +4 -4
- package/dist/{chunk-FTHBKPFN.js → chunk-RPBIX6JI.js} +3 -3
- package/dist/{chunk-LL34NJO3.cjs → chunk-UDPMUFXM.cjs} +4 -4
- package/dist/{chunk-YVN7IMYC.cjs → chunk-VFXZVCGG.cjs} +2 -2
- package/dist/{chunk-7ZLXQ2YQ.cjs → chunk-XTSKPL6I.cjs} +5 -5
- package/dist/{chunk-MUYUCDCN.js → chunk-Z5MNSDM4.js} +3 -3
- package/dist/{chunk-EN4A3XVI.cjs → chunk-ZLLAZ5LF.cjs} +4 -4
- package/dist/{context-BTbXJsGt.d.ts → context-BK7L6aHC.d.ts} +2 -2
- package/dist/{context-VzZM5aS9.d.cts → context-CbLP5ZJo.d.cts} +2 -2
- package/dist/esbuild.cjs +7 -7
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.ts +1 -1
- package/dist/esbuild.js +4 -4
- package/dist/farm.cjs +4 -4
- package/dist/farm.d.cts +1 -1
- package/dist/farm.d.ts +1 -1
- package/dist/farm.js +3 -3
- package/dist/index.cjs +11 -11
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/lib/{api-CFadZBJS.d.cts → api-CHM8_t1f.d.cts} +1 -1
- package/dist/lib/{api-Dihp6Dkd.d.ts → api-zlk8r_Vv.d.ts} +1 -1
- package/dist/lib/build/esbuild.d.cts +1 -1
- package/dist/lib/build/esbuild.d.ts +1 -1
- package/dist/lib/build/index.d.cts +3 -3
- package/dist/lib/build/index.d.ts +3 -3
- package/dist/lib/build/rolldown.d.cts +1 -1
- package/dist/lib/build/rolldown.d.ts +1 -1
- package/dist/lib/build/rollup.d.cts +1 -1
- package/dist/lib/build/rollup.d.ts +1 -1
- package/dist/lib/build/rspack.d.cts +1 -1
- package/dist/lib/build/rspack.d.ts +1 -1
- package/dist/lib/build/tsdown.d.cts +1 -1
- package/dist/lib/build/tsdown.d.ts +1 -1
- package/dist/lib/build/tsup.d.cts +1 -1
- package/dist/lib/build/tsup.d.ts +1 -1
- package/dist/lib/build/unbuild.d.cts +3 -3
- package/dist/lib/build/unbuild.d.ts +3 -3
- package/dist/lib/build/vite.d.cts +1 -1
- package/dist/lib/build/vite.d.ts +1 -1
- package/dist/lib/build/webpack.d.cts +1 -1
- package/dist/lib/build/webpack.d.ts +1 -1
- package/dist/lib/{chunk-OANCMG6M.js → chunk-72NPPPRF.js} +3 -3
- package/dist/lib/{chunk-OANCMG6M.js.map → chunk-72NPPPRF.js.map} +1 -1
- package/dist/lib/{chunk-WDWFFST7.cjs → chunk-ACVINY5F.cjs} +4 -4
- package/dist/lib/{chunk-WDWFFST7.cjs.map → chunk-ACVINY5F.cjs.map} +1 -1
- package/dist/lib/{chunk-AZACBBDV.js → chunk-AEUGNAWZ.js} +3 -3
- package/dist/lib/{chunk-AZACBBDV.js.map → chunk-AEUGNAWZ.js.map} +1 -1
- package/dist/lib/{chunk-ADNIE2W6.js → chunk-FR2ZVFLT.js} +2 -2
- package/dist/lib/{chunk-ADNIE2W6.js.map → chunk-FR2ZVFLT.js.map} +1 -1
- package/dist/lib/{chunk-BDD3CCIC.cjs → chunk-O6E2NAHX.cjs} +4 -4
- package/dist/lib/{chunk-BDD3CCIC.cjs.map → chunk-O6E2NAHX.cjs.map} +1 -1
- package/dist/lib/{chunk-KONHDVDN.cjs → chunk-UHQU5ASL.cjs} +2 -2
- package/dist/lib/{chunk-KONHDVDN.cjs.map → chunk-UHQU5ASL.cjs.map} +1 -1
- package/dist/lib/{config-bJLIdq79.d.ts → config-Bkk5oOVc.d.ts} +2 -2
- package/dist/lib/{config-jIBcJ5iG.d.cts → config-C74fZ7Hm.d.cts} +2 -2
- package/dist/lib/config-file.d.cts +1 -1
- package/dist/lib/config-file.d.ts +1 -1
- package/dist/lib/contexts/api-context.cjs +3 -3
- package/dist/lib/contexts/api-context.d.cts +3 -3
- package/dist/lib/contexts/api-context.d.ts +3 -3
- package/dist/lib/contexts/api-context.js +2 -2
- package/dist/lib/contexts/context.d.cts +3 -3
- package/dist/lib/contexts/context.d.ts +3 -3
- package/dist/lib/contexts/environment-context.cjs +2 -2
- package/dist/lib/contexts/environment-context.d.cts +3 -3
- package/dist/lib/contexts/environment-context.d.ts +3 -3
- package/dist/lib/contexts/environment-context.js +1 -1
- package/dist/lib/contexts/index.cjs +4 -4
- package/dist/lib/contexts/index.d.cts +3 -3
- package/dist/lib/contexts/index.d.ts +3 -3
- package/dist/lib/contexts/index.js +2 -2
- package/dist/lib/contexts/plugin-context.d.cts +3 -3
- package/dist/lib/contexts/plugin-context.d.ts +3 -3
- package/dist/lib/entry.d.cts +1 -1
- package/dist/lib/entry.d.ts +1 -1
- package/dist/lib/fs/index.d.cts +1 -1
- package/dist/lib/fs/index.d.ts +1 -1
- package/dist/lib/fs/vfs.d.cts +1 -1
- package/dist/lib/fs/vfs.d.ts +1 -1
- package/dist/lib/index.cjs +6 -6
- package/dist/lib/index.d.cts +4 -4
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +3 -3
- package/dist/lib/{internal-Dp5XvEQx.d.ts → internal-DA1f6c7h.d.ts} +2 -2
- package/dist/lib/{internal-Cb8TJhwl.d.cts → internal-Z9V60LMp.d.cts} +2 -2
- package/dist/lib/logger.d.cts +1 -1
- package/dist/lib/logger.d.ts +1 -1
- package/dist/lib/typescript/import-transformer.d.cts +1 -1
- package/dist/lib/typescript/import-transformer.d.ts +1 -1
- package/dist/lib/typescript/index.d.cts +1 -1
- package/dist/lib/typescript/index.d.ts +1 -1
- package/dist/lib/typescript/ts-morph.d.cts +1 -1
- package/dist/lib/typescript/ts-morph.d.ts +1 -1
- package/dist/lib/unplugin/factory.cjs +4 -4
- package/dist/lib/unplugin/factory.d.cts +3 -3
- package/dist/lib/unplugin/factory.d.ts +3 -3
- package/dist/lib/unplugin/factory.js +3 -3
- package/dist/lib/unplugin/helpers.d.cts +1 -1
- package/dist/lib/unplugin/helpers.d.ts +1 -1
- package/dist/lib/unplugin/index.cjs +4 -4
- package/dist/lib/unplugin/index.d.cts +3 -3
- package/dist/lib/unplugin/index.d.ts +3 -3
- package/dist/lib/unplugin/index.js +3 -3
- package/dist/lib/unplugin/plugin.d.cts +3 -3
- package/dist/lib/unplugin/plugin.d.ts +3 -3
- package/dist/lib/{unplugin-DiffQcvO.d.cts → unplugin--Wb_ttDq.d.cts} +2 -2
- package/dist/lib/{unplugin-BVe7BCHj.d.ts → unplugin-_FT__-JQ.d.ts} +2 -2
- package/dist/lib/utilities/bundle.d.cts +1 -1
- package/dist/lib/utilities/bundle.d.ts +1 -1
- package/dist/lib/utilities/cache.d.cts +1 -1
- package/dist/lib/utilities/cache.d.ts +1 -1
- package/dist/lib/utilities/file-header.d.cts +1 -1
- package/dist/lib/utilities/file-header.d.ts +1 -1
- package/dist/lib/utilities/index.d.cts +1 -1
- package/dist/lib/utilities/index.d.ts +1 -1
- package/dist/lib/utilities/meta.d.cts +1 -1
- package/dist/lib/utilities/meta.d.ts +1 -1
- package/dist/lib/utilities/resolve.d.cts +1 -1
- package/dist/lib/utilities/resolve.d.ts +1 -1
- package/dist/lib/utilities/source-file.d.cts +1 -1
- package/dist/lib/utilities/source-file.d.ts +1 -1
- package/dist/lib/utilities/source-map.d.cts +1 -1
- package/dist/lib/utilities/source-map.d.ts +1 -1
- package/dist/lib/utilities/worker.d.cts +1 -1
- package/dist/lib/utilities/worker.d.ts +1 -1
- package/dist/lib/utilities/write-file.d.cts +1 -1
- package/dist/lib/utilities/write-file.d.ts +1 -1
- package/dist/next.cjs +5 -5
- package/dist/next.js +4 -4
- package/dist/nuxt.cjs +8 -8
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +6 -6
- package/dist/plugin-utils/{context-DzPQnKvh.d.ts → context-Cz95NeRR.d.cts} +2 -2
- package/dist/plugin-utils/{context-DzPQnKvh.d.cts → context-Cz95NeRR.d.ts} +2 -2
- package/dist/plugin-utils/context-helpers.d.cts +1 -1
- package/dist/plugin-utils/context-helpers.d.ts +1 -1
- package/dist/plugin-utils/enforce.d.cts +1 -1
- package/dist/plugin-utils/enforce.d.ts +1 -1
- package/dist/plugin-utils/extend.d.cts +1 -1
- package/dist/plugin-utils/extend.d.ts +1 -1
- package/dist/plugin-utils/get-config-path.d.cts +1 -1
- package/dist/plugin-utils/get-config-path.d.ts +1 -1
- package/dist/plugin-utils/helpers.d.cts +1 -1
- package/dist/plugin-utils/helpers.d.ts +1 -1
- package/dist/plugin-utils/index.d.cts +1 -1
- package/dist/plugin-utils/index.d.ts +1 -1
- package/dist/plugin-utils/merge.d.cts +1 -1
- package/dist/plugin-utils/merge.d.ts +1 -1
- package/dist/plugin-utils/paths.d.cts +1 -1
- package/dist/plugin-utils/paths.d.ts +1 -1
- package/dist/rolldown.cjs +7 -7
- package/dist/rolldown.d.cts +1 -1
- package/dist/rolldown.d.ts +1 -1
- package/dist/rolldown.js +4 -4
- package/dist/rollup.cjs +4 -4
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +3 -3
- package/dist/rspack.cjs +4 -4
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.js +3 -3
- package/dist/tsdown.cjs +5 -5
- package/dist/tsdown.js +4 -4
- package/dist/tsup.cjs +5 -5
- package/dist/tsup.js +4 -4
- package/dist/types/api.d.cts +2 -2
- package/dist/types/api.d.ts +2 -2
- package/dist/types/babel.d.cts +1 -1
- package/dist/types/babel.d.ts +1 -1
- package/dist/types/commands.d.cts +1 -1
- package/dist/types/commands.d.ts +1 -1
- package/dist/types/config.d.cts +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/context.d.cts +1 -1
- package/dist/types/context.d.ts +1 -1
- package/dist/types/hooks.d.cts +1 -1
- package/dist/types/hooks.d.ts +1 -1
- package/dist/types/index.cjs +2 -2
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +1 -1
- package/dist/types/internal.d.cts +2 -2
- package/dist/types/internal.d.ts +2 -2
- package/dist/types/plugin.cjs +2 -2
- package/dist/types/plugin.d.cts +1 -1
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/plugin.js +1 -1
- package/dist/types/resolved.d.cts +1 -1
- package/dist/types/resolved.d.ts +1 -1
- package/dist/types/unplugin.d.cts +2 -2
- package/dist/types/unplugin.d.ts +2 -2
- package/dist/unloader.cjs +4 -4
- package/dist/unloader.d.cts +1 -1
- package/dist/unloader.d.ts +1 -1
- package/dist/unloader.js +3 -3
- package/dist/unplugin.cjs +6 -6
- package/dist/unplugin.d.cts +2 -2
- package/dist/unplugin.d.ts +2 -2
- package/dist/unplugin.js +4 -4
- package/dist/vite.cjs +7 -7
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +4 -4
- package/dist/webpack.cjs +7 -7
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +4 -4
- package/package.json +2 -2
- package/dist/chunk-CBRW2T76.cjs +0 -12
- package/dist/chunk-YUDVA7A3.cjs +0 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PowerlinesAPI } from './api.js';
|
|
2
|
-
import { ag as AnyUserConfig, U as UserConfig } from './context-
|
|
3
|
-
export { b6 as APIContext, B as BabelPluginPass, cn as BabelResolvedConfig, d as BabelTransformInput, b as BabelTransformPlugin, f as BabelTransformPluginBuilder, e as BabelTransformPluginBuilderParams, a as BabelTransformPluginFilter, c as BabelTransformPluginOptions, G as BabelUserConfig, J as BaseConfig, bw as BaseHookKeys, bv as BaseHooks, bC as BaseHooksList, bB as BaseHooksListItem, b$ as BasePluginHookFunctions, ab as BuildInlineConfig, c0 as BuildPlugin, bb as BuildPluginContext, a9 as CleanInlineConfig, C as CommandType, u as Commands, M as CommonUserConfig, af as ConfigEnv, b_ as ConfigResult, b5 as Context, g as DeclareBabelTransformPluginReturn, D as DefaultImportDefinition, H as DeployConfig, ae as DeployInlineConfig, ad as DocsInlineConfig, cv as ESBuildResolvedConfig, Z as ESBuildUserConfig, K as EnvironmentConfig, b9 as EnvironmentContext, b7 as EnvironmentContextPlugin, co as EnvironmentResolvedConfig, by as ExternalHookKeys, bx as ExternalHooks, bD as ExternalHooksListItem, c2 as ExternalPluginHookFunctions, c1 as ExternalPluginHookFunctionsVariant, cB as FarmResolvedConfig, a2 as FarmUserConfig, b2 as FetchOptions, bA as HookKeys, bz as Hooks, bE as HooksList, I as ImportDefinition, h as ImportSpecifier, bF as InferHookHandler, bH as InferHookParameters, bG as InferHookReturnType, bI as InferHookThisType, cC as InferResolvedConfig, a3 as InferUserConfig, b1 as InitContextOptions, a4 as InitialUserConfig, a7 as InlineConfig, ac as LintInlineConfig, L as LogFn, aV as LogLevel, aX as MetaInfo, N as NamedImportDefinition, a8 as NewInlineConfig, O as OutputConfig, cq as OutputResolvedConfig, c7 as PLUGIN_NON_HOOK_FIELDS, b3 as ParseOptions, a5 as ParsedUserConfig, A as PartialPlugin, E as PartialPluginFactory, c6 as Plugin, c5 as PluginBuildPlugins, z as PluginConfig, y as PluginConfigObject, x as PluginConfigTuple, ba as PluginContext, P as PluginFactory, bY as PluginHook, c3 as PluginHookFunctions, bX as PluginHookObject, c4 as PluginHooks, c8 as PluginNonHookFields, a6 as PowerlinesCommand, aa as PrepareInlineConfig, F as ProjectType, cp as ResolvedAssetGlob, R as ResolvedBabelTransformPluginOptions, cr as ResolvedConfig, cm as ResolvedEntryTypeDefinition, aY as Resolver, cx as RolldownResolvedConfig, X as RolldownUserConfig, cw as RollupResolvedConfig, V as RollupUserConfig, cu as RspackResolvedConfig, T as RspackUserConfig, S as SUPPORTED_COMMANDS, b0 as SelectHooksOptions, b8 as SelectHooksResult, a_ as SourceFile, aZ as TransformResult, cz as TsdownResolvedConfig, a1 as TsdownUserConfig, cy as TsupResolvedConfig, a0 as TsupUserConfig, bZ as TypesResult, cA as UnbuildResolvedConfig, $ as UnbuildUserConfig, a$ as UnimportContext, b4 as UnresolvedContext, cs as ViteResolvedConfig, Y as ViteUserConfig, ct as WebpackResolvedConfig, Q as WebpackUserConfig, aW as WorkerProcess, W as WorkspaceConfig, bp as __ΩAPIContext, aU as __ΩAnyUserConfig, k as __ΩBabelPluginPass, cE as __ΩBabelResolvedConfig, p as __ΩBabelTransformInput, m as __ΩBabelTransformPlugin, r as __ΩBabelTransformPluginBuilder, q as __ΩBabelTransformPluginBuilderParams, l as __ΩBabelTransformPluginFilter, n as __ΩBabelTransformPluginOptions, aq as __ΩBabelUserConfig, at as __ΩBaseConfig, bK as __ΩBaseHookKeys, bJ as __ΩBaseHooks, bQ as __ΩBaseHooksList, bP as __ΩBaseHooksListItem, cd as __ΩBasePluginHookFunctions, aP as __ΩBuildInlineConfig, ce as __ΩBuildPlugin, bu as __ΩBuildPluginContext, aN as __ΩCleanInlineConfig, v as __ΩCommandType, w as __ΩCommands, av as __ΩCommonUserConfig, aT as __ΩConfigEnv, cc as __ΩConfigResult, bo as __ΩContext, s as __ΩDeclareBabelTransformPluginReturn, i as __ΩDefaultImportDefinition, ar as __ΩDeployConfig, aS as __ΩDeployInlineConfig, aR as __ΩDocsInlineConfig, cM as __ΩESBuildResolvedConfig, aC as __ΩESBuildUserConfig, au as __ΩEnvironmentConfig, bs as __ΩEnvironmentContext, bq as __ΩEnvironmentContextPlugin, cF as __ΩEnvironmentResolvedConfig, bM as __ΩExternalHookKeys, bL as __ΩExternalHooks, bR as __ΩExternalHooksListItem, cg as __ΩExternalPluginHookFunctions, cf as __ΩExternalPluginHookFunctionsVariant, cS as __ΩFarmResolvedConfig, aG as __ΩFarmUserConfig, bl as __ΩFetchOptions, bO as __ΩHookKeys, bN as __ΩHooks, bS as __ΩHooksList, j as __ΩImportDefinition, t as __ΩImportSpecifier, bT as __ΩInferHookHandler, bV as __ΩInferHookParameters, bU as __ΩInferHookReturnType, bW as __ΩInferHookThisType, cT as __ΩInferResolvedConfig, aH as __ΩInferUserConfig, bk as __ΩInitContextOptions, aI as __ΩInitialUserConfig, aL as __ΩInlineConfig, aQ as __ΩLintInlineConfig, ah as __ΩLogFn, bc as __ΩLogLevel, be as __ΩMetaInfo, _ as __ΩNamedImportDefinition, aM as __ΩNewInlineConfig, as as __ΩOutputConfig, cH as __ΩOutputResolvedConfig, bm as __ΩParseOptions, aJ as __ΩParsedUserConfig, an as __ΩPartialPlugin, ao as __ΩPartialPluginFactory, ck as __ΩPlugin, cj as __ΩPluginBuildPlugins, am as __ΩPluginConfig, al as __ΩPluginConfigObject, ak as __ΩPluginConfigTuple, bt as __ΩPluginContext, aj as __ΩPluginFactory, ca as __ΩPluginHook, ch as __ΩPluginHookFunctions, c9 as __ΩPluginHookObject, ci as __ΩPluginHooks, cl as __ΩPluginNonHookFields, aK as __ΩPowerlinesCommand, aO as __ΩPrepareInlineConfig, ap as __ΩProjectType, cG as __ΩResolvedAssetGlob, o as __ΩResolvedBabelTransformPluginOptions, cI as __ΩResolvedConfig, cD as __ΩResolvedEntryTypeDefinition, bf as __ΩResolver, cO as __ΩRolldownResolvedConfig, aA as __ΩRolldownUserConfig, cN as __ΩRollupResolvedConfig, az as __ΩRollupUserConfig, cL as __ΩRspackResolvedConfig, ay as __ΩRspackUserConfig, bj as __ΩSelectHooksOptions, br as __ΩSelectHooksResult, bh as __ΩSourceFile, bg as __ΩTransformResult, cQ as __ΩTsdownResolvedConfig, aF as __ΩTsdownUserConfig, cP as __ΩTsupResolvedConfig, aE as __ΩTsupUserConfig, cb as __ΩTypesResult, cR as __ΩUnbuildResolvedConfig, aD as __ΩUnbuildUserConfig, bi as __ΩUnimportContext, bn as __ΩUnresolvedContext, aw as __ΩUserConfig, cJ as __ΩViteResolvedConfig, aB as __ΩViteUserConfig, cK as __ΩWebpackResolvedConfig, ax as __ΩWebpackUserConfig, bd as __ΩWorkerProcess, ai as __ΩWorkspaceConfig } from './context-
|
|
2
|
+
import { ag as AnyUserConfig, U as UserConfig } from './context-BK7L6aHC.js';
|
|
3
|
+
export { b6 as APIContext, B as BabelPluginPass, cn as BabelResolvedConfig, d as BabelTransformInput, b as BabelTransformPlugin, f as BabelTransformPluginBuilder, e as BabelTransformPluginBuilderParams, a as BabelTransformPluginFilter, c as BabelTransformPluginOptions, G as BabelUserConfig, J as BaseConfig, bw as BaseHookKeys, bv as BaseHooks, bC as BaseHooksList, bB as BaseHooksListItem, b$ as BasePluginHookFunctions, ab as BuildInlineConfig, c0 as BuildPlugin, bb as BuildPluginContext, a9 as CleanInlineConfig, C as CommandType, u as Commands, M as CommonUserConfig, af as ConfigEnv, b_ as ConfigResult, b5 as Context, g as DeclareBabelTransformPluginReturn, D as DefaultImportDefinition, H as DeployConfig, ae as DeployInlineConfig, ad as DocsInlineConfig, cv as ESBuildResolvedConfig, Z as ESBuildUserConfig, K as EnvironmentConfig, b9 as EnvironmentContext, b7 as EnvironmentContextPlugin, co as EnvironmentResolvedConfig, by as ExternalHookKeys, bx as ExternalHooks, bD as ExternalHooksListItem, c2 as ExternalPluginHookFunctions, c1 as ExternalPluginHookFunctionsVariant, cB as FarmResolvedConfig, a2 as FarmUserConfig, b2 as FetchOptions, bA as HookKeys, bz as Hooks, bE as HooksList, I as ImportDefinition, h as ImportSpecifier, bF as InferHookHandler, bH as InferHookParameters, bG as InferHookReturnType, bI as InferHookThisType, cC as InferResolvedConfig, a3 as InferUserConfig, b1 as InitContextOptions, a4 as InitialUserConfig, a7 as InlineConfig, ac as LintInlineConfig, L as LogFn, aV as LogLevel, aX as MetaInfo, N as NamedImportDefinition, a8 as NewInlineConfig, O as OutputConfig, cq as OutputResolvedConfig, c7 as PLUGIN_NON_HOOK_FIELDS, b3 as ParseOptions, a5 as ParsedUserConfig, A as PartialPlugin, E as PartialPluginFactory, c6 as Plugin, c5 as PluginBuildPlugins, z as PluginConfig, y as PluginConfigObject, x as PluginConfigTuple, ba as PluginContext, P as PluginFactory, bY as PluginHook, c3 as PluginHookFunctions, bX as PluginHookObject, c4 as PluginHooks, c8 as PluginNonHookFields, a6 as PowerlinesCommand, aa as PrepareInlineConfig, F as ProjectType, cp as ResolvedAssetGlob, R as ResolvedBabelTransformPluginOptions, cr as ResolvedConfig, cm as ResolvedEntryTypeDefinition, aY as Resolver, cx as RolldownResolvedConfig, X as RolldownUserConfig, cw as RollupResolvedConfig, V as RollupUserConfig, cu as RspackResolvedConfig, T as RspackUserConfig, S as SUPPORTED_COMMANDS, b0 as SelectHooksOptions, b8 as SelectHooksResult, a_ as SourceFile, aZ as TransformResult, cz as TsdownResolvedConfig, a1 as TsdownUserConfig, cy as TsupResolvedConfig, a0 as TsupUserConfig, bZ as TypesResult, cA as UnbuildResolvedConfig, $ as UnbuildUserConfig, a$ as UnimportContext, b4 as UnresolvedContext, cs as ViteResolvedConfig, Y as ViteUserConfig, ct as WebpackResolvedConfig, Q as WebpackUserConfig, aW as WorkerProcess, W as WorkspaceConfig, bp as __ΩAPIContext, aU as __ΩAnyUserConfig, k as __ΩBabelPluginPass, cE as __ΩBabelResolvedConfig, p as __ΩBabelTransformInput, m as __ΩBabelTransformPlugin, r as __ΩBabelTransformPluginBuilder, q as __ΩBabelTransformPluginBuilderParams, l as __ΩBabelTransformPluginFilter, n as __ΩBabelTransformPluginOptions, aq as __ΩBabelUserConfig, at as __ΩBaseConfig, bK as __ΩBaseHookKeys, bJ as __ΩBaseHooks, bQ as __ΩBaseHooksList, bP as __ΩBaseHooksListItem, cd as __ΩBasePluginHookFunctions, aP as __ΩBuildInlineConfig, ce as __ΩBuildPlugin, bu as __ΩBuildPluginContext, aN as __ΩCleanInlineConfig, v as __ΩCommandType, w as __ΩCommands, av as __ΩCommonUserConfig, aT as __ΩConfigEnv, cc as __ΩConfigResult, bo as __ΩContext, s as __ΩDeclareBabelTransformPluginReturn, i as __ΩDefaultImportDefinition, ar as __ΩDeployConfig, aS as __ΩDeployInlineConfig, aR as __ΩDocsInlineConfig, cM as __ΩESBuildResolvedConfig, aC as __ΩESBuildUserConfig, au as __ΩEnvironmentConfig, bs as __ΩEnvironmentContext, bq as __ΩEnvironmentContextPlugin, cF as __ΩEnvironmentResolvedConfig, bM as __ΩExternalHookKeys, bL as __ΩExternalHooks, bR as __ΩExternalHooksListItem, cg as __ΩExternalPluginHookFunctions, cf as __ΩExternalPluginHookFunctionsVariant, cS as __ΩFarmResolvedConfig, aG as __ΩFarmUserConfig, bl as __ΩFetchOptions, bO as __ΩHookKeys, bN as __ΩHooks, bS as __ΩHooksList, j as __ΩImportDefinition, t as __ΩImportSpecifier, bT as __ΩInferHookHandler, bV as __ΩInferHookParameters, bU as __ΩInferHookReturnType, bW as __ΩInferHookThisType, cT as __ΩInferResolvedConfig, aH as __ΩInferUserConfig, bk as __ΩInitContextOptions, aI as __ΩInitialUserConfig, aL as __ΩInlineConfig, aQ as __ΩLintInlineConfig, ah as __ΩLogFn, bc as __ΩLogLevel, be as __ΩMetaInfo, _ as __ΩNamedImportDefinition, aM as __ΩNewInlineConfig, as as __ΩOutputConfig, cH as __ΩOutputResolvedConfig, bm as __ΩParseOptions, aJ as __ΩParsedUserConfig, an as __ΩPartialPlugin, ao as __ΩPartialPluginFactory, ck as __ΩPlugin, cj as __ΩPluginBuildPlugins, am as __ΩPluginConfig, al as __ΩPluginConfigObject, ak as __ΩPluginConfigTuple, bt as __ΩPluginContext, aj as __ΩPluginFactory, ca as __ΩPluginHook, ch as __ΩPluginHookFunctions, c9 as __ΩPluginHookObject, ci as __ΩPluginHooks, cl as __ΩPluginNonHookFields, aK as __ΩPowerlinesCommand, aO as __ΩPrepareInlineConfig, ap as __ΩProjectType, cG as __ΩResolvedAssetGlob, o as __ΩResolvedBabelTransformPluginOptions, cI as __ΩResolvedConfig, cD as __ΩResolvedEntryTypeDefinition, bf as __ΩResolver, cO as __ΩRolldownResolvedConfig, aA as __ΩRolldownUserConfig, cN as __ΩRollupResolvedConfig, az as __ΩRollupUserConfig, cL as __ΩRspackResolvedConfig, ay as __ΩRspackUserConfig, bj as __ΩSelectHooksOptions, br as __ΩSelectHooksResult, bh as __ΩSourceFile, bg as __ΩTransformResult, cQ as __ΩTsdownResolvedConfig, aF as __ΩTsdownUserConfig, cP as __ΩTsupResolvedConfig, aE as __ΩTsupUserConfig, cb as __ΩTypesResult, cR as __ΩUnbuildResolvedConfig, aD as __ΩUnbuildUserConfig, bi as __ΩUnimportContext, bn as __ΩUnresolvedContext, aw as __ΩUserConfig, cJ as __ΩViteResolvedConfig, aB as __ΩViteUserConfig, cK as __ΩWebpackResolvedConfig, ax as __ΩWebpackUserConfig, bd as __ΩWorkerProcess, ai as __ΩWorkspaceConfig } from './context-BK7L6aHC.js';
|
|
4
4
|
import * as $ from '@stryke/capnp';
|
|
5
|
-
export { A as API, _ as __ΩAPI } from './api-
|
|
5
|
+
export { A as API, _ as __ΩAPI } from './api-CRSOph63.js';
|
|
6
6
|
export { BuildConfig, BuildResolvedConfig, BuildVariant, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, InferUnpluginVariant, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupBuildOutputConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, UnpluginBuildVariant, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig, __ΩBuildConfig, __ΩBuildResolvedConfig, __ΩBuildVariant, __ΩESBuildBuildConfig, __ΩESBuildResolvedBuildConfig, __ΩFarmBuildConfig, __ΩFarmResolvedBuildConfig, __ΩInferUnpluginVariant, __ΩRolldownBuildConfig, __ΩRolldownResolvedBuildConfig, __ΩRollupBuildConfig, __ΩRollupBuildOutputConfig, __ΩRollupResolvedBuildConfig, __ΩRspackBuildConfig, __ΩRspackResolvedBuildConfig, __ΩTsdownBuildConfig, __ΩTsdownResolvedBuildConfig, __ΩTsupBuildConfig, __ΩTsupResolvedBuildConfig, __ΩUnbuildBuildConfig, __ΩUnbuildResolvedBuildConfig, __ΩUnpluginBuildVariant, __ΩViteBuildConfig, __ΩViteResolvedBuildConfig, __ΩWebpackBuildConfig, __ΩWebpackResolvedBuildConfig } from './types/build.js';
|
|
7
7
|
export { ResolveOptions, StorageAdapter, StoragePort, StoragePreset, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WriteData, WriteOptions, __VFS_PATCH__, __VFS_REVERT__, __ΩResolveOptions, __ΩStorageAdapter, __ΩStoragePort, __ΩStoragePreset, __ΩVirtualFile, __ΩVirtualFileData, __ΩVirtualFileExtension, __ΩVirtualFileMetadata, __ΩVirtualFileSystemInterface, __ΩWriteData, __ΩWriteOptions } from './types/fs.js';
|
|
8
8
|
export { DeepkitOptions, ParsedTypeScriptConfig, RawReflectionMode, ReflectionLevel, ReflectionMode, TSCompilerOptions, TSConfig, __ΩDeepkitOptions, __ΩParsedTypeScriptConfig, __ΩRawReflectionMode, __ΩReflectionLevel, __ΩReflectionMode, __ΩTSCompilerOptions, __ΩTSConfig } from './types/tsconfig.js';
|
package/dist/index.js
CHANGED
|
@@ -10,9 +10,9 @@ import './chunk-OYASPHNL.js';
|
|
|
10
10
|
export { LogLevel } from './chunk-D5WIJFI4.js';
|
|
11
11
|
export { __VFS_PATCH__, __VFS_REVERT__ } from './chunk-DJVETZWM.js';
|
|
12
12
|
import './chunk-HJW7OH6E.js';
|
|
13
|
-
import { PowerlinesAPI } from './chunk-
|
|
14
|
-
export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, PowerlinesAPI, _capnpFileId } from './chunk-
|
|
15
|
-
export { PLUGIN_NON_HOOK_FIELDS } from './chunk-
|
|
13
|
+
import { PowerlinesAPI } from './chunk-EMIKBRCT.js';
|
|
14
|
+
export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, PowerlinesAPI, _capnpFileId } from './chunk-EMIKBRCT.js';
|
|
15
|
+
export { PLUGIN_NON_HOOK_FIELDS } from './chunk-JGSCIWFQ.js';
|
|
16
16
|
export { SUPPORTED_COMMANDS } from './chunk-2MYPFASJ.js';
|
|
17
17
|
import { __name } from './chunk-7QVYU63E.js';
|
|
18
18
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromise } from '@stryke/types/base';
|
|
2
|
-
import { S as SelectHooksOptions, g as ResolvedConfig, A as APIContext, G as PrepareInlineConfig, N as NewInlineConfig, J as CleanInlineConfig, K as BuildInlineConfig, O as LintInlineConfig, Q as DocsInlineConfig, X as DeployInlineConfig, n as HookKeys, i as PluginContext, l as EnvironmentContext, t as InferHookParameters, u as InferHookReturnType } from './config-
|
|
2
|
+
import { S as SelectHooksOptions, g as ResolvedConfig, A as APIContext, G as PrepareInlineConfig, N as NewInlineConfig, J as CleanInlineConfig, K as BuildInlineConfig, O as LintInlineConfig, Q as DocsInlineConfig, X as DeployInlineConfig, n as HookKeys, i as PluginContext, l as EnvironmentContext, t as InferHookParameters, u as InferHookReturnType } from './config-C74fZ7Hm.cjs';
|
|
3
3
|
|
|
4
4
|
type CallHookOptions = SelectHooksOptions & (({
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromise } from '@stryke/types/base';
|
|
2
|
-
import { S as SelectHooksOptions, g as ResolvedConfig, A as APIContext, G as PrepareInlineConfig, N as NewInlineConfig, J as CleanInlineConfig, K as BuildInlineConfig, O as LintInlineConfig, Q as DocsInlineConfig, X as DeployInlineConfig, n as HookKeys, i as PluginContext, l as EnvironmentContext, t as InferHookParameters, u as InferHookReturnType } from './config-
|
|
2
|
+
import { S as SelectHooksOptions, g as ResolvedConfig, A as APIContext, G as PrepareInlineConfig, N as NewInlineConfig, J as CleanInlineConfig, K as BuildInlineConfig, O as LintInlineConfig, Q as DocsInlineConfig, X as DeployInlineConfig, n as HookKeys, i as PluginContext, l as EnvironmentContext, t as InferHookParameters, u as InferHookReturnType } from './config-Bkk5oOVc.js';
|
|
3
3
|
|
|
4
4
|
type CallHookOptions = SelectHooksOptions & (({
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuildOptions } from 'esbuild';
|
|
2
|
-
import { E as ESBuildResolvedBuildConfig, C as Context, R as ResolvedEntryTypeDefinition } from '../config-
|
|
2
|
+
import { E as ESBuildResolvedBuildConfig, C as Context, R as ResolvedEntryTypeDefinition } from '../config-C74fZ7Hm.cjs';
|
|
3
3
|
import '@storm-software/build-tools/types';
|
|
4
4
|
import '@storm-software/config-tools/types';
|
|
5
5
|
import '@storm-software/config/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuildOptions } from 'esbuild';
|
|
2
|
-
import { E as ESBuildResolvedBuildConfig, C as Context, R as ResolvedEntryTypeDefinition } from '../config-
|
|
2
|
+
import { E as ESBuildResolvedBuildConfig, C as Context, R as ResolvedEntryTypeDefinition } from '../config-Bkk5oOVc.js';
|
|
3
3
|
import '@storm-software/build-tools/types';
|
|
4
4
|
import '@storm-software/config-tools/types';
|
|
5
5
|
import '@storm-software/config/types';
|
|
@@ -8,7 +8,7 @@ export { DEFAULT_UNBUILD_CONFIG, extractUnbuildConfig, unbuildLoader } from './u
|
|
|
8
8
|
export { DEFAULT_VITE_CONFIG, extractViteConfig } from './vite.cjs';
|
|
9
9
|
export { extractWebpackConfig } from './webpack.cjs';
|
|
10
10
|
import 'esbuild';
|
|
11
|
-
import '../config-
|
|
11
|
+
import '../config-C74fZ7Hm.cjs';
|
|
12
12
|
import '@storm-software/build-tools/types';
|
|
13
13
|
import '@storm-software/config-tools/types';
|
|
14
14
|
import '@storm-software/config/types';
|
|
@@ -42,5 +42,5 @@ import '@stryke/types/array';
|
|
|
42
42
|
import '../tsconfig-Bz-CiFqD.cjs';
|
|
43
43
|
import '@stryke/types/tsconfig';
|
|
44
44
|
import 'typescript';
|
|
45
|
-
import '../internal-
|
|
46
|
-
import '../api-
|
|
45
|
+
import '../internal-Z9V60LMp.cjs';
|
|
46
|
+
import '../api-CHM8_t1f.cjs';
|
|
@@ -8,7 +8,7 @@ export { DEFAULT_UNBUILD_CONFIG, extractUnbuildConfig, unbuildLoader } from './u
|
|
|
8
8
|
export { DEFAULT_VITE_CONFIG, extractViteConfig } from './vite.js';
|
|
9
9
|
export { extractWebpackConfig } from './webpack.js';
|
|
10
10
|
import 'esbuild';
|
|
11
|
-
import '../config-
|
|
11
|
+
import '../config-Bkk5oOVc.js';
|
|
12
12
|
import '@storm-software/build-tools/types';
|
|
13
13
|
import '@storm-software/config-tools/types';
|
|
14
14
|
import '@storm-software/config/types';
|
|
@@ -42,5 +42,5 @@ import '@stryke/types/array';
|
|
|
42
42
|
import '../tsconfig-Bz-CiFqD.js';
|
|
43
43
|
import '@stryke/types/tsconfig';
|
|
44
44
|
import 'typescript';
|
|
45
|
-
import '../internal-
|
|
46
|
-
import '../api-
|
|
45
|
+
import '../internal-DA1f6c7h.js';
|
|
46
|
+
import '../api-zlk8r_Vv.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Context, b as RolldownResolvedBuildConfig } from '../config-
|
|
1
|
+
import { C as Context, b as RolldownResolvedBuildConfig } from '../config-C74fZ7Hm.cjs';
|
|
2
2
|
import '@storm-software/build-tools/types';
|
|
3
3
|
import '@storm-software/config-tools/types';
|
|
4
4
|
import '@storm-software/config/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Context, b as RolldownResolvedBuildConfig } from '../config-
|
|
1
|
+
import { C as Context, b as RolldownResolvedBuildConfig } from '../config-Bkk5oOVc.js';
|
|
2
2
|
import '@storm-software/build-tools/types';
|
|
3
3
|
import '@storm-software/config-tools/types';
|
|
4
4
|
import '@storm-software/config/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from 'rollup';
|
|
2
|
-
import { C as Context, c as RollupResolvedBuildConfig } from '../config-
|
|
2
|
+
import { C as Context, c as RollupResolvedBuildConfig } from '../config-C74fZ7Hm.cjs';
|
|
3
3
|
import '@storm-software/build-tools/types';
|
|
4
4
|
import '@storm-software/config-tools/types';
|
|
5
5
|
import '@storm-software/config/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from 'rollup';
|
|
2
|
-
import { C as Context, c as RollupResolvedBuildConfig } from '../config-
|
|
2
|
+
import { C as Context, c as RollupResolvedBuildConfig } from '../config-Bkk5oOVc.js';
|
|
3
3
|
import '@storm-software/build-tools/types';
|
|
4
4
|
import '@storm-software/config-tools/types';
|
|
5
5
|
import '@storm-software/config/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Configuration } from '@rspack/core';
|
|
2
|
-
import { C as Context } from '../config-
|
|
2
|
+
import { C as Context } from '../config-C74fZ7Hm.cjs';
|
|
3
3
|
import '@storm-software/build-tools/types';
|
|
4
4
|
import '@storm-software/config-tools/types';
|
|
5
5
|
import '@storm-software/config/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Configuration } from '@rspack/core';
|
|
2
|
-
import { C as Context } from '../config-
|
|
2
|
+
import { C as Context } from '../config-Bkk5oOVc.js';
|
|
3
3
|
import '@storm-software/build-tools/types';
|
|
4
4
|
import '@storm-software/config-tools/types';
|
|
5
5
|
import '@storm-software/config/types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Format } from '@storm-software/build-tools/types';
|
|
2
2
|
import { Format as Format$1 } from 'tsdown';
|
|
3
|
-
import { T as TsdownResolvedBuildConfig, C as Context } from '../config-
|
|
3
|
+
import { T as TsdownResolvedBuildConfig, C as Context } from '../config-C74fZ7Hm.cjs';
|
|
4
4
|
import '@storm-software/config-tools/types';
|
|
5
5
|
import '@storm-software/config/types';
|
|
6
6
|
import '@stryke/types/base';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Format } from '@storm-software/build-tools/types';
|
|
2
2
|
import { Format as Format$1 } from 'tsdown';
|
|
3
|
-
import { T as TsdownResolvedBuildConfig, C as Context } from '../config-
|
|
3
|
+
import { T as TsdownResolvedBuildConfig, C as Context } from '../config-Bkk5oOVc.js';
|
|
4
4
|
import '@storm-software/config-tools/types';
|
|
5
5
|
import '@storm-software/config/types';
|
|
6
6
|
import '@stryke/types/base';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Entry } from '@storm-software/build-tools/types';
|
|
2
|
-
import { d as TsupBuildConfig, C as Context, R as ResolvedEntryTypeDefinition, e as TsupResolvedBuildConfig } from '../config-
|
|
2
|
+
import { d as TsupBuildConfig, C as Context, R as ResolvedEntryTypeDefinition, e as TsupResolvedBuildConfig } from '../config-C74fZ7Hm.cjs';
|
|
3
3
|
import '@storm-software/config-tools/types';
|
|
4
4
|
import '@storm-software/config/types';
|
|
5
5
|
import '@stryke/types/base';
|
package/dist/lib/build/tsup.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Entry } from '@storm-software/build-tools/types';
|
|
2
|
-
import { d as TsupBuildConfig, C as Context, R as ResolvedEntryTypeDefinition, e as TsupResolvedBuildConfig } from '../config-
|
|
2
|
+
import { d as TsupBuildConfig, C as Context, R as ResolvedEntryTypeDefinition, e as TsupResolvedBuildConfig } from '../config-Bkk5oOVc.js';
|
|
3
3
|
import '@storm-software/config-tools/types';
|
|
4
4
|
import '@storm-software/config/types';
|
|
5
5
|
import '@stryke/types/base';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Loader } from '@storm-software/unbuild/types';
|
|
2
|
-
import { U as UnbuildBuildConfig, C as Context, f as UnbuildResolvedBuildConfig } from '../config-
|
|
3
|
-
import { U as UNSAFE_PluginContext } from '../internal-
|
|
2
|
+
import { U as UnbuildBuildConfig, C as Context, f as UnbuildResolvedBuildConfig } from '../config-C74fZ7Hm.cjs';
|
|
3
|
+
import { U as UNSAFE_PluginContext } from '../internal-Z9V60LMp.cjs';
|
|
4
4
|
import '@storm-software/build-tools/types';
|
|
5
5
|
import '@storm-software/config-tools/types';
|
|
6
6
|
import '@storm-software/config/types';
|
|
@@ -34,7 +34,7 @@ import '@stryke/types/array';
|
|
|
34
34
|
import '../tsconfig-Bz-CiFqD.cjs';
|
|
35
35
|
import '@stryke/types/tsconfig';
|
|
36
36
|
import 'typescript';
|
|
37
|
-
import '../api-
|
|
37
|
+
import '../api-CHM8_t1f.cjs';
|
|
38
38
|
|
|
39
39
|
declare const DEFAULT_UNBUILD_CONFIG: Partial<UnbuildBuildConfig>;
|
|
40
40
|
declare const unbuildLoader: (context: UNSAFE_PluginContext) => Loader;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Loader } from '@storm-software/unbuild/types';
|
|
2
|
-
import { U as UnbuildBuildConfig, C as Context, f as UnbuildResolvedBuildConfig } from '../config-
|
|
3
|
-
import { U as UNSAFE_PluginContext } from '../internal-
|
|
2
|
+
import { U as UnbuildBuildConfig, C as Context, f as UnbuildResolvedBuildConfig } from '../config-Bkk5oOVc.js';
|
|
3
|
+
import { U as UNSAFE_PluginContext } from '../internal-DA1f6c7h.js';
|
|
4
4
|
import '@storm-software/build-tools/types';
|
|
5
5
|
import '@storm-software/config-tools/types';
|
|
6
6
|
import '@storm-software/config/types';
|
|
@@ -34,7 +34,7 @@ import '@stryke/types/array';
|
|
|
34
34
|
import '../tsconfig-Bz-CiFqD.js';
|
|
35
35
|
import '@stryke/types/tsconfig';
|
|
36
36
|
import 'typescript';
|
|
37
|
-
import '../api-
|
|
37
|
+
import '../api-zlk8r_Vv.js';
|
|
38
38
|
|
|
39
39
|
declare const DEFAULT_UNBUILD_CONFIG: Partial<UnbuildBuildConfig>;
|
|
40
40
|
declare const unbuildLoader: (context: UNSAFE_PluginContext) => Loader;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as ViteResolvedBuildConfig, C as Context } from '../config-
|
|
1
|
+
import { V as ViteResolvedBuildConfig, C as Context } from '../config-C74fZ7Hm.cjs';
|
|
2
2
|
import '@storm-software/build-tools/types';
|
|
3
3
|
import '@storm-software/config-tools/types';
|
|
4
4
|
import '@storm-software/config/types';
|
package/dist/lib/build/vite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as ViteResolvedBuildConfig, C as Context } from '../config-
|
|
1
|
+
import { V as ViteResolvedBuildConfig, C as Context } from '../config-Bkk5oOVc.js';
|
|
2
2
|
import '@storm-software/build-tools/types';
|
|
3
3
|
import '@storm-software/config-tools/types';
|
|
4
4
|
import '@storm-software/config/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
-
import { C as Context } from '../config-
|
|
2
|
+
import { C as Context } from '../config-C74fZ7Hm.cjs';
|
|
3
3
|
import '@storm-software/build-tools/types';
|
|
4
4
|
import '@storm-software/config-tools/types';
|
|
5
5
|
import '@storm-software/config/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
-
import { C as Context } from '../config-
|
|
2
|
+
import { C as Context } from '../config-Bkk5oOVc.js';
|
|
3
3
|
import '@storm-software/build-tools/types';
|
|
4
4
|
import '@storm-software/config-tools/types';
|
|
5
5
|
import '@storm-software/config/types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PowerlinesEnvironmentContext } from './chunk-
|
|
1
|
+
import { PowerlinesEnvironmentContext } from './chunk-FR2ZVFLT.js';
|
|
2
2
|
import { PowerlinesContext } from './chunk-VN2OA25X.js';
|
|
3
3
|
import { loadWorkspaceConfig } from './chunk-Q25ZPXA7.js';
|
|
4
4
|
import { __name } from './chunk-7QVYU63E.js';
|
|
@@ -254,5 +254,5 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
export { PowerlinesAPIContext };
|
|
257
|
-
//# sourceMappingURL=chunk-
|
|
258
|
-
//# sourceMappingURL=chunk-
|
|
257
|
+
//# sourceMappingURL=chunk-72NPPPRF.js.map
|
|
258
|
+
//# sourceMappingURL=chunk-72NPPPRF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/helpers/environment.ts","../../src/lib/contexts/api-context.ts"],"names":["DEFAULT_ENVIRONMENT","GLOBAL_ENVIRONMENT","createEnvironment","name","userConfig","defu","environments","title","titleCase","ssr","mainFields","build","platform","extensions","consumer","preview","port","open","strictPort","host","allowedHosts","cors","headers","undefined","createDefaultEnvironment","PowerlinesAPIContext","PowerlinesContext","from","workspaceRoot","config","context","loadWorkspaceConfig","root","withUserConfig","powerlinesPath","resolvePackage","Error","$$internal","value","environment","Object","values","log","createLog","plugins","workspaceConfig","init","Promise","all","toArray","keys","length","map","env","in","PowerlinesEnvironmentContext","fromConfig","isSetObject","inlineConfig","withInlineConfig","plugin","addPlugin","options","isHighPriority","push","getEnvironment","LogLevelLabel","DEBUG","chalk","bold","cyanBright","WARN","getEnvironmentSafe","toEnvironment"],"mappings":";;;;;;;;;;;;AAuBO,IAAMA,mBAAAA,GAAsB,aAAA;AAC5B,IAAMC,kBAAAA,GAAqB,YAAA;AAE3B,SAASC,iBAAAA,CACdC,MACAC,UAAAA,EAA4C;AAE5C,EAAA,OAAOC,KACLD,UAAAA,CAAWE,YAAAA,GAAeH,IAAAA,CAAAA,IAAS,EAAC,EACpC;AACEA,IAAAA,IAAAA;AACAI,IAAAA,KAAAA,EAAOH,UAAAA,CAAWG,KAAAA,IAASC,SAAAA,CAAUJ,UAAAA,CAAWD,IAAI,CAAA;IACpDM,GAAAA,EAAK,KAAA;IACLC,UAAAA,EACEN,UAAAA,CAAWO,KAAAA,EAAOC,QAAAA,KAAa,SAAA,GAC3B;AAAC,MAAA,SAAA;AAAW,MAAA,QAAA;AAAU,MAAA,aAAA;AAAe,MAAA;AACrC,KAAA,GAAA;AAAC,MAAA,QAAA;AAAU,MAAA,aAAA;AAAe,MAAA;;IAChCC,UAAAA,EAAY;AAAC,MAAA,MAAA;AAAQ,MAAA,KAAA;AAAO,MAAA,MAAA;AAAQ,MAAA,KAAA;AAAO,MAAA,MAAA;AAAQ,MAAA,MAAA;AAAQ,MAAA;;AAC3DC,IAAAA,QAAAA,EAAUV,UAAAA,CAAWO,KAAAA,EAAOC,QAAAA,KAAa,SAAA,GAAY,QAAA,GAAW,QAAA;IAChEG,OAAAA,EACEX,UAAAA,CAAWO,KAAAA,EAAOC,QAAAA,KAAa,SAAA,GAC3B;MACEI,IAAAA,EAAM,IAAA;MACNC,IAAAA,EAAM,IAAA;MACNC,UAAAA,EAAY,KAAA;;MAEZC,IAAAA,EAAM,WAAA;MACNC,YAAAA,EAAc;AAAC,QAAA;;MACfC,IAAAA,EAAM,IAAA;AACNC,MAAAA,OAAAA,EAAS;KACX,GACA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c,MAAM,KAAKe,EAAAA,CACvBpD,iBAAAA,CAAkBD,oBAAoB,IAAA,CAAK4B,MAAAA,CAAOzB,UAAU,CAAA,CAAA;AAG9D,MAAA,IAAA,CAAKsC,GAAAA,CACHwB,aAAAA,CAAcC,KAAAA,EACd,CAAA,aAAA,EAAgB3B,MAAAA,CAAOU,KAAK,IAAA,CAAK5C,YAAY,CAAA,CAAE6C,MAAM,CAAA,2CAAA,CAA6C,CAAA;IAEtG,CAAA,MAAO;AACLZ,MAAAA,WAAAA,GAAc,MAAM,KAAK0B,cAAAA,EAAc;AACzC,IAAA;AAEA,IAAA,OAAO1B,WAAAA;AACT,EAAA;AACF","file":"chunk-OANCMG6M.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { APIContext, Context } from \"../../types/context\";\nimport { EnvironmentResolvedConfig } from \"../../types/resolved\";\n\nexport const DEFAULT_ENVIRONMENT = \"__DEFAULT__\" as const;\nexport const GLOBAL_ENVIRONMENT = \"__GLOBAL__\" as const;\n\nexport function createEnvironment<TContext extends Context = Context>(\n name: string,\n userConfig: TContext[\"config\"][\"userConfig\"]\n): EnvironmentResolvedConfig {\n return defu(\n userConfig.environments?.[name] ?? {},\n {\n name,\n title: userConfig.title || titleCase(userConfig.name),\n ssr: false,\n mainFields:\n userConfig.build?.platform === \"browser\"\n ? [\"browser\", \"module\", \"jsnext:main\", \"jsnext\"]\n : [\"module\", \"jsnext:main\", \"jsnext\"],\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"],\n consumer: userConfig.build?.platform === \"browser\" ? \"client\" : \"server\",\n preview:\n userConfig.build?.platform === \"browser\"\n ? {\n port: 5173,\n open: true,\n strictPort: false,\n // https: false,\n host: \"localhost\",\n allowedHosts: [\".\"],\n cors: true,\n headers: {}\n }\n : undefined\n },\n userConfig\n ) as EnvironmentResolvedConfig;\n}\n\nexport function createDefaultEnvironment<\n TContext extends APIContext = APIContext\n>(userConfig: TContext[\"config\"][\"userConfig\"]): EnvironmentResolvedConfig {\n return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport chalk from \"chalk\";\nimport {\n createDefaultEnvironment,\n createEnvironment,\n GLOBAL_ENVIRONMENT\n} from \"../../internal/helpers/environment\";\nimport {\n InitialUserConfig,\n InlineConfig,\n LogFn,\n UserConfig,\n WorkspaceConfig\n} from \"../../types/config\";\nimport {\n APIContext,\n EnvironmentContext,\n InitContextOptions,\n PluginContext\n} from \"../../types/context\";\nimport {\n UNSAFE_ContextInternal,\n UNSAFE_EnvironmentContext\n} from \"../../types/internal\";\nimport { Plugin } from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { loadWorkspaceConfig } from \"../config-file\";\nimport { PowerlinesContext } from \"./context\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\nexport class PowerlinesAPIContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n extends PowerlinesContext<TResolvedConfig>\n implements APIContext<TResolvedConfig>\n{\n #environments: Record<string, UNSAFE_EnvironmentContext<TResolvedConfig>> =\n {};\n\n #plugins: Plugin<PluginContext<TResolvedConfig>>[] = [];\n\n #log!: LogFn;\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param config - The user configuration options.\n * @returns A promise that resolves to the new context.\n */\n public static override async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<APIContext<TResolvedConfig>> {\n const context = new PowerlinesAPIContext<TResolvedConfig>(\n await loadWorkspaceConfig(workspaceRoot, config.root)\n );\n await context.withUserConfig(config);\n\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n\n context.powerlinesPath = powerlinesPath;\n\n return context;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override get $$internal(): UNSAFE_ContextInternal<TResolvedConfig> {\n return super.$$internal;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override set $$internal(\n value: UNSAFE_ContextInternal<TResolvedConfig>\n ) {\n super.$$internal = value;\n for (const environment of Object.values(this.environments)) {\n environment.$$internal = super.$$internal;\n }\n }\n\n /**\n * A record of all environments by name\n */\n public get environments(): Record<\n string,\n UNSAFE_EnvironmentContext<TResolvedConfig>\n > {\n return this.#environments;\n }\n\n public override get log(): LogFn {\n if (!this.#log) {\n this.#log = this.createLog(\"engine\");\n }\n\n return this.#log;\n }\n\n public get plugins(): Array<Plugin<PluginContext<TResolvedConfig>>> {\n return this.#plugins;\n }\n\n protected constructor(workspaceConfig: WorkspaceConfig) {\n super(workspaceConfig);\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @param config - The partial user configuration to use for initialization.\n */\n protected override async init(\n config: Partial<TResolvedConfig[\"userConfig\"]> = {}\n ) {\n await super.init(config);\n\n await Promise.all(\n toArray(\n this.config.userConfig.environments &&\n Object.keys(this.config.userConfig.environments).length > 0\n ? Object.keys(this.config.userConfig.environments).map(name =>\n createEnvironment(name, this.config.userConfig)\n )\n : createDefaultEnvironment(this.config.userConfig)\n ).map(async env => {\n this.#environments[env.name] = await this.in(env);\n })\n );\n }\n\n /**\n * A function to copy the context and update the fields for a specific environment\n *\n * @param environment - The environment configuration to use.\n * @returns A new context instance with the updated environment.\n */\n public async in(\n environment: EnvironmentResolvedConfig\n ): Promise<UNSAFE_EnvironmentContext<TResolvedConfig>> {\n let context: UNSAFE_EnvironmentContext<TResolvedConfig>;\n if (this.environments[environment.name]) {\n context = this.environments[environment.name] as any;\n } else {\n context = (await PowerlinesEnvironmentContext.fromConfig(\n this.workspaceConfig,\n this.config\n )) as any;\n }\n\n if (isSetObject(this.config.inlineConfig)) {\n await context.withInlineConfig(this.config.inlineConfig);\n }\n\n context.environment = environment;\n context.plugins = [];\n\n for (const plugin of this.plugins) {\n await context.addPlugin(plugin);\n }\n\n return context;\n }\n\n /**\n * Update the context using a new user configuration options\n *\n * @param userConfig - The new user configuration options.\n */\n public override async withUserConfig(\n userConfig: InitialUserConfig<TResolvedConfig[\"userConfig\"]>,\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withUserConfig(userConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withUserConfig(\n userConfig as UserConfig,\n options\n );\n })\n );\n }\n\n /**\n * Update the context using a new inline configuration options\n *\n * @param inlineConfig - The new inline configuration options.\n */\n public override async withInlineConfig(\n inlineConfig: TResolvedConfig[\"inlineConfig\"],\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withInlineConfig(inlineConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withInlineConfig(\n inlineConfig as InlineConfig,\n options\n );\n })\n );\n }\n\n /**\n * Add a plugin to the API context and all environments\n *\n * @param plugin - The plugin to add.\n */\n public async addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>) {\n this.plugins.push(plugin);\n\n await Promise.all(\n Object.keys(this.environments).map(async name => {\n await this.environments[name]!.addPlugin(plugin);\n })\n );\n }\n\n /**\n * Get an environment by name, or the default environment if no name is provided\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context.\n */\n public async getEnvironment(name?: string) {\n let environment: EnvironmentContext<TResolvedConfig> | undefined;\n if (name) {\n environment = this.environments[name];\n }\n\n if (Object.keys(this.environments).length === 1) {\n environment = this.environments[Object.keys(this.environments)[0]!];\n\n this.log(\n LogLevelLabel.DEBUG,\n `Applying the only configured environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n if (!environment) {\n if (name) {\n throw new Error(`Environment \"${name}\" not found.`);\n }\n\n environment = await this.in(\n createDefaultEnvironment(this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.WARN,\n `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n return environment;\n }\n\n /**\n * A safe version of `getEnvironment` that returns `undefined` if the environment is not found\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context or `undefined` if not found.\n */\n public async getEnvironmentSafe(\n name?: string\n ): Promise<EnvironmentContext<TResolvedConfig> | undefined> {\n try {\n return await this.getEnvironment(name);\n } catch {\n return undefined;\n }\n }\n\n /**\n * A function to merge all configured environments into a single context.\n *\n * @remarks\n * If only one environment is configured, that environment will be returned directly.\n *\n * @returns A promise that resolves to a merged/global environment context.\n */\n public async toEnvironment(): Promise<EnvironmentContext<TResolvedConfig>> {\n let environment: EnvironmentContext<TResolvedConfig>;\n if (Object.keys(this.environments).length > 1) {\n environment = await this.in(\n createEnvironment(GLOBAL_ENVIRONMENT, this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.DEBUG,\n `Combined all ${Object.keys(this.environments).length} environments into a single global context.`\n );\n } else {\n environment = await this.getEnvironment();\n }\n\n return environment;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/internal/helpers/environment.ts","../../src/lib/contexts/api-context.ts"],"names":["DEFAULT_ENVIRONMENT","GLOBAL_ENVIRONMENT","createEnvironment","name","userConfig","defu","environments","title","titleCase","ssr","mainFields","build","platform","extensions","consumer","preview","port","open","strictPort","host","allowedHosts","cors","headers","undefined","createDefaultEnvironment","PowerlinesAPIContext","PowerlinesContext","from","workspaceRoot","config","context","loadWorkspaceConfig","root","withUserConfig","powerlinesPath","resolvePackage","Error","$$internal","value","environment","Object","values","log","createLog","plugins","workspaceConfig","init","Promise","all","toArray","keys","length","map","env","in","PowerlinesEnvironmentContext","fromConfig","isSetObject","inlineConfig","withInlineConfig","plugin","addPlugin","options","isHighPriority","push","getEnvironment","LogLevelLabel","DEBUG","chalk","bold","cyanBright","WARN","getEnvironmentSafe","toEnvironment"],"mappings":";;;;;;;;;;;;AAuBO,IAAMA,mBAAAA,GAAsB,aAAA;AAC5B,IAAMC,kBAAAA,GAAqB,YAAA;AAE3B,SAASC,iBAAAA,CACdC,MACAC,UAAAA,EAA4C;AAE5C,EAAA,OAAOC,KACLD,UAAAA,CAAWE,YAAAA,GAAeH,IAAAA,CAAAA,IAAS,EAAC,EACpC;AACEA,IAAAA,IAAAA;AACAI,IAAAA,KAAAA,EAAOH,UAAAA,CAAWG,KAAAA,IAASC,SAAAA,CAAUJ,UAAAA,CAAWD,IAAI,CAAA;IACpDM,GAAAA,EAAK,KA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A,CAAKe,EAAAA,CACvB9B,yBAAyB,IAAA,CAAKK,MAAAA,CAAOzB,UAAU,CAAA,CAAA;AAGjD,MAAA,IAAA,CAAKsC,GAAAA,CACHwB,aAAAA,CAAcK,IAAAA,EACd,CAAA,mGAAA,EAAsGH,KAAAA,CAAMC,IAAAA,CAAKC,UAAAA,CAC/G/B,WAAAA,EAAaA,WAAAA,CAAYpC,IAAAA,CAAAA,CAAAA,CACxB,CAAA;AAEP,IAAA;AAEA,IAAA,OAAOoC,WAAAA;AACT,EAAA;;;;;;;AAQA,EAAA,MAAaiC,mBACXrE,IAAAA,EAC0D;AAC1D,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,IAAA,CAAK8D,cAAAA,CAAe9D,IAAAA,CAAAA;IACnC,CAAA,CAAA,MAAQ;AACN,MAAA,OAAOoB,MAAAA;AACT,IAAA;AACF,EAAA;;;;;;;;;AAUA,EAAA,MAAakD,aAAAA,GAA8D;AACzE,IAAA,IAAIlC,WAAAA;AACJ,IAAA,IAAIC,OAAOU,IAAAA,CAAK,IAAA,CAAK5C,YAAY,CAAA,CAAE6C,SAAS,CAAA,EAAG;AAC7CZ,MAAAA,WAAAA,GAAc,MAAM,KAAKe,EAAAA,CACvBpD,iBAAAA,CAAkBD,oBAAoB,IAAA,CAAK4B,MAAAA,CAAOzB,UAAU,CAAA,CAAA;AAG9D,MAAA,IAAA,CAAKsC,GAAAA,CACHwB,aAAAA,CAAcC,KAAAA,EACd,CAAA,aAAA,EAAgB3B,MAAAA,CAAOU,KAAK,IAAA,CAAK5C,YAAY,CAAA,CAAE6C,MAAM,CAAA,2CAAA,CAA6C,CAAA;IAEtG,CAAA,MAAO;AACLZ,MAAAA,WAAAA,GAAc,MAAM,KAAK0B,cAAAA,EAAc;AACzC,IAAA;AAEA,IAAA,OAAO1B,WAAAA;AACT,EAAA;AACF","file":"chunk-72NPPPRF.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { APIContext, Context } from \"../../types/context\";\nimport { EnvironmentResolvedConfig } from \"../../types/resolved\";\n\nexport const DEFAULT_ENVIRONMENT = \"__DEFAULT__\" as const;\nexport const GLOBAL_ENVIRONMENT = \"__GLOBAL__\" as const;\n\nexport function createEnvironment<TContext extends Context = Context>(\n name: string,\n userConfig: TContext[\"config\"][\"userConfig\"]\n): EnvironmentResolvedConfig {\n return defu(\n userConfig.environments?.[name] ?? {},\n {\n name,\n title: userConfig.title || titleCase(userConfig.name),\n ssr: false,\n mainFields:\n userConfig.build?.platform === \"browser\"\n ? [\"browser\", \"module\", \"jsnext:main\", \"jsnext\"]\n : [\"module\", \"jsnext:main\", \"jsnext\"],\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"],\n consumer: userConfig.build?.platform === \"browser\" ? \"client\" : \"server\",\n preview:\n userConfig.build?.platform === \"browser\"\n ? {\n port: 5173,\n open: true,\n strictPort: false,\n // https: false,\n host: \"localhost\",\n allowedHosts: [\".\"],\n cors: true,\n headers: {}\n }\n : undefined\n },\n userConfig\n ) as EnvironmentResolvedConfig;\n}\n\nexport function createDefaultEnvironment<\n TContext extends APIContext = APIContext\n>(userConfig: TContext[\"config\"][\"userConfig\"]): EnvironmentResolvedConfig {\n return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport chalk from \"chalk\";\nimport {\n createDefaultEnvironment,\n createEnvironment,\n GLOBAL_ENVIRONMENT\n} from \"../../internal/helpers/environment\";\nimport {\n InitialUserConfig,\n InlineConfig,\n LogFn,\n UserConfig,\n WorkspaceConfig\n} from \"../../types/config\";\nimport {\n APIContext,\n EnvironmentContext,\n InitContextOptions,\n PluginContext\n} from \"../../types/context\";\nimport {\n UNSAFE_ContextInternal,\n UNSAFE_EnvironmentContext\n} from \"../../types/internal\";\nimport { Plugin } from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { loadWorkspaceConfig } from \"../config-file\";\nimport { PowerlinesContext } from \"./context\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\nexport class PowerlinesAPIContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n extends PowerlinesContext<TResolvedConfig>\n implements APIContext<TResolvedConfig>\n{\n #environments: Record<string, UNSAFE_EnvironmentContext<TResolvedConfig>> =\n {};\n\n #plugins: Plugin<PluginContext<TResolvedConfig>>[] = [];\n\n #log!: LogFn;\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param config - The user configuration options.\n * @returns A promise that resolves to the new context.\n */\n public static override async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<APIContext<TResolvedConfig>> {\n const context = new PowerlinesAPIContext<TResolvedConfig>(\n await loadWorkspaceConfig(workspaceRoot, config.root)\n );\n await context.withUserConfig(config);\n\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n\n context.powerlinesPath = powerlinesPath;\n\n return context;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override get $$internal(): UNSAFE_ContextInternal<TResolvedConfig> {\n return super.$$internal;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override set $$internal(\n value: UNSAFE_ContextInternal<TResolvedConfig>\n ) {\n super.$$internal = value;\n for (const environment of Object.values(this.environments)) {\n environment.$$internal = super.$$internal;\n }\n }\n\n /**\n * A record of all environments by name\n */\n public get environments(): Record<\n string,\n UNSAFE_EnvironmentContext<TResolvedConfig>\n > {\n return this.#environments;\n }\n\n public override get log(): LogFn {\n if (!this.#log) {\n this.#log = this.createLog(\"engine\");\n }\n\n return this.#log;\n }\n\n public get plugins(): Array<Plugin<PluginContext<TResolvedConfig>>> {\n return this.#plugins;\n }\n\n protected constructor(workspaceConfig: WorkspaceConfig) {\n super(workspaceConfig);\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @param config - The partial user configuration to use for initialization.\n */\n protected override async init(\n config: Partial<TResolvedConfig[\"userConfig\"]> = {}\n ) {\n await super.init(config);\n\n await Promise.all(\n toArray(\n this.config.userConfig.environments &&\n Object.keys(this.config.userConfig.environments).length > 0\n ? Object.keys(this.config.userConfig.environments).map(name =>\n createEnvironment(name, this.config.userConfig)\n )\n : createDefaultEnvironment(this.config.userConfig)\n ).map(async env => {\n this.#environments[env.name] = await this.in(env);\n })\n );\n }\n\n /**\n * A function to copy the context and update the fields for a specific environment\n *\n * @param environment - The environment configuration to use.\n * @returns A new context instance with the updated environment.\n */\n public async in(\n environment: EnvironmentResolvedConfig\n ): Promise<UNSAFE_EnvironmentContext<TResolvedConfig>> {\n let context: UNSAFE_EnvironmentContext<TResolvedConfig>;\n if (this.environments[environment.name]) {\n context = this.environments[environment.name] as any;\n } else {\n context = (await PowerlinesEnvironmentContext.fromConfig(\n this.workspaceConfig,\n this.config\n )) as any;\n }\n\n if (isSetObject(this.config.inlineConfig)) {\n await context.withInlineConfig(this.config.inlineConfig);\n }\n\n context.environment = environment;\n context.plugins = [];\n\n for (const plugin of this.plugins) {\n await context.addPlugin(plugin);\n }\n\n return context;\n }\n\n /**\n * Update the context using a new user configuration options\n *\n * @param userConfig - The new user configuration options.\n */\n public override async withUserConfig(\n userConfig: InitialUserConfig<TResolvedConfig[\"userConfig\"]>,\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withUserConfig(userConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withUserConfig(\n userConfig as UserConfig,\n options\n );\n })\n );\n }\n\n /**\n * Update the context using a new inline configuration options\n *\n * @param inlineConfig - The new inline configuration options.\n */\n public override async withInlineConfig(\n inlineConfig: TResolvedConfig[\"inlineConfig\"],\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withInlineConfig(inlineConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withInlineConfig(\n inlineConfig as InlineConfig,\n options\n );\n })\n );\n }\n\n /**\n * Add a plugin to the API context and all environments\n *\n * @param plugin - The plugin to add.\n */\n public async addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>) {\n this.plugins.push(plugin);\n\n await Promise.all(\n Object.keys(this.environments).map(async name => {\n await this.environments[name]!.addPlugin(plugin);\n })\n );\n }\n\n /**\n * Get an environment by name, or the default environment if no name is provided\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context.\n */\n public async getEnvironment(name?: string) {\n let environment: EnvironmentContext<TResolvedConfig> | undefined;\n if (name) {\n environment = this.environments[name];\n }\n\n if (Object.keys(this.environments).length === 1) {\n environment = this.environments[Object.keys(this.environments)[0]!];\n\n this.log(\n LogLevelLabel.DEBUG,\n `Applying the only configured environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n if (!environment) {\n if (name) {\n throw new Error(`Environment \"${name}\" not found.`);\n }\n\n environment = await this.in(\n createDefaultEnvironment(this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.WARN,\n `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n return environment;\n }\n\n /**\n * A safe version of `getEnvironment` that returns `undefined` if the environment is not found\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context or `undefined` if not found.\n */\n public async getEnvironmentSafe(\n name?: string\n ): Promise<EnvironmentContext<TResolvedConfig> | undefined> {\n try {\n return await this.getEnvironment(name);\n } catch {\n return undefined;\n }\n }\n\n /**\n * A function to merge all configured environments into a single context.\n *\n * @remarks\n * If only one environment is configured, that environment will be returned directly.\n *\n * @returns A promise that resolves to a merged/global environment context.\n */\n public async toEnvironment(): Promise<EnvironmentContext<TResolvedConfig>> {\n let environment: EnvironmentContext<TResolvedConfig>;\n if (Object.keys(this.environments).length > 1) {\n environment = await this.in(\n createEnvironment(GLOBAL_ENVIRONMENT, this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.DEBUG,\n `Combined all ${Object.keys(this.environments).length} environments into a single global context.`\n );\n } else {\n environment = await this.getEnvironment();\n }\n\n return environment;\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUHQU5ASL_cjs = require('./chunk-UHQU5ASL.cjs');
|
|
4
4
|
var chunkCLLQO726_cjs = require('./chunk-CLLQO726.cjs');
|
|
5
5
|
var chunk2JR645O3_cjs = require('./chunk-2JR645O3.cjs');
|
|
6
6
|
var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
|
|
@@ -154,7 +154,7 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends chunkCLLQO726_cjs
|
|
|
154
154
|
if (this.environments[environment.name]) {
|
|
155
155
|
context = this.environments[environment.name];
|
|
156
156
|
} else {
|
|
157
|
-
context = await
|
|
157
|
+
context = await chunkUHQU5ASL_cjs.PowerlinesEnvironmentContext.fromConfig(this.workspaceConfig, this.config);
|
|
158
158
|
}
|
|
159
159
|
if (isSetObject.isSetObject(this.config.inlineConfig)) {
|
|
160
160
|
await context.withInlineConfig(this.config.inlineConfig);
|
|
@@ -261,5 +261,5 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends chunkCLLQO726_cjs
|
|
|
261
261
|
};
|
|
262
262
|
|
|
263
263
|
exports.PowerlinesAPIContext = PowerlinesAPIContext;
|
|
264
|
-
//# sourceMappingURL=chunk-
|
|
265
|
-
//# sourceMappingURL=chunk-
|
|
264
|
+
//# sourceMappingURL=chunk-ACVINY5F.cjs.map
|
|
265
|
+
//# sourceMappingURL=chunk-ACVINY5F.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/helpers/environment.ts","../../src/lib/contexts/api-context.ts"],"names":["DEFAULT_ENVIRONMENT","GLOBAL_ENVIRONMENT","createEnvironment","name","userConfig","defu","environments","title","titleCase","ssr","mainFields","build","platform","extensions","consumer","preview","port","open","strictPort","host","allowedHosts","cors","headers","undefined","createDefaultEnvironment","PowerlinesAPIContext","PowerlinesContext","from","workspaceRoot","config","context","loadWorkspaceConfig","root","withUserConfig","powerlinesPath","resolvePackage","Error","$$internal","value","environment","Object","values","log","createLog","plugins","workspaceConfig","init","Promise","all","toArray","keys","length","map","env","in","PowerlinesEnvironmentContext","fromConfig","isSetObject","inlineConfig","withInlineConfig","plugin","addPlugin","options","isHighPriority","push","getEnvironment","LogLevelLabel","DEBUG","chalk","bold","cyanBright","WARN","getEnvironmentSafe","toEnvironment"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBO,IAAMA,mBAAAA,GAAsB,aAAA;AAC5B,IAAMC,kBAAAA,GAAqB,YAAA;AAE3B,SAASC,iBAAAA,CACdC,MACAC,UAAAA,EAA4C;AAE5C,EAAA,OAAOC,sBACLD,UAAAA,CAAWE,YAAAA,GAAeH,IAAAA,CAAAA,IAAS,EAAC,EACpC;AACEA,IAAAA,IAAAA;AACAI,IAAAA,KAAAA,EAAOH,UAAAA,CAAWG,KAAAA,IAASC,mBAAAA,CAAUJ,UAAAA,CAAWD,IAAI,CAAA;IACpDM,GAAAA,EAAK,KAAA;IACLC,UAAAA,EACEN,UAAAA,CAAWO,KAAAA,EAAOC,QAAAA,KAAa,SAAA,GAC3B;AAAC,MAAA,SAAA;AAAW,MAAA,QAAA;AAAU,MAAA,aAAA;AAAe,MAAA;AACrC,KAAA,GAAA;AAAC,MAAA,QAAA;AAAU,MAAA,aAAA;AAAe,MAAA;;IAChCC,UAAAA,EAAY;AAAC,MAAA,MAAA;AAAQ,MAAA,KAAA;AAAO,MAAA,MAAA;AAAQ,MAAA,KAAA;AAAO,MAAA,MAAA;AAAQ,MAAA,MAAA;AAAQ,MAAA;;AAC3DC,IAAAA,QAAAA,EAAUV,UAAAA,CAAWO,KAAAA,EAAOC,QAAAA,KAAa,SAAA,GAAY,QAAA,GAAW,QAAA;IAChEG,OAAAA,EACEX,UAAAA,CAAWO,KAAAA,EAAOC,QAAAA,KAAa,SAAA,GAC3B;MACEI,IAAAA,EAAM,IAAA;MACNC,IAAAA,EAAM,IAAA;MACNC,UAAAA,EAAY,KAAA;;MAEZC,IAAAA,EAAM,WAAA;MACNC,YAAAA,EAAc;AAAC,QAAA;;MACfC,IAAAA,EAAM,IAAA;AACNC,MAAAA,OAAAA,EAAS;KACX,GACAC;AACR,GAAA,EACAnB,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AKe,EAAAA,CACvBpD,iBAAAA,CAAkBD,oBAAoB,IAAA,CAAK4B,MAAAA,CAAOzB,UAAU,CAAA,CAAA;AAG9D,MAAA,IAAA,CAAKsC,GAAAA,CACHwB,mBAAAA,CAAcC,KAAAA,EACd,CAAA,aAAA,EAAgB3B,MAAAA,CAAOU,KAAK,IAAA,CAAK5C,YAAY,CAAA,CAAE6C,MAAM,CAAA,2CAAA,CAA6C,CAAA;IAEtG,CAAA,MAAO;AACLZ,MAAAA,WAAAA,GAAc,MAAM,KAAK0B,cAAAA,EAAc;AACzC,IAAA;AAEA,IAAA,OAAO1B,WAAAA;AACT,EAAA;AACF","file":"chunk-WDWFFST7.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { APIContext, Context } from \"../../types/context\";\nimport { EnvironmentResolvedConfig } from \"../../types/resolved\";\n\nexport const DEFAULT_ENVIRONMENT = \"__DEFAULT__\" as const;\nexport const GLOBAL_ENVIRONMENT = \"__GLOBAL__\" as const;\n\nexport function createEnvironment<TContext extends Context = Context>(\n name: string,\n userConfig: TContext[\"config\"][\"userConfig\"]\n): EnvironmentResolvedConfig {\n return defu(\n userConfig.environments?.[name] ?? {},\n {\n name,\n title: userConfig.title || titleCase(userConfig.name),\n ssr: false,\n mainFields:\n userConfig.build?.platform === \"browser\"\n ? [\"browser\", \"module\", \"jsnext:main\", \"jsnext\"]\n : [\"module\", \"jsnext:main\", \"jsnext\"],\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"],\n consumer: userConfig.build?.platform === \"browser\" ? \"client\" : \"server\",\n preview:\n userConfig.build?.platform === \"browser\"\n ? {\n port: 5173,\n open: true,\n strictPort: false,\n // https: false,\n host: \"localhost\",\n allowedHosts: [\".\"],\n cors: true,\n headers: {}\n }\n : undefined\n },\n userConfig\n ) as EnvironmentResolvedConfig;\n}\n\nexport function createDefaultEnvironment<\n TContext extends APIContext = APIContext\n>(userConfig: TContext[\"config\"][\"userConfig\"]): EnvironmentResolvedConfig {\n return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport chalk from \"chalk\";\nimport {\n createDefaultEnvironment,\n createEnvironment,\n GLOBAL_ENVIRONMENT\n} from \"../../internal/helpers/environment\";\nimport {\n InitialUserConfig,\n InlineConfig,\n LogFn,\n UserConfig,\n WorkspaceConfig\n} from \"../../types/config\";\nimport {\n APIContext,\n EnvironmentContext,\n InitContextOptions,\n PluginContext\n} from \"../../types/context\";\nimport {\n UNSAFE_ContextInternal,\n UNSAFE_EnvironmentContext\n} from \"../../types/internal\";\nimport { Plugin } from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { loadWorkspaceConfig } from \"../config-file\";\nimport { PowerlinesContext } from \"./context\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\nexport class PowerlinesAPIContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n extends PowerlinesContext<TResolvedConfig>\n implements APIContext<TResolvedConfig>\n{\n #environments: Record<string, UNSAFE_EnvironmentContext<TResolvedConfig>> =\n {};\n\n #plugins: Plugin<PluginContext<TResolvedConfig>>[] = [];\n\n #log!: LogFn;\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param config - The user configuration options.\n * @returns A promise that resolves to the new context.\n */\n public static override async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<APIContext<TResolvedConfig>> {\n const context = new PowerlinesAPIContext<TResolvedConfig>(\n await loadWorkspaceConfig(workspaceRoot, config.root)\n );\n await context.withUserConfig(config);\n\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n\n context.powerlinesPath = powerlinesPath;\n\n return context;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override get $$internal(): UNSAFE_ContextInternal<TResolvedConfig> {\n return super.$$internal;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override set $$internal(\n value: UNSAFE_ContextInternal<TResolvedConfig>\n ) {\n super.$$internal = value;\n for (const environment of Object.values(this.environments)) {\n environment.$$internal = super.$$internal;\n }\n }\n\n /**\n * A record of all environments by name\n */\n public get environments(): Record<\n string,\n UNSAFE_EnvironmentContext<TResolvedConfig>\n > {\n return this.#environments;\n }\n\n public override get log(): LogFn {\n if (!this.#log) {\n this.#log = this.createLog(\"engine\");\n }\n\n return this.#log;\n }\n\n public get plugins(): Array<Plugin<PluginContext<TResolvedConfig>>> {\n return this.#plugins;\n }\n\n protected constructor(workspaceConfig: WorkspaceConfig) {\n super(workspaceConfig);\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @param config - The partial user configuration to use for initialization.\n */\n protected override async init(\n config: Partial<TResolvedConfig[\"userConfig\"]> = {}\n ) {\n await super.init(config);\n\n await Promise.all(\n toArray(\n this.config.userConfig.environments &&\n Object.keys(this.config.userConfig.environments).length > 0\n ? Object.keys(this.config.userConfig.environments).map(name =>\n createEnvironment(name, this.config.userConfig)\n )\n : createDefaultEnvironment(this.config.userConfig)\n ).map(async env => {\n this.#environments[env.name] = await this.in(env);\n })\n );\n }\n\n /**\n * A function to copy the context and update the fields for a specific environment\n *\n * @param environment - The environment configuration to use.\n * @returns A new context instance with the updated environment.\n */\n public async in(\n environment: EnvironmentResolvedConfig\n ): Promise<UNSAFE_EnvironmentContext<TResolvedConfig>> {\n let context: UNSAFE_EnvironmentContext<TResolvedConfig>;\n if (this.environments[environment.name]) {\n context = this.environments[environment.name] as any;\n } else {\n context = (await PowerlinesEnvironmentContext.fromConfig(\n this.workspaceConfig,\n this.config\n )) as any;\n }\n\n if (isSetObject(this.config.inlineConfig)) {\n await context.withInlineConfig(this.config.inlineConfig);\n }\n\n context.environment = environment;\n context.plugins = [];\n\n for (const plugin of this.plugins) {\n await context.addPlugin(plugin);\n }\n\n return context;\n }\n\n /**\n * Update the context using a new user configuration options\n *\n * @param userConfig - The new user configuration options.\n */\n public override async withUserConfig(\n userConfig: InitialUserConfig<TResolvedConfig[\"userConfig\"]>,\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withUserConfig(userConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withUserConfig(\n userConfig as UserConfig,\n options\n );\n })\n );\n }\n\n /**\n * Update the context using a new inline configuration options\n *\n * @param inlineConfig - The new inline configuration options.\n */\n public override async withInlineConfig(\n inlineConfig: TResolvedConfig[\"inlineConfig\"],\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withInlineConfig(inlineConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withInlineConfig(\n inlineConfig as InlineConfig,\n options\n );\n })\n );\n }\n\n /**\n * Add a plugin to the API context and all environments\n *\n * @param plugin - The plugin to add.\n */\n public async addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>) {\n this.plugins.push(plugin);\n\n await Promise.all(\n Object.keys(this.environments).map(async name => {\n await this.environments[name]!.addPlugin(plugin);\n })\n );\n }\n\n /**\n * Get an environment by name, or the default environment if no name is provided\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context.\n */\n public async getEnvironment(name?: string) {\n let environment: EnvironmentContext<TResolvedConfig> | undefined;\n if (name) {\n environment = this.environments[name];\n }\n\n if (Object.keys(this.environments).length === 1) {\n environment = this.environments[Object.keys(this.environments)[0]!];\n\n this.log(\n LogLevelLabel.DEBUG,\n `Applying the only configured environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n if (!environment) {\n if (name) {\n throw new Error(`Environment \"${name}\" not found.`);\n }\n\n environment = await this.in(\n createDefaultEnvironment(this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.WARN,\n `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n return environment;\n }\n\n /**\n * A safe version of `getEnvironment` that returns `undefined` if the environment is not found\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context or `undefined` if not found.\n */\n public async getEnvironmentSafe(\n name?: string\n ): Promise<EnvironmentContext<TResolvedConfig> | undefined> {\n try {\n return await this.getEnvironment(name);\n } catch {\n return undefined;\n }\n }\n\n /**\n * A function to merge all configured environments into a single context.\n *\n * @remarks\n * If only one environment is configured, that environment will be returned directly.\n *\n * @returns A promise that resolves to a merged/global environment context.\n */\n public async toEnvironment(): Promise<EnvironmentContext<TResolvedConfig>> {\n let environment: EnvironmentContext<TResolvedConfig>;\n if (Object.keys(this.environments).length > 1) {\n environment = await this.in(\n createEnvironment(GLOBAL_ENVIRONMENT, this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.DEBUG,\n `Combined all ${Object.keys(this.environments).length} environments into a single global context.`\n );\n } else {\n environment = await this.getEnvironment();\n }\n\n return environment;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/internal/helpers/environment.ts","../../src/lib/contexts/api-context.ts"],"names":["DEFAULT_ENVIRONMENT","GLOBAL_ENVIRONMENT","createEnvironment","name","userConfig","defu","environments","title","titleCase","ssr","mainFields","build","platform","extensions","consumer","preview","port","open","strictPort","host","allowedHosts","cors","headers","undefined","createDefaultEnvironment","PowerlinesAPIContext","PowerlinesContext","from","workspaceRoot","config","context","loadWorkspaceConfig","root","withUserConfig","powerlinesPath","resolvePackage","Error","$$internal","value","environment","Object","values","log","createLog","plugins","workspaceConfig","init","Promise","all","toArray","keys","length","map","env","in","PowerlinesEnvironmentContext","fromConfig","isSetObject","inlineConfig","withInlineConfig","plugin","addPlugin","options","isHighPriority","push","getEnvironment","LogLevelLabel","DEBUG","chalk","bold","cyanBright","WARN","getEnvironmentSafe","toEnvironment"],"mappings":";;;;;;;;;;;;;;;;;;;AAuBO,IAAMA,mBAAAA,GAAsB,aAAA;AAC5B,IAAMC,kBAAAA,GAAqB,YAAA;AAE3B,SAASC,iBAAAA,CACdC,MACAC,UAAAA,EAA4C;AAE5C,EAAA,OAAOC,sBACLD,UAAAA,CAAWE,YAAAA,GAAeH,IAAAA,CAAAA,IAAS,EAAC,EACpC;AACEA,IAAAA,IAAAA;AACAI,IAAAA,KAAAA,EAAOH,UAAAA,CAAWG,KAAAA,IAASC,mBAAAA,CAAUJ,UAAAA,CAAWD,IAAI,CAAA;IACpDM,GAAAA,EAAK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,MAAM,IAAA,CAAKe,EAAAA,CACvB9B,yBAAyB,IAAA,CAAKK,MAAAA,CAAOzB,UAAU,CAAA,CAAA;AAGjD,MAAA,IAAA,CAAKsC,GAAAA,CACHwB,mBAAAA,CAAcK,IAAAA,EACd,CAAA,mGAAA,EAAsGH,sBAAAA,CAAMC,IAAAA,CAAKC,UAAAA,CAC/G/B,WAAAA,EAAaA,WAAAA,CAAYpC,IAAAA,CAAAA,CAAAA,CACxB,CAAA;AAEP,IAAA;AAEA,IAAA,OAAOoC,WAAAA;AACT,EAAA;;;;;;;AAQA,EAAA,MAAaiC,mBACXrE,IAAAA,EAC0D;AAC1D,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,IAAA,CAAK8D,cAAAA,CAAe9D,IAAAA,CAAAA;IACnC,CAAA,CAAA,MAAQ;AACN,MAAA,OAAOoB,MAAAA;AACT,IAAA;AACF,EAAA;;;;;;;;;AAUA,EAAA,MAAakD,aAAAA,GAA8D;AACzE,IAAA,IAAIlC,WAAAA;AACJ,IAAA,IAAIC,OAAOU,IAAAA,CAAK,IAAA,CAAK5C,YAAY,CAAA,CAAE6C,SAAS,CAAA,EAAG;AAC7CZ,MAAAA,WAAAA,GAAc,MAAM,KAAKe,EAAAA,CACvBpD,iBAAAA,CAAkBD,oBAAoB,IAAA,CAAK4B,MAAAA,CAAOzB,UAAU,CAAA,CAAA;AAG9D,MAAA,IAAA,CAAKsC,GAAAA,CACHwB,mBAAAA,CAAcC,KAAAA,EACd,CAAA,aAAA,EAAgB3B,MAAAA,CAAOU,KAAK,IAAA,CAAK5C,YAAY,CAAA,CAAE6C,MAAM,CAAA,2CAAA,CAA6C,CAAA;IAEtG,CAAA,MAAO;AACLZ,MAAAA,WAAAA,GAAc,MAAM,KAAK0B,cAAAA,EAAc;AACzC,IAAA;AAEA,IAAA,OAAO1B,WAAAA;AACT,EAAA;AACF","file":"chunk-ACVINY5F.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { APIContext, Context } from \"../../types/context\";\nimport { EnvironmentResolvedConfig } from \"../../types/resolved\";\n\nexport const DEFAULT_ENVIRONMENT = \"__DEFAULT__\" as const;\nexport const GLOBAL_ENVIRONMENT = \"__GLOBAL__\" as const;\n\nexport function createEnvironment<TContext extends Context = Context>(\n name: string,\n userConfig: TContext[\"config\"][\"userConfig\"]\n): EnvironmentResolvedConfig {\n return defu(\n userConfig.environments?.[name] ?? {},\n {\n name,\n title: userConfig.title || titleCase(userConfig.name),\n ssr: false,\n mainFields:\n userConfig.build?.platform === \"browser\"\n ? [\"browser\", \"module\", \"jsnext:main\", \"jsnext\"]\n : [\"module\", \"jsnext:main\", \"jsnext\"],\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"],\n consumer: userConfig.build?.platform === \"browser\" ? \"client\" : \"server\",\n preview:\n userConfig.build?.platform === \"browser\"\n ? {\n port: 5173,\n open: true,\n strictPort: false,\n // https: false,\n host: \"localhost\",\n allowedHosts: [\".\"],\n cors: true,\n headers: {}\n }\n : undefined\n },\n userConfig\n ) as EnvironmentResolvedConfig;\n}\n\nexport function createDefaultEnvironment<\n TContext extends APIContext = APIContext\n>(userConfig: TContext[\"config\"][\"userConfig\"]): EnvironmentResolvedConfig {\n return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport chalk from \"chalk\";\nimport {\n createDefaultEnvironment,\n createEnvironment,\n GLOBAL_ENVIRONMENT\n} from \"../../internal/helpers/environment\";\nimport {\n InitialUserConfig,\n InlineConfig,\n LogFn,\n UserConfig,\n WorkspaceConfig\n} from \"../../types/config\";\nimport {\n APIContext,\n EnvironmentContext,\n InitContextOptions,\n PluginContext\n} from \"../../types/context\";\nimport {\n UNSAFE_ContextInternal,\n UNSAFE_EnvironmentContext\n} from \"../../types/internal\";\nimport { Plugin } from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { loadWorkspaceConfig } from \"../config-file\";\nimport { PowerlinesContext } from \"./context\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\nexport class PowerlinesAPIContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n extends PowerlinesContext<TResolvedConfig>\n implements APIContext<TResolvedConfig>\n{\n #environments: Record<string, UNSAFE_EnvironmentContext<TResolvedConfig>> =\n {};\n\n #plugins: Plugin<PluginContext<TResolvedConfig>>[] = [];\n\n #log!: LogFn;\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param config - The user configuration options.\n * @returns A promise that resolves to the new context.\n */\n public static override async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<APIContext<TResolvedConfig>> {\n const context = new PowerlinesAPIContext<TResolvedConfig>(\n await loadWorkspaceConfig(workspaceRoot, config.root)\n );\n await context.withUserConfig(config);\n\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n\n context.powerlinesPath = powerlinesPath;\n\n return context;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override get $$internal(): UNSAFE_ContextInternal<TResolvedConfig> {\n return super.$$internal;\n }\n\n /**\n * Internal context fields and methods\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public override set $$internal(\n value: UNSAFE_ContextInternal<TResolvedConfig>\n ) {\n super.$$internal = value;\n for (const environment of Object.values(this.environments)) {\n environment.$$internal = super.$$internal;\n }\n }\n\n /**\n * A record of all environments by name\n */\n public get environments(): Record<\n string,\n UNSAFE_EnvironmentContext<TResolvedConfig>\n > {\n return this.#environments;\n }\n\n public override get log(): LogFn {\n if (!this.#log) {\n this.#log = this.createLog(\"engine\");\n }\n\n return this.#log;\n }\n\n public get plugins(): Array<Plugin<PluginContext<TResolvedConfig>>> {\n return this.#plugins;\n }\n\n protected constructor(workspaceConfig: WorkspaceConfig) {\n super(workspaceConfig);\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @param config - The partial user configuration to use for initialization.\n */\n protected override async init(\n config: Partial<TResolvedConfig[\"userConfig\"]> = {}\n ) {\n await super.init(config);\n\n await Promise.all(\n toArray(\n this.config.userConfig.environments &&\n Object.keys(this.config.userConfig.environments).length > 0\n ? Object.keys(this.config.userConfig.environments).map(name =>\n createEnvironment(name, this.config.userConfig)\n )\n : createDefaultEnvironment(this.config.userConfig)\n ).map(async env => {\n this.#environments[env.name] = await this.in(env);\n })\n );\n }\n\n /**\n * A function to copy the context and update the fields for a specific environment\n *\n * @param environment - The environment configuration to use.\n * @returns A new context instance with the updated environment.\n */\n public async in(\n environment: EnvironmentResolvedConfig\n ): Promise<UNSAFE_EnvironmentContext<TResolvedConfig>> {\n let context: UNSAFE_EnvironmentContext<TResolvedConfig>;\n if (this.environments[environment.name]) {\n context = this.environments[environment.name] as any;\n } else {\n context = (await PowerlinesEnvironmentContext.fromConfig(\n this.workspaceConfig,\n this.config\n )) as any;\n }\n\n if (isSetObject(this.config.inlineConfig)) {\n await context.withInlineConfig(this.config.inlineConfig);\n }\n\n context.environment = environment;\n context.plugins = [];\n\n for (const plugin of this.plugins) {\n await context.addPlugin(plugin);\n }\n\n return context;\n }\n\n /**\n * Update the context using a new user configuration options\n *\n * @param userConfig - The new user configuration options.\n */\n public override async withUserConfig(\n userConfig: InitialUserConfig<TResolvedConfig[\"userConfig\"]>,\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withUserConfig(userConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withUserConfig(\n userConfig as UserConfig,\n options\n );\n })\n );\n }\n\n /**\n * Update the context using a new inline configuration options\n *\n * @param inlineConfig - The new inline configuration options.\n */\n public override async withInlineConfig(\n inlineConfig: TResolvedConfig[\"inlineConfig\"],\n options: InitContextOptions = {\n isHighPriority: true\n }\n ) {\n await super.withInlineConfig(inlineConfig, options);\n\n await Promise.all(\n Object.keys(this.#environments).map(async name => {\n await this.#environments[name]!.withInlineConfig(\n inlineConfig as InlineConfig,\n options\n );\n })\n );\n }\n\n /**\n * Add a plugin to the API context and all environments\n *\n * @param plugin - The plugin to add.\n */\n public async addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>) {\n this.plugins.push(plugin);\n\n await Promise.all(\n Object.keys(this.environments).map(async name => {\n await this.environments[name]!.addPlugin(plugin);\n })\n );\n }\n\n /**\n * Get an environment by name, or the default environment if no name is provided\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context.\n */\n public async getEnvironment(name?: string) {\n let environment: EnvironmentContext<TResolvedConfig> | undefined;\n if (name) {\n environment = this.environments[name];\n }\n\n if (Object.keys(this.environments).length === 1) {\n environment = this.environments[Object.keys(this.environments)[0]!];\n\n this.log(\n LogLevelLabel.DEBUG,\n `Applying the only configured environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n if (!environment) {\n if (name) {\n throw new Error(`Environment \"${name}\" not found.`);\n }\n\n environment = await this.in(\n createDefaultEnvironment(this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.WARN,\n `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(\n environment?.environment.name\n )}`\n );\n }\n\n return environment;\n }\n\n /**\n * A safe version of `getEnvironment` that returns `undefined` if the environment is not found\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context or `undefined` if not found.\n */\n public async getEnvironmentSafe(\n name?: string\n ): Promise<EnvironmentContext<TResolvedConfig> | undefined> {\n try {\n return await this.getEnvironment(name);\n } catch {\n return undefined;\n }\n }\n\n /**\n * A function to merge all configured environments into a single context.\n *\n * @remarks\n * If only one environment is configured, that environment will be returned directly.\n *\n * @returns A promise that resolves to a merged/global environment context.\n */\n public async toEnvironment(): Promise<EnvironmentContext<TResolvedConfig>> {\n let environment: EnvironmentContext<TResolvedConfig>;\n if (Object.keys(this.environments).length > 1) {\n environment = await this.in(\n createEnvironment(GLOBAL_ENVIRONMENT, this.config.userConfig)\n );\n\n this.log(\n LogLevelLabel.DEBUG,\n `Combined all ${Object.keys(this.environments).length} environments into a single global context.`\n );\n } else {\n environment = await this.getEnvironment();\n }\n\n return environment;\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getFileHeader } from './chunk-7R23HVGQ.js';
|
|
2
|
-
import { PowerlinesAPIContext } from './chunk-
|
|
2
|
+
import { PowerlinesAPIContext } from './chunk-72NPPPRF.js';
|
|
3
3
|
import { isPluginConfig, isPlugin, isPluginConfigTuple, isPluginConfigObject, checkDedupe } from './chunk-VN2OA25X.js';
|
|
4
4
|
import { writeMetaFile } from './chunk-45D4XIOK.js';
|
|
5
5
|
import { createProgram } from './chunk-ZLWW2MXD.js';
|
|
@@ -1187,5 +1187,5 @@ function createUnpluginFactory(variant, decorate) {
|
|
|
1187
1187
|
__name(createUnpluginFactory, "createUnpluginFactory");
|
|
1188
1188
|
|
|
1189
1189
|
export { createUnpluginFactory };
|
|
1190
|
-
//# sourceMappingURL=chunk-
|
|
1191
|
-
//# sourceMappingURL=chunk-
|
|
1190
|
+
//# sourceMappingURL=chunk-AEUGNAWZ.js.map
|
|
1191
|
+
//# sourceMappingURL=chunk-AEUGNAWZ.js.map
|