@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
@@ -1,19 +1,47 @@
1
1
  export default function buildExportsTree(fileDataList) {
2
- const flatExports = [];
3
- const nestedExports = {};
4
- fileDataList.forEach(({ parts, functionName, importVarName, jsDocComment }) => {
5
- if (parts.length === 0) {
6
- flatExports.push({ functionName, importVarName, jsDocComment });
7
- } else {
8
- let current = nestedExports;
9
- parts.forEach(part => {
10
- if (!current[part]) {
11
- current[part] = {};
12
- }
13
- current = current[part];
14
- });
15
- current[functionName] = { importVarName, jsDocComment };
16
- }
17
- });
18
- return { flatExports, nestedExports };
2
+
3
+ const flatExports = [];
4
+ const nestedExports = {};
5
+
6
+ fileDataList.forEach(({
7
+ parts, functionName, importVarName, jsDocComment
8
+ }) => {
9
+
10
+ if (parts.length === 0) {
11
+
12
+ flatExports.push({
13
+ functionName,
14
+ importVarName,
15
+ jsDocComment
16
+ });
17
+
18
+ } else {
19
+
20
+ let current = nestedExports;
21
+
22
+ parts.forEach((part) => {
23
+
24
+ if (!current[part]) {
25
+
26
+ current[part] = {};
27
+
28
+ }
29
+
30
+ current = current[part];
31
+
32
+ });
33
+ current[functionName] = {
34
+ importVarName,
35
+ jsDocComment
36
+ };
37
+
38
+ }
39
+
40
+ });
41
+
42
+ return {
43
+ flatExports,
44
+ nestedExports
45
+ };
46
+
19
47
  }
@@ -2,22 +2,41 @@ import getAllFiles from '../getAllFiles.js';
2
2
  import extractJSDocComment from './extractJSDocComment.js';
3
3
  import { join } from 'path';
4
4
 
