@powerlines/plugin-react 0.1.9 → 0.1.11
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/components/index.d.cts +1 -3
- package/dist/components/index.d.ts +1 -3
- package/dist/components/react-optimized.d.cts +1 -3
- package/dist/components/react-optimized.d.ts +1 -3
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +2 -2
- package/dist/{runtime-Bb7JS9HT.d.ts → runtime-BKpao7nk.d.cts} +165 -63
- package/dist/{runtime-CXMswNNM.d.cts → runtime-DNQO2Zr2.d.ts} +165 -63
- package/dist/types/index.d.cts +3 -5
- package/dist/types/index.d.ts +3 -5
- package/dist/types/plugin.d.cts +3 -5
- package/dist/types/plugin.d.ts +3 -5
- package/dist/types/runtime.d.cts +3 -5
- package/dist/types/runtime.d.ts +3 -5
- package/dist/{vfs-Bl84Hw2V.d.cts → vfs-BGmsy47f.d.cts} +36 -52
- package/dist/{vfs-Bl84Hw2V.d.ts → vfs-BGmsy47f.d.ts} +36 -52
- package/package.json +8 -8
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps } from './react-optimized.cjs';
|
|
2
2
|
import '@alloy-js/core';
|
|
3
3
|
import '@alloy-js/core/jsx-runtime';
|
|
4
|
-
import '../vfs-
|
|
4
|
+
import '../vfs-BGmsy47f.cjs';
|
|
5
5
|
import '@stryke/json/types';
|
|
6
|
-
import 'memfs';
|
|
7
6
|
import 'node:fs';
|
|
8
|
-
import 'unionfs';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export { ReactOptimizedBuiltin, ReactOptimizedBuiltinProps } from './react-optimized.js';
|
|
2
2
|
import '@alloy-js/core';
|
|
3
3
|
import '@alloy-js/core/jsx-runtime';
|
|
4
|
-
import '../vfs-
|
|
4
|
+
import '../vfs-BGmsy47f.js';
|
|
5
5
|
import '@stryke/json/types';
|
|
6
|
-
import 'memfs';
|
|
7
6
|
import 'node:fs';
|
|
8
|
-
import 'unionfs';
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as _alloy_js_core from '@alloy-js/core';
|
|
2
2
|
import { Children as Children$1, SourceFileProps as SourceFileProps$1 } from '@alloy-js/core';
|
|
3
3
|
import { Children } from '@alloy-js/core/jsx-runtime';
|
|
4
|
-
import { O as OutputModeType } from '../vfs-
|
|
4
|
+
import { O as OutputModeType } from '../vfs-BGmsy47f.cjs';
|
|
5
5
|
import '@stryke/json/types';
|
|
6
|
-
import 'memfs';
|
|
7
6
|
import 'node:fs';
|
|
8
|
-
import 'unionfs';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* A type that represents the props of a component that can have children.
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as _alloy_js_core from '@alloy-js/core';
|
|
2
2
|
import { Children as Children$1, SourceFileProps as SourceFileProps$1 } from '@alloy-js/core';
|
|
3
3
|
import { Children } from '@alloy-js/core/jsx-runtime';
|
|
4
|
-
import { O as OutputModeType } from '../vfs-
|
|
4
|
+
import { O as OutputModeType } from '../vfs-BGmsy47f.js';
|
|
5
5
|
import '@stryke/json/types';
|
|
6
|
-
import 'memfs';
|
|
7
6
|
import 'node:fs';
|
|
8
|
-
import 'unionfs';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* A type that represents the props of a component that can have children.
|
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'),
|
|
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:[
|
|
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-
|
|
1
|
+
import { P as PluginContext, a as Plugin } from './runtime-BKpao7nk.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';
|
|
@@ -23,11 +23,9 @@ import '@babel/helper-plugin-utils';
|
|
|
23
23
|
import '@stryke/types/array';
|
|
24
24
|
import '@stryke/types/tsconfig';
|
|
25
25
|
import 'typescript';
|
|
26
|
-
import './vfs-
|
|
26
|
+
import './vfs-BGmsy47f.cjs';
|
|
27
27
|
import '@stryke/json/types';
|
|
28
|
-
import 'memfs';
|
|
29
28
|
import 'node:fs';
|
|
30
|
-
import 'unionfs';
|
|
31
29
|
import '@deepkit/type';
|
|
32
30
|
import '@stryke/capnp';
|
|
33
31
|
import '@stryke/env/types';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PluginContext, a as Plugin } from './runtime-
|
|
1
|
+
import { P as PluginContext, a as Plugin } from './runtime-DNQO2Zr2.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';
|
|
@@ -23,11 +23,9 @@ import '@babel/helper-plugin-utils';
|
|
|
23
23
|
import '@stryke/types/array';
|
|
24
24
|
import '@stryke/types/tsconfig';
|
|
25
25
|
import 'typescript';
|
|
26
|
-
import './vfs-
|
|
26
|
+
import './vfs-BGmsy47f.js';
|
|
27
27
|
import '@stryke/json/types';
|
|
28
|
-
import 'memfs';
|
|
29
28
|
import 'node:fs';
|
|
30
|
-
import 'unionfs';
|
|
31
29
|
import '@deepkit/type';
|
|
32
30
|
import '@stryke/capnp';
|
|
33
31
|
import '@stryke/env/types';
|
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
|
|
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:[
|
|
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,
|
|
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';
|
|
@@ -16,7 +16,7 @@ import { BabelAPI } from '@babel/helper-plugin-utils';
|
|
|
16
16
|
import { ArrayValues } from '@stryke/types/array';
|
|
17
17
|
import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
|
|
18
18
|
import ts from 'typescript';
|
|
19
|
-
import { O as OutputModeType, V as VirtualFileSystemInterface, a as VirtualFile, P as PowerlinesWriteFileOptions } from './vfs-
|
|
19
|
+
import { O as OutputModeType, V as VirtualFileSystemInterface, a as VirtualFile, P as PowerlinesWriteFileOptions } from './vfs-BGmsy47f.cjs';
|
|
20
20
|
|
|
21
21
|
type BabelPluginPass<TState = unknown> = PluginPass & TState;
|
|
22
22
|
type BabelTransformPluginFilter = (code: string, id: string) => boolean;
|
|
@@ -44,6 +44,87 @@ interface BuildConfig {
|
|
|
44
44
|
* @defaultValue "neutral"
|
|
45
45
|
*/
|
|
46
46
|
platform?: "node" | "browser" | "neutral";
|
|
47
|
+
/**
|
|
48
|
+
* Array of strings indicating the polyfills to include for the build.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* {
|
|
56
|
+
* polyfill: ['{projectRoot}/custom-polyfill.ts']
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
polyfill?: string[];
|
|
61
|
+
/**
|
|
62
|
+
* 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.
|
|
63
|
+
*
|
|
64
|
+
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
65
|
+
*/
|
|
66
|
+
mainFields?: string[];
|
|
67
|
+
/**
|
|
68
|
+
* Array of strings indicating what conditions should be used for module resolution.
|
|
69
|
+
*/
|
|
70
|
+
conditions?: string[];
|
|
71
|
+
/**
|
|
72
|
+
* Array of strings indicating what file extensions should be used for module resolution.
|
|
73
|
+
*
|
|
74
|
+
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
75
|
+
*/
|
|
76
|
+
extensions?: string[];
|
|
77
|
+
/**
|
|
78
|
+
* Array of strings indicating what modules should be deduplicated to a single version in the build.
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* 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.
|
|
82
|
+
*/
|
|
83
|
+
dedupe?: string[];
|
|
84
|
+
/**
|
|
85
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
86
|
+
*/
|
|
87
|
+
builtins?: (string | RegExp)[];
|
|
88
|
+
/**
|
|
89
|
+
* Define global variable replacements.
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* 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.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* {
|
|
97
|
+
* define: {
|
|
98
|
+
* __VERSION__: '"1.0.0"',
|
|
99
|
+
* __DEV__: 'process.env.NODE_ENV !== "production"'
|
|
100
|
+
* }
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @see https://esbuild.github.io/api/#define
|
|
105
|
+
* @see https://vitejs.dev/config/build-options.html#define
|
|
106
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/replace
|
|
107
|
+
*/
|
|
108
|
+
define?: Record<string, any>;
|
|
109
|
+
/**
|
|
110
|
+
* Global variables that will have import statements injected where necessary
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* 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.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* {
|
|
118
|
+
* inject: {
|
|
119
|
+
* process: 'process/browser',
|
|
120
|
+
* Buffer: ['buffer', 'Buffer'],
|
|
121
|
+
* }
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/inject
|
|
126
|
+
*/
|
|
127
|
+
inject?: Record<string, string | string[]>;
|
|
47
128
|
/**
|
|
48
129
|
* The alias mappings to use for module resolution during the build process.
|
|
49
130
|
*
|
|
@@ -59,8 +140,13 @@ interface BuildConfig {
|
|
|
59
140
|
* }
|
|
60
141
|
* }
|
|
61
142
|
* ```
|
|
143
|
+
*
|
|
144
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/alias
|
|
62
145
|
*/
|
|
63
|
-
alias?: Record<string, string
|
|
146
|
+
alias?: Record<string, string> | Array<{
|
|
147
|
+
find: string | RegExp;
|
|
148
|
+
replacement: string;
|
|
149
|
+
}>;
|
|
64
150
|
/**
|
|
65
151
|
* A list of modules that should not be bundled, even if they are external dependencies.
|
|
66
152
|
*
|
|
@@ -77,15 +163,16 @@ interface BuildConfig {
|
|
|
77
163
|
*/
|
|
78
164
|
skipNodeModulesBundle?: boolean;
|
|
79
165
|
/**
|
|
80
|
-
*
|
|
166
|
+
* An optional set of override options to apply to the selected build variant.
|
|
81
167
|
*
|
|
82
|
-
* @
|
|
168
|
+
* @remarks
|
|
169
|
+
* 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
170
|
*/
|
|
84
|
-
|
|
171
|
+
override?: Record<string, any>;
|
|
85
172
|
}
|
|
86
|
-
type BuildResolvedConfig = BuildConfig
|
|
173
|
+
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
87
174
|
|
|
88
|
-
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "
|
|
175
|
+
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
|
|
89
176
|
type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
|
|
90
177
|
|
|
91
178
|
interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
@@ -99,7 +186,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
|
99
186
|
output?: string;
|
|
100
187
|
}
|
|
101
188
|
type BabelResolvedConfig = Omit<BabelUserConfig, "plugins" | "presets"> & Required<Pick<BabelUserConfig, "plugins" | "presets">>;
|
|
102
|
-
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"
|
|
189
|
+
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
|
|
103
190
|
/**
|
|
104
191
|
* The name of the environment
|
|
105
192
|
*/
|
|
@@ -116,7 +203,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
|
|
|
116
203
|
/**
|
|
117
204
|
* The resolved options for the Powerlines project configuration.
|
|
118
205
|
*/
|
|
119
|
-
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "
|
|
206
|
+
type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework">> & {
|
|
120
207
|
/**
|
|
121
208
|
* The configuration options that were provided inline to the Powerlines CLI.
|
|
122
209
|
*/
|
|
@@ -147,6 +234,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
|
|
|
147
234
|
* The output configuration options to use for the build process
|
|
148
235
|
*/
|
|
149
236
|
output: OutputResolvedConfig;
|
|
237
|
+
/**
|
|
238
|
+
* Configuration provided to build processes
|
|
239
|
+
*
|
|
240
|
+
* @remarks
|
|
241
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
|
|
242
|
+
*/
|
|
243
|
+
build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
|
|
150
244
|
/**
|
|
151
245
|
* The log level to use for the Powerlines processes.
|
|
152
246
|
*
|
|
@@ -177,6 +271,10 @@ interface GenerateTypesResult {
|
|
|
177
271
|
directives?: string[];
|
|
178
272
|
code: string;
|
|
179
273
|
}
|
|
274
|
+
type DeepPartial<T> = {
|
|
275
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
276
|
+
};
|
|
277
|
+
type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
|
|
180
278
|
interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
|
|
181
279
|
/**
|
|
182
280
|
* A function that returns configuration options to be merged with the build context's options.
|
|
@@ -192,7 +290,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
|
|
|
192
290
|
* @param config - The partial configuration object to be modified.
|
|
193
291
|
* @returns A promise that resolves to a partial configuration object.
|
|
194
292
|
*/
|
|
195
|
-
config: (this:
|
|
293
|
+
config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
|
|
196
294
|
/**
|
|
197
295
|
* 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
296
|
*
|
|
@@ -295,7 +393,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
|
|
|
295
393
|
* @param config - The partial configuration object to be modified.
|
|
296
394
|
* @returns A promise that resolves to a partial configuration object.
|
|
297
395
|
*/
|
|
298
|
-
config: PluginHook<(this:
|
|
396
|
+
config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
|
|
299
397
|
/**
|
|
300
398
|
* A hook that is called to transform the source code.
|
|
301
399
|
*
|
|
@@ -571,24 +669,33 @@ interface BaseConfig {
|
|
|
571
669
|
* The entry point(s) for the application
|
|
572
670
|
*/
|
|
573
671
|
entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
|
|
672
|
+
/**
|
|
673
|
+
* Configuration for the output of the build process
|
|
674
|
+
*/
|
|
675
|
+
output?: OutputConfig;
|
|
574
676
|
/**
|
|
575
677
|
* Configuration for linting the source code
|
|
678
|
+
*
|
|
679
|
+
* @remarks
|
|
680
|
+
* If set to `false`, linting will be disabled.
|
|
576
681
|
*/
|
|
577
682
|
lint?: Record<string, any> | false;
|
|
578
683
|
/**
|
|
579
684
|
* Configuration for testing the source code
|
|
685
|
+
*
|
|
686
|
+
* @remarks
|
|
687
|
+
* If set to `false`, testing will be disabled.
|
|
580
688
|
*/
|
|
581
689
|
test?: Record<string, any> | false;
|
|
582
|
-
/**
|
|
583
|
-
* Configuration for the output of the build process
|
|
584
|
-
*/
|
|
585
|
-
output?: OutputConfig;
|
|
586
690
|
/**
|
|
587
691
|
* Configuration for the transformation of the source code
|
|
588
692
|
*/
|
|
589
693
|
transform?: Record<string, any>;
|
|
590
694
|
/**
|
|
591
|
-
*
|
|
695
|
+
* Configuration provided to build processes
|
|
696
|
+
*
|
|
697
|
+
* @remarks
|
|
698
|
+
* 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
699
|
*/
|
|
593
700
|
build?: BuildConfig;
|
|
594
701
|
/**
|
|
@@ -598,6 +705,13 @@ interface BaseConfig {
|
|
|
598
705
|
* This configuration will be used by the documentation generation plugins during the `docs` command.
|
|
599
706
|
*/
|
|
600
707
|
docs?: Record<string, any>;
|
|
708
|
+
/**
|
|
709
|
+
* Configuration for deploying the source code
|
|
710
|
+
*
|
|
711
|
+
* @remarks
|
|
712
|
+
* If set to `false`, the deployment will be disabled.
|
|
713
|
+
*/
|
|
714
|
+
deploy?: Record<string, any> | false;
|
|
601
715
|
/**
|
|
602
716
|
* The path to the tsconfig file to be used by the compiler
|
|
603
717
|
*
|
|
@@ -618,37 +732,6 @@ interface BaseConfig {
|
|
|
618
732
|
tsconfigRaw?: TSConfig;
|
|
619
733
|
}
|
|
620
734
|
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
735
|
/**
|
|
653
736
|
* Configuration options for the preview server
|
|
654
737
|
*/
|
|
@@ -721,16 +804,28 @@ interface CommonUserConfig extends BaseConfig {
|
|
|
721
804
|
*/
|
|
722
805
|
framework?: string;
|
|
723
806
|
}
|
|
724
|
-
type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
|
|
725
|
-
|
|
807
|
+
type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
|
|
808
|
+
/**
|
|
809
|
+
* Configuration provided to build processes
|
|
810
|
+
*
|
|
811
|
+
* @remarks
|
|
812
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
|
|
813
|
+
*/
|
|
814
|
+
build: Omit<TBuildConfig, "override"> & {
|
|
726
815
|
/**
|
|
727
816
|
* The build variant being used by the Powerlines engine.
|
|
728
817
|
*/
|
|
729
818
|
variant?: TBuildVariant;
|
|
819
|
+
/**
|
|
820
|
+
* An optional set of override options to apply to the selected build variant.
|
|
821
|
+
*
|
|
822
|
+
* @remarks
|
|
823
|
+
* 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.
|
|
824
|
+
*/
|
|
825
|
+
override?: Partial<TBuildResolvedConfig>;
|
|
730
826
|
};
|
|
731
|
-
override?: Partial<TBuildResolvedConfig>;
|
|
732
827
|
};
|
|
733
|
-
type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "
|
|
828
|
+
type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
|
|
734
829
|
/**
|
|
735
830
|
* The configuration provided while executing Powerlines commands.
|
|
736
831
|
*/
|
|
@@ -777,14 +872,6 @@ interface MetaInfo {
|
|
|
777
872
|
* A hash that represents the path to the project root directory
|
|
778
873
|
*/
|
|
779
874
|
configHash: string;
|
|
780
|
-
/**
|
|
781
|
-
* A mapping of runtime ids to their corresponding file paths
|
|
782
|
-
*/
|
|
783
|
-
builtinIdMap: Record<string, string>;
|
|
784
|
-
/**
|
|
785
|
-
* A mapping of virtual file paths to their corresponding file contents
|
|
786
|
-
*/
|
|
787
|
-
virtualFiles: Record<string, string | null>;
|
|
788
875
|
}
|
|
789
876
|
interface Resolver extends Jiti {
|
|
790
877
|
plugin: Jiti;
|
|
@@ -797,7 +884,13 @@ interface InitContextOptions {
|
|
|
797
884
|
*/
|
|
798
885
|
isHighPriority: boolean;
|
|
799
886
|
}
|
|
800
|
-
|
|
887
|
+
/**
|
|
888
|
+
* The unresolved Powerlines context.
|
|
889
|
+
*
|
|
890
|
+
* @remarks
|
|
891
|
+
* This context is used before the user configuration has been fully resolved after the `config`.
|
|
892
|
+
*/
|
|
893
|
+
interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
801
894
|
/**
|
|
802
895
|
* The Storm workspace configuration
|
|
803
896
|
*/
|
|
@@ -805,7 +898,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
|
805
898
|
/**
|
|
806
899
|
* An object containing the options provided to Powerlines
|
|
807
900
|
*/
|
|
808
|
-
config: TResolvedConfig
|
|
901
|
+
config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
|
|
902
|
+
projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
|
|
903
|
+
output: TResolvedConfig["output"];
|
|
904
|
+
};
|
|
809
905
|
/**
|
|
810
906
|
* A logging function for the Powerlines engine
|
|
811
907
|
*/
|
|
@@ -962,6 +1058,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
|
962
1058
|
*/
|
|
963
1059
|
extendLog: (name: string) => LogFn;
|
|
964
1060
|
}
|
|
1061
|
+
type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
|
|
1062
|
+
/**
|
|
1063
|
+
* The fully resolved Powerlines configuration
|
|
1064
|
+
*/
|
|
1065
|
+
config: TResolvedConfig;
|
|
1066
|
+
};
|
|
965
1067
|
interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
|
|
966
1068
|
/**
|
|
967
1069
|
* The environment specific resolved configuration
|