@powerlines/plugin-id 0.9.247 → 0.9.249
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.cjs +3 -2
- package/dist/components/index.d.cts +3 -1
- package/dist/components/index.d.mts +3 -1
- package/dist/components/index.mjs +2 -1
- package/dist/components/nanoid.cjs +2 -104
- package/dist/components/nanoid.d.cts +2 -12
- package/dist/components/nanoid.d.mts +2 -12
- package/dist/components/nanoid.mjs +1 -102
- package/dist/components-BWLXb7a2.cjs +0 -0
- package/dist/components-kh0CpIG2.mjs +1 -0
- package/dist/index-9iG2qHLe.d.mts +1 -0
- package/dist/index-D4ELpJXS.d.cts +1 -0
- package/dist/index-D6CnpA_r.d.cts +1 -0
- package/dist/index-DL0uimUT.d.mts +1 -0
- package/dist/index.cjs +35 -6
- package/dist/index.d.cts +6 -5
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +6 -5
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6 -3
- package/dist/index.mjs.map +1 -0
- package/dist/nanoid-B2PspA4W.d.cts +14 -0
- package/dist/nanoid-B2PspA4W.d.cts.map +1 -0
- package/dist/nanoid-COe3b5W5.d.mts +14 -0
- package/dist/nanoid-COe3b5W5.d.mts.map +1 -0
- package/dist/nanoid-T78pG_pQ.mjs +105 -0
- package/dist/nanoid-T78pG_pQ.mjs.map +1 -0
- package/dist/nanoid-tv7r-1sU.cjs +110 -0
- package/dist/plugin-CW5KujoN.d.mts +39 -0
- package/dist/plugin-CW5KujoN.d.mts.map +1 -0
- package/dist/plugin-DGFbkTdN.d.cts +39 -0
- package/dist/plugin-DGFbkTdN.d.cts.map +1 -0
- package/dist/plugin-ifZVa20V.mjs +1 -0
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.mts +2 -1
- package/dist/types/index.mjs +3 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +1 -37
- package/dist/types/plugin.d.mts +1 -37
- package/dist/types/plugin.mjs +2 -0
- package/dist/types-U3zd8PTP.mjs +1 -0
- package/dist/types-o3zWarRp.cjs +0 -0
- package/package.json +4 -4
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_nanoid = require('../nanoid-tv7r-1sU.cjs');
|
|
2
|
+
require('../components-BWLXb7a2.cjs');
|
|
2
3
|
|
|
3
|
-
exports.nanoidModule =
|
|
4
|
+
exports.nanoidModule = require_nanoid.nanoidModule;
|
|
@@ -1,105 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
let powerlines_lib_utilities_file_header = require("powerlines/lib/utilities/file-header");
|
|
1
|
+
const require_nanoid = require('../nanoid-tv7r-1sU.cjs');
|
|
3
2
|
|
|
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
|
-
function nanoidModule(context) {
|
|
12
|
-
return `
|
|
13
|
-
/**
|
|
14
|
-
* The ID module provides a set of utilities for generating unique identifiers.
|
|
15
|
-
*
|
|
16
|
-
* @module ${context.config.framework}:id
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
${(0, powerlines_lib_utilities_file_header.getFileHeader)(context)}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Generate a random string
|
|
23
|
-
*
|
|
24
|
-
* @param array - The array to fill with random values
|
|
25
|
-
* @returns The array filled with random values
|
|
26
|
-
*/
|
|
27
|
-
export function getRandom(array: Uint8Array) {
|
|
28
|
-
if (array === null) {
|
|
29
|
-
throw new StormError({ type: "general", code: 9 });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Fill the array with random values
|
|
33
|
-
for (let i = 0; i < array.length; i++) {
|
|
34
|
-
array[i] = Math.floor(Math.random() * 256); // Random byte (0-255)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return array;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
42
|
-
*
|
|
43
|
-
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
44
|
-
* @returns A unique identifier following the nanoid format
|
|
45
|
-
*/
|
|
46
|
-
export function uniqueId(size?: number | undefined): string;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
50
|
-
*
|
|
51
|
-
* @param prefix - The prefix to use for the unique identifier
|
|
52
|
-
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
53
|
-
* @returns A unique identifier following the nanoid format
|
|
54
|
-
*/
|
|
55
|
-
export function uniqueId(prefix?: string, size?: number | undefined): string;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
59
|
-
*
|
|
60
|
-
* @param param - The parameter to use for the unique identifier, can be a string or number
|
|
61
|
-
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
62
|
-
* @returns A unique identifier following the nanoid format
|
|
63
|
-
*/
|
|
64
|
-
export function uniqueId(param?: string | number | undefined, size?: number | undefined): string {
|
|
65
|
-
if (typeof param === "number") {
|
|
66
|
-
size = param;
|
|
67
|
-
} else if (!param || !size) {
|
|
68
|
-
size = 21; // Default size if not provided
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Use our custom getRandom function to fill a Uint8Array with random values.
|
|
72
|
-
const randomBytes = getRandom(new Uint8Array(typeof param === "string" ? size - (param.length + 1) : size));
|
|
73
|
-
|
|
74
|
-
let result = "";
|
|
75
|
-
if (typeof param === "string") {
|
|
76
|
-
// If the parameter is a string, use it as a prefix.
|
|
77
|
-
result = param + "_";
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return result + randomBytes.reduce((id, byte) => {
|
|
81
|
-
// It is incorrect to use bytes exceeding the alphabet size.
|
|
82
|
-
// The following mask reduces the random byte in the 0-255 value
|
|
83
|
-
// range to the 0-63 value range. Therefore, adding hacks, such
|
|
84
|
-
// as empty string fallback or magic numbers, is unnecessary because
|
|
85
|
-
// the bitmask trims bytes down to the alphabet size.
|
|
86
|
-
byte &= 63;
|
|
87
|
-
if (byte < 36) {
|
|
88
|
-
// \`0-9a-z\`
|
|
89
|
-
id += byte.toString(36);
|
|
90
|
-
} else if (byte < 62) {
|
|
91
|
-
// \`A-Z\`
|
|
92
|
-
id += (byte - 26).toString(36).toUpperCase();
|
|
93
|
-
} else if (byte > 62) {
|
|
94
|
-
id += "-";
|
|
95
|
-
} else {
|
|
96
|
-
id += "_";
|
|
97
|
-
}
|
|
98
|
-
return id;
|
|
99
|
-
}, "");
|
|
100
|
-
}
|
|
101
|
-
`;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
//#endregion
|
|
105
|
-
exports.nanoidModule = nanoidModule;
|
|
3
|
+
exports.nanoidModule = require_nanoid.nanoidModule;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import
|
|
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
|
|
1
|
+
import "../plugin-DGFbkTdN.cjs";
|
|
2
|
+
import { t as nanoidModule } from "../nanoid-B2PspA4W.cjs";
|
|
13
3
|
export { nanoidModule };
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import
|
|
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
|
|
1
|
+
import "../plugin-CW5KujoN.mjs";
|
|
2
|
+
import { t as nanoidModule } from "../nanoid-COe3b5W5.mjs";
|
|
13
3
|
export { nanoidModule };
|
|
@@ -1,104 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as nanoidModule } from "../nanoid-T78pG_pQ.mjs";
|
|
2
2
|
|
|
3
|
-
//#region src/components/nanoid.ts
|
|
4
|
-
/**
|
|
5
|
-
* Generates the nanoid module content.
|
|
6
|
-
*
|
|
7
|
-
* @param context - The build context containing runtime information.
|
|
8
|
-
* @returns A string representing the nanoid module code.
|
|
9
|
-
*/
|
|
10
|
-
function nanoidModule(context) {
|
|
11
|
-
return `
|
|
12
|
-
/**
|
|
13
|
-
* The ID module provides a set of utilities for generating unique identifiers.
|
|
14
|
-
*
|
|
15
|
-
* @module ${context.config.framework}:id
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
${getFileHeader(context)}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Generate a random string
|
|
22
|
-
*
|
|
23
|
-
* @param array - The array to fill with random values
|
|
24
|
-
* @returns The array filled with random values
|
|
25
|
-
*/
|
|
26
|
-
export function getRandom(array: Uint8Array) {
|
|
27
|
-
if (array === null) {
|
|
28
|
-
throw new StormError({ type: "general", code: 9 });
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Fill the array with random values
|
|
32
|
-
for (let i = 0; i < array.length; i++) {
|
|
33
|
-
array[i] = Math.floor(Math.random() * 256); // Random byte (0-255)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return array;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
41
|
-
*
|
|
42
|
-
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
43
|
-
* @returns A unique identifier following the nanoid format
|
|
44
|
-
*/
|
|
45
|
-
export function uniqueId(size?: number | undefined): string;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
49
|
-
*
|
|
50
|
-
* @param prefix - The prefix to use for the unique identifier
|
|
51
|
-
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
52
|
-
* @returns A unique identifier following the nanoid format
|
|
53
|
-
*/
|
|
54
|
-
export function uniqueId(prefix?: string, size?: number | undefined): string;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
58
|
-
*
|
|
59
|
-
* @param param - The parameter to use for the unique identifier, can be a string or number
|
|
60
|
-
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
61
|
-
* @returns A unique identifier following the nanoid format
|
|
62
|
-
*/
|
|
63
|
-
export function uniqueId(param?: string | number | undefined, size?: number | undefined): string {
|
|
64
|
-
if (typeof param === "number") {
|
|
65
|
-
size = param;
|
|
66
|
-
} else if (!param || !size) {
|
|
67
|
-
size = 21; // Default size if not provided
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Use our custom getRandom function to fill a Uint8Array with random values.
|
|
71
|
-
const randomBytes = getRandom(new Uint8Array(typeof param === "string" ? size - (param.length + 1) : size));
|
|
72
|
-
|
|
73
|
-
let result = "";
|
|
74
|
-
if (typeof param === "string") {
|
|
75
|
-
// If the parameter is a string, use it as a prefix.
|
|
76
|
-
result = param + "_";
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return result + randomBytes.reduce((id, byte) => {
|
|
80
|
-
// It is incorrect to use bytes exceeding the alphabet size.
|
|
81
|
-
// The following mask reduces the random byte in the 0-255 value
|
|
82
|
-
// range to the 0-63 value range. Therefore, adding hacks, such
|
|
83
|
-
// as empty string fallback or magic numbers, is unnecessary because
|
|
84
|
-
// the bitmask trims bytes down to the alphabet size.
|
|
85
|
-
byte &= 63;
|
|
86
|
-
if (byte < 36) {
|
|
87
|
-
// \`0-9a-z\`
|
|
88
|
-
id += byte.toString(36);
|
|
89
|
-
} else if (byte < 62) {
|
|
90
|
-
// \`A-Z\`
|
|
91
|
-
id += (byte - 26).toString(36).toUpperCase();
|
|
92
|
-
} else if (byte > 62) {
|
|
93
|
-
id += "-";
|
|
94
|
-
} else {
|
|
95
|
-
id += "_";
|
|
96
|
-
}
|
|
97
|
-
return id;
|
|
98
|
-
}, "");
|
|
99
|
-
}
|
|
100
|
-
`;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
//#endregion
|
|
104
3
|
export { nanoidModule };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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_nanoid = require('./nanoid-tv7r-1sU.cjs');
|
|
30
|
+
require('./components-BWLXb7a2.cjs');
|
|
31
|
+
require('./plugin-pBKbb5K9.cjs');
|
|
32
|
+
require('./types-o3zWarRp.cjs');
|
|
5
33
|
let defu = require("defu");
|
|
6
|
-
defu =
|
|
34
|
+
defu = __toESM(defu);
|
|
7
35
|
|
|
8
36
|
//#region src/index.ts
|
|
9
37
|
/**
|
|
@@ -28,7 +56,7 @@ function plugin(options = {}) {
|
|
|
28
56
|
switch (this.config.id.type) {
|
|
29
57
|
case "nanoid":
|
|
30
58
|
default:
|
|
31
|
-
idModule =
|
|
59
|
+
idModule = require_nanoid.nanoidModule;
|
|
32
60
|
break;
|
|
33
61
|
}
|
|
34
62
|
await this.emitBuiltin(await Promise.resolve(idModule(this)), "id");
|
|
@@ -38,6 +66,7 @@ function plugin(options = {}) {
|
|
|
38
66
|
var src_default = plugin;
|
|
39
67
|
|
|
40
68
|
//#endregion
|
|
69
|
+
exports.__toESM = __toESM;
|
|
41
70
|
exports.default = src_default;
|
|
42
|
-
exports.nanoidModule =
|
|
71
|
+
exports.nanoidModule = require_nanoid.nanoidModule;
|
|
43
72
|
exports.plugin = plugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { nanoidModule } from "./
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
1
|
+
import { a as UniqueIdFormatType, c as __ΩIdPluginResolvedConfig, i as IdPluginUserConfig, l as __ΩIdPluginUserConfig, n as IdPluginOptions, o as __ΩIdPluginContext, r as IdPluginResolvedConfig, s as __ΩIdPluginOptions, t as IdPluginContext, u as __ΩUniqueIdFormatType } from "./plugin-DGFbkTdN.cjs";
|
|
2
|
+
import { t as nanoidModule } from "./nanoid-B2PspA4W.cjs";
|
|
3
|
+
import "./index-D6CnpA_r.cjs";
|
|
4
|
+
import "./index-D4ELpJXS.cjs";
|
|
5
5
|
import { Plugin } from "powerlines/types/plugin";
|
|
6
6
|
|
|
7
7
|
//#region src/index.d.ts
|
|
@@ -10,4 +10,5 @@ import { Plugin } from "powerlines/types/plugin";
|
|
|
10
10
|
*/
|
|
11
11
|
declare function plugin(options?: IdPluginOptions): Plugin<IdPluginContext>;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType, plugin as default, plugin, nanoidModule };
|
|
13
|
+
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType, plugin as default, plugin, nanoidModule };
|
|
14
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAiCgB,iBAAA,MAAA,CAAM,OAAA,CAAA,EAAU,eAAV,CAAA,EAAiC,MAAjC,CAAwC,eAAxC,CAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { nanoidModule } from "./
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
1
|
+
import { a as UniqueIdFormatType, c as __ΩIdPluginResolvedConfig, i as IdPluginUserConfig, l as __ΩIdPluginUserConfig, n as IdPluginOptions, o as __ΩIdPluginContext, r as IdPluginResolvedConfig, s as __ΩIdPluginOptions, t as IdPluginContext, u as __ΩUniqueIdFormatType } from "./plugin-CW5KujoN.mjs";
|
|
2
|
+
import { t as nanoidModule } from "./nanoid-COe3b5W5.mjs";
|
|
3
|
+
import "./index-DL0uimUT.mjs";
|
|
4
|
+
import "./index-9iG2qHLe.mjs";
|
|
5
5
|
import { Plugin } from "powerlines/types/plugin";
|
|
6
6
|
|
|
7
7
|
//#region src/index.d.ts
|
|
@@ -10,4 +10,5 @@ import { Plugin } from "powerlines/types/plugin";
|
|
|
10
10
|
*/
|
|
11
11
|
declare function plugin(options?: IdPluginOptions): Plugin<IdPluginContext>;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType, plugin as default, plugin, nanoidModule };
|
|
13
|
+
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType, plugin as default, plugin, nanoidModule };
|
|
14
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAiCgB,iBAAA,MAAA,CAAM,OAAA,CAAA,EAAU,eAAV,CAAA,EAAiC,MAAjC,CAAwC,eAAxC,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { nanoidModule } from "./
|
|
2
|
-
import "./components
|
|
1
|
+
import { t as nanoidModule } from "./nanoid-T78pG_pQ.mjs";
|
|
2
|
+
import "./components-kh0CpIG2.mjs";
|
|
3
|
+
import "./plugin-ifZVa20V.mjs";
|
|
4
|
+
import "./types-U3zd8PTP.mjs";
|
|
3
5
|
import defu from "defu";
|
|
4
6
|
|
|
5
7
|
//#region src/index.ts
|
|
@@ -35,4 +37,5 @@ function plugin(options = {}) {
|
|
|
35
37
|
var src_default = plugin;
|
|
36
38
|
|
|
37
39
|
//#endregion
|
|
38
|
-
export { src_default as default, nanoidModule, plugin };
|
|
40
|
+
export { src_default as default, nanoidModule, plugin };
|
|
41
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["idModule!: (context: IdPluginContext) => string"],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines/types/plugin\";\nimport { nanoidModule } from \"./components/nanoid\";\nimport {\n IdPluginContext,\n IdPluginOptions,\n IdPluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./components\";\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport function plugin(options: IdPluginOptions = {}): Plugin<IdPluginContext> {\n return {\n name: \"id\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `id` build plugin.\"\n );\n\n const config = {\n id: defu(options, {\n type: \"nanoid\"\n })\n } as Partial<IdPluginUserConfig>;\n\n if (!config.id!.type || ![\"nanoid\"].includes(config.id!.type)) {\n if (config.id!.type) {\n this.warn(\n `Invalid ID generation type \"${config.id!.type}\" specified. Defaulting to \"nanoid\".`\n );\n }\n\n config.id!.type = \"nanoid\";\n }\n\n this.debug(`Using ID generation library: ${config.id!.type}`);\n\n return config;\n },\n async prepare() {\n this.debug(\n \"Preparing the ID runtime artifacts for the Powerlines project.\"\n );\n\n let idModule!: (context: IdPluginContext) => string;\n switch (this.config.id.type) {\n case \"nanoid\":\n default:\n // Default to nanoid if no type is specified or if the type is not recognized\n idModule = nanoidModule;\n break;\n }\n\n await this.emitBuiltin(await Promise.resolve(idModule(this)), \"id\");\n }\n };\n}\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;AAiCA,SAAgB,OAAO,UAA2B,EAAE,EAA2B;AAC7E,QAAO;EACL,MAAM;EACN,MAAM,SAAS;AACb,QAAK,MACH,wEACD;GAED,MAAM,SAAS,EACb,IAAI,KAAK,SAAS,EAChB,MAAM,UACP,CAAC,EACH;AAED,OAAI,CAAC,OAAO,GAAI,QAAQ,CAAC,CAAC,SAAS,CAAC,SAAS,OAAO,GAAI,KAAK,EAAE;AAC7D,QAAI,OAAO,GAAI,KACb,MAAK,KACH,+BAA+B,OAAO,GAAI,KAAK,sCAChD;AAGH,WAAO,GAAI,OAAO;;AAGpB,QAAK,MAAM,gCAAgC,OAAO,GAAI,OAAO;AAE7D,UAAO;;EAET,MAAM,UAAU;AACd,QAAK,MACH,iEACD;GAED,IAAIA;AACJ,WAAQ,KAAK,OAAO,GAAG,MAAvB;IACE,KAAK;IACL;AAEE,gBAAW;AACX;;AAGJ,SAAM,KAAK,YAAY,MAAM,QAAQ,QAAQ,SAAS,KAAK,CAAC,EAAE,KAAK;;EAEtE;;AAGH,kBAAe"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as IdPluginContext } from "./plugin-DGFbkTdN.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
|
|
13
|
+
export { nanoidModule as t };
|
|
14
|
+
//# sourceMappingURL=nanoid-B2PspA4W.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nanoid-B2PspA4W.d.cts","names":[],"sources":["../src/components/nanoid.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;iBAAgB,YAAA,UAAsB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as IdPluginContext } from "./plugin-CW5KujoN.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
|
|
13
|
+
export { nanoidModule as t };
|
|
14
|
+
//# sourceMappingURL=nanoid-COe3b5W5.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nanoid-COe3b5W5.d.mts","names":[],"sources":["../src/components/nanoid.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;iBAAgB,YAAA,UAAsB"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { getFileHeader } from "powerlines/lib/utilities/file-header";
|
|
2
|
+
|
|
3
|
+
//#region src/components/nanoid.ts
|
|
4
|
+
/**
|
|
5
|
+
* Generates the nanoid module content.
|
|
6
|
+
*
|
|
7
|
+
* @param context - The build context containing runtime information.
|
|
8
|
+
* @returns A string representing the nanoid module code.
|
|
9
|
+
*/
|
|
10
|
+
function nanoidModule(context) {
|
|
11
|
+
return `
|
|
12
|
+
/**
|
|
13
|
+
* The ID module provides a set of utilities for generating unique identifiers.
|
|
14
|
+
*
|
|
15
|
+
* @module ${context.config.framework}:id
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
${getFileHeader(context)}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Generate a random string
|
|
22
|
+
*
|
|
23
|
+
* @param array - The array to fill with random values
|
|
24
|
+
* @returns The array filled with random values
|
|
25
|
+
*/
|
|
26
|
+
export function getRandom(array: Uint8Array) {
|
|
27
|
+
if (array === null) {
|
|
28
|
+
throw new StormError({ type: "general", code: 9 });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Fill the array with random values
|
|
32
|
+
for (let i = 0; i < array.length; i++) {
|
|
33
|
+
array[i] = Math.floor(Math.random() * 256); // Random byte (0-255)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return array;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
41
|
+
*
|
|
42
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
43
|
+
* @returns A unique identifier following the nanoid format
|
|
44
|
+
*/
|
|
45
|
+
export function uniqueId(size?: number | undefined): string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
49
|
+
*
|
|
50
|
+
* @param prefix - The prefix to use for the unique identifier
|
|
51
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
52
|
+
* @returns A unique identifier following the nanoid format
|
|
53
|
+
*/
|
|
54
|
+
export function uniqueId(prefix?: string, size?: number | undefined): string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
58
|
+
*
|
|
59
|
+
* @param param - The parameter to use for the unique identifier, can be a string or number
|
|
60
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
61
|
+
* @returns A unique identifier following the nanoid format
|
|
62
|
+
*/
|
|
63
|
+
export function uniqueId(param?: string | number | undefined, size?: number | undefined): string {
|
|
64
|
+
if (typeof param === "number") {
|
|
65
|
+
size = param;
|
|
66
|
+
} else if (!param || !size) {
|
|
67
|
+
size = 21; // Default size if not provided
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Use our custom getRandom function to fill a Uint8Array with random values.
|
|
71
|
+
const randomBytes = getRandom(new Uint8Array(typeof param === "string" ? size - (param.length + 1) : size));
|
|
72
|
+
|
|
73
|
+
let result = "";
|
|
74
|
+
if (typeof param === "string") {
|
|
75
|
+
// If the parameter is a string, use it as a prefix.
|
|
76
|
+
result = param + "_";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return result + randomBytes.reduce((id, byte) => {
|
|
80
|
+
// It is incorrect to use bytes exceeding the alphabet size.
|
|
81
|
+
// The following mask reduces the random byte in the 0-255 value
|
|
82
|
+
// range to the 0-63 value range. Therefore, adding hacks, such
|
|
83
|
+
// as empty string fallback or magic numbers, is unnecessary because
|
|
84
|
+
// the bitmask trims bytes down to the alphabet size.
|
|
85
|
+
byte &= 63;
|
|
86
|
+
if (byte < 36) {
|
|
87
|
+
// \`0-9a-z\`
|
|
88
|
+
id += byte.toString(36);
|
|
89
|
+
} else if (byte < 62) {
|
|
90
|
+
// \`A-Z\`
|
|
91
|
+
id += (byte - 26).toString(36).toUpperCase();
|
|
92
|
+
} else if (byte > 62) {
|
|
93
|
+
id += "-";
|
|
94
|
+
} else {
|
|
95
|
+
id += "_";
|
|
96
|
+
}
|
|
97
|
+
return id;
|
|
98
|
+
}, "");
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
export { nanoidModule as t };
|
|
105
|
+
//# sourceMappingURL=nanoid-T78pG_pQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nanoid-T78pG_pQ.mjs","names":[],"sources":["../src/components/nanoid.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getFileHeader } from \"powerlines/lib/utilities/file-header\";\nimport { IdPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the nanoid module content.\n *\n * @param context - The build context containing runtime information.\n * @returns A string representing the nanoid module code.\n */\nexport function nanoidModule(context: IdPluginContext) {\n return `\n/**\n * The ID module provides a set of utilities for generating unique identifiers.\n *\n * @module ${context.config.framework}:id\n */\n\n${getFileHeader(context)}\n\n/**\n * Generate a random string\n *\n * @param array - The array to fill with random values\n * @returns The array filled with random values\n */\nexport function getRandom(array: Uint8Array) {\n if (array === null) {\n throw new StormError({ type: \"general\", code: 9 });\n }\n\n // Fill the array with random values\n for (let i = 0; i < array.length; i++) {\n array[i] = Math.floor(Math.random() * 256); // Random byte (0-255)\n }\n\n return array;\n}\n\n/**\n * A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.\n *\n * @param size - The size of the string to generate. Defaults to 21 if not provided.\n * @returns A unique identifier following the nanoid format\n */\nexport function uniqueId(size?: number | undefined): string;\n\n/**\n * A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.\n *\n * @param prefix - The prefix to use for the unique identifier\n * @param size - The size of the string to generate. Defaults to 21 if not provided.\n * @returns A unique identifier following the nanoid format\n */\nexport function uniqueId(prefix?: string, size?: number | undefined): string;\n\n/**\n * A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.\n *\n * @param param - The parameter to use for the unique identifier, can be a string or number\n * @param size - The size of the string to generate. Defaults to 21 if not provided.\n * @returns A unique identifier following the nanoid format\n */\nexport function uniqueId(param?: string | number | undefined, size?: number | undefined): string {\n if (typeof param === \"number\") {\n size = param;\n } else if (!param || !size) {\n size = 21; // Default size if not provided\n }\n\n // Use our custom getRandom function to fill a Uint8Array with random values.\n const randomBytes = getRandom(new Uint8Array(typeof param === \"string\" ? size - (param.length + 1) : size));\n\n let result = \"\";\n if (typeof param === \"string\") {\n // If the parameter is a string, use it as a prefix.\n result = param + \"_\";\n }\n\n return result + randomBytes.reduce((id, byte) => {\n // It is incorrect to use bytes exceeding the alphabet size.\n // The following mask reduces the random byte in the 0-255 value\n // range to the 0-63 value range. Therefore, adding hacks, such\n // as empty string fallback or magic numbers, is unnecessary because\n // the bitmask trims bytes down to the alphabet size.\n byte &= 63;\n if (byte < 36) {\n // \\`0-9a-z\\`\n id += byte.toString(36);\n } else if (byte < 62) {\n // \\`A-Z\\`\n id += (byte - 26).toString(36).toUpperCase();\n } else if (byte > 62) {\n id += \"-\";\n } else {\n id += \"_\";\n }\n return id;\n }, \"\");\n}\n`;\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgB,aAAa,SAA0B;AACrD,QAAO;;;;aAII,QAAQ,OAAO,UAAU;;;EAGpC,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const require_index = require('./index.cjs');
|
|
2
|
+
let powerlines_lib_utilities_file_header = require("powerlines/lib/utilities/file-header");
|
|
3
|
+
|
|
4
|
+
//#region src/components/nanoid.ts
|
|
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
|
+
function nanoidModule(context) {
|
|
12
|
+
return `
|
|
13
|
+
/**
|
|
14
|
+
* The ID module provides a set of utilities for generating unique identifiers.
|
|
15
|
+
*
|
|
16
|
+
* @module ${context.config.framework}:id
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
${(0, powerlines_lib_utilities_file_header.getFileHeader)(context)}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Generate a random string
|
|
23
|
+
*
|
|
24
|
+
* @param array - The array to fill with random values
|
|
25
|
+
* @returns The array filled with random values
|
|
26
|
+
*/
|
|
27
|
+
export function getRandom(array: Uint8Array) {
|
|
28
|
+
if (array === null) {
|
|
29
|
+
throw new StormError({ type: "general", code: 9 });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Fill the array with random values
|
|
33
|
+
for (let i = 0; i < array.length; i++) {
|
|
34
|
+
array[i] = Math.floor(Math.random() * 256); // Random byte (0-255)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return array;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
42
|
+
*
|
|
43
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
44
|
+
* @returns A unique identifier following the nanoid format
|
|
45
|
+
*/
|
|
46
|
+
export function uniqueId(size?: number | undefined): string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
50
|
+
*
|
|
51
|
+
* @param prefix - The prefix to use for the unique identifier
|
|
52
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
53
|
+
* @returns A unique identifier following the nanoid format
|
|
54
|
+
*/
|
|
55
|
+
export function uniqueId(prefix?: string, size?: number | undefined): string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
59
|
+
*
|
|
60
|
+
* @param param - The parameter to use for the unique identifier, can be a string or number
|
|
61
|
+
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
62
|
+
* @returns A unique identifier following the nanoid format
|
|
63
|
+
*/
|
|
64
|
+
export function uniqueId(param?: string | number | undefined, size?: number | undefined): string {
|
|
65
|
+
if (typeof param === "number") {
|
|
66
|
+
size = param;
|
|
67
|
+
} else if (!param || !size) {
|
|
68
|
+
size = 21; // Default size if not provided
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Use our custom getRandom function to fill a Uint8Array with random values.
|
|
72
|
+
const randomBytes = getRandom(new Uint8Array(typeof param === "string" ? size - (param.length + 1) : size));
|
|
73
|
+
|
|
74
|
+
let result = "";
|
|
75
|
+
if (typeof param === "string") {
|
|
76
|
+
// If the parameter is a string, use it as a prefix.
|
|
77
|
+
result = param + "_";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return result + randomBytes.reduce((id, byte) => {
|
|
81
|
+
// It is incorrect to use bytes exceeding the alphabet size.
|
|
82
|
+
// The following mask reduces the random byte in the 0-255 value
|
|
83
|
+
// range to the 0-63 value range. Therefore, adding hacks, such
|
|
84
|
+
// as empty string fallback or magic numbers, is unnecessary because
|
|
85
|
+
// the bitmask trims bytes down to the alphabet size.
|
|
86
|
+
byte &= 63;
|
|
87
|
+
if (byte < 36) {
|
|
88
|
+
// \`0-9a-z\`
|
|
89
|
+
id += byte.toString(36);
|
|
90
|
+
} else if (byte < 62) {
|
|
91
|
+
// \`A-Z\`
|
|
92
|
+
id += (byte - 26).toString(36).toUpperCase();
|
|
93
|
+
} else if (byte > 62) {
|
|
94
|
+
id += "-";
|
|
95
|
+
} else {
|
|
96
|
+
id += "_";
|
|
97
|
+
}
|
|
98
|
+
return id;
|
|
99
|
+
}, "");
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//#endregion
|
|
105
|
+
Object.defineProperty(exports, 'nanoidModule', {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
get: function () {
|
|
108
|
+
return nanoidModule;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { UserConfig } from "powerlines/types/config";
|
|
2
|
+
import { PluginContext } from "powerlines/types/context";
|
|
3
|
+
import { ResolvedConfig } from "powerlines/types/resolved";
|
|
4
|
+
|
|
5
|
+
//#region src/types/plugin.d.ts
|
|
6
|
+
type UniqueIdFormatType = "nanoid";
|
|
7
|
+
interface IdPluginOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The type of ID generation format to use
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This value is used to determine which ID generation format to use. It can be one of the following:
|
|
13
|
+
* - [nanoid](https://github.com/ai/nanoid)
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue "nanoid"
|
|
16
|
+
*/
|
|
17
|
+
type?: UniqueIdFormatType;
|
|
18
|
+
}
|
|
19
|
+
interface IdPluginUserConfig extends UserConfig {
|
|
20
|
+
/**
|
|
21
|
+
* Options for the ID plugin.
|
|
22
|
+
*/
|
|
23
|
+
id?: IdPluginOptions;
|
|
24
|
+
}
|
|
25
|
+
interface IdPluginResolvedConfig extends ResolvedConfig {
|
|
26
|
+
/**
|
|
27
|
+
* Options for the ID plugin.
|
|
28
|
+
*/
|
|
29
|
+
id: Required<IdPluginOptions>;
|
|
30
|
+
}
|
|
31
|
+
type IdPluginContext<TResolvedConfig extends IdPluginResolvedConfig = IdPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
32
|
+
declare type __ΩUniqueIdFormatType = any[];
|
|
33
|
+
declare type __ΩIdPluginOptions = any[];
|
|
34
|
+
declare type __ΩIdPluginUserConfig = any[];
|
|
35
|
+
declare type __ΩIdPluginResolvedConfig = any[];
|
|
36
|
+
declare type __ΩIdPluginContext = any[];
|
|
37
|
+
//#endregion
|
|
38
|
+
export { UniqueIdFormatType as a, __ΩIdPluginResolvedConfig as c, IdPluginUserConfig as i, __ΩIdPluginUserConfig as l, IdPluginOptions as n, __ΩIdPluginContext as o, IdPluginResolvedConfig as r, __ΩIdPluginOptions as s, IdPluginContext as t, __ΩUniqueIdFormatType as u };
|
|
39
|
+
//# sourceMappingURL=plugin-CW5KujoN.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-CW5KujoN.d.mts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAsBY,kBAAA;UAEK,eAAA;EAFL;AAEZ;AAaA;AAOA;;;;;AAOA;EAC0B,IAAA,CAAA,EAlBjB,kBAkBiB;;AACR,UAhBD,kBAAA,SAA2B,UAgB1B,CAAA;EAAd;;;OAZG;;UAGU,sBAAA,SAA+B;;;;MAI1C,SAAS;;KAGH,wCACc,yBAAyB,0BAC/C,cAAc"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { UserConfig } from "powerlines/types/config";
|
|
2
|
+
import { PluginContext } from "powerlines/types/context";
|
|
3
|
+
import { ResolvedConfig } from "powerlines/types/resolved";
|
|
4
|
+
|
|
5
|
+
//#region src/types/plugin.d.ts
|
|
6
|
+
type UniqueIdFormatType = "nanoid";
|
|
7
|
+
interface IdPluginOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The type of ID generation format to use
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This value is used to determine which ID generation format to use. It can be one of the following:
|
|
13
|
+
* - [nanoid](https://github.com/ai/nanoid)
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue "nanoid"
|
|
16
|
+
*/
|
|
17
|
+
type?: UniqueIdFormatType;
|
|
18
|
+
}
|
|
19
|
+
interface IdPluginUserConfig extends UserConfig {
|
|
20
|
+
/**
|
|
21
|
+
* Options for the ID plugin.
|
|
22
|
+
*/
|
|
23
|
+
id?: IdPluginOptions;
|
|
24
|
+
}
|
|
25
|
+
interface IdPluginResolvedConfig extends ResolvedConfig {
|
|
26
|
+
/**
|
|
27
|
+
* Options for the ID plugin.
|
|
28
|
+
*/
|
|
29
|
+
id: Required<IdPluginOptions>;
|
|
30
|
+
}
|
|
31
|
+
type IdPluginContext<TResolvedConfig extends IdPluginResolvedConfig = IdPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
32
|
+
declare type __ΩUniqueIdFormatType = any[];
|
|
33
|
+
declare type __ΩIdPluginOptions = any[];
|
|
34
|
+
declare type __ΩIdPluginUserConfig = any[];
|
|
35
|
+
declare type __ΩIdPluginResolvedConfig = any[];
|
|
36
|
+
declare type __ΩIdPluginContext = any[];
|
|
37
|
+
//#endregion
|
|
38
|
+
export { UniqueIdFormatType as a, __ΩIdPluginResolvedConfig as c, IdPluginUserConfig as i, __ΩIdPluginUserConfig as l, IdPluginOptions as n, __ΩIdPluginContext as o, IdPluginResolvedConfig as r, __ΩIdPluginOptions as s, IdPluginContext as t, __ΩUniqueIdFormatType as u };
|
|
39
|
+
//# sourceMappingURL=plugin-DGFbkTdN.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-DGFbkTdN.d.cts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;KAsBY,kBAAA;UAEK,eAAA;EAFL;AAEZ;AAaA;AAOA;;;;;AAOA;EAC0B,IAAA,CAAA,EAlBjB,kBAkBiB;;AACR,UAhBD,kBAAA,SAA2B,UAgB1B,CAAA;EAAd;;;OAZG;;UAGU,sBAAA,SAA+B;;;;MAI1C,SAAS;;KAGH,wCACc,yBAAyB,0BAC/C,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
package/dist/types/index.cjs
CHANGED
package/dist/types/index.d.cts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as UniqueIdFormatType, c as __ΩIdPluginResolvedConfig, i as IdPluginUserConfig, l as __ΩIdPluginUserConfig, n as IdPluginOptions, o as __ΩIdPluginContext, r as IdPluginResolvedConfig, s as __ΩIdPluginOptions, t as IdPluginContext, u as __ΩUniqueIdFormatType } from "../plugin-DGFbkTdN.cjs";
|
|
2
|
+
import "../index-D4ELpJXS.cjs";
|
|
2
3
|
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as UniqueIdFormatType, c as __ΩIdPluginResolvedConfig, i as IdPluginUserConfig, l as __ΩIdPluginUserConfig, n as IdPluginOptions, o as __ΩIdPluginContext, r as IdPluginResolvedConfig, s as __ΩIdPluginOptions, t as IdPluginContext, u as __ΩUniqueIdFormatType } from "../plugin-CW5KujoN.mjs";
|
|
2
|
+
import "../index-9iG2qHLe.mjs";
|
|
2
3
|
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType };
|
package/dist/types/index.mjs
CHANGED
package/dist/types/plugin.cjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('../plugin-pBKbb5K9.cjs');
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,38 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PluginContext } from "powerlines/types/context";
|
|
3
|
-
import { ResolvedConfig } from "powerlines/types/resolved";
|
|
4
|
-
|
|
5
|
-
//#region src/types/plugin.d.ts
|
|
6
|
-
type UniqueIdFormatType = "nanoid";
|
|
7
|
-
interface IdPluginOptions {
|
|
8
|
-
/**
|
|
9
|
-
* The type of ID generation format to use
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* This value is used to determine which ID generation format to use. It can be one of the following:
|
|
13
|
-
* - [nanoid](https://github.com/ai/nanoid)
|
|
14
|
-
*
|
|
15
|
-
* @defaultValue "nanoid"
|
|
16
|
-
*/
|
|
17
|
-
type?: UniqueIdFormatType;
|
|
18
|
-
}
|
|
19
|
-
interface IdPluginUserConfig extends UserConfig {
|
|
20
|
-
/**
|
|
21
|
-
* Options for the ID plugin.
|
|
22
|
-
*/
|
|
23
|
-
id?: IdPluginOptions;
|
|
24
|
-
}
|
|
25
|
-
interface IdPluginResolvedConfig extends ResolvedConfig {
|
|
26
|
-
/**
|
|
27
|
-
* Options for the ID plugin.
|
|
28
|
-
*/
|
|
29
|
-
id: Required<IdPluginOptions>;
|
|
30
|
-
}
|
|
31
|
-
type IdPluginContext<TResolvedConfig extends IdPluginResolvedConfig = IdPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
32
|
-
declare type __ΩUniqueIdFormatType = any[];
|
|
33
|
-
declare type __ΩIdPluginOptions = any[];
|
|
34
|
-
declare type __ΩIdPluginUserConfig = any[];
|
|
35
|
-
declare type __ΩIdPluginResolvedConfig = any[];
|
|
36
|
-
declare type __ΩIdPluginContext = any[];
|
|
37
|
-
//#endregion
|
|
1
|
+
import { a as UniqueIdFormatType, c as __ΩIdPluginResolvedConfig, i as IdPluginUserConfig, l as __ΩIdPluginUserConfig, n as IdPluginOptions, o as __ΩIdPluginContext, r as IdPluginResolvedConfig, s as __ΩIdPluginOptions, t as IdPluginContext, u as __ΩUniqueIdFormatType } from "../plugin-DGFbkTdN.cjs";
|
|
38
2
|
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType };
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,38 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PluginContext } from "powerlines/types/context";
|
|
3
|
-
import { ResolvedConfig } from "powerlines/types/resolved";
|
|
4
|
-
|
|
5
|
-
//#region src/types/plugin.d.ts
|
|
6
|
-
type UniqueIdFormatType = "nanoid";
|
|
7
|
-
interface IdPluginOptions {
|
|
8
|
-
/**
|
|
9
|
-
* The type of ID generation format to use
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* This value is used to determine which ID generation format to use. It can be one of the following:
|
|
13
|
-
* - [nanoid](https://github.com/ai/nanoid)
|
|
14
|
-
*
|
|
15
|
-
* @defaultValue "nanoid"
|
|
16
|
-
*/
|
|
17
|
-
type?: UniqueIdFormatType;
|
|
18
|
-
}
|
|
19
|
-
interface IdPluginUserConfig extends UserConfig {
|
|
20
|
-
/**
|
|
21
|
-
* Options for the ID plugin.
|
|
22
|
-
*/
|
|
23
|
-
id?: IdPluginOptions;
|
|
24
|
-
}
|
|
25
|
-
interface IdPluginResolvedConfig extends ResolvedConfig {
|
|
26
|
-
/**
|
|
27
|
-
* Options for the ID plugin.
|
|
28
|
-
*/
|
|
29
|
-
id: Required<IdPluginOptions>;
|
|
30
|
-
}
|
|
31
|
-
type IdPluginContext<TResolvedConfig extends IdPluginResolvedConfig = IdPluginResolvedConfig> = PluginContext<TResolvedConfig>;
|
|
32
|
-
declare type __ΩUniqueIdFormatType = any[];
|
|
33
|
-
declare type __ΩIdPluginOptions = any[];
|
|
34
|
-
declare type __ΩIdPluginUserConfig = any[];
|
|
35
|
-
declare type __ΩIdPluginResolvedConfig = any[];
|
|
36
|
-
declare type __ΩIdPluginContext = any[];
|
|
37
|
-
//#endregion
|
|
1
|
+
import { a as UniqueIdFormatType, c as __ΩIdPluginResolvedConfig, i as IdPluginUserConfig, l as __ΩIdPluginUserConfig, n as IdPluginOptions, o as __ΩIdPluginContext, r as IdPluginResolvedConfig, s as __ΩIdPluginOptions, t as IdPluginContext, u as __ΩUniqueIdFormatType } from "../plugin-CW5KujoN.mjs";
|
|
38
2
|
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType };
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-id",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.249",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Powerlines plugin that provides unique identifier generation capabilities at runtime by adding the `id` builtin module.",
|
|
6
6
|
"repository": {
|
|
@@ -117,15 +117,15 @@
|
|
|
117
117
|
"@storm-software/config-tools": "^1.189.0",
|
|
118
118
|
"@stryke/path": "^0.26.3",
|
|
119
119
|
"defu": "^6.1.4",
|
|
120
|
-
"powerlines": "^0.38.
|
|
120
|
+
"powerlines": "^0.38.7"
|
|
121
121
|
},
|
|
122
122
|
"devDependencies": {
|
|
123
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
123
|
+
"@powerlines/plugin-plugin": "^0.12.191",
|
|
124
124
|
"@types/node": "^24.10.9"
|
|
125
125
|
},
|
|
126
126
|
"publishConfig": { "access": "public" },
|
|
127
127
|
"main": "./dist/index.cjs",
|
|
128
128
|
"module": "./dist/index.mjs",
|
|
129
129
|
"types": "./dist/index.d.cts",
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "d389997536baee28d116675d7916d9bfa5596dce"
|
|
131
131
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
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;
|