@powerlines/plugin-tsc 0.2.130 → 0.2.132

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.
Files changed (57) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/helpers/index.cjs +2 -3
  3. package/dist/helpers/index.d.cts +1 -3
  4. package/dist/helpers/index.d.mts +1 -3
  5. package/dist/helpers/index.mjs +1 -2
  6. package/dist/helpers/type-check.cjs +21 -2
  7. package/dist/helpers/type-check.d.cts +11 -2
  8. package/dist/helpers/type-check.d.mts +11 -2
  9. package/dist/helpers/type-check.mjs +19 -1
  10. package/dist/index.cjs +12 -36
  11. package/dist/index.d.cts +3 -5
  12. package/dist/index.d.mts +5 -5
  13. package/dist/index.mjs +7 -4
  14. package/dist/powerlines/src/types/babel.d.mts +2 -0
  15. package/dist/powerlines/src/types/build.d.cts +145 -0
  16. package/dist/powerlines/src/types/build.d.mts +145 -0
  17. package/dist/powerlines/src/types/commands.d.cts +8 -0
  18. package/dist/powerlines/src/types/commands.d.mts +9 -0
  19. package/dist/powerlines/src/types/config.d.cts +376 -0
  20. package/dist/powerlines/src/types/config.d.mts +376 -0
  21. package/dist/powerlines/src/types/context.d.cts +403 -0
  22. package/dist/powerlines/src/types/context.d.mts +403 -0
  23. package/dist/powerlines/src/types/fs.d.cts +486 -0
  24. package/dist/powerlines/src/types/fs.d.mts +486 -0
  25. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  26. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  27. package/dist/powerlines/src/types/resolved.d.cts +81 -0
  28. package/dist/powerlines/src/types/resolved.d.mts +81 -0
  29. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  30. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  31. package/dist/types/index.cjs +0 -2
  32. package/dist/types/index.d.cts +1 -3
  33. package/dist/types/index.d.mts +1 -3
  34. package/dist/types/index.mjs +0 -3
  35. package/dist/types/plugin.cjs +0 -1
  36. package/dist/types/plugin.d.cts +36 -2
  37. package/dist/types/plugin.d.mts +36 -2
  38. package/dist/types/plugin.mjs +0 -2
  39. package/package.json +5 -4
  40. package/dist/context-Wc7vQcpF.d.cts +0 -1749
  41. package/dist/context-YG82wM_K.d.mts +0 -1749
  42. package/dist/helpers-B15z10jN.mjs +0 -1
  43. package/dist/helpers-LF26RHol.cjs +0 -0
  44. package/dist/index-CUbWeWHc.d.mts +0 -1
  45. package/dist/index-D6CnpA_r.d.cts +0 -1
  46. package/dist/index-DL0uimUT.d.mts +0 -1
  47. package/dist/index-DWPDThxu.d.cts +0 -1
  48. package/dist/plugin-B8O1Fqy6.d.mts +0 -35
  49. package/dist/plugin-DjevpZ1o.d.cts +0 -35
  50. package/dist/plugin-ifZVa20V.mjs +0 -1
  51. package/dist/plugin-pBKbb5K9.cjs +0 -0
  52. package/dist/type-check-BM6tW_xw.cjs +0 -27
  53. package/dist/type-check-Bkbb5EkH.mjs +0 -21
  54. package/dist/type-check-COd0vfQK.d.cts +0 -12
  55. package/dist/type-check-DrcpU2r1.d.mts +0 -12
  56. package/dist/types-U3zd8PTP.mjs +0 -1
  57. package/dist/types-o3zWarRp.cjs +0 -0
@@ -0,0 +1,29 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
@@ -1,4 +1,3 @@
1
- const require_type_check = require('../type-check-BM6tW_xw.cjs');
2
- require('../helpers-LF26RHol.cjs');
1
+ const require_helpers_type_check = require('./type-check.cjs');
3
2
 
