@awesomeness-js/utils 1.0.2 → 1.0.3
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/index.js +9 -7
- package/package.json +1 -1
- package/src/build.js +5 -1
package/index.js
CHANGED
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import _build from './src/build.js';
|
|
7
7
|
|
|
8
|
+
export { _build as build };
|
|
9
|
+
|
|
8
10
|
export default {
|
|
9
|
-
/**
|
|
10
|
-
* Generates a output file that consolidates all src functions.
|
|
11
|
-
*
|
|
12
|
-
* @param {Object} [options] - The options for generating the output file.
|
|
13
|
-
* @param {string} [options.src='./src'] - The source directory.
|
|
14
|
-
* @param {array} [options.dest=['./', 'index.js']] - The destination file.
|
|
15
|
-
* @returns {bool} - Returns true if the output file is generated successfully.
|
|
11
|
+
/**
|
|
12
|
+
* Generates a output file that consolidates all src functions.
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} [options] - The options for generating the output file.
|
|
15
|
+
* @param {string} [options.src='./src'] - The source directory.
|
|
16
|
+
* @param {array} [options.dest=['./', 'index.js']] - The destination file.
|
|
17
|
+
* @returns {bool} - Returns true if the output file is generated successfully.
|
|
16
18
|
*/
|
|
17
19
|
build: _build
|
|
18
20
|
};
|
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -70,6 +70,7 @@ function generateExports(src) {
|
|
|
70
70
|
allFiles.push(...fnFiles);
|
|
71
71
|
|
|
72
72
|
let imports = '';
|
|
73
|
+
let allExports = '';
|
|
73
74
|
let apiObject = {};
|
|
74
75
|
|
|
75
76
|
let allComments = {};
|
|
@@ -94,6 +95,9 @@ function generateExports(src) {
|
|
|
94
95
|
// Generate import statement with JSDoc comment if available
|
|
95
96
|
imports += `import ${namespace}_${functionName} from '${importPath}.js';\n`;
|
|
96
97
|
|
|
98
|
+
// generate exports
|
|
99
|
+
if(!namespace){ allExports += `export { _${functionName} as ${functionName} };\n`; }
|
|
100
|
+
|
|
97
101
|
// Populate the API object structure
|
|
98
102
|
let current = apiObject;
|
|
99
103
|
for (const part of parts) {
|
|
@@ -113,7 +117,7 @@ function generateExports(src) {
|
|
|
113
117
|
*/
|
|
114
118
|
`;
|
|
115
119
|
|
|
116
|
-
return headerComment + imports + '\n' + apiContent;
|
|
120
|
+
return headerComment + imports + '\n' + allExports + '\n' + apiContent;
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
|