js-build-tools 6.1.0 → 6.2.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.
Files changed (47) hide show
  1. package/README.md +89 -25
  2. package/dist/build.js +68 -63
  3. package/dist/build.min.js +1 -1
  4. package/dist/bundle.js +40 -40
  5. package/dist/bundleMinify.js +18 -18
  6. package/dist/copyFiles.js +47 -0
  7. package/dist/copyFiles.min.js +1 -0
  8. package/dist/copyFonts.js +13 -13
  9. package/dist/default.js +15 -15
  10. package/dist/distMinify.js +13 -13
  11. package/dist/jsdocDocs.js +15 -0
  12. package/dist/jsdocDocs.min.js +1 -0
  13. package/dist/partials/addToReadme.js +25 -25
  14. package/dist/partials/beginWatcher.js +13 -13
  15. package/dist/partials/clean.js +15 -15
  16. package/dist/partials/copyFor.js +10 -2
  17. package/dist/partials/distFor.js +22 -22
  18. package/dist/partials/distForSrc.js +12 -12
  19. package/dist/partials/distSeries.js +20 -20
  20. package/dist/partials/imagesFor.js +43 -43
  21. package/dist/partials/jsdocDocsFor.js +155 -0
  22. package/dist/partials/neostandardLint.js +121 -121
  23. package/dist/partials/readmeTemplate.js +15 -15
  24. package/dist/partials/runOnChange.js +29 -29
  25. package/dist/partials/sassFor.js +29 -29
  26. package/dist/partials/tsFor.js +71 -71
  27. package/dist/partials/typeDocsFor.js +203 -203
  28. package/dist/sourceLint.js +26 -26
  29. package/dist/test-helpers/neostandardLintWithRealNeostandard.js +49 -49
  30. package/dist/test-helpers/setUp.js +95 -95
  31. package/dist/testFull.js +20 -20
  32. package/dist/testHelpers.js +10 -10
  33. package/dist/testQuick.js +22 -22
  34. package/dist/utilities/dotNotate.js +48 -48
  35. package/dist/utilities/getBundleConfigs.js +28 -28
  36. package/dist/watchTest.js +16 -16
  37. package/functions/build.mjs +7 -2
  38. package/functions/build.test.mjs +50 -1
  39. package/functions/copyFiles.mjs +32 -0
  40. package/functions/copyFiles.test.mjs +78 -0
  41. package/functions/jsdocDocs.mjs +10 -0
  42. package/functions/partials/copyFor.mjs +4 -1
  43. package/functions/partials/jsdocDocsFor.mjs +132 -0
  44. package/functions/partials/jsdocDocsFor.test.mjs +101 -0
  45. package/gulp.config.mjs +28 -5
  46. package/gulpfile.base.mjs +2 -0
  47. package/package.json +11 -1
