js-build-tools 4.1.0 → 5.0.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 +274 -267
- package/dist/build.js +58 -56
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +16 -16
- package/dist/bundleLint.js +16 -20
- package/dist/bundleLint.min.js +1 -1
- package/dist/bundleMinify.js +13 -13
- package/dist/compileReadme.js +10 -10
- package/dist/copyFonts.js +13 -13
- package/dist/default.js +15 -15
- package/dist/dist.js +10 -10
- package/dist/distLint.js +16 -20
- package/dist/distLint.min.js +1 -1
- package/dist/distMinify.js +13 -13
- package/dist/images.js +10 -10
- package/dist/partials/copyFor.js +12 -9
- package/dist/partials/imagesFor.js +56 -21
- package/dist/partials/removeDirectory.js +37 -13
- package/dist/partials/sassFor.js +8 -2
- package/dist/partials/standardLint.js +96 -0
- package/dist/partials/tsFor.js +67 -59
- package/dist/partials.js +110 -103
- package/dist/partials.min.js +1 -1
- package/dist/sass.js +10 -10
- package/dist/test-helpers/standardLintWithRealStandard.js +28 -0
- package/dist/testFull.js +20 -21
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +10 -10
- package/dist/testQuick.js +22 -23
- package/dist/testQuick.min.js +1 -1
- package/dist/typeScript.js +9 -9
- package/dist/watchFull.js +10 -10
- package/dist/watchTest.js +16 -16
- package/functions/build.mjs +6 -3
- package/functions/build.test.mjs +31 -0
- package/functions/bundleLint.mjs +2 -6
- package/functions/bundleLint.test.mjs +3 -0
- package/functions/distLint.mjs +2 -6
- package/functions/distLint.test.mjs +3 -0
- package/functions/partials/copyFor.mjs +2 -1
- package/functions/partials/copyFor.test.mjs +18 -0
- package/functions/partials/imagesFor.mjs +35 -3
- package/functions/partials/imagesFor.test.mjs +83 -1
- package/functions/partials/removeDirectory.mjs +28 -14
- package/functions/partials/removeDirectory.test.mjs +44 -0
- package/functions/partials/sassFor.mjs +5 -2
- package/functions/partials/sassFor.test.mjs +22 -4
- package/functions/partials/standardLint.mjs +80 -0
- package/functions/partials/standardLint.test.mjs +99 -0
- package/functions/partials/tsFor.mjs +8 -1
- package/functions/partials.mjs +1 -0
- package/functions/partials.test.mjs +1 -1
- package/functions/test-helpers/standardLintWithRealStandard.mjs +21 -0
- package/functions/testFull.mjs +2 -2
- package/functions/testFull.test.mjs +2 -2
- package/functions/testQuick.mjs +2 -2
- package/functions/testQuick.test.mjs +2 -2
- package/package.json +19 -8
|
@@ -1,17 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.removeDirectory = void 0;
|
|
7
|
-
var
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.removeDirectory = void 0;
|
|
7
|
+
var _promises = require("node:fs/promises");
|
|
8
|
+
var _promises2 = require("node:timers/promises");
|
|
9
|
+
const attempts = 4;
|
|
10
|
+
const exists = dirPath => (0, _promises.access)(dirPath).then(() => true, () => false);
|
|
11
|
+
|
|
8
12
|
/**
|
|
9
|
-
*
|
|
13
|
+
* Delete a directory and everything in it, resolving only once it is really gone.
|
|
14
|
+
*
|
|
15
|
+
* A single rm can leave a directory behind - most often when something is still writing into it (a build task, a
|
|
16
|
+
* watcher, a dev server) or has it briefly locked (EBUSY/EPERM/ENOTEMPTY) - which silently leaves stale output for
|
|
17
|
+
* the next build. So: Node's own retry-with-back-off handles the transient errors, then the directory is checked and
|
|
18
|
+
* removed again if it was recreated, and a clear error is raised rather than carrying on with stale output.
|
|
10
19
|
* @memberOf module:partials
|
|
11
20
|
* @param {string} dirPath
|
|
12
|
-
* @returns {Promise
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
* @returns {Promise<string>} Resolves with dirPath once the directory no longer exists (or already didn't).
|
|
22
|
+
* @throws {Error} If the directory still exists after several attempts.
|
|
23
|
+
*/
|
|
24
|
+
const removeDirectory = async dirPath => {
|
|
25
|
+
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
26
|
+
await (0, _promises.rm)(dirPath, {
|
|
27
|
+
recursive: true,
|
|
28
|
+
force: true,
|
|
29
|
+
maxRetries: 5,
|
|
30
|
+
retryDelay: 100
|
|
31
|
+
});
|
|
32
|
+
if (!(await exists(dirPath))) {
|
|
33
|
+
return dirPath;
|
|
34
|
+
}
|
|
35
|
+
if (attempt < attempts) {
|
|
36
|
+
await (0, _promises2.setTimeout)(200 * attempt);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Unable to remove "${dirPath}" - it was recreated or is locked. Stop anything that has it open or is writing ` + 'into it (watchers, dev servers, editors, other build tasks) and try again.');
|
|
40
|
+
};
|
|
17
41
|
exports.removeDirectory = removeDirectory;
|
package/dist/partials/sassFor.js
CHANGED
|
@@ -7,7 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.sassFor = void 0;
|
|
8
8
|
var _gulp = require("gulp");
|
|
9
9
|
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
10
|
-
var
|
|
10
|
+
var _autoprefixer = _interopRequireDefault(require("autoprefixer"));
|
|
11
|
+
var _cssnano = _interopRequireDefault(require("cssnano"));
|
|
12
|
+
var _gulpPostcss = _interopRequireDefault(require("gulp-postcss"));
|
|
11
13
|
var _gulpRename = _interopRequireDefault(require("gulp-rename"));
|
|
12
14
|
var sass = _interopRequireWildcard(require("sass"));
|
|
13
15
|
var _gulpSass = _interopRequireDefault(require("gulp-sass"));
|
|
@@ -23,7 +25,11 @@ const runSass = (0, _gulpSass.default)(sass);
|
|
|
23
25
|
* @returns {stream.Stream}
|
|
24
26
|
*/
|
|
25
27
|
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
|
|
26
|
-
.pipe((0, _gulp.dest)(cssPath))
|
|
28
|
+
.pipe((0, _gulp.dest)(cssPath))
|
|
29
|
+
// add: false - the old gulp-cssnano only ever removed obsolete vendor prefixes, never added any; keep that.
|
|
30
|
+
.pipe((0, _gulpPostcss.default)([(0, _autoprefixer.default)({
|
|
31
|
+
add: false
|
|
32
|
+
}), (0, _cssnano.default)()])).pipe((0, _gulpRename.default)({
|
|
27
33
|
extname: '.min.css'
|
|
28
34
|
})).pipe((0, _gulp.dest)(cssPath));
|
|
29
35
|
exports.sassFor = sassFor;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.standardLint = void 0;
|
|
7
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
9
|
+
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
10
|
+
var _through = _interopRequireDefault(require("through2"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
// `standard` (17+) ships ESM-only, but this package also publishes a CommonJS build (dist/*.js) whose babel
|
|
13
|
+
// transform would turn even a dynamic import() into a require() that cannot load an ES module. Hiding the import()
|
|
14
|
+
// inside a Function constructor keeps it a genuine dynamic import that works from either build (same escape hatch
|
|
15
|
+
// as tsFor.mjs uses for gulp-ts-compile).
|
|
16
|
+
const importStandard = new Function('return import(\'standard\')');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Print a file's lint messages, if it has any.
|
|
20
|
+
* @memberOf module:partials
|
|
21
|
+
* @param {import('vinyl')} file
|
|
22
|
+
* @param {{messages: Array<{line: number, column: number, message: string}>, errorCount: number, warningCount: number}} result
|
|
23
|
+
* @returns {undefined}
|
|
24
|
+
*/
|
|
25
|
+
const printFileReport = (file, result) => {
|
|
26
|
+
if (!result.messages.length) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
console.log(_nodePath.default.relative(file.cwd, file.path));
|
|
30
|
+
result.messages.forEach(({
|
|
31
|
+
line,
|
|
32
|
+
column,
|
|
33
|
+
message
|
|
34
|
+
}) => console.log(`line ${line}:${column}\t${message}`));
|
|
35
|
+
console.log(`✖ ${result.errorCount} error\t⚠ ${result.warningCount} warning\n`);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Lint every file streaming through with JavaScript Standard Style and, unless `fix` is false, apply the automatic
|
|
40
|
+
* fixes to the file's contents so a following `dest()` writes the fixed version. Remaining problems are printed
|
|
41
|
+
* along with a summary once the stream ends; they never fail the build.
|
|
42
|
+
*
|
|
43
|
+
* Project-level Standard configuration (the `standard` field in package.json: ignore, env, globals, ...) is honored
|
|
44
|
+
* because the file's own path and cwd are handed to Standard.
|
|
45
|
+
* @memberOf module:partials
|
|
46
|
+
* @param {Object} [options={}]
|
|
47
|
+
* @param {boolean} [options.fix=true] - Apply Standard's automatic fixes to the file contents.
|
|
48
|
+
* @param {function(): Promise<{lintText: Function}>} [loadStandard] - Resolves the `standard` module. Real callers
|
|
49
|
+
* should never need to pass this - it exists so tests can supply a stand-in, since this project's
|
|
50
|
+
* CommonJS-transform-based Jest setup cannot execute a real dynamic import() of an ES module.
|
|
51
|
+
* @returns {import('stream').Transform}
|
|
52
|
+
*/
|
|
53
|
+
const standardLint = ({
|
|
54
|
+
fix = true
|
|
55
|
+
} = {}, loadStandard = () => importStandard().then(({
|
|
56
|
+
default: standard
|
|
57
|
+
}) => standard)) => {
|
|
58
|
+
const totals = {
|
|
59
|
+
errors: 0,
|
|
60
|
+
warnings: 0
|
|
61
|
+
};
|
|
62
|
+
return _through.default.obj(function (file, enc, callback) {
|
|
63
|
+
if (file.isNull()) {
|
|
64
|
+
callback(null, file);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (file.isStream()) {
|
|
68
|
+
callback(new Error('standardLint: streaming file contents are not supported.'));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
loadStandard().then(standard => standard.lintText(file.contents.toString(), {
|
|
72
|
+
filename: file.path,
|
|
73
|
+
cwd: file.cwd,
|
|
74
|
+
fix
|
|
75
|
+
})).then(results => {
|
|
76
|
+
// No result at all means the file is ignored by the project's Standard configuration.
|
|
77
|
+
const [result] = results;
|
|
78
|
+
if (result) {
|
|
79
|
+
if (typeof result.output === 'string') {
|
|
80
|
+
file.contents = Buffer.from(result.output);
|
|
81
|
+
}
|
|
82
|
+
totals.errors += result.errorCount;
|
|
83
|
+
totals.warnings += result.warningCount;
|
|
84
|
+
printFileReport(file, result);
|
|
85
|
+
}
|
|
86
|
+
callback(null, file);
|
|
87
|
+
}, callback);
|
|
88
|
+
}, function (callback) {
|
|
89
|
+
console.log('Standard linter results');
|
|
90
|
+
console.log('======================================');
|
|
91
|
+
console.log(`✖ Errors total: ${totals.errors}`);
|
|
92
|
+
console.log(`⚠ Warnings total: ${totals.warnings}\n`);
|
|
93
|
+
callback();
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
exports.standardLint = standardLint;
|
package/dist/partials/tsFor.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
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 = void 0;
|
|
8
|
-
var _gulp = require("gulp");
|
|
9
|
-
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
10
|
-
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
11
|
-
var _typescript = _interopRequireDefault(require("typescript"));
|
|
12
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
// gulp-ts-compile ships ESM-only (no CJS build - see its own package.json) since it's meant to be consumed by
|
|
15
|
-
// gulpfiles running under a real ESM loader, same as this project's own gulpfile.mjs does. This project also
|
|
16
|
-
// compiles itself to a CommonJS build (dist/*.js, this file's own compiled counterpart) for consumers using
|
|
17
|
-
// require() though, and even a dynamic `import()` gets downleveled by babel's CommonJS transform into a
|
|
18
|
-
// require() call - which can't load a real ES module. Hiding the import() call inside a Function constructor is
|
|
19
|
-
// the standard escape hatch: babel can't see (and so can't rewrite) an import expression that only exists as a
|
|
20
|
-
// runtime-evaluated string, so it survives as a genuine dynamic import, capable of loading gulp-ts-compile from
|
|
21
|
-
// either build.
|
|
22
|
-
const importGulpTsCompile = new Function('return import(\'gulp-ts-compile\')');
|
|
23
|
-
|
|
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 = void 0;
|
|
8
|
+
var _gulp = require("gulp");
|
|
9
|
+
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
10
|
+
var gulpConfig = _interopRequireWildcard(require("../../gulp.config.js"));
|
|
11
|
+
var _typescript = _interopRequireDefault(require("typescript"));
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
// gulp-ts-compile ships ESM-only (no CJS build - see its own package.json) since it's meant to be consumed by
|
|
15
|
+
// gulpfiles running under a real ESM loader, same as this project's own gulpfile.mjs does. This project also
|
|
16
|
+
// compiles itself to a CommonJS build (dist/*.js, this file's own compiled counterpart) for consumers using
|
|
17
|
+
// require() though, and even a dynamic `import()` gets downleveled by babel's CommonJS transform into a
|
|
18
|
+
// require() call - which can't load a real ES module. Hiding the import() call inside a Function constructor is
|
|
19
|
+
// the standard escape hatch: babel can't see (and so can't rewrite) an import expression that only exists as a
|
|
20
|
+
// runtime-evaluated string, so it survives as a genuine dynamic import, capable of loading gulp-ts-compile from
|
|
21
|
+
// either build.
|
|
22
|
+
const importGulpTsCompile = new Function('return import(\'gulp-ts-compile\')');
|
|
23
|
+
|
|
24
24
|
/**
|
|
25
25
|
* Wrap a stream in a promise that resolves once it finishes writing.
|
|
26
26
|
* @memberOf module:partials
|
|
27
27
|
* @param {import('node:stream').Stream} stream
|
|
28
28
|
* @returns {Promise<void>}
|
|
29
|
-
*/
|
|
30
|
-
const streamToPromise = stream => new Promise((resolve, reject) => {
|
|
31
|
-
stream.on('finish', resolve);
|
|
32
|
-
stream.on('error', reject);
|
|
33
|
-
});
|
|
34
|
-
|
|
29
|
+
*/
|
|
30
|
+
const streamToPromise = stream => new Promise((resolve, reject) => {
|
|
31
|
+
stream.on('finish', resolve);
|
|
32
|
+
stream.on('error', reject);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
35
|
/**
|
|
36
36
|
* Read a tsconfig.json file into real typescript.CompilerOptions values, using only TypeScript's stable, current,
|
|
37
37
|
* public config-reading API (the same one `tsc --project` itself uses internally) - never
|
|
@@ -40,13 +40,13 @@ const streamToPromise = stream => new Promise((resolve, reject) => {
|
|
|
40
40
|
* @memberOf module:partials
|
|
41
41
|
* @param {string} configPath - Path to a tsconfig.json file.
|
|
42
42
|
* @returns {import('typescript').CompilerOptions}
|
|
43
|
-
*/
|
|
44
|
-
const readCompilerOptions = configPath => {
|
|
45
|
-
const configFile = _typescript.default.readConfigFile(configPath, _typescript.default.sys.readFile);
|
|
46
|
-
const parsedConfig = _typescript.default.parseJsonConfigFileContent(configFile.config, _typescript.default.sys, _nodePath.default.dirname(configPath));
|
|
47
|
-
return parsedConfig.options;
|
|
48
|
-
};
|
|
49
|
-
|
|
43
|
+
*/
|
|
44
|
+
const readCompilerOptions = configPath => {
|
|
45
|
+
const configFile = _typescript.default.readConfigFile(configPath, _typescript.default.sys.readFile);
|
|
46
|
+
const parsedConfig = _typescript.default.parseJsonConfigFileContent(configFile.config, _typescript.default.sys, _nodePath.default.dirname(configPath));
|
|
47
|
+
return parsedConfig.options;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
50
|
/**
|
|
51
51
|
* Starting at the source directory, find all the ts files and convert them into the distribution directory.
|
|
52
52
|
* @memberOf module:partials
|
|
@@ -59,27 +59,35 @@ const readCompilerOptions = configPath => {
|
|
|
59
59
|
* suite already covers real TypeScript-compile correctness - this function's own tests only need to verify its
|
|
60
60
|
* config resolution and stream wiring.
|
|
61
61
|
* @returns {Function}
|
|
62
|
-
*/
|
|
63
|
-
const tsFor = (srcPath = gulpConfig.get('typescript.from'), distPath = gulpConfig.get('typescript.to'), loadTsCompile = () => importGulpTsCompile().then(({
|
|
64
|
-
default: tsCompile
|
|
65
|
-
}) => tsCompile)) => {
|
|
66
|
-
if (gulpConfig.get('typescript.enabled') === false) {
|
|
67
|
-
return () => {};
|
|
68
|
-
}
|
|
69
|
-
const configPath = gulpConfig.get('typescript.config');
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
62
|
+
*/
|
|
63
|
+
const tsFor = (srcPath = gulpConfig.get('typescript.from'), distPath = gulpConfig.get('typescript.to'), loadTsCompile = () => importGulpTsCompile().then(({
|
|
64
|
+
default: tsCompile
|
|
65
|
+
}) => tsCompile)) => {
|
|
66
|
+
if (gulpConfig.get('typescript.enabled') === false) {
|
|
67
|
+
return () => {};
|
|
68
|
+
}
|
|
69
|
+
const configPath = gulpConfig.get('typescript.config');
|
|
70
|
+
// When no tsconfig.json is configured, target/module are pinned explicitly rather than left for TypeScript's
|
|
71
|
+
// own compiler defaults - those defaults have already shifted once across a TypeScript version bump in this
|
|
72
|
+
// project's own history (silently changing whether output keeps `const`/`let` or downlevels to `var`), and
|
|
73
|
+
// pinning them keeps this task's output stable across future TypeScript upgrades too. ES5/CommonJS matches
|
|
74
|
+
// what the downstream babel/browserify bundling pipeline has always assumed it receives.
|
|
75
|
+
const compilerOptions = configPath ? readCompilerOptions(configPath) : {
|
|
76
|
+
declaration: true,
|
|
77
|
+
target: _typescript.default.ScriptTarget.ES5,
|
|
78
|
+
module: _typescript.default.ModuleKind.CommonJS,
|
|
79
|
+
esModuleInterop: false
|
|
80
|
+
};
|
|
81
|
+
// Accepts gulp's own callback-style task convention (an optional `done`, called once finished) rather than
|
|
82
|
+
// just returning a Promise, since callers may invoke the returned function directly with a callback instead
|
|
83
|
+
// of relying on gulp's own runner to observe a returned Promise.
|
|
84
|
+
return done => {
|
|
85
|
+
const compile = async () => {
|
|
86
|
+
const tsCompile = await loadTsCompile();
|
|
87
|
+
const tsResult = (0, _gulp.src)(srcPath).pipe(tsCompile(compilerOptions));
|
|
88
|
+
await Promise.all([streamToPromise(tsResult.dts.pipe((0, _gulp.dest)(distPath))), streamToPromise(tsResult.js.pipe((0, _gulp.dest)(distPath)))]);
|
|
89
|
+
};
|
|
90
|
+
return typeof done === 'function' ? compile().then(() => done(), done) : compile();
|
|
91
|
+
};
|
|
92
|
+
};
|
|
85
93
|
exports.tsFor = tsFor;
|
package/dist/partials.js
CHANGED
|
@@ -1,103 +1,110 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
Object.defineProperty(exports, 'addToReadme', {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _addToReadme.addToReadme
|
|
10
|
-
}
|
|
11
|
-
})
|
|
12
|
-
Object.defineProperty(exports, 'beginWatcher', {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _beginWatcher.beginWatcher
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
Object.defineProperty(exports, 'clean', {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _clean.clean
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
Object.defineProperty(exports, 'copyFor', {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _copyFor.copyFor
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
Object.defineProperty(exports, 'distFor', {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _distFor.distFor
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
Object.defineProperty(exports, 'distForSrc', {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _distForSrc.distForSrc
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
Object.defineProperty(exports, 'distSeries', {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _distSeries.distSeries
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
Object.defineProperty(exports, 'imagesFor', {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _imagesFor.imagesFor
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
Object.defineProperty(exports, 'minifyFor', {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _minifyFor.minifyFor
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
Object.defineProperty(exports, 'readmeTemplate', {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return _readmeTemplate.readmeTemplate
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
Object.defineProperty(exports, 'removeDirectory', {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () {
|
|
69
|
-
return _removeDirectory.removeDirectory
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
Object.defineProperty(exports, 'runOnChange', {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
get: function () {
|
|
75
|
-
return _runOnChange.runOnChange
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
Object.defineProperty(exports, 'sassFor', {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
get: function () {
|
|
81
|
-
return _sassFor.sassFor
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
Object.defineProperty(exports, '
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: function () {
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
var
|
|
97
|
-
var
|
|
98
|
-
var
|
|
99
|
-
var
|
|
100
|
-
var
|
|
101
|
-
var
|
|
102
|
-
var
|
|
103
|
-
var
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
Object.defineProperty(exports, 'addToReadme', {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _addToReadme.addToReadme
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
Object.defineProperty(exports, 'beginWatcher', {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _beginWatcher.beginWatcher
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
Object.defineProperty(exports, 'clean', {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _clean.clean
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
Object.defineProperty(exports, 'copyFor', {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _copyFor.copyFor
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
Object.defineProperty(exports, 'distFor', {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _distFor.distFor
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
Object.defineProperty(exports, 'distForSrc', {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _distForSrc.distForSrc
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
Object.defineProperty(exports, 'distSeries', {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _distSeries.distSeries
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
Object.defineProperty(exports, 'imagesFor', {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _imagesFor.imagesFor
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
Object.defineProperty(exports, 'minifyFor', {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _minifyFor.minifyFor
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
Object.defineProperty(exports, 'readmeTemplate', {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _readmeTemplate.readmeTemplate
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
Object.defineProperty(exports, 'removeDirectory', {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _removeDirectory.removeDirectory
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
Object.defineProperty(exports, 'runOnChange', {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _runOnChange.runOnChange
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
Object.defineProperty(exports, 'sassFor', {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _sassFor.sassFor
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
Object.defineProperty(exports, 'standardLint', {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _standardLint.standardLint
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
Object.defineProperty(exports, 'tsFor', {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _tsFor.tsFor
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
var _addToReadme = require('./partials/addToReadme.js')
|
|
97
|
+
var _beginWatcher = require('./partials/beginWatcher.js')
|
|
98
|
+
var _clean = require('./partials/clean.js')
|
|
99
|
+
var _copyFor = require('./partials/copyFor.js')
|
|
100
|
+
var _distFor = require('./partials/distFor.js')
|
|
101
|
+
var _distForSrc = require('./partials/distForSrc.js')
|
|
102
|
+
var _distSeries = require('./partials/distSeries.js')
|
|
103
|
+
var _imagesFor = require('./partials/imagesFor.js')
|
|
104
|
+
var _minifyFor = require('./partials/minifyFor.js')
|
|
105
|
+
var _readmeTemplate = require('./partials/readmeTemplate.js')
|
|
106
|
+
var _removeDirectory = require('./partials/removeDirectory.js')
|
|
107
|
+
var _runOnChange = require('./partials/runOnChange.js')
|
|
108
|
+
var _sassFor = require('./partials/sassFor.js')
|
|
109
|
+
var _standardLint = require('./partials/standardLint.js')
|
|
110
|
+
var _tsFor = require('./partials/tsFor.js')
|
package/dist/partials.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"addToReadme",{enumerable:!0,get:function(){return _addToReadme.addToReadme}}),Object.defineProperty(exports,"beginWatcher",{enumerable:!0,get:function(){return _beginWatcher.beginWatcher}}),Object.defineProperty(exports,"clean",{enumerable:!0,get:function(){return _clean.clean}}),Object.defineProperty(exports,"copyFor",{enumerable:!0,get:function(){return _copyFor.copyFor}}),Object.defineProperty(exports,"distFor",{enumerable:!0,get:function(){return _distFor.distFor}}),Object.defineProperty(exports,"distForSrc",{enumerable:!0,get:function(){return _distForSrc.distForSrc}}),Object.defineProperty(exports,"distSeries",{enumerable:!0,get:function(){return _distSeries.distSeries}}),Object.defineProperty(exports,"imagesFor",{enumerable:!0,get:function(){return _imagesFor.imagesFor}}),Object.defineProperty(exports,"minifyFor",{enumerable:!0,get:function(){return _minifyFor.minifyFor}}),Object.defineProperty(exports,"readmeTemplate",{enumerable:!0,get:function(){return _readmeTemplate.readmeTemplate}}),Object.defineProperty(exports,"removeDirectory",{enumerable:!0,get:function(){return _removeDirectory.removeDirectory}}),Object.defineProperty(exports,"runOnChange",{enumerable:!0,get:function(){return _runOnChange.runOnChange}}),Object.defineProperty(exports,"sassFor",{enumerable:!0,get:function(){return _sassFor.sassFor}}),Object.defineProperty(exports,"tsFor",{enumerable:!0,get:function(){return _tsFor.tsFor}});var _addToReadme=require("./partials/addToReadme.js"),_beginWatcher=require("./partials/beginWatcher.js"),_clean=require("./partials/clean.js"),_copyFor=require("./partials/copyFor.js"),_distFor=require("./partials/distFor.js"),_distForSrc=require("./partials/distForSrc.js"),_distSeries=require("./partials/distSeries.js"),_imagesFor=require("./partials/imagesFor.js"),_minifyFor=require("./partials/minifyFor.js"),_readmeTemplate=require("./partials/readmeTemplate.js"),_removeDirectory=require("./partials/removeDirectory.js"),_runOnChange=require("./partials/runOnChange.js"),_sassFor=require("./partials/sassFor.js"),_tsFor=require("./partials/tsFor.js");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"addToReadme",{enumerable:!0,get:function(){return _addToReadme.addToReadme}}),Object.defineProperty(exports,"beginWatcher",{enumerable:!0,get:function(){return _beginWatcher.beginWatcher}}),Object.defineProperty(exports,"clean",{enumerable:!0,get:function(){return _clean.clean}}),Object.defineProperty(exports,"copyFor",{enumerable:!0,get:function(){return _copyFor.copyFor}}),Object.defineProperty(exports,"distFor",{enumerable:!0,get:function(){return _distFor.distFor}}),Object.defineProperty(exports,"distForSrc",{enumerable:!0,get:function(){return _distForSrc.distForSrc}}),Object.defineProperty(exports,"distSeries",{enumerable:!0,get:function(){return _distSeries.distSeries}}),Object.defineProperty(exports,"imagesFor",{enumerable:!0,get:function(){return _imagesFor.imagesFor}}),Object.defineProperty(exports,"minifyFor",{enumerable:!0,get:function(){return _minifyFor.minifyFor}}),Object.defineProperty(exports,"readmeTemplate",{enumerable:!0,get:function(){return _readmeTemplate.readmeTemplate}}),Object.defineProperty(exports,"removeDirectory",{enumerable:!0,get:function(){return _removeDirectory.removeDirectory}}),Object.defineProperty(exports,"runOnChange",{enumerable:!0,get:function(){return _runOnChange.runOnChange}}),Object.defineProperty(exports,"sassFor",{enumerable:!0,get:function(){return _sassFor.sassFor}}),Object.defineProperty(exports,"standardLint",{enumerable:!0,get:function(){return _standardLint.standardLint}}),Object.defineProperty(exports,"tsFor",{enumerable:!0,get:function(){return _tsFor.tsFor}});var _addToReadme=require("./partials/addToReadme.js"),_beginWatcher=require("./partials/beginWatcher.js"),_clean=require("./partials/clean.js"),_copyFor=require("./partials/copyFor.js"),_distFor=require("./partials/distFor.js"),_distForSrc=require("./partials/distForSrc.js"),_distSeries=require("./partials/distSeries.js"),_imagesFor=require("./partials/imagesFor.js"),_minifyFor=require("./partials/minifyFor.js"),_readmeTemplate=require("./partials/readmeTemplate.js"),_removeDirectory=require("./partials/removeDirectory.js"),_runOnChange=require("./partials/runOnChange.js"),_sassFor=require("./partials/sassFor.js"),_standardLint=require("./partials/standardLint.js"),_tsFor=require("./partials/tsFor.js");
|
package/dist/sass.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.sass = void 0
|
|
7
|
-
|
|
8
|
-
// Compile sass into CSS & auto-inject into browsers
|
|
9
|
-
const sass = () => (0, _sassFor.sassFor)()
|
|
10
|
-
exports.sass = sass
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.sass = void 0
|
|
7
|
+
const _sassFor = require('./partials/sassFor.js')
|
|
8
|
+
// Compile sass into CSS & auto-inject into browsers
|
|
9
|
+
const sass = () => (0, _sassFor.sassFor)()
|
|
10
|
+
exports.sass = sass
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.standardLint = exports.loadStandardViaSubprocess = void 0;
|
|
7
|
+
require("core-js/modules/es.json.stringify.js");
|
|
8
|
+
var _nodeChild_process = require("node:child_process");
|
|
9
|
+
// Jest's CommonJS transform cannot load `standard` (ESM-only) or run a real dynamic import(), so tests that need
|
|
10
|
+
// genuine Standard behavior run the actual `standard` package in a plain Node subprocess instead of faking it.
|
|
11
|
+
const script = 'import { readFileSync } from \'node:fs\'\n' + 'import standard from \'standard\'\n' + 'const { text, options } = JSON.parse(readFileSync(0, \'utf8\'))\n' + 'process.stdout.write(JSON.stringify(await standard.lintText(text, options)))\n';
|
|
12
|
+
const loadStandardViaSubprocess = () => Promise.resolve({
|
|
13
|
+
lintText: (text, options) => Promise.resolve().then(() => JSON.parse((0, _nodeChild_process.execFileSync)(process.execPath, ['--input-type=module', '--eval', script], {
|
|
14
|
+
input: JSON.stringify({
|
|
15
|
+
text,
|
|
16
|
+
options
|
|
17
|
+
}),
|
|
18
|
+
encoding: 'utf8',
|
|
19
|
+
cwd: process.cwd(),
|
|
20
|
+
maxBuffer: 256 * 1024 * 1024
|
|
21
|
+
})))
|
|
22
|
+
});
|
|
23
|
+
exports.loadStandardViaSubprocess = loadStandardViaSubprocess;
|
|
24
|
+
const actual = jest.requireActual('../partials/standardLint.js');
|
|
25
|
+
|
|
26
|
+
// Drop-in replacement for the partial module (see jest.mock in the lint/build tests): same API, real Standard.
|
|
27
|
+
const standardLint = options => actual.standardLint(options, loadStandardViaSubprocess);
|
|
28
|
+
exports.standardLint = standardLint;
|