@powerlines/plugin-id 0.9.55 → 0.9.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/components/index.cjs +1 -1
  2. package/dist/components/index.d.cts +4 -23
  3. package/dist/components/index.d.mts +4 -0
  4. package/dist/components/index.mjs +1 -0
  5. package/dist/components/nanoid.cjs +1 -96
  6. package/dist/components/nanoid.d.cts +3 -32
  7. package/dist/components/nanoid.d.mts +3 -0
  8. package/dist/components/nanoid.mjs +1 -0
  9. package/dist/components-CeJvJXAB.mjs +1 -0
  10. package/dist/index-9iG2qHLe.d.mts +1 -0
  11. package/dist/index-D4ELpJXS.d.cts +1 -0
  12. package/dist/index-D6CnpA_r.d.cts +1 -0
  13. package/dist/index-DL0uimUT.d.mts +1 -0
  14. package/dist/index.cjs +1 -7
  15. package/dist/index.d.cts +9 -26
  16. package/dist/index.d.cts.map +1 -0
  17. package/dist/index.d.mts +14 -0
  18. package/dist/index.d.mts.map +1 -0
  19. package/dist/index.mjs +2 -0
  20. package/dist/index.mjs.map +1 -0
  21. package/dist/nanoid-BMwJGbL3.cjs +99 -0
  22. package/dist/{components/nanoid.js → nanoid-Clx2gSOJ.mjs} +12 -8
  23. package/dist/nanoid-Clx2gSOJ.mjs.map +1 -0
  24. package/dist/nanoid-DaJQFnTo.d.mts +14 -0
  25. package/dist/nanoid-DaJQFnTo.d.mts.map +1 -0
  26. package/dist/nanoid-EQ7i4b1_.d.cts +14 -0
  27. package/dist/nanoid-EQ7i4b1_.d.cts.map +1 -0
  28. package/dist/plugin-BjiGfRHE.mjs +1 -0
  29. package/dist/plugin-DMubQ9jR.d.mts +1673 -0
  30. package/dist/plugin-DMubQ9jR.d.mts.map +1 -0
  31. package/dist/plugin-STBvIMqO.d.cts +1673 -0
  32. package/dist/plugin-STBvIMqO.d.cts.map +1 -0
  33. package/dist/plugin-pBKbb5K9.cjs +0 -0
  34. package/dist/types/index.cjs +1 -1
  35. package/dist/types/index.d.cts +3 -22
  36. package/dist/types/index.d.mts +3 -0
  37. package/dist/types/index.mjs +1 -0
  38. package/dist/types/plugin.cjs +1 -1
  39. package/dist/types/plugin.d.cts +2 -22
  40. package/dist/types/plugin.d.mts +2 -0
  41. package/dist/types/plugin.mjs +1 -0
  42. package/dist/types-n6NgD0QK.mjs +1 -0
  43. package/dist/types-o3zWarRp.cjs +0 -0
  44. package/package.json +37 -25
  45. package/dist/chunk-FBBMZ4NC.cjs +0 -7
  46. package/dist/chunk-UCUR73HG.js +0 -7
  47. package/dist/components/index.d.ts +0 -23
  48. package/dist/components/index.js +0 -1
  49. package/dist/components/nanoid.d.ts +0 -32
  50. package/dist/index-BOQhbVDi.d.cts +0 -1584
  51. package/dist/index-BOQhbVDi.d.ts +0 -1584
  52. package/dist/index.d.ts +0 -31
  53. package/dist/index.js +0 -7
  54. package/dist/types/index.d.ts +0 -22
  55. package/dist/types/index.js +0 -1
  56. package/dist/types/plugin.d.ts +0 -22
  57. /package/dist/{types/plugin.js → components-BWLXb7a2.cjs} +0 -0
