@powerlines/plugin-id 0.9.65 → 0.9.67
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/components/index.cjs +1 -1
- package/dist/components/index.d.cts +1 -3
- package/dist/components/index.d.mts +1 -3
- package/dist/components/index.mjs +1 -1
- package/dist/components/nanoid.cjs +90 -1
- package/dist/components/nanoid.d.cts +12 -2
- package/dist/components/nanoid.d.mts +12 -2
- package/dist/components/nanoid.mjs +90 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1 -1
- package/dist/powerlines/src/lib/utilities/file-header.cjs +10 -0
- package/dist/powerlines/src/lib/utilities/file-header.mjs +10 -0
- package/dist/powerlines/src/types/babel.d.mts +2 -0
- 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 +9 -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 +349 -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/hooks.d.mts +2 -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 +37 -1
- package/dist/types/plugin.d.mts +37 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +7 -7
- package/dist/components-BWLXb7a2.cjs +0 -0
- package/dist/components-CeJvJXAB.mjs +0 -1
- package/dist/index-9iG2qHLe.d.mts +0 -1
- package/dist/index-D4ELpJXS.d.cts +0 -1
- package/dist/index-D6CnpA_r.d.cts +0 -1
- package/dist/index-DL0uimUT.d.mts +0 -1
- package/dist/nanoid-BEJDhi9o.d.cts +0 -13
- package/dist/nanoid-BG_lCiEX.d.mts +0 -13
- package/dist/nanoid-BMwJGbL3.cjs +0 -99
- package/dist/nanoid-Clx2gSOJ.mjs +0 -99
- package/dist/plugin-9oupXQGY.d.mts +0 -1672
- package/dist/plugin-BjiGfRHE.mjs +0 -1
- package/dist/plugin-DAFqTL_r.d.cts +0 -1672
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/types-n6NgD0QK.mjs +0 -1
- package/dist/types-o3zWarRp.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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(
|
|
1
|
+
const e=require(`./nanoid.cjs`);exports.nanoidModule=e.nanoidModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{nanoidModule as e}from"./nanoid.mjs";export{e as nanoidModule};
|
|
@@ -1 +1,90 @@
|
|
|
1
|
-
const e=require(`../
|
|
1
|
+
const e=require(`../powerlines/src/lib/utilities/file-header.cjs`);function t(t){return`
|
|
2
|
+
/**
|
|
3
|
+
* The ID module provides a set of utilities for generating unique identifiers.
|
|
4
|
+
*
|
|
5
|
+
* @module ${t.config.output.builtinPrefix}:id
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
${e.getFileHeader(t)}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generate a random string
|
|
12
|
+
*
|
|
13
|
+
* @param array - The array to fill with random values
|
|
14
|
+
* @returns The array filled with random values
|
|
15
|
+
*/
|
|
16
|
+
export function getRandom(array: Uint8Array) {
|
|
17
|
+
if (array === null) {
|
|
18
|
+
throw new StormError({ type: "general", code: 9 });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Fill the array with random values
|
|
22
|
+
for (let i = 0; i < array.length; i++) {
|
|
23
|
+
array[i] = Math.floor(Math.random() * 256); // Random byte (0-255)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return array;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
31
|
+
*
|
|
32
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
33
|
+
* @returns A unique identifier following the nanoid format
|
|
34
|
+
*/
|
|
35
|
+
export function uniqueId(size?: number | undefined): string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
39
|
+
*
|
|
40
|
+
* @param prefix - The prefix to use for the unique identifier
|
|
41
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
42
|
+
* @returns A unique identifier following the nanoid format
|
|
43
|
+
*/
|
|
44
|
+
export function uniqueId(prefix?: string, size?: number | undefined): string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
48
|
+
*
|
|
49
|
+
* @param param - The parameter to use for the unique identifier, can be a string or number
|
|
50
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
51
|
+
* @returns A unique identifier following the nanoid format
|
|
52
|
+
*/
|
|
53
|
+
export function uniqueId(param?: string | number | undefined, size?: number | undefined): string {
|
|
54
|
+
if (typeof param === "number") {
|
|
55
|
+
size = param;
|
|
56
|
+
} else if (!param || !size) {
|
|
57
|
+
size = 21; // Default size if not provided
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Use our custom getRandom function to fill a Uint8Array with random values.
|
|
61
|
+
const randomBytes = getRandom(new Uint8Array(typeof param === "string" ? size - (param.length + 1) : size));
|
|
62
|
+
|
|
63
|
+
let result = "";
|
|
64
|
+
if (typeof param === "string") {
|
|
65
|
+
// If the parameter is a string, use it as a prefix.
|
|
66
|
+
result = param + "_";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return result + randomBytes.reduce((id, byte) => {
|
|
70
|
+
// It is incorrect to use bytes exceeding the alphabet size.
|
|
71
|
+
// The following mask reduces the random byte in the 0-255 value
|
|
72
|
+
// range to the 0-63 value range. Therefore, adding hacks, such
|
|
73
|
+
// as empty string fallback or magic numbers, is unnecessary because
|
|
74
|
+
// the bitmask trims bytes down to the alphabet size.
|
|
75
|
+
byte &= 63;
|
|
76
|
+
if (byte < 36) {
|
|
77
|
+
// \`0-9a-z\`
|
|
78
|
+
id += byte.toString(36);
|
|
79
|
+
} else if (byte < 62) {
|
|
80
|
+
// \`A-Z\`
|
|
81
|
+
id += (byte - 26).toString(36).toUpperCase();
|
|
82
|
+
} else if (byte > 62) {
|
|
83
|
+
id += "-";
|
|
84
|
+
} else {
|
|
85
|
+
id += "_";
|
|
86
|
+
}
|
|
87
|
+
return id;
|
|
88
|
+
}, "");
|
|
89
|
+
}
|
|
90
|
+
`}exports.nanoidModule=t;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import "../plugin
|
|
2
|
-
|
|
1
|
+
import { IdPluginContext } from "../types/plugin.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/components/nanoid.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generates the nanoid module content.
|
|
7
|
+
*
|
|
8
|
+
* @param context - The build context containing runtime information.
|
|
9
|
+
* @returns A string representing the nanoid module code.
|
|
10
|
+
*/
|
|
11
|
+
declare function nanoidModule(context: IdPluginContext): string;
|
|
12
|
+
//#endregion
|
|
3
13
|
export { nanoidModule };
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import "../plugin
|
|
2
|
-
|
|
1
|
+
import { IdPluginContext } from "../types/plugin.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/components/nanoid.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generates the nanoid module content.
|
|
7
|
+
*
|
|
8
|
+
* @param context - The build context containing runtime information.
|
|
9
|
+
* @returns A string representing the nanoid module code.
|
|
10
|
+
*/
|
|
11
|
+
declare function nanoidModule(context: IdPluginContext): string;
|
|
12
|
+
//#endregion
|
|
3
13
|
export { nanoidModule };
|
|
@@ -1 +1,90 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getFileHeader as e}from"../powerlines/src/lib/utilities/file-header.mjs";function t(t){return`
|
|
2
|
+
/**
|
|
3
|
+
* The ID module provides a set of utilities for generating unique identifiers.
|
|
4
|
+
*
|
|
5
|
+
* @module ${t.config.output.builtinPrefix}:id
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
${e(t)}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generate a random string
|
|
12
|
+
*
|
|
13
|
+
* @param array - The array to fill with random values
|
|
14
|
+
* @returns The array filled with random values
|
|
15
|
+
*/
|
|
16
|
+
export function getRandom(array: Uint8Array) {
|
|
17
|
+
if (array === null) {
|
|
18
|
+
throw new StormError({ type: "general", code: 9 });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Fill the array with random values
|
|
22
|
+
for (let i = 0; i < array.length; i++) {
|
|
23
|
+
array[i] = Math.floor(Math.random() * 256); // Random byte (0-255)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return array;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
31
|
+
*
|
|
32
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
33
|
+
* @returns A unique identifier following the nanoid format
|
|
34
|
+
*/
|
|
35
|
+
export function uniqueId(size?: number | undefined): string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
39
|
+
*
|
|
40
|
+
* @param prefix - The prefix to use for the unique identifier
|
|
41
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
42
|
+
* @returns A unique identifier following the nanoid format
|
|
43
|
+
*/
|
|
44
|
+
export function uniqueId(prefix?: string, size?: number | undefined): string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
48
|
+
*
|
|
49
|
+
* @param param - The parameter to use for the unique identifier, can be a string or number
|
|
50
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
51
|
+
* @returns A unique identifier following the nanoid format
|
|
52
|
+
*/
|
|
53
|
+
export function uniqueId(param?: string | number | undefined, size?: number | undefined): string {
|
|
54
|
+
if (typeof param === "number") {
|
|
55
|
+
size = param;
|
|
56
|
+
} else if (!param || !size) {
|
|
57
|
+
size = 21; // Default size if not provided
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Use our custom getRandom function to fill a Uint8Array with random values.
|
|
61
|
+
const randomBytes = getRandom(new Uint8Array(typeof param === "string" ? size - (param.length + 1) : size));
|
|
62
|
+
|
|
63
|
+
let result = "";
|
|
64
|
+
if (typeof param === "string") {
|
|
65
|
+
// If the parameter is a string, use it as a prefix.
|
|
66
|
+
result = param + "_";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return result + randomBytes.reduce((id, byte) => {
|
|
70
|
+
// It is incorrect to use bytes exceeding the alphabet size.
|
|
71
|
+
// The following mask reduces the random byte in the 0-255 value
|
|
72
|
+
// range to the 0-63 value range. Therefore, adding hacks, such
|
|
73
|
+
// as empty string fallback or magic numbers, is unnecessary because
|
|
74
|
+
// the bitmask trims bytes down to the alphabet size.
|
|
75
|
+
byte &= 63;
|
|
76
|
+
if (byte < 36) {
|
|
77
|
+
// \`0-9a-z\`
|
|
78
|
+
id += byte.toString(36);
|
|
79
|
+
} else if (byte < 62) {
|
|
80
|
+
// \`A-Z\`
|
|
81
|
+
id += (byte - 26).toString(36).toUpperCase();
|
|
82
|
+
} else if (byte > 62) {
|
|
83
|
+
id += "-";
|
|
84
|
+
} else {
|
|
85
|
+
id += "_";
|
|
86
|
+
}
|
|
87
|
+
return id;
|
|
88
|
+
}, "");
|
|
89
|
+
}
|
|
90
|
+
`}export{t as nanoidModule};
|
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`),t=require(`./components/nanoid.cjs`);require(`./components/index.cjs`);let n=require(`@storm-software/config-tools/types`),r=require(`defu`);r=e.__toESM(r);function i(e={}){return{name:`id`,async config(){this.log(n.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `id` build plugin.");let t={id:(0,r.default)(e,{type:`nanoid`})};return(!t.id.type||![`nanoid`].includes(t.id.type))&&(t.id.type&&this.log(n.LogLevelLabel.WARN,`Invalid ID generation type "${t.id.type}" specified. Defaulting to "nanoid".`),t.id.type=`nanoid`),this.log(n.LogLevelLabel.DEBUG,`Using ID generation library: ${t.id.type}`),t},async prepare(){this.log(n.LogLevelLabel.TRACE,`Preparing the ID runtime artifacts for the Powerlines project.`);let e;switch(this.config.id.type){case`nanoid`:default:e=t.nanoidModule;break}await this.emitBuiltin(await Promise.resolve(e(this)),`id`,`id.ts`)}}}var a=i;exports.default=a,exports.nanoidModule=t.nanoidModule,exports.plugin=i;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
import "./index-D4ELpJXS.cjs";
|
|
1
|
+
import { Plugin } from "./powerlines/src/types/plugin.cjs";
|
|
2
|
+
import { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType } from "./types/plugin.cjs";
|
|
3
|
+
import { nanoidModule } from "./components/nanoid.cjs";
|
|
5
4
|
|
|
6
5
|
//#region src/index.d.ts
|
|
7
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
import "./index
|
|
1
|
+
import { Plugin } from "./powerlines/src/types/plugin.mjs";
|
|
2
|
+
import { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType } from "./types/plugin.mjs";
|
|
3
|
+
import { nanoidModule } from "./components/nanoid.mjs";
|
|
4
|
+
import "./components/index.mjs";
|
|
5
|
+
import "./types/index.mjs";
|
|
5
6
|
|
|
6
7
|
//#region src/index.d.ts
|
|
7
|
-
|
|
8
8
|
/**
|
|
9
9
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
10
10
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{nanoidModule as e}from"./components/nanoid.mjs";import"./components/index.mjs";import{LogLevelLabel as t}from"@storm-software/config-tools/types";import n from"defu";function r(r={}){return{name:`id`,async config(){this.log(t.TRACE,"Providing default configuration for the Powerlines `id` build plugin.");let e={id:n(r,{type:`nanoid`})};return(!e.id.type||![`nanoid`].includes(e.id.type))&&(e.id.type&&this.log(t.WARN,`Invalid ID generation type "${e.id.type}" specified. Defaulting to "nanoid".`),e.id.type=`nanoid`),this.log(t.DEBUG,`Using ID generation library: ${e.id.type}`),e},async prepare(){this.log(t.TRACE,`Preparing the ID runtime artifacts for the Powerlines project.`);let n;switch(this.config.id.type){case`nanoid`:default:n=e;break}await this.emitBuiltin(await Promise.resolve(n(this)),`id`,`id.ts`)}}}var i=r;export{i as default,e as nanoidModule,r as plugin};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/string-format/title-case`);function n(e){return`
|
|
2
|
+
// Generated with ${(0,t.titleCase)(e.config.framework)}
|
|
3
|
+
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
4
|
+
`}function r(e,t={}){let{directive:r=null,prettierIgnore:i=!1}=t;return`/* eslint-disable */
|
|
5
|
+
// biome-ignore lint: disable
|
|
6
|
+
${i?`// prettier-ignore`:``}${r?`\n\n${r}\n`:`
|
|
7
|
+
`}
|
|
8
|
+
${n(e)}
|
|
9
|
+
|
|
10
|
+
`}exports.getFileHeader=r;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{titleCase as e}from"@stryke/string-format/title-case";function t(t){return`
|
|
2
|
+
// Generated with ${e(t.config.framework)}
|
|
3
|
+
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
4
|
+
`}function n(e,n={}){let{directive:r=null,prettierIgnore:i=!1}=n;return`/* eslint-disable */
|
|
5
|
+
// biome-ignore lint: disable
|
|
6
|
+
${i?`// prettier-ignore`:``}${r?`\n\n${r}\n`:`
|
|
7
|
+
`}
|
|
8
|
+
${t(e)}
|
|
9
|
+
|
|
10
|
+
`}export{n as getFileHeader};
|
|
@@ -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 { 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 };
|