@awesomeness-js/utils 1.2.4 → 1.2.6

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 (41) hide show
  1. package/CLA.md +9 -0
  2. package/CONTRIBUTING.md +18 -0
  3. package/NOTICE +3 -0
  4. package/SECURITY.md +7 -0
  5. package/index.js +179 -179
  6. package/license +10 -4
  7. package/package.json +1 -1
  8. package/src/getAllFiles.js +43 -57
  9. package/types/build.d.ts +10 -10
  10. package/types/clean/boolean.d.ts +3 -3
  11. package/types/clean/integer.d.ts +6 -6
  12. package/types/clean/number.d.ts +8 -8
  13. package/types/clean/timestamp.d.ts +5 -5
  14. package/types/clean/uuid.d.ts +3 -3
  15. package/types/collectImports.d.ts +6 -6
  16. package/types/combineFiles.d.ts +8 -8
  17. package/types/convertBytes.d.ts +8 -8
  18. package/types/decrypt.d.ts +1 -1
  19. package/types/each.d.ts +10 -10
  20. package/types/eachAsync.d.ts +1 -1
  21. package/types/encrypt.d.ts +5 -5
  22. package/types/getAllFiles.d.ts +6 -6
  23. package/types/isUUID.d.ts +1 -1
  24. package/types/md5.d.ts +2 -2
  25. package/types/password/check.d.ts +1 -1
  26. package/types/password/hash.d.ts +1 -1
  27. package/types/setLocalEnvs.d.ts +2 -2
  28. package/types/shouldIgnore.d.ts +1 -1
  29. package/types/thingType.d.ts +2 -2
  30. package/types/toPennies.d.ts +1 -1
  31. package/types/utils/buildExportsTree.d.ts +4 -4
  32. package/types/utils/buildFileDataList.d.ts +12 -12
  33. package/types/utils/extractJSDocComment.d.ts +1 -1
  34. package/types/utils/generateFile.d.ts +8 -8
  35. package/types/utils/generateFlatExportLines.d.ts +7 -7
  36. package/types/utils/generateImportStatements.d.ts +5 -5
  37. package/types/utils/generateNamedExports.d.ts +7 -7
  38. package/types/utils/generateNamespaceCode.d.ts +7 -7
  39. package/types/utils/generateNamespaceExportLines.d.ts +6 -6
  40. package/types/uuid.d.ts +2 -2
  41. package/types/validateSchema.d.ts +2 -2
