@awesomeness-js/utils 1.0.24 → 1.1.2

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 (90) hide show
  1. package/README.md +112 -86
  2. package/build/build.js +16 -11
  3. package/build/postBuild.js +8 -8
  4. package/eslint.config.js +90 -0
  5. package/index.js +108 -78
  6. package/package.json +26 -25
  7. package/schemas/schema1.js +5 -1
  8. package/schemas/schema2.js +5 -1
  9. package/schemas.js +3 -2
  10. package/src/build.js +88 -8
  11. package/src/clean/boolean.js +27 -17
  12. package/src/clean/integer.js +85 -69
  13. package/src/clean/number.js +103 -86
  14. package/src/clean/string.js +91 -67
  15. package/src/clean/timestamp.js +61 -45
  16. package/src/clean/uuid.js +38 -25
  17. package/src/collectImports.js +195 -0
  18. package/src/combineFiles.js +45 -36
  19. package/src/convertBytes.js +12 -7
  20. package/src/decrypt.js +17 -9
  21. package/src/each.js +26 -4
  22. package/src/eachAsync.js +35 -19
  23. package/src/encrypt.js +22 -17
  24. package/src/getAllFiles.js +56 -42
  25. package/src/ignoreFolder/ignoreMe.js +6 -2
  26. package/src/ignoreMe.js +4 -2
  27. package/src/isUUID.js +4 -0
  28. package/src/md5.js +5 -1
  29. package/src/password/check.js +7 -3
  30. package/src/password/hash.js +12 -7
  31. package/src/setLocalEnvs.js +16 -3
  32. package/src/shouldIgnore.js +99 -0
  33. package/src/thingType.js +62 -24
  34. package/src/toPennies.js +23 -5
  35. package/src/utils/buildExportsTree.js +45 -17
  36. package/src/utils/buildFileDataList.js +37 -18
  37. package/src/utils/clean.js +205 -120
  38. package/src/utils/extractJSDocComment.js +14 -7
  39. package/src/utils/generateFile.js +54 -18
  40. package/src/utils/generateFlatExportLines.js +40 -17
  41. package/src/utils/generateImportStatements.js +20 -8
  42. package/src/utils/generateNamedExports.js +55 -10
  43. package/src/utils/generateNamespaceCode.js +56 -24
  44. package/src/utils/generateNamespaceExportLines.js +27 -7
  45. package/src/utils/writeHotWrapper.js +42 -0
  46. package/src/uuid.js +9 -7
  47. package/src/validateSchema.js +95 -77
  48. package/test/collectImports.js +8 -0
  49. package/test/css/some.css +3 -0
  50. package/test/css/some.js +5 -0
  51. package/test/ignoreFolder/ignoreMe.js +3 -1
  52. package/test/ignoreFolder/ignoreMe2.js +3 -1
  53. package/test/ignoreFolder2/ignoreMe.js +6 -2
  54. package/test/js/abc.test.js +7 -3
  55. package/test/js/some.js +5 -0
  56. package/test/secret.test.js +1 -1
  57. package/tests/clean/array.test.js +122 -74
  58. package/tests/clean/boolean.test.js +18 -6
  59. package/tests/clean/integer.test.js +25 -9
  60. package/tests/clean/number.test.js +49 -13
  61. package/tests/clean/object.test.js +190 -119
  62. package/tests/clean/string.test.js +48 -17
  63. package/tests/clean/timestamp.test.js +12 -5
  64. package/tests/clean/uuid.test.js +13 -6
  65. package/tests/collectImports.test.js +66 -0
  66. package/tests/combineFiles.test.js +28 -26
  67. package/tests/convertBytes.test.js +8 -3
  68. package/tests/env.test.js +9 -3
  69. package/tests/example.test.js +7 -3
  70. package/tests/fileList.test.js +16 -12
  71. package/tests/hash-and-encrypt.test.js +13 -4
  72. package/tests/ignore.test.js +55 -0
  73. package/tests/md5.test.js +7 -2
  74. package/tests/namedExports.test.js +13 -0
  75. package/tests/uuid.test.js +10 -4
  76. package/tests/validateSchema.test.js +21 -9
  77. package/tsconfig.json +20 -16
  78. package/types/build.d.ts +5 -1
  79. package/types/collectImports.d.ts +6 -0
  80. package/types/index.d.ts +108 -78
  81. package/types/shouldIgnore.d.ts +1 -0
  82. package/types/utils/buildFileDataList.d.ts +5 -1
  83. package/types/utils/generateFile.d.ts +8 -1
  84. package/types/utils/generateFlatExportLines.d.ts +7 -1
  85. package/types/utils/generateImportStatements.d.ts +5 -1
  86. package/types/utils/generateNamedExports.d.ts +7 -1
  87. package/types/utils/generateNamespaceCode.d.ts +7 -1
  88. package/types/utils/generateNamespaceExportLines.d.ts +6 -1
  89. package/types/utils/writeHotWrapper.d.ts +4 -0
  90. package/src/utils/shouldIgnore.js +0 -43