@@ -1,35 +1,35 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.neostandardLint = void 0;
7
- require("core-js/modules/esnext.iterator.constructor.js");
8
- require("core-js/modules/esnext.iterator.for-each.js");
9
- var _nodeFs = _interopRequireDefault(require("node:fs"));
10
- var _nodePath = _interopRequireDefault(require("node:path"));
11
- var _through = _interopRequireDefault(require("through2"));
12
- var _eslint = require("eslint");
13
- var _loadPeer = require("./loadPeer.js");
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- // neostandard (js-build-tools' chosen style - a maintained, TypeScript-aware successor to `standard`, see
16
- // https://github.com/neostandard/neostandard) ships ESM-only, see importModule for how it is imported.
17
- const importNeostandard = () => (0, _loadPeer.importModule)('neostandard');
18
-
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.neostandardLint = void 0;
7
+ require("core-js/modules/esnext.iterator.constructor.js");
8
+ require("core-js/modules/esnext.iterator.for-each.js");
9
+ var _nodeFs = _interopRequireDefault(require("node:fs"));
10
+ var _nodePath = _interopRequireDefault(require("node:path"));
11
+ var _through = _interopRequireDefault(require("through2"));
12
+ var _eslint = require("eslint");
13
+ var _loadPeer = require("./loadPeer.js");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ // neostandard (js-build-tools' chosen style - a maintained, TypeScript-aware successor to `standard`, see
16
+ // https://github.com/neostandard/neostandard) ships ESM-only, see importModule for how it is imported.
17
+ const importNeostandard = () => (0, _loadPeer.importModule)('neostandard');
18
+
19
19
  /**
20
20
  * Read the `env` a project already declared for Standard (the `standard` field in its package.json), so a project
21
21
  * migrating from `standard` keeps its globals (jest, browser, ...) without touching package.json.
22
22
  * @param {string} cwd
23
23
  * @returns {Array<string>}
24
- */
25
- const readEnv = cwd => {
26
- try {
27
- return JSON.parse(_nodeFs.default.readFileSync(_nodePath.default.join(cwd, 'package.json'), 'utf8')).standard?.env ?? [];
28
- } catch {
29
- return [];
30
- }
31
- };
32
-
24
+ */
25
+ const readEnv = cwd => {
26
+ try {
27
+ return JSON.parse(_nodeFs.default.readFileSync(_nodePath.default.join(cwd, 'package.json'), 'utf8')).standard?.env ?? [];
28
+ } catch {
29
+ return [];
30
+ }
31
+ };
32
+
33
33
  /**
34
34
  * Build an ESLint instance configured with neostandard, honoring the project's own package.json `standard.env`,
35
35
  * plus an optional layer of rule overrides (see gulp.config.mjs's `lint.rules`) for a rule that is wrong for this
@@ -43,55 +43,55 @@ const readEnv = cwd => {
43
43
  * @param {boolean} options.fix
44
44
  * @param {Object<string, *>} [options.rules={}]
45
45
  * @returns {Promise<import('eslint').ESLint>}
46
- */
47
- const buildEslint = async ({
48
- cwd,
49
- ts,
50
- fix,
51
- rules = {}
52
- }) => {
53
- const {
54
- neostandard,
55
- defaultFilePatterns
56
- } = await importNeostandard();
57
- const baseConfig = neostandard({
58
- ts,
59
- env: readEnv(cwd)
60
- });
61
- if (Object.keys(rules).length) {
62
- baseConfig.push({
63
- files: defaultFilePatterns.all,
64
- rules
65
- });
66
- }
67
- return new _eslint.ESLint({
68
- cwd,
69
- fix,
70
- overrideConfigFile: true,
71
- baseConfig
72
- });
73
- };
74
-
46
+ */
47
+ const buildEslint = async ({
48
+ cwd,
49
+ ts,
50
+ fix,
51
+ rules = {}
52
+ }) => {
53
+ const {
54
+ neostandard,
55
+ defaultFilePatterns
56
+ } = await importNeostandard();
57
+ const baseConfig = neostandard({
58
+ ts,
59
+ env: readEnv(cwd)
60
+ });
61
+ if (Object.keys(rules).length) {
62
+ baseConfig.push({
63
+ files: defaultFilePatterns.all,
64
+ rules
65
+ });
66
+ }
67
+ return new _eslint.ESLint({
68
+ cwd,
69
+ fix,
70
+ overrideConfigFile: true,
71
+ baseConfig
72
+ });
73
+ };
74
+
75
75
  /**
76
76
  * Print a file's lint messages, if it has any.
77
77
  * @memberOf module:partials
78
78
  * @param {import('vinyl')} file
79
79
  * @param {{messages: Array<{line: number, column: number, message: string}>, errorCount: number, warningCount: number}} result
80
80
  * @returns {undefined}
81
- */
82
- const printFileReport = (file, result) => {
83
- if (!result.messages.length) {
84
- return;
85
- }
86
- console.log(_nodePath.default.relative(file.cwd, file.path));
87
- result.messages.forEach(({
88
- line,
89
- column,
90
- message
91
- }) => console.log(`line ${line}:${column}\t${message}`));
92
- console.log(`✖ ${result.errorCount} error\t⚠ ${result.warningCount} warning\n`);
93
- };
94
-
81
+ */
82
+ const printFileReport = (file, result) => {
83
+ if (!result.messages.length) {
84
+ return;
85
+ }
86
+ console.log(_nodePath.default.relative(file.cwd, file.path));
87
+ result.messages.forEach(({
88
+ line,
89
+ column,
90
+ message
91
+ }) => console.log(`line ${line}:${column}\t${message}`));
92
+ console.log(`✖ ${result.errorCount} error\t⚠ ${result.warningCount} warning\n`);
93
+ };
94
+
95
95
  /**
96
96
  * Lint every file streaming through with neostandard and, unless `fix` is false, apply the automatic fixes to the
97
97
  * file's contents so a following `dest()` writes the fixed version. Remaining problems are printed along with a
@@ -109,55 +109,55 @@ const printFileReport = (file, result) => {
109
109
  * callers should never need to pass this - it exists so tests can supply a stand-in, since this project's
110
110
  * CommonJS-transform-based Jest setup cannot execute a real dynamic import() of neostandard (ESM-only).
111
111
  * @returns {import('stream').Transform}
112
- */
113
- const neostandardLint = ({
114
- fix = true,
115
- ts = false,
116
- rules = {}
117
- } = {}, loadEslint = buildEslint) => {
118
- const totals = {
119
- errors: 0,
120
- warnings: 0
121
- };
122
- let eslintPromise = null;
123
- return _through.default.obj(function (file, enc, callback) {
124
- if (file.isNull()) {
125
- callback(null, file);
126
- return;
127
- }
128
- if (file.isStream()) {
129
- callback(new Error('neostandardLint: streaming file contents are not supported.'));
130
- return;
131
- }
132
- if (!eslintPromise) {
133
- eslintPromise = loadEslint({
134
- cwd: file.cwd,
135
- ts,
136
- fix,
137
- rules
138
- });
139
- }
140
- eslintPromise.then(eslint => eslint.lintText(file.contents.toString(), {
141
- filePath: file.path
142
- })).then(results => {
143
- // No result at all means the file is ignored by the project's ESLint configuration.
144
- const [result] = results;
145
- if (result) {
146
- if (typeof result.output === 'string') {
147
- file.contents = Buffer.from(result.output);
148
- }
149
- totals.errors += result.errorCount;
150
- totals.warnings += result.warningCount;
151
- printFileReport(file, result);
152
- }
153
- callback(null, file);
154
- }, callback);
155
- }, function (callback) {
156
- console.log('neostandard linter results');
157
- console.log('======================================');
158
- console.log(`✖ Errors total: ${totals.errors}`);
159
- console.log(`⚠ Warnings total: ${totals.warnings}\n`);
160
- callback();
161
- });
162
- };
112
+ */
113
+ const neostandardLint = ({
114
+ fix = true,
115
+ ts = false,
116
+ rules = {}
117
+ } = {}, loadEslint = buildEslint) => {
118
+ const totals = {
119
+ errors: 0,
120
+ warnings: 0
121
+ };
122
+ let eslintPromise = null;
123
+ return _through.default.obj(function (file, enc, callback) {
124
+ if (file.isNull()) {
125
+ callback(null, file);
126
+ return;
127
+ }
128
+ if (file.isStream()) {
129
+ callback(new Error('neostandardLint: streaming file contents are not supported.'));
130
+ return;
131
+ }
132
+ if (!eslintPromise) {
133
+ eslintPromise = loadEslint({
134
+ cwd: file.cwd,
135
+ ts,
136
+ fix,
137
+ rules
138
+ });
139
+ }
140
+ eslintPromise.then(eslint => eslint.lintText(file.contents.toString(), {
141
+ filePath: file.path
142
+ })).then(results => {
143
+ // No result at all means the file is ignored by the project's ESLint configuration.
144
+ const [result] = results;
145
+ if (result) {
146
+ if (typeof result.output === 'string') {
147
+ file.contents = Buffer.from(result.output);
148
+ }
149
+ totals.errors += result.errorCount;
150
+ totals.warnings += result.warningCount;
151
+ printFileReport(file, result);
152
+ }
153
+ callback(null, file);
154
+ }, callback);
155
+ }, function (callback) {
156
+ console.log('neostandard linter results');
157
+ console.log('======================================');
158
+ console.log(`✖ Errors total: ${totals.errors}`);
159
+ console.log(`⚠ Warnings total: ${totals.warnings}\n`);
160
+ callback();
161
+ });
162
+ };
163
163
  exports.neostandardLint = neostandardLint;