package/CLA.md ADDED
@@ -0,0 +1,9 @@
1
+ # Contributor License Agreement
2
+
3
+ By contributing to this repository, you agree that:
4
+
5
+ 1. You have the right to submit the contribution
6
+ 2. You grant the project owner a perpetual, worldwide, royalty-free license to use, modify, distribute, and relicense your contribution
7
+ 3. Your contribution does not infringe on third-party rights
8
+
9
+ This agreement applies to all contributions submitted via pull request, issue, or other means.
@@ -0,0 +1,18 @@
1
+ # Contributing
2
+
3
+ Thank you for your interest in contributing!
4
+
5
+ ## License of Contributions
6
+
7
+ By submitting a contribution to this project, you agree that:
8
+
9
+ - Your contribution is licensed under the Apache License 2.0
10
+ - You grant the project owner the right to relicense your contribution as part of future versions of the project
11
+
12
+ If you do not agree to these terms, please do not submit a contribution.
13
+
14
+ ## How to Contribute
15
+
16
+ - Fork the repository
17
+ - Create a feature branch
18
+ - Submit a pull request
package/NOTICE ADDED
@@ -0,0 +1,3 @@
1
+ Copyright © 2026 Scott Forte
2
+
3
+ This product includes software developed by Scott Forte.
package/SECURITY.md ADDED
@@ -0,0 +1,7 @@
1
+ # Security Policy
2
+
3
+ If you discover a security issue, please report it privately.
4
+
5
+ Email: security@email.awesomenessjs.com
6
+
7
+ Do not open public issues for security vulnerabilities.
package/index.js CHANGED
@@ -1,122 +1,122 @@
1
- /**
2
- * This file is auto-generated by the build script.
3
- * It consolidates API functions for use in the application.
4
- * Do not edit manually.
5
- */
6
- import _build from './src/build.js';
7
- import _clean_array from './src/clean/array.js';
8
- import _clean_boolean from './src/clean/boolean.js';
9
- import _clean_buffer from './src/clean/buffer.js';
10
- import _clean_custom from './src/clean/custom.js';
11
- import _clean_integer from './src/clean/integer.js';
12
- import _clean_number from './src/clean/number.js';
13
- import _clean_object from './src/clean/object.js';
14
- import _clean_string from './src/clean/string.js';
15
- import _clean_timestamp from './src/clean/timestamp.js';
16
- import _clean_uuid from './src/clean/uuid.js';
17
- import _collectImports from './src/collectImports.js';
18
- import _combineFiles from './src/combineFiles.js';
19
- import _convertBytes from './src/convertBytes.js';
20
- import _decrypt from './src/decrypt.js';
21
- import _each from './src/each.js';
22
- import _eachAsync from './src/eachAsync.js';
23
- import _encrypt from './src/encrypt.js';
24
- import _getAllFiles from './src/getAllFiles.js';
25
- import _isUUID from './src/isUUID.js';
26
- import _md5 from './src/md5.js';
27
- import _password_check from './src/password/check.js';
28
- import _password_hash from './src/password/hash.js';
29
- import _random_array from './src/random/array.js';
30
- import _random_arrayValue from './src/random/arrayValue.js';
31
- import _random_boolean from './src/random/boolean.js';
32
- import _random_integer from './src/random/integer.js';
33
- import _random_number from './src/random/number.js';
34
- import _random_object from './src/random/object.js';
35
- import _random_string from './src/random/string.js';
36
- import _random_timestamp from './src/random/timestamp.js';
37
- import _random_uuid from './src/random/uuid.js';
38
- import _setLocalEnvs from './src/setLocalEnvs.js';
39
- import _shouldIgnore from './src/shouldIgnore.js';
40
- import _thingType from './src/thingType.js';
41
- import _toPennies from './src/toPennies.js';
42
- import _utils_buildExportsTree from './src/utils/buildExportsTree.js';
43
- import _utils_buildFileDataList from './src/utils/buildFileDataList.js';
44
- import _utils_clean from './src/utils/clean.js';
45
- import _utils_extractJSDocComment from './src/utils/extractJSDocComment.js';
46
- import _utils_generateFile from './src/utils/generateFile.js';
47
- import _utils_generateFlatExportLines from './src/utils/generateFlatExportLines.js';
48
- import _utils_generateImportStatements from './src/utils/generateImportStatements.js';
49
- import _utils_generateNamedExports from './src/utils/generateNamedExports.js';
50
- import _utils_generateNamespaceCode from './src/utils/generateNamespaceCode.js';
51
- import _utils_generateNamespaceExportLines from './src/utils/generateNamespaceExportLines.js';
52
- import _uuid from './src/uuid.js';
53
- import _validateSchema from './src/validateSchema.js';
54
- import _wait from './src/wait.js';
55
-
56
- export { _build as build };
57
- export { _collectImports as collectImports };
58
- export { _combineFiles as combineFiles };
59
- export { _convertBytes as convertBytes };
60
- export { _decrypt as decrypt };
61
- export { _each as each };
62
- export { _eachAsync as eachAsync };
63
- export { _encrypt as encrypt };
64
- export { _getAllFiles as getAllFiles };
65
- export { _isUUID as isUUID };
66
- export { _md5 as md5 };
67
- export { _setLocalEnvs as setLocalEnvs };
68
- export { _shouldIgnore as shouldIgnore };
69
- export { _thingType as thingType };
70
- export { _toPennies as toPennies };
71
- export { _uuid as uuid };
72
- export { _validateSchema as validateSchema };
73
- export { _wait as wait };
74
-
75
- export const clean = {
76
- array: _clean_array,
77
- boolean: _clean_boolean,
78
- buffer: _clean_buffer,
79
- custom: _clean_custom,
80
- integer: _clean_integer,
81
- number: _clean_number,
82
- object: _clean_object,
83
- string: _clean_string,
84
- timestamp: _clean_timestamp,
85
- uuid: _clean_uuid
86
- };
87
-
88
- export const password = {
89
- check: _password_check,
90
- hash: _password_hash
91
- };
92
-
93
- export const random = {
94
- array: _random_array,
95
- arrayValue: _random_arrayValue,
96
- boolean: _random_boolean,
97
- integer: _random_integer,
98
- number: _random_number,
99
- object: _random_object,
100
- string: _random_string,
101
- timestamp: _random_timestamp,
102
- uuid: _random_uuid
103
- };
104
-
105
- export const utils = {
106
- buildExportsTree: _utils_buildExportsTree,
107
- buildFileDataList: _utils_buildFileDataList,
108
- clean: _utils_clean,
109
- extractJSDocComment: _utils_extractJSDocComment,
110
- generateFile: _utils_generateFile,
111
- generateFlatExportLines: _utils_generateFlatExportLines,
112
- generateImportStatements: _utils_generateImportStatements,
113
- generateNamedExports: _utils_generateNamedExports,
114
- generateNamespaceCode: _utils_generateNamespaceCode,
115
- generateNamespaceExportLines: _utils_generateNamespaceExportLines
116
- };
117
-
118
-
119
- export default {
1
+ /**
2
+ * This file is auto-generated by the build script.
3
+ * It consolidates API functions for use in the application.
4
+ * Do not edit manually.
5
+ */
6
+ import _build from './src/build.js';
7
+ import _clean_array from './src/clean/array.js';
8
+ import _clean_boolean from './src/clean/boolean.js';
9
+ import _clean_buffer from './src/clean/buffer.js';
10
+ import _clean_custom from './src/clean/custom.js';
11
+ import _clean_integer from './src/clean/integer.js';
12
+ import _clean_number from './src/clean/number.js';
13
+ import _clean_object from './src/clean/object.js';
14
+ import _clean_string from './src/clean/string.js';
15
+ import _clean_timestamp from './src/clean/timestamp.js';
16
+ import _clean_uuid from './src/clean/uuid.js';
17
+ import _collectImports from './src/collectImports.js';
18
+ import _combineFiles from './src/combineFiles.js';
19
+ import _convertBytes from './src/convertBytes.js';
20
+ import _decrypt from './src/decrypt.js';
21
+ import _each from './src/each.js';
22
+ import _eachAsync from './src/eachAsync.js';
23
+ import _encrypt from './src/encrypt.js';
24
+ import _getAllFiles from './src/getAllFiles.js';
25
+ import _isUUID from './src/isUUID.js';
26
+ import _md5 from './src/md5.js';
27
+ import _password_check from './src/password/check.js';
28
+ import _password_hash from './src/password/hash.js';
29
+ import _random_array from './src/random/array.js';
30
+ import _random_arrayValue from './src/random/arrayValue.js';
31
+ import _random_boolean from './src/random/boolean.js';
32
+ import _random_integer from './src/random/integer.js';
33
+ import _random_number from './src/random/number.js';
34
+ import _random_object from './src/random/object.js';
35
+ import _random_string from './src/random/string.js';
36
+ import _random_timestamp from './src/random/timestamp.js';
37
+ import _random_uuid from './src/random/uuid.js';
38
+ import _setLocalEnvs from './src/setLocalEnvs.js';
39
+ import _shouldIgnore from './src/shouldIgnore.js';
40
+ import _thingType from './src/thingType.js';
41
+ import _toPennies from './src/toPennies.js';
42
+ import _utils_buildExportsTree from './src/utils/buildExportsTree.js';
43
+ import _utils_buildFileDataList from './src/utils/buildFileDataList.js';
44
+ import _utils_clean from './src/utils/clean.js';
45
+ import _utils_extractJSDocComment from './src/utils/extractJSDocComment.js';
46
+ import _utils_generateFile from './src/utils/generateFile.js';
47
+ import _utils_generateFlatExportLines from './src/utils/generateFlatExportLines.js';
48
+ import _utils_generateImportStatements from './src/utils/generateImportStatements.js';
49
+ import _utils_generateNamedExports from './src/utils/generateNamedExports.js';
50
+ import _utils_generateNamespaceCode from './src/utils/generateNamespaceCode.js';
51
+ import _utils_generateNamespaceExportLines from './src/utils/generateNamespaceExportLines.js';
52
+ import _uuid from './src/uuid.js';
53
+ import _validateSchema from './src/validateSchema.js';
54
+ import _wait from './src/wait.js';
55
+
56
+ export { _build as build };
57
+ export { _collectImports as collectImports };
58
+ export { _combineFiles as combineFiles };
59
+ export { _convertBytes as convertBytes };
60
+ export { _decrypt as decrypt };
61
+ export { _each as each };
62
+ export { _eachAsync as eachAsync };
63
+ export { _encrypt as encrypt };
64
+ export { _getAllFiles as getAllFiles };
65
+ export { _isUUID as isUUID };
66
+ export { _md5 as md5 };
67
+ export { _setLocalEnvs as setLocalEnvs };
68
+ export { _shouldIgnore as shouldIgnore };
69
+ export { _thingType as thingType };
70
+ export { _toPennies as toPennies };
71
+ export { _uuid as uuid };
72
+ export { _validateSchema as validateSchema };
73
+ export { _wait as wait };
74
+
75
+ export const clean = {
76
+ array: _clean_array,
77
+ boolean: _clean_boolean,
78
+ buffer: _clean_buffer,
79
+ custom: _clean_custom,
80
+ integer: _clean_integer,
81
+ number: _clean_number,
82
+ object: _clean_object,
83
+ string: _clean_string,
84
+ timestamp: _clean_timestamp,
85
+ uuid: _clean_uuid
86
+ };
87
+
88
+ export const password = {
89
+ check: _password_check,
90
+ hash: _password_hash
91
+ };
92
+
93
+ export const random = {
94
+ array: _random_array,
95
+ arrayValue: _random_arrayValue,
96
+ boolean: _random_boolean,
97
+ integer: _random_integer,
98
+ number: _random_number,
99
+ object: _random_object,
100
+ string: _random_string,
101
+ timestamp: _random_timestamp,
102
+ uuid: _random_uuid
103
+ };
104
+
105
+ export const utils = {
106
+ buildExportsTree: _utils_buildExportsTree,
107
+ buildFileDataList: _utils_buildFileDataList,
108
+ clean: _utils_clean,
109
+ extractJSDocComment: _utils_extractJSDocComment,
110
+ generateFile: _utils_generateFile,
111
+ generateFlatExportLines: _utils_generateFlatExportLines,
112
+ generateImportStatements: _utils_generateImportStatements,
113
+ generateNamedExports: _utils_generateNamedExports,
114
+ generateNamespaceCode: _utils_generateNamespaceCode,
115
+ generateNamespaceExportLines: _utils_generateNamespaceExportLines
116
+ };
117
+
118
+
119
+ export default {
120
120
  /**
121
121
  * Builds a file from the specified source directory and writes it to the destination file.
122
122
  *
@@ -128,19 +128,19 @@ export default {
128
128
  * @param {boolean} [options.includeComments=true] - Whether to include comments in the generated file.
129
129
  * @param {boolean} [options.dts=false] - Whether to generate TypeScript declaration files.
130
130
  * @returns {Promise<boolean>} A promise that resolves to true when the build is complete.
131
- */
132
- build: _build,
133
- collectImports: _collectImports,
134
- combineFiles: _combineFiles,
131
+ */
132
+ build: _build,
133
+ collectImports: _collectImports,
134
+ combineFiles: _combineFiles,
135
135
  /**
136
136
  * Converts a given number of bytes into a more readable string format with appropriate units.
137
137
  *
138
138
  * @param {number} bytes - The number of bytes to convert.
139
139
  * @param {number} [precision=2] - The number of decimal places to include in the result.
140
140
  * @returns {string} The converted bytes in a string format with appropriate units.
141
- */
142
- convertBytes: _convertBytes,
143
- decrypt: _decrypt,
141
+ */
142
+ convertBytes: _convertBytes,
143
+ decrypt: _decrypt,
144
144
  /**
145
145
  * Iterates over elements of an array or properties of an object, invoking a callback for each element/property.
146
146
  * The iteration stops if the callback returns `false`.
@@ -149,57 +149,57 @@ export default {
149
149
  * @param {Object|Array} objectOrArray - The object or array to iterate over.
150
150
  * @param {Function} callback - The function to invoke per iteration. It is invoked with two arguments: (value, key/index).
151
151
  * @returns {void}
152
- */
153
- each: _each,
154
- eachAsync: _eachAsync,
155
- encrypt: _encrypt,
156
- getAllFiles: _getAllFiles,
157
- isUUID: _isUUID,
158
- md5: _md5,
159
- setLocalEnvs: _setLocalEnvs,
160
- shouldIgnore: _shouldIgnore,
161
- thingType: _thingType,
162
- toPennies: _toPennies,
163
- uuid: _uuid,
164
- validateSchema: _validateSchema,
165
- wait: _wait,
166
- clean: {
167
- array: _clean_array,
168
- boolean: _clean_boolean,
169
- buffer: _clean_buffer,
170
- custom: _clean_custom,
171
- integer: _clean_integer,
172
- number: _clean_number,
173
- object: _clean_object,
174
- string: _clean_string,
175
- timestamp: _clean_timestamp,
176
- uuid: _clean_uuid,
177
- },
178
- password: {
179
- check: _password_check,
180
- hash: _password_hash,
181
- },
182
- random: {
183
- array: _random_array,
184
- arrayValue: _random_arrayValue,
185
- boolean: _random_boolean,
186
- integer: _random_integer,
187
- number: _random_number,
188
- object: _random_object,
189
- string: _random_string,
190
- timestamp: _random_timestamp,
191
- uuid: _random_uuid,
192
- },
193
- utils: {
194
- buildExportsTree: _utils_buildExportsTree,
195
- buildFileDataList: _utils_buildFileDataList,
196
- clean: _utils_clean,
197
- extractJSDocComment: _utils_extractJSDocComment,
198
- generateFile: _utils_generateFile,
199
- generateFlatExportLines: _utils_generateFlatExportLines,
200
- generateImportStatements: _utils_generateImportStatements,
201
- generateNamedExports: _utils_generateNamedExports,
202
- generateNamespaceCode: _utils_generateNamespaceCode,
203
- generateNamespaceExportLines: _utils_generateNamespaceExportLines,
204
- },
152
+ */
153
+ each: _each,
154
+ eachAsync: _eachAsync,
155
+ encrypt: _encrypt,
156
+ getAllFiles: _getAllFiles,
157
+ isUUID: _isUUID,
158
+ md5: _md5,
159
+ setLocalEnvs: _setLocalEnvs,
160
+ shouldIgnore: _shouldIgnore,
161
+ thingType: _thingType,
162
+ toPennies: _toPennies,
163
+ uuid: _uuid,
164
+ validateSchema: _validateSchema,
165
+ wait: _wait,
166
+ clean: {
167
+ array: _clean_array,
168
+ boolean: _clean_boolean,
169
+ buffer: _clean_buffer,
170
+ custom: _clean_custom,
171
+ integer: _clean_integer,
172
+ number: _clean_number,
173
+ object: _clean_object,
174
+ string: _clean_string,
175
+ timestamp: _clean_timestamp,
176
+ uuid: _clean_uuid,
177
+ },
178
+ password: {
179
+ check: _password_check,
180
+ hash: _password_hash,
181
+ },
182
+ random: {
183
+ array: _random_array,
184
+ arrayValue: _random_arrayValue,
185
+ boolean: _random_boolean,
186
+ integer: _random_integer,
187
+ number: _random_number,
188
+ object: _random_object,
189
+ string: _random_string,
190
+ timestamp: _random_timestamp,
191
+ uuid: _random_uuid,
192
+ },
193
+ utils: {
194
+ buildExportsTree: _utils_buildExportsTree,
195
+ buildFileDataList: _utils_buildFileDataList,
196
+ clean: _utils_clean,
197
+ extractJSDocComment: _utils_extractJSDocComment,
198
+ generateFile: _utils_generateFile,
199
+ generateFlatExportLines: _utils_generateFlatExportLines,
200
+ generateImportStatements: _utils_generateImportStatements,
201
+ generateNamedExports: _utils_generateNamedExports,
202
+ generateNamespaceCode: _utils_generateNamespaceCode,
203
+ generateNamespaceExportLines: _utils_generateNamespaceExportLines,
204
+ },
205
205
  };
package/license CHANGED
@@ -1,7 +1,13 @@
1
- Copyright 2024 Scott Forte
1
+ Copyright 2026 Scott Forte
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
4
6
 
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+ http://www.apache.org/licenses/LICENSE-2.0
6
8
 
7
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesomeness-js/utils",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "Awesomeness - Utils",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,62 +1,48 @@
1
- import {
2
- readdirSync, statSync
3
- } from 'fs';
4
- import { join } from 'path';
5
- import shouldIgnore from './shouldIgnore.js';
1
+ import { readdirSync, statSync } from "fs";
2
+ import path from "path";
3
+ import shouldIgnore from "./shouldIgnore.js";
6
4
 
7
5
  export default function getAllFiles(base, {
8
- dir = '.',
9
- files = [],
10
- ignore = [],
11
- fileTypes = []
6
+ dir = ".",
7
+ files = [],
8
+ ignore = [],
9
+ fileTypes = [],
12
10
  } = {}) {
13
11
 
14
- const directory = join(base, dir);
15
-
16
- const sortedFiles = readdirSync(directory).sort();
17
-
18
- sortedFiles.forEach((file) => {
19
-
20
- const fullPath = join(directory, file);
21
- // 1) Generate the original "relative path"
22
- const relativePath = join(dir, file).replace(/\\/g, '/');
23
-
24
- // 2) Prepend a slash so patterns like "/css/*.js" will match "/css/some.js"
25
- const pathForIgnore = '/' + relativePath.replace(/^\/*/, '');
26
-
27
- // 3) Check with the leading slash path
28
- if (shouldIgnore(pathForIgnore, ignore)) {
29
-
30
- return;
31
-
32
- }
33
-
34
- // Recurse if it's a directory
35
- if (statSync(fullPath).isDirectory()) {
36
-
37
- getAllFiles(base, {
38
- dir: join(dir, file),
39
- files,
40
- ignore,
41
- fileTypes
42
- });
43
-
44
- } else {
45
-
46
- // Filter by file types if specified
47
- if (fileTypes.length > 0 && !fileTypes.some((ext) => file.endsWith(ext))) {
48
-
49
- return;
50
-
51
- }
52
-
53
- // 4) Store the original relative path (without leading slash) in `files` if you prefer
54
- files.push(relativePath);
55
-
56
- }
57
-
58
- });
59
-
60
- return files;
61
-
12
+ const isAbsDir = path.isAbsolute(dir);
13
+
14
+ // if dir is absolute, don't join it onto base
15
+ const directory = isAbsDir ? dir : path.join(base, dir);
16
+
17
+ const sortedFiles = readdirSync(directory).sort();
18
+
19
+ sortedFiles.forEach((file) => {
20
+ const fullPath = path.join(directory, file);
21
+
22
+ // if dir is absolute, store relative to the scan root (directory)
23
+ // otherwise keep original behavior (join(dir, file))
24
+ const relativePath = (
25
+ isAbsDir ? path.relative(dir, fullPath) : path.join(dir, file)
26
+ ).replace(/\\/g, "/");
27
+
28
+ const pathForIgnore = "/" + relativePath.replace(/^\/*/, "");
29
+ if (shouldIgnore(pathForIgnore, ignore)) return;
30
+
31
+ if (statSync(fullPath).isDirectory()) {
32
+ getAllFiles(base, {
33
+ // ✅ if absolute, recurse using absolute path; else keep old join(dir, file)
34
+ dir: isAbsDir ? fullPath : path.join(dir, file),
35
+ files,
36
+ ignore,
37
+ fileTypes,
38
+ });
39
+ } else {
40
+ if (fileTypes.length > 0 && !fileTypes.some((ext) => file.endsWith(ext))) {
41
+ return;
42
+ }
43
+ files.push(relativePath);
44
+ }
45
+ });
46
+
47
+ return files;
62
48
  }
package/types/build.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export default build;
2
- declare function build({ src, dest, exportRoots, ignore, includeComments, dts, useTabs, }?: {
3
- src?: string;
4
- dest?: string;
5
- exportRoots?: boolean;
6
- ignore?: any[];
7
- includeComments?: boolean;
8
- dts?: boolean;
9
- useTabs?: boolean;
10
- }): Promise<boolean>;
1
+ export default build;
2
+ declare function build({ src, dest, exportRoots, ignore, includeComments, dts, useTabs, }?: {
3
+ src?: string;
4
+ dest?: string;
5
+ exportRoots?: boolean;
6
+ ignore?: any[];
7
+ includeComments?: boolean;
8
+ dts?: boolean;
9
+ useTabs?: boolean;
10
+ }): Promise<boolean>;
@@ -1,3 +1,3 @@
1
- export default function cleanBoolean(x: any, { required }?: {
2
- required?: boolean;
3
- }): any;
1
+ export default function cleanBoolean(x: any, { required }?: {
2
+ required?: boolean;
3
+ }): any;
@@ -1,6 +1,6 @@
1
- export default function cleanInt(x: any, { required, convertString, min, max, }?: {
2
- required?: boolean;
3
- convertString?: boolean;
4
- min?: boolean;
5
- max?: boolean;
6
- }): any;
1
+ export default function cleanInt(x: any, { required, convertString, min, max, }?: {
2
+ required?: boolean;
3
+ convertString?: boolean;
4
+ min?: boolean;
5
+ max?: boolean;
6
+ }): any;
@@ -1,8 +1,8 @@
1
- export default function cleanNumber(x: any, { required, convertString, min, max, maxDecimal, minDecimal, }?: {
2
- required?: boolean;
3
- convertString?: boolean;
4
- min?: boolean;
5
- max?: boolean;
6
- maxDecimal?: boolean;
7
- minDecimal?: boolean;
8
- }): any;
1
+ export default function cleanNumber(x: any, { required, convertString, min, max, maxDecimal, minDecimal, }?: {
2
+ required?: boolean;
3
+ convertString?: boolean;
4
+ min?: boolean;
5
+ max?: boolean;
6
+ maxDecimal?: boolean;
7
+ minDecimal?: boolean;
8
+ }): any;
@@ -1,5 +1,5 @@
1
- export default function cleanTimestamp(isoDateTimeString: any, { required, maxDaysInFuture, maxDaysInFPast, }?: {
2
- required?: boolean;
3
- maxDaysInFuture?: boolean;
4
- maxDaysInFPast?: boolean;
5
- }): string;
1
+ export default function cleanTimestamp(isoDateTimeString: any, { required, maxDaysInFuture, maxDaysInFPast, }?: {
2
+ required?: boolean;
3
+ maxDaysInFuture?: boolean;
4
+ maxDaysInFPast?: boolean;
5
+ }): string;
@@ -1,3 +1,3 @@
1
- export default function cleanUUID(uuid: any, { required, }?: {
2
- required?: boolean;
3
- }): string;
1
+ export default function cleanUUID(uuid: any, { required, }?: {
2
+ required?: boolean;
3
+ }): string;
@@ -1,6 +1,6 @@
1
- export default run;
2
- declare function run(filePath: any, { returnCode, jsMaps, cssMaps }?: {
3
- returnCode?: boolean;
4
- jsMaps?: {};
5
- cssMaps?: {};
6
- }): any[];
1
+ export default run;
2
+ declare function run(filePath: any, { returnCode, jsMaps, cssMaps }?: {
3
+ returnCode?: boolean;
4
+ jsMaps?: {};
5
+ cssMaps?: {};
6
+ }): any[];
@@ -1,8 +1,8 @@
1
- export default combineFiles;
2
- declare function combineFiles(dir: any, fileType: any, { minify, processContent, }?: {
3
- minify?: boolean;
4
- processContent?: ({ content, path }: {
5
- content: any;
6
- path: any;
7
- }) => any;
8
- }): string;
1
+ export default combineFiles;
2
+ declare function combineFiles(dir: any, fileType: any, { minify, processContent, }?: {
3
+ minify?: boolean;
4
+ processContent?: ({ content, path }: {
5
+ content: any;
6
+ path: any;
7
+ }) => any;
8
+ }): string;
@@ -1,8 +1,8 @@
1
- /**
2
- * Converts a given number of bytes into a more readable string format with appropriate units.
3
- *
4
- * @param {number} bytes - The number of bytes to convert.
5
- * @param {number} [precision=2] - The number of decimal places to include in the result.
6
- * @returns {string} The converted bytes in a string format with appropriate units.
7
- */
8
- export default function convertBytes(bytes: number, precision?: number): string;
1
+ /**
2
+ * Converts a given number of bytes into a more readable string format with appropriate units.
3
+ *
4
+ * @param {number} bytes - The number of bytes to convert.
5
+ * @param {number} [precision=2] - The number of decimal places to include in the result.
6
+ * @returns {string} The converted bytes in a string format with appropriate units.
7
+ */
8
+ export default function convertBytes(bytes: number, precision?: number): string;
@@ -1 +1 @@
1
- export default function decrypt(encryptedData: any, key?: any): any;
1
+ export default function decrypt(encryptedData: any, key?: any): any;
package/types/each.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- /**
2
- * Iterates over elements of an array or properties of an object, invoking a callback for each element/property.
3
- * The iteration stops if the callback returns `false`.
4
- *
5
- * @example each({ a: 1, b: 2 }, (value, key) => { console.log(value, key); });
6
- * @param {Object|Array} objectOrArray - The object or array to iterate over.
7
- * @param {Function} callback - The function to invoke per iteration. It is invoked with two arguments: (value, key/index).
8
- * @returns {void}
9
- */
10
- export default function each(objectOrArray: any | any[], callback: Function): void;
1
+ /**
2
+ * Iterates over elements of an array or properties of an object, invoking a callback for each element/property.
3
+ * The iteration stops if the callback returns `false`.
4
+ *
5
+ * @example each({ a: 1, b: 2 }, (value, key) => { console.log(value, key); });
6
+ * @param {Object|Array} objectOrArray - The object or array to iterate over.
7
+ * @param {Function} callback - The function to invoke per iteration. It is invoked with two arguments: (value, key/index).
8
+ * @returns {void}
9
+ */
10
+ export default function each(objectOrArray: any | any[], callback: Function): void;
@@ -1 +1 @@
1
- export default function eachAsync(objectOrArray: any, callback: any): Promise<void>;
1
+ export default function eachAsync(objectOrArray: any, callback: any): Promise<void>;
@@ -1,5 +1,5 @@
1
- export default function encrypt(plainText: any, key?: any): {
2
- iv: any;
3
- authTag: any;
4
- cipherText: any;
5
- };
1
+ export default function encrypt(plainText: any, key?: any): {
2
+ iv: any;
3
+ authTag: any;
4
+ cipherText: any;
5
+ };
@@ -1,6 +1,6 @@
1
- export default function getAllFiles(base: any, { dir, files, ignore, fileTypes }?: {
2
- dir?: string;
3
- files?: any[];
4
- ignore?: any[];
5
- fileTypes?: any[];
6
- }): any[];
1
+ export default function getAllFiles(base: any, { dir, files, ignore, fileTypes }?: {
2
+ dir?: string;
3
+ files?: any[];
4
+ ignore?: any[];
5
+ fileTypes?: any[];
6
+ }): any[];
package/types/isUUID.d.ts CHANGED
@@ -1 +1 @@
1
- export default function isUUID(uuid: any): boolean;
1
+ export default function isUUID(uuid: any): boolean;
package/types/md5.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export default md5;
2
- declare function md5(data: any): any;
1
+ export default md5;
2
+ declare function md5(data: any): any;
@@ -1 +1 @@
1
- export default function validatePassword(password: any, storedHash: any): boolean;
1
+ export default function validatePassword(password: any, storedHash: any): boolean;
@@ -1 +1 @@
1
- export default function hashPassword(password: any): string;
1
+ export default function hashPassword(password: any): string;
@@ -1,2 +1,2 @@
1
- declare function _default(localSecretsPath?: string): Promise<void>;
2
- export default _default;
1
+ declare function _default(localSecretsPath?: string): Promise<void>;
2
+ export default _default;
@@ -1 +1 @@
1
- export default function shouldIgnore(filePath: any, ignorePatterns: any): any;
1
+ export default function shouldIgnore(filePath: any, ignorePatterns: any): any;
@@ -1,2 +1,2 @@
1
- declare function _default(thing: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "null";
2
- export default _default;
1
+ declare function _default(thing: any): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "null";
2
+ export default _default;
@@ -1 +1 @@
1
- export default function toPennies(uglyMoney: any): number;
1
+ export default function toPennies(uglyMoney: any): number;
@@ -1,4 +1,4 @@
1
- export default function buildExportsTree(fileDataList: any): {
2
- flatExports: any[];
3
- nestedExports: {};
4
- };
1
+ export default function buildExportsTree(fileDataList: any): {
2
+ flatExports: any[];
3
+ nestedExports: {};
4
+ };
@@ -1,12 +1,12 @@
1
- export default function buildFileDataList({ src, ignore, includeComments }: {
2
- src: any;
3
- ignore: any;
4
- includeComments: any;
5
- }): {
6
- normalizedFile: any;
7
- parts: any;
8
- functionName: any;
9
- importVarName: string;
10
- importPath: string;
11
- jsDocComment: string;
12
- }[];
1
+ export default function buildFileDataList({ src, ignore, includeComments }: {
2
+ src: any;
3
+ ignore: any;
4
+ includeComments: any;
5
+ }): {
6
+ normalizedFile: any;
7
+ parts: any;
8
+ functionName: any;
9
+ importVarName: string;
10
+ importPath: string;
11
+ jsDocComment: string;
12
+ }[];
@@ -1 +1 @@
1
- export default function extractJSDocComment(filePath: any): string;
1
+ export default function extractJSDocComment(filePath: any): string;
@@ -1,8 +1,8 @@
1
- export default function generateFile({ src, exportRoots, ignore, includeComments, dts, useTabs }: {
2
- src: any;
3
- exportRoots: any;
4
- ignore: any;
5
- includeComments: any;
6
- dts: any;
7
- useTabs?: boolean;
8
- }): string;
1
+ export default function generateFile({ src, exportRoots, ignore, includeComments, dts, useTabs }: {
2
+ src: any;
3
+ exportRoots: any;
4
+ ignore: any;
5
+ includeComments: any;
6
+ dts: any;
7
+ useTabs?: boolean;
8
+ }): string;
@@ -1,7 +1,7 @@
1
- export default function generateFlatExportLines({ flatExports, exportRoots, includeComments, dts, useTabs }: {
2
- flatExports: any;
3
- exportRoots: any;
4
- includeComments: any;
5
- dts: any;
6
- useTabs?: boolean;
7
- }): string;
1
+ export default function generateFlatExportLines({ flatExports, exportRoots, includeComments, dts, useTabs }: {
2
+ flatExports: any;
3
+ exportRoots: any;
4
+ includeComments: any;
5
+ dts: any;
6
+ useTabs?: boolean;
7
+ }): string;
@@ -1,5 +1,5 @@
1
- export default function generateImportStatements({ fileDataList, dts, src }: {
2
- fileDataList: any;
3
- dts: any;
4
- src: any;
5
- }): string;
1
+ export default function generateImportStatements({ fileDataList, dts, src }: {
2
+ fileDataList: any;
3
+ dts: any;
4
+ src: any;
5
+ }): string;
@@ -1,7 +1,7 @@
1
- export default function generateNamedExports({ flatExports, exportRoots, nestedExports, dts, useTabs }: {
2
- flatExports: any;
3
- exportRoots: any;
4
- nestedExports: any;
5
- dts: any;
6
- useTabs?: boolean;
7
- }): string;
1
+ export default function generateNamedExports({ flatExports, exportRoots, nestedExports, dts, useTabs }: {
2
+ flatExports: any;
3
+ exportRoots: any;
4
+ nestedExports: any;
5
+ dts: any;
6
+ useTabs?: boolean;
7
+ }): string;
@@ -1,7 +1,7 @@
1
- export default function generateNamespaceCode({ nsObj, indentLevel, includeComments, dts, useTabs }: {
2
- nsObj: any;
3
- indentLevel: any;
4
- includeComments: any;
5
- dts: any;
6
- useTabs?: boolean;
7
- }): string;
1
+ export default function generateNamespaceCode({ nsObj, indentLevel, includeComments, dts, useTabs }: {
2
+ nsObj: any;
3
+ indentLevel: any;
4
+ includeComments: any;
5
+ dts: any;
6
+ useTabs?: boolean;
7
+ }): string;
@@ -1,6 +1,6 @@
1
- export default function generateNamespaceExportLines({ nestedExports, includeComments, dts, useTabs }: {
2
- nestedExports: any;
3
- includeComments: any;
4
- dts: any;
5
- useTabs?: boolean;
6
- }): string;
1
+ export default function generateNamespaceExportLines({ nestedExports, includeComments, dts, useTabs }: {
2
+ nestedExports: any;
3
+ includeComments: any;
4
+ dts: any;
5
+ useTabs?: boolean;
6
+ }): string;
package/types/uuid.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export default uuid;
2
- declare function uuid(): string;
1
+ export default uuid;
2
+ declare function uuid(): string;
@@ -1,2 +1,2 @@
1
- export default validateSchema;
2
- declare function validateSchema(schema: any): boolean;
1
+ export default validateSchema;
2
+ declare function validateSchema(schema: any): boolean;