js-build-tools 3.0.4 → 4.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 +431 -691
- package/babel.config.js +1 -1
- package/dist/build.js +58 -59
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +17 -12
- package/dist/bundle.min.js +1 -1
- package/dist/bundleLint.js +21 -17
- package/dist/bundleLint.min.js +1 -1
- package/dist/bundleMinify.js +14 -8
- package/dist/bundleMinify.min.js +1 -1
- package/dist/compileReadme.js +10 -13
- package/dist/compileReadme.min.js +1 -1
- package/dist/copyFonts.js +14 -8
- package/dist/copyFonts.min.js +1 -1
- package/dist/default.js +19 -15
- package/dist/default.min.js +1 -1
- package/dist/dist.js +10 -7
- package/dist/dist.min.js +1 -1
- package/dist/distLint.js +21 -17
- package/dist/distLint.min.js +1 -1
- package/dist/distMinify.js +14 -8
- package/dist/distMinify.min.js +1 -1
- package/dist/images.js +10 -7
- package/dist/images.min.js +1 -1
- package/dist/partials/addToReadme.js +19 -14
- package/dist/partials/beginWatcher.js +14 -10
- package/dist/partials/clean.js +17 -11
- package/dist/partials/copyFor.js +10 -10
- package/dist/partials/distFor.js +27 -17
- package/dist/partials/distForSrc.js +16 -10
- package/dist/partials/distSeries.js +24 -20
- package/dist/partials/imagesFor.js +27 -28
- package/dist/partials/minifyFor.js +17 -16
- package/dist/partials/readmeTemplate.js +16 -12
- package/dist/partials/removeDirectory.js +12 -12
- package/dist/partials/runOnChange.js +30 -28
- package/dist/partials/sassFor.js +28 -21
- package/dist/partials/tsFor.js +24 -21
- package/dist/partials.js +103 -41
- package/dist/partials.min.js +1 -1
- package/dist/sass.js +10 -7
- package/dist/sass.min.js +1 -1
- package/dist/test-helpers/setUp.js +68 -65
- package/dist/testFull.js +22 -17
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +11 -15
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +24 -19
- package/dist/testQuick.min.js +1 -1
- package/dist/typeScript.js +9 -7
- package/dist/typeScript.min.js +1 -1
- package/dist/utilities/dotGet.js +45 -43
- package/dist/utilities/dotNotate.js +53 -51
- package/dist/utilities/dotSet.js +39 -37
- package/dist/utilities/isObject.js +9 -5
- package/dist/utilities/strAfter.js +18 -14
- package/dist/utilities/strBefore.js +18 -14
- package/dist/watchFull.js +10 -10
- package/dist/watchFull.min.js +1 -1
- package/dist/watchTest.js +17 -13
- package/dist/watchTest.min.js +1 -1
- package/functions/{build.js → build.mjs} +14 -16
- package/functions/{build.test.js → build.test.mjs} +9 -8
- package/functions/{bundle.js → bundle.mjs} +5 -7
- package/functions/{bundle.test.js → bundle.test.mjs} +5 -4
- package/functions/{bundleLint.js → bundleLint.mjs} +4 -6
- package/functions/{bundleLint.test.js → bundleLint.test.mjs} +5 -4
- package/functions/bundleMinify.mjs +9 -0
- package/functions/bundleMinify.test.mjs +15 -0
- package/functions/compileReadme.mjs +9 -0
- package/functions/{compileReadme.test.js → compileReadme.test.mjs} +4 -4
- package/functions/copyFonts.mjs +9 -0
- package/functions/{copyFonts.test.js → copyFonts.test.mjs} +4 -3
- package/functions/default.mjs +12 -0
- package/functions/{default.test.js → default.test.mjs} +8 -7
- package/functions/{dist.js → dist.mjs} +2 -4
- package/functions/{dist.test.js → dist.test.mjs} +4 -3
- package/functions/{distLint.js → distLint.mjs} +4 -6
- package/functions/{distLint.test.js → distLint.test.mjs} +5 -4
- package/functions/distMinify.mjs +9 -0
- package/functions/distMinify.test.mjs +15 -0
- package/functions/{images.js → images.mjs} +2 -4
- package/functions/{images.test.js → images.test.mjs} +4 -3
- package/functions/partials/{addToReadme.js → addToReadme.mjs} +5 -7
- package/functions/partials/{addToReadme.test.js → addToReadme.test.mjs} +4 -3
- package/functions/partials/beginWatcher.mjs +9 -0
- package/functions/partials/{beginWatcher.test.js → beginWatcher.test.mjs} +4 -3
- package/functions/partials/clean.mjs +13 -0
- package/functions/partials/{clean.test.js → clean.test.mjs} +4 -3
- package/functions/partials/{copyFor.js → copyFor.mjs} +2 -4
- package/functions/partials/{copyFor.test.js → copyFor.test.mjs} +4 -3
- package/functions/partials/distFor.mjs +22 -0
- package/functions/partials/{distFor.test.js → distFor.test.mjs} +49 -8
- package/functions/partials/{distForSrc.js → distForSrc.mjs} +2 -4
- package/functions/partials/{distForSrc.test.js → distForSrc.test.mjs} +3 -2
- package/functions/partials/{distSeries.js → distSeries.mjs} +6 -8
- package/functions/partials/{distSeries.test.js → distSeries.test.mjs} +7 -6
- package/functions/partials/{imagesFor.js → imagesFor.mjs} +5 -13
- package/functions/partials/{imagesFor.test.js → imagesFor.test.mjs} +4 -3
- package/functions/partials/minifyFor.mjs +15 -0
- package/functions/partials/{minifyFor.test.js → minifyFor.test.mjs} +5 -4
- package/functions/partials/readmeTemplate.mjs +12 -0
- package/functions/partials/{readmeTemplate.test.js → readmeTemplate.test.mjs} +4 -3
- package/functions/partials/{removeDirectory.js → removeDirectory.mjs} +2 -4
- package/functions/partials/{removeDirectory.test.js → removeDirectory.test.mjs} +28 -28
- package/functions/partials/{runOnChange.js → runOnChange.mjs} +6 -8
- package/functions/partials/{runOnChange.test.js → runOnChange.test.mjs} +12 -11
- package/functions/partials/sassFor.mjs +22 -0
- package/functions/partials/{sassFor.test.js → sassFor.test.mjs} +5 -4
- package/functions/partials/{tsFor.js → tsFor.mjs} +4 -6
- package/functions/partials/{tsFor.test.js → tsFor.test.mjs} +5 -4
- package/functions/partials.mjs +23 -0
- package/functions/{partials.test.js → partials.test.mjs} +1 -1
- package/functions/sass.mjs +4 -0
- package/functions/{sass.test.js → sass.test.mjs} +4 -3
- package/functions/test-helpers/{setUp.js → setUp.mjs} +25 -27
- package/functions/test-helpers/setUp.test.mjs +19 -0
- package/functions/{testFull.js → testFull.mjs} +4 -6
- package/functions/testFull.test.mjs +17 -0
- package/functions/{testHelpers.js → testHelpers.mjs} +1 -6
- package/functions/testHelpers.test.mjs +7 -0
- package/functions/{testQuick.js → testQuick.mjs} +4 -6
- package/functions/testQuick.test.mjs +17 -0
- package/functions/{typeScript.js → typeScript.mjs} +2 -4
- package/functions/typeScript.test.mjs +11 -0
- package/functions/utilities/{dotGet.js → dotGet.mjs} +4 -6
- package/functions/utilities/{dotNotate.js → dotNotate.mjs} +2 -4
- package/functions/utilities/{dotSet.js → dotSet.mjs} +4 -6
- package/functions/utilities/{isObject.js → isObject.mjs} +1 -3
- package/functions/utilities/{strAfter.js → strAfter.mjs} +11 -13
- package/functions/utilities/{strBefore.js → strBefore.mjs} +11 -13
- package/functions/{watchFull.js → watchFull.mjs} +2 -4
- package/functions/{watchFull.test.js → watchFull.test.mjs} +8 -7
- package/functions/watchTest.mjs +10 -0
- package/functions/{watchTest.test.js → watchTest.test.mjs} +7 -6
- package/gulp.config.js +20 -19
- package/gulp.config.mjs +252 -0
- package/gulpfile.base.js +20 -20
- package/gulpfile.base.mjs +27 -0
- package/package.json +19 -13
- package/functions/bundleMinify.js +0 -11
- package/functions/bundleMinify.test.js +0 -14
- package/functions/compileReadme.js +0 -11
- package/functions/copyFonts.js +0 -11
- package/functions/default.js +0 -14
- package/functions/distMinify.js +0 -11
- package/functions/distMinify.test.js +0 -14
- package/functions/partials/beginWatcher.js +0 -11
- package/functions/partials/clean.js +0 -15
- package/functions/partials/distFor.js +0 -17
- package/functions/partials/minifyFor.js +0 -15
- package/functions/partials/readmeTemplate.js +0 -14
- package/functions/partials/sassFor.js +0 -21
- package/functions/partials.js +0 -40
- package/functions/sass.js +0 -6
- package/functions/test-helpers/setUp.test.js +0 -18
- package/functions/testFull.test.js +0 -16
- package/functions/testHelpers.test.js +0 -7
- package/functions/testQuick.test.js +0 -16
- package/functions/typeScript.test.js +0 -10
- package/functions/watchTest.js +0 -12
- package/vendor/array-union/index.js +0 -31
- package/vendor/easy-transform-stream/index.js +0 -54
- package/vendor/globby/gitignore.js +0 -96
- package/vendor/globby/index.js +0 -191
- package/vendor/globby/node_modules/slash/index.js +0 -16
- package/vendor/globby/stream-utils.js +0 -58
- package/vendor/globby/to-path.js +0 -20
- package/vendor/gulp-imagemin/index.js +0 -124
- package/vendor/gulp-imagemin/node_modules/chalk/source/index.js +0 -265
- package/vendor/gulp-imagemin/node_modules/chalk/source/utilities.js +0 -36
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -217
- package/vendor/gulp-imagemin/node_modules/chalk/source/vendor/supports-color/index.js +0 -154
- package/vendor/gulp-plugin-extras/index.js +0 -42
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/index.js +0 -265
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/utilities.js +0 -36
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/ansi-styles/index.js +0 -217
- package/vendor/gulp-plugin-extras/node_modules/chalk/source/vendor/supports-color/index.js +0 -154
- package/vendor/gulp-plugin-extras/plugin-error.js +0 -145
- package/vendor/ignore/index.js +0 -468
- package/vendor/imagemin/index.js +0 -90
- package/vendor/imagemin-gifsicle/index.js +0 -33
- package/vendor/imagemin-mozjpeg/index.js +0 -100
- package/vendor/imagemin-mozjpeg/node_modules/execa/index.js +0 -260
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/command.js +0 -47
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/error.js +0 -102
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/kill.js +0 -123
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/promise.js +0 -47
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stdio.js +0 -50
- package/vendor/imagemin-mozjpeg/node_modules/execa/lib/stream.js +0 -124
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/core.js +0 -238
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/main.js +0 -89
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/realtime.js +0 -24
- package/vendor/imagemin-mozjpeg/node_modules/human-signals/build/src/signals.js +0 -44
- package/vendor/imagemin-mozjpeg/node_modules/is-stream/index.js +0 -25
- package/vendor/imagemin-mozjpeg/node_modules/mimic-fn/index.js +0 -70
- package/vendor/imagemin-mozjpeg/node_modules/npm-run-path/index.js +0 -52
- package/vendor/imagemin-mozjpeg/node_modules/onetime/index.js +0 -43
- package/vendor/imagemin-mozjpeg/node_modules/path-key/index.js +0 -20
- package/vendor/imagemin-mozjpeg/node_modules/strip-final-newline/index.js +0 -17
- package/vendor/imagemin-optipng/index.js +0 -44
- package/vendor/imagemin-svgo/index.js +0 -27
- package/vendor/is-jpg/index.js +0 -12
- package/vendor/junk/index.js +0 -49
- package/vendor/mozjpeg/index.js +0 -9
- package/vendor/mozjpeg/lib/index.js +0 -18
- package/vendor/mozjpeg/package.json +0 -49
- package/vendor/mozjpeg/vendor/cjpeg +0 -0
- package/vendor/mozjpeg/vendor/source/mozjpeg.tar.gz +0 -0
- package/vendor/p-pipe/index.js +0 -22
- package/vendor/plur/index.js +0 -32
- package/vendor/pretty-bytes/index.js +0 -71
- package/vendor/slash/index.js +0 -12
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const { dest, src } = require('gulp')
|
|
2
|
-
const gulpConfig = require('../../gulp.config.js')
|
|
3
|
-
const cssnano = require('gulp-cssnano')
|
|
4
|
-
const rename = require('gulp-rename')
|
|
5
|
-
const sass = require('gulp-sass')(require('sass'))
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Build the CSS for a given source pattern.
|
|
9
|
-
* @memberOf module:partials
|
|
10
|
-
* @param {string|array} [srcSearch='src/config/path/sass/for']
|
|
11
|
-
* @param {string} [cssPath='css/config/path']
|
|
12
|
-
* @returns {stream.Stream}
|
|
13
|
-
*/
|
|
14
|
-
const sassFor = (srcSearch = gulpConfig.get('sass.from'), cssPath = gulpConfig.get('sass.to')) => src(srcSearch)
|
|
15
|
-
.pipe(sass().on('error', sass.logError)) // Passes it through a gulp-sass, log errors to console
|
|
16
|
-
.pipe(dest(cssPath))
|
|
17
|
-
.pipe(cssnano())
|
|
18
|
-
.pipe(rename({ extname: '.min.css' }))
|
|
19
|
-
.pipe(dest(cssPath))
|
|
20
|
-
|
|
21
|
-
module.exports = sassFor
|
package/functions/partials.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Micro-functions used as components for the main gulp functions.
|
|
3
|
-
* @file
|
|
4
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
5
|
-
* @version 3.0.0
|
|
6
|
-
* @module partials
|
|
7
|
-
* @memberOf module:js-build-tools
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const addToReadme = require('./partials/addToReadme')
|
|
11
|
-
const beginWatcher = require('./partials/beginWatcher')
|
|
12
|
-
const clean = require('./partials/clean')
|
|
13
|
-
const copyFor = require('./partials/copyFor')
|
|
14
|
-
const distFor = require('./partials/distFor')
|
|
15
|
-
const distForSrc = require('./partials/distForSrc')
|
|
16
|
-
const distSeries = require('./partials/distSeries')
|
|
17
|
-
const imagesFor = require('./partials/imagesFor.js')
|
|
18
|
-
const minifyFor = require('./partials/minifyFor')
|
|
19
|
-
const readmeTemplate = require('./partials/readmeTemplate')
|
|
20
|
-
const removeDirectory = require('./partials/removeDirectory')
|
|
21
|
-
const runOnChange = require('./partials/runOnChange')
|
|
22
|
-
const sassFor = require('./partials/sassFor')
|
|
23
|
-
const tsFor = require('./partials/tsFor')
|
|
24
|
-
|
|
25
|
-
module.exports = {
|
|
26
|
-
addToReadme,
|
|
27
|
-
beginWatcher,
|
|
28
|
-
clean,
|
|
29
|
-
copyFor,
|
|
30
|
-
distFor,
|
|
31
|
-
distForSrc,
|
|
32
|
-
distSeries,
|
|
33
|
-
imagesFor,
|
|
34
|
-
minifyFor,
|
|
35
|
-
readmeTemplate,
|
|
36
|
-
removeDirectory,
|
|
37
|
-
runOnChange,
|
|
38
|
-
sassFor,
|
|
39
|
-
tsFor,
|
|
40
|
-
}
|
package/functions/sass.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const { afterEach, createTempDir, gulpConfig, setDefaults } = require('./setUp')
|
|
2
|
-
const fs = require('fs')
|
|
3
|
-
|
|
4
|
-
setDefaults()
|
|
5
|
-
|
|
6
|
-
describe('setUp', () => {
|
|
7
|
-
test('able to create the test-temp/src directory', async () => {
|
|
8
|
-
expect(fs.existsSync(gulpConfig.get('srcPath'))).toBeFalsy()
|
|
9
|
-
await createTempDir()
|
|
10
|
-
expect(fs.existsSync(gulpConfig.get('srcPath'))).toBeTruthy()
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
test('able to delete the test-temp/src directory', async () => {
|
|
14
|
-
expect(fs.existsSync(gulpConfig.get('srcPath'))).toBeTruthy()
|
|
15
|
-
await afterEach()
|
|
16
|
-
expect(fs.existsSync(gulpConfig.get('srcPath'))).toBeFalsy()
|
|
17
|
-
})
|
|
18
|
-
})
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const { setUp } = require('./testHelpers')
|
|
2
|
-
const gulpConfig = setUp.gulpConfig
|
|
3
|
-
const { runCLI } = require('jest')
|
|
4
|
-
const testFull = require('./testFull')
|
|
5
|
-
|
|
6
|
-
jest.mock('jest', () => ({
|
|
7
|
-
'runCLI': jest.fn(() => Promise.resolve(true))
|
|
8
|
-
}))
|
|
9
|
-
|
|
10
|
-
describe('testFull', () => {
|
|
11
|
-
test('runs the Jest CLI with the configured options', () => {
|
|
12
|
-
expect.assertions(1)
|
|
13
|
-
testFull()
|
|
14
|
-
expect(runCLI).toHaveBeenCalledWith(gulpConfig.get('test.options'), [gulpConfig.get('test.path')])
|
|
15
|
-
})
|
|
16
|
-
})
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const { setUp } = require('./testHelpers')
|
|
2
|
-
const gulpConfig = setUp.gulpConfig
|
|
3
|
-
const { runCLI } = require('jest')
|
|
4
|
-
const testQuick = require('./testQuick')
|
|
5
|
-
|
|
6
|
-
jest.mock('jest', () => ({
|
|
7
|
-
'runCLI': jest.fn(() => Promise.resolve(true))
|
|
8
|
-
}))
|
|
9
|
-
|
|
10
|
-
describe('testQuick', () => {
|
|
11
|
-
test('runs the jest CLI with onlyChanged option', () => {
|
|
12
|
-
expect.assertions(1)
|
|
13
|
-
testQuick()
|
|
14
|
-
expect(runCLI).toHaveBeenCalledWith({ onlyChanged: true }, [gulpConfig.get('test.path')])
|
|
15
|
-
})
|
|
16
|
-
})
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const typeScript = require('./typeScript')
|
|
2
|
-
const tsFor = require('./partials/tsFor')
|
|
3
|
-
jest.mock('./partials/tsFor', () => jest.fn(() => () => null))
|
|
4
|
-
|
|
5
|
-
describe('typeScript', () => {
|
|
6
|
-
test('calls tsFor with no parameters', () => {
|
|
7
|
-
typeScript()
|
|
8
|
-
expect(tsFor).toHaveBeenCalled()
|
|
9
|
-
})
|
|
10
|
-
})
|
package/functions/watchTest.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const gulpConfig = require('../gulp.config.js')
|
|
2
|
-
const { watch } = require('gulp')
|
|
3
|
-
const testQuick = require('./testQuick')
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Watch for changes and run the tests.
|
|
7
|
-
* @memberOf module:js-build-tools
|
|
8
|
-
* @returns {*}
|
|
9
|
-
*/
|
|
10
|
-
const watchTest = () => watch(gulpConfig.get('test.watch'), { ignoreInitial: false }, testQuick)
|
|
11
|
-
|
|
12
|
-
module.exports = watchTest
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
require("core-js/modules/es.array.unscopables.flat.js");
|
|
8
|
-
require("core-js/modules/esnext.set.add-all.js");
|
|
9
|
-
require("core-js/modules/esnext.set.delete-all.js");
|
|
10
|
-
require("core-js/modules/esnext.set.difference.js");
|
|
11
|
-
require("core-js/modules/esnext.set.every.js");
|
|
12
|
-
require("core-js/modules/esnext.set.filter.js");
|
|
13
|
-
require("core-js/modules/esnext.set.find.js");
|
|
14
|
-
require("core-js/modules/esnext.set.intersection.js");
|
|
15
|
-
require("core-js/modules/esnext.set.is-disjoint-from.js");
|
|
16
|
-
require("core-js/modules/esnext.set.is-subset-of.js");
|
|
17
|
-
require("core-js/modules/esnext.set.is-superset-of.js");
|
|
18
|
-
require("core-js/modules/esnext.set.join.js");
|
|
19
|
-
require("core-js/modules/esnext.set.map.js");
|
|
20
|
-
require("core-js/modules/esnext.set.reduce.js");
|
|
21
|
-
require("core-js/modules/esnext.set.some.js");
|
|
22
|
-
require("core-js/modules/esnext.set.symmetric-difference.js");
|
|
23
|
-
require("core-js/modules/esnext.set.union.js");
|
|
24
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
25
|
-
const arrayUnion = function () {
|
|
26
|
-
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
|
-
arguments_[_key] = arguments[_key];
|
|
28
|
-
}
|
|
29
|
-
return [...new Set(arguments_.flat())];
|
|
30
|
-
};
|
|
31
|
-
var _default = exports.default = arrayUnion;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = transformStream;
|
|
7
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
|
-
var _nodeStream = require("node:stream");
|
|
9
|
-
function transformStream() {
|
|
10
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11
|
-
let transformer = arguments.length > 1 ? arguments[1] : undefined;
|
|
12
|
-
let flusher = arguments.length > 2 ? arguments[2] : undefined;
|
|
13
|
-
if (typeof options === 'function') {
|
|
14
|
-
flusher = transformer;
|
|
15
|
-
transformer = options;
|
|
16
|
-
}
|
|
17
|
-
return new _nodeStream.Transform({
|
|
18
|
-
...options,
|
|
19
|
-
transform(chunk, encoding, callback) {
|
|
20
|
-
(async () => {
|
|
21
|
-
try {
|
|
22
|
-
const value = await transformer(chunk, encoding, this);
|
|
23
|
-
|
|
24
|
-
// If the callback throws, we don't want to cause an infinite recursion.
|
|
25
|
-
try {
|
|
26
|
-
callback(undefined, value);
|
|
27
|
-
} catch {}
|
|
28
|
-
} catch (error) {
|
|
29
|
-
callback(error);
|
|
30
|
-
}
|
|
31
|
-
})();
|
|
32
|
-
},
|
|
33
|
-
flush(callback) {
|
|
34
|
-
if (typeof flusher !== 'function') {
|
|
35
|
-
callback();
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
(async () => {
|
|
39
|
-
try {
|
|
40
|
-
for await (const chunk of flusher(this)) {
|
|
41
|
-
this.push(chunk);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// If the callback throws, we don't want to cause an infinite recursion.
|
|
45
|
-
try {
|
|
46
|
-
callback();
|
|
47
|
-
} catch {}
|
|
48
|
-
} catch (error) {
|
|
49
|
-
callback(error);
|
|
50
|
-
}
|
|
51
|
-
})();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isGitIgnoredSync = exports.isGitIgnored = void 0;
|
|
7
|
-
require("core-js/modules/esnext.async-iterator.filter.js");
|
|
8
|
-
require("core-js/modules/esnext.async-iterator.map.js");
|
|
9
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
10
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
11
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
12
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
13
|
-
var _nodeProcess = _interopRequireDefault(require("node:process"));
|
|
14
|
-
var _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
15
|
-
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
16
|
-
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
17
|
-
var _index = _interopRequireDefault(require("../ignore/index.js"));
|
|
18
|
-
var _index2 = _interopRequireDefault(require("./node_modules/slash/index.js"));
|
|
19
|
-
var _toPath = _interopRequireDefault(require("./to-path.js"));
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
const DEFAULT_IGNORE = ['**/node_modules/**', '**/flow-typed/**', '**/coverage/**', '**/.git'];
|
|
22
|
-
const mapGitIgnorePatternTo = base => ignore => {
|
|
23
|
-
if (ignore.startsWith('!')) {
|
|
24
|
-
return '!' + _nodePath.default.posix.join(base, ignore.slice(1));
|
|
25
|
-
}
|
|
26
|
-
return _nodePath.default.posix.join(base, ignore);
|
|
27
|
-
};
|
|
28
|
-
const parseGitIgnore = (content, options) => {
|
|
29
|
-
const base = (0, _index2.default)(_nodePath.default.relative(options.cwd, _nodePath.default.dirname(options.fileName)));
|
|
30
|
-
return content.split(/\r?\n/).filter(Boolean).filter(line => !line.startsWith('#')).map(mapGitIgnorePatternTo(base));
|
|
31
|
-
};
|
|
32
|
-
const reduceIgnore = files => {
|
|
33
|
-
const ignores = (0, _index.default)();
|
|
34
|
-
for (const file of files) {
|
|
35
|
-
ignores.add(parseGitIgnore(file.content, {
|
|
36
|
-
cwd: file.cwd,
|
|
37
|
-
fileName: file.filePath
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
return ignores;
|
|
41
|
-
};
|
|
42
|
-
const ensureAbsolutePathForCwd = (cwd, p) => {
|
|
43
|
-
cwd = (0, _index2.default)(cwd);
|
|
44
|
-
if (_nodePath.default.isAbsolute(p)) {
|
|
45
|
-
if ((0, _index2.default)(p).startsWith(cwd)) {
|
|
46
|
-
return p;
|
|
47
|
-
}
|
|
48
|
-
throw new Error("Path ".concat(p, " is not in cwd ").concat(cwd));
|
|
49
|
-
}
|
|
50
|
-
return _nodePath.default.join(cwd, p);
|
|
51
|
-
};
|
|
52
|
-
const getIsIgnoredPredicate = (ignores, cwd) => p => ignores.ignores((0, _index2.default)(_nodePath.default.relative(cwd, ensureAbsolutePathForCwd(cwd, (0, _toPath.default)(p.path || p)))));
|
|
53
|
-
const getFile = async (file, cwd) => {
|
|
54
|
-
const filePath = _nodePath.default.join(cwd, file);
|
|
55
|
-
const content = await _nodeFs.default.promises.readFile(filePath, 'utf8');
|
|
56
|
-
return {
|
|
57
|
-
cwd,
|
|
58
|
-
filePath,
|
|
59
|
-
content
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
const getFileSync = (file, cwd) => {
|
|
63
|
-
const filePath = _nodePath.default.join(cwd, file);
|
|
64
|
-
const content = _nodeFs.default.readFileSync(filePath, 'utf8');
|
|
65
|
-
return {
|
|
66
|
-
cwd,
|
|
67
|
-
filePath,
|
|
68
|
-
content
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
const normalizeOptions = function () {
|
|
72
|
-
let {
|
|
73
|
-
ignore = [],
|
|
74
|
-
cwd = (0, _index2.default)(_nodeProcess.default.cwd())
|
|
75
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
76
|
-
return {
|
|
77
|
-
ignore: [...DEFAULT_IGNORE, ...ignore],
|
|
78
|
-
cwd: (0, _toPath.default)(cwd)
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
const isGitIgnored = async options => {
|
|
82
|
-
options = normalizeOptions(options);
|
|
83
|
-
const paths = await (0, _fastGlob.default)('**/.gitignore', options);
|
|
84
|
-
const files = await Promise.all(paths.map(file => getFile(file, options.cwd)));
|
|
85
|
-
const ignores = reduceIgnore(files);
|
|
86
|
-
return getIsIgnoredPredicate(ignores, options.cwd);
|
|
87
|
-
};
|
|
88
|
-
exports.isGitIgnored = isGitIgnored;
|
|
89
|
-
const isGitIgnoredSync = options => {
|
|
90
|
-
options = normalizeOptions(options);
|
|
91
|
-
const paths = _fastGlob.default.sync('**/.gitignore', options);
|
|
92
|
-
const files = paths.map(file => getFileSync(file, options.cwd));
|
|
93
|
-
const ignores = reduceIgnore(files);
|
|
94
|
-
return getIsIgnoredPredicate(ignores, options.cwd);
|
|
95
|
-
};
|
|
96
|
-
exports.isGitIgnoredSync = isGitIgnoredSync;
|
package/vendor/globby/index.js
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isDynamicPattern = exports.globbySync = exports.globbyStream = exports.globby = exports.generateGlobTasks = void 0;
|
|
7
|
-
Object.defineProperty(exports, "isGitIgnored", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _gitignore.isGitIgnored;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "isGitIgnoredSync", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _gitignore.isGitIgnoredSync;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
require("core-js/modules/es.array.unscopables.flat.js");
|
|
20
|
-
require("core-js/modules/esnext.async-iterator.every.js");
|
|
21
|
-
require("core-js/modules/esnext.async-iterator.filter.js");
|
|
22
|
-
require("core-js/modules/esnext.async-iterator.map.js");
|
|
23
|
-
require("core-js/modules/esnext.async-iterator.some.js");
|
|
24
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
25
|
-
require("core-js/modules/esnext.iterator.every.js");
|
|
26
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
27
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
28
|
-
require("core-js/modules/esnext.iterator.some.js");
|
|
29
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
30
|
-
var _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
31
|
-
var _index = _interopRequireDefault(require("../array-union/index.js"));
|
|
32
|
-
var _merge = _interopRequireDefault(require("merge2"));
|
|
33
|
-
var _fastGlob = _interopRequireDefault(require("fast-glob"));
|
|
34
|
-
var _dirGlob = _interopRequireDefault(require("dir-glob"));
|
|
35
|
-
var _toPath = _interopRequireDefault(require("./to-path.js"));
|
|
36
|
-
var _gitignore = require("./gitignore.js");
|
|
37
|
-
var _streamUtils = require("./stream-utils.js");
|
|
38
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
|
-
const DEFAULT_FILTER = () => false;
|
|
40
|
-
const isNegative = pattern => pattern[0] === '!';
|
|
41
|
-
const assertPatternsInput = patterns => {
|
|
42
|
-
if (!patterns.every(pattern => typeof pattern === 'string')) {
|
|
43
|
-
throw new TypeError('Patterns must be a string or an array of strings');
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const checkCwdOption = options => {
|
|
47
|
-
if (!options.cwd) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
let stat;
|
|
51
|
-
try {
|
|
52
|
-
stat = _nodeFs.default.statSync(options.cwd);
|
|
53
|
-
} catch {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (!stat.isDirectory()) {
|
|
57
|
-
throw new Error('The `cwd` option must be a path to a directory');
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const getPathString = p => p.stats instanceof _nodeFs.default.Stats ? p.path : p;
|
|
61
|
-
const generateGlobTasks = function (patterns) {
|
|
62
|
-
let taskOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
63
|
-
patterns = (0, _index.default)([patterns].flat());
|
|
64
|
-
assertPatternsInput(patterns);
|
|
65
|
-
const globTasks = [];
|
|
66
|
-
taskOptions = {
|
|
67
|
-
ignore: [],
|
|
68
|
-
expandDirectories: true,
|
|
69
|
-
...taskOptions,
|
|
70
|
-
cwd: (0, _toPath.default)(taskOptions.cwd)
|
|
71
|
-
};
|
|
72
|
-
checkCwdOption(taskOptions);
|
|
73
|
-
for (const [index, pattern] of patterns.entries()) {
|
|
74
|
-
if (isNegative(pattern)) {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
const ignore = patterns.slice(index).filter(pattern => isNegative(pattern)).map(pattern => pattern.slice(1));
|
|
78
|
-
const options = {
|
|
79
|
-
...taskOptions,
|
|
80
|
-
ignore: [...taskOptions.ignore, ...ignore]
|
|
81
|
-
};
|
|
82
|
-
globTasks.push({
|
|
83
|
-
pattern,
|
|
84
|
-
options
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return globTasks;
|
|
88
|
-
};
|
|
89
|
-
exports.generateGlobTasks = generateGlobTasks;
|
|
90
|
-
const globDirectories = (task, fn) => {
|
|
91
|
-
let options = {};
|
|
92
|
-
if (task.options.cwd) {
|
|
93
|
-
options.cwd = task.options.cwd;
|
|
94
|
-
}
|
|
95
|
-
if (Array.isArray(task.options.expandDirectories)) {
|
|
96
|
-
options = {
|
|
97
|
-
...options,
|
|
98
|
-
files: task.options.expandDirectories
|
|
99
|
-
};
|
|
100
|
-
} else if (typeof task.options.expandDirectories === 'object') {
|
|
101
|
-
options = {
|
|
102
|
-
...options,
|
|
103
|
-
...task.options.expandDirectories
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return fn(task.pattern, options);
|
|
107
|
-
};
|
|
108
|
-
const getPattern = (task, fn) => task.options.expandDirectories ? globDirectories(task, fn) : [task.pattern];
|
|
109
|
-
const getFilterSync = options => options && options.gitignore ? (0, _gitignore.isGitIgnoredSync)({
|
|
110
|
-
cwd: options.cwd,
|
|
111
|
-
ignore: options.ignore
|
|
112
|
-
}) : DEFAULT_FILTER;
|
|
113
|
-
const globToTask = task => async glob => {
|
|
114
|
-
const {
|
|
115
|
-
options
|
|
116
|
-
} = task;
|
|
117
|
-
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
|
|
118
|
-
options.ignore = await (0, _dirGlob.default)(options.ignore);
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
pattern: glob,
|
|
122
|
-
options
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
const globToTaskSync = task => glob => {
|
|
126
|
-
const {
|
|
127
|
-
options
|
|
128
|
-
} = task;
|
|
129
|
-
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
|
|
130
|
-
options.ignore = _dirGlob.default.sync(options.ignore);
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
pattern: glob,
|
|
134
|
-
options
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
const globby = async (patterns, options) => {
|
|
138
|
-
const globTasks = generateGlobTasks(patterns, options);
|
|
139
|
-
const getFilter = async () => options && options.gitignore ? (0, _gitignore.isGitIgnored)({
|
|
140
|
-
cwd: options.cwd,
|
|
141
|
-
ignore: options.ignore
|
|
142
|
-
}) : DEFAULT_FILTER;
|
|
143
|
-
const getTasks = async () => {
|
|
144
|
-
const tasks = await Promise.all(globTasks.map(async task => {
|
|
145
|
-
const globs = await getPattern(task, _dirGlob.default);
|
|
146
|
-
return Promise.all(globs.map(globToTask(task)));
|
|
147
|
-
}));
|
|
148
|
-
return (0, _index.default)(...tasks);
|
|
149
|
-
};
|
|
150
|
-
const [filter, tasks] = await Promise.all([getFilter(), getTasks()]);
|
|
151
|
-
const paths = await Promise.all(tasks.map(task => (0, _fastGlob.default)(task.pattern, task.options)));
|
|
152
|
-
return (0, _index.default)(...paths).filter(path_ => !filter(getPathString(path_)));
|
|
153
|
-
};
|
|
154
|
-
exports.globby = globby;
|
|
155
|
-
const globbySync = (patterns, options) => {
|
|
156
|
-
const globTasks = generateGlobTasks(patterns, options);
|
|
157
|
-
const tasks = [];
|
|
158
|
-
for (const task of globTasks) {
|
|
159
|
-
const newTask = getPattern(task, _dirGlob.default.sync).map(globToTaskSync(task));
|
|
160
|
-
tasks.push(...newTask);
|
|
161
|
-
}
|
|
162
|
-
const filter = getFilterSync(options);
|
|
163
|
-
let matches = [];
|
|
164
|
-
for (const task of tasks) {
|
|
165
|
-
matches = (0, _index.default)(matches, _fastGlob.default.sync(task.pattern, task.options));
|
|
166
|
-
}
|
|
167
|
-
return matches.filter(path_ => !filter(path_));
|
|
168
|
-
};
|
|
169
|
-
exports.globbySync = globbySync;
|
|
170
|
-
const globbyStream = (patterns, options) => {
|
|
171
|
-
const globTasks = generateGlobTasks(patterns, options);
|
|
172
|
-
const tasks = [];
|
|
173
|
-
for (const task of globTasks) {
|
|
174
|
-
const newTask = getPattern(task, _dirGlob.default.sync).map(globToTaskSync(task));
|
|
175
|
-
tasks.push(...newTask);
|
|
176
|
-
}
|
|
177
|
-
const filter = getFilterSync(options);
|
|
178
|
-
const filterStream = new _streamUtils.FilterStream(p => !filter(p));
|
|
179
|
-
const uniqueStream = new _streamUtils.UniqueStream();
|
|
180
|
-
return (0, _merge.default)(tasks.map(task => _fastGlob.default.stream(task.pattern, task.options))).pipe(filterStream).pipe(uniqueStream);
|
|
181
|
-
};
|
|
182
|
-
exports.globbyStream = globbyStream;
|
|
183
|
-
const isDynamicPattern = function (patterns) {
|
|
184
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
185
|
-
options = {
|
|
186
|
-
...options,
|
|
187
|
-
cwd: (0, _toPath.default)(options.cwd)
|
|
188
|
-
};
|
|
189
|
-
return [patterns].flat().some(pattern => _fastGlob.default.isDynamicPattern(pattern, options));
|
|
190
|
-
};
|
|
191
|
-
exports.isDynamicPattern = isDynamicPattern;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = slash;
|
|
7
|
-
require("core-js/modules/es.string.replace.js");
|
|
8
|
-
function slash(path) {
|
|
9
|
-
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
|
|
10
|
-
const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex
|
|
11
|
-
|
|
12
|
-
if (isExtendedLengthPath || hasNonAscii) {
|
|
13
|
-
return path;
|
|
14
|
-
}
|
|
15
|
-
return path.replace(/\\/g, '/');
|
|
16
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.UniqueStream = exports.FilterStream = void 0;
|
|
7
|
-
require("core-js/modules/esnext.set.add-all.js");
|
|
8
|
-
require("core-js/modules/esnext.set.delete-all.js");
|
|
9
|
-
require("core-js/modules/esnext.set.difference.js");
|
|
10
|
-
require("core-js/modules/esnext.set.every.js");
|
|
11
|
-
require("core-js/modules/esnext.set.filter.js");
|
|
12
|
-
require("core-js/modules/esnext.set.find.js");
|
|
13
|
-
require("core-js/modules/esnext.set.intersection.js");
|
|
14
|
-
require("core-js/modules/esnext.set.is-disjoint-from.js");
|
|
15
|
-
require("core-js/modules/esnext.set.is-subset-of.js");
|
|
16
|
-
require("core-js/modules/esnext.set.is-superset-of.js");
|
|
17
|
-
require("core-js/modules/esnext.set.join.js");
|
|
18
|
-
require("core-js/modules/esnext.set.map.js");
|
|
19
|
-
require("core-js/modules/esnext.set.reduce.js");
|
|
20
|
-
require("core-js/modules/esnext.set.some.js");
|
|
21
|
-
require("core-js/modules/esnext.set.symmetric-difference.js");
|
|
22
|
-
require("core-js/modules/esnext.set.union.js");
|
|
23
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
24
|
-
var _nodeStream = require("node:stream");
|
|
25
|
-
class ObjectTransform extends _nodeStream.Transform {
|
|
26
|
-
constructor() {
|
|
27
|
-
super({
|
|
28
|
-
objectMode: true
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
class FilterStream extends ObjectTransform {
|
|
33
|
-
constructor(filter) {
|
|
34
|
-
super();
|
|
35
|
-
this._filter = filter;
|
|
36
|
-
}
|
|
37
|
-
_transform(data, encoding, callback) {
|
|
38
|
-
if (this._filter(data)) {
|
|
39
|
-
this.push(data);
|
|
40
|
-
}
|
|
41
|
-
callback();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.FilterStream = FilterStream;
|
|
45
|
-
class UniqueStream extends ObjectTransform {
|
|
46
|
-
constructor() {
|
|
47
|
-
super();
|
|
48
|
-
this._pushed = new Set();
|
|
49
|
-
}
|
|
50
|
-
_transform(data, encoding, callback) {
|
|
51
|
-
if (!this._pushed.has(data)) {
|
|
52
|
-
this.push(data);
|
|
53
|
-
this._pushed.add(data);
|
|
54
|
-
}
|
|
55
|
-
callback();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.UniqueStream = UniqueStream;
|
package/vendor/globby/to-path.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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 _nodeUrl = require("node:url");
|
|
11
|
-
const toPath = urlOrPath => {
|
|
12
|
-
if (!urlOrPath) {
|
|
13
|
-
return urlOrPath;
|
|
14
|
-
}
|
|
15
|
-
if (urlOrPath instanceof URL) {
|
|
16
|
-
urlOrPath = urlOrPath.href;
|
|
17
|
-
}
|
|
18
|
-
return urlOrPath.startsWith('file://') ? (0, _nodeUrl.fileURLToPath)(urlOrPath) : urlOrPath;
|
|
19
|
-
};
|
|
20
|
-
var _default = exports.default = toPath;
|