package/README.md CHANGED
@@ -1,44 +1,51 @@
1
1
  # Nothing Special
2
2
 
3
- Just some <u>zero dependency</u> utils ...
3
+ Just some <u>zero dependency</u>* utils that every [Awesomeness.js](https://github.com/awesomeness-js) project uses.
4
4
 
5
+ **Perfect?** Far from it.
6
+
7
+ Better than what you have now? For sure.
5
8
 
6
9
  ---
7
10
 
8
11
  # 🚀 Auto-Generate API Exports for Your Node.js Project
9
12
 
10
-
11
13
  ## 📌 Why "build" Exists
12
14
 
13
- When working on a Node.js project, you often need to import multiple functions from a directory and structure them in a clean, accessible way. Webpack is overkill for this—it’s designed for browser bundling, not for generating structured API exports in a Node.js environment.
15
+ When you’re building a Node.js project, pulling functions together into a clean, predictable API shouldn’t feel like busywork. But maintaining a manual `index.js` is a waste of time, and Webpack? That’s a browser bundler—great for shipping front-end bundles, useless for building a logical backend export layer.
16
+
17
+ This script takes that grunt work off your plate and does it **right**:
14
18
 
15
- This script **automates** that process. It dynamically scans your source directory (`./src`), imports functions, and generates an `index.js` file that:
19
+ **Consolidates all exports** into a single, perfectly structured API object
20
+ ✅ **Keeps function names and namespaces** exactly as your folder structure dictates—no mystery, no guessing
21
+ ✅ **Pulls in JSDoc comments** so your documentation is baked right into the build. Intellisense loves this.
22
+ ✅ **Runs in plain Node.js**—zero bundlers, zero fluff, zero excuses
23
+
24
+
25
+ Hint: Use the [Awesomeness Intellitip](https://marketplace.visualstudio.com/items?itemName=awesomeness.awesomeness-intellitip) VS Code Extension for classy hover documentation.
16
26
 
17
- ✅ **Consolidates all exports** into a structured API object.
18
- ✅ **Preserves function names and namespaces** based on folder structure.
19
- ✅ **Extracts JSDoc comments** for better documentation.
20
- ✅ **Works in plain Node.js**—no need for Webpack or extra dependencies.
21
27
 
22
28
  ---
23
29
 
24
- ## 🚀 Why Use "build" Instead of Webpack?
30
+ ## 💡 Why Use This Over Webpack or Manual Indexing?
25
31
 
26
- **Webpack is great for frontend bundling, but it’s not ideal for this use case.** Here’s why this script is a better choice:
32
+ Webpack is a great bundler, but it’s not suited for building a structured export layer for backend code. This script offers a focused, ergonomic solution:
27
33
 
28
- ✔ **Zero dependencies**—Runs in plain Node.js, no Webpack or config files required.
29
- ✔ **Automatic function export generation**—No need to manually update an `index.js`.
34
+ ✔ **Automatic export generation** no more maintaining `index.js` by hand
30
35
  ✔ **JSDoc extraction**—Includes comments directly in the generated file.
31
36
  ✔ **Simple and predictable**—You control how exports are structured.
32
37
  ✔ **Namespace support**—Uses folder structure to organize functions logically.
38
+ ✔ **Minimal setup** — one line to generate your exports
39
+ ✔ **Dev-friendly hot rebuild** — optional file watching with HMR-style rebuilds
33
40
 
34
- With this script, you can stop wasting time managing exports and focus on writing code.
41
+ > Uses `chokidar` under the hood for reliable cross-platform file watching.
35
42
 
36
43
  ---
37
44
 
38
- ## How It Works
45
+ ## ⚙️ How It Works
39
46
 
40
- 1. **Scans** the `./src` directory for `.js` files.
41
- 2. **Generates** import statements dynamically.
47
+ 1. **Scans** the `./src` directory for `.js` files
48
+ 2. **Generates** import statements
42
49
  3. **Creates** an API object that mirrors your folder structure.
43
50
  4. **Extracts JSDoc comments** from each file and attaches them to the exports.
44
51
  5. **Outputs** a clean, structured `index.js` file, ready to use.
@@ -47,103 +54,122 @@ With this script, you can stop wasting time managing exports and focus on writin
47
54
 
48
55
  ## 🔧 Usage
49
56
 
50
- Simply run:
51
-
52
- By default, this will:
53
- - Scan `./src` for JavaScript files
54
- - Generate an `index.js` file
55
- - Structure exports based on your folder hierarchy
57
+ To run it:
56
58
 
57
- ```javascript
58
-
59
- import { build } from '@awesomeness-js/utils';
60
-
61
- build();
59
+ ```js
60
+ import build from '@awesomeness-js/utils/build.js';
62
61
 
62
+ await build();
63
63
  ```
64
64
 
65
- If you need custom paths, modify the `src` and `dest` options in the script:
66
-
67
- ```javascript
65
+ This will:
66
+ - Scan the `./src` directory
67
+ - Create or overwrite `./index.js`
68
+ - Structure exports based on your file and folder layout
68
69
 
69
- import { build } from '@awesomeness-js/utils';
70
+ Customize it:
70
71
 
71
- build({
72
- src: './my-functions',
73
- dest: './api.js'
72
+ ```js
73
+ await build({
74
+ src: './my-functions',
75
+ dest: './api.js',
76
+ includeComments: true,
77
+ useTabs: true,
78
+ hotModuleReload: true // Enable hot reload for dev
74
79
  });
75
80
  ```
76
81
 
77
82
  ---
78
83
 
79
- ## 📜 Example Output
84
+ ## 📦 Example Output
80
85
 
81
- If your folder structure looks like this:
86
+ Given this folder structure:
82
87
 
83
88
  ```
84
89
  src/
85
- │── utils/
86
- │ ├── formatDate.js
87
- │ ├── generateId.js
88
- │── services/
89
- │ ├── fetchData.js
90
- │── calculate.js
90
+ ├── roxbury/
91
+ │ ├── didYouJustGrabMyAss.js
92
+ │ ├── areYouGuysBrothers.js
93
+ ├── bros/
94
+ │ ├── didWeJustBecomeBestFriends.js
95
+ │ ├── prestigeWorldwide.js
96
+ ├── rickyBobby/
97
+ │ ├── iWakeUpAndPissExcellence.js
98
+ │ ├── iRaiseWinners.js
99
+ │ ├── shakeAndBake.js
100
+ ├── oldSchool/
101
+ │ ├── youMyBoyBlue.js
102
+ ├── news/
103
+ │ ├── thatEscalatedQuickly.js
104
+ │ ├── stayClassy.js
105
+ │ ├── milkWasABadChoice.js
106
+ ├── tommy/
107
+ │ ├── roomService.js
108
+ │ ├── fatGuyInALittleCoat.js
109
+ ├── menInTights/
110
+ │ ├── youGrewBoobs.js
111
+ │ ├── merryMen/
112
+ │ │ ├── snipTheTip.js
91
113
  ```
92
114
 
93
- Your generated `index.js` will look like this:
94
-
95
- ```javascript
96
- /**
97
- * This file is auto-generated by the build script.
98
- * It consolidates API functions for use in the application.
99
- * Do not edit manually.
100
- */
101
-
102
- import utils_formatDate from './src/utils/formatDate.js';
103
- import utils_generateId from './src/utils/generateId.js';
104
- import services_fetchData from './src/services/fetchData.js';
105
- import calculate from './src/calculate.js';
106
-
107
- export { calculate };
108
- export default {
109
- utils: {
110
- formatDate: utils_formatDate,
111
- generateId: utils_generateId
112
- },
113
- services: {
114
- fetchData: services_fetchData
115
- },
116
- calculate
117
- };
118
- ```
119
115
 
120
- Your api is now neatly organized and ready to use!
121
- and will look like this
122
- ```javascript
123
- import { calculate } from './api.js';
124
- const result = calculate(5, 10);
125
- console.log(result);
126
- ```
116
+ #### Use it like:
127
117
 
128
- or
118
+ ```js
119
+
120
+ // Default import: full API
121
+ import api from './index.js';
122
+
123
+ // Use the full API
124
+ api.roxbury.didYouJustGrabMyAss();
125
+
126
+ // perfect for CTRL+F
127
+ api.rickyBobby.shakeAndBake();
128
+
129
+ // deep
130
+ api.menInTights.youGrewBoobs();
131
+ api.menInTights.merryMen.snipTheTip();
129
132
 
130
- ```javascript
131
- import { utils } from './api.js';
132
- const id = utils.generateId();
133
- console.log(id);
134
133
  ```
135
134
 
135
+ ```js
136
+
137
+ // Named import also work
138
+ import { youMyBoy, roxbury } from './api.js';
136
139
 
140
+ // Use the named group
141
+ youMyBoy.blue();
142
+ roxbury.didYouGrabMyAss();
143
+
144
+ ```
137
145
 
138
146
  ---
139
147
 
140
- ## 🚀 Who Should Use This?
148
+ ## 💪 Who’s This For?
149
+
150
+ - **Teams** who want **clean and consistent** APIs
151
+ - **Expert** ~~developers~~ **architects** obsessed with
152
+ - organization
153
+ - hierarchy
154
+ - explicit namespacing
155
+ - clean code
156
+ - **Champions** who know CTRL+F `app.roxbury.didYouJustGrabMyAss` will <u>always beat</u> any “magic” refactor tool when it comes to finding **every. single. usage.**
157
+ - Developers who refuse to hide functions behind lazy aliases, and instead demand predictable, grep-able APIs that tell you **exactly where the code lives.**
158
+
159
+ If you want a smarter way to manage and structure exports in a Node.js project — without extra tooling bloat — this script was built for you.
141
160
 
142
- - **Node.js developers** who want automatic API exports.
143
- - **Backend teams** managing large function directories.
144
- - **Anyone tired of manually updating `index.js` files.**
161
+ If that makes you hard, you’re in the right place.
145
162
 
146
- If you don’t need Webpacks **complexity** but want **automatic structured exports**, this script is for you.
163
+ > If it makes you mad… youve probably never built a scalable codebase.
164
+
165
+ ---
147
166
 
148
- 👉 **Try it out and let automation handle your exports!** 🚀
167
+ **Ready to make development great again?**
168
+ 👉 [awesomenessjs.com](https://awesomenessjs.com)
149
169
 
170
+ ---
171
+ ✱ disclaimer... *Kinda zero dependencies.*
172
+ Zero **prod** dependencies.
173
+ > dev dependencies:
174
+ > `chokidar` for hot module reloading (HMR)
175
+ > `vitest` for testing
package/build/build.js CHANGED
@@ -1,18 +1,23 @@
1
1
  import build from '../src/build.js';
2
2
 
3
3
  build({
4
- src: './src',
5
- dest: './index.js',
6
- dts: false,
7
- ignore: [
8
- 'ignoreMe.js',
9
- 'ignoreFolder/*',
10
- //'namespaceExample/*',
11
- ],
4
+ src: './src',
5
+ dest: './index.js',
6
+ dts: false,
7
+ hotModuleReload: false,
8
+ hotCallback: (file) => {
9
+
10
+ console.log(`[build callback] processed ${file}`);
11
+
12
+ },
13
+ ignore: [
14
+ 'ignoreMe.js',
15
+ 'ignoreFolder/*',
16
+ ],
12
17
  });
13
18
 
14
19
  build({
15
- src: './schemas',
16
- dest: './schemas.js',
17
- dts: false
20
+ src: './schemas',
21
+ dest: './schemas.js',
22
+ dts: false
18
23
  });
@@ -1,11 +1,11 @@
1
1
  import build from '../src/build.js';
2
2
  build({
3
- src: './src',
4
- dest: './types/index.d.ts',
5
- dts: true,
6
- ignore: [
7
- 'ignoreMe.js',
8
- 'ignoreFolder/*',
9
- //'namespaceExample/*',
10
- ],
3
+ src: './src',
4
+ dest: './types/index.d.ts',
5
+ dts: true,
6
+ ignore: [
7
+ 'ignoreMe.js',
8
+ 'ignoreFolder/*',
9
+ //'namespaceExample/*',
10
+ ],
11
11
  });
@@ -0,0 +1,90 @@
1
+ export default [
2
+ // Here is where we fix "padding-line-between-statements"
3
+ {
4
+ rules: {
5
+ 'padding-line-between-statements': [
6
+ 'error',
7
+ // Insert a blank line **before** any block-like statement
8
+ {
9
+ blankLine: 'always',
10
+ prev: '*',
11
+ next: 'block-like'
12
+ },
13
+ // Insert a blank line **after** any block-like statement
14
+ {
15
+ blankLine: 'always',
16
+ prev: 'block-like',
17
+ next: '*'
18
+ },
19
+ // Keep the rest of your rules here as needed...
20
+ {
21
+ blankLine: 'always',
22
+ prev: '*',
23
+ next: 'function'
24
+ },
25
+ {
26
+ blankLine: 'always',
27
+ prev: 'function',
28
+ next: '*'
29
+ },
30
+ {
31
+ blankLine: 'always',
32
+ prev: '*',
33
+ next: 'throw'
34
+ }
35
+ ],
36
+ 'padded-blocks': [
37
+ 'error',
38
+ {
39
+ blocks: 'always',
40
+ classes: 'always',
41
+ switches: 'always'
42
+ }
43
+ ],
44
+
45
+ "object-curly-newline": [
46
+ "error",
47
+ {
48
+ ObjectExpression: {
49
+ minProperties: 2, // If object has 2+ props, break into multiple lines
50
+ multiline: true,
51
+ consistent: true
52
+ },
53
+ // You can also configure ImportDeclaration, ExportDeclaration, etc.
54
+ ObjectPattern: {
55
+ multiline: true,
56
+ minProperties: 2,
57
+ consistent: true
58
+ },
59
+ ImportDeclaration: {
60
+ multiline: true,
61
+ minProperties: 2
62
+ },
63
+ ExportDeclaration: {
64
+ multiline: true,
65
+ minProperties: 2
66
+ }
67
+ }
68
+ ],
69
+
70
+ // 2) If the object is multiline, put each property on its own line
71
+ "object-property-newline": [
72
+ "error",
73
+ {
74
+ allowAllPropertiesOnSameLine: false
75
+ }
76
+ ],
77
+
78
+ indent: [ "error", "tab", { "SwitchCase": 1 } ],
79
+ semi: [ "error", "always" ],
80
+ "arrow-parens": [ "error", "always" ],
81
+ "object-curly-spacing": [ "error", "always" ],
82
+ "array-bracket-spacing": [ "error", "always" ],
83
+ 'lines-between-class-members': [ 'error', 'always' ],
84
+ 'newline-after-var': [ 'error', 'always' ],
85
+ 'newline-before-return': 'error',
86
+ 'brace-style': [ 'error', '1tbs', { allowSingleLine: false } ],
87
+ "no-unreachable": "off"
88
+ }
89
+ }
90
+ ];
package/index.js CHANGED
@@ -12,6 +12,7 @@ import _clean_object from './src/clean/object.js';
12
12
  import _clean_string from './src/clean/string.js';
13
13
  import _clean_timestamp from './src/clean/timestamp.js';
14
14
  import _clean_uuid from './src/clean/uuid.js';
15
+ import _collectImports from './src/collectImports.js';
15
16
  import _combineFiles from './src/combineFiles.js';
16
17
  import _convertBytes from './src/convertBytes.js';
17
18
  import _decrypt from './src/decrypt.js';
@@ -19,13 +20,12 @@ import _each from './src/each.js';
19
20
  import _eachAsync from './src/eachAsync.js';
20
21
  import _encrypt from './src/encrypt.js';
21
22
  import _getAllFiles from './src/getAllFiles.js';
22
- import _ignoreFolder_ignoreMe from './src/ignoreFolder/ignoreMe.js';
23
- import _ignoreMe from './src/ignoreMe.js';
24
23
  import _isUUID from './src/isUUID.js';
25
24
  import _md5 from './src/md5.js';
26
25
  import _password_check from './src/password/check.js';
27
26
  import _password_hash from './src/password/hash.js';
28
27
  import _setLocalEnvs from './src/setLocalEnvs.js';
28
+ import _shouldIgnore from './src/shouldIgnore.js';
29
29
  import _thingType from './src/thingType.js';
30
30
  import _toPennies from './src/toPennies.js';
31
31
  import _utils_buildExportsTree from './src/utils/buildExportsTree.js';
@@ -38,11 +38,12 @@ import _utils_generateImportStatements from './src/utils/generateImportStatement
38
38
  import _utils_generateNamedExports from './src/utils/generateNamedExports.js';
39
39
  import _utils_generateNamespaceCode from './src/utils/generateNamespaceCode.js';
40
40
  import _utils_generateNamespaceExportLines from './src/utils/generateNamespaceExportLines.js';
41
- import _utils_shouldIgnore from './src/utils/shouldIgnore.js';
41
+ import _utils_writeHotWrapper from './src/utils/writeHotWrapper.js';
42
42
  import _uuid from './src/uuid.js';
43
43
  import _validateSchema from './src/validateSchema.js';
44
44
 
45
45
  export { _build as build };
46
+ export { _collectImports as collectImports };
46
47
  export { _combineFiles as combineFiles };
47
48
  export { _convertBytes as convertBytes };
48
49
  export { _decrypt as decrypt };
@@ -50,88 +51,117 @@ export { _each as each };
50
51
  export { _eachAsync as eachAsync };
51
52
  export { _encrypt as encrypt };
52
53
  export { _getAllFiles as getAllFiles };
53
- export { _ignoreMe as ignoreMe };
54
54
  export { _isUUID as isUUID };
55
55
  export { _md5 as md5 };
56
56
  export { _setLocalEnvs as setLocalEnvs };
57
+ export { _shouldIgnore as shouldIgnore };
57
58
  export { _thingType as thingType };
58
59
  export { _toPennies as toPennies };
59
60
  export { _uuid as uuid };
60
61
  export { _validateSchema as validateSchema };
61
62
 
63
+ export const clean = {
64
+ array: _clean_array,
65
+ boolean: _clean_boolean,
66
+ integer: _clean_integer,
67
+ number: _clean_number,
68
+ object: _clean_object,
69
+ string: _clean_string,
70
+ timestamp: _clean_timestamp,
71
+ uuid: _clean_uuid
72
+ };
73
+
74
+ export const password = {
75
+ check: _password_check,
76
+ hash: _password_hash
77
+ };
78
+
79
+ export const utils = {
80
+ buildExportsTree: _utils_buildExportsTree,
81
+ buildFileDataList: _utils_buildFileDataList,
82
+ clean: _utils_clean,
83
+ extractJSDocComment: _utils_extractJSDocComment,
84
+ generateFile: _utils_generateFile,
85
+ generateFlatExportLines: _utils_generateFlatExportLines,
86
+ generateImportStatements: _utils_generateImportStatements,
87
+ generateNamedExports: _utils_generateNamedExports,
88
+ generateNamespaceCode: _utils_generateNamespaceCode,
89
+ generateNamespaceExportLines: _utils_generateNamespaceExportLines,
90
+ writeHotWrapper: _utils_writeHotWrapper
91
+ };
92
+
93
+
62
94
  export default {
63
- /**
64
- * Builds a file from the specified source directory and writes it to the destination file.
65
- *
66
- * @param {Object} options - The options for the build process.
67
- * @param {string} [options.src='./src'] - The source directory to build from.
68
- * @param {string} [options.dest='./index.js'] - The destination file to write the built content to.
69
- * @param {boolean} [options.exportRoots=true] - Whether to export root files.
70
- * @param {string[]} [options.ignore=[]] - An array of file patterns to ignore.
71
- * @param {boolean} [options.includeComments=true] - Whether to include comments in the generated file.
72
- * @param {boolean} [options.dts=false] - Whether to generate TypeScript declaration files.
73
- * @returns {Promise<boolean>} A promise that resolves to true when the build is complete.
74
- */
75
- build: _build,
76
- combineFiles: _combineFiles,
77
- /**
78
- * Converts a given number of bytes into a more readable string format with appropriate units.
79
- *
80
- * @param {number} bytes - The number of bytes to convert.
81
- * @param {number} [precision=2] - The number of decimal places to include in the result.
82
- * @returns {string} The converted bytes in a string format with appropriate units.
83
- */
84
- convertBytes: _convertBytes,
85
- decrypt: _decrypt,
86
- /**
87
- * Iterates over elements of an array or properties of an object, invoking a callback for each element/property.
88
- * The iteration stops if the callback returns `false`.
89
- *
90
- * @example each({ a: 1, b: 2 }, (value, key) => { console.log(value, key); });
91
- * @param {Object|Array} objectOrArray - The object or array to iterate over.
92
- * @param {Function} callback - The function to invoke per iteration. It is invoked with two arguments: (value, key/index).
93
- * @returns {void}
94
- */
95
- each: _each,
96
- eachAsync: _eachAsync,
97
- encrypt: _encrypt,
98
- getAllFiles: _getAllFiles,
99
- ignoreMe: _ignoreMe,
100
- isUUID: _isUUID,
101
- md5: _md5,
102
- setLocalEnvs: _setLocalEnvs,
103
- thingType: _thingType,
104
- toPennies: _toPennies,
105
- uuid: _uuid,
106
- validateSchema: _validateSchema,
107
- clean: {
108
- array: _clean_array,
109
- boolean: _clean_boolean,
110
- integer: _clean_integer,
111
- number: _clean_number,
112
- object: _clean_object,
113
- string: _clean_string,
114
- timestamp: _clean_timestamp,
115
- uuid: _clean_uuid,
116
- },
117
- ignoreFolder: {
118
- ignoreMe: _ignoreFolder_ignoreMe,
119
- },
120
- password: {
121
- check: _password_check,
122
- hash: _password_hash,
123
- },
124
- utils: {
125
- buildExportsTree: _utils_buildExportsTree,
126
- buildFileDataList: _utils_buildFileDataList,
127
- clean: _utils_clean,
128
- extractJSDocComment: _utils_extractJSDocComment,
129
- generateFile: _utils_generateFile,
130
- generateFlatExportLines: _utils_generateFlatExportLines,
131
- generateImportStatements: _utils_generateImportStatements,
132
- generateNamedExports: _utils_generateNamedExports,
133
- generateNamespaceCode: _utils_generateNamespaceCode,
134
- generateNamespaceExportLines: _utils_generateNamespaceExportLines,
135
- shouldIgnore: _utils_shouldIgnore,
136
- },
95
+ /**
96
+ * Builds a file from the specified source directory and writes it to the destination file.
97
+ *
98
+ * @param {Object} options - The options for the build process.
99
+ * @param {string} [options.src='./src'] - The source directory to build from.
100
+ * @param {string} [options.dest='./index.js'] - The destination file to write the built content to.
101
+ * @param {boolean} [options.exportRoots=true] - Whether to export root files.
102
+ * @param {string[]} [options.ignore=[]] - An array of file patterns to ignore.
103
+ * @param {boolean} [options.includeComments=true] - Whether to include comments in the generated file.
104
+ * @param {boolean} [options.dts=false] - Whether to generate TypeScript declaration files.
105
+ * @returns {Promise<boolean>} A promise that resolves to true when the build is complete.
106
+ */
107
+ build: _build,
108
+ collectImports: _collectImports,
109
+ combineFiles: _combineFiles,
110
+ /**
111
+ * Converts a given number of bytes into a more readable string format with appropriate units.
112
+ *
113
+ * @param {number} bytes - The number of bytes to convert.
114
+ * @param {number} [precision=2] - The number of decimal places to include in the result.
115
+ * @returns {string} The converted bytes in a string format with appropriate units.
116
+ */
117
+ convertBytes: _convertBytes,
118
+ decrypt: _decrypt,
119
+ /**
120
+ * Iterates over elements of an array or properties of an object, invoking a callback for each element/property.
121
+ * The iteration stops if the callback returns `false`.
122
+ *
123
+ * @example each({ a: 1, b: 2 }, (value, key) => { console.log(value, key); });
124
+ * @param {Object|Array} objectOrArray - The object or array to iterate over.
125
+ * @param {Function} callback - The function to invoke per iteration. It is invoked with two arguments: (value, key/index).
126
+ * @returns {void}
127
+ */
128
+ each: _each,
129
+ eachAsync: _eachAsync,
130
+ encrypt: _encrypt,
131
+ getAllFiles: _getAllFiles,
132
+ isUUID: _isUUID,
133
+ md5: _md5,
134
+ setLocalEnvs: _setLocalEnvs,
135
+ shouldIgnore: _shouldIgnore,
136
+ thingType: _thingType,
137
+ toPennies: _toPennies,
138
+ uuid: _uuid,
139
+ validateSchema: _validateSchema,
140
+ clean: {
141
+ array: _clean_array,
142
+ boolean: _clean_boolean,
143
+ integer: _clean_integer,
144
+ number: _clean_number,
145
+ object: _clean_object,
146
+ string: _clean_string,
147
+ timestamp: _clean_timestamp,
148
+ uuid: _clean_uuid,
149
+ },
150
+ password: {
151
+ check: _password_check,
152
+ hash: _password_hash,
153
+ },
154
+ utils: {
155
+ buildExportsTree: _utils_buildExportsTree,
156
+ buildFileDataList: _utils_buildFileDataList,
157
+ clean: _utils_clean,
158
+ extractJSDocComment: _utils_extractJSDocComment,
159
+ generateFile: _utils_generateFile,
160
+ generateFlatExportLines: _utils_generateFlatExportLines,
161
+ generateImportStatements: _utils_generateImportStatements,
162
+ generateNamedExports: _utils_generateNamedExports,
163
+ generateNamespaceCode: _utils_generateNamespaceCode,
164
+ generateNamespaceExportLines: _utils_generateNamespaceExportLines,
165
+ writeHotWrapper: _utils_writeHotWrapper,
166
+ },
137
167
  };