js-build-tools 2.3.1 → 3.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 +334 -205
- package/dist/build.js +16 -5
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +12 -13
- package/dist/bundle.min.js +1 -1
- package/dist/bundleLint.js +17 -18
- package/dist/bundleLint.min.js +1 -1
- package/dist/bundleMinify.js +8 -9
- package/dist/bundleMinify.min.js +1 -1
- package/dist/copyFonts.js +12 -0
- package/dist/copyFonts.min.js +1 -0
- package/dist/default.js +15 -15
- package/dist/default.min.js +1 -1
- package/dist/dist.js +0 -1
- package/dist/distLint.js +17 -18
- package/dist/distLint.min.js +1 -1
- package/dist/distMinify.js +8 -9
- package/dist/distMinify.min.js +1 -1
- package/dist/images.js +11 -0
- package/dist/images.min.js +1 -0
- package/dist/partials/addToReadme.js +13 -14
- package/dist/partials/beginWatcher.js +9 -10
- package/dist/partials/clean.js +0 -1
- package/dist/partials/copyFor.js +16 -0
- package/dist/partials/distFor.js +16 -17
- package/dist/partials/distForSrc.js +9 -10
- package/dist/partials/distSeries.js +19 -20
- package/dist/partials/imagesFor.js +34 -0
- package/dist/partials/minifyFor.js +0 -1
- package/dist/partials/readmeTemplate.js +11 -12
- package/dist/partials/removeDirectory.js +5 -6
- package/dist/partials/runOnChange.js +27 -27
- package/dist/partials/sassFor.js +2 -3
- package/dist/partials/tsFor.js +20 -21
- package/dist/partials.js +5 -1
- package/dist/partials.min.js +1 -1
- package/dist/sass.js +7 -7
- package/dist/test-helpers/setUp.js +31 -39
- package/dist/testFull.js +17 -18
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +10 -28
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +19 -20
- package/dist/testQuick.min.js +1 -1
- package/dist/typeScript.js +0 -1
- package/dist/utilities/dotGet.js +50 -0
- package/dist/utilities/dotNotate.js +77 -0
- package/dist/utilities/dotSet.js +44 -0
- package/dist/utilities/isObject.js +10 -0
- package/dist/watchFull.js +0 -1
- package/dist/watchTest.js +13 -14
- package/dist/watchTest.min.js +1 -1
- package/functions/build.js +15 -5
- package/functions/build.test.js +278 -42
- package/functions/bundle.js +3 -4
- package/functions/bundle.test.js +6 -6
- package/functions/bundleLint.js +2 -3
- package/functions/bundleLint.test.js +5 -5
- package/functions/bundleMinify.js +1 -2
- package/functions/bundleMinify.test.js +1 -1
- package/functions/copyFonts.js +11 -0
- package/functions/copyFonts.test.js +31 -0
- package/functions/default.js +1 -1
- package/functions/default.test.js +2 -2
- package/functions/dist.js +0 -1
- package/functions/dist.test.js +1 -1
- package/functions/distLint.js +2 -3
- package/functions/distLint.test.js +3 -3
- package/functions/distMinify.js +1 -2
- package/functions/distMinify.test.js +1 -1
- package/functions/images.js +10 -0
- package/functions/images.test.js +138 -0
- package/functions/partials/addToReadme.js +2 -3
- package/functions/partials/addToReadme.test.js +2 -2
- package/functions/partials/beginWatcher.js +1 -2
- package/functions/partials/beginWatcher.test.js +1 -1
- package/functions/partials/clean.js +0 -1
- package/functions/partials/copyFor.js +13 -0
- package/functions/partials/copyFor.test.js +34 -0
- package/functions/partials/distFor.js +1 -2
- package/functions/partials/distFor.test.js +4 -4
- package/functions/partials/distForSrc.js +3 -4
- package/functions/partials/distForSrc.test.js +6 -6
- package/functions/partials/distSeries.js +2 -3
- package/functions/partials/distSeries.test.js +5 -5
- package/functions/partials/imagesFor.js +33 -0
- package/functions/partials/imagesFor.test.js +143 -0
- package/functions/partials/minifyFor.js +0 -1
- package/functions/partials/minifyFor.test.js +1 -1
- package/functions/partials/readmeTemplate.js +3 -4
- package/functions/partials/readmeTemplate.test.js +2 -2
- package/functions/partials/removeDirectory.js +22 -23
- package/functions/partials/runOnChange.js +5 -6
- package/functions/partials/runOnChange.test.js +9 -9
- package/functions/partials/sassFor.js +1 -2
- package/functions/partials/sassFor.test.js +3 -3
- package/functions/partials/tsFor.js +3 -4
- package/functions/partials/tsFor.test.js +2 -2
- package/functions/partials.js +5 -1
- package/functions/partials.test.js +1 -1
- package/functions/sass.test.js +2 -2
- package/functions/test-helpers/setUp.js +24 -32
- package/functions/testFull.js +2 -3
- package/functions/testFull.test.js +1 -1
- package/functions/testHelpers.js +3 -20
- package/functions/testHelpers.test.js +1 -1
- package/functions/testQuick.js +1 -2
- package/functions/testQuick.test.js +1 -1
- package/functions/typeScript.js +0 -1
- package/functions/typeScript.test.js +0 -2
- package/functions/utilities/dotGet.js +47 -0
- package/functions/utilities/dotNotate.js +68 -0
- package/functions/utilities/dotSet.js +41 -0
- package/functions/utilities/isObject.js +9 -0
- package/functions/watchFull.js +0 -1
- package/functions/watchFull.test.js +1 -1
- package/functions/watchTest.js +1 -2
- package/functions/watchTest.test.js +1 -1
- package/gulp.config.js +153 -79
- package/gulpfile.base.js +5 -1
- package/jsdoc.base.js +1 -1
- package/package.json +13 -9
- package/vendor/array-union/index.js +31 -0
- package/vendor/easy-transform-stream/index.js +58 -0
- package/vendor/globby/gitignore.js +100 -0
- package/vendor/globby/index.js +195 -0
- package/vendor/globby/node_modules/slash/index.js +16 -0
- package/vendor/globby/stream-utils.js +58 -0
- package/vendor/globby/to-path.js +20 -0
- package/vendor/gulp-imagemin/index.js +128 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/index.js +265 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/utilities.js +36 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/ansi-styles/index.js +217 -0
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/supports-color/index.js +154 -0
- package/vendor/gulp-plugin-extras/index.js +46 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/index.js +265 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/utilities.js +36 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/ansi-styles/index.js +217 -0
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/supports-color/index.js +154 -0
- package/vendor/gulp-plugin-extras/plugin-error.js +145 -0
- package/vendor/ignore/index.js +468 -0
- package/vendor/imagemin/index.js +94 -0
- package/vendor/imagemin-gifsicle/index.js +37 -0
- package/vendor/imagemin-mozjpeg/index.js +104 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/index.js +264 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/command.js +47 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/error.js +102 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/kill.js +123 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/promise.js +47 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stdio.js +50 -0
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stream.js +128 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/core.js +238 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/main.js +89 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/realtime.js +24 -0
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/signals.js +44 -0
- package/vendor/imagemin-mozjpeg/node_modules/is-stream/index.js +25 -0
- package/vendor/imagemin-mozjpeg/node_modules/mimic-fn/index.js +70 -0
- package/vendor/imagemin-mozjpeg/node_modules/npm-run-path/index.js +52 -0
- package/vendor/imagemin-mozjpeg/node_modules/onetime/index.js +43 -0
- package/vendor/imagemin-mozjpeg/node_modules/path-key/index.js +20 -0
- package/vendor/imagemin-mozjpeg/node_modules/strip-final-newline/index.js +17 -0
- package/vendor/imagemin-optipng/index.js +44 -0
- package/vendor/imagemin-svgo/index.js +27 -0
- package/vendor/is-jpg/index.js +12 -0
- package/vendor/junk/index.js +49 -0
- package/vendor/mozjpeg/index.js +9 -0
- package/vendor/mozjpeg/lib/index.js +18 -0
- package/vendor/mozjpeg/package.json +50 -0
- package/vendor/p-pipe/index.js +26 -0
- package/vendor/plur/index.js +32 -0
- package/vendor/pretty-bytes/index.js +71 -0
- package/vendor/slash/index.js +12 -0
- package/dist/test-helpers/circularObject.js +0 -50
- package/dist/test-helpers/countMatches.js +0 -12
- package/dist/test-helpers/deepReferenceObject.js +0 -20
- package/dist/test-helpers/domItem.js +0 -33
- package/dist/test-helpers/jsonDom.js +0 -20
- package/dist/test-helpers/linkedList.js +0 -23
- package/dist/test-helpers/logObject.js +0 -21
- package/dist/test-helpers/multiReferenceObject.js +0 -20
- package/dist/test-helpers/nodeTree.js +0 -28
- package/functions/test-helpers/circularObject.js +0 -28
- package/functions/test-helpers/circularObject.test.js +0 -14
- package/functions/test-helpers/countMatches.js +0 -11
- package/functions/test-helpers/countMatches.test.js +0 -9
- package/functions/test-helpers/deepReferenceObject.js +0 -25
- package/functions/test-helpers/deepReferenceObject.test.js +0 -7
- package/functions/test-helpers/domItem.js +0 -31
- package/functions/test-helpers/domItem.test.js +0 -12
- package/functions/test-helpers/jsonDom.js +0 -16
- package/functions/test-helpers/jsonDom.test.js +0 -12
- package/functions/test-helpers/linkedList.js +0 -10
- package/functions/test-helpers/linkedList.test.js +0 -22
- package/functions/test-helpers/logObject.js +0 -18
- package/functions/test-helpers/logObject.test.js +0 -20
- package/functions/test-helpers/multiReferenceObject.js +0 -25
- package/functions/test-helpers/multiReferenceObject.test.js +0 -14
- package/functions/test-helpers/nodeTree.js +0 -11
- package/functions/test-helpers/nodeTree.test.js +0 -18
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.npmRunPath = npmRunPath;
|
|
7
|
+
exports.npmRunPathEnv = npmRunPathEnv;
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
require("core-js/modules/web.url.js");
|
|
10
|
+
require("core-js/modules/web.url-search-params.js");
|
|
11
|
+
var _nodeProcess = _interopRequireDefault(require("node:process"));
|
|
12
|
+
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
13
|
+
var _nodeUrl = _interopRequireDefault(require("node:url"));
|
|
14
|
+
var _index = _interopRequireDefault(require("../path-key/index.js"));
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function npmRunPath() {
|
|
17
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
|
+
const {
|
|
19
|
+
cwd = _nodeProcess.default.cwd(),
|
|
20
|
+
path: path_ = _nodeProcess.default.env[(0, _index.default)()],
|
|
21
|
+
execPath = _nodeProcess.default.execPath
|
|
22
|
+
} = options;
|
|
23
|
+
let previous;
|
|
24
|
+
const execPathString = execPath instanceof URL ? _nodeUrl.default.fileURLToPath(execPath) : execPath;
|
|
25
|
+
const cwdString = cwd instanceof URL ? _nodeUrl.default.fileURLToPath(cwd) : cwd;
|
|
26
|
+
let cwdPath = _nodePath.default.resolve(cwdString);
|
|
27
|
+
const result = [];
|
|
28
|
+
while (previous !== cwdPath) {
|
|
29
|
+
result.push(_nodePath.default.join(cwdPath, 'node_modules/.bin'));
|
|
30
|
+
previous = cwdPath;
|
|
31
|
+
cwdPath = _nodePath.default.resolve(cwdPath, '..');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Ensure the running `node` binary is used.
|
|
35
|
+
result.push(_nodePath.default.resolve(cwdString, execPathString, '..'));
|
|
36
|
+
return [...result, path_].join(_nodePath.default.delimiter);
|
|
37
|
+
}
|
|
38
|
+
function npmRunPathEnv() {
|
|
39
|
+
let {
|
|
40
|
+
env = _nodeProcess.default.env,
|
|
41
|
+
...options
|
|
42
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
43
|
+
env = {
|
|
44
|
+
...env
|
|
45
|
+
};
|
|
46
|
+
const path = (0, _index.default)({
|
|
47
|
+
env
|
|
48
|
+
});
|
|
49
|
+
options.path = env[path];
|
|
50
|
+
env[path] = npmRunPath(options);
|
|
51
|
+
return env;
|
|
52
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/esnext.weak-map.delete-all.js");
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
var _index = _interopRequireDefault(require("../mimic-fn/index.js"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const calledFunctions = new WeakMap();
|
|
12
|
+
const onetime = function (function_) {
|
|
13
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
14
|
+
if (typeof function_ !== 'function') {
|
|
15
|
+
throw new TypeError('Expected a function');
|
|
16
|
+
}
|
|
17
|
+
let returnValue;
|
|
18
|
+
let callCount = 0;
|
|
19
|
+
const functionName = function_.displayName || function_.name || '<anonymous>';
|
|
20
|
+
const onetime = function () {
|
|
21
|
+
calledFunctions.set(onetime, ++callCount);
|
|
22
|
+
if (callCount === 1) {
|
|
23
|
+
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
24
|
+
arguments_[_key] = arguments[_key];
|
|
25
|
+
}
|
|
26
|
+
returnValue = function_.apply(this, arguments_);
|
|
27
|
+
function_ = null;
|
|
28
|
+
} else if (options.throw === true) {
|
|
29
|
+
throw new Error("Function `".concat(functionName, "` can only be called once"));
|
|
30
|
+
}
|
|
31
|
+
return returnValue;
|
|
32
|
+
};
|
|
33
|
+
(0, _index.default)(onetime, function_);
|
|
34
|
+
calledFunctions.set(onetime, callCount);
|
|
35
|
+
return onetime;
|
|
36
|
+
};
|
|
37
|
+
onetime.callCount = function_ => {
|
|
38
|
+
if (!calledFunctions.has(function_)) {
|
|
39
|
+
throw new Error("The given function `".concat(function_.name, "` is not wrapped by the `onetime` package"));
|
|
40
|
+
}
|
|
41
|
+
return calledFunctions.get(function_);
|
|
42
|
+
};
|
|
43
|
+
var _default = exports.default = onetime;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = pathKey;
|
|
7
|
+
require("core-js/modules/esnext.async-iterator.find.js");
|
|
8
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
9
|
+
require("core-js/modules/esnext.iterator.find.js");
|
|
10
|
+
function pathKey() {
|
|
11
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12
|
+
const {
|
|
13
|
+
env = process.env,
|
|
14
|
+
platform = process.platform
|
|
15
|
+
} = options;
|
|
16
|
+
if (platform !== 'win32') {
|
|
17
|
+
return 'PATH';
|
|
18
|
+
}
|
|
19
|
+
return Object.keys(env).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = stripFinalNewline;
|
|
7
|
+
function stripFinalNewline(input) {
|
|
8
|
+
const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
|
|
9
|
+
const CR = typeof input === 'string' ? '\r' : '\r'.charCodeAt();
|
|
10
|
+
if (input[input.length - 1] === LF) {
|
|
11
|
+
input = input.slice(0, -1);
|
|
12
|
+
}
|
|
13
|
+
if (input[input.length - 1] === CR) {
|
|
14
|
+
input = input.slice(0, -1);
|
|
15
|
+
}
|
|
16
|
+
return input;
|
|
17
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const execBuffer = require('exec-buffer');
|
|
4
|
+
const isPng = require('is-png');
|
|
5
|
+
const optipng = require('optipng-bin');
|
|
6
|
+
module.exports = options => async buffer => {
|
|
7
|
+
options = {
|
|
8
|
+
optimizationLevel: 3,
|
|
9
|
+
bitDepthReduction: true,
|
|
10
|
+
colorTypeReduction: true,
|
|
11
|
+
paletteReduction: true,
|
|
12
|
+
interlaced: false,
|
|
13
|
+
errorRecovery: true,
|
|
14
|
+
...options
|
|
15
|
+
};
|
|
16
|
+
if (!Buffer.isBuffer(buffer)) {
|
|
17
|
+
throw new TypeError('Expected a buffer');
|
|
18
|
+
}
|
|
19
|
+
if (!isPng(buffer)) {
|
|
20
|
+
return buffer;
|
|
21
|
+
}
|
|
22
|
+
const arguments_ = ['-strip', 'all', '-clobber', '-o', options.optimizationLevel, '-out', execBuffer.output];
|
|
23
|
+
if (options.errorRecovery) {
|
|
24
|
+
arguments_.push('-fix');
|
|
25
|
+
}
|
|
26
|
+
if (!options.bitDepthReduction) {
|
|
27
|
+
arguments_.push('-nb');
|
|
28
|
+
}
|
|
29
|
+
if (typeof options.interlaced === 'boolean') {
|
|
30
|
+
arguments_.push('-i', options.interlaced ? '1' : '0');
|
|
31
|
+
}
|
|
32
|
+
if (!options.colorTypeReduction) {
|
|
33
|
+
arguments_.push('-nc');
|
|
34
|
+
}
|
|
35
|
+
if (!options.paletteReduction) {
|
|
36
|
+
arguments_.push('-np');
|
|
37
|
+
}
|
|
38
|
+
arguments_.push(execBuffer.input);
|
|
39
|
+
return execBuffer({
|
|
40
|
+
input: buffer,
|
|
41
|
+
bin: optipng,
|
|
42
|
+
args: arguments_
|
|
43
|
+
});
|
|
44
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _nodeBuffer = require("node:buffer");
|
|
8
|
+
var _isSvg = _interopRequireDefault(require("is-svg"));
|
|
9
|
+
var _svgo = require("svgo");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const imageminSvgo = options => async buffer => {
|
|
12
|
+
options = {
|
|
13
|
+
multipass: true,
|
|
14
|
+
...options
|
|
15
|
+
};
|
|
16
|
+
if (!(0, _isSvg.default)(buffer)) {
|
|
17
|
+
return Promise.resolve(buffer);
|
|
18
|
+
}
|
|
19
|
+
if (_nodeBuffer.Buffer.isBuffer(buffer)) {
|
|
20
|
+
buffer = buffer.toString();
|
|
21
|
+
}
|
|
22
|
+
const {
|
|
23
|
+
data
|
|
24
|
+
} = (0, _svgo.optimize)(buffer, options);
|
|
25
|
+
return _nodeBuffer.Buffer.from(data);
|
|
26
|
+
};
|
|
27
|
+
var _default = exports.default = imageminSvgo;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = isJpg;
|
|
7
|
+
function isJpg(buffer) {
|
|
8
|
+
if (!buffer || buffer.length < 3) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return buffer[0] === 255 && buffer[1] === 216 && buffer[2] === 255;
|
|
12
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const blacklist = [
|
|
4
|
+
// # All
|
|
5
|
+
'^npm-debug\\.log$',
|
|
6
|
+
// Error log for npm
|
|
7
|
+
'^\\..*\\.swp$',
|
|
8
|
+
// Swap file for vim state
|
|
9
|
+
|
|
10
|
+
// # macOS
|
|
11
|
+
'^\\.DS_Store$',
|
|
12
|
+
// Stores custom folder attributes
|
|
13
|
+
'^\\.AppleDouble$',
|
|
14
|
+
// Stores additional file resources
|
|
15
|
+
'^\\.LSOverride$',
|
|
16
|
+
// Contains the absolute path to the app to be used
|
|
17
|
+
'^Icon\\r$',
|
|
18
|
+
// Custom Finder icon: http://superuser.com/questions/298785/icon-file-on-os-x-desktop
|
|
19
|
+
'^\\._.*',
|
|
20
|
+
// Thumbnail
|
|
21
|
+
'^\\.Spotlight-V100(?:$|\\/)',
|
|
22
|
+
// Directory that might appear on external disk
|
|
23
|
+
'\\.Trashes',
|
|
24
|
+
// File that might appear on external disk
|
|
25
|
+
'^__MACOSX$',
|
|
26
|
+
// Resource fork
|
|
27
|
+
|
|
28
|
+
// # Linux
|
|
29
|
+
'~$',
|
|
30
|
+
// Backup file
|
|
31
|
+
|
|
32
|
+
// # Windows
|
|
33
|
+
'^Thumbs\\.db$',
|
|
34
|
+
// Image file cache
|
|
35
|
+
'^ehthumbs\\.db$',
|
|
36
|
+
// Folder config file
|
|
37
|
+
'^Desktop\\.ini$',
|
|
38
|
+
// Stores custom folder attributes
|
|
39
|
+
'@eaDir$' // Synology Diskstation "hidden" folder where the server stores thumbnails
|
|
40
|
+
];
|
|
41
|
+
exports.re = () => {
|
|
42
|
+
throw new Error('`junk.re` was renamed to `junk.regex`');
|
|
43
|
+
};
|
|
44
|
+
exports.regex = new RegExp(blacklist.join('|'));
|
|
45
|
+
exports.is = filename => exports.regex.test(filename);
|
|
46
|
+
exports.not = filename => !exports.is(filename);
|
|
47
|
+
|
|
48
|
+
// TODO: Remove this for the next major release
|
|
49
|
+
exports.default = module.exports;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _index = _interopRequireDefault(require("./lib/index.js"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
var _default = exports.default = _index.default.path();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
|
+
require("core-js/modules/web.url.js");
|
|
9
|
+
require("core-js/modules/web.url-search-params.js");
|
|
10
|
+
var _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
11
|
+
var _nodeProcess = _interopRequireDefault(require("node:process"));
|
|
12
|
+
var _nodeUrl = require("node:url");
|
|
13
|
+
var _binWrapper = _interopRequireDefault(require("bin-wrapper"));
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
const pkg = JSON.parse(_nodeFs.default.readFileSync(new URL('../package.json', require('url').pathToFileURL(__filename).toString())));
|
|
16
|
+
const url = "https://raw.githubusercontent.com/imagemin/mozjpeg-bin/v".concat(pkg.version, "/vendor/");
|
|
17
|
+
const binWrapper = new _binWrapper.default().src("".concat(url, "macos/cjpeg"), 'darwin').src("".concat(url, "linux/cjpeg"), 'linux').src("".concat(url, "win/cjpeg.exe"), 'win32').dest((0, _nodeUrl.fileURLToPath)(new URL('../vendor', require('url').pathToFileURL(__filename).toString()))).use(_nodeProcess.default.platform === 'win32' ? 'cjpeg.exe' : 'cjpeg');
|
|
18
|
+
var _default = exports.default = binWrapper;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mozjpeg",
|
|
3
|
+
"version": "8.0.0",
|
|
4
|
+
"description": "mozjpeg wrapper that makes it seamlessly available as a local dependency",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "imagemin/mozjpeg-bin",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": "./index.js",
|
|
9
|
+
"bin": "cli.js",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"postinstall": "node lib/install.js",
|
|
15
|
+
"test": "xo && ava --timeout=120s",
|
|
16
|
+
"build-linux": "docker build --tag imagemin/mozjpeg docker && docker run --rm --volume $(pwd)/vendor/linux:/src/out imagemin/mozjpeg cp cjpeg /src/out"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"index.js",
|
|
20
|
+
"cli.js",
|
|
21
|
+
"lib",
|
|
22
|
+
"vendor/source"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"imagemin",
|
|
26
|
+
"jpeg",
|
|
27
|
+
"jpg",
|
|
28
|
+
"img",
|
|
29
|
+
"image",
|
|
30
|
+
"compress",
|
|
31
|
+
"minify",
|
|
32
|
+
"mozjpeg",
|
|
33
|
+
"optimize"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"bin-build": "^3.0.0",
|
|
37
|
+
"bin-wrapper": "^4.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"ava": "^3.8.0",
|
|
41
|
+
"bin-check": "^4.1.0",
|
|
42
|
+
"compare-size": "^3.0.0",
|
|
43
|
+
"execa": "^5.1.1",
|
|
44
|
+
"tempy": "^2.0.0",
|
|
45
|
+
"xo": "^0.45.0"
|
|
46
|
+
},
|
|
47
|
+
"ava": {
|
|
48
|
+
"serial": true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
async function exportPPipe () {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = pPipe;
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
function pPipe() {
|
|
10
|
+
for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11
|
+
functions[_key] = arguments[_key];
|
|
12
|
+
}
|
|
13
|
+
if (functions.length === 0) {
|
|
14
|
+
throw new Error('Expected at least one argument');
|
|
15
|
+
}
|
|
16
|
+
return async input => {
|
|
17
|
+
let currentValue = input;
|
|
18
|
+
for (const function_ of functions) {
|
|
19
|
+
currentValue = await function_(currentValue); // eslint-disable-line no-await-in-loop
|
|
20
|
+
}
|
|
21
|
+
return currentValue;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exportPPipe()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = plur;
|
|
7
|
+
require("core-js/modules/es.string.replace.js");
|
|
8
|
+
var _irregularPlurals = _interopRequireDefault(require("irregular-plurals"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function plur(word, plural, count) {
|
|
11
|
+
if (typeof plural === 'number') {
|
|
12
|
+
count = plural;
|
|
13
|
+
}
|
|
14
|
+
if (_irregularPlurals.default.has(word.toLowerCase())) {
|
|
15
|
+
plural = _irregularPlurals.default.get(word.toLowerCase());
|
|
16
|
+
const firstLetter = word.charAt(0);
|
|
17
|
+
const isFirstLetterUpperCase = firstLetter === firstLetter.toUpperCase();
|
|
18
|
+
if (isFirstLetterUpperCase) {
|
|
19
|
+
plural = firstLetter + plural.slice(1);
|
|
20
|
+
}
|
|
21
|
+
const isWholeWordUpperCase = word === word.toUpperCase();
|
|
22
|
+
if (isWholeWordUpperCase) {
|
|
23
|
+
plural = plural.toUpperCase();
|
|
24
|
+
}
|
|
25
|
+
} else if (typeof plural !== 'string') {
|
|
26
|
+
plural = (word.replace(/(?:s|x|z|ch|sh)$/i, '$&e').replace(/([^aeiou])y$/i, '$1ie') + 's').replace(/i?e?s$/i, match => {
|
|
27
|
+
const isTailLowerCase = word.slice(-1) === word.slice(-1).toLowerCase();
|
|
28
|
+
return isTailLowerCase ? match.toLowerCase() : match.toUpperCase();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return Math.abs(count) === 1 ? word : plural;
|
|
32
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = prettyBytes;
|
|
7
|
+
const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
8
|
+
const BIBYTE_UNITS = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
9
|
+
const BIT_UNITS = ['b', 'kbit', 'Mbit', 'Gbit', 'Tbit', 'Pbit', 'Ebit', 'Zbit', 'Ybit'];
|
|
10
|
+
const BIBIT_UNITS = ['b', 'kibit', 'Mibit', 'Gibit', 'Tibit', 'Pibit', 'Eibit', 'Zibit', 'Yibit'];
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
Formats the given number using `Number#toLocaleString`.
|
|
14
|
+
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
15
|
+
- If locale is true, the system default locale is used for translation.
|
|
16
|
+
- If no value for locale is specified, the number is returned unmodified.
|
|
17
|
+
*/
|
|
18
|
+
const toLocaleString = (number, locale, options) => {
|
|
19
|
+
let result = number;
|
|
20
|
+
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
21
|
+
result = number.toLocaleString(locale, options);
|
|
22
|
+
} else if (locale === true || options !== undefined) {
|
|
23
|
+
result = number.toLocaleString(undefined, options);
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
function prettyBytes(number, options) {
|
|
28
|
+
if (!Number.isFinite(number)) {
|
|
29
|
+
throw new TypeError("Expected a finite number, got ".concat(typeof number, ": ").concat(number));
|
|
30
|
+
}
|
|
31
|
+
options = {
|
|
32
|
+
bits: false,
|
|
33
|
+
binary: false,
|
|
34
|
+
space: true,
|
|
35
|
+
...options
|
|
36
|
+
};
|
|
37
|
+
const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
38
|
+
const separator = options.space ? ' ' : '';
|
|
39
|
+
if (options.signed && number === 0) {
|
|
40
|
+
return " 0".concat(separator).concat(UNITS[0]);
|
|
41
|
+
}
|
|
42
|
+
const isNegative = number < 0;
|
|
43
|
+
const prefix = isNegative ? '-' : options.signed ? '+' : '';
|
|
44
|
+
if (isNegative) {
|
|
45
|
+
number = -number;
|
|
46
|
+
}
|
|
47
|
+
let localeOptions;
|
|
48
|
+
if (options.minimumFractionDigits !== undefined) {
|
|
49
|
+
localeOptions = {
|
|
50
|
+
minimumFractionDigits: options.minimumFractionDigits
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (options.maximumFractionDigits !== undefined) {
|
|
54
|
+
localeOptions = {
|
|
55
|
+
maximumFractionDigits: options.maximumFractionDigits,
|
|
56
|
+
...localeOptions
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (number < 1) {
|
|
60
|
+
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
61
|
+
return prefix + numberString + separator + UNITS[0];
|
|
62
|
+
}
|
|
63
|
+
const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
|
|
64
|
+
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
65
|
+
if (!localeOptions) {
|
|
66
|
+
number = number.toPrecision(3);
|
|
67
|
+
}
|
|
68
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
69
|
+
const unit = UNITS[exponent];
|
|
70
|
+
return prefix + numberString + separator + unit;
|
|
71
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.string.replace.js");
|
|
4
|
+
module.exports = path => {
|
|
5
|
+
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
|
|
6
|
+
const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex
|
|
7
|
+
|
|
8
|
+
if (isExtendedLengthPath || hasNonAscii) {
|
|
9
|
+
return path;
|
|
10
|
+
}
|
|
11
|
+
return path.replace(/\\/g, '/');
|
|
12
|
+
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Multilayered node tree-like structure with parent references
|
|
5
|
-
* @memberOf module:testHelpers
|
|
6
|
-
* @type {Object.<string, string|Object|Array>}
|
|
7
|
-
*/
|
|
8
|
-
const circularObject = {
|
|
9
|
-
name: 'root',
|
|
10
|
-
parent: {},
|
|
11
|
-
body: {},
|
|
12
|
-
head: {},
|
|
13
|
-
children: []
|
|
14
|
-
};
|
|
15
|
-
circularObject.children = [{
|
|
16
|
-
name: 'body',
|
|
17
|
-
parent: {},
|
|
18
|
-
children: []
|
|
19
|
-
}, {
|
|
20
|
-
name: 'head',
|
|
21
|
-
parent: {},
|
|
22
|
-
children: []
|
|
23
|
-
}];
|
|
24
|
-
circularObject.body = circularObject.children[0];
|
|
25
|
-
circularObject.head = circularObject.children[1];
|
|
26
|
-
circularObject.body.parent = circularObject;
|
|
27
|
-
circularObject.head.parent = circularObject;
|
|
28
|
-
circularObject.body.children = [{
|
|
29
|
-
name: 'body child one',
|
|
30
|
-
parent: {},
|
|
31
|
-
children: []
|
|
32
|
-
}, {
|
|
33
|
-
name: 'body child two',
|
|
34
|
-
parent: {},
|
|
35
|
-
children: []
|
|
36
|
-
}];
|
|
37
|
-
circularObject.body.children[0].parent = circularObject.body;
|
|
38
|
-
circularObject.body.children[1].parent = circularObject.body;
|
|
39
|
-
circularObject.head.children = [{
|
|
40
|
-
name: 'head child one',
|
|
41
|
-
parent: {},
|
|
42
|
-
children: []
|
|
43
|
-
}, {
|
|
44
|
-
name: 'head child two',
|
|
45
|
-
parent: {},
|
|
46
|
-
children: []
|
|
47
|
-
}];
|
|
48
|
-
circularObject.head.children[0].parent = circularObject.head;
|
|
49
|
-
circularObject.head.children[1].parent = circularObject.head;
|
|
50
|
-
module.exports = circularObject;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Simple way to count string occurrences for testing.
|
|
5
|
-
* @function
|
|
6
|
-
* @memberOf module:testHelpers
|
|
7
|
-
* @param {string} content
|
|
8
|
-
* @param {string} search
|
|
9
|
-
* @returns {number}
|
|
10
|
-
*/
|
|
11
|
-
const countMatches = (content, search) => content.split(search).length - 1;
|
|
12
|
-
module.exports = countMatches;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sample object with deep references.
|
|
5
|
-
* @memberOf module:testHelpers
|
|
6
|
-
* @type {Object.<string, string|number|Object>}
|
|
7
|
-
*/
|
|
8
|
-
const deepReferenceObject = {
|
|
9
|
-
object1: {
|
|
10
|
-
name: 'someName',
|
|
11
|
-
object2: {
|
|
12
|
-
age: 12,
|
|
13
|
-
array1: ['someString', 'anotherString']
|
|
14
|
-
},
|
|
15
|
-
array2: [89, 32]
|
|
16
|
-
},
|
|
17
|
-
title: 'Some Title',
|
|
18
|
-
item: 45
|
|
19
|
-
};
|
|
20
|
-
module.exports = deepReferenceObject;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sample of domItem child with nested child and optional details
|
|
5
|
-
* @memberOf module:testHelpers
|
|
6
|
-
* @type {Object.<string, string|number|Array|Object>}
|
|
7
|
-
*/
|
|
8
|
-
const domItem = [{
|
|
9
|
-
attributes: {
|
|
10
|
-
className: 'row',
|
|
11
|
-
style: {}
|
|
12
|
-
},
|
|
13
|
-
axis: 'y',
|
|
14
|
-
children: [{
|
|
15
|
-
attributes: {
|
|
16
|
-
style: {}
|
|
17
|
-
},
|
|
18
|
-
axis: 'x',
|
|
19
|
-
children: [],
|
|
20
|
-
element: {},
|
|
21
|
-
eventListeners: {},
|
|
22
|
-
hasShip: false,
|
|
23
|
-
isHit: false,
|
|
24
|
-
parentItem: {},
|
|
25
|
-
point: {},
|
|
26
|
-
tagName: 'div'
|
|
27
|
-
}],
|
|
28
|
-
element: null,
|
|
29
|
-
eventListeners: {},
|
|
30
|
-
parentItem: {},
|
|
31
|
-
tagName: 'div'
|
|
32
|
-
}];
|
|
33
|
-
module.exports = domItem;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sample of jsonDom object containing empty nested array and objects
|
|
5
|
-
* @memberOf module:testHelpers
|
|
6
|
-
* @type {Object.<string, string|number|Array|Object>}
|
|
7
|
-
*/
|
|
8
|
-
const jsonDom = {
|
|
9
|
-
tagName: 'div',
|
|
10
|
-
attributes: {
|
|
11
|
-
style: {},
|
|
12
|
-
className: 'column'
|
|
13
|
-
},
|
|
14
|
-
element: null,
|
|
15
|
-
eventListeners: {},
|
|
16
|
-
parentItem: {},
|
|
17
|
-
children: [],
|
|
18
|
-
axis: 'x'
|
|
19
|
-
};
|
|
20
|
-
module.exports = jsonDom;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sample LinkedList for testing circular references.
|
|
5
|
-
* @memberOf module:testHelpers
|
|
6
|
-
* @type {Object.<string, string|Object>}
|
|
7
|
-
*/
|
|
8
|
-
const linkedList = {
|
|
9
|
-
name: 'one',
|
|
10
|
-
prev: null,
|
|
11
|
-
next: null
|
|
12
|
-
};
|
|
13
|
-
linkedList.next = {
|
|
14
|
-
name: 'two',
|
|
15
|
-
prev: linkedList,
|
|
16
|
-
next: null
|
|
17
|
-
};
|
|
18
|
-
linkedList.next.next = {
|
|
19
|
-
name: 'three',
|
|
20
|
-
prev: linkedList.next,
|
|
21
|
-
next: null
|
|
22
|
-
};
|
|
23
|
-
module.exports = linkedList;
|