4
- exports.typeCheck = require_type_check.typeCheck;
3
+ exports.typeCheck = require_helpers_type_check.typeCheck;
@@ -1,4 +1,2 @@
1
- import "../context-Wc7vQcpF.cjs";
2
- import { t as typeCheck } from "../type-check-COd0vfQK.cjs";
3
- import "../index-D6CnpA_r.cjs";
1
+ import { typeCheck } from "./type-check.cjs";
4
2
  export { typeCheck };
@@ -1,4 +1,2 @@
1
- import "../context-YG82wM_K.mjs";
2
- import { t as typeCheck } from "../type-check-DrcpU2r1.mjs";
3
- import "../index-DL0uimUT.mjs";
1
+ import { typeCheck } from "./type-check.mjs";
4
2
  export { typeCheck };
@@ -1,4 +1,3 @@
1
- import { t as typeCheck } from "../type-check-Bkbb5EkH.mjs";
2
- import "../helpers-B15z10jN.mjs";
1
+ import { typeCheck } from "./type-check.mjs";
3
2
 
4
3
  export { typeCheck };
@@ -1,3 +1,22 @@
1
- const require_type_check = require('../type-check-BM6tW_xw.cjs');
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let typescript = require("typescript");
2
3
 
3
- exports.typeCheck = require_type_check.typeCheck;
4
+ //#region src/helpers/type-check.ts
5
+ /**
6
+ * Perform type checks on the provided sources using TypeScript's compiler API.
7
+ *
8
+ * @param context - The build context containing information about the current build.
9
+ */
10
+ async function typeCheck(context) {
11
+ const result = context.program.emitToMemory();
12
+ const diagnosticMessages = [];
13
+ result.getDiagnostics().forEach((diagnostic) => {
14
+ if (diagnostic.getSourceFile()?.getBaseName()) diagnosticMessages.push(`${diagnostic.getSourceFile()?.getBaseName()} (${(diagnostic.getLineNumber() ?? 0) + 1}): ${(0, typescript.flattenDiagnosticMessageText)(diagnostic.getMessageText().toString(), "\n")}`);
15
+ else diagnosticMessages.push((0, typescript.flattenDiagnosticMessageText)(diagnostic.getMessageText().toString(), "\n"));
16
+ });
17
+ const diagnosticMessage = diagnosticMessages.join("\n");
18
+ if (diagnosticMessage) throw new Error(`TypeScript compilation failed: \n\n${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : diagnosticMessage}`);
19
+ }
20
+
21
+ //#endregion
22
+ exports.typeCheck = typeCheck;
@@ -1,3 +1,12 @@
1
- import "../context-Wc7vQcpF.cjs";
2
- import { t as typeCheck } from "../type-check-COd0vfQK.cjs";
1
+ import { Context } from "../powerlines/src/types/context.cjs";
2
+
3
+ //#region src/helpers/type-check.d.ts
4
+
5
+ /**
6
+ * Perform type checks on the provided sources using TypeScript's compiler API.
7
+ *
8
+ * @param context - The build context containing information about the current build.
9
+ */
10
+ declare function typeCheck(context: Context): Promise<void>;
11
+ //#endregion
3
12
  export { typeCheck };
@@ -1,3 +1,12 @@
1
- import "../context-YG82wM_K.mjs";
2
- import { t as typeCheck } from "../type-check-DrcpU2r1.mjs";
1
+ import { Context } from "../powerlines/src/types/context.mjs";
2
+
3
+ //#region src/helpers/type-check.d.ts
4
+
5
+ /**
6
+ * Perform type checks on the provided sources using TypeScript's compiler API.
7
+ *
8
+ * @param context - The build context containing information about the current build.
9
+ */
10
+ declare function typeCheck(context: Context): Promise<void>;
11
+ //#endregion
3
12
  export { typeCheck };
@@ -1,3 +1,21 @@
1
- import { t as typeCheck } from "../type-check-Bkbb5EkH.mjs";
1
+ import { flattenDiagnosticMessageText } from "typescript";
2
2
 
