js-build-tools 5.7.0 → 6.1.0
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 +46 -3
- package/dist/build.js +40 -38
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +24 -23
- package/dist/bundle.min.js +1 -1
- package/dist/bundleMinify.js +14 -13
- package/dist/bundleMinify.min.js +1 -1
- package/dist/compileReadme.js +7 -7
- package/dist/copyFonts.js +14 -13
- package/dist/copyFonts.min.js +1 -1
- package/dist/default.js +16 -15
- package/dist/default.min.js +1 -1
- package/dist/dist.js +7 -7
- package/dist/distMinify.js +14 -13
- package/dist/distMinify.min.js +1 -1
- package/dist/images.js +7 -7
- package/dist/partials/addToReadme.js +3 -2
- package/dist/partials/beginWatcher.js +13 -12
- package/dist/partials/clean.js +15 -14
- package/dist/partials/distFor.js +22 -21
- package/dist/partials/distForSrc.js +12 -11
- package/dist/partials/distSeries.js +20 -19
- package/dist/partials/imagesFor.js +2 -1
- package/dist/partials/loadPeer.js +70 -70
- package/dist/partials/neostandardLint.js +163 -0
- package/dist/partials/readmeTemplate.js +15 -14
- package/dist/partials/runOnChange.js +29 -28
- package/dist/partials/sassFor.js +29 -28
- package/dist/partials/tsFor.js +2 -1
- package/dist/partials/typeDocsFor.js +2 -1
- package/dist/partials.js +136 -136
- package/dist/partials.min.js +1 -1
- package/dist/sass.js +7 -7
- package/dist/sourceLint.js +35 -0
- package/dist/sourceLint.min.js +1 -0
- package/dist/test-helpers/neostandardLintWithRealNeostandard.js +50 -0
- package/dist/test-helpers/setUp.js +2 -1
- package/dist/testFull.js +21 -20
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +11 -10
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +23 -22
- package/dist/testQuick.min.js +1 -1
- package/dist/typeDocs.js +9 -9
- package/dist/typeScript.js +6 -6
- package/dist/utilities/convertMjsFilesForDocs.js +36 -36
- package/dist/utilities/dotNotate.js +48 -46
- package/dist/utilities/esmNamedExportsToCjs.js +18 -18
- package/dist/utilities/getBundleConfigs.js +3 -2
- package/dist/watchFull.js +7 -7
- package/dist/watchTest.js +17 -16
- package/dist/watchTest.min.js +1 -1
- package/functions/build.mjs +9 -8
- package/functions/build.test.mjs +18 -25
- package/functions/bundle.mjs +2 -2
- package/functions/partials/addToReadme.mjs +1 -1
- package/functions/partials/neostandardLint.mjs +130 -0
- package/functions/partials/neostandardLint.test.mjs +117 -0
- package/functions/partials.mjs +1 -1
- package/functions/sourceLint.mjs +24 -0
- package/functions/sourceLint.test.mjs +97 -0
- package/functions/test-helpers/neostandardLintWithRealNeostandard.mjs +40 -0
- package/functions/utilities/dotNotate.mjs +3 -1
- package/functions/utilities/dotNotate.test.mjs +34 -0
- package/functions/utilities/getBundleConfigs.mjs +1 -1
- package/gulp.config.mjs +14 -0
- package/gulpfile.base.js +2 -4
- package/gulpfile.base.mjs +1 -2
- package/package.json +7 -6
- package/dist/bundleLint.js +0 -28
- package/dist/bundleLint.min.js +0 -1
- package/dist/distLint.js +0 -20
- package/dist/distLint.min.js +0 -1
- package/dist/partials/standardLint.js +0 -94
- package/dist/test-helpers/standardLintWithRealStandard.js +0 -28
- package/functions/bundleLint.mjs +0 -18
- package/functions/bundleLint.test.mjs +0 -85
- package/functions/distLint.mjs +0 -12
- package/functions/distLint.test.mjs +0 -62
- package/functions/partials/standardLint.mjs +0 -78
- package/functions/partials/standardLint.test.mjs +0 -99
- package/functions/test-helpers/standardLintWithRealStandard.mjs +0 -21
package/dist/testQuick.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require(
|
|
4
|
-
Object.defineProperty(exports,
|
|
5
|
-
value: true
|
|
6
|
-
})
|
|
7
|
-
exports.testQuick = void 0
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.testQuick = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
|
|
9
|
+
var _jest = require("jest");
|
|
10
|
+
var cache;
|
|
11
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
11
12
|
/**
|
|
12
13
|
* Run the Jest tests for files which have been modified (based on git status).
|
|
13
14
|
* Configure where tests are located by using 'testPath'.
|
|
14
15
|
* @memberOf module:js-build-tools
|
|
15
16
|
* @returns {Promise<*>}
|
|
16
|
-
*/
|
|
17
|
-
const testQuick = () => {
|
|
18
|
-
let testPath = gulpConfig.get('test.path')
|
|
19
|
-
if (!Array.isArray(testPath)) {
|
|
20
|
-
// The testPath must be an array of strings
|
|
21
|
-
testPath = [testPath]
|
|
22
|
-
}
|
|
23
|
-
return (0, _jest.runCLI)({
|
|
24
|
-
onlyChanged: true
|
|
25
|
-
}, testPath)
|
|
26
|
-
}
|
|
27
|
-
exports.testQuick = testQuick
|
|
17
|
+
*/
|
|
18
|
+
const testQuick = () => {
|
|
19
|
+
let testPath = gulpConfig.get('test.path');
|
|
20
|
+
if (!Array.isArray(testPath)) {
|
|
21
|
+
// The testPath must be an array of strings
|
|
22
|
+
testPath = [testPath];
|
|
23
|
+
}
|
|
24
|
+
return (0, _jest.runCLI)({
|
|
25
|
+
onlyChanged: true
|
|
26
|
+
}, testPath);
|
|
27
|
+
};
|
|
28
|
+
exports.testQuick = testQuick;
|
package/dist/testQuick.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.testQuick=void 0;var gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_jest=require("jest");function _interopRequireWildcard(e,t){if(
|
|
1
|
+
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.testQuick=void 0;var cache,gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_jest=require("jest");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var r,c,i=Object.defineProperty,a={__proto__:null,default:e};if(Object(e)!==e)return a;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,a)}for(c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((r=i&&Object.getOwnPropertyDescriptor(e,c))&&(r.get||r.set)?i(a,c,r):a[c]=e[c]);return a}const testQuick=()=>{let e=gulpConfig.get("test.path");return Array.isArray(e)||(e=[e]),(0,_jest.runCLI)({onlyChanged:!0},e)};exports.testQuick=testQuick;
|
package/dist/typeDocs.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.typeDocs = void 0
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.typeDocs = void 0;
|
|
7
|
+
var _typeDocsFor = require("./partials/typeDocsFor.js");
|
|
8
8
|
/**
|
|
9
9
|
* Generate the HTML documentation of a TypeScript project from its source, with the modules mirroring the source
|
|
10
10
|
* folders. Turn it on with docs.enabled, see {@link module:partials.typeDocsFor}.
|
|
11
11
|
* @memberOf module:js-build-tools
|
|
12
12
|
* @returns {Function}
|
|
13
|
-
*/
|
|
14
|
-
const typeDocs = exports.typeDocs = (0, _typeDocsFor.typeDocsFor)()
|
|
13
|
+
*/
|
|
14
|
+
const typeDocs = exports.typeDocs = (0, _typeDocsFor.typeDocsFor)();
|
package/dist/typeScript.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.typeScript = void 0
|
|
7
|
-
|
|
5
|
+
});
|
|
6
|
+
exports.typeScript = void 0;
|
|
7
|
+
var _tsFor = require("./partials/tsFor.js");
|
|
8
8
|
/**
|
|
9
9
|
* Simplified typescript task using tsFor.
|
|
10
10
|
* @memberOf module:js-build-tools
|
|
11
11
|
* @returns {Function}
|
|
12
12
|
*/
|
|
13
|
-
const typeScript = exports.typeScript = (0, _tsFor.tsFor)()
|
|
13
|
+
const typeScript = exports.typeScript = (0, _tsFor.tsFor)();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.convertMjsFilesForDocs = void 0;
|
|
7
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
9
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
10
|
-
var _os = _interopRequireDefault(require("os"));
|
|
11
|
-
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
var _esmNamedExportsToCjs = require("./esmNamedExportsToCjs.js");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.convertMjsFilesForDocs = void 0;
|
|
7
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
9
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
10
|
+
var _os = _interopRequireDefault(require("os"));
|
|
11
|
+
var _path = _interopRequireDefault(require("path"));
|
|
12
|
+
var _esmNamedExportsToCjs = require("./esmNamedExportsToCjs.js");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
/**
|
|
15
15
|
* Writes a rewritten (see {@link esmNamedExportsToCjs}) copy of each given `.mjs` file into a fresh, unique
|
|
16
16
|
* directory under the OS temp directory, with a `.js` extension - jsdoc-to-markdown only recognizes `.js` as a
|
|
@@ -22,27 +22,27 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
22
22
|
* @param {Array<string>} mjsFilePaths - Real `.mjs` files to convert. An empty array is a safe, cheap no-op.
|
|
23
23
|
* @returns {{filePaths: Array<string>, cleanUp: function(): void}} The temp `.js` file paths to pass to
|
|
24
24
|
* jsdoc-to-markdown instead of the real `.mjs` ones, and a function to remove the temp directory afterward.
|
|
25
|
-
*/
|
|
26
|
-
const convertMjsFilesForDocs = (mjsFilePaths = []) => {
|
|
27
|
-
if (mjsFilePaths.length === 0) {
|
|
28
|
-
return {
|
|
29
|
-
filePaths: [],
|
|
30
|
-
cleanUp: () => {}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const tempDir = _fs.default.mkdtempSync(_path.default.join(_os.default.tmpdir(), 'js-build-tools-docs-'));
|
|
34
|
-
const filePaths = mjsFilePaths.map(mjsFilePath => {
|
|
35
|
-
const tempFilePath = _path.default.join(tempDir, _path.default.basename(mjsFilePath, '.js') + '.js');
|
|
36
|
-
const source = _fs.default.readFileSync(mjsFilePath, 'utf8');
|
|
37
|
-
_fs.default.writeFileSync(tempFilePath, (0, _esmNamedExportsToCjs.esmNamedExportsToCjs)(source));
|
|
38
|
-
return tempFilePath;
|
|
39
|
-
});
|
|
40
|
-
return {
|
|
41
|
-
filePaths,
|
|
42
|
-
cleanUp: () => _fs.default.rmSync(tempDir, {
|
|
43
|
-
recursive: true,
|
|
44
|
-
force: true
|
|
45
|
-
})
|
|
46
|
-
};
|
|
47
|
-
};
|
|
25
|
+
*/
|
|
26
|
+
const convertMjsFilesForDocs = (mjsFilePaths = []) => {
|
|
27
|
+
if (mjsFilePaths.length === 0) {
|
|
28
|
+
return {
|
|
29
|
+
filePaths: [],
|
|
30
|
+
cleanUp: () => {}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const tempDir = _fs.default.mkdtempSync(_path.default.join(_os.default.tmpdir(), 'js-build-tools-docs-'));
|
|
34
|
+
const filePaths = mjsFilePaths.map(mjsFilePath => {
|
|
35
|
+
const tempFilePath = _path.default.join(tempDir, _path.default.basename(mjsFilePath, '.js') + '.js');
|
|
36
|
+
const source = _fs.default.readFileSync(mjsFilePath, 'utf8');
|
|
37
|
+
_fs.default.writeFileSync(tempFilePath, (0, _esmNamedExportsToCjs.esmNamedExportsToCjs)(source));
|
|
38
|
+
return tempFilePath;
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
filePaths,
|
|
42
|
+
cleanUp: () => _fs.default.rmSync(tempDir, {
|
|
43
|
+
recursive: true,
|
|
44
|
+
force: true
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
48
|
exports.convertMjsFilesForDocs = convertMjsFilesForDocs;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.dotNotate = void 0;
|
|
7
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
9
|
-
var _isObject = require("./isObject.js");
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.dotNotate = void 0;
|
|
7
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
9
|
+
var _isObject = require("./isObject.js");
|
|
10
10
|
/**
|
|
11
11
|
* Convert an array of keys into a regex, return a function to test if incoming keys match.
|
|
12
12
|
* @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
|
|
13
13
|
* @returns {Function} The dot-notated array
|
|
14
|
-
*/
|
|
15
|
-
const handleRetainObjects = (retainObjects = []) => {
|
|
16
|
-
if (!retainObjects.length) {
|
|
14
|
+
*/
|
|
15
|
+
const handleRetainObjects = (retainObjects = []) => {
|
|
16
|
+
if (!retainObjects.length) {
|
|
17
17
|
/**
|
|
18
18
|
* Bypass the test function if there are no retainObjects.
|
|
19
19
|
* @returns {false}
|
|
20
|
-
*/
|
|
21
|
-
return (currentKey, value, results) => false;
|
|
22
|
-
}
|
|
23
|
-
retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
|
|
24
|
-
const retainRegex = new RegExp(`(${retainObjects.join('|')})$`);
|
|
20
|
+
*/
|
|
21
|
+
return (currentKey, value, results) => false;
|
|
22
|
+
}
|
|
23
|
+
retainObjects = retainObjects.map(key => key.replace('\.', '\\.'));
|
|
24
|
+
const retainRegex = new RegExp(`(${retainObjects.join('|')})$`);
|
|
25
25
|
/**
|
|
26
26
|
* Test if a key should be retained as an object.
|
|
27
27
|
* @param {string} currentKey - The key to test
|
|
28
28
|
* @param {*} value - The value of the key
|
|
29
29
|
* @param {Object} results - The result object to add to
|
|
30
30
|
* @returns {boolean}
|
|
31
|
-
*/
|
|
32
|
-
return (currentKey, value, results) => {
|
|
33
|
-
if (!currentKey.match(retainRegex)) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
results[currentKey] = value;
|
|
37
|
-
return true;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
|
|
31
|
+
*/
|
|
32
|
+
return (currentKey, value, results) => {
|
|
33
|
+
if (!currentKey.match(retainRegex)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
results[currentKey] = value;
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
41
|
/**
|
|
42
42
|
* The underlying logic function for converting arrays to dot-notation.
|
|
43
43
|
* @param {Object} arrayObject - The array or object to dot-notate
|
|
@@ -45,29 +45,31 @@ const handleRetainObjects = (retainObjects = []) => {
|
|
|
45
45
|
* @param {string} [prepend=''] - The path for the property being processed
|
|
46
46
|
* @param {Object<string, *>} [results={}] - The final notated object to return
|
|
47
47
|
* @returns {Object<string, *>} The dot-notated object
|
|
48
|
-
*/
|
|
49
|
-
const performDotNotate = (arrayObject, didRetain, prepend = '', results = {}) => {
|
|
50
|
-
for (let key in arrayObject) {
|
|
51
|
-
const value = arrayObject[key];
|
|
52
|
-
const currentKey = `${prepend}${key}`;
|
|
53
|
-
if (didRetain(currentKey, value, results)) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
48
|
+
*/
|
|
49
|
+
const performDotNotate = (arrayObject, didRetain, prepend = '', results = {}) => {
|
|
50
|
+
for (let key in arrayObject) {
|
|
51
|
+
const value = arrayObject[key];
|
|
52
|
+
const currentKey = `${prepend}${key}`;
|
|
53
|
+
if (didRetain(currentKey, value, results)) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
// An empty object/array has no keys to flatten into - recursing into one would silently drop currentKey
|
|
57
|
+
// from the result entirely, rather than keeping it as the empty value it actually is. Treat it as a leaf.
|
|
58
|
+
if ((0, _isObject.isObject)(value) && Object.keys(value).length) {
|
|
59
|
+
performDotNotate(value, didRetain, `${currentKey}.`, results);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
results[currentKey] = value;
|
|
63
|
+
}
|
|
64
|
+
return results;
|
|
65
|
+
};
|
|
66
|
+
|
|
65
67
|
/**
|
|
66
68
|
* Convert an array or object to a single dimensional associative array with dot notation.
|
|
67
69
|
* Original source concepts from {@link https://github.com/jheagle/si-funciona/blob/main/src/helpers/objects/dotNotate.ts Sí, funciona}
|
|
68
70
|
* @param {Object} arrayObject - The array or object to dot-notate
|
|
69
71
|
* @param {Array.<string>} [retainObjects=[]] - An array of keys to retain as objects
|
|
70
72
|
* @returns {Object<string, *>} The dot-notated object
|
|
71
|
-
*/
|
|
72
|
-
const dotNotate = (arrayObject, retainObjects = []) => performDotNotate(arrayObject, handleRetainObjects(retainObjects));
|
|
73
|
+
*/
|
|
74
|
+
const dotNotate = (arrayObject, retainObjects = []) => performDotNotate(arrayObject, handleRetainObjects(retainObjects));
|
|
73
75
|
exports.dotNotate = dotNotate;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.esmNamedExportsToCjs = void 0;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.esmNamedExportsToCjs = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* Rewrites named `export const`/`export function`/`export class` declarations to plain declarations plus a
|
|
9
9
|
* trailing `module.exports = { ... }` - the same shape jsdoc-to-markdown already documents cleanly (a plain
|
|
@@ -18,16 +18,16 @@ exports.esmNamedExportsToCjs = void 0;
|
|
|
18
18
|
* @memberOf module:utilities
|
|
19
19
|
* @param {string} source - The raw ESM source text (never executed, just rewritten as text).
|
|
20
20
|
* @returns {string} The rewritten text, safe to write out with a `.js` extension for jsdoc-to-markdown to read.
|
|
21
|
-
*/
|
|
22
|
-
const esmNamedExportsToCjs = source => {
|
|
23
|
-
const exportedNames = [];
|
|
24
|
-
const rewritten = source.replace(/^export (const|function|class) (\w+)/gm, (match, keyword, name) => {
|
|
25
|
-
exportedNames.push(name);
|
|
26
|
-
return `${keyword} ${name}`;
|
|
27
|
-
});
|
|
28
|
-
if (exportedNames.length === 0) {
|
|
29
|
-
return rewritten;
|
|
30
|
-
}
|
|
31
|
-
return `${rewritten}\n\nmodule.exports = { ${exportedNames.join(', ')} }\n`;
|
|
32
|
-
};
|
|
21
|
+
*/
|
|
22
|
+
const esmNamedExportsToCjs = source => {
|
|
23
|
+
const exportedNames = [];
|
|
24
|
+
const rewritten = source.replace(/^export (const|function|class) (\w+)/gm, (match, keyword, name) => {
|
|
25
|
+
exportedNames.push(name);
|
|
26
|
+
return `${keyword} ${name}`;
|
|
27
|
+
});
|
|
28
|
+
if (exportedNames.length === 0) {
|
|
29
|
+
return rewritten;
|
|
30
|
+
}
|
|
31
|
+
return `${rewritten}\n\nmodule.exports = { ${exportedNames.join(', ')} }\n`;
|
|
32
|
+
};
|
|
33
33
|
exports.esmNamedExportsToCjs = esmNamedExportsToCjs;
|
|
@@ -8,7 +8,8 @@ exports.getBundleConfigs = void 0;
|
|
|
8
8
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
9
|
require("core-js/modules/esnext.iterator.map.js");
|
|
10
10
|
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
11
|
-
|
|
11
|
+
var cache;
|
|
12
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
12
13
|
/**
|
|
13
14
|
* Build the full list of bundles to produce for this project: the primary bundle (browser.name /
|
|
14
15
|
* dist.main / browser.ignore / browser.exclude, exactly as before browser.bundles existed) plus
|
|
@@ -25,7 +26,7 @@ const getBundleConfigs = () => {
|
|
|
25
26
|
ignore: gulpConfig.get('browser.ignore'),
|
|
26
27
|
exclude: gulpConfig.get('browser.exclude')
|
|
27
28
|
};
|
|
28
|
-
const additional = gulpConfig.get('browser.bundles')
|
|
29
|
+
const additional = gulpConfig.get('browser.bundles');
|
|
29
30
|
return [primary, ...additional.map(bundleConfig => ({
|
|
30
31
|
name: bundleConfig.name,
|
|
31
32
|
main: bundleConfig.main || primary.main,
|
package/dist/watchFull.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports,
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.watchFull = void 0
|
|
7
|
-
|
|
5
|
+
});
|
|
6
|
+
exports.watchFull = void 0;
|
|
7
|
+
var _partials = require("./partials.js");
|
|
8
8
|
/**
|
|
9
9
|
* Watch for changes and run the distribution for the changed files, then bundle and test the changed files.
|
|
10
10
|
* @memberOf module:js-build-tools
|
|
11
11
|
* @returns {FSWatcher}
|
|
12
12
|
*/
|
|
13
|
-
const watchFull = () => (0, _partials.beginWatcher)().on('change', _partials.runOnChange)
|
|
14
|
-
exports.watchFull = watchFull
|
|
13
|
+
const watchFull = () => (0, _partials.beginWatcher)().on('change', _partials.runOnChange);
|
|
14
|
+
exports.watchFull = watchFull;
|
package/dist/watchTest.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require(
|
|
4
|
-
Object.defineProperty(exports,
|
|
5
|
-
value: true
|
|
6
|
-
})
|
|
7
|
-
exports.watchTest = void 0
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.watchTest = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../gulp.config.js"));
|
|
9
|
+
var _gulp = require("gulp");
|
|
10
|
+
var _testQuick = require("./testQuick.js");
|
|
11
|
+
var cache;
|
|
12
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
12
13
|
/**
|
|
13
14
|
* Watch for changes and run the tests.
|
|
14
15
|
* @memberOf module:js-build-tools
|
|
15
16
|
* @returns {*}
|
|
16
|
-
*/
|
|
17
|
-
const watchTest = () => (0, _gulp.watch)(gulpConfig.get('test.watch'), {
|
|
18
|
-
ignoreInitial: false
|
|
19
|
-
}, _testQuick.testQuick)
|
|
20
|
-
exports.watchTest = watchTest
|
|
17
|
+
*/
|
|
18
|
+
const watchTest = () => (0, _gulp.watch)(gulpConfig.get('test.watch'), {
|
|
19
|
+
ignoreInitial: false
|
|
20
|
+
}, _testQuick.testQuick);
|
|
21
|
+
exports.watchTest = watchTest;
|
package/dist/watchTest.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.watchTest=void 0;var gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_gulp=require("gulp"),_testQuick=require("./testQuick.js");function _interopRequireWildcard(e,t){if(
|
|
1
|
+
"use strict";require("core-js/modules/esnext.weak-map.delete-all.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.watchTest=void 0;var cache,gulpConfig=_interopRequireWildcard(require("../gulp.config.js")),_gulp=require("gulp"),_testQuick=require("./testQuick.js");function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;var r,c,i=Object.defineProperty,a={__proto__:null,default:e};if(Object(e)!==e)return a;if(cache||"function"!=typeof WeakMap||(cache=new WeakMap),cache){if(cache.has(e))return cache.get(e);cache.set(e,a)}for(c in e)"default"!==c&&{}.hasOwnProperty.call(e,c)&&((r=i&&Object.getOwnPropertyDescriptor(e,c))&&(r.get||r.set)?i(a,c,r):a[c]=e[c]);return a}const watchTest=()=>(0,_gulp.watch)(gulpConfig.get("test.watch"),{ignoreInitial:!1},_testQuick.testQuick);exports.watchTest=watchTest;
|
package/functions/build.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { bundle } from './bundle.mjs'
|
|
2
|
-
import { bundleLint } from './bundleLint.mjs'
|
|
3
2
|
import { bundleMinify } from './bundleMinify.mjs'
|
|
4
3
|
import { clean, distSeries } from './partials.mjs'
|
|
5
4
|
import { compileReadme } from './compileReadme.mjs'
|
|
6
5
|
import { typeDocs } from './typeDocs.mjs'
|
|
7
|
-
import { distLint } from './distLint.mjs'
|
|
8
6
|
import { distMinify } from './distMinify.mjs'
|
|
7
|
+
import { sourceLint } from './sourceLint.mjs'
|
|
9
8
|
import { parallel, series } from 'gulp'
|
|
10
9
|
import * as gulpConfig from '../gulp.config.mjs'
|
|
11
10
|
import { copyFonts } from './copyFonts.mjs'
|
|
@@ -15,14 +14,13 @@ import { testFull } from './testFull.mjs'
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Runs several processes to build and validate the project.
|
|
18
|
-
* Cleans, distributes
|
|
17
|
+
* Cleans and lints the source, distributes and minifies, bundles and minifies, creates the readme, then runs the
|
|
18
|
+
* tests.
|
|
19
19
|
* @memberOf module:js-build-tools
|
|
20
20
|
* @returns {stream.Stream}
|
|
21
21
|
*/
|
|
22
22
|
export const build = (done = null) => {
|
|
23
|
-
const
|
|
24
|
-
const bundleLintMinify = parallel(bundleLint, bundleMinify)
|
|
25
|
-
const buildActions = [distSeries(), distLintMinify]
|
|
23
|
+
const buildActions = [distSeries(), distMinify]
|
|
26
24
|
const generateDocs = gulpConfig.get('docs.enabled')
|
|
27
25
|
if (generateDocs) {
|
|
28
26
|
// The documentation is generated from the TypeScript source itself, the readme is written by hand
|
|
@@ -34,7 +32,7 @@ export const build = (done = null) => {
|
|
|
34
32
|
if (gulpConfig.get('browser.enabled')) {
|
|
35
33
|
// If not 'nodeOnly' then we also want to bundle for browser after we complete the dist directory
|
|
36
34
|
buildActions.push(bundle)
|
|
37
|
-
buildActions.push(
|
|
35
|
+
buildActions.push(bundleMinify)
|
|
38
36
|
}
|
|
39
37
|
const runActions = [
|
|
40
38
|
series(...buildActions),
|
|
@@ -58,8 +56,11 @@ export const build = (done = null) => {
|
|
|
58
56
|
}
|
|
59
57
|
// clean has to finish before anything writes into the output folders - images, fonts and sass all write into
|
|
60
58
|
// browser/, so running clean in parallel with them races (ENOTEMPTY errors from clean, or output deleted mid-write).
|
|
59
|
+
// sourceLint fixes the real source in place before anything compiles from it (distSeries, tsFor inside it), so a
|
|
60
|
+
// build never reads a mix of pre- and post-fix content; clean only touches dist/browser output, so the two can
|
|
61
|
+
// run alongside each other.
|
|
61
62
|
return series(
|
|
62
|
-
clean,
|
|
63
|
+
parallel(clean, sourceLint),
|
|
63
64
|
parallel(...runActions)
|
|
64
65
|
)(done)
|
|
65
66
|
}
|