@powerlines/plugin-react 0.1.9 → 0.1.10

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/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkFBBMZ4NC_cjs=require('./chunk-FBBMZ4NC.cjs'),jsxRuntime=require('@alloy-js/core/jsx-runtime'),createPlugin=require('@powerlines/alloy/create-plugin'),type=require('@powerlines/deepkit/vendor/type'),m=require('@powerlines/plugin-babel'),f=require('@powerlines/plugin-env'),types$1=require('@storm-software/config-tools/types'),g=require('@vitejs/plugin-react'),d=require('defu'),tsconfig=require('powerlines/lib/typescript/tsconfig'),reactOptimized=require('./components/react-optimized'),components=require('./components'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var m__default=/*#__PURE__*/_interopDefault(m);var f__default=/*#__PURE__*/_interopDefault(f);var g__default=/*#__PURE__*/_interopDefault(g);var d__default=/*#__PURE__*/_interopDefault(d);/*****************************************
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkFBBMZ4NC_cjs=require('./chunk-FBBMZ4NC.cjs'),jsxRuntime=require('@alloy-js/core/jsx-runtime'),createPlugin=require('@powerlines/alloy/create-plugin'),type=require('@powerlines/deepkit/vendor/type'),a=require('@powerlines/plugin-babel'),f=require('@powerlines/plugin-env'),types$1=require('@storm-software/config-tools/types'),g=require('@vitejs/plugin-react'),d=require('defu'),tsconfig=require('powerlines/lib/typescript/tsconfig'),reactOptimized=require('./components/react-optimized'),components=require('./components'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var a__default=/*#__PURE__*/_interopDefault(a);var f__default=/*#__PURE__*/_interopDefault(f);var g__default=/*#__PURE__*/_interopDefault(g);var d__default=/*#__PURE__*/_interopDefault(d);/*****************************************
2
2
  *
3
3
  * ⚡ Built by Storm Software
4
4
  *
5
5
  *****************************************/
6
6
 
7
- const h=createPlugin.createAlloyPlugin(s=>({name:"react",dependsOn:[m__default.default(s.babel),f__default.default(s.env)],config(){return d__default.default({react:s},{react:{jsxImportSource:this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource}},{react:{jsxRuntime:"automatic",jsxImportSource:"react",compiler:{target:"react19",compilationMode:"infer",gating:{source:`${this.config.output.builtinPrefix}:react/optimized`,importSpecifierName:"isOptimizationEnabled"},enableReanimatedCheck:true,logger:{logEvent:chunkFBBMZ4NC_cjs.a((o,i)=>{this.log(i.kind==="CompileSuccess"?types$1.LogLevelLabel.SUCCESS:i.kind==="AutoDepsEligible"||i.kind==="AutoDepsDecorations"?types$1.LogLevelLabel.INFO:i.kind==="CompileSkip"||i.kind==="CompileDiagnostic"?types$1.LogLevelLabel.DEBUG:i.kind==="Timing"?types$1.LogLevelLabel.TRACE:types$1.LogLevelLabel.ERROR,`(${o}) ${i.kind==="CompileSuccess"?"React Compiler Success":i.kind==="AutoDepsEligible"?`React AutoDeps Eligible - ${i.depArrayLoc.identifierName||"No identifier"}`:i.kind==="AutoDepsDecorations"?`React AutoDeps Decorations - ${i.decorations.filter(n=>n.identifierName).map(n=>n.identifierName).join(", ")}`:i.kind==="CompileSkip"?`React Compile Skip - ${i.reason}`:i.kind==="CompileDiagnostic"?`React Compile Diagnostic - (Category: ${i.detail.category}) ${i.detail.reason}${i.detail.description?`
7
+ const h=createPlugin.createAlloyPlugin(s=>({name:"react",dependsOn:[a__default.default(s.babel),f__default.default(s.env)],config(){return d__default.default({react:s},{react:{jsxImportSource:this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource}},{react:{jsxRuntime:"automatic",jsxImportSource:"react",compiler:{target:"19",compilationMode:"infer",gating:{source:`${this.config.output.builtinPrefix}:react/optimized`,importSpecifierName:"isOptimizationEnabled"},enableReanimatedCheck:true,logger:{logEvent:chunkFBBMZ4NC_cjs.a((o,i)=>{this.log(i.kind==="CompileSuccess"?types$1.LogLevelLabel.SUCCESS:i.kind==="AutoDepsEligible"||i.kind==="AutoDepsDecorations"?types$1.LogLevelLabel.INFO:i.kind==="CompileSkip"||i.kind==="CompileDiagnostic"?types$1.LogLevelLabel.DEBUG:i.kind==="Timing"?types$1.LogLevelLabel.TRACE:types$1.LogLevelLabel.ERROR,`(${o}) ${i.kind==="CompileSuccess"?"React Compiler Success":i.kind==="AutoDepsEligible"?`React AutoDeps Eligible - ${i.depArrayLoc.identifierName||"No identifier"}`:i.kind==="AutoDepsDecorations"?`React AutoDeps Decorations - ${i.decorations.filter(n=>n.identifierName).map(n=>n.identifierName).join(", ")}`:i.kind==="CompileSkip"?`React Compile Skip - ${i.reason}`:i.kind==="CompileDiagnostic"?`React Compile Diagnostic - (Category: ${i.detail.category}) ${i.detail.reason}${i.detail.description?`
8
8
  ${i.detail.description}`:""}`:i.kind==="Timing"?`React ${i.measurement.entryType} Timing (${i.measurement.name}) - ${i.measurement.duration}ms`:`React Compiler Error - ${i.fnLoc?.identifierName||"unknown location"}`}`);},"logEvent")}}}})},configResolved(){if(this.dependencies.react="^19.2.0",this.dependencies["react-dom"]="^19.2.0",this.devDependencies["@types/react"]="^19.2.2",this.devDependencies["@types/react-dom"]="^19.2.2",this.config.react.compiler!==false&&(this.config.transform.babel??={},this.config.transform.babel.plugins??=[],this.config.transform.babel.plugins.push(["babel-plugin-react-compiler",this.config.react.compiler])),this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.module??="esnext",this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=this.config.react.jsxImportSource,this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource==="react"?this.tsconfig.tsconfigJson.compilerOptions.jsx??="react-jsx":this.tsconfig.tsconfigJson.compilerOptions.jsx??="preserve",this.tsconfig.tsconfigJson.compilerOptions.lib=[],tsconfig.isMatchFound("dom",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM"),tsconfig.isMatchFound("dom.iterable",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM.Iterable"),tsconfig.isMatchFound("esnext",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("ESNext"),this.tsconfig.options.resolveJsonModule!==true&&(this.tsconfig.tsconfigJson.compilerOptions.resolveJsonModule=true),this.config.build.variant==="vite"){this.tsconfig.tsconfigJson.compilerOptions.types??=[],tsconfig.isMatchFound("vite/client",this.tsconfig.tsconfigJson.compilerOptions.types)||this.tsconfig.tsconfigJson.compilerOptions.types.push("vite/client");const o=this.config.build;o.build??={},o.build.target="chrome95",o.plugins??=[],o.plugins.unshift(g__default.default({babel:this.config.transform.babel,jsxImportSource:this.config.react.jsxImportSource,jsxRuntime:this.config.react.jsxRuntime,reactRefreshHost:this.config.react.reactRefreshHost}));}this.env?.types?.env&&!this.env.types.env.hasProperty("DISABLE_REACT_COMPILER")&&this.env.types.env.addProperty({name:"DISABLE_REACT_COMPILER",optional:true,readonly:true,description:"Disables the React compiler optimizations.",visibility:type.ReflectionVisibility.public,type:{kind:type.ReflectionKind.boolean},default:false});},render(){const o=this;return jsxRuntime.createComponent(reactOptimized.ReactOptimizedBuiltin,{get override(){return o.config.react.compiler===false?false:void 0}})}}));var j=h;exports.default=j;exports.plugin=h;Object.keys(components).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return components[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as PluginContext, a as Plugin } from './runtime-CXMswNNM.cjs';
1
+ import { P as PluginContext, a as Plugin } from './runtime-BC7ENbDx.cjs';
2
2
  import { Children } from '@alloy-js/core/jsx-runtime';
3
3
  import { PrintTreeOptions } from '@alloy-js/core';
4
4
  import { ReactPluginContext } from './types/plugin.cjs';
@@ -6,6 +6,7 @@ export { ReactCompilerOptions, ReactPluginOptions, ReactPluginResolvedConfig, Re
6
6
  export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps } from './components/react-optimized.cjs';
7
7
  export { ReactEnvInterface } from './types/runtime.cjs';
8
8
  import '@stryke/env/get-env-paths';
9
+ import '@stryke/types/base';
9
10
  import '@stryke/types/package-json';
10
11
  import 'jiti';
11
12
  import 'oxc-parser';
@@ -15,7 +16,6 @@ import '@babel/core';
15
16
  import '@storm-software/build-tools/types';
16
17
  import '@storm-software/config-tools/types';
17
18
  import '@storm-software/config/types';
18
- import '@stryke/types/base';
19
19
  import '@stryke/types/configuration';
20
20
  import '@stryke/types/file';
21
21
  import 'vite';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as PluginContext, a as Plugin } from './runtime-Bb7JS9HT.js';
1
+ import { P as PluginContext, a as Plugin } from './runtime-DCT7zK30.js';
2
2
  import { Children } from '@alloy-js/core/jsx-runtime';
3
3
  import { PrintTreeOptions } from '@alloy-js/core';
4
4
  import { ReactPluginContext } from './types/plugin.js';
@@ -6,6 +6,7 @@ export { ReactCompilerOptions, ReactPluginOptions, ReactPluginResolvedConfig, Re
6
6
  export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps } from './components/react-optimized.js';
7
7
  export { ReactEnvInterface } from './types/runtime.js';
8
8
  import '@stryke/env/get-env-paths';
9
+ import '@stryke/types/base';
9
10
  import '@stryke/types/package-json';
10
11
  import 'jiti';
11
12
  import 'oxc-parser';
@@ -15,7 +16,6 @@ import '@babel/core';
15
16
  import '@storm-software/build-tools/types';
16
17
  import '@storm-software/config-tools/types';
17
18
  import '@storm-software/config/types';
18
- import '@stryke/types/base';
19
19
  import '@stryke/types/configuration';
20
20
  import '@stryke/types/file';
21
21
  import 'vite';
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import {a}from'./chunk-UCUR73HG.js';import {createComponent}from'@alloy-js/core/jsx-runtime';import {createAlloyPlugin}from'@powerlines/alloy/create-plugin';import {ReflectionKind,ReflectionVisibility}from'@powerlines/deepkit/vendor/type';import m from'@powerlines/plugin-babel';import f from'@powerlines/plugin-env';import {LogLevelLabel}from'@storm-software/config-tools/types';import g from'@vitejs/plugin-react';import d from'defu';import {isMatchFound}from'powerlines/lib/typescript/tsconfig';import {ReactOptimizedBuiltin}from'./components/react-optimized';export*from'./components';export*from'./types';/*****************************************
1
+ import {a as a$1}from'./chunk-UCUR73HG.js';import {createComponent}from'@alloy-js/core/jsx-runtime';import {createAlloyPlugin}from'@powerlines/alloy/create-plugin';import {ReflectionKind,ReflectionVisibility}from'@powerlines/deepkit/vendor/type';import a from'@powerlines/plugin-babel';import f from'@powerlines/plugin-env';import {LogLevelLabel}from'@storm-software/config-tools/types';import g from'@vitejs/plugin-react';import d from'defu';import {isMatchFound}from'powerlines/lib/typescript/tsconfig';import {ReactOptimizedBuiltin}from'./components/react-optimized';export*from'./components';export*from'./types';/*****************************************
2
2
  *
3
3
  * ⚡ Built by Storm Software
4
4
  *
5
5
  *****************************************/
6
6
 
7
- const h=createAlloyPlugin(s=>({name:"react",dependsOn:[m(s.babel),f(s.env)],config(){return d({react:s},{react:{jsxImportSource:this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource}},{react:{jsxRuntime:"automatic",jsxImportSource:"react",compiler:{target:"react19",compilationMode:"infer",gating:{source:`${this.config.output.builtinPrefix}:react/optimized`,importSpecifierName:"isOptimizationEnabled"},enableReanimatedCheck:true,logger:{logEvent:a((o,i)=>{this.log(i.kind==="CompileSuccess"?LogLevelLabel.SUCCESS:i.kind==="AutoDepsEligible"||i.kind==="AutoDepsDecorations"?LogLevelLabel.INFO:i.kind==="CompileSkip"||i.kind==="CompileDiagnostic"?LogLevelLabel.DEBUG:i.kind==="Timing"?LogLevelLabel.TRACE:LogLevelLabel.ERROR,`(${o}) ${i.kind==="CompileSuccess"?"React Compiler Success":i.kind==="AutoDepsEligible"?`React AutoDeps Eligible - ${i.depArrayLoc.identifierName||"No identifier"}`:i.kind==="AutoDepsDecorations"?`React AutoDeps Decorations - ${i.decorations.filter(n=>n.identifierName).map(n=>n.identifierName).join(", ")}`:i.kind==="CompileSkip"?`React Compile Skip - ${i.reason}`:i.kind==="CompileDiagnostic"?`React Compile Diagnostic - (Category: ${i.detail.category}) ${i.detail.reason}${i.detail.description?`
7
+ const h=createAlloyPlugin(s=>({name:"react",dependsOn:[a(s.babel),f(s.env)],config(){return d({react:s},{react:{jsxImportSource:this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource}},{react:{jsxRuntime:"automatic",jsxImportSource:"react",compiler:{target:"19",compilationMode:"infer",gating:{source:`${this.config.output.builtinPrefix}:react/optimized`,importSpecifierName:"isOptimizationEnabled"},enableReanimatedCheck:true,logger:{logEvent:a$1((o,i)=>{this.log(i.kind==="CompileSuccess"?LogLevelLabel.SUCCESS:i.kind==="AutoDepsEligible"||i.kind==="AutoDepsDecorations"?LogLevelLabel.INFO:i.kind==="CompileSkip"||i.kind==="CompileDiagnostic"?LogLevelLabel.DEBUG:i.kind==="Timing"?LogLevelLabel.TRACE:LogLevelLabel.ERROR,`(${o}) ${i.kind==="CompileSuccess"?"React Compiler Success":i.kind==="AutoDepsEligible"?`React AutoDeps Eligible - ${i.depArrayLoc.identifierName||"No identifier"}`:i.kind==="AutoDepsDecorations"?`React AutoDeps Decorations - ${i.decorations.filter(n=>n.identifierName).map(n=>n.identifierName).join(", ")}`:i.kind==="CompileSkip"?`React Compile Skip - ${i.reason}`:i.kind==="CompileDiagnostic"?`React Compile Diagnostic - (Category: ${i.detail.category}) ${i.detail.reason}${i.detail.description?`
8
8
  ${i.detail.description}`:""}`:i.kind==="Timing"?`React ${i.measurement.entryType} Timing (${i.measurement.name}) - ${i.measurement.duration}ms`:`React Compiler Error - ${i.fnLoc?.identifierName||"unknown location"}`}`);},"logEvent")}}}})},configResolved(){if(this.dependencies.react="^19.2.0",this.dependencies["react-dom"]="^19.2.0",this.devDependencies["@types/react"]="^19.2.2",this.devDependencies["@types/react-dom"]="^19.2.2",this.config.react.compiler!==false&&(this.config.transform.babel??={},this.config.transform.babel.plugins??=[],this.config.transform.babel.plugins.push(["babel-plugin-react-compiler",this.config.react.compiler])),this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.module??="esnext",this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=this.config.react.jsxImportSource,this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource==="react"?this.tsconfig.tsconfigJson.compilerOptions.jsx??="react-jsx":this.tsconfig.tsconfigJson.compilerOptions.jsx??="preserve",this.tsconfig.tsconfigJson.compilerOptions.lib=[],isMatchFound("dom",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM"),isMatchFound("dom.iterable",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("DOM.Iterable"),isMatchFound("esnext",this.tsconfig.tsconfigJson.compilerOptions.lib)||this.tsconfig.tsconfigJson.compilerOptions.lib.push("ESNext"),this.tsconfig.options.resolveJsonModule!==true&&(this.tsconfig.tsconfigJson.compilerOptions.resolveJsonModule=true),this.config.build.variant==="vite"){this.tsconfig.tsconfigJson.compilerOptions.types??=[],isMatchFound("vite/client",this.tsconfig.tsconfigJson.compilerOptions.types)||this.tsconfig.tsconfigJson.compilerOptions.types.push("vite/client");const o=this.config.build;o.build??={},o.build.target="chrome95",o.plugins??=[],o.plugins.unshift(g({babel:this.config.transform.babel,jsxImportSource:this.config.react.jsxImportSource,jsxRuntime:this.config.react.jsxRuntime,reactRefreshHost:this.config.react.reactRefreshHost}));}this.env?.types?.env&&!this.env.types.env.hasProperty("DISABLE_REACT_COMPILER")&&this.env.types.env.addProperty({name:"DISABLE_REACT_COMPILER",optional:true,readonly:true,description:"Disables the React compiler optimizations.",visibility:ReflectionVisibility.public,type:{kind:ReflectionKind.boolean},default:false});},render(){const o=this;return createComponent(ReactOptimizedBuiltin,{get override(){return o.config.react.compiler===false?false:void 0}})}}));var I=h;export{I as default,h as plugin};
@@ -1,14 +1,14 @@
1
1
  import { EnvPaths } from '@stryke/env/get-env-paths';
2
+ import { NonUndefined, MaybePromise, FunctionLike } from '@stryke/types/base';
2
3
  import { PackageJson } from '@stryke/types/package-json';
3
4
  import { Jiti } from 'jiti';
4
5
  import { ParserOptions, ParseResult } from 'oxc-parser';
5
6
  import { Range } from 'semver';
6
- import { TransformResult, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginBuildContext, UnpluginMessage } from 'unplugin';
7
+ import { TransformResult, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginMessage, UnpluginBuildContext } from 'unplugin';
7
8
  import { PluginItem, PluginObj, PluginPass, transformAsync } from '@babel/core';
8
9
  import { Format } from '@storm-software/build-tools/types';
9
10
  import { LogLevelLabel } from '@storm-software/config-tools/types';
10
11
  import { StormWorkspaceConfig } from '@storm-software/config/types';
11
- import { NonUndefined, MaybePromise, FunctionLike } from '@stryke/types/base';
12
12
  import { TypeDefinition, TypeDefinitionParameter } from '@stryke/types/configuration';
13
13
  import { AssetGlob } from '@stryke/types/file';
14
14
  import { ResolvedPreviewOptions, PreviewOptions } from 'vite';
@@ -44,6 +44,73 @@ interface BuildConfig {
44
44
  * @defaultValue "neutral"
45
45
  */
46
46
  platform?: "node" | "browser" | "neutral";
47
+ /**
48
+ * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
49
+ *
50
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
51
+ */
52
+ mainFields?: string[];
53
+ /**
54
+ * Array of strings indicating what conditions should be used for module resolution.
55
+ */
56
+ conditions?: string[];
57
+ /**
58
+ * Array of strings indicating what file extensions should be used for module resolution.
59
+ *
60
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
61
+ */
62
+ extensions?: string[];
63
+ /**
64
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
65
+ *
66
+ * @remarks
67
+ * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
68
+ */
69
+ dedupe?: string[];
70
+ /**
71
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
72
+ */
73
+ builtins?: (string | RegExp)[];
74
+ /**
75
+ * Define global variable replacements.
76
+ *
77
+ * @remarks
78
+ * This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * {
83
+ * define: {
84
+ * __VERSION__: '"1.0.0"',
85
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
86
+ * }
87
+ * }
88
+ * ```
89
+ *
90
+ * @see https://esbuild.github.io/api/#define
91
+ * @see https://vitejs.dev/config/build-options.html#define
92
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
93
+ */
94
+ define?: Record<string, any>;
95
+ /**
96
+ * Global variables that will have import statements injected where necessary
97
+ *
98
+ * @remarks
99
+ * This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * {
104
+ * inject: {
105
+ * process: 'process/browser',
106
+ * Buffer: ['buffer', 'Buffer'],
107
+ * }
108
+ * }
109
+ * ```
110
+ *
111
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
112
+ */
113
+ inject?: Record<string, string | string[]>;
47
114
  /**
48
115
  * The alias mappings to use for module resolution during the build process.
49
116
  *
@@ -59,6 +126,8 @@ interface BuildConfig {
59
126
  * }
60
127
  * }
61
128
  * ```
129
+ *
130
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
62
131
  */
63
132
  alias?: Record<string, string>;
64
133
  /**
@@ -77,13 +146,14 @@ interface BuildConfig {
77
146
  */
78
147
  skipNodeModulesBundle?: boolean;
79
148
  /**
80
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
149
+ * An optional set of override options to apply to the selected build variant.
81
150
  *
82
- * @defaultValue false
151
+ * @remarks
152
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
83
153
  */
84
- skipPrepare?: boolean;
154
+ override?: Record<string, any>;
85
155
  }
86
- type BuildResolvedConfig = BuildConfig;
156
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
87
157
 
88
158
  declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "release", "finalize"];
89
159
  type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
@@ -99,7 +169,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
99
169
  output?: string;
100
170
  }
101
171
  type BabelResolvedConfig = Omit<BabelUserConfig, "plugins" | "presets"> & Required<Pick<BabelUserConfig, "plugins" | "presets">>;
102
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
172
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
103
173
  /**
104
174
  * The name of the environment
105
175
  */
@@ -116,7 +186,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
116
186
  /**
117
187
  * The resolved options for the Powerlines project configuration.
118
188
  */
119
- type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "override" | "root" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "override" | "framework">> & {
189
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "framework">> & {
120
190
  /**
121
191
  * The configuration options that were provided inline to the Powerlines CLI.
122
192
  */
@@ -147,6 +217,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
147
217
  * The output configuration options to use for the build process
148
218
  */
149
219
  output: OutputResolvedConfig;
220
+ /**
221
+ * Configuration provided to build processes
222
+ *
223
+ * @remarks
224
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
225
+ */
226
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
150
227
  /**
151
228
  * The log level to use for the Powerlines processes.
152
229
  *
@@ -177,6 +254,10 @@ interface GenerateTypesResult {
177
254
  directives?: string[];
178
255
  code: string;
179
256
  }
257
+ type DeepPartial<T> = {
258
+ [K in keyof T]?: DeepPartial<T[K]>;
259
+ };
260
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
180
261
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
181
262
  /**
182
263
  * A function that returns configuration options to be merged with the build context's options.
@@ -192,7 +273,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
192
273
  * @param config - The partial configuration object to be modified.
193
274
  * @returns A promise that resolves to a partial configuration object.
194
275
  */
195
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
276
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
196
277
  /**
197
278
  * Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.
198
279
  *
@@ -295,7 +376,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
295
376
  * @param config - The partial configuration object to be modified.
296
377
  * @returns A promise that resolves to a partial configuration object.
297
378
  */
298
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
379
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
299
380
  /**
300
381
  * A hook that is called to transform the source code.
301
382
  *
@@ -571,24 +652,33 @@ interface BaseConfig {
571
652
  * The entry point(s) for the application
572
653
  */
573
654
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
655
+ /**
656
+ * Configuration for the output of the build process
657
+ */
658
+ output?: OutputConfig;
574
659
  /**
575
660
  * Configuration for linting the source code
661
+ *
662
+ * @remarks
663
+ * If set to `false`, linting will be disabled.
576
664
  */
577
665
  lint?: Record<string, any> | false;
578
666
  /**
579
667
  * Configuration for testing the source code
668
+ *
669
+ * @remarks
670
+ * If set to `false`, testing will be disabled.
580
671
  */
581
672
  test?: Record<string, any> | false;
582
- /**
583
- * Configuration for the output of the build process
584
- */
585
- output?: OutputConfig;
586
673
  /**
587
674
  * Configuration for the transformation of the source code
588
675
  */
589
676
  transform?: Record<string, any>;
590
677
  /**
591
- * Options to to provide to the build process
678
+ * Configuration provided to build processes
679
+ *
680
+ * @remarks
681
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
592
682
  */
593
683
  build?: BuildConfig;
594
684
  /**
@@ -618,37 +708,6 @@ interface BaseConfig {
618
708
  tsconfigRaw?: TSConfig;
619
709
  }
620
710
  interface EnvironmentConfig extends BaseConfig {
621
- /**
622
- * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
623
- *
624
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
625
- */
626
- mainFields?: string[];
627
- /**
628
- * Array of strings indicating what conditions should be used for module resolution.
629
- */
630
- conditions?: string[];
631
- /**
632
- * Array of strings indicating what conditions should be used for external modules.
633
- */
634
- externalConditions?: string[];
635
- /**
636
- * Array of strings indicating what file extensions should be used for module resolution.
637
- *
638
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
639
- */
640
- extensions?: string[];
641
- /**
642
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
643
- *
644
- * @remarks
645
- * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
646
- */
647
- dedupe?: string[];
648
- /**
649
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
650
- */
651
- builtins?: (string | RegExp)[];
652
711
  /**
653
712
  * Configuration options for the preview server
654
713
  */
@@ -721,14 +780,26 @@ interface CommonUserConfig extends BaseConfig {
721
780
  */
722
781
  framework?: string;
723
782
  }
724
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
725
- build?: TBuildConfig & {
783
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
784
+ /**
785
+ * Configuration provided to build processes
786
+ *
787
+ * @remarks
788
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
789
+ */
790
+ build: Omit<TBuildConfig, "override"> & {
726
791
  /**
727
792
  * The build variant being used by the Powerlines engine.
728
793
  */
729
794
  variant?: TBuildVariant;
795
+ /**
796
+ * An optional set of override options to apply to the selected build variant.
797
+ *
798
+ * @remarks
799
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
800
+ */
801
+ override?: Partial<TBuildResolvedConfig>;
730
802
  };
731
- override?: Partial<TBuildResolvedConfig>;
732
803
  };
733
804
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
734
805
  /**
@@ -797,7 +868,13 @@ interface InitContextOptions {
797
868
  */
798
869
  isHighPriority: boolean;
799
870
  }
800
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
871
+ /**
872
+ * The unresolved Powerlines context.
873
+ *
874
+ * @remarks
875
+ * This context is used before the user configuration has been fully resolved after the `config`.
876
+ */
877
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
801
878
  /**
802
879
  * The Storm workspace configuration
803
880
  */
@@ -805,7 +882,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
805
882
  /**
806
883
  * An object containing the options provided to Powerlines
807
884
  */
808
- config: TResolvedConfig;
885
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
886
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
887
+ output: TResolvedConfig["output"];
888
+ };
809
889
  /**
810
890
  * A logging function for the Powerlines engine
811
891
  */
@@ -962,6 +1042,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
962
1042
  */
963
1043
  extendLog: (name: string) => LogFn;
964
1044
  }
1045
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1046
+ /**
1047
+ * The fully resolved Powerlines configuration
1048
+ */
1049
+ config: TResolvedConfig;
1050
+ };
965
1051
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
966
1052
  /**
967
1053
  * The environment specific resolved configuration
@@ -1,14 +1,14 @@
1
1
  import { EnvPaths } from '@stryke/env/get-env-paths';
2
+ import { NonUndefined, MaybePromise, FunctionLike } from '@stryke/types/base';
2
3
  import { PackageJson } from '@stryke/types/package-json';
3
4
  import { Jiti } from 'jiti';
4
5
  import { ParserOptions, ParseResult } from 'oxc-parser';
5
6
  import { Range } from 'semver';
6
- import { TransformResult, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginBuildContext, UnpluginMessage } from 'unplugin';
7
+ import { TransformResult, ExternalIdResult, HookFilter, UnpluginOptions, UnpluginContext, UnpluginMessage, UnpluginBuildContext } from 'unplugin';
7
8
  import { PluginItem, PluginObj, PluginPass, transformAsync } from '@babel/core';
8
9
  import { Format } from '@storm-software/build-tools/types';
9
10
  import { LogLevelLabel } from '@storm-software/config-tools/types';
10
11
  import { StormWorkspaceConfig } from '@storm-software/config/types';
11
- import { NonUndefined, MaybePromise, FunctionLike } from '@stryke/types/base';
12
12
  import { TypeDefinition, TypeDefinitionParameter } from '@stryke/types/configuration';
13
13
  import { AssetGlob } from '@stryke/types/file';
14
14
  import { ResolvedPreviewOptions, PreviewOptions } from 'vite';
@@ -44,6 +44,73 @@ interface BuildConfig {
44
44
  * @defaultValue "neutral"
45
45
  */
46
46
  platform?: "node" | "browser" | "neutral";
47
+ /**
48
+ * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
49
+ *
50
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
51
+ */
52
+ mainFields?: string[];
53
+ /**
54
+ * Array of strings indicating what conditions should be used for module resolution.
55
+ */
56
+ conditions?: string[];
57
+ /**
58
+ * Array of strings indicating what file extensions should be used for module resolution.
59
+ *
60
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
61
+ */
62
+ extensions?: string[];
63
+ /**
64
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
65
+ *
66
+ * @remarks
67
+ * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
68
+ */
69
+ dedupe?: string[];
70
+ /**
71
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
72
+ */
73
+ builtins?: (string | RegExp)[];
74
+ /**
75
+ * Define global variable replacements.
76
+ *
77
+ * @remarks
78
+ * This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * {
83
+ * define: {
84
+ * __VERSION__: '"1.0.0"',
85
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
86
+ * }
87
+ * }
88
+ * ```
89
+ *
90
+ * @see https://esbuild.github.io/api/#define
91
+ * @see https://vitejs.dev/config/build-options.html#define
92
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
93
+ */
94
+ define?: Record<string, any>;
95
+ /**
96
+ * Global variables that will have import statements injected where necessary
97
+ *
98
+ * @remarks
99
+ * This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * {
104
+ * inject: {
105
+ * process: 'process/browser',
106
+ * Buffer: ['buffer', 'Buffer'],
107
+ * }
108
+ * }
109
+ * ```
110
+ *
111
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
112
+ */
113
+ inject?: Record<string, string | string[]>;
47
114
  /**
48
115
  * The alias mappings to use for module resolution during the build process.
49
116
  *
@@ -59,6 +126,8 @@ interface BuildConfig {
59
126
  * }
60
127
  * }
61
128
  * ```
129
+ *
130
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
62
131
  */
63
132
  alias?: Record<string, string>;
64
133
  /**
@@ -77,13 +146,14 @@ interface BuildConfig {
77
146
  */
78
147
  skipNodeModulesBundle?: boolean;
79
148
  /**
80
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
149
+ * An optional set of override options to apply to the selected build variant.
81
150
  *
82
- * @defaultValue false
151
+ * @remarks
152
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
83
153
  */
84
- skipPrepare?: boolean;
154
+ override?: Record<string, any>;
85
155
  }
86
- type BuildResolvedConfig = BuildConfig;
156
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
87
157
 
88
158
  declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "release", "finalize"];
89
159
  type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
@@ -99,7 +169,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
99
169
  output?: string;
100
170
  }
101
171
  type BabelResolvedConfig = Omit<BabelUserConfig, "plugins" | "presets"> & Required<Pick<BabelUserConfig, "plugins" | "presets">>;
102
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
172
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
103
173
  /**
104
174
  * The name of the environment
105
175
  */
@@ -116,7 +186,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
116
186
  /**
117
187
  * The resolved options for the Powerlines project configuration.
118
188
  */
119
- type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "override" | "root" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "override" | "framework">> & {
189
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "framework">> & {
120
190
  /**
121
191
  * The configuration options that were provided inline to the Powerlines CLI.
122
192
  */
@@ -147,6 +217,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
147
217
  * The output configuration options to use for the build process
148
218
  */
149
219
  output: OutputResolvedConfig;
220
+ /**
221
+ * Configuration provided to build processes
222
+ *
223
+ * @remarks
224
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
225
+ */
226
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
150
227
  /**
151
228
  * The log level to use for the Powerlines processes.
152
229
  *
@@ -177,6 +254,10 @@ interface GenerateTypesResult {
177
254
  directives?: string[];
178
255
  code: string;
179
256
  }
257
+ type DeepPartial<T> = {
258
+ [K in keyof T]?: DeepPartial<T[K]>;
259
+ };
260
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
180
261
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
181
262
  /**
182
263
  * A function that returns configuration options to be merged with the build context's options.
@@ -192,7 +273,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
192
273
  * @param config - The partial configuration object to be modified.
193
274
  * @returns A promise that resolves to a partial configuration object.
194
275
  */
195
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
276
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
196
277
  /**
197
278
  * Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.
198
279
  *
@@ -295,7 +376,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
295
376
  * @param config - The partial configuration object to be modified.
296
377
  * @returns A promise that resolves to a partial configuration object.
297
378
  */
298
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
379
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
299
380
  /**
300
381
  * A hook that is called to transform the source code.
301
382
  *
@@ -571,24 +652,33 @@ interface BaseConfig {
571
652
  * The entry point(s) for the application
572
653
  */
573
654
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
655
+ /**
656
+ * Configuration for the output of the build process
657
+ */
658
+ output?: OutputConfig;
574
659
  /**
575
660
  * Configuration for linting the source code
661
+ *
662
+ * @remarks
663
+ * If set to `false`, linting will be disabled.
576
664
  */
577
665
  lint?: Record<string, any> | false;
578
666
  /**
579
667
  * Configuration for testing the source code
668
+ *
669
+ * @remarks
670
+ * If set to `false`, testing will be disabled.
580
671
  */
581
672
  test?: Record<string, any> | false;
582
- /**
583
- * Configuration for the output of the build process
584
- */
585
- output?: OutputConfig;
586
673
  /**
587
674
  * Configuration for the transformation of the source code
588
675
  */
589
676
  transform?: Record<string, any>;
590
677
  /**
591
- * Options to to provide to the build process
678
+ * Configuration provided to build processes
679
+ *
680
+ * @remarks
681
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
592
682
  */
593
683
  build?: BuildConfig;
594
684
  /**
@@ -618,37 +708,6 @@ interface BaseConfig {
618
708
  tsconfigRaw?: TSConfig;
619
709
  }
620
710
  interface EnvironmentConfig extends BaseConfig {
621
- /**
622
- * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
623
- *
624
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
625
- */
626
- mainFields?: string[];
627
- /**
628
- * Array of strings indicating what conditions should be used for module resolution.
629
- */
630
- conditions?: string[];
631
- /**
632
- * Array of strings indicating what conditions should be used for external modules.
633
- */
634
- externalConditions?: string[];
635
- /**
636
- * Array of strings indicating what file extensions should be used for module resolution.
637
- *
638
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
639
- */
640
- extensions?: string[];
641
- /**
642
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
643
- *
644
- * @remarks
645
- * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
646
- */
647
- dedupe?: string[];
648
- /**
649
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
650
- */
651
- builtins?: (string | RegExp)[];
652
711
  /**
653
712
  * Configuration options for the preview server
654
713
  */
@@ -721,14 +780,26 @@ interface CommonUserConfig extends BaseConfig {
721
780
  */
722
781
  framework?: string;
723
782
  }
724
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
725
- build?: TBuildConfig & {
783
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
784
+ /**
785
+ * Configuration provided to build processes
786
+ *
787
+ * @remarks
788
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
789
+ */
790
+ build: Omit<TBuildConfig, "override"> & {
726
791
  /**
727
792
  * The build variant being used by the Powerlines engine.
728
793
  */
729
794
  variant?: TBuildVariant;
795
+ /**
796
+ * An optional set of override options to apply to the selected build variant.
797
+ *
798
+ * @remarks
799
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
800
+ */
801
+ override?: Partial<TBuildResolvedConfig>;
730
802
  };
731
- override?: Partial<TBuildResolvedConfig>;
732
803
  };
733
804
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
734
805
  /**
@@ -797,7 +868,13 @@ interface InitContextOptions {
797
868
  */
798
869
  isHighPriority: boolean;
799
870
  }
800
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
871
+ /**
872
+ * The unresolved Powerlines context.
873
+ *
874
+ * @remarks
875
+ * This context is used before the user configuration has been fully resolved after the `config`.
876
+ */
877
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
801
878
  /**
802
879
  * The Storm workspace configuration
803
880
  */
@@ -805,7 +882,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
805
882
  /**
806
883
  * An object containing the options provided to Powerlines
807
884
  */
808
- config: TResolvedConfig;
885
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
886
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
887
+ output: TResolvedConfig["output"];
888
+ };
809
889
  /**
810
890
  * A logging function for the Powerlines engine
811
891
  */
@@ -962,6 +1042,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
962
1042
  */
963
1043
  extendLog: (name: string) => LogFn;
964
1044
  }
1045
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1046
+ /**
1047
+ * The fully resolved Powerlines configuration
1048
+ */
1049
+ config: TResolvedConfig;
1050
+ };
965
1051
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
966
1052
  /**
967
1053
  * The environment specific resolved configuration
@@ -1,7 +1,8 @@
1
1
  export { ReactCompilerOptions, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig } from './plugin.cjs';
2
2
  export { ReactEnvInterface } from './runtime.cjs';
3
- import '../runtime-CXMswNNM.cjs';
3
+ import '../runtime-BC7ENbDx.cjs';
4
4
  import '@stryke/env/get-env-paths';
5
+ import '@stryke/types/base';
5
6
  import '@stryke/types/package-json';
6
7
  import 'jiti';
7
8
  import 'oxc-parser';
@@ -11,7 +12,6 @@ import '@babel/core';
11
12
  import '@storm-software/build-tools/types';
12
13
  import '@storm-software/config-tools/types';
13
14
  import '@storm-software/config/types';
14
- import '@stryke/types/base';
15
15
  import '@stryke/types/configuration';
16
16
  import '@stryke/types/file';
17
17
  import 'vite';
@@ -1,7 +1,8 @@
1
1
  export { ReactCompilerOptions, ReactPluginContext, ReactPluginOptions, ReactPluginResolvedConfig, ReactPluginUserConfig } from './plugin.js';
2
2
  export { ReactEnvInterface } from './runtime.js';
3
- import '../runtime-Bb7JS9HT.js';
3
+ import '../runtime-DCT7zK30.js';
4
4
  import '@stryke/env/get-env-paths';
5
+ import '@stryke/types/base';
5
6
  import '@stryke/types/package-json';
6
7
  import 'jiti';
7
8
  import 'oxc-parser';
@@ -11,7 +12,6 @@ import '@babel/core';
11
12
  import '@storm-software/build-tools/types';
12
13
  import '@storm-software/config-tools/types';
13
14
  import '@storm-software/config/types';
14
- import '@stryke/types/base';
15
15
  import '@stryke/types/configuration';
16
16
  import '@stryke/types/file';
17
17
  import 'vite';
@@ -1,4 +1,4 @@
1
- import { B as BabelUserConfig, U as UserConfig, R as ResolvedConfig, b as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-CXMswNNM.cjs';
1
+ import { B as BabelUserConfig, U as UserConfig, R as ResolvedConfig, b as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-BC7ENbDx.cjs';
2
2
  import { Children } from '@alloy-js/core/jsx-runtime';
3
3
  import { ReflectionClass } from '@deepkit/type';
4
4
  import * as $ from '@stryke/capnp';
@@ -6,6 +6,7 @@ import { DotenvParseOutput } from '@stryke/env/types';
6
6
  import { DotenvConfiguration, TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
7
7
  import { PluginOptions } from 'babel-plugin-react-compiler';
8
8
  import '@stryke/env/get-env-paths';
9
+ import '@stryke/types/base';
9
10
  import '@stryke/types/package-json';
10
11
  import 'jiti';
11
12
  import 'oxc-parser';
@@ -15,7 +16,6 @@ import '@babel/core';
15
16
  import '@storm-software/build-tools/types';
16
17
  import '@storm-software/config-tools/types';
17
18
  import '@storm-software/config/types';
18
- import '@stryke/types/base';
19
19
  import '@stryke/types/file';
20
20
  import 'vite';
21
21
  import '@babel/helper-plugin-utils';
@@ -1,4 +1,4 @@
1
- import { B as BabelUserConfig, U as UserConfig, R as ResolvedConfig, b as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-Bb7JS9HT.js';
1
+ import { B as BabelUserConfig, U as UserConfig, R as ResolvedConfig, b as BabelResolvedConfig, P as PluginContext, E as EnvInterface, S as SecretsInterface } from '../runtime-DCT7zK30.js';
2
2
  import { Children } from '@alloy-js/core/jsx-runtime';
3
3
  import { ReflectionClass } from '@deepkit/type';
4
4
  import * as $ from '@stryke/capnp';
@@ -6,6 +6,7 @@ import { DotenvParseOutput } from '@stryke/env/types';
6
6
  import { DotenvConfiguration, TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
7
7
  import { PluginOptions } from 'babel-plugin-react-compiler';
8
8
  import '@stryke/env/get-env-paths';
9
+ import '@stryke/types/base';
9
10
  import '@stryke/types/package-json';
10
11
  import 'jiti';
11
12
  import 'oxc-parser';
@@ -15,7 +16,6 @@ import '@babel/core';
15
16
  import '@storm-software/build-tools/types';
16
17
  import '@storm-software/config-tools/types';
17
18
  import '@storm-software/config/types';
18
- import '@stryke/types/base';
19
19
  import '@stryke/types/file';
20
20
  import 'vite';
21
21
  import '@babel/helper-plugin-utils';
@@ -1,5 +1,6 @@
1
- import { E as EnvInterface } from '../runtime-CXMswNNM.cjs';
1
+ import { E as EnvInterface } from '../runtime-BC7ENbDx.cjs';
2
2
  import '@stryke/env/get-env-paths';
3
+ import '@stryke/types/base';
3
4
  import '@stryke/types/package-json';
4
5
  import 'jiti';
5
6
  import 'oxc-parser';
@@ -9,7 +10,6 @@ import '@babel/core';
9
10
  import '@storm-software/build-tools/types';
10
11
  import '@storm-software/config-tools/types';
11
12
  import '@storm-software/config/types';
12
- import '@stryke/types/base';
13
13
  import '@stryke/types/configuration';
14
14
  import '@stryke/types/file';
15
15
  import 'vite';
@@ -1,5 +1,6 @@
1
- import { E as EnvInterface } from '../runtime-Bb7JS9HT.js';
1
+ import { E as EnvInterface } from '../runtime-DCT7zK30.js';
2
2
  import '@stryke/env/get-env-paths';
3
+ import '@stryke/types/base';
3
4
  import '@stryke/types/package-json';
4
5
  import 'jiti';
5
6
  import 'oxc-parser';
@@ -9,7 +10,6 @@ import '@babel/core';
9
10
  import '@storm-software/build-tools/types';
10
11
  import '@storm-software/config-tools/types';
11
12
  import '@storm-software/config/types';
12
- import '@stryke/types/base';
13
13
  import '@stryke/types/configuration';
14
14
  import '@stryke/types/file';
15
15
  import 'vite';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-react",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for building a React application.",
6
6
  "repository": {
@@ -130,19 +130,19 @@
130
130
  "@stryke/fs": "^0.32.13",
131
131
  "@stryke/path": "^0.19.2",
132
132
  "babel-plugin-react-compiler": "^1.0.0",
133
- "@powerlines/alloy": "^0.11.18",
134
- "@powerlines/plugin-babel": "^0.12.18",
135
- "@powerlines/plugin-env": "^0.13.15",
136
- "@powerlines/plugin-plugin": "^0.11.17",
133
+ "@powerlines/alloy": "^0.11.19",
134
+ "@powerlines/plugin-babel": "^0.12.19",
135
+ "@powerlines/plugin-env": "^0.13.16",
136
+ "@powerlines/plugin-plugin": "^0.11.18",
137
137
  "@vitejs/plugin-react": "^5.1.1",
138
138
  "defu": "^6.1.4",
139
- "powerlines": "^0.19.5"
139
+ "powerlines": "^0.20.0"
140
140
  },
141
141
  "devDependencies": {
142
- "@powerlines/nx": "^0.10.9",
142
+ "@powerlines/nx": "^0.10.10",
143
143
  "@storm-software/tsup": "^0.2.38",
144
144
  "@types/node": "^22.19.1"
145
145
  },
146
146
  "publishConfig": { "access": "public" },
147
- "gitHead": "041609f2ea8770273cff82b402e3abdc3fcd9133"
147
+ "gitHead": "e33924ab31dbf508b8983523edbaecffeebbee4f"
148
148
  }