3
+ //#region src/helpers/type-check.ts
4
+ /**
5
+ * Perform type checks on the provided sources using TypeScript's compiler API.
6
+ *
7
+ * @param context - The build context containing information about the current build.
8
+ */
9
+ async function typeCheck(context) {
10
+ const result = context.program.emitToMemory();
11
+ const diagnosticMessages = [];
12
+ result.getDiagnostics().forEach((diagnostic) => {
13
+ if (diagnostic.getSourceFile()?.getBaseName()) diagnosticMessages.push(`${diagnostic.getSourceFile()?.getBaseName()} (${(diagnostic.getLineNumber() ?? 0) + 1}): ${flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n")}`);
14
+ else diagnosticMessages.push(flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n"));
15
+ });
16
+ const diagnosticMessage = diagnosticMessages.join("\n");
17
+ if (diagnosticMessage) throw new Error(`TypeScript compilation failed: \n\n${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : diagnosticMessage}`);
18
+ }
19
+
20
+ //#endregion
3
21
  export { typeCheck };
package/dist/index.cjs CHANGED
@@ -1,39 +1,12 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- //#region rolldown:runtime
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
- value: mod,
25
- enumerable: true
26
- }) : target, mod));
27
-
28
- //#endregion
29
- const require_type_check = require('./type-check-BM6tW_xw.cjs');
30
- require('./helpers-LF26RHol.cjs');
31
- require('./plugin-pBKbb5K9.cjs');
32
- require('./types-o3zWarRp.cjs');
2
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
+ const require_helpers_type_check = require('./helpers/type-check.cjs');
4
+ require('./helpers/index.cjs');
5
+ let __stryke_path_find = require("@stryke/path/find");
33
6
  let defu = require("defu");
34
- defu = __toESM(defu);
7
+ defu = require_rolldown_runtime.__toESM(defu);
35
8
  let typescript = require("typescript");
36
- typescript = __toESM(typescript);
9
+ typescript = require_rolldown_runtime.__toESM(typescript);
37
10
 
38
11
  //#region src/index.ts