5
- export default function buildFileDataList(src, ignore, includeComments) {
6
- const allFiles = getAllFiles(src, {
7
- ignore,
8
- fileTypes: ['.js']
9
- });
10
- return allFiles.map(file => {
11
- const normalizedFile = file.replace(/\\/g, '/');
12
- const parts = normalizedFile.split('/');
13
- const fileName = parts.pop();
14
- const functionName = fileName.replace(/\.js$/, '');
15
- const namespaceParts = parts;
16
- const importVarName = namespaceParts.length > 0
17
- ? '_' + [...namespaceParts, functionName].join('_')
18
- : '_' + functionName;
19
- const importPath = src + '/' + normalizedFile.replace(/\.js$/, '');
20
- const jsDocComment = includeComments ? extractJSDocComment(join(src, normalizedFile)) : '';
21
- return { normalizedFile, parts: namespaceParts, functionName, importVarName, importPath, jsDocComment };
22
- });
5
+ export default function buildFileDataList({
6
+ src,
7
+ ignore,
8
+ includeComments
9
+ }) {
10
+
11
+ const allFiles = getAllFiles(src, {
12
+ ignore,
13
+ fileTypes: [ '.js' ]
14
+ });
15
+
16
+
17
+ return allFiles.map((file) => {
18
+
19
+ const normalizedFile = file.replace(/\\/g, '/');
20
+ const parts = normalizedFile.split('/');
21
+ const fileName = parts.pop();
22
+ const functionName = fileName.replace(/\.js$/, '');
23
+ const namespaceParts = parts;
24
+ const importVarName = namespaceParts.length > 0
25
+ ? '_' + [ ...namespaceParts, functionName ].join('_')
26
+ : '_' + functionName;
27
+ const importPath = src + '/' + normalizedFile.replace(/\.js$/, '');
28
+ const jsDocComment = includeComments ? extractJSDocComment(join(src, normalizedFile)) : '';
29
+
30
+
31
+ return {
32
+ normalizedFile,
33
+ parts: namespaceParts,
34
+ functionName,
35
+ importVarName,
36
+ importPath,
37
+ jsDocComment
38
+ };
39
+
40
+ });
41
+
23
42
  }
@@ -11,88 +11,135 @@ import cleanUUID from '../clean/uuid.js';
11
11
 
12
12
  function cleanArray(arr, schema = {}){
13
13
 
14
- try {
15
-
16
- if(!Array.isArray(arr)) {
17
- throw {
18
- message: 'Input must be an array',
19
- arr
20
- };
21
- }
14
+ try {
15
+
16
+ if(!Array.isArray(arr)) {
17
+
18
+ throw {
19
+ message: 'Input must be an array',
20
+ arr
21
+ };
22
+
23
+ }
22
24
 
23
- validateSchema(schema);
25
+ validateSchema(schema);
24
26
 
25
- const cleanArrayItems = [];
27
+ const cleanArrayItems = [];
26
28
 
27
- const supposedToBeType = schema.items.type;
29
+ const supposedToBeType = schema.items.type;
28
30
 
29
- arr.forEach( (item, key) => {
31
+ arr.forEach( (item, key) => {
30
32
 
31
- const itemType = thingType(item);
33
+ const itemType = thingType(item);
32
34
 
33
35
 
34
- if(itemType !== supposedToBeType){
36
+ if(itemType !== supposedToBeType){
35
37
 
36
- throw {
37
- message: 'type invalid',
38
- itemType,
39
- supposedToBeType
40
- };
38
+ throw {
39
+ message: 'type invalid',
40
+ itemType,
41
+ supposedToBeType
42
+ };
41
43
 
42
- }
44
+ }
43
45
 
44
- let cleanedItem = item;
46
+ let cleanedItem = item;
45
47
 
46
- if(supposedToBeType === 'boolean'){ cleanedItem = cleanBoolean(item); }
47
- if(supposedToBeType === 'integer'){ cleanedItem = cleanInteger(item); }
48
- if(supposedToBeType === 'number'){ cleanedItem = cleanNumber(item); }
49
- if(supposedToBeType === 'string'){ cleanedItem = cleanString(item); }
50
- if(supposedToBeType === 'timestamp'){ cleanedItem = cleanTimestamp(item); }
51
- if(supposedToBeType === 'uuid'){ cleanedItem = cleanUUID(item); }
48
+ if(supposedToBeType === 'boolean'){
49
+
50
+ cleanedItem = cleanBoolean(item);
51
+
52
+ }
53
+
54
+ if(supposedToBeType === 'integer'){
55
+
56
+ cleanedItem = cleanInteger(item);
57
+
58
+ }
59
+
60
+ if(supposedToBeType === 'number'){
61
+
62
+ cleanedItem = cleanNumber(item);
63
+
64
+ }
65
+
66
+ if(supposedToBeType === 'string'){
67
+
68
+ cleanedItem = cleanString(item);
69
+
70
+ }
71
+
72
+ if(supposedToBeType === 'timestamp'){
73
+
74
+ cleanedItem = cleanTimestamp(item);
75
+
76
+ }
77
+
78
+ if(supposedToBeType === 'uuid'){
79
+
80
+ cleanedItem = cleanUUID(item);
81
+
82
+ }
52
83
 
53
- if(supposedToBeType === 'array'){
54
- cleanedItem = cleanArray(item, schema.items);
55
- }
56
-
57
- if(supposedToBeType === 'object'){
58
- cleanedItem = cleanObject(item, schema.items);
59
- }
60
-
61
- if(cleanedItem === null){
62
- if(schema.required === true){
63
- throw {
64
- message: 'required item is null',
65
- item,
66
- key
67
- };
68
- } else {
69
- return; // skip this item if it's not required and is null
70
- }
71
- }
84
+ if(supposedToBeType === 'array'){
85
+
86
+ cleanedItem = cleanArray(item, schema.items);
87
+
88
+ }
89
+
90
+ if(supposedToBeType === 'object'){
91
+
92
+ cleanedItem = cleanObject(item, schema.items);
93
+
94
+ }
95
+
96
+ if(cleanedItem === null){
97
+
98
+ if(schema.required === true){
99
+
100
+ throw {
101
+ message: 'required item is null',
102
+ item,
103
+ key
104
+ };
105
+
106
+ } else {
107
+
108
+ return; // skip this item if it's not required and is null
109
+
110
+ }
111
+
112
+ }
72
113
 
73
114
 
74
- cleanArrayItems.push(cleanedItem);
115
+ cleanArrayItems.push(cleanedItem);
75
116
 
76
- });
117
+ });
77
118
 
78
- if(cleanArrayItems.length === 0){
79
- throw {
80
- message: 'array is empty',
81
- arr
82
- };
83
- }
119
+ if(cleanArrayItems.length === 0){
120
+
121
+ throw {
122
+ message: 'array is empty',
123
+ arr
124
+ };
125
+
126
+ }
127
+
128
+ return cleanArrayItems;
84
129
 
85
- return cleanArrayItems;
130
+ } catch (e) {
86
131
 
87
- } catch (e) {
132
+ if(schema.required === true){
88
133
 
89
- if(schema.required === true){
90
- throw e
91
- } else {
92
- return null;
93
- }
134
+ throw e;
135
+
136
+ } else {
94
137
 
95
- }
138
+ return null;
139
+
140
+ }
141
+
142
+ }
96
143
 
97
144
 
98
145
 
@@ -101,83 +148,121 @@ function cleanArray(arr, schema = {}){
101
148
 
102
149
  function cleanObject(obj, schema){
103
150
 
104
- validateSchema(schema);
151
+ validateSchema(schema);
152
+
153
+ if(typeof obj !== 'object' || obj === null){
154
+
155
+ throw {
156
+ message: 'Clean Object - Input must be an object',
157
+ obj,
158
+ schema
159
+ };
160
+
161
+ }
162
+
163
+ let keysPassed = Object.keys(obj);
164
+ let keysSchema = Object.keys(schema.properties);
165
+
166
+ const origLength = keysPassed.length;
167
+
168
+ keysPassed = keysPassed.filter((key) => keysSchema.includes(key));
169
+
170
+ if(origLength !== keysPassed.length){
171
+
172
+ throw {
173
+ name: 'KeyError',
174
+ message: 'Object contains keys not in schema',
175
+ keysPassed,
176
+ keysSchema,
177
+ obj
178
+ };
179
+
180
+ }
181
+
182
+ const cleanObj = {};
183
+
184
+ // Iterate over the schema keys
185
+ each(obj, (value, key) => {
186
+
187
+ const valType = thingType(value);
188
+ const supposedToBeType = schema.properties[key].type;
189
+
190
+ if(valType !== supposedToBeType){
191
+
192
+ throw {
193
+ message: 'type invalid',
194
+ valType,
195
+ supposedToBeType,
196
+ key
197
+ };
198
+
199
+ }
200
+
201
+ let cleanedValue;
202
+
203
+ if(supposedToBeType === 'boolean'){
204
+
205
+ cleanedValue = cleanBoolean(value);
206
+
207
+ }
208
+
209
+ if(supposedToBeType === 'integer'){
210
+
211
+ cleanedValue = cleanInteger(value);
212
+
213
+ }
105
214
 
106
- if(typeof obj !== 'object' || obj === null){
107
- throw {
108
- message: 'Clean Object - Input must be an object',
109
- obj,
110
- schema
111
- };
112
- }
215
+ if(supposedToBeType === 'number'){
113
216
 
114
- let keysPassed = Object.keys(obj);
115
- let keysSchema = Object.keys(schema.properties);
217
+ cleanedValue = cleanNumber(value);
116
218
 
117
- const origLength = keysPassed.length;
118
- keysPassed = keysPassed.filter(key => keysSchema.includes(key));
219
+ }
119
220
 
120
- if(origLength !== keysPassed.length){
121
- throw {
122
- name: 'KeyError',
123
- message: 'Object contains keys not in schema',
124
- keysPassed,
125
- keysSchema,
126
- obj
127
- };
128
- }
221
+ if(supposedToBeType === 'string'){
129
222
 
130
- const cleanObj = {};
223
+ cleanedValue = cleanString(value);
131
224
 
132
- // Iterate over the schema keys
133
- each(obj, (value, key) => {
225
+ }
134
226
 
135
- const valType = thingType(value);
136
- const supposedToBeType = schema.properties[key].type;
227
+ if(supposedToBeType === 'timestamp'){
137
228
 
138
- if(valType !== supposedToBeType){
229
+ cleanedValue = cleanTimestamp(value);
139
230
 
140
- throw {
141
- message: 'type invalid',
142
- valType,
143
- supposedToBeType,
144
- key
145
- };
231
+ }
146
232
 
147
- }
233
+ if(supposedToBeType === 'uuid'){
148
234
 
149
- let cleanedValue;
235
+ cleanedValue = cleanUUID(value);
150
236
 
151
- if(supposedToBeType === 'boolean'){ cleanedValue = cleanBoolean(value); }
152
- if(supposedToBeType === 'integer'){ cleanedValue = cleanInteger(value); }
153
- if(supposedToBeType === 'number'){ cleanedValue = cleanNumber(value); }
154
- if(supposedToBeType === 'string'){ cleanedValue = cleanString(value); }
155
- if(supposedToBeType === 'timestamp'){ cleanedValue = cleanTimestamp(value); }
156
- if(supposedToBeType === 'uuid'){ cleanedValue = cleanUUID(value); }
237
+ }
157
238
 
158
- if(supposedToBeType === 'object'){
159
- cleanedValue = cleanObject(value, schema.properties[key]);
160
- }
239
+ if(supposedToBeType === 'object'){
240
+
241
+ cleanedValue = cleanObject(value, schema.properties[key]);
242
+
243
+ }
161
244
 
162
- if(supposedToBeType === 'array'){
163
- cleanedValue = cleanArray(value, schema.properties[key]);
164
- }
245
+ if(supposedToBeType === 'array'){
246
+
247
+ cleanedValue = cleanArray(value, schema.properties[key]);
248
+
249
+ }
165
250
 
166
- cleanObj[key] = cleanedValue;
251
+ cleanObj[key] = cleanedValue;
167
252
 
168
- });
253
+ });
169
254
 
170
- return cleanObj;
255
+ return cleanObj;
171
256
 
172
257
  }
173
258
 
174
259
  export default {
175
- array: cleanArray,
176
- object: cleanObject,
177
- boolean: cleanBoolean,
178
- integer: cleanInteger,
179
- number: cleanNumber,
180
- string: cleanString,
181
- timestamp: cleanTimestamp,
182
- uuid: cleanUUID
260
+ array: cleanArray,
261
+ object: cleanObject,
262
+ boolean: cleanBoolean,
263
+ integer: cleanInteger,
264
+ number: cleanNumber,
265
+ string: cleanString,
266
+ timestamp: cleanTimestamp,
267
+ uuid: cleanUUID
183
268
  };
@@ -1,11 +1,18 @@
1
1
  import { readFileSync } from 'fs';
2
2
 
3
3
  export default function extractJSDocComment(filePath) {
4
- const fileContent = readFileSync(filePath, 'utf8');
5
- const match = fileContent.match(/\/\*\*([\s\S]*?)\*\//);
6
- // If the match exists and doesn't contain an unresolved template placeholder, return it.
7
- if (match && match[1] && !match[1].includes('${')) {
8
- return `/**${match[1]}*/`;
9
- }
10
- return '';
4
+
5
+ const fileContent = readFileSync(filePath, 'utf8');
6
+ const match = fileContent.match(/\/\*\*([\s\S]*?)\*\//);
7
+
8
+ // If the match exists and doesn't contain an unresolved template placeholder, return it.
9
+
10
+ if (match && match[1] && !match[1].includes('${')) {
11
+
12
+ return `/**${match[1]}*/`;
13
+
14
+ }
15
+
16
+ return '';
17
+
11
18
  }
@@ -5,30 +5,66 @@ import generateFlatExportLines from './generateFlatExportLines.js';
5
5
  import generateNamespaceExportLines from './generateNamespaceExportLines.js';
6
6
  import generateNamedExports from './generateNamedExports.js';
7
7
 
8
- export default function generateFile(src, exportRoots, ignore, includeComments, dts) {
9
- const fileDataList = buildFileDataList(src, ignore, includeComments);
10
- const { flatExports, nestedExports } = buildExportsTree(fileDataList);
11
- const headerComment = `/**
8
+ export default function generateFile({
9
+ src,
10
+ exportRoots,
11
+ ignore,
12
+ includeComments,
13
+ dts,
14
+ useTabs = true
15
+ }) {
16
+
17
+ const fileDataList = buildFileDataList({
18
+ src,
19
+ ignore,
20
+ includeComments
21
+ });
22
+ const {
23
+ flatExports,
24
+ nestedExports
25
+ } = buildExportsTree(fileDataList);
26
+ const headerComment = `/**
12
27
  * This file is auto-generated by the build script.
13
28
  * It consolidates API ${dts ? 'type declarations' : 'functions'} for use in the application.
14
29
  * Do not edit manually.
15
30
  */
16
31
  `;
17
- const importStatements = generateImportStatements(fileDataList, dts, src);
18
- const flatExportLines = generateFlatExportLines(flatExports, exportRoots, includeComments, dts);
19
- const namespaceExportLines = generateNamespaceExportLines(nestedExports, includeComments, dts);
20
- const defaultExportCode = dts
21
- ? 'declare const _default: {\n' +
22
- flatExportLines +
23
- namespaceExportLines +
24
- '};\n\nexport default _default;\n'
25
- : 'export default {\n' +
26
- flatExportLines +
27
- namespaceExportLines +
28
- '};';
29
- const namedExports = generateNamedExports(flatExports, exportRoots, dts);
30
- return headerComment +
32
+ const importStatements = generateImportStatements({
33
+ fileDataList,
34
+ dts,
35
+ src
36
+ });
37
+
38
+ const flatExportLines = generateFlatExportLines({
39
+ flatExports,
40
+ exportRoots,
41
+ includeComments,
42
+ dts,
43
+ useTabs
44
+ });
45
+
46
+ const namespaceExportLines = generateNamespaceExportLines({
47
+ nestedExports,
48
+ includeComments,
49
+ dts,
50
+ useTabs
51
+ });
52
+
53
+ const defaultExportCode = dts
54
+ ? `declare const _default: {\n${flatExportLines}${namespaceExportLines}};\n\nexport default _default;\n`
55
+ : `export default {\n${flatExportLines}${namespaceExportLines}};`;
56
+
57
+ const namedExports = generateNamedExports({
58
+ nestedExports,
59
+ flatExports,
60
+ exportRoots,
61
+ dts,
62
+ useTabs
63
+ });
64
+
65
+ return headerComment +
31
66
  importStatements + '\n' +
32
67
  namedExports + '\n' +
33
68
  defaultExportCode;
69
+
34
70
  }
@@ -1,18 +1,41 @@
1
- export default function generateFlatExportLines(flatExports, exportRoots, includeComments, dts) {
2
- let lines = '';
3
- if (exportRoots) {
4
- flatExports.forEach(({ functionName, importVarName, jsDocComment }) => {
5
- if (includeComments && jsDocComment) {
6
- const indentedComment = jsDocComment
7
- .split('\n')
8
- .map(line => ' ' + line)
9
- .join('\n');
10
- lines += indentedComment + '\n';
11
- }
12
- lines += dts
13
- ? ` ${functionName}: typeof ${importVarName};\n`
14
- : ` ${functionName}: ${importVarName},\n`;
15
- });
16
- }
17
- return lines;
1
+ export default function generateFlatExportLines({
2
+ flatExports,
3
+ exportRoots,
4
+ includeComments,
5
+ dts,
6
+ useTabs = true
7
+ }) {
8
+
9
+ let indentStyle = useTabs ? '\t' : ' ';
10
+
11
+ let lines = '';
12
+
13
+
14
+ if (exportRoots) {
15
+
16
+ flatExports.forEach(({
17
+ functionName, importVarName, jsDocComment
18
+ }) => {
19
+
20
+ if (includeComments && jsDocComment) {
21
+
22
+ const indentedComment = jsDocComment
23
+ .split('\n')
24
+ .map((line) => indentStyle + line)
25
+ .join('\n');
26
+
27
+ lines += indentedComment + '\n';
28
+
29
+ }
30
+
31
+ lines += dts
32
+ ? `${indentStyle}${functionName}: typeof ${importVarName};\n`
33
+ : `${indentStyle}${functionName}: ${importVarName},\n`;
34
+
35
+ });
36
+
37
+ }
38
+
39
+ return lines;
40
+
18
41
  }