@@ -1 +1 @@
1
- 'use strict';var nanoid=require('./nanoid');Object.keys(nanoid).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return nanoid[k]}})});
1
+ const e=require(`../nanoid-BMwJGbL3.cjs`);require(`../components-BWLXb7a2.cjs`),exports.nanoidModule=e.t;
@@ -1,23 +1,4 @@
1
- export { nanoidModule } from './nanoid.cjs';
2
- import '../index-BOQhbVDi.cjs';
3
- import '@storm-software/build-tools/types';
4
- import '@storm-software/config-tools/types';
5
- import '@storm-software/config/types';
6
- import '@stryke/types/base';
7
- import '@stryke/types/configuration';
8
- import '@stryke/types/file';
9
- import 'vite';
10
- import '@stryke/env/get-env-paths';
11
- import '@stryke/http/fetch';
12
- import '@stryke/types/package-json';
13
- import 'jiti';
14
- import 'magic-string';
15
- import 'oxc-parser';
16
- import 'semver';
17
- import 'ts-morph';
18
- import 'undici';
19
- import 'unplugin';
20
- import '@stryke/fs/resolve';
21
- import '@stryke/types/tsconfig';
22
- import 'typescript';
23
- import '@stryke/types/array';
1
+ import "../plugin-STBvIMqO.cjs";
2
+ import { t as nanoidModule } from "../nanoid-EQ7i4b1_.cjs";
3
+ import "../index-D6CnpA_r.cjs";
4
+ export { nanoidModule };
@@ -0,0 +1,4 @@
1
+ import "../plugin-DMubQ9jR.mjs";
2
+ import { t as nanoidModule } from "../nanoid-DaJQFnTo.mjs";
3
+ import "../index-DL0uimUT.mjs";
4
+ export { nanoidModule };
@@ -0,0 +1 @@
1
+ import{t as e}from"../nanoid-Clx2gSOJ.mjs";import"../components-CeJvJXAB.mjs";export{e as nanoidModule};
@@ -1,96 +1 @@
1
- 'use strict';var chunkFBBMZ4NC_cjs=require('../chunk-FBBMZ4NC.cjs'),fileHeader=require('powerlines/lib/utilities/file-header');/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- function s(e){return `
8
- /**
9
- * The ID module provides a set of utilities for generating unique identifiers.
10
- *
11
- * @module ${e.config.output.builtinPrefix}:id
12
- */
13
-
14
- ${fileHeader.getFileHeader(e)}
15
-
16
- /**
17
- * Generate a random string
18
- *
19
- * @param array - The array to fill with random values
20
- * @returns The array filled with random values
21
- */
22
- export function getRandom(array: Uint8Array) {
23
- if (array === null) {
24
- throw new StormError({ type: "general", code: 9 });
25
- }
26
-
27
- // Fill the array with random values
28
- for (let i = 0; i < array.length; i++) {
29
- array[i] = Math.floor(Math.random() * 256); // Random byte (0-255)
30
- }
31
-
32
- return array;
33
- }
34
-
35
- /**
36
- * A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
37
- *
38
- * @param size - The size of the string to generate. Defaults to 21 if not provided.
39
- * @returns A unique identifier following the nanoid format
40
- */
41
- export function uniqueId(size?: number | undefined): string;
42
-
43
- /**
44
- * A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
45
- *
46
- * @param prefix - The prefix to use for the unique identifier
47
- * @param size - The size of the string to generate. Defaults to 21 if not provided.
48
- * @returns A unique identifier following the nanoid format
49
- */
50
- export function uniqueId(prefix?: string, size?: number | undefined): string;
51
-
52
- /**
53
- * A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
54
- *
55
- * @param param - The parameter to use for the unique identifier, can be a string or number
56
- * @param size - The size of the string to generate. Defaults to 21 if not provided.
57
- * @returns A unique identifier following the nanoid format
58
- */
59
- export function uniqueId(param?: string | number | undefined, size?: number | undefined): string {
60
- if (typeof param === "number") {
61
- size = param;
62
- } else if (!param || !size) {
63
- size = 21; // Default size if not provided
64
- }
65
-
66
- // Use our custom getRandom function to fill a Uint8Array with random values.
67
- const randomBytes = getRandom(new Uint8Array(typeof param === "string" ? size - (param.length + 1) : size));
68
-
69
- let result = "";
70
- if (typeof param === "string") {
71
- // If the parameter is a string, use it as a prefix.
72
- result = param + "_";
73
- }
74
-
75
- return result + randomBytes.reduce((id, byte) => {
76
- // It is incorrect to use bytes exceeding the alphabet size.
77
- // The following mask reduces the random byte in the 0-255 value
78
- // range to the 0-63 value range. Therefore, adding hacks, such
79
- // as empty string fallback or magic numbers, is unnecessary because
80
- // the bitmask trims bytes down to the alphabet size.
81
- byte &= 63;
82
- if (byte < 36) {
83
- // \`0-9a-z\`
84
- id += byte.toString(36);
85
- } else if (byte < 62) {
86
- // \`A-Z\`
87
- id += (byte - 26).toString(36).toUpperCase();
88
- } else if (byte > 62) {
89
- id += "-";
90
- } else {
91
- id += "_";
92
- }
93
- return id;
94
- }, "");
95
- }
96
- `}chunkFBBMZ4NC_cjs.a(s,"nanoidModule");exports.nanoidModule=s;
1
+ const e=require(`../nanoid-BMwJGbL3.cjs`);exports.nanoidModule=e.t;
@@ -1,32 +1,3 @@
1
- import { a as IdPluginContext } from '../index-BOQhbVDi.cjs';
2
- import '@storm-software/build-tools/types';
3
- import '@storm-software/config-tools/types';
4
- import '@storm-software/config/types';
5
- import '@stryke/types/base';
6
- import '@stryke/types/configuration';
7
- import '@stryke/types/file';
8
- import 'vite';
9
- import '@stryke/env/get-env-paths';
10
- import '@stryke/http/fetch';
11
- import '@stryke/types/package-json';
12
- import 'jiti';
13
- import 'magic-string';
14
- import 'oxc-parser';
15
- import 'semver';
16
- import 'ts-morph';
17
- import 'undici';
18
- import 'unplugin';
19
- import '@stryke/fs/resolve';
20
- import '@stryke/types/tsconfig';
21
- import 'typescript';
22
- import '@stryke/types/array';
23
-
24
- /**
25
- * Generates the nanoid module content.
26
- *
27
- * @param context - The build context containing runtime information.
28
- * @returns A string representing the nanoid module code.
29
- */
30
- declare function nanoidModule(context: IdPluginContext): string;
31
-
32
- export { nanoidModule };
1
+ import "../plugin-STBvIMqO.cjs";
2
+ import { t as nanoidModule } from "../nanoid-EQ7i4b1_.cjs";
3
+ export { nanoidModule };
@@ -0,0 +1,3 @@
1
+ import "../plugin-DMubQ9jR.mjs";
2
+ import { t as nanoidModule } from "../nanoid-DaJQFnTo.mjs";
3
+ export { nanoidModule };
@@ -0,0 +1 @@
1
+ import{t as e}from"../nanoid-Clx2gSOJ.mjs";export{e as nanoidModule};
@@ -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,7 +1 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkFBBMZ4NC_cjs=require('./chunk-FBBMZ4NC.cjs'),types$1=require('@storm-software/config-tools/types'),o=require('defu'),nanoid=require('./components/nanoid'),components=require('./components'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- function d(e={}){return {name:"id",async config(){this.log(types$1.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `id` build plugin.");const i={id:o__default.default(e,{type:"nanoid"})};return (!i.id.type||!["nanoid"].includes(i.id.type))&&(i.id.type&&this.log(types$1.LogLevelLabel.WARN,`Invalid ID generation type "${i.id.type}" specified. Defaulting to "nanoid".`),i.id.type="nanoid"),this.log(types$1.LogLevelLabel.DEBUG,`Using ID generation library: ${i.id.type}`),i},async prepare(){this.log(types$1.LogLevelLabel.TRACE,"Preparing the ID runtime artifacts for the Powerlines project.");let i;switch(this.config.id.type){case "nanoid":default:i=nanoid.nanoidModule;break}await this.emitBuiltin(await Promise.resolve(i(this)),"id","id.ts");}}}chunkFBBMZ4NC_cjs.a(d,"plugin");var y=d;exports.default=y;exports.plugin=d;Object.keys(components).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return components[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});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));const c=require(`./nanoid-BMwJGbL3.cjs`);require(`./components-BWLXb7a2.cjs`),require(`./plugin-pBKbb5K9.cjs`),require(`./types-o3zWarRp.cjs`);let l=require(`@storm-software/config-tools/types`),u=require(`defu`);u=s(u);function d(e={}){return{name:`id`,async config(){this.log(l.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `id` build plugin.");let t={id:(0,u.default)(e,{type:`nanoid`})};return(!t.id.type||![`nanoid`].includes(t.id.type))&&(t.id.type&&this.log(l.LogLevelLabel.WARN,`Invalid ID generation type "${t.id.type}" specified. Defaulting to "nanoid".`),t.id.type=`nanoid`),this.log(l.LogLevelLabel.DEBUG,`Using ID generation library: ${t.id.type}`),t},async prepare(){this.log(l.LogLevelLabel.TRACE,`Preparing the ID runtime artifacts for the Powerlines project.`);let e;switch(this.config.id.type){case`nanoid`:default:e=c.t;break}await this.emitBuiltin(await Promise.resolve(e(this)),`id`,`id.ts`)}}}var f=d;exports.default=f,exports.nanoidModule=c.t,exports.plugin=d,exports.t=s;
package/dist/index.d.cts CHANGED
@@ -1,31 +1,14 @@
1
- import { I as IdPluginOptions, P as Plugin, a as IdPluginContext } from './index-BOQhbVDi.cjs';
2
- export { c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType, g as __ΩIdPluginContext, d as __ΩIdPluginOptions, f as __ΩIdPluginResolvedConfig, e as __ΩIdPluginUserConfig, _ as __ΩUniqueIdFormatType } from './index-BOQhbVDi.cjs';
3
- export { nanoidModule } from './components/nanoid.cjs';
4
- import '@storm-software/build-tools/types';
5
- import '@storm-software/config-tools/types';
6
- import '@storm-software/config/types';
7
- import '@stryke/types/base';
8
- import '@stryke/types/configuration';
9
- import '@stryke/types/file';
10
- import 'vite';
11
- import '@stryke/env/get-env-paths';
12
- import '@stryke/http/fetch';
13
- import '@stryke/types/package-json';
14
- import 'jiti';
15
- import 'magic-string';
16
- import 'oxc-parser';
17
- import 'semver';
18
- import 'ts-morph';
19
- import 'undici';
20
- import 'unplugin';
21
- import '@stryke/fs/resolve';
22
- import '@stryke/types/tsconfig';
23
- import 'typescript';
24
- import '@stryke/types/array';
1
+ import { a as UniqueIdFormatType, c as __ΩIdPluginResolvedConfig, d as Plugin, 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-STBvIMqO.cjs";
2
+ import { t as nanoidModule } from "./nanoid-EQ7i4b1_.cjs";
3
+ import "./index-D6CnpA_r.cjs";
4
+ import "./index-D4ELpJXS.cjs";
5
+
6
+ //#region src/index.d.ts
25
7
 
26
8
  /**
27
9
  * A Powerlines plugin to assist in developing other Powerlines plugins.
28
10
  */
29
11
  declare function plugin(options?: IdPluginOptions): Plugin<IdPluginContext>;
30
-
31
- export { IdPluginContext, IdPluginOptions, plugin as default, plugin };
12
+ //#endregion
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":";;;;;;;;;AAkCA;AAAgC,iBAAhB,MAAA,CAAgB,OAAA,CAAA,EAAA,eAAA,CAAA,EAAuB,MAAvB,CAA8B,eAA9B,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { a as UniqueIdFormatType, c as __ΩIdPluginResolvedConfig, d as Plugin, 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-DMubQ9jR.mjs";
2
+ import { t as nanoidModule } from "./nanoid-DaJQFnTo.mjs";
3
+ import "./index-DL0uimUT.mjs";
4
+ import "./index-9iG2qHLe.mjs";
5
+
6
+ //#region src/index.d.ts
7
+
8
+ /**
9
+ * A Powerlines plugin to assist in developing other Powerlines plugins.
10
+ */
11
+ declare function plugin(options?: IdPluginOptions): Plugin<IdPluginContext>;
12
+ //#endregion
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":";;;;;;;;;AAkCA;AAAgC,iBAAhB,MAAA,CAAgB,OAAA,CAAA,EAAA,eAAA,CAAA,EAAuB,MAAvB,CAA8B,eAA9B,CAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./nanoid-Clx2gSOJ.mjs";import"./components-CeJvJXAB.mjs";import"./plugin-BjiGfRHE.mjs";import"./types-n6NgD0QK.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};
2
+ //# 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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\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.log(\n LogLevelLabel.TRACE,\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.log(\n LogLevelLabel.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.log(\n LogLevelLabel.DEBUG,\n `Using ID generation library: ${config.id!.type}`\n );\n\n return config;\n },\n async prepare() {\n this.log(\n LogLevelLabel.TRACE,\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(\n await Promise.resolve(idModule(this)),\n \"id\",\n \"id.ts\"\n );\n }\n };\n}\n\nexport default plugin;\n"],"mappings":"8NAkCA,SAAgB,EAAO,EAA2B,EAAE,CAA2B,CAC7E,MAAO,CACL,KAAM,KACN,MAAM,QAAS,CACb,KAAK,IACH,EAAc,MACd,wEACD,CAED,IAAM,EAAS,CACb,GAAI,EAAK,EAAS,CAChB,KAAM,SACP,CAAC,CACH,CAkBD,OAhBI,CAAC,EAAO,GAAI,MAAQ,CAAC,CAAC,SAAS,CAAC,SAAS,EAAO,GAAI,KAAK,IACvD,EAAO,GAAI,MACb,KAAK,IACH,EAAc,KACd,+BAA+B,EAAO,GAAI,KAAK,sCAChD,CAGH,EAAO,GAAI,KAAO,UAGpB,KAAK,IACH,EAAc,MACd,gCAAgC,EAAO,GAAI,OAC5C,CAEM,GAET,MAAM,SAAU,CACd,KAAK,IACH,EAAc,MACd,iEACD,CAED,IAAIA,EACJ,OAAQ,KAAK,OAAO,GAAG,KAAvB,CACE,IAAK,SACL,QAEE,EAAW,EACX,MAGJ,MAAM,KAAK,YACT,MAAM,QAAQ,QAAQ,EAAS,KAAK,CAAC,CACrC,KACA,QACD,EAEJ,CAGH,IAAA,EAAe"}
@@ -0,0 +1,99 @@
1
+ const e=require(`./index.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
+ `}function i(e){return`
11
+ /**
12
+ * The ID module provides a set of utilities for generating unique identifiers.
13
+ *
14
+ * @module ${e.config.output.builtinPrefix}:id
15
+ */
16
+
17
+ ${r(e)}
18
+
19
+ /**
20
+ * Generate a random string
21
+ *
22
+ * @param array - The array to fill with random values
23
+ * @returns The array filled with random values
24
+ */
25
+ export function getRandom(array: Uint8Array) {
26
+ if (array === null) {
27
+ throw new StormError({ type: "general", code: 9 });
28
+ }
29
+
30
+ // Fill the array with random values
31
+ for (let i = 0; i < array.length; i++) {
32
+ array[i] = Math.floor(Math.random() * 256); // Random byte (0-255)
33
+ }
34
+
35
+ return array;
36
+ }
37
+
38
+ /**
39
+ * A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
40
+ *
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(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 prefix - The prefix to use for the unique identifier
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(prefix?: string, size?: number | undefined): string;
54
+
55
+ /**
56
+ * A platform agnostic version of the [nanoid](https://github.com/ai/nanoid) package with some modifications.
57
+ *
58
+ * @param param - The parameter to use for the unique identifier, can be a string or number
59
+ * @param size - The size of the string to generate. Defaults to 21 if not provided.
60
+ * @returns A unique identifier following the nanoid format
61
+ */
62
+ export function uniqueId(param?: string | number | undefined, size?: number | undefined): string {
63
+ if (typeof param === "number") {
64
+ size = param;
65
+ } else if (!param || !size) {
66
+ size = 21; // Default size if not provided
67
+ }
68
+
69
+ // Use our custom getRandom function to fill a Uint8Array with random values.
70
+ const randomBytes = getRandom(new Uint8Array(typeof param === "string" ? size - (param.length + 1) : size));
71
+
72
+ let result = "";
73
+ if (typeof param === "string") {
74
+ // If the parameter is a string, use it as a prefix.
75
+ result = param + "_";
76
+ }
77
+
78
+ return result + randomBytes.reduce((id, byte) => {
79
+ // It is incorrect to use bytes exceeding the alphabet size.
80
+ // The following mask reduces the random byte in the 0-255 value
81
+ // range to the 0-63 value range. Therefore, adding hacks, such
82
+ // as empty string fallback or magic numbers, is unnecessary because
83
+ // the bitmask trims bytes down to the alphabet size.
84
+ byte &= 63;
85
+ if (byte < 36) {
86
+ // \`0-9a-z\`
87
+ id += byte.toString(36);
88
+ } else if (byte < 62) {
89
+ // \`A-Z\`
90
+ id += (byte - 26).toString(36).toUpperCase();
91
+ } else if (byte > 62) {
92
+ id += "-";
93
+ } else {
94
+ id += "_";
95
+ }
96
+ return id;
97
+ }, "");
98
+ }
99
+ `}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
@@ -1,17 +1,20 @@
1
- import {a}from'../chunk-UCUR73HG.js';import {getFileHeader}from'powerlines/lib/utilities/file-header';/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
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)}
6
9
 
