@powerlines/plugin-id 0.9.131 → 0.9.133
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 +29 -0
- package/dist/components/index.cjs +2 -3
- package/dist/components/index.d.cts +1 -3
- package/dist/components/index.d.mts +1 -3
- package/dist/components/index.mjs +1 -2
- package/dist/components/nanoid.cjs +103 -2
- package/dist/components/nanoid.d.cts +12 -2
- package/dist/components/nanoid.d.mts +12 -2
- package/dist/components/nanoid.mjs +102 -1
- package/dist/index.cjs +6 -35
- package/dist/index.d.cts +3 -4
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +2 -4
- package/dist/powerlines/src/lib/utilities/file-header.cjs +22 -0
- package/dist/powerlines/src/lib/utilities/file-header.mjs +21 -0
- package/dist/powerlines/src/types/babel.d.mts +2 -0
- package/dist/powerlines/src/types/build.d.cts +145 -0
- package/dist/powerlines/src/types/build.d.mts +145 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +9 -0
- package/dist/powerlines/src/types/config.d.cts +376 -0
- package/dist/powerlines/src/types/config.d.mts +376 -0
- package/dist/powerlines/src/types/context.d.cts +403 -0
- package/dist/powerlines/src/types/context.d.mts +405 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/fs.d.mts +486 -0
- package/dist/powerlines/src/types/hooks.d.mts +2 -0
- package/dist/powerlines/src/types/plugin.d.cts +231 -0
- package/dist/powerlines/src/types/plugin.d.mts +231 -0
- package/dist/powerlines/src/types/resolved.d.cts +81 -0
- package/dist/powerlines/src/types/resolved.d.mts +81 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/types/index.cjs +0 -2
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.mts +1 -2
- package/dist/types/index.mjs +0 -3
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +37 -1
- package/dist/types/plugin.d.mts +37 -1
- package/dist/types/plugin.mjs +0 -2
- package/package.json +4 -4
- package/dist/components-BWLXb7a2.cjs +0 -0
- package/dist/components-kh0CpIG2.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-Ck7ultxE.mjs +0 -122
- package/dist/nanoid-DeeBhFoV.d.cts +0 -13
- package/dist/nanoid-DvIF2L1a.cjs +0 -128
- package/dist/nanoid-w9uyqUyr.d.mts +0 -13
- package/dist/plugin-DTBvnr5N.d.mts +0 -1782
- package/dist/plugin-DwyRXCvA.d.cts +0 -1782
- package/dist/plugin-ifZVa20V.mjs +0 -1
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/types-U3zd8PTP.mjs +0 -1
- package/dist/types-o3zWarRp.cjs +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/types/tsconfig.d.ts
|
|
5
|
+
type ReflectionMode = "default" | "explicit" | "never";
|
|
6
|
+
type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
12
|
+
* - `minimal` - Only the essential type information is captured.
|
|
13
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
14
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
15
|
+
*/
|
|
16
|
+
type ReflectionLevel = "minimal" | "normal" | "verbose";
|
|
17
|
+
interface DeepkitOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Either true to activate reflection for all files compiled using this tsconfig,
|
|
20
|
+
* or a list of globs/file paths relative to this tsconfig.json.
|
|
21
|
+
* Globs/file paths can be prefixed with a ! to exclude them.
|
|
22
|
+
*/
|
|
23
|
+
reflection?: RawReflectionMode;
|
|
24
|
+
/**
|
|
25
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
29
|
+
* - `minimal` - Only the essential type information is captured.
|
|
30
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
31
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
32
|
+
*/
|
|
33
|
+
reflectionLevel?: ReflectionLevel;
|
|
34
|
+
}
|
|
35
|
+
type TSCompilerOptions = CompilerOptions & DeepkitOptions;
|
|
36
|
+
/**
|
|
37
|
+
* The TypeScript compiler configuration.
|
|
38
|
+
*
|
|
39
|
+
* @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
|
|
40
|
+
*/
|
|
41
|
+
interface TSConfig extends Omit<TsConfigJson, "reflection"> {
|
|
42
|
+
/**
|
|
43
|
+
* Either true to activate reflection for all files compiled using this tsconfig,
|
|
44
|
+
* or a list of globs/file paths relative to this tsconfig.json.
|
|
45
|
+
* Globs/file paths can be prefixed with a ! to exclude them.
|
|
46
|
+
*/
|
|
47
|
+
reflection?: RawReflectionMode;
|
|
48
|
+
/**
|
|
49
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
53
|
+
* - `minimal` - Only the essential type information is captured.
|
|
54
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
55
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
56
|
+
*/
|
|
57
|
+
reflectionLevel?: ReflectionLevel;
|
|
58
|
+
/**
|
|
59
|
+
* Instructs the TypeScript compiler how to compile `.ts` files.
|
|
60
|
+
*/
|
|
61
|
+
compilerOptions?: TSCompilerOptions;
|
|
62
|
+
}
|
|
63
|
+
type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
|
|
64
|
+
originalTsconfigJson: TsConfigJson;
|
|
65
|
+
tsconfigJson: TSConfig;
|
|
66
|
+
tsconfigFilePath: string;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { ParsedTypeScriptConfig, TSConfig };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/types/tsconfig.d.ts
|
|
5
|
+
type ReflectionMode = "default" | "explicit" | "never";
|
|
6
|
+
type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
12
|
+
* - `minimal` - Only the essential type information is captured.
|
|
13
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
14
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
15
|
+
*/
|
|
16
|
+
type ReflectionLevel = "minimal" | "normal" | "verbose";
|
|
17
|
+
interface DeepkitOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Either true to activate reflection for all files compiled using this tsconfig,
|
|
20
|
+
* or a list of globs/file paths relative to this tsconfig.json.
|
|
21
|
+
* Globs/file paths can be prefixed with a ! to exclude them.
|
|
22
|
+
*/
|
|
23
|
+
reflection?: RawReflectionMode;
|
|
24
|
+
/**
|
|
25
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
29
|
+
* - `minimal` - Only the essential type information is captured.
|
|
30
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
31
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
32
|
+
*/
|
|
33
|
+
reflectionLevel?: ReflectionLevel;
|
|
34
|
+
}
|
|
35
|
+
type TSCompilerOptions = CompilerOptions & DeepkitOptions;
|
|
36
|
+
/**
|
|
37
|
+
* The TypeScript compiler configuration.
|
|
38
|
+
*
|
|
39
|
+
* @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
|
|
40
|
+
*/
|
|
41
|
+
interface TSConfig extends Omit<TsConfigJson, "reflection"> {
|
|
42
|
+
/**
|
|
43
|
+
* Either true to activate reflection for all files compiled using this tsconfig,
|
|
44
|
+
* or a list of globs/file paths relative to this tsconfig.json.
|
|
45
|
+
* Globs/file paths can be prefixed with a ! to exclude them.
|
|
46
|
+
*/
|
|
47
|
+
reflection?: RawReflectionMode;
|
|
48
|
+
/**
|
|
49
|
+
* Defines the level of reflection to be used during the transpilation process.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
|
|
53
|
+
* - `minimal` - Only the essential type information is captured.
|
|
54
|
+
* - `normal` - Additional type information is captured, including some contextual data.
|
|
55
|
+
* - `verbose` - All available type information is captured, including detailed contextual data.
|
|
56
|
+
*/
|
|
57
|
+
reflectionLevel?: ReflectionLevel;
|
|
58
|
+
/**
|
|
59
|
+
* Instructs the TypeScript compiler how to compile `.ts` files.
|
|
60
|
+
*/
|
|
61
|
+
compilerOptions?: TSCompilerOptions;
|
|
62
|
+
}
|
|
63
|
+
type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
|
|
64
|
+
originalTsconfigJson: TsConfigJson;
|
|
65
|
+
tsconfigJson: TSConfig;
|
|
66
|
+
tsconfigFilePath: string;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { ParsedTypeScriptConfig, TSConfig };
|
package/dist/types/index.cjs
CHANGED
package/dist/types/index.d.cts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../index-D4ELpJXS.cjs";
|
|
1
|
+
import { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType } from "./plugin.cjs";
|
|
3
2
|
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../index-9iG2qHLe.mjs";
|
|
1
|
+
import { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType } from "./plugin.mjs";
|
|
3
2
|
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType };
|
package/dist/types/index.mjs
CHANGED
package/dist/types/plugin.cjs
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require('../plugin-pBKbb5K9.cjs');
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,2 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ResolvedConfig } from "../powerlines/src/types/resolved.cjs";
|
|
2
|
+
import { PluginContext } from "../powerlines/src/types/context.cjs";
|
|
3
|
+
import { UserConfig } from "../powerlines/src/types/config.cjs";
|
|
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
|
|
2
38
|
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType };
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,2 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ResolvedConfig } from "../powerlines/src/types/resolved.mjs";
|
|
2
|
+
import { PluginContext } from "../powerlines/src/types/context.mjs";
|
|
3
|
+
import { UserConfig } from "../powerlines/src/types/config.mjs";
|
|
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
|
|
2
38
|
export { IdPluginContext, IdPluginOptions, IdPluginResolvedConfig, IdPluginUserConfig, UniqueIdFormatType, __ΩIdPluginContext, __ΩIdPluginOptions, __ΩIdPluginResolvedConfig, __ΩIdPluginUserConfig, __ΩUniqueIdFormatType };
|
package/dist/types/plugin.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-id",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.133",
|
|
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": {
|
|
@@ -131,13 +131,13 @@
|
|
|
131
131
|
"@storm-software/config-tools": "^1.188.75",
|
|
132
132
|
"@stryke/path": "^0.24.1",
|
|
133
133
|
"defu": "^6.1.4",
|
|
134
|
-
"powerlines": "^0.36.
|
|
134
|
+
"powerlines": "^0.36.28"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
|
-
"@powerlines/nx": "^0.11.
|
|
137
|
+
"@powerlines/nx": "^0.11.54",
|
|
138
138
|
"@storm-software/tsup": "^0.2.73",
|
|
139
139
|
"@types/node": "^24.10.4"
|
|
140
140
|
},
|
|
141
141
|
"publishConfig": { "access": "public" },
|
|
142
|
-
"gitHead": "
|
|
142
|
+
"gitHead": "6891ff1330798e807c4caef6134df09d9f57686d"
|
|
143
143
|
}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/nanoid-Ck7ultxE.mjs
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
2
|
-
|
|
3
|
-
//#region ../powerlines/src/lib/utilities/file-header.ts
|
|
4
|
-
function getBaseFileHeader(context) {
|
|
5
|
-
return `
|
|
6
|
-
// Generated with ${titleCase(context.config.framework)}
|
|
7
|
-
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
8
|
-
`;
|
|
9
|
-
}
|
|
10
|
-
function getFileHeader(context, options = {}) {
|
|
11
|
-
const { directive = null, prettierIgnore = false } = options;
|
|
12
|
-
return `/* eslint-disable */
|
|
13
|
-
// biome-ignore lint: disable
|
|
14
|
-
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `\n\n${directive}\n` : "\n"}
|
|
15
|
-
${getBaseFileHeader(context)}
|
|
16
|
-
|
|
17
|
-
`;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/components/nanoid.ts
|
|
22
|
-
/**
|
|
23
|
-
* Generates the nanoid module content.
|
|
24
|
-
*
|
|
25
|
-
* @param context - The build context containing runtime information.
|
|
26
|
-
* @returns A string representing the nanoid module code.
|
|
27
|
-
*/
|
|
28
|
-
function nanoidModule(context) {
|
|
29
|
-
return `
|
|
30
|
-
/**
|
|
31
|
-
* The ID module provides a set of utilities for generating unique identifiers.
|
|
32
|
-
*
|
|
33
|
-
* @module ${context.config.output.builtinPrefix}:id
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
${getFileHeader(context)}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Generate a random string
|
|
40
|
-
*
|
|
41
|
-
* @param array - The array to fill with random values
|
|
42
|
-
* @returns The array filled with random values
|
|
43
|
-
*/
|
|
44
|
-
export function getRandom(array: Uint8Array) {
|
|
45
|
-
if (array === null) {
|
|
46
|
-
throw new StormError({ type: "general", code: 9 });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Fill the array with random values
|
|
50
|
-
for (let i = 0; i < array.length; i++) {
|
|
51
|
-
array[i] = Math.floor(Math.random() * 256); // Random byte (0-255)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return array;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
59
|
-
*
|
|
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(size?: number | undefined): string;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
67
|
-
*
|
|
68
|
-
* @param prefix - The prefix to use for the unique identifier
|
|
69
|
-
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
70
|
-
* @returns A unique identifier following the nanoid format
|
|
71
|
-
*/
|
|
72
|
-
export function uniqueId(prefix?: string, size?: number | undefined): string;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
76
|
-
*
|
|
77
|
-
* @param param - The parameter to use for the unique identifier, can be a string or number
|
|
78
|
-
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
79
|
-
* @returns A unique identifier following the nanoid format
|
|
80
|
-
*/
|
|
81
|
-
export function uniqueId(param?: string | number | undefined, size?: number | undefined): string {
|
|
82
|
-
if (typeof param === "number") {
|
|
83
|
-
size = param;
|
|
84
|
-
} else if (!param || !size) {
|
|
85
|
-
size = 21; // Default size if not provided
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Use our custom getRandom function to fill a Uint8Array with random values.
|
|
89
|
-
const randomBytes = getRandom(new Uint8Array(typeof param === "string" ? size - (param.length + 1) : size));
|
|
90
|
-
|
|
91
|
-
let result = "";
|
|
92
|
-
if (typeof param === "string") {
|
|
93
|
-
// If the parameter is a string, use it as a prefix.
|
|
94
|
-
result = param + "_";
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return result + randomBytes.reduce((id, byte) => {
|
|
98
|
-
// It is incorrect to use bytes exceeding the alphabet size.
|
|
99
|
-
// The following mask reduces the random byte in the 0-255 value
|
|
100
|
-
// range to the 0-63 value range. Therefore, adding hacks, such
|
|
101
|
-
// as empty string fallback or magic numbers, is unnecessary because
|
|
102
|
-
// the bitmask trims bytes down to the alphabet size.
|
|
103
|
-
byte &= 63;
|
|
104
|
-
if (byte < 36) {
|
|
105
|
-
// \`0-9a-z\`
|
|
106
|
-
id += byte.toString(36);
|
|
107
|
-
} else if (byte < 62) {
|
|
108
|
-
// \`A-Z\`
|
|
109
|
-
id += (byte - 26).toString(36).toUpperCase();
|
|
110
|
-
} else if (byte > 62) {
|
|
111
|
-
id += "-";
|
|
112
|
-
} else {
|
|
113
|
-
id += "_";
|
|
114
|
-
}
|
|
115
|
-
return id;
|
|
116
|
-
}, "");
|
|
117
|
-
}
|
|
118
|
-
`;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
//#endregion
|
|
122
|
-
export { nanoidModule as t };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { t as IdPluginContext } from "./plugin-DwyRXCvA.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 };
|
package/dist/nanoid-DvIF2L1a.cjs
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
const require_index = require('./index.cjs');
|
|
2
|
-
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
3
|
-
|
|
4
|
-
//#region ../powerlines/src/lib/utilities/file-header.ts
|
|
5
|
-
function getBaseFileHeader(context) {
|
|
6
|
-
return `
|
|
7
|
-
// Generated with ${(0, __stryke_string_format_title_case.titleCase)(context.config.framework)}
|
|
8
|
-
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
9
|
-
`;
|
|
10
|
-
}
|
|
11
|
-
function getFileHeader(context, options = {}) {
|
|
12
|
-
const { directive = null, prettierIgnore = false } = options;
|
|
13
|
-
return `/* eslint-disable */
|
|
14
|
-
// biome-ignore lint: disable
|
|
15
|
-
${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `\n\n${directive}\n` : "\n"}
|
|
16
|
-
${getBaseFileHeader(context)}
|
|
17
|
-
|
|
18
|
-
`;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/components/nanoid.ts
|
|
23
|
-
/**
|
|
24
|
-
* Generates the nanoid module content.
|
|
25
|
-
*
|
|
26
|
-
* @param context - The build context containing runtime information.
|
|
27
|
-
* @returns A string representing the nanoid module code.
|
|
28
|
-
*/
|
|
29
|
-
function nanoidModule(context) {
|
|
30
|
-
return `
|
|
31
|
-
/**
|
|
32
|
-
* The ID module provides a set of utilities for generating unique identifiers.
|
|
33
|
-
*
|
|
34
|
-
* @module ${context.config.output.builtinPrefix}:id
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
${getFileHeader(context)}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Generate a random string
|
|
41
|
-
*
|
|
42
|
-
* @param array - The array to fill with random values
|
|
43
|
-
* @returns The array filled with random values
|
|
44
|
-
*/
|
|
45
|
-
export function getRandom(array: Uint8Array) {
|
|
46
|
-
if (array === null) {
|
|
47
|
-
throw new StormError({ type: "general", code: 9 });
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Fill the array with random values
|
|
51
|
-
for (let i = 0; i < array.length; i++) {
|
|
52
|
-
array[i] = Math.floor(Math.random() * 256); // Random byte (0-255)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return array;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
60
|
-
*
|
|
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(size?: number | undefined): string;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
68
|
-
*
|
|
69
|
-
* @param prefix - The prefix to use for the unique identifier
|
|
70
|
-
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
71
|
-
* @returns A unique identifier following the nanoid format
|
|
72
|
-
*/
|
|
73
|
-
export function uniqueId(prefix?: string, size?: number | undefined): string;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
|
|
77
|
-
*
|
|
78
|
-
* @param param - The parameter to use for the unique identifier, can be a string or number
|
|
79
|
-
* @param size - The size of the string to generate. Defaults to 21 if not provided.
|
|
80
|
-
* @returns A unique identifier following the nanoid format
|
|
81
|
-
*/
|
|
82
|
-
export function uniqueId(param?: string | number | undefined, size?: number | undefined): string {
|
|
83
|
-
if (typeof param === "number") {
|
|
84
|
-
size = param;
|
|
85
|
-
} else if (!param || !size) {
|
|
86
|
-
size = 21; // Default size if not provided
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Use our custom getRandom function to fill a Uint8Array with random values.
|
|
90
|
-
const randomBytes = getRandom(new Uint8Array(typeof param === "string" ? size - (param.length + 1) : size));
|
|
91
|
-
|
|
92
|
-
let result = "";
|
|
93
|
-
if (typeof param === "string") {
|
|
94
|
-
// If the parameter is a string, use it as a prefix.
|
|
95
|
-
result = param + "_";
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return result + randomBytes.reduce((id, byte) => {
|
|
99
|
-
// It is incorrect to use bytes exceeding the alphabet size.
|
|
100
|
-
// The following mask reduces the random byte in the 0-255 value
|
|
101
|
-
// range to the 0-63 value range. Therefore, adding hacks, such
|
|
102
|
-
// as empty string fallback or magic numbers, is unnecessary because
|
|
103
|
-
// the bitmask trims bytes down to the alphabet size.
|
|
104
|
-
byte &= 63;
|
|
105
|
-
if (byte < 36) {
|
|
106
|
-
// \`0-9a-z\`
|
|
107
|
-
id += byte.toString(36);
|
|
108
|
-
} else if (byte < 62) {
|
|
109
|
-
// \`A-Z\`
|
|
110
|
-
id += (byte - 26).toString(36).toUpperCase();
|
|
111
|
-
} else if (byte > 62) {
|
|
112
|
-
id += "-";
|
|
113
|
-
} else {
|
|
114
|
-
id += "_";
|
|
115
|
-
}
|
|
116
|
-
return id;
|
|
117
|
-
}, "");
|
|
118
|
-
}
|
|
119
|
-
`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
//#endregion
|
|
123
|
-
Object.defineProperty(exports, 'nanoidModule', {
|
|
124
|
-
enumerable: true,
|
|
125
|
-
get: function () {
|
|
126
|
-
return nanoidModule;
|
|
127
|
-
}
|
|
128
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { t as IdPluginContext } from "./plugin-DTBvnr5N.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 };
|