39
12
  /**
@@ -49,9 +22,13 @@ const plugin = (options = {}) => {
49
22
  return { transform: { tsc: (0, defu.default)(options ?? {}, { typeCheck: false }) } };
50
23
  },
51
24
  async lint() {
52
- if (this.config.transform.tsc.typeCheck) await require_type_check.typeCheck(this);
25
+ if (this.config.transform.tsc.typeCheck) await require_helpers_type_check.typeCheck(this);
53
26
  },
54
27
  async transform(code, id) {
28
+ if ((0, __stryke_path_find.findFileExtensionSafe)(id).toLowerCase() !== "ts" || id.endsWith(".d.ts")) return {
29
+ code,
30
+ id
31
+ };
55
32
  const result = typescript.default.transpileModule(code, {
56
33
  ...this.config.transform.tsc,
57
34
  compilerOptions: {
@@ -76,7 +53,6 @@ const plugin = (options = {}) => {
76
53
  var src_default = plugin;
77
54
 
78
55
  //#endregion
79
- exports.__toESM = __toESM;
80
56
  exports.default = src_default;
81
57
  exports.plugin = plugin;
82
- exports.typeCheck = require_type_check.typeCheck;
58
+ exports.typeCheck = require_helpers_type_check.typeCheck;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,6 @@
1
- import { i as Plugin } from "./context-Wc7vQcpF.cjs";
2
- import { t as typeCheck } from "./type-check-COd0vfQK.cjs";
3
- import "./index-D6CnpA_r.cjs";
4
- import { a as __ΩTypeScriptCompilerPluginContext, c as __ΩTypeScriptCompilerPluginUserConfig, i as TypeScriptCompilerPluginUserConfig, n as TypeScriptCompilerPluginOptions, o as __ΩTypeScriptCompilerPluginOptions, r as TypeScriptCompilerPluginResolvedConfig, s as __ΩTypeScriptCompilerPluginResolvedConfig, t as TypeScriptCompilerPluginContext } from "./plugin-DjevpZ1o.cjs";
5
- import "./index-DWPDThxu.cjs";
1
+ import { Plugin } from "./powerlines/src/types/plugin.cjs";
2
+ import { typeCheck } from "./helpers/type-check.cjs";
3
+ import { TypeScriptCompilerPluginContext, TypeScriptCompilerPluginOptions, TypeScriptCompilerPluginResolvedConfig, TypeScriptCompilerPluginUserConfig, __ΩTypeScriptCompilerPluginContext, __ΩTypeScriptCompilerPluginOptions, __ΩTypeScriptCompilerPluginResolvedConfig, __ΩTypeScriptCompilerPluginUserConfig } from "./types/plugin.cjs";
6
4
 
7
5
  //#region src/index.d.ts
8
6
 
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { i as Plugin } from "./context-YG82wM_K.mjs";
2
- import { t as typeCheck } from "./type-check-DrcpU2r1.mjs";
3
- import "./index-DL0uimUT.mjs";
4
- import { a as __ΩTypeScriptCompilerPluginContext, c as __ΩTypeScriptCompilerPluginUserConfig, i as TypeScriptCompilerPluginUserConfig, n as TypeScriptCompilerPluginOptions, o as __ΩTypeScriptCompilerPluginOptions, r as TypeScriptCompilerPluginResolvedConfig, s as __ΩTypeScriptCompilerPluginResolvedConfig, t as TypeScriptCompilerPluginContext } from "./plugin-B8O1Fqy6.mjs";
5
- import "./index-CUbWeWHc.mjs";
1
+ import { Plugin } from "./powerlines/src/types/plugin.mjs";
2
+ import { typeCheck } from "./helpers/type-check.mjs";
3
+ import "./helpers/index.mjs";
4
+ import { TypeScriptCompilerPluginContext, TypeScriptCompilerPluginOptions, TypeScriptCompilerPluginResolvedConfig, TypeScriptCompilerPluginUserConfig, __ΩTypeScriptCompilerPluginContext, __ΩTypeScriptCompilerPluginOptions, __ΩTypeScriptCompilerPluginResolvedConfig, __ΩTypeScriptCompilerPluginUserConfig } from "./types/plugin.mjs";
5
+ import "./types/index.mjs";
6
6
 
7
7
  //#region src/index.d.ts
8
8
 
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
- import { t as typeCheck } from "./type-check-Bkbb5EkH.mjs";
2
- import "./helpers-B15z10jN.mjs";
3
- import "./plugin-ifZVa20V.mjs";
4
- import "./types-U3zd8PTP.mjs";
1
+ import { typeCheck } from "./helpers/type-check.mjs";
2
+ import "./helpers/index.mjs";
3
+ import { findFileExtensionSafe } from "@stryke/path/find";
5
4
  import defu from "defu";
6
5
  import ts from "typescript";
7
6
 
@@ -22,6 +21,10 @@ const plugin = (options = {}) => {
22
21
  if (this.config.transform.tsc.typeCheck) await typeCheck(this);
23
22
  },
24
23
  async transform(code, id) {
24
+ if (findFileExtensionSafe(id).toLowerCase() !== "ts" || id.endsWith(".d.ts")) return {
25
+ code,
26
+ id
27
+ };
25
28
  const result = ts.transpileModule(code, {
26
29
  ...this.config.transform.tsc,
27
30
  compilerOptions: {
@@ -0,0 +1,2 @@
1
+ import "./config.mjs";
2
+ import "./context.mjs";
@@ -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 { MaybePromise } from "@stryke/types/base";
2
+ import { ArrayValues } from "@stryke/types/array";
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 { MaybePromise } from "@stryke/types/base";
3
+ import { ArrayValues } from "@stryke/types/array";
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 };