7
- function u(e){return `
10
+ `}function r(e){return`
8
11
  /**
9
12
  * The ID module provides a set of utilities for generating unique identifiers.
10
13
  *
11
14
  * @module ${e.config.output.builtinPrefix}:id
12
15
  */
13
16
 
14
- ${getFileHeader(e)}
17
+ ${n(e)}
15
18
 
16
19
  /**
17
20
  * Generate a random string
@@ -93,4 +96,5 @@ export function uniqueId(param?: string | number | undefined, size?: number | un
93
96
  return id;
94
97
  }, "");
95
98
  }
96
- `}a(u,"nanoidModule");export{u as nanoidModule};
99
+ `}export{r as t};
100
+ //# sourceMappingURL=nanoid-Clx2gSOJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nanoid-Clx2gSOJ.mjs","names":[],"sources":["../../powerlines/src/lib/utilities/file-header.ts","../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 { titleCase } from \"@stryke/string-format/title-case\";\nimport { Context } from \"../../types/context\";\n\nexport interface FileHeaderOptions {\n directive?: string | null;\n prettierIgnore?: boolean;\n}\n\nexport function getBaseFileHeader(context: Context): string {\n return `\n// Generated with ${titleCase(context.config.framework)}\n// Note: Do not edit this file manually - it will be overwritten automatically\n`;\n}\n\nexport function getFileHeader(\n context: Context,\n options: FileHeaderOptions = {}\n): string {\n const { directive = null, prettierIgnore = false } = options;\n\n return `/* eslint-disable */\n// biome-ignore lint: disable\n${prettierIgnore ? `// prettier-ignore` : \"\"}${directive ? `\\n\\n${directive}\\n` : \"\\n\"}\n${getBaseFileHeader(context)}\n\n`;\n}\n","/* -------------------------------------------------------------------\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.output.builtinPrefix}: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":"6DA0BA,SAAgB,EAAkB,EAA0B,CAC1D,MAAO;oBACW,EAAU,EAAQ,OAAO,UAAU,CAAC;;EAKxD,SAAgB,EACd,EACA,EAA6B,EAAE,CACvB,CACR,GAAM,CAAE,YAAY,KAAM,iBAAiB,IAAU,EAErD,MAAO;;EAEP,EAAiB,qBAAuB,KAAK,EAAY,OAAO,EAAU,IAAM;EAAK;EACrF,EAAkB,EAAQ,CAAC;;ECf7B,SAAgB,EAAa,EAA0B,CACrD,MAAO;;;;aAII,EAAQ,OAAO,OAAO,cAAc;;;EAG/C,EAAc,EAAQ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { t as IdPluginContext } from "./plugin-DMubQ9jR.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-DaJQFnTo.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nanoid-DaJQFnTo.d.mts","names":[],"sources":["../src/components/nanoid.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;iBAAgB,YAAA,UAAsB"}
@@ -0,0 +1,14 @@
1
+ import { t as IdPluginContext } from "./plugin-STBvIMqO.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-EQ7i4b1_.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nanoid-EQ7i4b1_.d.cts","names":[],"sources":["../src/components/nanoid.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;iBAAgB,YAAA,UAAsB"}
@@ -0,0 +1 @@
1
+ export{};