js-build-tools 6.1.0 → 6.2.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 +89 -25
- package/dist/build.js +5 -2
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +40 -40
- package/dist/bundleMinify.js +18 -18
- package/dist/copyFiles.js +47 -0
- package/dist/copyFiles.min.js +1 -0
- package/dist/copyFonts.js +13 -13
- package/dist/default.js +15 -15
- package/dist/distMinify.js +13 -13
- package/dist/docs.js +19 -0
- package/dist/docs.min.js +1 -0
- package/dist/jsdocDocs.js +15 -0
- package/dist/jsdocDocs.min.js +1 -0
- package/dist/partials/addToReadme.js +25 -25
- package/dist/partials/beginWatcher.js +13 -13
- package/dist/partials/clean.js +15 -15
- package/dist/partials/copyFor.js +10 -2
- package/dist/partials/distFor.js +22 -22
- package/dist/partials/distForSrc.js +12 -12
- package/dist/partials/distSeries.js +20 -20
- package/dist/partials/imagesFor.js +43 -43
- package/dist/partials/jsdocDocsFor.js +155 -0
- package/dist/partials/neostandardLint.js +121 -121
- package/dist/partials/readmeTemplate.js +15 -15
- package/dist/partials/resolveDocsMethod.js +19 -0
- package/dist/partials/runOnChange.js +29 -29
- package/dist/partials/sassFor.js +29 -29
- package/dist/partials/tsFor.js +71 -71
- package/dist/partials/typeDocsFor.js +203 -203
- package/dist/partials.js +149 -135
- package/dist/partials.min.js +1 -1
- package/dist/sourceLint.js +26 -26
- package/dist/test-helpers/neostandardLintWithRealNeostandard.js +49 -49
- package/dist/test-helpers/setUp.js +95 -95
- package/dist/testFull.js +20 -20
- package/dist/testHelpers.js +10 -10
- package/dist/testQuick.js +22 -22
- package/dist/utilities/dotNotate.js +48 -48
- package/dist/utilities/getBundleConfigs.js +28 -28
- package/dist/watchTest.js +16 -16
- package/functions/build.mjs +5 -2
- package/functions/build.test.mjs +50 -1
- package/functions/copyFiles.mjs +32 -0
- package/functions/copyFiles.test.mjs +78 -0
- package/functions/docs.mjs +13 -0
- package/functions/docs.test.mjs +45 -0
- package/functions/jsdocDocs.mjs +10 -0
- package/functions/partials/copyFor.mjs +4 -1
- package/functions/partials/jsdocDocsFor.mjs +132 -0
- package/functions/partials/jsdocDocsFor.test.mjs +101 -0
- package/functions/partials/resolveDocsMethod.mjs +10 -0
- package/functions/partials/resolveDocsMethod.test.mjs +33 -0
- package/functions/partials.mjs +2 -0
- package/functions/partials.test.mjs +1 -1
- package/gulp.config.mjs +28 -5
- package/gulpfile.base.mjs +4 -1
- package/package.json +14 -1
|
@@ -1,18 +1,18 @@
|
|
|
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.addToReadme = void 0;
|
|
8
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
10
|
-
var _jsdocToMarkdown = _interopRequireDefault(require("jsdoc-to-markdown"));
|
|
11
|
-
var _glob = require("glob");
|
|
12
|
-
var _convertMjsFilesForDocs = require("../utilities/convertMjsFilesForDocs.js");
|
|
13
|
-
var cache;
|
|
14
|
-
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; }
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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.addToReadme = void 0;
|
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
10
|
+
var _jsdocToMarkdown = _interopRequireDefault(require("jsdoc-to-markdown"));
|
|
11
|
+
var _glob = require("glob");
|
|
12
|
+
var _convertMjsFilesForDocs = require("../utilities/convertMjsFilesForDocs.js");
|
|
13
|
+
var cache;
|
|
14
|
+
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; }
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
/**
|
|
17
17
|
* Appends all the jsdoc comments to the readme file. Assumes empty or templated file.
|
|
18
18
|
* Configure this with 'readmeSearch', 'readmePath', 'readmeFile', and 'readmeOptions'.
|
|
@@ -22,14 +22,14 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
22
22
|
* {@link convertMjsFilesForDocs}) and cleaned up again once this has read them, win or lose.
|
|
23
23
|
* @memberOf module:partials
|
|
24
24
|
* @returns {string|Uint8Array}
|
|
25
|
-
*/
|
|
26
|
-
const addToReadme = () => {
|
|
27
|
-
const {
|
|
28
|
-
filePaths: esmFilePaths,
|
|
29
|
-
cleanUp
|
|
30
|
-
} = (0, _convertMjsFilesForDocs.convertMjsFilesForDocs)((0, _glob.globSync)(gulpConfig.get('readme.fromEsm')));
|
|
31
|
-
return _jsdocToMarkdown.default.render({
|
|
32
|
-
files: [...(0, _glob.globSync)(gulpConfig.get('readme.from')), ...esmFilePaths]
|
|
33
|
-
}).finally(cleanUp).then(readme => _fs.default.appendFileSync(gulpConfig.get('readme.to') + gulpConfig.get('readme.file'), readme, gulpConfig.get('readmeOptions')));
|
|
34
|
-
};
|
|
25
|
+
*/
|
|
26
|
+
const addToReadme = () => {
|
|
27
|
+
const {
|
|
28
|
+
filePaths: esmFilePaths,
|
|
29
|
+
cleanUp
|
|
30
|
+
} = (0, _convertMjsFilesForDocs.convertMjsFilesForDocs)((0, _glob.globSync)(gulpConfig.get('readme.fromEsm')));
|
|
31
|
+
return _jsdocToMarkdown.default.render({
|
|
32
|
+
files: [...(0, _glob.globSync)(gulpConfig.get('readme.from')), ...esmFilePaths]
|
|
33
|
+
}).finally(cleanUp).then(readme => _fs.default.appendFileSync(gulpConfig.get('readme.to') + gulpConfig.get('readme.file'), readme, gulpConfig.get('readmeOptions')));
|
|
34
|
+
};
|
|
35
35
|
exports.addToReadme = addToReadme;
|
|
@@ -1,18 +1,18 @@
|
|
|
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.beginWatcher = void 0;
|
|
8
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
-
var _gulp = require("gulp");
|
|
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; }
|
|
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.beginWatcher = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
+
var _gulp = require("gulp");
|
|
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; }
|
|
12
12
|
/**
|
|
13
13
|
* Create a chokidar instance which watches and triggers change when the globed files are modified.
|
|
14
14
|
* @memberOf module:partials
|
|
15
15
|
* @returns {FSWatcher}
|
|
16
|
-
*/
|
|
17
|
-
const beginWatcher = () => (0, _gulp.watch)(gulpConfig.get('test.watch'));
|
|
16
|
+
*/
|
|
17
|
+
const beginWatcher = () => (0, _gulp.watch)(gulpConfig.get('test.watch'));
|
|
18
18
|
exports.beginWatcher = beginWatcher;
|
package/dist/partials/clean.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
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.clean = void 0;
|
|
8
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
|
-
require("core-js/modules/esnext.iterator.reduce.js");
|
|
10
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
11
|
-
var _removeDirectory = require("./removeDirectory.js");
|
|
12
|
-
var cache;
|
|
13
|
-
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; }
|
|
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.clean = void 0;
|
|
8
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
|
+
require("core-js/modules/esnext.iterator.reduce.js");
|
|
10
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
11
|
+
var _removeDirectory = require("./removeDirectory.js");
|
|
12
|
+
var cache;
|
|
13
|
+
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; }
|
|
14
14
|
/**
|
|
15
15
|
* Deletes all the distribution and browser files (used before create a new build).
|
|
16
16
|
* Configure array of directories to remove with 'cleanPaths'.
|
|
17
17
|
* @memberOf module:partials
|
|
18
18
|
* @returns {Promise<string[]> | *}
|
|
19
|
-
*/
|
|
20
|
-
const clean = () => gulpConfig.get('cleanPaths').reduce((promise, path) => promise.then(() => (0, _removeDirectory.removeDirectory)(path)), Promise.resolve());
|
|
19
|
+
*/
|
|
20
|
+
const clean = () => gulpConfig.get('cleanPaths').reduce((promise, path) => promise.then(() => (0, _removeDirectory.removeDirectory)(path)), Promise.resolve());
|
|
21
21
|
exports.clean = clean;
|
package/dist/partials/copyFor.js
CHANGED
|
@@ -10,10 +10,18 @@ var _gulp = require("gulp");
|
|
|
10
10
|
* @memberOf module:partials
|
|
11
11
|
* @param {string|array} srcPath
|
|
12
12
|
* @param {string} destPath
|
|
13
|
+
* @param {Object} [options]
|
|
14
|
+
* @param {string} [options.base] - Passed through to gulp's own src(pattern, {base}), to preserve srcPath's own
|
|
15
|
+
* subdirectory structure in destPath instead of flattening it.
|
|
13
16
|
* @returns {stream.Stream}
|
|
14
17
|
*/
|
|
15
18
|
// encoding: false copies the bytes untouched - Gulp 5's default utf8 handling corrupts binary files such as fonts.
|
|
16
|
-
const copyFor = (srcPath, destPath
|
|
17
|
-
|
|
19
|
+
const copyFor = (srcPath, destPath, {
|
|
20
|
+
base
|
|
21
|
+
} = {}) => (0, _gulp.src)(srcPath, {
|
|
22
|
+
encoding: false,
|
|
23
|
+
...(base ? {
|
|
24
|
+
base
|
|
25
|
+
} : {})
|
|
18
26
|
}).pipe((0, _gulp.dest)(destPath));
|
|
19
27
|
exports.copyFor = copyFor;
|
package/dist/partials/distFor.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
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.distFor = void 0;
|
|
8
|
-
var _gulpBabel = _interopRequireDefault(require("gulp-babel"));
|
|
9
|
-
var _gulp = require("gulp");
|
|
10
|
-
var _distForSrc = require("./distForSrc.js");
|
|
11
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
12
|
-
var _through = _interopRequireDefault(require("through2"));
|
|
13
|
-
var cache;
|
|
14
|
-
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; }
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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.distFor = void 0;
|
|
8
|
+
var _gulpBabel = _interopRequireDefault(require("gulp-babel"));
|
|
9
|
+
var _gulp = require("gulp");
|
|
10
|
+
var _distForSrc = require("./distForSrc.js");
|
|
11
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
12
|
+
var _through = _interopRequireDefault(require("through2"));
|
|
13
|
+
var cache;
|
|
14
|
+
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; }
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
/**
|
|
17
17
|
* Build the distribution for a given source pattern.
|
|
18
18
|
* @memberOf module:partials
|
|
19
19
|
* @param {string|array} [srcPath='src/config/path/dist/for']
|
|
20
20
|
* @param {string} [destPath='dist/config/path']
|
|
21
21
|
* @returns {stream.Stream}
|
|
22
|
-
*/
|
|
23
|
-
const distFor = (srcPath = (0, _distForSrc.distForSrc)(), destPath = gulpConfig.get('dist.to')) => (0, _gulp.src)(srcPath).pipe((0, _gulpBabel.default)()).pipe(_through.default.obj(function (file, enc, callback) {
|
|
24
|
-
const regex = /\.mjs(['"]\s*\))/gi;
|
|
25
|
-
file.contents = Buffer.from(file.contents.toString().replaceAll(regex, '.js$1'));
|
|
26
|
-
this.push(file);
|
|
27
|
-
callback();
|
|
28
|
-
})).pipe((0, _gulp.dest)(destPath));
|
|
22
|
+
*/
|
|
23
|
+
const distFor = (srcPath = (0, _distForSrc.distForSrc)(), destPath = gulpConfig.get('dist.to')) => (0, _gulp.src)(srcPath).pipe((0, _gulpBabel.default)()).pipe(_through.default.obj(function (file, enc, callback) {
|
|
24
|
+
const regex = /\.mjs(['"]\s*\))/gi;
|
|
25
|
+
file.contents = Buffer.from(file.contents.toString().replaceAll(regex, '.js$1'));
|
|
26
|
+
this.push(file);
|
|
27
|
+
callback();
|
|
28
|
+
})).pipe((0, _gulp.dest)(destPath));
|
|
29
29
|
exports.distFor = distFor;
|
|
@@ -1,18 +1,18 @@
|
|
|
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.distForSrc = void 0;
|
|
8
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
-
var cache;
|
|
10
|
-
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; }
|
|
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.distForSrc = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
+
var cache;
|
|
10
|
+
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
11
|
/**
|
|
12
12
|
* Retrieve the correct distFor search path based on TS Config.
|
|
13
13
|
* @memberOf module:partials
|
|
14
14
|
* @param {module:gulpConfig~FlagStringSetting} [useTs='config/for/ts']
|
|
15
15
|
* @returns {string}
|
|
16
|
-
*/
|
|
17
|
-
const distForSrc = (useTs = gulpConfig.get('typescript.enabled')) => useTs ? gulpConfig.get('browser.from') : gulpConfig.get('dist.from');
|
|
16
|
+
*/
|
|
17
|
+
const distForSrc = (useTs = gulpConfig.get('typescript.enabled')) => useTs ? gulpConfig.get('browser.from') : gulpConfig.get('dist.from');
|
|
18
18
|
exports.distForSrc = distForSrc;
|
|
@@ -1,17 +1,17 @@
|
|
|
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.distSeries = void 0;
|
|
8
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
-
var _distFor = require("./distFor.js");
|
|
10
|
-
var _distForSrc = require("./distForSrc.js");
|
|
11
|
-
var _gulp = require("gulp");
|
|
12
|
-
var _tsFor = require("./tsFor.js");
|
|
13
|
-
var cache;
|
|
14
|
-
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; }
|
|
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.distSeries = void 0;
|
|
8
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
9
|
+
var _distFor = require("./distFor.js");
|
|
10
|
+
var _distForSrc = require("./distForSrc.js");
|
|
11
|
+
var _gulp = require("gulp");
|
|
12
|
+
var _tsFor = require("./tsFor.js");
|
|
13
|
+
var cache;
|
|
14
|
+
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; }
|
|
15
15
|
/**
|
|
16
16
|
* When using TypeScript, ensure that we process the ts first then run babel (dist)
|
|
17
17
|
* @memberOf module:partials
|
|
@@ -19,10 +19,10 @@ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e;
|
|
|
19
19
|
* @param {string} [distFinalPath='dist/config/path']
|
|
20
20
|
* @param {string} [tsSearch='ts/search/config/path']
|
|
21
21
|
* @returns {function(null=): stream.Stream}
|
|
22
|
-
*/
|
|
23
|
-
const distSeries = (srcPath = (0, _distForSrc.distForSrc)(), distFinalPath = gulpConfig.get('dist.to'), tsSearch = gulpConfig.get('typescript.from')) => {
|
|
24
|
-
const typescript = (0, _tsFor.tsFor)(tsSearch, distFinalPath);
|
|
25
|
-
const dist = () => (0, _distFor.distFor)(srcPath, distFinalPath);
|
|
26
|
-
return gulpConfig.get('typescript.enabled') ? (0, _gulp.series)(typescript, dist) : dist;
|
|
27
|
-
};
|
|
22
|
+
*/
|
|
23
|
+
const distSeries = (srcPath = (0, _distForSrc.distForSrc)(), distFinalPath = gulpConfig.get('dist.to'), tsSearch = gulpConfig.get('typescript.from')) => {
|
|
24
|
+
const typescript = (0, _tsFor.tsFor)(tsSearch, distFinalPath);
|
|
25
|
+
const dist = () => (0, _distFor.distFor)(srcPath, distFinalPath);
|
|
26
|
+
return gulpConfig.get('typescript.enabled') ? (0, _gulp.series)(typescript, dist) : dist;
|
|
27
|
+
};
|
|
28
28
|
exports.distSeries = distSeries;
|
|
@@ -1,20 +1,20 @@
|
|
|
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.loadImagemin = exports.imagesFor = void 0;
|
|
8
|
-
var _gulpCache = _interopRequireDefault(require("gulp-cache"));
|
|
9
|
-
var _loadPeer = require("./loadPeer.js");
|
|
10
|
-
var _gulp = require("gulp");
|
|
11
|
-
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
12
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
13
|
-
var cache;
|
|
14
|
-
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; }
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
const installHint = 'Add it to your project with: npm install --save-dev github:jheagle/gulp-imagemin#common-js-compatibility ' + '(the CommonJS-compatible fork - upstream gulp-imagemin is ESM-only and cannot be require()d by this package\'s CommonJS build).';
|
|
17
|
-
|
|
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.loadImagemin = exports.imagesFor = void 0;
|
|
8
|
+
var _gulpCache = _interopRequireDefault(require("gulp-cache"));
|
|
9
|
+
var _loadPeer = require("./loadPeer.js");
|
|
10
|
+
var _gulp = require("gulp");
|
|
11
|
+
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
12
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
13
|
+
var cache;
|
|
14
|
+
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; }
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
const installHint = 'Add it to your project with: npm install --save-dev github:jheagle/gulp-imagemin#common-js-compatibility ' + '(the CommonJS-compatible fork - upstream gulp-imagemin is ESM-only and cannot be require()d by this package\'s CommonJS build).';
|
|
17
|
+
|
|
18
18
|
/**
|
|
19
19
|
* Load `gulp-imagemin`, an optional peer dependency: image optimization is off by default and its binary-download
|
|
20
20
|
* dependency chain is heavy, so it is only required once the images task actually runs, and it is resolved from the
|
|
@@ -23,36 +23,36 @@ const installHint = 'Add it to your project with: npm install --save-dev github:
|
|
|
23
23
|
* @param {string} [projectPath=process.cwd()] - The project directory to resolve `gulp-imagemin` from.
|
|
24
24
|
* @returns {Function} The gulp-imagemin plugin factory.
|
|
25
25
|
* @throws {Error} With install instructions when gulp-imagemin is missing or is the ESM-only upstream release.
|
|
26
|
-
*/
|
|
27
|
-
const loadImagemin = (projectPath = process.cwd()) => {
|
|
28
|
-
const loaded = (0, _loadPeer.requirePeer)('gulp-imagemin', {
|
|
29
|
-
task: 'images',
|
|
30
|
-
installHint,
|
|
31
|
-
esmOnlyMessage: `gulp-imagemin could not be loaded because it is ESM-only. ${installHint}`,
|
|
32
|
-
projectPath
|
|
33
|
-
});
|
|
34
|
-
return loaded && (loaded.__esModule || loaded.default) ? loaded.default : loaded;
|
|
35
|
-
};
|
|
36
|
-
|
|
26
|
+
*/
|
|
27
|
+
const loadImagemin = (projectPath = process.cwd()) => {
|
|
28
|
+
const loaded = (0, _loadPeer.requirePeer)('gulp-imagemin', {
|
|
29
|
+
task: 'images',
|
|
30
|
+
installHint,
|
|
31
|
+
esmOnlyMessage: `gulp-imagemin could not be loaded because it is ESM-only. ${installHint}`,
|
|
32
|
+
projectPath
|
|
33
|
+
});
|
|
34
|
+
return loaded && (loaded.__esModule || loaded.default) ? loaded.default : loaded;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
37
|
/**
|
|
38
38
|
* Move and optimize images into the browser directory.
|
|
39
39
|
* @memberOf module:partials
|
|
40
40
|
* @param {string|array} [imageSrc=src/images/pattern]
|
|
41
41
|
* @param {string} [imageDest=dest/image/folder]
|
|
42
42
|
* @return {stream.Stream}
|
|
43
|
-
*/
|
|
44
|
-
exports.loadImagemin = loadImagemin;
|
|
45
|
-
const imagesFor = (imageSrc = gulpConfig.get('images.from'), imageDest = gulpConfig.get('images.to')) => {
|
|
46
|
-
const imagemin = loadImagemin();
|
|
47
|
-
// Gulp 5 reads files as utf8 text unless told otherwise, which corrupts binary images (and makes gulp-cache drop them).
|
|
48
|
-
return (0, _gulp.src)(imageSrc, {
|
|
49
|
-
encoding: false
|
|
50
|
-
}).pipe(
|
|
51
|
-
// Caching images that ran through imagemin
|
|
52
|
-
(0, _gulpCache.default)(imagemin({
|
|
53
|
-
interlaced: true,
|
|
54
|
-
silent: true,
|
|
55
|
-
verbose: false
|
|
56
|
-
}))).pipe((0, _gulp.dest)(imageDest));
|
|
57
|
-
};
|
|
43
|
+
*/
|
|
44
|
+
exports.loadImagemin = loadImagemin;
|
|
45
|
+
const imagesFor = (imageSrc = gulpConfig.get('images.from'), imageDest = gulpConfig.get('images.to')) => {
|
|
46
|
+
const imagemin = loadImagemin();
|
|
47
|
+
// Gulp 5 reads files as utf8 text unless told otherwise, which corrupts binary images (and makes gulp-cache drop them).
|
|
48
|
+
return (0, _gulp.src)(imageSrc, {
|
|
49
|
+
encoding: false
|
|
50
|
+
}).pipe(
|
|
51
|
+
// Caching images that ran through imagemin
|
|
52
|
+
(0, _gulpCache.default)(imagemin({
|
|
53
|
+
interlaced: true,
|
|
54
|
+
silent: true,
|
|
55
|
+
verbose: false
|
|
56
|
+
}))).pipe((0, _gulp.dest)(imageDest));
|
|
57
|
+
};
|
|
58
58
|
exports.imagesFor = imagesFor;
|
|
@@ -0,0 +1,155 @@
|
|
|
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.resolveJsdocTheme = exports.resolveJsdocBin = exports.jsdocDocsFor = void 0;
|
|
8
|
+
require("core-js/modules/es.json.stringify.js");
|
|
9
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
10
|
+
require("core-js/modules/esnext.iterator.find.js");
|
|
11
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
12
|
+
var _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
13
|
+
var _nodeOs = _interopRequireDefault(require("node:os"));
|
|
14
|
+
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
15
|
+
var _nodeModule = require("node:module");
|
|
16
|
+
var _nodeChild_process = require("node:child_process");
|
|
17
|
+
var _nodeUtil = require("node:util");
|
|
18
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
19
|
+
var _removeDirectory = require("./removeDirectory.js");
|
|
20
|
+
var _jsdocBase = _interopRequireDefault(require("../../jsdoc.base.js"));
|
|
21
|
+
var cache;
|
|
22
|
+
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; }
|
|
23
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
+
// jsdoc.base.js is CommonJS (it's also required directly by consuming projects' own .jsdoc.conf.js, and by this
|
|
25
|
+
// project's own legacy htmldocs script) - Node's ESM loader imports a CJS module's module.exports as the default
|
|
26
|
+
// export directly, no createRequire/import.meta needed (import.meta.url tripped up this project's own Babel CJS
|
|
27
|
+
// transform, which Jest relies on to run .mjs test files - confirmed by removing it and nothing else changing).
|
|
28
|
+
|
|
29
|
+
const execFileAsync = (0, _nodeUtil.promisify)(_nodeChild_process.execFile);
|
|
30
|
+
const jsdocInstallHint = 'Install it in your project with: npm install --save-dev jsdoc';
|
|
31
|
+
const themeInstallHint = name => `Install it in your project with: npm install --save-dev ${name}`;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the installed directory of an optional peer dependency, from the project being built rather than from
|
|
35
|
+
* this package. Deliberately not requirePeer/importPeer's own `require(name + '/package.json')` approach - that
|
|
36
|
+
* breaks for any package whose own package.json restricts its exports map and does not expose that subpath
|
|
37
|
+
* (clean-jsdoc-theme does; confirmed live, not assumed - resolving its own package.json throws
|
|
38
|
+
* ERR_PACKAGE_PATH_NOT_EXPORTED in plain Node, and a differently-shaped MODULE_NOT_FOUND under Jest's own
|
|
39
|
+
* resolver, which still is not "not installed" either way). Walking Node's own real module-lookup directories
|
|
40
|
+
* (require.resolve.paths) and checking each on disk sidesteps the exports map entirely - this only ever reads
|
|
41
|
+
* whether `<dir>/<name>/package.json` exists, never asks the module system to resolve a restricted subpath.
|
|
42
|
+
* @memberOf module:partials
|
|
43
|
+
* @param {string} name - The package name.
|
|
44
|
+
* @param {Object} options
|
|
45
|
+
* @param {string} options.task
|
|
46
|
+
* @param {string} options.installHint
|
|
47
|
+
* @param {string} [options.projectPath=process.cwd()]
|
|
48
|
+
* @returns {string}
|
|
49
|
+
* @throws {Error} With install instructions when the package is not installed.
|
|
50
|
+
*/
|
|
51
|
+
const resolvePeerDir = (name, {
|
|
52
|
+
task,
|
|
53
|
+
installHint,
|
|
54
|
+
projectPath = process.cwd()
|
|
55
|
+
}) => {
|
|
56
|
+
const req = (0, _nodeModule.createRequire)(_nodePath.default.join(projectPath, 'package.json'));
|
|
57
|
+
const found = (req.resolve.paths(name) || []).map(dir => _nodePath.default.join(dir, name)).find(dir => _nodeFs.default.existsSync(_nodePath.default.join(dir, 'package.json')));
|
|
58
|
+
if (!found) {
|
|
59
|
+
throw new Error(`The ${task} task needs the optional peer dependency ${name}, which is not installed. ${installHint}`);
|
|
60
|
+
}
|
|
61
|
+
return found;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Resolve jsdoc's own CLI entry point. jsdoc has no stable programmatic Node API for generating HTML docs (unlike
|
|
66
|
+
* TypeDoc's Application.bootstrap()/convert()/generateDocs()) - gulp-jsdoc3, the established gulp wrapper, is
|
|
67
|
+
* stale, and its own README admits jsdoc does not support piped input in the first place, a real anti-pattern for
|
|
68
|
+
* this project's own gulp-stream conventions. Running its real CLI via child_process is the portable way in -
|
|
69
|
+
* confirmed via `npm view jsdoc bin`, which reports "jsdoc.js" at the package root.
|
|
70
|
+
* @memberOf module:partials
|
|
71
|
+
* @param {string} [projectPath=process.cwd()]
|
|
72
|
+
* @returns {string}
|
|
73
|
+
*/
|
|
74
|
+
const resolveJsdocBin = (projectPath = process.cwd()) => _nodePath.default.join(resolvePeerDir('jsdoc', {
|
|
75
|
+
task: 'docs',
|
|
76
|
+
installHint: jsdocInstallHint,
|
|
77
|
+
projectPath
|
|
78
|
+
}), 'jsdoc.js');
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Resolve a jsdoc theme package's own template directory, for jsdoc's own opts.template config key. Not
|
|
82
|
+
* necessarily the package's own root - clean-jsdoc-theme's own docs say to point opts.template at its `dist`
|
|
83
|
+
* subdirectory specifically, confirmed by reading its real README rather than assuming every theme follows the
|
|
84
|
+
* classic jsdoc template layout (a bare package root with its own tmpl/static folders) - clean-jsdoc-theme does
|
|
85
|
+
* not (it is a modern, self-contained, server-rendered theme with no such folders at its package root at all).
|
|
86
|
+
* @memberOf module:partials
|
|
87
|
+
* @param {string} name
|
|
88
|
+
* @param {string} [projectPath=process.cwd()]
|
|
89
|
+
* @returns {string}
|
|
90
|
+
*/
|
|
91
|
+
exports.resolveJsdocBin = resolveJsdocBin;
|
|
92
|
+
const resolveJsdocTheme = (name, projectPath = process.cwd()) => {
|
|
93
|
+
const packageDir = resolvePeerDir(name, {
|
|
94
|
+
task: 'docs',
|
|
95
|
+
installHint: themeInstallHint(name),
|
|
96
|
+
projectPath
|
|
97
|
+
});
|
|
98
|
+
return name === 'clean-jsdoc-theme' ? _nodePath.default.join(packageDir, 'dist') : packageDir;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Generate the HTML documentation of a plain-JavaScript project with jsdoc, using jsdoc.base.js's own shared
|
|
103
|
+
* config (plugins, includePattern/excludePattern) as the starting point rather than a parallel one - the same
|
|
104
|
+
* base a project's own .jsdoc.conf.js has always been able to extend, just with source.include and the output
|
|
105
|
+
* options generated here instead of hand-maintained per project. Configure this with 'docs.from', 'docs.to',
|
|
106
|
+
* 'docs.index', 'docs.theme' and 'docs.title'.
|
|
107
|
+
* @memberOf module:partials
|
|
108
|
+
* @param {string} [srcPath=gulpConfig.get('docs.from')] - The directory (or glob) holding the JS source.
|
|
109
|
+
* @param {string} [outPath=gulpConfig.get('docs.to')] - The directory the documentation is generated into (cleared first).
|
|
110
|
+
* @param {function(string, Array<string>): Promise<Object>} [runJsdoc] - Runs the jsdoc CLI, tests can inject a stand-in.
|
|
111
|
+
* @returns {Function} A gulp task, it accepts an optional callback and returns a promise.
|
|
112
|
+
*/
|
|
113
|
+
exports.resolveJsdocTheme = resolveJsdocTheme;
|
|
114
|
+
const jsdocDocsFor = (srcPath = gulpConfig.get('docs.from'), outPath = gulpConfig.get('docs.to'), runJsdoc = (bin, args) => execFileAsync(process.execPath, [bin, ...args])) => {
|
|
115
|
+
if (gulpConfig.get('docs.enabled') === false) {
|
|
116
|
+
return () => {};
|
|
117
|
+
}
|
|
118
|
+
return done => {
|
|
119
|
+
const generate = async () => {
|
|
120
|
+
const theme = gulpConfig.get('docs.theme') || 'clean-jsdoc-theme';
|
|
121
|
+
const themeDir = resolveJsdocTheme(theme);
|
|
122
|
+
const indexFile = gulpConfig.get('docs.index');
|
|
123
|
+
await (0, _removeDirectory.removeDirectory)(outPath);
|
|
124
|
+
const config = {
|
|
125
|
+
..._jsdocBase.default,
|
|
126
|
+
source: {
|
|
127
|
+
..._jsdocBase.default.source,
|
|
128
|
+
include: [_nodePath.default.resolve(srcPath)]
|
|
129
|
+
},
|
|
130
|
+
opts: {
|
|
131
|
+
destination: _nodePath.default.resolve(outPath),
|
|
132
|
+
// jsdoc does not recurse into source.include's own subdirectories by default - without this, only
|
|
133
|
+
// the top level of docs.from would ever be scanned. Confirmed from clean-jsdoc-theme's own README
|
|
134
|
+
// quick-start example, which sets this explicitly, not assumed from jsdoc's own classic defaults.
|
|
135
|
+
recurse: true,
|
|
136
|
+
template: themeDir,
|
|
137
|
+
...(indexFile && _nodeFs.default.existsSync(indexFile) ? {
|
|
138
|
+
readme: _nodePath.default.resolve(indexFile)
|
|
139
|
+
} : {})
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const workDir = _nodeFs.default.mkdtempSync(_nodePath.default.join(_nodeOs.default.tmpdir(), 'jsdocdocs-'));
|
|
143
|
+
try {
|
|
144
|
+
const configPath = _nodePath.default.join(workDir, 'jsdoc.conf.json');
|
|
145
|
+
_nodeFs.default.writeFileSync(configPath, JSON.stringify(config));
|
|
146
|
+
const bin = resolveJsdocBin();
|
|
147
|
+
await runJsdoc(bin, ['-c', configPath]);
|
|
148
|
+
} finally {
|
|
149
|
+
await (0, _removeDirectory.removeDirectory)(workDir);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
return typeof done === 'function' ? generate().then(() => done(), done) : generate();
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
exports.jsdocDocsFor = jsdocDocsFor;
|