@powerlines/plugin-oxc-transform 0.5.67 → 0.5.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +1 -1
- package/dist/powerlines/src/types/build.d.cts +139 -0
- package/dist/powerlines/src/types/build.d.mts +139 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +8 -0
- package/dist/powerlines/src/types/config.d.cts +345 -0
- package/dist/powerlines/src/types/config.d.mts +345 -0
- package/dist/powerlines/src/types/context.d.cts +347 -0
- package/dist/powerlines/src/types/context.d.mts +347 -0
- package/dist/powerlines/src/types/fs.d.cts +458 -0
- package/dist/powerlines/src/types/fs.d.mts +458 -0
- package/dist/powerlines/src/types/plugin.d.cts +232 -0
- package/dist/powerlines/src/types/plugin.d.mts +232 -0
- package/dist/powerlines/src/types/resolved.d.cts +81 -0
- package/dist/powerlines/src/types/resolved.d.mts +81 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/types/index.cjs +0 -1
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.mts +1 -2
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +23 -1
- package/dist/types/plugin.d.mts +23 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +6 -6
- package/dist/index-BgAdqTbb.d.mts +0 -1
- package/dist/index-CEgs-Dz2.d.cts +0 -1
- package/dist/plugin-Biqbm7Ye.d.mts +0 -1655
- package/dist/plugin-Bvn-he2n.mjs +0 -1
- package/dist/plugin-CeRe_T8U.d.cts +0 -1655
- package/dist/plugin-DHXHjv16.cjs +0 -0
- package/dist/types-B7VYa_Pp.mjs +0 -1
- package/dist/types-DHkg7xmX.cjs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,`__esModule`,{value:!0});
|
|
1
|
+
Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/find`),n=require(`defu`);n=e.__toESM(n);let r=require(`oxc-transform`);const i=(e={})=>({name:`oxc-transform`,config(){return{transform:{oxc:(0,n.default)(e,{sourceType:`module`,cwd:this.config.projectRoot,envName:this.config.mode,outputPath:this.config.output.buildPath,sourcemap:this.config.mode===`development`})}}},async transform(e,n){let i=await(0,r.transform)(n,e,{lang:[`d.ts`,`d.cts`,`d.mts`].includes((0,t.findFileExtensionSafe)(n))?`dts`:(0,t.findFileExtension)(n),...this.config.transform.oxc});return{id:n,code:i.code,map:i.map}}});var a=i;exports.default=a,exports.plugin=i;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
1
|
+
import { Plugin } from "./powerlines/src/types/plugin.cjs";
|
|
2
|
+
import { OxcTransformPluginContext, OxcTransformPluginOptions, OxcTransformPluginResolvedConfig, OxcTransformPluginUserConfig, __ΩOxcTransformPluginContext, __ΩOxcTransformPluginOptions, __ΩOxcTransformPluginResolvedConfig, __ΩOxcTransformPluginUserConfig } from "./types/plugin.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
5
5
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
1
|
+
import { Plugin } from "./powerlines/src/types/plugin.mjs";
|
|
2
|
+
import { OxcTransformPluginContext, OxcTransformPluginOptions, OxcTransformPluginResolvedConfig, OxcTransformPluginUserConfig, __ΩOxcTransformPluginContext, __ΩOxcTransformPluginOptions, __ΩOxcTransformPluginResolvedConfig, __ΩOxcTransformPluginUserConfig } from "./types/plugin.mjs";
|
|
3
|
+
import "./types/index.mjs";
|
|
3
4
|
|
|
4
5
|
//#region src/index.d.ts
|
|
5
6
|
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{findFileExtension as e,findFileExtensionSafe as t}from"@stryke/path/find";import n from"defu";import{transform as r}from"oxc-transform";const i=(i={})=>({name:`oxc-transform`,config(){return{transform:{oxc:n(i,{sourceType:`module`,cwd:this.config.projectRoot,envName:this.config.mode,outputPath:this.config.output.buildPath,sourcemap:this.config.mode===`development`})}}},async transform(n,i){let a=await r(i,n,{lang:[`d.ts`,`d.cts`,`d.mts`].includes(t(i))?`dts`:e(i),...this.config.transform.oxc});return{id:i,code:a.code,map:a.map}}});var a=i;export{a as default,i as plugin};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
//#region ../powerlines/src/types/build.d.ts
|
|
2
|
+
|
|
3
|
+
type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
|
|
4
|
+
interface BuildConfig {
|
|
5
|
+
/**
|
|
6
|
+
* The platform to build the project for
|
|
7
|
+
*
|
|
8
|
+
* @defaultValue "neutral"
|
|
9
|
+
*/
|
|
10
|
+
platform?: "node" | "browser" | "neutral";
|
|
11
|
+
/**
|
|
12
|
+
* Array of strings indicating the polyfills to include for the build.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* 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).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* {
|
|
20
|
+
* polyfill: ['{projectRoot}/custom-polyfill.ts']
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
polyfill?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* 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.
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
29
|
+
*/
|
|
30
|
+
mainFields?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Array of strings indicating what conditions should be used for module resolution.
|
|
33
|
+
*/
|
|
34
|
+
conditions?: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Array of strings indicating what file extensions should be used for module resolution.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
39
|
+
*/
|
|
40
|
+
extensions?: string[];
|
|
41
|
+
/**
|
|
42
|
+
* Array of strings indicating what modules should be deduplicated to a single version in the build.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* 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.
|
|
46
|
+
*/
|
|
47
|
+
dedupe?: string[];
|
|
48
|
+
/**
|
|
49
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
50
|
+
*/
|
|
51
|
+
builtins?: (string | RegExp)[];
|
|
52
|
+
/**
|
|
53
|
+
* Define global variable replacements.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* 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.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* {
|
|
61
|
+
* define: {
|
|
62
|
+
* __VERSION__: '"1.0.0"',
|
|
63
|
+
* __DEV__: 'process.env.NODE_ENV !== "production"'
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @see https://esbuild.github.io/api/#define
|
|
69
|
+
* @see https://vitejs.dev/config/build-options.html#define
|
|
70
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/replace
|
|
71
|
+
*/
|
|
72
|
+
define?: Record<string, any>;
|
|
73
|
+
/**
|
|
74
|
+
* Global variables that will have import statements injected where necessary
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* 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.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* {
|
|
82
|
+
* inject: {
|
|
83
|
+
* process: 'process/browser',
|
|
84
|
+
* Buffer: ['buffer', 'Buffer'],
|
|
85
|
+
* }
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/inject
|
|
90
|
+
*/
|
|
91
|
+
inject?: Record<string, string | string[]>;
|
|
92
|
+
/**
|
|
93
|
+
* The alias mappings to use for module resolution during the build process.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* {
|
|
101
|
+
* alias: {
|
|
102
|
+
* "@utils": "./src/utils",
|
|
103
|
+
* "@components": "./src/components"
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/alias
|
|
109
|
+
*/
|
|
110
|
+
alias?: Record<string, string> | Array<{
|
|
111
|
+
find: string | RegExp;
|
|
112
|
+
replacement: string;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* A list of modules that should not be bundled, even if they are external dependencies.
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.
|
|
119
|
+
*/
|
|
120
|
+
external?: (string | RegExp)[];
|
|
121
|
+
/**
|
|
122
|
+
* A list of modules that should always be bundled, even if they are external dependencies.
|
|
123
|
+
*/
|
|
124
|
+
noExternal?: (string | RegExp)[];
|
|
125
|
+
/**
|
|
126
|
+
* Should the Powerlines CLI processes skip bundling the `node_modules` directory?
|
|
127
|
+
*/
|
|
128
|
+
skipNodeModulesBundle?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* An optional set of override options to apply to the selected build variant.
|
|
131
|
+
*
|
|
132
|
+
* @remarks
|
|
133
|
+
* 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.
|
|
134
|
+
*/
|
|
135
|
+
override?: Record<string, any>;
|
|
136
|
+
}
|
|
137
|
+
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
138
|
+
//#endregion
|
|
139
|
+
export { BuildConfig, BuildResolvedConfig, UnpluginBuildVariant };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
//#region ../powerlines/src/types/build.d.ts
|
|
2
|
+
|
|
3
|
+
type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
|
|
4
|
+
interface BuildConfig {
|
|
5
|
+
/**
|
|
6
|
+
* The platform to build the project for
|
|
7
|
+
*
|
|
8
|
+
* @defaultValue "neutral"
|
|
9
|
+
*/
|
|
10
|
+
platform?: "node" | "browser" | "neutral";
|
|
11
|
+
/**
|
|
12
|
+
* Array of strings indicating the polyfills to include for the build.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* 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).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* {
|
|
20
|
+
* polyfill: ['{projectRoot}/custom-polyfill.ts']
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
polyfill?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* 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.
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
29
|
+
*/
|
|
30
|
+
mainFields?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Array of strings indicating what conditions should be used for module resolution.
|
|
33
|
+
*/
|
|
34
|
+
conditions?: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Array of strings indicating what file extensions should be used for module resolution.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
39
|
+
*/
|
|
40
|
+
extensions?: string[];
|
|
41
|
+
/**
|
|
42
|
+
* Array of strings indicating what modules should be deduplicated to a single version in the build.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* 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.
|
|
46
|
+
*/
|
|
47
|
+
dedupe?: string[];
|
|
48
|
+
/**
|
|
49
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
50
|
+
*/
|
|
51
|
+
builtins?: (string | RegExp)[];
|
|
52
|
+
/**
|
|
53
|
+
* Define global variable replacements.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* 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.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* {
|
|
61
|
+
* define: {
|
|
62
|
+
* __VERSION__: '"1.0.0"',
|
|
63
|
+
* __DEV__: 'process.env.NODE_ENV !== "production"'
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @see https://esbuild.github.io/api/#define
|
|
69
|
+
* @see https://vitejs.dev/config/build-options.html#define
|
|
70
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/replace
|
|
71
|
+
*/
|
|
72
|
+
define?: Record<string, any>;
|
|
73
|
+
/**
|
|
74
|
+
* Global variables that will have import statements injected where necessary
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* 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.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* {
|
|
82
|
+
* inject: {
|
|
83
|
+
* process: 'process/browser',
|
|
84
|
+
* Buffer: ['buffer', 'Buffer'],
|
|
85
|
+
* }
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/inject
|
|
90
|
+
*/
|
|
91
|
+
inject?: Record<string, string | string[]>;
|
|
92
|
+
/**
|
|
93
|
+
* The alias mappings to use for module resolution during the build process.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* {
|
|
101
|
+
* alias: {
|
|
102
|
+
* "@utils": "./src/utils",
|
|
103
|
+
* "@components": "./src/components"
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/alias
|
|
109
|
+
*/
|
|
110
|
+
alias?: Record<string, string> | Array<{
|
|
111
|
+
find: string | RegExp;
|
|
112
|
+
replacement: string;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* A list of modules that should not be bundled, even if they are external dependencies.
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.
|
|
119
|
+
*/
|
|
120
|
+
external?: (string | RegExp)[];
|
|
121
|
+
/**
|
|
122
|
+
* A list of modules that should always be bundled, even if they are external dependencies.
|
|
123
|
+
*/
|
|
124
|
+
noExternal?: (string | RegExp)[];
|
|
125
|
+
/**
|
|
126
|
+
* Should the Powerlines CLI processes skip bundling the `node_modules` directory?
|
|
127
|
+
*/
|
|
128
|
+
skipNodeModulesBundle?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* An optional set of override options to apply to the selected build variant.
|
|
131
|
+
*
|
|
132
|
+
* @remarks
|
|
133
|
+
* 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.
|
|
134
|
+
*/
|
|
135
|
+
override?: Record<string, any>;
|
|
136
|
+
}
|
|
137
|
+
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
138
|
+
//#endregion
|
|
139
|
+
export { BuildConfig, BuildResolvedConfig, UnpluginBuildVariant };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ArrayValues } from "@stryke/types/array";
|
|
2
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/types/commands.d.ts
|
|
5
|
+
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
|
|
6
|
+
type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { CommandType };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ArrayValues } from "@stryke/types/array";
|
|
2
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/types/commands.d.ts
|
|
5
|
+
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
|
|
6
|
+
type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { CommandType };
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { BuildConfig, BuildResolvedConfig } from "./build.cjs";
|
|
2
|
+
import { StoragePort, StoragePreset } from "./fs.cjs";
|
|
3
|
+
import { TSConfig } from "./tsconfig.cjs";
|
|
4
|
+
import { PluginContext } from "./context.cjs";
|
|
5
|
+
import { Plugin } from "./plugin.cjs";
|
|
6
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
7
|
+
import { PreviewOptions } from "vite";
|
|
8
|
+
import { Format } from "@storm-software/build-tools/types";
|
|
9
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
10
|
+
import { StormWorkspaceConfig } from "@storm-software/config/types";
|
|
11
|
+
import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
12
|
+
import { AssetGlob } from "@stryke/types/file";
|
|
13
|
+
|
|
14
|
+
//#region ../powerlines/src/types/config.d.ts
|
|
15
|
+
|
|
16
|
+
type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
|
|
17
|
+
/**
|
|
18
|
+
* The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
|
|
19
|
+
*/
|
|
20
|
+
type WorkspaceConfig = Partial<StormWorkspaceConfig> & Required<Pick<StormWorkspaceConfig, "workspaceRoot">>;
|
|
21
|
+
type PluginFactory<in out TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => MaybePromise<Plugin<TContext>>;
|
|
22
|
+
/**
|
|
23
|
+
* A configuration tuple for a Powerlines plugin.
|
|
24
|
+
*/
|
|
25
|
+
type PluginConfigTuple<TContext extends PluginContext = PluginContext, TOptions = any> = [string | PluginFactory<TContext, TOptions>, TOptions] | [Plugin<TContext>];
|
|
26
|
+
/**
|
|
27
|
+
* A configuration object for a Powerlines plugin.
|
|
28
|
+
*/
|
|
29
|
+
type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions = any> = {
|
|
30
|
+
plugin: string | PluginFactory<TContext, TOptions>;
|
|
31
|
+
options: TOptions;
|
|
32
|
+
} | {
|
|
33
|
+
plugin: Plugin<TContext>;
|
|
34
|
+
options?: never;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* A configuration tuple for a Powerlines plugin.
|
|
38
|
+
*/
|
|
39
|
+
type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | Promise<Plugin<TContext>> | PluginConfigTuple<TContext> | PluginConfigObject<TContext>;
|
|
40
|
+
type ProjectType = "application" | "library";
|
|
41
|
+
interface DeployConfig {
|
|
42
|
+
/**
|
|
43
|
+
* The deployment variant being used by the Powerlines engine.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* export default defineConfig({
|
|
48
|
+
* deploy: {
|
|
49
|
+
* variant: "cloudflare"
|
|
50
|
+
* }
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
variant?: string;
|
|
56
|
+
}
|
|
57
|
+
interface OutputConfig {
|
|
58
|
+
/**
|
|
59
|
+
* The path to output the final compiled files to
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* If a value is not provided, Powerlines will attempt to:
|
|
63
|
+
* 1. Use the `outDir` value in the `tsconfig.json` file.
|
|
64
|
+
* 2. Use the `dist` directory in the project root directory.
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue "dist/\{projectRoot\}"
|
|
67
|
+
*/
|
|
68
|
+
outputPath?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The output directory path for the project build.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* This path is used to determine where the built files will be placed after the build process completes. This will be used in scenarios where the monorepo uses TSConfig paths to link packages together.
|
|
74
|
+
*
|
|
75
|
+
* @defaultValue "\{projectRoot\}/dist"
|
|
76
|
+
*/
|
|
77
|
+
buildPath?: string;
|
|
78
|
+
/**
|
|
79
|
+
* The folder where the generated runtime artifacts will be located
|
|
80
|
+
*
|
|
81
|
+
* @remarks
|
|
82
|
+
* This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
|
|
83
|
+
*
|
|
84
|
+
* @defaultValue "\{projectRoot\}/.powerlines"
|
|
85
|
+
*/
|
|
86
|
+
artifactsPath?: string;
|
|
87
|
+
/**
|
|
88
|
+
* The path of the generated runtime declaration file relative to the workspace root.
|
|
89
|
+
*
|
|
90
|
+
* @defaultValue "\{projectRoot\}/powerlines.d.ts"
|
|
91
|
+
*/
|
|
92
|
+
dts?: string | false;
|
|
93
|
+
/**
|
|
94
|
+
* A prefix to use for identifying builtin modules
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
|
|
98
|
+
*
|
|
99
|
+
* @defaultValue "powerlines"
|
|
100
|
+
*/
|
|
101
|
+
builtinPrefix?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The module format of the output files
|
|
104
|
+
*
|
|
105
|
+
* @remarks
|
|
106
|
+
* This option can be a single format or an array of formats. If an array is provided, multiple builds will be generated for each format.
|
|
107
|
+
*
|
|
108
|
+
* @defaultValue "esm"
|
|
109
|
+
*/
|
|
110
|
+
format?: Format | Format[];
|
|
111
|
+
/**
|
|
112
|
+
* A list of assets to copy to the output directory
|
|
113
|
+
*
|
|
114
|
+
* @remarks
|
|
115
|
+
* The assets can be specified as a string (path to the asset) or as an object with a `glob` property (to match multiple files). The paths are relative to the project root directory.
|
|
116
|
+
*/
|
|
117
|
+
assets?: Array<string | AssetGlob>;
|
|
118
|
+
/**
|
|
119
|
+
* A string preset or a custom {@link StoragePort} to provide fine-grained control over generated/output file storage.
|
|
120
|
+
*
|
|
121
|
+
* @remarks
|
|
122
|
+
* If a string preset is provided, it must be one of the following values:
|
|
123
|
+
* - `"virtual"`: Uses the local file system for storage.
|
|
124
|
+
* - `"fs"`: Uses an in-memory virtual file system for storage.
|
|
125
|
+
*
|
|
126
|
+
* If a custom {@link StoragePort} is provided, it will be used for all file storage operations during the build process.
|
|
127
|
+
*
|
|
128
|
+
* @defaultValue "virtual"
|
|
129
|
+
*/
|
|
130
|
+
storage?: StoragePort | StoragePreset;
|
|
131
|
+
}
|
|
132
|
+
interface BaseConfig {
|
|
133
|
+
/**
|
|
134
|
+
* The entry point(s) for the application
|
|
135
|
+
*/
|
|
136
|
+
entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
|
|
137
|
+
/**
|
|
138
|
+
* Configuration for the output of the build process
|
|
139
|
+
*/
|
|
140
|
+
output?: OutputConfig;
|
|
141
|
+
/**
|
|
142
|
+
* Configuration for cleaning the build artifacts
|
|
143
|
+
*
|
|
144
|
+
* @remarks
|
|
145
|
+
* If set to `false`, the cleaning process will be disabled.
|
|
146
|
+
*/
|
|
147
|
+
clean?: Record<string, any> | false;
|
|
148
|
+
/**
|
|
149
|
+
* Configuration for linting the source code
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* If set to `false`, linting will be disabled.
|
|
153
|
+
*/
|
|
154
|
+
lint?: Record<string, any> | false;
|
|
155
|
+
/**
|
|
156
|
+
* Configuration for testing the source code
|
|
157
|
+
*
|
|
158
|
+
* @remarks
|
|
159
|
+
* If set to `false`, testing will be disabled.
|
|
160
|
+
*/
|
|
161
|
+
test?: Record<string, any> | false;
|
|
162
|
+
/**
|
|
163
|
+
* Configuration for the transformation of the source code
|
|
164
|
+
*/
|
|
165
|
+
transform?: Record<string, any>;
|
|
166
|
+
/**
|
|
167
|
+
* Configuration provided to build processes
|
|
168
|
+
*
|
|
169
|
+
* @remarks
|
|
170
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
|
|
171
|
+
*/
|
|
172
|
+
build?: BuildConfig;
|
|
173
|
+
/**
|
|
174
|
+
* Configuration for documentation generation
|
|
175
|
+
*
|
|
176
|
+
* @remarks
|
|
177
|
+
* This configuration will be used by the documentation generation plugins during the `docs` command.
|
|
178
|
+
*/
|
|
179
|
+
docs?: Record<string, any>;
|
|
180
|
+
/**
|
|
181
|
+
* Configuration for deploying the source code
|
|
182
|
+
*
|
|
183
|
+
* @remarks
|
|
184
|
+
* If set to `false`, the deployment will be disabled.
|
|
185
|
+
*/
|
|
186
|
+
deploy?: DeployConfig | false;
|
|
187
|
+
/**
|
|
188
|
+
* The path to the tsconfig file to be used by the compiler
|
|
189
|
+
*
|
|
190
|
+
* @remarks
|
|
191
|
+
* If a value is not provided, the plugin will attempt to find the `tsconfig.json` file in the project root directory. The parsed tsconfig compiler options will be merged with the {@link Options.tsconfigRaw} value (if provided).
|
|
192
|
+
*
|
|
193
|
+
* @defaultValue "\{projectRoot\}/tsconfig.json"
|
|
194
|
+
*/
|
|
195
|
+
tsconfig?: string;
|
|
196
|
+
/**
|
|
197
|
+
* The raw {@link TSConfig} object to be used by the compiler. This object will be merged with the `tsconfig.json` file.
|
|
198
|
+
*
|
|
199
|
+
* @see https://www.typescriptlang.org/tsconfig
|
|
200
|
+
*
|
|
201
|
+
* @remarks
|
|
202
|
+
* If populated, this option takes higher priority than `tsconfig`
|
|
203
|
+
*/
|
|
204
|
+
tsconfigRaw?: TSConfig;
|
|
205
|
+
}
|
|
206
|
+
interface EnvironmentConfig extends BaseConfig {
|
|
207
|
+
/**
|
|
208
|
+
* Configuration options for the preview server
|
|
209
|
+
*/
|
|
210
|
+
preview?: PreviewOptions;
|
|
211
|
+
/**
|
|
212
|
+
* A flag indicating whether the build is for a Server-Side Rendering environment.
|
|
213
|
+
*/
|
|
214
|
+
ssr?: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Define if this environment is used for Server-Side Rendering
|
|
217
|
+
*
|
|
218
|
+
* @defaultValue "server" (if it isn't the client environment)
|
|
219
|
+
*/
|
|
220
|
+
consumer?: "client" | "server";
|
|
221
|
+
}
|
|
222
|
+
interface CommonUserConfig extends BaseConfig {
|
|
223
|
+
/**
|
|
224
|
+
* The name of the project
|
|
225
|
+
*/
|
|
226
|
+
name?: string;
|
|
227
|
+
/**
|
|
228
|
+
* The project display title
|
|
229
|
+
*
|
|
230
|
+
* @remarks
|
|
231
|
+
* This option is used in documentation generation and other places where a human-readable title is needed.
|
|
232
|
+
*/
|
|
233
|
+
title?: string;
|
|
234
|
+
/**
|
|
235
|
+
* A description of the project
|
|
236
|
+
*
|
|
237
|
+
* @remarks
|
|
238
|
+
* If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
|
|
239
|
+
*/
|
|
240
|
+
description?: string;
|
|
241
|
+
/**
|
|
242
|
+
* The log level to use for the Powerlines processes.
|
|
243
|
+
*
|
|
244
|
+
* @defaultValue "info"
|
|
245
|
+
*/
|
|
246
|
+
logLevel?: LogLevelLabel | null;
|
|
247
|
+
/**
|
|
248
|
+
* A custom logger function to use for logging messages
|
|
249
|
+
*/
|
|
250
|
+
customLogger?: LogFn;
|
|
251
|
+
/**
|
|
252
|
+
* Explicitly set a mode to run in. This mode will be used at various points throughout the Powerlines processes, such as when compiling the source code.
|
|
253
|
+
*
|
|
254
|
+
* @defaultValue "production"
|
|
255
|
+
*/
|
|
256
|
+
mode?: "development" | "test" | "production";
|
|
257
|
+
/**
|
|
258
|
+
* The type of project being built
|
|
259
|
+
*
|
|
260
|
+
* @defaultValue "application"
|
|
261
|
+
*/
|
|
262
|
+
type?: ProjectType;
|
|
263
|
+
/**
|
|
264
|
+
* The root directory of the project
|
|
265
|
+
*/
|
|
266
|
+
root: string;
|
|
267
|
+
/**
|
|
268
|
+
* The root directory of the project's source code
|
|
269
|
+
*
|
|
270
|
+
* @defaultValue "\{root\}/src"
|
|
271
|
+
*/
|
|
272
|
+
sourceRoot?: string;
|
|
273
|
+
/**
|
|
274
|
+
* A path to a custom configuration file to be used instead of the default `storm.json`, `powerlines.config.js`, or `powerlines.config.ts` files.
|
|
275
|
+
*
|
|
276
|
+
* @remarks
|
|
277
|
+
* This option is useful for running Powerlines commands with different configuration files, such as in CI/CD environments or when testing different configurations.
|
|
278
|
+
*/
|
|
279
|
+
configFile?: string;
|
|
280
|
+
/**
|
|
281
|
+
* Should the Powerlines CLI processes skip installing missing packages?
|
|
282
|
+
*
|
|
283
|
+
* @remarks
|
|
284
|
+
* This option is useful for CI/CD environments where the installation of packages is handled by a different process.
|
|
285
|
+
*
|
|
286
|
+
* @defaultValue false
|
|
287
|
+
*/
|
|
288
|
+
skipInstalls?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Should the compiler processes skip any improvements that make use of cache?
|
|
291
|
+
*
|
|
292
|
+
* @defaultValue false
|
|
293
|
+
*/
|
|
294
|
+
skipCache?: boolean;
|
|
295
|
+
/**
|
|
296
|
+
* A list of resolvable paths to plugins used during the build process
|
|
297
|
+
*/
|
|
298
|
+
plugins?: PluginConfig<PluginContext<any>>[];
|
|
299
|
+
/**
|
|
300
|
+
* Environment-specific configurations
|
|
301
|
+
*/
|
|
302
|
+
environments?: Record<string, EnvironmentConfig>;
|
|
303
|
+
/**
|
|
304
|
+
* A string identifier that allows a child framework or tool to identify itself when using Powerlines.
|
|
305
|
+
*
|
|
306
|
+
* @remarks
|
|
307
|
+
* If no values are provided for {@link OutputConfig.dts | output.dts}, {@link OutputConfig.builtinPrefix | output.builtinPrefix}, or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
|
|
308
|
+
*
|
|
309
|
+
* @defaultValue "powerlines"
|
|
310
|
+
*/
|
|
311
|
+
framework?: string;
|
|
312
|
+
}
|
|
313
|
+
interface UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> extends Omit<CommonUserConfig, "build"> {
|
|
314
|
+
/**
|
|
315
|
+
* Configuration provided to build processes
|
|
316
|
+
*
|
|
317
|
+
* @remarks
|
|
318
|
+
* This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
|
|
319
|
+
*/
|
|
320
|
+
build: Omit<TBuildConfig, "override"> & {
|
|
321
|
+
/**
|
|
322
|
+
* The build variant being used by the Powerlines engine.
|
|
323
|
+
*/
|
|
324
|
+
variant?: TBuildVariant;
|
|
325
|
+
/**
|
|
326
|
+
* An optional set of override options to apply to the selected build variant.
|
|
327
|
+
*
|
|
328
|
+
* @remarks
|
|
329
|
+
* 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.
|
|
330
|
+
*/
|
|
331
|
+
override?: Partial<TBuildResolvedConfig>;
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
|
|
335
|
+
/**
|
|
336
|
+
* The configuration provided while executing Powerlines commands.
|
|
337
|
+
*/
|
|
338
|
+
type InlineConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
|
|
339
|
+
/**
|
|
340
|
+
* A string identifier for the Powerlines command being executed
|
|
341
|
+
*/
|
|
342
|
+
command: PowerlinesCommand;
|
|
343
|
+
};
|
|
344
|
+
//#endregion
|
|
345
|
+
export { EnvironmentConfig, InlineConfig, LogFn, OutputConfig, PluginConfig, UserConfig, WorkspaceConfig };
|