@powerlines/plugin-eslint 0.8.127 → 0.8.128
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/helpers/format-message.cjs +27 -3
- package/dist/helpers/format-message.d.cts +16 -1
- package/dist/helpers/format-message.d.mts +16 -1
- package/dist/helpers/format-message.mjs +25 -1
- package/dist/helpers/index.cjs +3 -4
- package/dist/helpers/index.d.cts +1 -2
- package/dist/helpers/index.d.mts +1 -2
- package/dist/helpers/index.mjs +1 -2
- package/dist/index.cjs +5 -7
- package/dist/index.d.cts +3 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +2 -4
- package/dist/powerlines/src/types/babel.d.mts +2 -0
- package/dist/powerlines/src/types/build.d.cts +145 -0
- package/dist/powerlines/src/types/build.d.mts +145 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +9 -0
- package/dist/powerlines/src/types/config.d.cts +376 -0
- package/dist/powerlines/src/types/config.d.mts +376 -0
- package/dist/powerlines/src/types/context.d.cts +403 -0
- package/dist/powerlines/src/types/context.d.mts +405 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/fs.d.mts +486 -0
- package/dist/powerlines/src/types/hooks.d.mts +2 -0
- package/dist/powerlines/src/types/plugin.d.cts +231 -0
- package/dist/powerlines/src/types/plugin.d.mts +231 -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 -2
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.mts +1 -2
- package/dist/types/index.mjs +0 -3
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +69 -1
- package/dist/types/plugin.d.mts +69 -1
- package/dist/types/plugin.mjs +0 -2
- package/package.json +4 -4
- package/dist/format-message-B0zrT_tN.d.cts +0 -17
- package/dist/format-message-Bt4W9wqe.cjs +0 -38
- package/dist/format-message-CKuUKX7C.mjs +0 -27
- package/dist/format-message-Ck01aLfz.d.mts +0 -17
- package/dist/helpers-B15z10jN.mjs +0 -1
- package/dist/helpers-LF26RHol.cjs +0 -0
- package/dist/index-9iG2qHLe.d.mts +0 -1
- package/dist/index-D-CYNcT9.d.mts +0 -1
- package/dist/index-D4ELpJXS.d.cts +0 -1
- package/dist/index-DLoAMD9J.d.cts +0 -1
- package/dist/plugin-B9rqWpLs.d.mts +0 -1821
- package/dist/plugin-ifZVa20V.mjs +0 -1
- package/dist/plugin-nQ-T2aMa.d.cts +0 -1821
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/types-U3zd8PTP.mjs +0 -1
- package/dist/types-o3zWarRp.cjs +0 -0
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
let __stryke_path_find = require("@stryke/path/find");
|
|
2
|
+
let __stryke_path_normalize = require("@stryke/path/normalize");
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
//#region src/helpers/format-message.ts
|
|
5
|
+
let MessageSeverity = /* @__PURE__ */ function(MessageSeverity$1) {
|
|
6
|
+
MessageSeverity$1[MessageSeverity$1["Warning"] = 1] = "Warning";
|
|
7
|
+
MessageSeverity$1[MessageSeverity$1["Error"] = 2] = "Error";
|
|
8
|
+
return MessageSeverity$1;
|
|
9
|
+
}({});
|
|
10
|
+
function formatMessage(dir, messages, filePath) {
|
|
11
|
+
let fileName = (0, __stryke_path_normalize.correctPath)((0, __stryke_path_find.relative)(dir, filePath));
|
|
12
|
+
if (!fileName.startsWith(".")) fileName = `./${fileName}`;
|
|
13
|
+
let output = `\n${fileName}`;
|
|
14
|
+
for (let i = 0; i < messages.length; i++) {
|
|
15
|
+
const { message, severity, line, column, ruleId } = messages[i];
|
|
16
|
+
output += "\n";
|
|
17
|
+
if (line && column) output = `${output + line.toString()}:${column.toString()} `;
|
|
18
|
+
if (severity === MessageSeverity.Warning) output += `Warning: `;
|
|
19
|
+
else output += `Error: `;
|
|
20
|
+
output += message;
|
|
21
|
+
if (ruleId) output += ` ${ruleId}`;
|
|
22
|
+
}
|
|
23
|
+
return output;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.MessageSeverity = MessageSeverity;
|
|
28
|
+
exports.formatMessage = formatMessage;
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/helpers/format-message.d.ts
|
|
2
|
+
declare enum MessageSeverity {
|
|
3
|
+
Warning = 1,
|
|
4
|
+
Error = 2,
|
|
5
|
+
}
|
|
6
|
+
interface LintMessage {
|
|
7
|
+
ruleId: string | null;
|
|
8
|
+
severity: MessageSeverity;
|
|
9
|
+
message: string;
|
|
10
|
+
line: number;
|
|
11
|
+
column: number;
|
|
12
|
+
}
|
|
13
|
+
declare function formatMessage(dir: string, messages: LintMessage[], filePath: string): string;
|
|
14
|
+
declare type __ΩMessageSeverity = any[];
|
|
15
|
+
declare type __ΩLintMessage = any[];
|
|
16
|
+
//#endregion
|
|
2
17
|
export { LintMessage, MessageSeverity, __ΩLintMessage, __ΩMessageSeverity, formatMessage };
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/helpers/format-message.d.ts
|
|
2
|
+
declare enum MessageSeverity {
|
|
3
|
+
Warning = 1,
|
|
4
|
+
Error = 2,
|
|
5
|
+
}
|
|
6
|
+
interface LintMessage {
|
|
7
|
+
ruleId: string | null;
|
|
8
|
+
severity: MessageSeverity;
|
|
9
|
+
message: string;
|
|
10
|
+
line: number;
|
|
11
|
+
column: number;
|
|
12
|
+
}
|
|
13
|
+
declare function formatMessage(dir: string, messages: LintMessage[], filePath: string): string;
|
|
14
|
+
declare type __ΩMessageSeverity = any[];
|
|
15
|
+
declare type __ΩLintMessage = any[];
|
|
16
|
+
//#endregion
|
|
2
17
|
export { LintMessage, MessageSeverity, __ΩLintMessage, __ΩMessageSeverity, formatMessage };
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { relative } from "@stryke/path/find";
|
|
2
|
+
import { correctPath } from "@stryke/path/normalize";
|
|
2
3
|
|
|
4
|
+
//#region src/helpers/format-message.ts
|
|
5
|
+
let MessageSeverity = /* @__PURE__ */ function(MessageSeverity$1) {
|
|
6
|
+
MessageSeverity$1[MessageSeverity$1["Warning"] = 1] = "Warning";
|
|
7
|
+
MessageSeverity$1[MessageSeverity$1["Error"] = 2] = "Error";
|
|
8
|
+
return MessageSeverity$1;
|
|
9
|
+
}({});
|
|
10
|
+
function formatMessage(dir, messages, filePath) {
|
|
11
|
+
let fileName = correctPath(relative(dir, filePath));
|
|
12
|
+
if (!fileName.startsWith(".")) fileName = `./${fileName}`;
|
|
13
|
+
let output = `\n${fileName}`;
|
|
14
|
+
for (let i = 0; i < messages.length; i++) {
|
|
15
|
+
const { message, severity, line, column, ruleId } = messages[i];
|
|
16
|
+
output += "\n";
|
|
17
|
+
if (line && column) output = `${output + line.toString()}:${column.toString()} `;
|
|
18
|
+
if (severity === MessageSeverity.Warning) output += `Warning: `;
|
|
19
|
+
else output += `Error: `;
|
|
20
|
+
output += message;
|
|
21
|
+
if (ruleId) output += ` ${ruleId}`;
|
|
22
|
+
}
|
|
23
|
+
return output;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
3
27
|
export { MessageSeverity, formatMessage };
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
require('../helpers-LF26RHol.cjs');
|
|
1
|
+
const require_helpers_format_message = require('./format-message.cjs');
|
|
3
2
|
|
|
4
|
-
exports.MessageSeverity =
|
|
5
|
-
exports.formatMessage =
|
|
3
|
+
exports.MessageSeverity = require_helpers_format_message.MessageSeverity;
|
|
4
|
+
exports.formatMessage = require_helpers_format_message.formatMessage;
|
package/dist/helpers/index.d.cts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../index-DLoAMD9J.cjs";
|
|
1
|
+
import { LintMessage, MessageSeverity, __ΩLintMessage, __ΩMessageSeverity, formatMessage } from "./format-message.cjs";
|
|
3
2
|
export { LintMessage, MessageSeverity, __ΩLintMessage, __ΩMessageSeverity, formatMessage };
|
package/dist/helpers/index.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../index-D-CYNcT9.mjs";
|
|
1
|
+
import { LintMessage, MessageSeverity, __ΩLintMessage, __ΩMessageSeverity, formatMessage } from "./format-message.mjs";
|
|
3
2
|
export { LintMessage, MessageSeverity, __ΩLintMessage, __ΩMessageSeverity, formatMessage };
|
package/dist/helpers/index.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
const
|
|
3
|
-
require('./helpers
|
|
4
|
-
require('./plugin-pBKbb5K9.cjs');
|
|
5
|
-
require('./types-o3zWarRp.cjs');
|
|
2
|
+
const require_helpers_format_message = require('./helpers/format-message.cjs');
|
|
3
|
+
require('./helpers/index.cjs');
|
|
6
4
|
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
7
5
|
let __stryke_fs_exists = require("@stryke/fs/exists");
|
|
8
6
|
let __stryke_fs_get_parent_path = require("@stryke/fs/get-parent-path");
|
|
@@ -95,7 +93,7 @@ function plugin(options = {}) {
|
|
|
95
93
|
if ("loadESLint" in module$1) ESLint = await module$1.loadESLint({ useFlatConfig: this.config.lint.eslint.configFile ? (0, __stryke_path_find.findFileName)(this.config.lint.eslint.configFile).startsWith("eslint.config.") : true });
|
|
96
94
|
if (this.config.lint.eslint.fix) await ESLint.outputFixes(results);
|
|
97
95
|
if (this.config.lint.eslint.reportErrorsOnly) results = ESLint.getErrorResults(results);
|
|
98
|
-
const output = results.filter(({ messages }) => messages?.length).map(({ messages, filePath }) =>
|
|
96
|
+
const output = results.filter(({ messages }) => messages?.length).map(({ messages, filePath }) => require_helpers_format_message.formatMessage(this.config.projectRoot, messages, filePath)).join("\n");
|
|
99
97
|
if (this.config.lint.eslint.outputFile) await this.fs.write(this.config.lint.eslint.outputFile, output);
|
|
100
98
|
else this.log(__storm_software_config_tools_types.LogLevelLabel.INFO, output);
|
|
101
99
|
}
|
|
@@ -104,7 +102,7 @@ function plugin(options = {}) {
|
|
|
104
102
|
var src_default = plugin;
|
|
105
103
|
|
|
106
104
|
//#endregion
|
|
107
|
-
exports.MessageSeverity =
|
|
105
|
+
exports.MessageSeverity = require_helpers_format_message.MessageSeverity;
|
|
108
106
|
exports.default = src_default;
|
|
109
|
-
exports.formatMessage =
|
|
107
|
+
exports.formatMessage = require_helpers_format_message.formatMessage;
|
|
110
108
|
exports.plugin = plugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
import {
|
|
4
|
-
import "./index-D4ELpJXS.cjs";
|
|
1
|
+
import { LintMessage, MessageSeverity, __ΩLintMessage, __ΩMessageSeverity, formatMessage } from "./helpers/format-message.cjs";
|
|
2
|
+
import { Plugin } from "./powerlines/src/types/plugin.cjs";
|
|
3
|
+
import { ESLintPluginContext, ESLintPluginOptions, ESLintPluginResolvedConfig, ESLintPluginUserConfig, __ΩESLintPluginContext, __ΩESLintPluginOptions, __ΩESLintPluginResolvedConfig, __ΩESLintPluginUserConfig } from "./types/plugin.cjs";
|
|
5
4
|
|
|
6
5
|
//#region src/index.d.ts
|
|
7
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
import {
|
|
4
|
-
import "./index
|
|
1
|
+
import { LintMessage, MessageSeverity, __ΩLintMessage, __ΩMessageSeverity, formatMessage } from "./helpers/format-message.mjs";
|
|
2
|
+
import { Plugin } from "./powerlines/src/types/plugin.mjs";
|
|
3
|
+
import { ESLintPluginContext, ESLintPluginOptions, ESLintPluginResolvedConfig, ESLintPluginUserConfig, __ΩESLintPluginContext, __ΩESLintPluginOptions, __ΩESLintPluginResolvedConfig, __ΩESLintPluginUserConfig } from "./types/plugin.mjs";
|
|
4
|
+
import "./types/index.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/index.d.ts
|
|
7
7
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./helpers
|
|
3
|
-
import "./plugin-ifZVa20V.mjs";
|
|
4
|
-
import "./types-U3zd8PTP.mjs";
|
|
1
|
+
import { MessageSeverity, formatMessage } from "./helpers/format-message.mjs";
|
|
2
|
+
import "./helpers/index.mjs";
|
|
5
3
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
6
4
|
import { existsSync } from "@stryke/fs/exists";
|
|
7
5
|
import { getParentPath } from "@stryke/fs/get-parent-path";
|
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
* If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime. Otherwise, it is statically replaced as an empty object.
|
|
131
|
+
*
|
|
132
|
+
* @defaultValue false
|
|
133
|
+
*/
|
|
134
|
+
keepProcessEnv?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* An optional set of override options to apply to the selected build variant.
|
|
137
|
+
*
|
|
138
|
+
* @remarks
|
|
139
|
+
* 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.
|
|
140
|
+
*/
|
|
141
|
+
override?: Record<string, any>;
|
|
142
|
+
}
|
|
143
|
+
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
144
|
+
//#endregion
|
|
145
|
+
export { BuildConfig, BuildResolvedConfig, UnpluginBuildVariant };
|
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
* If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime. Otherwise, it is statically replaced as an empty object.
|
|
131
|
+
*
|
|
132
|
+
* @defaultValue false
|
|
133
|
+
*/
|
|
134
|
+
keepProcessEnv?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* An optional set of override options to apply to the selected build variant.
|
|
137
|
+
*
|
|
138
|
+
* @remarks
|
|
139
|
+
* 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.
|
|
140
|
+
*/
|
|
141
|
+
override?: Record<string, any>;
|
|
142
|
+
}
|
|
143
|
+
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
144
|
+
//#endregion
|
|
145
|
+
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,9 @@
|
|
|
1
|
+
import "./context.mjs";
|
|
2
|
+
import { ArrayValues } from "@stryke/types/array";
|
|
3
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
4
|
+
|
|
5
|
+
//#region ../powerlines/src/types/commands.d.ts
|
|
6
|
+
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
|
|
7
|
+
type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { CommandType };
|