@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.
- package/README.md +112 -86
- package/build/build.js +16 -11
- package/build/postBuild.js +8 -8
- package/eslint.config.js +90 -0
- package/index.js +108 -78
- package/package.json +26 -25
- package/schemas/schema1.js +5 -1
- package/schemas/schema2.js +5 -1
- package/schemas.js +3 -2
- package/src/build.js +88 -8
- package/src/clean/boolean.js +27 -17
- package/src/clean/integer.js +85 -69
- package/src/clean/number.js +103 -86
- package/src/clean/string.js +91 -67
- package/src/clean/timestamp.js +61 -45
- package/src/clean/uuid.js +38 -25
- package/src/collectImports.js +195 -0
- package/src/combineFiles.js +45 -36
- package/src/convertBytes.js +12 -7
- package/src/decrypt.js +17 -9
- package/src/each.js +26 -4
- package/src/eachAsync.js +35 -19
- package/src/encrypt.js +22 -17
- package/src/getAllFiles.js +56 -42
- package/src/ignoreFolder/ignoreMe.js +6 -2
- package/src/ignoreMe.js +4 -2
- package/src/isUUID.js +4 -0
- package/src/md5.js +5 -1
- package/src/password/check.js +7 -3
- package/src/password/hash.js +12 -7
- package/src/setLocalEnvs.js +16 -3
- package/src/shouldIgnore.js +99 -0
- package/src/thingType.js +62 -24
- package/src/toPennies.js +23 -5
- package/src/utils/buildExportsTree.js +45 -17
- package/src/utils/buildFileDataList.js +37 -18
- package/src/utils/clean.js +205 -120
- package/src/utils/extractJSDocComment.js +14 -7
- package/src/utils/generateFile.js +54 -18
- package/src/utils/generateFlatExportLines.js +40 -17
- package/src/utils/generateImportStatements.js +20 -8
- package/src/utils/generateNamedExports.js +55 -10
- package/src/utils/generateNamespaceCode.js +56 -24
- package/src/utils/generateNamespaceExportLines.js +27 -7
- package/src/utils/writeHotWrapper.js +42 -0
- package/src/uuid.js +9 -7
- package/src/validateSchema.js +95 -77
- package/test/collectImports.js +8 -0
- package/test/css/some.css +3 -0
- package/test/css/some.js +5 -0
- package/test/ignoreFolder/ignoreMe.js +3 -1
- package/test/ignoreFolder/ignoreMe2.js +3 -1
- package/test/ignoreFolder2/ignoreMe.js +6 -2
- package/test/js/abc.test.js +7 -3
- package/test/js/some.js +5 -0
- package/test/secret.test.js +1 -1
- package/tests/clean/array.test.js +122 -74
- package/tests/clean/boolean.test.js +18 -6
- package/tests/clean/integer.test.js +25 -9
- package/tests/clean/number.test.js +49 -13
- package/tests/clean/object.test.js +190 -119
- package/tests/clean/string.test.js +48 -17
- package/tests/clean/timestamp.test.js +12 -5
- package/tests/clean/uuid.test.js +13 -6
- package/tests/collectImports.test.js +66 -0
- package/tests/combineFiles.test.js +28 -26
- package/tests/convertBytes.test.js +8 -3
- package/tests/env.test.js +9 -3
- package/tests/example.test.js +7 -3
- package/tests/fileList.test.js +16 -12
- package/tests/hash-and-encrypt.test.js +13 -4
- package/tests/ignore.test.js +55 -0
- package/tests/md5.test.js +7 -2
- package/tests/namedExports.test.js +13 -0
- package/tests/uuid.test.js +10 -4
- package/tests/validateSchema.test.js +21 -9
- package/tsconfig.json +20 -16
- package/types/build.d.ts +5 -1
- package/types/collectImports.d.ts +6 -0
- package/types/index.d.ts +108 -78
- package/types/shouldIgnore.d.ts +1 -0
- package/types/utils/buildFileDataList.d.ts +5 -1
- package/types/utils/generateFile.d.ts +8 -1
- package/types/utils/generateFlatExportLines.d.ts +7 -1
- package/types/utils/generateImportStatements.d.ts +5 -1
- package/types/utils/generateNamedExports.d.ts +7 -1
- package/types/utils/generateNamespaceCode.d.ts +7 -1
- package/types/utils/generateNamespaceExportLines.d.ts +6 -1
- package/types/utils/writeHotWrapper.d.ts +4 -0
- package/src/utils/shouldIgnore.js +0 -43
package/tests/env.test.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
|
|
5
7
|
await utils.setLocalEnvs('./secrets/local.env');
|
|
@@ -7,11 +9,15 @@ await utils.setLocalEnvs('./secrets/local.env');
|
|
|
7
9
|
const env1 = process.env.JUST_A_TEST;
|
|
8
10
|
|
|
9
11
|
test('localEnv - should be testValue', () => {
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
expect(env1).toBe('Local just a test');
|
|
14
|
+
|
|
11
15
|
});
|
|
12
16
|
|
|
13
17
|
await utils.setLocalEnvs('./secrets/dev.env');
|
|
14
18
|
|
|
15
19
|
test('localEnv - should be testValue', () => {
|
|
16
|
-
|
|
20
|
+
|
|
21
|
+
expect(process.env.JUST_A_TEST).toBe('Dev just a test');
|
|
22
|
+
|
|
17
23
|
});
|
package/tests/example.test.js
CHANGED
package/tests/fileList.test.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
let fileList2 = utils.getAllFiles('./test', {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
// fileTypes: ['.css'],
|
|
10
|
+
// fileTypes: ['.js'],
|
|
11
|
+
ignore: [
|
|
12
|
+
"/ignoreFolder",
|
|
13
|
+
"/ignoreFolder2/",
|
|
14
|
+
"*.env",
|
|
15
|
+
"*.test.js",
|
|
16
|
+
"/css/*.js",
|
|
17
|
+
"/js/*.css"
|
|
18
|
+
]
|
|
17
19
|
});
|
|
18
20
|
|
|
19
21
|
test('file list of 3', () => {
|
|
20
|
-
|
|
22
|
+
|
|
23
|
+
expect(fileList2.length).toBe(4); // Adjust this number based on your test folder contents
|
|
24
|
+
|
|
21
25
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
|
|
5
7
|
// set AWESOMENESS_ENCRYPTION_KEY
|
|
@@ -8,11 +10,15 @@ await utils.setLocalEnvs('./secrets/dev.env');
|
|
|
8
10
|
const storedHash = utils.password.hash('mySecret123');
|
|
9
11
|
|
|
10
12
|
test('correct password check', () => {
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
expect(utils.password.check('mySecret123', storedHash)).toBe(true);
|
|
15
|
+
|
|
12
16
|
});
|
|
13
17
|
|
|
14
18
|
test('incorrect password check', () => {
|
|
15
|
-
|
|
19
|
+
|
|
20
|
+
expect(utils.password.check('wrongPassword', storedHash)).toBe(false);
|
|
21
|
+
|
|
16
22
|
});
|
|
17
23
|
|
|
18
24
|
// Example 256-bit key for AES-256
|
|
@@ -21,6 +27,9 @@ test('incorrect password check', () => {
|
|
|
21
27
|
const secretMessage = 'This is top secret!';
|
|
22
28
|
const encrypted = utils.encrypt(secretMessage);
|
|
23
29
|
const decrypted = utils.decrypt(encrypted);
|
|
30
|
+
|
|
24
31
|
test('encryption and decryption', () => {
|
|
25
|
-
|
|
32
|
+
|
|
33
|
+
expect(decrypted).toBe(secretMessage);
|
|
34
|
+
|
|
26
35
|
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// example.test.js
|
|
2
|
+
import {
|
|
3
|
+
expect, test, describe
|
|
4
|
+
} from 'vitest';
|
|
5
|
+
import utils from '../index.js';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
describe('shouldIgnore', () => {
|
|
9
|
+
|
|
10
|
+
test('exact file match (case-insensitive)', () => {
|
|
11
|
+
|
|
12
|
+
expect(utils.shouldIgnore('/src/ignoreMe.js', [ 'ignoreMe.js' ])).toBe(true);
|
|
13
|
+
expect(utils.shouldIgnore('/src/IGNOREME.JS', [ 'ignoreMe.js' ])).toBe(true);
|
|
14
|
+
expect(utils.shouldIgnore('/src/notIgnoreMe.js', [ 'ignoreMe.js' ])).toBe(false);
|
|
15
|
+
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('ignore all in folder/* immediate children only', () => {
|
|
19
|
+
|
|
20
|
+
expect(utils.shouldIgnore('/src/ignoreFolder/file.js', [ 'ignoreFolder/*' ])).toBe(true);
|
|
21
|
+
expect(utils.shouldIgnore('/src/ignoreFolder/nested/file.js', [ 'ignoreFolder/*' ])).toBe(false);
|
|
22
|
+
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('ignore all with extension (*.js)', () => {
|
|
26
|
+
|
|
27
|
+
expect(utils.shouldIgnore('/src/file.js', [ '*.js' ])).toBe(true);
|
|
28
|
+
expect(utils.shouldIgnore('/src/deep/file.js', [ '*.js' ])).toBe(true);
|
|
29
|
+
expect(utils.shouldIgnore('/src/file.ts', [ '*.js' ])).toBe(false);
|
|
30
|
+
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('ignore only specific extension in folder (folder/*.js)', () => {
|
|
34
|
+
|
|
35
|
+
expect(utils.shouldIgnore('/src/css/style.js', [ 'css/*.js' ])).toBe(true);
|
|
36
|
+
expect(utils.shouldIgnore('/src/css/nested/style.js', [ 'css/*.js' ])).toBe(false);
|
|
37
|
+
expect(utils.shouldIgnore('/src/css/style.css', [ 'css/*.js' ])).toBe(false);
|
|
38
|
+
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('ignore whole directory (folder)', () => {
|
|
42
|
+
|
|
43
|
+
expect(utils.shouldIgnore('/src/namespaceExample/file.js', [ 'namespaceExample' ])).toBe(true);
|
|
44
|
+
expect(utils.shouldIgnore('/src/namespaceExample/nested/file.js', [ 'namespaceExample' ])).toBe(true);
|
|
45
|
+
expect(utils.shouldIgnore('/src/namespaceExampleFile.js', [ 'namespaceExample' ])).toBe(false);
|
|
46
|
+
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('mixed case patterns still match paths', () => {
|
|
50
|
+
|
|
51
|
+
expect(utils.shouldIgnore('/src/SomeFolder/File.JS', [ 'somefolder/*' ])).toBe(true);
|
|
52
|
+
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
});
|
package/tests/md5.test.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
let md5Test = utils.md5('test');
|
|
7
|
+
|
|
5
8
|
test('md5 test', () => {
|
|
6
|
-
|
|
9
|
+
|
|
10
|
+
expect(md5Test).toBe('098f6bcd4621d373cade4e832627b4f6');
|
|
11
|
+
|
|
7
12
|
});
|
package/tests/uuid.test.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
// example.test.js
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
expect, test
|
|
4
|
+
} from 'vitest';
|
|
3
5
|
import utils from '../index.js';
|
|
4
6
|
|
|
5
7
|
let uuid = utils.uuid();
|
|
6
8
|
let isValid = utils.isUUID(uuid);
|
|
7
9
|
|
|
8
10
|
test('uuid create', () => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
expect(uuid).toBeDefined();
|
|
13
|
+
expect(uuid.length).toBe(36);
|
|
14
|
+
|
|
11
15
|
});
|
|
12
16
|
|
|
13
17
|
test('uuid isValid', () => {
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
expect(isValid).toBe(true);
|
|
20
|
+
|
|
15
21
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
expect, test
|
|
3
|
+
} from 'vitest';
|
|
2
4
|
import utils from '../index.js';
|
|
3
5
|
import schemas from '../schemas.js';
|
|
4
6
|
|
|
@@ -7,24 +9,34 @@ let schema2 = utils.validateSchema(schemas.schema2);
|
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
test('schema1 is valid', () => {
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
expect(schema1).toBe(true);
|
|
14
|
+
|
|
11
15
|
});
|
|
12
16
|
|
|
13
17
|
test('schema2 is valid', () => {
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
expect(schema2).toBe(true);
|
|
20
|
+
|
|
15
21
|
});
|
|
16
22
|
|
|
17
23
|
let expectedError;
|
|
18
24
|
|
|
19
25
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
|
|
27
|
+
utils.validateSchema({
|
|
28
|
+
notReal: true
|
|
29
|
+
});
|
|
30
|
+
expectedError = false; // should not reach here
|
|
31
|
+
|
|
24
32
|
} catch(e){
|
|
25
|
-
|
|
33
|
+
|
|
34
|
+
expectedError = true;
|
|
35
|
+
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
test('invalid schema throws error', () => {
|
|
29
|
-
|
|
39
|
+
|
|
40
|
+
expect(expectedError).toBe(true);
|
|
41
|
+
|
|
30
42
|
});
|
package/tsconfig.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"declaration": true, // Generates .d.ts files
|
|
4
|
+
"emitDeclarationOnly": true, // Only output .d.ts files
|
|
5
|
+
"allowJs": true, // Allows JS files
|
|
6
|
+
"outDir": "types", // Output directory for type files
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"types": [
|
|
11
|
+
"vitest/globals"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"include": [
|
|
15
|
+
"src/**/*"
|
|
16
|
+
],
|
|
17
|
+
"exclude": [
|
|
18
|
+
"./src/ignoreFolder/**/*",
|
|
19
|
+
"./src/ignoreMe.js"
|
|
20
|
+
]
|
|
21
|
+
}
|
package/types/build.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
export default build;
|
|
2
|
-
declare function build({ src, dest, exportRoots, ignore, includeComments, dts }?: {
|
|
2
|
+
declare function build({ src, dest, exportRoots, ignore, includeComments, dts, useTabs, hotModuleReload, hotCallback, hotSource }?: {
|
|
3
3
|
src?: string;
|
|
4
4
|
dest?: string;
|
|
5
5
|
exportRoots?: boolean;
|
|
6
6
|
ignore?: any[];
|
|
7
7
|
includeComments?: boolean;
|
|
8
8
|
dts?: boolean;
|
|
9
|
+
useTabs?: boolean;
|
|
10
|
+
hotModuleReload?: boolean;
|
|
11
|
+
hotCallback?: any;
|
|
12
|
+
hotSource?: string;
|
|
9
13
|
}): Promise<boolean>;
|
package/types/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type _clean_object from './clean/object';
|
|
|
12
12
|
import type _clean_string from './clean/string';
|
|
13
13
|
import type _clean_timestamp from './clean/timestamp';
|
|
14
14
|
import type _clean_uuid from './clean/uuid';
|
|
15
|
+
import type _collectImports from './collectImports';
|
|
15
16
|
import type _combineFiles from './combineFiles';
|
|
16
17
|
import type _convertBytes from './convertBytes';
|
|
17
18
|
import type _decrypt from './decrypt';
|
|
@@ -19,13 +20,12 @@ import type _each from './each';
|
|
|
19
20
|
import type _eachAsync from './eachAsync';
|
|
20
21
|
import type _encrypt from './encrypt';
|
|
21
22
|
import type _getAllFiles from './getAllFiles';
|
|
22
|
-
import type _ignoreFolder_ignoreMe from './ignoreFolder/ignoreMe';
|
|
23
|
-
import type _ignoreMe from './ignoreMe';
|
|
24
23
|
import type _isUUID from './isUUID';
|
|
25
24
|
import type _md5 from './md5';
|
|
26
25
|
import type _password_check from './password/check';
|
|
27
26
|
import type _password_hash from './password/hash';
|
|
28
27
|
import type _setLocalEnvs from './setLocalEnvs';
|
|
28
|
+
import type _shouldIgnore from './shouldIgnore';
|
|
29
29
|
import type _thingType from './thingType';
|
|
30
30
|
import type _toPennies from './toPennies';
|
|
31
31
|
import type _utils_buildExportsTree from './utils/buildExportsTree';
|
|
@@ -38,11 +38,12 @@ import type _utils_generateImportStatements from './utils/generateImportStatemen
|
|
|
38
38
|
import type _utils_generateNamedExports from './utils/generateNamedExports';
|
|
39
39
|
import type _utils_generateNamespaceCode from './utils/generateNamespaceCode';
|
|
40
40
|
import type _utils_generateNamespaceExportLines from './utils/generateNamespaceExportLines';
|
|
41
|
-
import type
|
|
41
|
+
import type _utils_writeHotWrapper from './utils/writeHotWrapper';
|
|
42
42
|
import type _uuid from './uuid';
|
|
43
43
|
import type _validateSchema from './validateSchema';
|
|
44
44
|
|
|
45
45
|
export declare const build: typeof _build;
|
|
46
|
+
export declare const collectImports: typeof _collectImports;
|
|
46
47
|
export declare const combineFiles: typeof _combineFiles;
|
|
47
48
|
export declare const convertBytes: typeof _convertBytes;
|
|
48
49
|
export declare const decrypt: typeof _decrypt;
|
|
@@ -50,90 +51,119 @@ export declare const each: typeof _each;
|
|
|
50
51
|
export declare const eachAsync: typeof _eachAsync;
|
|
51
52
|
export declare const encrypt: typeof _encrypt;
|
|
52
53
|
export declare const getAllFiles: typeof _getAllFiles;
|
|
53
|
-
export declare const ignoreMe: typeof _ignoreMe;
|
|
54
54
|
export declare const isUUID: typeof _isUUID;
|
|
55
55
|
export declare const md5: typeof _md5;
|
|
56
56
|
export declare const setLocalEnvs: typeof _setLocalEnvs;
|
|
57
|
+
export declare const shouldIgnore: typeof _shouldIgnore;
|
|
57
58
|
export declare const thingType: typeof _thingType;
|
|
58
59
|
export declare const toPennies: typeof _toPennies;
|
|
59
60
|
export declare const uuid: typeof _uuid;
|
|
60
61
|
export declare const validateSchema: typeof _validateSchema;
|
|
61
62
|
|
|
63
|
+
export declare const clean: {
|
|
64
|
+
array: typeof _clean_array;
|
|
65
|
+
boolean: typeof _clean_boolean;
|
|
66
|
+
integer: typeof _clean_integer;
|
|
67
|
+
number: typeof _clean_number;
|
|
68
|
+
object: typeof _clean_object;
|
|
69
|
+
string: typeof _clean_string;
|
|
70
|
+
timestamp: typeof _clean_timestamp;
|
|
71
|
+
uuid: typeof _clean_uuid;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export declare const password: {
|
|
75
|
+
check: typeof _password_check;
|
|
76
|
+
hash: typeof _password_hash;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export declare const utils: {
|
|
80
|
+
buildExportsTree: typeof _utils_buildExportsTree;
|
|
81
|
+
buildFileDataList: typeof _utils_buildFileDataList;
|
|
82
|
+
clean: typeof _utils_clean;
|
|
83
|
+
extractJSDocComment: typeof _utils_extractJSDocComment;
|
|
84
|
+
generateFile: typeof _utils_generateFile;
|
|
85
|
+
generateFlatExportLines: typeof _utils_generateFlatExportLines;
|
|
86
|
+
generateImportStatements: typeof _utils_generateImportStatements;
|
|
87
|
+
generateNamedExports: typeof _utils_generateNamedExports;
|
|
88
|
+
generateNamespaceCode: typeof _utils_generateNamespaceCode;
|
|
89
|
+
generateNamespaceExportLines: typeof _utils_generateNamespaceExportLines;
|
|
90
|
+
writeHotWrapper: typeof _utils_writeHotWrapper;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
|
|
62
94
|
declare const _default: {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
shouldIgnore: typeof _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: typeof _build;
|
|
108
|
+
collectImports: typeof _collectImports;
|
|
109
|
+
combineFiles: typeof _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: typeof _convertBytes;
|
|
118
|
+
decrypt: typeof _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: typeof _each;
|
|
129
|
+
eachAsync: typeof _eachAsync;
|
|
130
|
+
encrypt: typeof _encrypt;
|
|
131
|
+
getAllFiles: typeof _getAllFiles;
|
|
132
|
+
isUUID: typeof _isUUID;
|
|
133
|
+
md5: typeof _md5;
|
|
134
|
+
setLocalEnvs: typeof _setLocalEnvs;
|
|
135
|
+
shouldIgnore: typeof _shouldIgnore;
|
|
136
|
+
thingType: typeof _thingType;
|
|
137
|
+
toPennies: typeof _toPennies;
|
|
138
|
+
uuid: typeof _uuid;
|
|
139
|
+
validateSchema: typeof _validateSchema;
|
|
140
|
+
clean: {
|
|
141
|
+
array: typeof _clean_array,
|
|
142
|
+
boolean: typeof _clean_boolean,
|
|
143
|
+
integer: typeof _clean_integer,
|
|
144
|
+
number: typeof _clean_number,
|
|
145
|
+
object: typeof _clean_object,
|
|
146
|
+
string: typeof _clean_string,
|
|
147
|
+
timestamp: typeof _clean_timestamp,
|
|
148
|
+
uuid: typeof _clean_uuid,
|
|
149
|
+
},
|
|
150
|
+
password: {
|
|
151
|
+
check: typeof _password_check,
|
|
152
|
+
hash: typeof _password_hash,
|
|
153
|
+
},
|
|
154
|
+
utils: {
|
|
155
|
+
buildExportsTree: typeof _utils_buildExportsTree,
|
|
156
|
+
buildFileDataList: typeof _utils_buildFileDataList,
|
|
157
|
+
clean: typeof _utils_clean,
|
|
158
|
+
extractJSDocComment: typeof _utils_extractJSDocComment,
|
|
159
|
+
generateFile: typeof _utils_generateFile,
|
|
160
|
+
generateFlatExportLines: typeof _utils_generateFlatExportLines,
|
|
161
|
+
generateImportStatements: typeof _utils_generateImportStatements,
|
|
162
|
+
generateNamedExports: typeof _utils_generateNamedExports,
|
|
163
|
+
generateNamespaceCode: typeof _utils_generateNamespaceCode,
|
|
164
|
+
generateNamespaceExportLines: typeof _utils_generateNamespaceExportLines,
|
|
165
|
+
writeHotWrapper: typeof _utils_writeHotWrapper,
|
|
166
|
+
},
|
|
137
167
|
};
|
|
138
168
|
|
|
139
169
|
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function shouldIgnore(filePath: any, ignorePatterns: any): any;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
export default function buildFileDataList(src
|
|
1
|
+
export default function buildFileDataList({ src, ignore, includeComments }: {
|
|
2
|
+
src: any;
|
|
3
|
+
ignore: any;
|
|
4
|
+
includeComments: any;
|
|
5
|
+
}): {
|
|
2
6
|
normalizedFile: any;
|
|
3
7
|
parts: any;
|
|
4
8
|
functionName: any;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export default function generateFile(src
|
|
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 +1,7 @@
|
|
|
1
|
-
export default function generateFlatExportLines(flatExports
|
|
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 +1,7 @@
|
|
|
1
|
-
export default function generateNamedExports(flatExports
|
|
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 +1,7 @@
|
|
|
1
|
-
export default function generateNamespaceCode(nsObj
|
|
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 +1,6 @@
|
|
|
1
|
-
export default function generateNamespaceExportLines(nestedExports
|
|
1
|
+
export default function generateNamespaceExportLines({ nestedExports, includeComments, dts, useTabs }: {
|
|
2
|
+
nestedExports: any;
|
|
3
|
+
includeComments: any;
|
|
4
|
+
dts: any;
|
|
5
|
+
useTabs?: boolean;
|
|
6
|
+
}): string;
|