@@ -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.readmeTemplate = void 0;
8
- var _gulp = require("gulp");
9
- var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
10
- var _gulpRename = _interopRequireDefault(require("gulp-rename"));
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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.readmeTemplate = void 0;
8
+ var _gulp = require("gulp");
9
+ var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
10
+ var _gulpRename = _interopRequireDefault(require("gulp-rename"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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
  * Copy a readme template into the README.md file.
16
16
  * @memberOf module:partials
17
17
  * @returns {*}
18
- */
19
- const readmeTemplate = () => (0, _gulp.src)(gulpConfig.get('readme.template')).pipe((0, _gulpRename.default)(gulpConfig.get('readme.file'))).pipe((0, _gulp.dest)(gulpConfig.get('readme.to')));
18
+ */
19
+ const readmeTemplate = () => (0, _gulp.src)(gulpConfig.get('readme.template')).pipe((0, _gulpRename.default)(gulpConfig.get('readme.file'))).pipe((0, _gulp.dest)(gulpConfig.get('readme.to')));
20
20
  exports.readmeTemplate = readmeTemplate;
@@ -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.runOnChange = void 0;
8
- var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
9
- var _bundle = require("../bundle.js");
10
- var _distSeries = require("./distSeries.js");
11
- var _gulp = require("gulp");
12
- var _testQuick = require("../testQuick.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.runOnChange = void 0;
8
+ var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
9
+ var _bundle = require("../bundle.js");
10
+ var _distSeries = require("./distSeries.js");
11
+ var _gulp = require("gulp");
12
+ var _testQuick = require("../testQuick.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
  * Run this function when the watched files are modified.
17
17
  * 1. Find the sub-folders within src path
@@ -36,11 +36,11 @@ function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e;
36
36
  * @memberOf module:partials
37
37
  * @param {string} path
38
38
  * @returns {stream.Stream}
39
- */
40
- const runOnChange = path => {
41
- const useTs = gulpConfig.get('typescript.enabled');
42
- const distPath = gulpConfig.get('dist.to');
43
- const srcPath = gulpConfig.get('srcPath');
39
+ */
40
+ const runOnChange = path => {
41
+ const useTs = gulpConfig.get('typescript.enabled');
42
+ const distPath = gulpConfig.get('dist.to');
43
+ const srcPath = gulpConfig.get('srcPath');
44
44
  /**
45
45
  * 1. The original path comes in from src and is a .ts
46
46
  * 2. Discover the outgoing dist path where that file should go
@@ -48,14 +48,14 @@ const runOnChange = path => {
48
48
  * 4. Take the original path, convert to full file path in dist
49
49
  * 5. Use the dist path found previously in #2
50
50
  * 6. Use the full dist path and the dist outgoing path in distFor
51
- */
52
- const pathRegex = new RegExp(`^${srcPath}(.*\\/)(.+)\\.(js|ts)$`, 'i');
53
- const distPathResult = path.replace(pathRegex, `${distPath}$1`);
54
- let distSrcPath = path;
55
- if (useTs) {
56
- distSrcPath = path.replace(pathRegex, `${distPath}$1$2.js`);
57
- }
58
- const runSeries = (0, _distSeries.distSeries)(distSrcPath, distPathResult, path);
59
- return gulpConfig.get('browser.enabled') ? (0, _gulp.parallel)(_testQuick.testQuick, (0, _gulp.series)(runSeries, _bundle.bundle))() : (0, _gulp.series)(_testQuick.testQuick, runSeries)();
60
- };
51
+ */
52
+ const pathRegex = new RegExp(`^${srcPath}(.*\\/)(.+)\\.(js|ts)$`, 'i');
53
+ const distPathResult = path.replace(pathRegex, `${distPath}$1`);
54
+ let distSrcPath = path;
55
+ if (useTs) {
56
+ distSrcPath = path.replace(pathRegex, `${distPath}$1$2.js`);
57
+ }
58
+ const runSeries = (0, _distSeries.distSeries)(distSrcPath, distPathResult, path);
59
+ return gulpConfig.get('browser.enabled') ? (0, _gulp.parallel)(_testQuick.testQuick, (0, _gulp.series)(runSeries, _bundle.bundle))() : (0, _gulp.series)(_testQuick.testQuick, runSeries)();
60
+ };
61
61
  exports.runOnChange = runOnChange;
@@ -1,36 +1,36 @@
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.sassFor = void 0;
8
- var _gulp = require("gulp");
9
- var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
10
- var _autoprefixer = _interopRequireDefault(require("autoprefixer"));
11
- var _cssnano = _interopRequireDefault(require("cssnano"));
12
- var _gulpPostcss = _interopRequireDefault(require("gulp-postcss"));
13
- var _gulpRename = _interopRequireDefault(require("gulp-rename"));
14
- var sass = _interopRequireWildcard(require("sass"));
15
- var _gulpSass = _interopRequireDefault(require("gulp-sass"));
16
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
- var cache;
18
- 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; }
19
- const runSass = (0, _gulpSass.default)(sass);
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.sassFor = void 0;
8
+ var _gulp = require("gulp");
9
+ var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
10
+ var _autoprefixer = _interopRequireDefault(require("autoprefixer"));
11
+ var _cssnano = _interopRequireDefault(require("cssnano"));
12
+ var _gulpPostcss = _interopRequireDefault(require("gulp-postcss"));
13
+ var _gulpRename = _interopRequireDefault(require("gulp-rename"));
14
+ var sass = _interopRequireWildcard(require("sass"));
15
+ var _gulpSass = _interopRequireDefault(require("gulp-sass"));
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
+ var cache;
18
+ 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; }
19
+ const runSass = (0, _gulpSass.default)(sass);
20
+
21
21
  /**
22
22
  * Build the CSS for a given source pattern.
23
23
  * @memberOf module:partials
24
24
  * @param {string|array} [srcSearch='src/config/path/sass/for']
25
25
  * @param {string} [cssPath='css/config/path']
26
26
  * @returns {stream.Stream}
27
- */
28
- const sassFor = (srcSearch = gulpConfig.get('sass.from'), cssPath = gulpConfig.get('sass.to')) => (0, _gulp.src)(srcSearch).pipe(runSass().on('error', runSass.logError)) // Passes it through a gulp-sass, log errors to console
29
- .pipe((0, _gulp.dest)(cssPath))
30
- // add: false - the old gulp-cssnano only ever removed obsolete vendor prefixes, never added any; keep that.
31
- .pipe((0, _gulpPostcss.default)([(0, _autoprefixer.default)({
32
- add: false
33
- }), (0, _cssnano.default)()])).pipe((0, _gulpRename.default)({
34
- extname: '.min.css'
35
- })).pipe((0, _gulp.dest)(cssPath));
27
+ */
28
+ const sassFor = (srcSearch = gulpConfig.get('sass.from'), cssPath = gulpConfig.get('sass.to')) => (0, _gulp.src)(srcSearch).pipe(runSass().on('error', runSass.logError)) // Passes it through a gulp-sass, log errors to console
29
+ .pipe((0, _gulp.dest)(cssPath))
30
+ // add: false - the old gulp-cssnano only ever removed obsolete vendor prefixes, never added any; keep that.
31
+ .pipe((0, _gulpPostcss.default)([(0, _autoprefixer.default)({
32
+ add: false
33
+ }), (0, _cssnano.default)()])).pipe((0, _gulpRename.default)({
34
+ extname: '.min.css'
35
+ })).pipe((0, _gulp.dest)(cssPath));
36
36
  exports.sassFor = sassFor;
@@ -1,28 +1,28 @@
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.tsFor = exports.loadTypescript = void 0;
8
- var _gulp = require("gulp");
9
- var _nodePath = _interopRequireDefault(require("node:path"));
10
- var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
11
- var _loadPeer = require("./loadPeer.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
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- // gulp-ts-compile ships ESM-only (no CJS build - see its own package.json), see importModule for how it is imported.
16
- const importGulpTsCompile = () => (0, _loadPeer.importModule)('gulp-ts-compile');
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.tsFor = exports.loadTypescript = void 0;
8
+ var _gulp = require("gulp");
9
+ var _nodePath = _interopRequireDefault(require("node:path"));
10
+ var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
11
+ var _loadPeer = require("./loadPeer.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
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ // gulp-ts-compile ships ESM-only (no CJS build - see its own package.json), see importModule for how it is imported.
16
+ const importGulpTsCompile = () => (0, _loadPeer.importModule)('gulp-ts-compile');
17
+
18
18
  /**
19
19
  * Wrap a stream in a promise that resolves once it finishes writing.
20
20
  * @memberOf module:partials
21
21
  * @param {import('node:stream').Stream} stream
22
22
  * @returns {Promise<void>}
23
- */
24
- const installHint = 'Install it in your project with: npm install --save-dev typescript';
25
-
23
+ */
24
+ const installHint = 'Install it in your project with: npm install --save-dev typescript';
25
+
26
26
  /**
27
27
  * Load the project's own copy of TypeScript (an optional peer dependency, only needed when the typescript task is
28
28
  * enabled) from the project being built, so projects which do not use TypeScript never need it installed.
@@ -30,18 +30,18 @@ const installHint = 'Install it in your project with: npm install --save-dev typ
30
30
  * @param {string} [projectPath=process.cwd()] The folder of the project (which has the package.json) being built.
31
31
  * @returns {Object} The TypeScript compiler API module.
32
32
  * @throws {Error} With install instructions when typescript is not installed.
33
- */
34
- const loadTypescript = (projectPath = process.cwd()) => (0, _loadPeer.requirePeer)('typescript', {
35
- task: 'typescript',
36
- installHint,
37
- projectPath
38
- });
39
- exports.loadTypescript = loadTypescript;
40
- const streamToPromise = stream => new Promise((resolve, reject) => {
41
- stream.on('finish', resolve);
42
- stream.on('error', reject);
43
- });
44
-
33
+ */
34
+ const loadTypescript = (projectPath = process.cwd()) => (0, _loadPeer.requirePeer)('typescript', {
35
+ task: 'typescript',
36
+ installHint,
37
+ projectPath
38
+ });
39
+ exports.loadTypescript = loadTypescript;
40
+ const streamToPromise = stream => new Promise((resolve, reject) => {
41
+ stream.on('finish', resolve);
42
+ stream.on('error', reject);
43
+ });
44
+
45
45
  /**
46
46
  * Read a tsconfig.json file into real typescript.CompilerOptions values, using only TypeScript's stable, current,
47
47
  * public config-reading API (the same one `tsc --project` itself uses internally) - never
@@ -50,13 +50,13 @@ const streamToPromise = stream => new Promise((resolve, reject) => {
50
50
  * @memberOf module:partials
51
51
  * @param {string} configPath - Path to a tsconfig.json file.
52
52
  * @returns {import('typescript').CompilerOptions}
53
- */
54
- const readCompilerOptions = (ts, configPath) => {
55
- const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
56
- const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, _nodePath.default.dirname(configPath));
57
- return parsedConfig.options;
58
- };
59
-
53
+ */
54
+ const readCompilerOptions = (ts, configPath) => {
55
+ const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
56
+ const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, _nodePath.default.dirname(configPath));
57
+ return parsedConfig.options;
58
+ };
59
+
60
60
  /**
61
61
  * Starting at the source directory, find all the ts files and convert them into the distribution directory.
62
62
  * @memberOf module:partials
@@ -69,36 +69,36 @@ const readCompilerOptions = (ts, configPath) => {
69
69
  * suite already covers real TypeScript-compile correctness - this function's own tests only need to verify its
70
70
  * config resolution and stream wiring.
71
71
  * @returns {Function}
72
- */
73
- const tsFor = (srcPath = gulpConfig.get('typescript.from'), distPath = gulpConfig.get('typescript.to'), loadTsCompile = () => importGulpTsCompile().then(({
74
- default: tsCompile
75
- }) => tsCompile)) => {
76
- if (gulpConfig.get('typescript.enabled') === false) {
77
- return () => {};
78
- }
79
- const ts = loadTypescript();
80
- const configPath = gulpConfig.get('typescript.config');
81
- // When no tsconfig.json is configured, target/module are pinned explicitly rather than left for TypeScript's
82
- // own compiler defaults - those defaults have already shifted once across a TypeScript version bump in this
83
- // project's own history (silently changing whether output keeps `const`/`let` or downlevels to `var`), and
84
- // pinning them keeps this task's output stable across future TypeScript upgrades too. ES5/CommonJS matches
85
- // what the downstream babel/browserify bundling pipeline has always assumed it receives.
86
- const compilerOptions = configPath ? readCompilerOptions(ts, configPath) : {
87
- declaration: true,
88
- target: ts.ScriptTarget.ES5,
89
- module: ts.ModuleKind.CommonJS,
90
- esModuleInterop: false
91
- };
92
- // Accepts gulp's own callback-style task convention (an optional `done`, called once finished) rather than
93
- // just returning a Promise, since callers may invoke the returned function directly with a callback instead
94
- // of relying on gulp's own runner to observe a returned Promise.
95
- return done => {
96
- const compile = async () => {
97
- const tsCompile = await loadTsCompile();
98
- const tsResult = (0, _gulp.src)(srcPath).pipe(tsCompile(compilerOptions));
99
- await Promise.all([streamToPromise(tsResult.dts.pipe((0, _gulp.dest)(distPath))), streamToPromise(tsResult.js.pipe((0, _gulp.dest)(distPath)))]);
100
- };
101
- return typeof done === 'function' ? compile().then(() => done(), done) : compile();
102
- };
103
- };
72
+ */
73
+ const tsFor = (srcPath = gulpConfig.get('typescript.from'), distPath = gulpConfig.get('typescript.to'), loadTsCompile = () => importGulpTsCompile().then(({
74
+ default: tsCompile
75
+ }) => tsCompile)) => {
76
+ if (gulpConfig.get('typescript.enabled') === false) {
77
+ return () => {};
78
+ }
79
+ const ts = loadTypescript();
80
+ const configPath = gulpConfig.get('typescript.config');
81
+ // When no tsconfig.json is configured, target/module are pinned explicitly rather than left for TypeScript's
82
+ // own compiler defaults - those defaults have already shifted once across a TypeScript version bump in this
83
+ // project's own history (silently changing whether output keeps `const`/`let` or downlevels to `var`), and
84
+ // pinning them keeps this task's output stable across future TypeScript upgrades too. ES5/CommonJS matches
85
+ // what the downstream babel/browserify bundling pipeline has always assumed it receives.
86
+ const compilerOptions = configPath ? readCompilerOptions(ts, configPath) : {
87
+ declaration: true,
88
+ target: ts.ScriptTarget.ES5,
89
+ module: ts.ModuleKind.CommonJS,
90
+ esModuleInterop: false
91
+ };
92
+ // Accepts gulp's own callback-style task convention (an optional `done`, called once finished) rather than
93
+ // just returning a Promise, since callers may invoke the returned function directly with a callback instead
94
+ // of relying on gulp's own runner to observe a returned Promise.
95
+ return done => {
96
+ const compile = async () => {
97
+ const tsCompile = await loadTsCompile();
98
+ const tsResult = (0, _gulp.src)(srcPath).pipe(tsCompile(compilerOptions));
99
+ await Promise.all([streamToPromise(tsResult.dts.pipe((0, _gulp.dest)(distPath))), streamToPromise(tsResult.js.pipe((0, _gulp.dest)(distPath)))]);
100
+ };
101
+ return typeof done === 'function' ? compile().then(() => done(), done) : compile();
102
+ };
103
+ };
104
104
  exports.tsFor = tsFor;