@datadog/esbuild-plugin 2.0.2-dev-6 → 2.0.2-dev-8
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/dist/src/index.d.ts +1 -2
- package/dist/src/index.js +254 -3530
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +255 -3531
- package/dist/src/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var fs$
|
|
3
|
+
var fs$j = require('fs');
|
|
4
4
|
var require$$0 = require('tty');
|
|
5
5
|
var require$$1 = require('util');
|
|
6
6
|
var require$$0$1 = require('os');
|
|
@@ -8,12 +8,11 @@ var child_process = require('child_process');
|
|
|
8
8
|
var node_events = require('node:events');
|
|
9
9
|
var url = require('url');
|
|
10
10
|
var require$$1$1 = require('path');
|
|
11
|
-
var require$$4 = require('events');
|
|
12
|
-
var require$$6 = require('assert');
|
|
13
11
|
var buffer$2 = require('buffer');
|
|
14
12
|
var require$$0$2 = require('stream');
|
|
15
13
|
var zlib = require('zlib');
|
|
16
14
|
var require$$0$3 = require('constants');
|
|
15
|
+
var require$$5 = require('assert');
|
|
17
16
|
var https = require('https');
|
|
18
17
|
var perf_hooks = require('perf_hooks');
|
|
19
18
|
var webpack = require('webpack');
|
|
@@ -225,11 +224,11 @@ function requireMs () {
|
|
|
225
224
|
return ms;
|
|
226
225
|
}
|
|
227
226
|
|
|
228
|
-
var common$
|
|
227
|
+
var common$1;
|
|
229
228
|
var hasRequiredCommon$1;
|
|
230
229
|
|
|
231
230
|
function requireCommon$1 () {
|
|
232
|
-
if (hasRequiredCommon$1) return common$
|
|
231
|
+
if (hasRequiredCommon$1) return common$1;
|
|
233
232
|
hasRequiredCommon$1 = 1;
|
|
234
233
|
/**
|
|
235
234
|
* This is the common logic for both the Node.js and web browser
|
|
@@ -495,8 +494,8 @@ function requireCommon$1 () {
|
|
|
495
494
|
return createDebug;
|
|
496
495
|
}
|
|
497
496
|
|
|
498
|
-
common$
|
|
499
|
-
return common$
|
|
497
|
+
common$1 = setup;
|
|
498
|
+
return common$1;
|
|
500
499
|
}
|
|
501
500
|
|
|
502
501
|
/* eslint-env browser */
|
|
@@ -1223,7 +1222,7 @@ var srcExports$1 = src$1.exports;
|
|
|
1223
1222
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1224
1223
|
};
|
|
1225
1224
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1226
|
-
const fs_1 = fs$
|
|
1225
|
+
const fs_1 = fs$j;
|
|
1227
1226
|
const debug_1 = __importDefault(srcExports$1);
|
|
1228
1227
|
const log = debug_1.default('@kwsites/file-exists');
|
|
1229
1228
|
function check(path, isFile, isDirectory) {
|
|
@@ -1288,11 +1287,11 @@ var src = {exports: {}};
|
|
|
1288
1287
|
|
|
1289
1288
|
var browser = {exports: {}};
|
|
1290
1289
|
|
|
1291
|
-
var common
|
|
1290
|
+
var common;
|
|
1292
1291
|
var hasRequiredCommon;
|
|
1293
1292
|
|
|
1294
1293
|
function requireCommon () {
|
|
1295
|
-
if (hasRequiredCommon) return common
|
|
1294
|
+
if (hasRequiredCommon) return common;
|
|
1296
1295
|
hasRequiredCommon = 1;
|
|
1297
1296
|
/**
|
|
1298
1297
|
* This is the common logic for both the Node.js and web browser
|
|
@@ -1566,8 +1565,8 @@ function requireCommon () {
|
|
|
1566
1565
|
return createDebug;
|
|
1567
1566
|
}
|
|
1568
1567
|
|
|
1569
|
-
common
|
|
1570
|
-
return common
|
|
1568
|
+
common = setup;
|
|
1569
|
+
return common;
|
|
1571
1570
|
}
|
|
1572
1571
|
|
|
1573
1572
|
/* eslint-env browser */
|
|
@@ -6790,18 +6789,20 @@ class TrackedFilesMatcher {
|
|
|
6790
6789
|
}
|
|
6791
6790
|
// Looks up the sources declared in the sourcemap and return a list of related tracked files.
|
|
6792
6791
|
matchSourcemap(srcmapPath, onSourcesNotFound) {
|
|
6793
|
-
const buff = fs$
|
|
6792
|
+
const buff = fs$j.readFileSync(srcmapPath, "utf8");
|
|
6794
6793
|
const srcmapObj = JSON.parse(buff);
|
|
6795
6794
|
if (!srcmapObj.sources) {
|
|
6795
|
+
onSourcesNotFound(`Missing 'sources' field in sourcemap.`);
|
|
6796
6796
|
return void 0;
|
|
6797
6797
|
}
|
|
6798
6798
|
const sources = srcmapObj.sources;
|
|
6799
|
-
if (
|
|
6799
|
+
if (sources.length === 0) {
|
|
6800
|
+
onSourcesNotFound(`Empty 'sources' field in sourcemap.`);
|
|
6800
6801
|
return void 0;
|
|
6801
6802
|
}
|
|
6802
6803
|
const filtered = this.matchSources(sources);
|
|
6803
6804
|
if (filtered.length === 0) {
|
|
6804
|
-
onSourcesNotFound();
|
|
6805
|
+
onSourcesNotFound(`Sources not in the tracked files.`);
|
|
6805
6806
|
return void 0;
|
|
6806
6807
|
}
|
|
6807
6808
|
return filtered;
|
|
@@ -6940,54 +6941,6 @@ const getGitPlugin = (options, context) => {
|
|
|
6940
6941
|
};
|
|
6941
6942
|
};
|
|
6942
6943
|
|
|
6943
|
-
const getGlobalContextPlugin = (opts, meta) => {
|
|
6944
|
-
const globalContext = {
|
|
6945
|
-
auth: opts.auth,
|
|
6946
|
-
cwd: process.cwd(),
|
|
6947
|
-
version: meta.version,
|
|
6948
|
-
bundler: {
|
|
6949
|
-
name: meta.framework
|
|
6950
|
-
}
|
|
6951
|
-
};
|
|
6952
|
-
const globalContextPlugin = {
|
|
6953
|
-
name: "global-context-plugin",
|
|
6954
|
-
enforce: "pre",
|
|
6955
|
-
esbuild: {
|
|
6956
|
-
setup(build) {
|
|
6957
|
-
globalContext.bundler.config = build.initialOptions;
|
|
6958
|
-
}
|
|
6959
|
-
},
|
|
6960
|
-
webpack(compiler) {
|
|
6961
|
-
globalContext.bundler.config = compiler.options;
|
|
6962
|
-
},
|
|
6963
|
-
vite: {
|
|
6964
|
-
options(options) {
|
|
6965
|
-
globalContext.bundler.config = options;
|
|
6966
|
-
}
|
|
6967
|
-
},
|
|
6968
|
-
rollup: {
|
|
6969
|
-
options(options) {
|
|
6970
|
-
globalContext.bundler.config = options;
|
|
6971
|
-
}
|
|
6972
|
-
},
|
|
6973
|
-
rspack(compiler) {
|
|
6974
|
-
globalContext.bundler.config = compiler.options;
|
|
6975
|
-
},
|
|
6976
|
-
farm: {
|
|
6977
|
-
configResolved(config) {
|
|
6978
|
-
globalContext.bundler.config = config;
|
|
6979
|
-
}
|
|
6980
|
-
}
|
|
6981
|
-
};
|
|
6982
|
-
return { globalContext, globalContextPlugin };
|
|
6983
|
-
};
|
|
6984
|
-
|
|
6985
|
-
const getInternalPlugins = (options, meta) => {
|
|
6986
|
-
const { globalContext, globalContextPlugin } = getGlobalContextPlugin(options, meta);
|
|
6987
|
-
const gitPlugin = getGitPlugin(options, globalContext);
|
|
6988
|
-
return { globalContext, internalPlugins: [globalContextPlugin, gitPlugin] };
|
|
6989
|
-
};
|
|
6990
|
-
|
|
6991
6944
|
var chalk$1 = {exports: {}};
|
|
6992
6945
|
|
|
6993
6946
|
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
|
@@ -8887,7 +8840,7 @@ const log = (text, level, type = "debug", name) => {
|
|
|
8887
8840
|
color = chalk.cyan;
|
|
8888
8841
|
logFn = console.log;
|
|
8889
8842
|
}
|
|
8890
|
-
const prefix = name ? `[${
|
|
8843
|
+
const prefix = name ? `[${type}|${name}] ` : "";
|
|
8891
8844
|
if (level === "debug" || level === "info" && ["info", "error", "warn"].includes(type) || level === "warn" && ["error", "warn"].includes(type) || level === "error" && type === "error") {
|
|
8892
8845
|
const content = typeof text === "string" ? text : JSON.stringify(text, null, 2);
|
|
8893
8846
|
logFn(`${color(prefix)}${content}`);
|
|
@@ -8895,6 +8848,82 @@ const log = (text, level, type = "debug", name) => {
|
|
|
8895
8848
|
};
|
|
8896
8849
|
const getLogger = (level = "warn", name) => (text, type = "debug") => log(text, level, type, name);
|
|
8897
8850
|
|
|
8851
|
+
const PLUGIN_NAME$2 = "global-context-plugin";
|
|
8852
|
+
const getGlobalContextPlugin = (opts, meta) => {
|
|
8853
|
+
const log = getLogger(opts.logLevel, "internal-global-context");
|
|
8854
|
+
const globalContext = {
|
|
8855
|
+
auth: opts.auth,
|
|
8856
|
+
cwd: process.cwd(),
|
|
8857
|
+
version: meta.version,
|
|
8858
|
+
outputDir: process.cwd(),
|
|
8859
|
+
bundler: {
|
|
8860
|
+
name: meta.framework
|
|
8861
|
+
}
|
|
8862
|
+
};
|
|
8863
|
+
const globalContextPlugin = {
|
|
8864
|
+
name: PLUGIN_NAME$2,
|
|
8865
|
+
enforce: "pre",
|
|
8866
|
+
esbuild: {
|
|
8867
|
+
setup(build) {
|
|
8868
|
+
globalContext.bundler.config = build.initialOptions;
|
|
8869
|
+
if (build.initialOptions.outdir) {
|
|
8870
|
+
globalContext.outputDir = build.initialOptions.outdir;
|
|
8871
|
+
}
|
|
8872
|
+
build.initialOptions.metafile = true;
|
|
8873
|
+
build.onEnd((result) => {
|
|
8874
|
+
if (!result.metafile) {
|
|
8875
|
+
log("Missing metafile from build result.", "warn");
|
|
8876
|
+
return;
|
|
8877
|
+
}
|
|
8878
|
+
const files = [];
|
|
8879
|
+
for (const [output] of Object.entries(result.metafile.outputs)) {
|
|
8880
|
+
files.push({ filepath: require$$1$1.join(globalContext.outputDir, output) });
|
|
8881
|
+
}
|
|
8882
|
+
globalContext.outputFiles = files;
|
|
8883
|
+
});
|
|
8884
|
+
}
|
|
8885
|
+
},
|
|
8886
|
+
webpack(compiler) {
|
|
8887
|
+
globalContext.bundler.config = compiler.options;
|
|
8888
|
+
if (compiler.options.output?.path) {
|
|
8889
|
+
globalContext.outputDir = compiler.options.output.path;
|
|
8890
|
+
}
|
|
8891
|
+
compiler.hooks.emit.tap(PLUGIN_NAME$2, (compilation) => {
|
|
8892
|
+
const files = [];
|
|
8893
|
+
for (const filename of Object.keys(compilation.assets)) {
|
|
8894
|
+
files.push({ filepath: require$$1$1.join(globalContext.outputDir, filename) });
|
|
8895
|
+
}
|
|
8896
|
+
globalContext.outputFiles = files;
|
|
8897
|
+
});
|
|
8898
|
+
},
|
|
8899
|
+
vite: {
|
|
8900
|
+
options(options) {
|
|
8901
|
+
globalContext.bundler.config = options;
|
|
8902
|
+
}
|
|
8903
|
+
},
|
|
8904
|
+
rollup: {
|
|
8905
|
+
options(options) {
|
|
8906
|
+
globalContext.bundler.config = options;
|
|
8907
|
+
}
|
|
8908
|
+
},
|
|
8909
|
+
rspack(compiler) {
|
|
8910
|
+
globalContext.bundler.config = compiler.options;
|
|
8911
|
+
},
|
|
8912
|
+
farm: {
|
|
8913
|
+
configResolved(config) {
|
|
8914
|
+
globalContext.bundler.config = config;
|
|
8915
|
+
}
|
|
8916
|
+
}
|
|
8917
|
+
};
|
|
8918
|
+
return { globalContext, globalContextPlugin };
|
|
8919
|
+
};
|
|
8920
|
+
|
|
8921
|
+
const getInternalPlugins = (options, meta) => {
|
|
8922
|
+
const { globalContext, globalContextPlugin } = getGlobalContextPlugin(options, meta);
|
|
8923
|
+
const gitPlugin = getGitPlugin(options, globalContext);
|
|
8924
|
+
return { globalContext, internalPlugins: [globalContextPlugin, gitPlugin] };
|
|
8925
|
+
};
|
|
8926
|
+
|
|
8898
8927
|
const CONFIG_KEY$1 = "rum";
|
|
8899
8928
|
const PLUGIN_NAME$1 = "datadog-rum-plugin";
|
|
8900
8929
|
|
|
@@ -9061,3477 +9090,169 @@ if (typeof module !== "undefined") {
|
|
|
9061
9090
|
catch (e) { }
|
|
9062
9091
|
}
|
|
9063
9092
|
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
//
|
|
9068
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
9069
|
-
// copy of this software and associated documentation files (the
|
|
9070
|
-
// "Software"), to deal in the Software without restriction, including
|
|
9071
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
9072
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
9073
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
9074
|
-
// following conditions:
|
|
9075
|
-
//
|
|
9076
|
-
// The above copyright notice and this permission notice shall be included
|
|
9077
|
-
// in all copies or substantial portions of the Software.
|
|
9078
|
-
//
|
|
9079
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
9080
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
9081
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
9082
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
9083
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
9084
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
9085
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
9086
|
-
|
|
9087
|
-
var pathModule = require$$1$1;
|
|
9088
|
-
var isWindows$1 = process.platform === 'win32';
|
|
9089
|
-
var fs$k = fs$l;
|
|
9090
|
-
|
|
9091
|
-
// JavaScript implementation of realpath, ported from node pre-v6
|
|
9092
|
-
|
|
9093
|
-
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
|
|
9094
|
-
|
|
9095
|
-
function rethrow() {
|
|
9096
|
-
// Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
|
|
9097
|
-
// is fairly slow to generate.
|
|
9098
|
-
var callback;
|
|
9099
|
-
if (DEBUG) {
|
|
9100
|
-
var backtrace = new Error;
|
|
9101
|
-
callback = debugCallback;
|
|
9102
|
-
} else
|
|
9103
|
-
callback = missingCallback;
|
|
9104
|
-
|
|
9105
|
-
return callback;
|
|
9106
|
-
|
|
9107
|
-
function debugCallback(err) {
|
|
9108
|
-
if (err) {
|
|
9109
|
-
backtrace.message = err.message;
|
|
9110
|
-
err = backtrace;
|
|
9111
|
-
missingCallback(err);
|
|
9112
|
-
}
|
|
9113
|
-
}
|
|
9114
|
-
|
|
9115
|
-
function missingCallback(err) {
|
|
9116
|
-
if (err) {
|
|
9117
|
-
if (process.throwDeprecation)
|
|
9118
|
-
throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs
|
|
9119
|
-
else if (!process.noDeprecation) {
|
|
9120
|
-
var msg = 'fs: missing callback ' + (err.stack || err.message);
|
|
9121
|
-
if (process.traceDeprecation)
|
|
9122
|
-
console.trace(msg);
|
|
9123
|
-
else
|
|
9124
|
-
console.error(msg);
|
|
9125
|
-
}
|
|
9126
|
-
}
|
|
9093
|
+
const decomposePath = (options, context, sourcemapFilePath) => {
|
|
9094
|
+
if (require$$1$1.extname(sourcemapFilePath) !== ".map") {
|
|
9095
|
+
throw new Error(`The file ${chalk.green.bold(sourcemapFilePath)} is not a sourcemap.`);
|
|
9127
9096
|
}
|
|
9128
|
-
|
|
9097
|
+
const minifiedFilePath = sourcemapFilePath.replace(/\.map$/, "");
|
|
9098
|
+
const relativePath = minifiedFilePath.replace(context.outputDir, "");
|
|
9099
|
+
const minifiedUrl = options.minifiedPathPrefix ? require$$1$1.join(options.minifiedPathPrefix, relativePath) : relativePath;
|
|
9100
|
+
return {
|
|
9101
|
+
minifiedFilePath,
|
|
9102
|
+
minifiedUrl,
|
|
9103
|
+
relativePath
|
|
9104
|
+
};
|
|
9105
|
+
};
|
|
9106
|
+
const getSourcemapsFiles = (options, context) => {
|
|
9107
|
+
if (!context.outputFiles || context.outputFiles.length === 0) {
|
|
9108
|
+
throw new Error("No output files found.");
|
|
9109
|
+
}
|
|
9110
|
+
const sourcemapFilesList = context.outputFiles.filter((file) => file.filepath.endsWith(".map")).map((file) => file.filepath);
|
|
9111
|
+
const sourcemapFiles = sourcemapFilesList.map((sourcemapFilePath) => {
|
|
9112
|
+
return {
|
|
9113
|
+
...decomposePath(options, context, sourcemapFilePath),
|
|
9114
|
+
sourcemapFilePath,
|
|
9115
|
+
minifiedPathPrefix: options.minifiedPathPrefix
|
|
9116
|
+
};
|
|
9117
|
+
});
|
|
9118
|
+
return sourcemapFiles;
|
|
9119
|
+
};
|
|
9129
9120
|
|
|
9130
|
-
|
|
9131
|
-
return typeof cb === 'function' ? cb : rethrow();
|
|
9132
|
-
}
|
|
9121
|
+
var retry$4 = {};
|
|
9133
9122
|
|
|
9134
|
-
|
|
9123
|
+
function RetryOperation(timeouts, options) {
|
|
9124
|
+
// Compatibility for the old (timeouts, retryForever) signature
|
|
9125
|
+
if (typeof options === 'boolean') {
|
|
9126
|
+
options = { forever: options };
|
|
9127
|
+
}
|
|
9135
9128
|
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9129
|
+
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
9130
|
+
this._timeouts = timeouts;
|
|
9131
|
+
this._options = options || {};
|
|
9132
|
+
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
9133
|
+
this._fn = null;
|
|
9134
|
+
this._errors = [];
|
|
9135
|
+
this._attempts = 1;
|
|
9136
|
+
this._operationTimeout = null;
|
|
9137
|
+
this._operationTimeoutCb = null;
|
|
9138
|
+
this._timeout = null;
|
|
9139
|
+
this._operationStart = null;
|
|
9140
|
+
this._timer = null;
|
|
9143
9141
|
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
} else {
|
|
9148
|
-
var splitRootRe = /^[\/]*/;
|
|
9142
|
+
if (this._options.forever) {
|
|
9143
|
+
this._cachedTimeouts = this._timeouts.slice(0);
|
|
9144
|
+
}
|
|
9149
9145
|
}
|
|
9146
|
+
var retry_operation = RetryOperation;
|
|
9150
9147
|
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9148
|
+
RetryOperation.prototype.reset = function() {
|
|
9149
|
+
this._attempts = 1;
|
|
9150
|
+
this._timeouts = this._originalTimeouts.slice(0);
|
|
9151
|
+
};
|
|
9154
9152
|
|
|
9155
|
-
|
|
9156
|
-
|
|
9153
|
+
RetryOperation.prototype.stop = function() {
|
|
9154
|
+
if (this._timeout) {
|
|
9155
|
+
clearTimeout(this._timeout);
|
|
9156
|
+
}
|
|
9157
|
+
if (this._timer) {
|
|
9158
|
+
clearTimeout(this._timer);
|
|
9157
9159
|
}
|
|
9158
9160
|
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9161
|
+
this._timeouts = [];
|
|
9162
|
+
this._cachedTimeouts = null;
|
|
9163
|
+
};
|
|
9162
9164
|
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
|
|
9167
|
-
// the partial path without a trailing slash (except when pointing at a root)
|
|
9168
|
-
var base;
|
|
9169
|
-
// the partial path scanned in the previous round, with slash
|
|
9170
|
-
var previous;
|
|
9165
|
+
RetryOperation.prototype.retry = function(err) {
|
|
9166
|
+
if (this._timeout) {
|
|
9167
|
+
clearTimeout(this._timeout);
|
|
9168
|
+
}
|
|
9171
9169
|
|
|
9172
|
-
|
|
9170
|
+
if (!err) {
|
|
9171
|
+
return false;
|
|
9172
|
+
}
|
|
9173
|
+
var currentTime = new Date().getTime();
|
|
9174
|
+
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
9175
|
+
this._errors.push(err);
|
|
9176
|
+
this._errors.unshift(new Error('RetryOperation timeout occurred'));
|
|
9177
|
+
return false;
|
|
9178
|
+
}
|
|
9173
9179
|
|
|
9174
|
-
|
|
9175
|
-
// Skip over roots
|
|
9176
|
-
var m = splitRootRe.exec(p);
|
|
9177
|
-
pos = m[0].length;
|
|
9178
|
-
current = m[0];
|
|
9179
|
-
base = m[0];
|
|
9180
|
-
previous = '';
|
|
9180
|
+
this._errors.push(err);
|
|
9181
9181
|
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9182
|
+
var timeout = this._timeouts.shift();
|
|
9183
|
+
if (timeout === undefined) {
|
|
9184
|
+
if (this._cachedTimeouts) {
|
|
9185
|
+
// retry forever, only keep last error
|
|
9186
|
+
this._errors.splice(0, this._errors.length - 1);
|
|
9187
|
+
timeout = this._cachedTimeouts.slice(-1);
|
|
9188
|
+
} else {
|
|
9189
|
+
return false;
|
|
9186
9190
|
}
|
|
9187
9191
|
}
|
|
9188
9192
|
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
while (pos < p.length) {
|
|
9193
|
-
// find the next part
|
|
9194
|
-
nextPartRe.lastIndex = pos;
|
|
9195
|
-
var result = nextPartRe.exec(p);
|
|
9196
|
-
previous = current;
|
|
9197
|
-
current += result[0];
|
|
9198
|
-
base = previous + result[1];
|
|
9199
|
-
pos = nextPartRe.lastIndex;
|
|
9200
|
-
|
|
9201
|
-
// continue if not a symlink
|
|
9202
|
-
if (knownHard[base] || (cache && cache[base] === base)) {
|
|
9203
|
-
continue;
|
|
9204
|
-
}
|
|
9193
|
+
var self = this;
|
|
9194
|
+
this._timer = setTimeout(function() {
|
|
9195
|
+
self._attempts++;
|
|
9205
9196
|
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
|
|
9209
|
-
|
|
9210
|
-
} else {
|
|
9211
|
-
var stat = fs$k.lstatSync(base);
|
|
9212
|
-
if (!stat.isSymbolicLink()) {
|
|
9213
|
-
knownHard[base] = true;
|
|
9214
|
-
if (cache) cache[base] = base;
|
|
9215
|
-
continue;
|
|
9216
|
-
}
|
|
9197
|
+
if (self._operationTimeoutCb) {
|
|
9198
|
+
self._timeout = setTimeout(function() {
|
|
9199
|
+
self._operationTimeoutCb(self._attempts);
|
|
9200
|
+
}, self._operationTimeout);
|
|
9217
9201
|
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
var linkTarget = null;
|
|
9221
|
-
if (!isWindows$1) {
|
|
9222
|
-
var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
|
|
9223
|
-
if (seenLinks.hasOwnProperty(id)) {
|
|
9224
|
-
linkTarget = seenLinks[id];
|
|
9225
|
-
}
|
|
9226
|
-
}
|
|
9227
|
-
if (linkTarget === null) {
|
|
9228
|
-
fs$k.statSync(base);
|
|
9229
|
-
linkTarget = fs$k.readlinkSync(base);
|
|
9202
|
+
if (self._options.unref) {
|
|
9203
|
+
self._timeout.unref();
|
|
9230
9204
|
}
|
|
9231
|
-
resolvedLink = pathModule.resolve(previous, linkTarget);
|
|
9232
|
-
// track this, if given a cache.
|
|
9233
|
-
if (cache) cache[base] = resolvedLink;
|
|
9234
|
-
if (!isWindows$1) seenLinks[id] = linkTarget;
|
|
9235
9205
|
}
|
|
9236
9206
|
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
start();
|
|
9240
|
-
}
|
|
9207
|
+
self._fn(self._attempts);
|
|
9208
|
+
}, timeout);
|
|
9241
9209
|
|
|
9242
|
-
if (
|
|
9210
|
+
if (this._options.unref) {
|
|
9211
|
+
this._timer.unref();
|
|
9212
|
+
}
|
|
9243
9213
|
|
|
9244
|
-
return
|
|
9214
|
+
return true;
|
|
9245
9215
|
};
|
|
9246
9216
|
|
|
9217
|
+
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
9218
|
+
this._fn = fn;
|
|
9247
9219
|
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9220
|
+
if (timeoutOps) {
|
|
9221
|
+
if (timeoutOps.timeout) {
|
|
9222
|
+
this._operationTimeout = timeoutOps.timeout;
|
|
9223
|
+
}
|
|
9224
|
+
if (timeoutOps.cb) {
|
|
9225
|
+
this._operationTimeoutCb = timeoutOps.cb;
|
|
9226
|
+
}
|
|
9252
9227
|
}
|
|
9253
9228
|
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9229
|
+
var self = this;
|
|
9230
|
+
if (this._operationTimeoutCb) {
|
|
9231
|
+
this._timeout = setTimeout(function() {
|
|
9232
|
+
self._operationTimeoutCb();
|
|
9233
|
+
}, self._operationTimeout);
|
|
9259
9234
|
}
|
|
9260
9235
|
|
|
9261
|
-
|
|
9262
|
-
seenLinks = {},
|
|
9263
|
-
knownHard = {};
|
|
9264
|
-
|
|
9265
|
-
// current character position in p
|
|
9266
|
-
var pos;
|
|
9267
|
-
// the partial path so far, including a trailing slash if any
|
|
9268
|
-
var current;
|
|
9269
|
-
// the partial path without a trailing slash (except when pointing at a root)
|
|
9270
|
-
var base;
|
|
9271
|
-
// the partial path scanned in the previous round, with slash
|
|
9272
|
-
var previous;
|
|
9236
|
+
this._operationStart = new Date().getTime();
|
|
9273
9237
|
|
|
9274
|
-
|
|
9238
|
+
this._fn(this._attempts);
|
|
9239
|
+
};
|
|
9275
9240
|
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
current = m[0];
|
|
9281
|
-
base = m[0];
|
|
9282
|
-
previous = '';
|
|
9241
|
+
RetryOperation.prototype.try = function(fn) {
|
|
9242
|
+
console.log('Using RetryOperation.try() is deprecated');
|
|
9243
|
+
this.attempt(fn);
|
|
9244
|
+
};
|
|
9283
9245
|
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
knownHard[base] = true;
|
|
9289
|
-
LOOP();
|
|
9290
|
-
});
|
|
9291
|
-
} else {
|
|
9292
|
-
process.nextTick(LOOP);
|
|
9293
|
-
}
|
|
9294
|
-
}
|
|
9246
|
+
RetryOperation.prototype.start = function(fn) {
|
|
9247
|
+
console.log('Using RetryOperation.start() is deprecated');
|
|
9248
|
+
this.attempt(fn);
|
|
9249
|
+
};
|
|
9295
9250
|
|
|
9296
|
-
|
|
9297
|
-
// values
|
|
9298
|
-
function LOOP() {
|
|
9299
|
-
// stop if scanned past end of path
|
|
9300
|
-
if (pos >= p.length) {
|
|
9301
|
-
if (cache) cache[original] = p;
|
|
9302
|
-
return cb(null, p);
|
|
9303
|
-
}
|
|
9251
|
+
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
9304
9252
|
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
previous = current;
|
|
9309
|
-
current += result[0];
|
|
9310
|
-
base = previous + result[1];
|
|
9311
|
-
pos = nextPartRe.lastIndex;
|
|
9312
|
-
|
|
9313
|
-
// continue if not a symlink
|
|
9314
|
-
if (knownHard[base] || (cache && cache[base] === base)) {
|
|
9315
|
-
return process.nextTick(LOOP);
|
|
9316
|
-
}
|
|
9317
|
-
|
|
9318
|
-
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
9319
|
-
// known symbolic link. no need to stat again.
|
|
9320
|
-
return gotResolvedLink(cache[base]);
|
|
9321
|
-
}
|
|
9322
|
-
|
|
9323
|
-
return fs$k.lstat(base, gotStat);
|
|
9324
|
-
}
|
|
9325
|
-
|
|
9326
|
-
function gotStat(err, stat) {
|
|
9327
|
-
if (err) return cb(err);
|
|
9328
|
-
|
|
9329
|
-
// if not a symlink, skip to the next path part
|
|
9330
|
-
if (!stat.isSymbolicLink()) {
|
|
9331
|
-
knownHard[base] = true;
|
|
9332
|
-
if (cache) cache[base] = base;
|
|
9333
|
-
return process.nextTick(LOOP);
|
|
9334
|
-
}
|
|
9335
|
-
|
|
9336
|
-
// stat & read the link if not read before
|
|
9337
|
-
// call gotTarget as soon as the link target is known
|
|
9338
|
-
// dev/ino always return 0 on windows, so skip the check.
|
|
9339
|
-
if (!isWindows$1) {
|
|
9340
|
-
var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
|
|
9341
|
-
if (seenLinks.hasOwnProperty(id)) {
|
|
9342
|
-
return gotTarget(null, seenLinks[id], base);
|
|
9343
|
-
}
|
|
9344
|
-
}
|
|
9345
|
-
fs$k.stat(base, function(err) {
|
|
9346
|
-
if (err) return cb(err);
|
|
9347
|
-
|
|
9348
|
-
fs$k.readlink(base, function(err, target) {
|
|
9349
|
-
if (!isWindows$1) seenLinks[id] = target;
|
|
9350
|
-
gotTarget(err, target);
|
|
9351
|
-
});
|
|
9352
|
-
});
|
|
9353
|
-
}
|
|
9354
|
-
|
|
9355
|
-
function gotTarget(err, target, base) {
|
|
9356
|
-
if (err) return cb(err);
|
|
9357
|
-
|
|
9358
|
-
var resolvedLink = pathModule.resolve(previous, target);
|
|
9359
|
-
if (cache) cache[base] = resolvedLink;
|
|
9360
|
-
gotResolvedLink(resolvedLink);
|
|
9361
|
-
}
|
|
9362
|
-
|
|
9363
|
-
function gotResolvedLink(resolvedLink) {
|
|
9364
|
-
// resolve the link, then start over
|
|
9365
|
-
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
|
9366
|
-
start();
|
|
9367
|
-
}
|
|
9368
|
-
};
|
|
9369
|
-
|
|
9370
|
-
var fs_realpath = realpath;
|
|
9371
|
-
realpath.realpath = realpath;
|
|
9372
|
-
realpath.sync = realpathSync;
|
|
9373
|
-
realpath.realpathSync = realpathSync;
|
|
9374
|
-
realpath.monkeypatch = monkeypatch;
|
|
9375
|
-
realpath.unmonkeypatch = unmonkeypatch;
|
|
9376
|
-
|
|
9377
|
-
var fs$j = fs$l;
|
|
9378
|
-
var origRealpath = fs$j.realpath;
|
|
9379
|
-
var origRealpathSync = fs$j.realpathSync;
|
|
9380
|
-
|
|
9381
|
-
var version$2 = process.version;
|
|
9382
|
-
var ok = /^v[0-5]\./.test(version$2);
|
|
9383
|
-
var old = old$1;
|
|
9384
|
-
|
|
9385
|
-
function newError (er) {
|
|
9386
|
-
return er && er.syscall === 'realpath' && (
|
|
9387
|
-
er.code === 'ELOOP' ||
|
|
9388
|
-
er.code === 'ENOMEM' ||
|
|
9389
|
-
er.code === 'ENAMETOOLONG'
|
|
9390
|
-
)
|
|
9391
|
-
}
|
|
9392
|
-
|
|
9393
|
-
function realpath (p, cache, cb) {
|
|
9394
|
-
if (ok) {
|
|
9395
|
-
return origRealpath(p, cache, cb)
|
|
9396
|
-
}
|
|
9397
|
-
|
|
9398
|
-
if (typeof cache === 'function') {
|
|
9399
|
-
cb = cache;
|
|
9400
|
-
cache = null;
|
|
9401
|
-
}
|
|
9402
|
-
origRealpath(p, cache, function (er, result) {
|
|
9403
|
-
if (newError(er)) {
|
|
9404
|
-
old.realpath(p, cache, cb);
|
|
9405
|
-
} else {
|
|
9406
|
-
cb(er, result);
|
|
9407
|
-
}
|
|
9408
|
-
});
|
|
9409
|
-
}
|
|
9410
|
-
|
|
9411
|
-
function realpathSync (p, cache) {
|
|
9412
|
-
if (ok) {
|
|
9413
|
-
return origRealpathSync(p, cache)
|
|
9414
|
-
}
|
|
9415
|
-
|
|
9416
|
-
try {
|
|
9417
|
-
return origRealpathSync(p, cache)
|
|
9418
|
-
} catch (er) {
|
|
9419
|
-
if (newError(er)) {
|
|
9420
|
-
return old.realpathSync(p, cache)
|
|
9421
|
-
} else {
|
|
9422
|
-
throw er
|
|
9423
|
-
}
|
|
9424
|
-
}
|
|
9425
|
-
}
|
|
9426
|
-
|
|
9427
|
-
function monkeypatch () {
|
|
9428
|
-
fs$j.realpath = realpath;
|
|
9429
|
-
fs$j.realpathSync = realpathSync;
|
|
9430
|
-
}
|
|
9431
|
-
|
|
9432
|
-
function unmonkeypatch () {
|
|
9433
|
-
fs$j.realpath = origRealpath;
|
|
9434
|
-
fs$j.realpathSync = origRealpathSync;
|
|
9435
|
-
}
|
|
9436
|
-
|
|
9437
|
-
var concatMap$1 = function (xs, fn) {
|
|
9438
|
-
var res = [];
|
|
9439
|
-
for (var i = 0; i < xs.length; i++) {
|
|
9440
|
-
var x = fn(xs[i], i);
|
|
9441
|
-
if (isArray$1(x)) res.push.apply(res, x);
|
|
9442
|
-
else res.push(x);
|
|
9443
|
-
}
|
|
9444
|
-
return res;
|
|
9445
|
-
};
|
|
9446
|
-
|
|
9447
|
-
var isArray$1 = Array.isArray || function (xs) {
|
|
9448
|
-
return Object.prototype.toString.call(xs) === '[object Array]';
|
|
9449
|
-
};
|
|
9450
|
-
|
|
9451
|
-
var balancedMatch = balanced$1;
|
|
9452
|
-
function balanced$1(a, b, str) {
|
|
9453
|
-
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
9454
|
-
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
9455
|
-
|
|
9456
|
-
var r = range(a, b, str);
|
|
9457
|
-
|
|
9458
|
-
return r && {
|
|
9459
|
-
start: r[0],
|
|
9460
|
-
end: r[1],
|
|
9461
|
-
pre: str.slice(0, r[0]),
|
|
9462
|
-
body: str.slice(r[0] + a.length, r[1]),
|
|
9463
|
-
post: str.slice(r[1] + b.length)
|
|
9464
|
-
};
|
|
9465
|
-
}
|
|
9466
|
-
|
|
9467
|
-
function maybeMatch(reg, str) {
|
|
9468
|
-
var m = str.match(reg);
|
|
9469
|
-
return m ? m[0] : null;
|
|
9470
|
-
}
|
|
9471
|
-
|
|
9472
|
-
balanced$1.range = range;
|
|
9473
|
-
function range(a, b, str) {
|
|
9474
|
-
var begs, beg, left, right, result;
|
|
9475
|
-
var ai = str.indexOf(a);
|
|
9476
|
-
var bi = str.indexOf(b, ai + 1);
|
|
9477
|
-
var i = ai;
|
|
9478
|
-
|
|
9479
|
-
if (ai >= 0 && bi > 0) {
|
|
9480
|
-
begs = [];
|
|
9481
|
-
left = str.length;
|
|
9482
|
-
|
|
9483
|
-
while (i >= 0 && !result) {
|
|
9484
|
-
if (i == ai) {
|
|
9485
|
-
begs.push(i);
|
|
9486
|
-
ai = str.indexOf(a, i + 1);
|
|
9487
|
-
} else if (begs.length == 1) {
|
|
9488
|
-
result = [ begs.pop(), bi ];
|
|
9489
|
-
} else {
|
|
9490
|
-
beg = begs.pop();
|
|
9491
|
-
if (beg < left) {
|
|
9492
|
-
left = beg;
|
|
9493
|
-
right = bi;
|
|
9494
|
-
}
|
|
9495
|
-
|
|
9496
|
-
bi = str.indexOf(b, i + 1);
|
|
9497
|
-
}
|
|
9498
|
-
|
|
9499
|
-
i = ai < bi && ai >= 0 ? ai : bi;
|
|
9500
|
-
}
|
|
9501
|
-
|
|
9502
|
-
if (begs.length) {
|
|
9503
|
-
result = [ left, right ];
|
|
9504
|
-
}
|
|
9505
|
-
}
|
|
9506
|
-
|
|
9507
|
-
return result;
|
|
9508
|
-
}
|
|
9509
|
-
|
|
9510
|
-
var concatMap = concatMap$1;
|
|
9511
|
-
var balanced = balancedMatch;
|
|
9512
|
-
|
|
9513
|
-
var braceExpansion = expandTop;
|
|
9514
|
-
|
|
9515
|
-
var escSlash = '\0SLASH'+Math.random()+'\0';
|
|
9516
|
-
var escOpen = '\0OPEN'+Math.random()+'\0';
|
|
9517
|
-
var escClose = '\0CLOSE'+Math.random()+'\0';
|
|
9518
|
-
var escComma = '\0COMMA'+Math.random()+'\0';
|
|
9519
|
-
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
|
9520
|
-
|
|
9521
|
-
function numeric(str) {
|
|
9522
|
-
return parseInt(str, 10) == str
|
|
9523
|
-
? parseInt(str, 10)
|
|
9524
|
-
: str.charCodeAt(0);
|
|
9525
|
-
}
|
|
9526
|
-
|
|
9527
|
-
function escapeBraces(str) {
|
|
9528
|
-
return str.split('\\\\').join(escSlash)
|
|
9529
|
-
.split('\\{').join(escOpen)
|
|
9530
|
-
.split('\\}').join(escClose)
|
|
9531
|
-
.split('\\,').join(escComma)
|
|
9532
|
-
.split('\\.').join(escPeriod);
|
|
9533
|
-
}
|
|
9534
|
-
|
|
9535
|
-
function unescapeBraces(str) {
|
|
9536
|
-
return str.split(escSlash).join('\\')
|
|
9537
|
-
.split(escOpen).join('{')
|
|
9538
|
-
.split(escClose).join('}')
|
|
9539
|
-
.split(escComma).join(',')
|
|
9540
|
-
.split(escPeriod).join('.');
|
|
9541
|
-
}
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
// Basically just str.split(","), but handling cases
|
|
9545
|
-
// where we have nested braced sections, which should be
|
|
9546
|
-
// treated as individual members, like {a,{b,c},d}
|
|
9547
|
-
function parseCommaParts(str) {
|
|
9548
|
-
if (!str)
|
|
9549
|
-
return [''];
|
|
9550
|
-
|
|
9551
|
-
var parts = [];
|
|
9552
|
-
var m = balanced('{', '}', str);
|
|
9553
|
-
|
|
9554
|
-
if (!m)
|
|
9555
|
-
return str.split(',');
|
|
9556
|
-
|
|
9557
|
-
var pre = m.pre;
|
|
9558
|
-
var body = m.body;
|
|
9559
|
-
var post = m.post;
|
|
9560
|
-
var p = pre.split(',');
|
|
9561
|
-
|
|
9562
|
-
p[p.length-1] += '{' + body + '}';
|
|
9563
|
-
var postParts = parseCommaParts(post);
|
|
9564
|
-
if (post.length) {
|
|
9565
|
-
p[p.length-1] += postParts.shift();
|
|
9566
|
-
p.push.apply(p, postParts);
|
|
9567
|
-
}
|
|
9568
|
-
|
|
9569
|
-
parts.push.apply(parts, p);
|
|
9570
|
-
|
|
9571
|
-
return parts;
|
|
9572
|
-
}
|
|
9573
|
-
|
|
9574
|
-
function expandTop(str) {
|
|
9575
|
-
if (!str)
|
|
9576
|
-
return [];
|
|
9577
|
-
|
|
9578
|
-
// I don't know why Bash 4.3 does this, but it does.
|
|
9579
|
-
// Anything starting with {} will have the first two bytes preserved
|
|
9580
|
-
// but *only* at the top level, so {},a}b will not expand to anything,
|
|
9581
|
-
// but a{},b}c will be expanded to [a}c,abc].
|
|
9582
|
-
// One could argue that this is a bug in Bash, but since the goal of
|
|
9583
|
-
// this module is to match Bash's rules, we escape a leading {}
|
|
9584
|
-
if (str.substr(0, 2) === '{}') {
|
|
9585
|
-
str = '\\{\\}' + str.substr(2);
|
|
9586
|
-
}
|
|
9587
|
-
|
|
9588
|
-
return expand$1(escapeBraces(str), true).map(unescapeBraces);
|
|
9589
|
-
}
|
|
9590
|
-
|
|
9591
|
-
function embrace(str) {
|
|
9592
|
-
return '{' + str + '}';
|
|
9593
|
-
}
|
|
9594
|
-
function isPadded(el) {
|
|
9595
|
-
return /^-?0\d/.test(el);
|
|
9596
|
-
}
|
|
9597
|
-
|
|
9598
|
-
function lte(i, y) {
|
|
9599
|
-
return i <= y;
|
|
9600
|
-
}
|
|
9601
|
-
function gte(i, y) {
|
|
9602
|
-
return i >= y;
|
|
9603
|
-
}
|
|
9604
|
-
|
|
9605
|
-
function expand$1(str, isTop) {
|
|
9606
|
-
var expansions = [];
|
|
9607
|
-
|
|
9608
|
-
var m = balanced('{', '}', str);
|
|
9609
|
-
if (!m || /\$$/.test(m.pre)) return [str];
|
|
9610
|
-
|
|
9611
|
-
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
9612
|
-
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
9613
|
-
var isSequence = isNumericSequence || isAlphaSequence;
|
|
9614
|
-
var isOptions = m.body.indexOf(',') >= 0;
|
|
9615
|
-
if (!isSequence && !isOptions) {
|
|
9616
|
-
// {a},b}
|
|
9617
|
-
if (m.post.match(/,.*\}/)) {
|
|
9618
|
-
str = m.pre + '{' + m.body + escClose + m.post;
|
|
9619
|
-
return expand$1(str);
|
|
9620
|
-
}
|
|
9621
|
-
return [str];
|
|
9622
|
-
}
|
|
9623
|
-
|
|
9624
|
-
var n;
|
|
9625
|
-
if (isSequence) {
|
|
9626
|
-
n = m.body.split(/\.\./);
|
|
9627
|
-
} else {
|
|
9628
|
-
n = parseCommaParts(m.body);
|
|
9629
|
-
if (n.length === 1) {
|
|
9630
|
-
// x{{a,b}}y ==> x{a}y x{b}y
|
|
9631
|
-
n = expand$1(n[0], false).map(embrace);
|
|
9632
|
-
if (n.length === 1) {
|
|
9633
|
-
var post = m.post.length
|
|
9634
|
-
? expand$1(m.post, false)
|
|
9635
|
-
: [''];
|
|
9636
|
-
return post.map(function(p) {
|
|
9637
|
-
return m.pre + n[0] + p;
|
|
9638
|
-
});
|
|
9639
|
-
}
|
|
9640
|
-
}
|
|
9641
|
-
}
|
|
9642
|
-
|
|
9643
|
-
// at this point, n is the parts, and we know it's not a comma set
|
|
9644
|
-
// with a single entry.
|
|
9645
|
-
|
|
9646
|
-
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
|
9647
|
-
var pre = m.pre;
|
|
9648
|
-
var post = m.post.length
|
|
9649
|
-
? expand$1(m.post, false)
|
|
9650
|
-
: [''];
|
|
9651
|
-
|
|
9652
|
-
var N;
|
|
9653
|
-
|
|
9654
|
-
if (isSequence) {
|
|
9655
|
-
var x = numeric(n[0]);
|
|
9656
|
-
var y = numeric(n[1]);
|
|
9657
|
-
var width = Math.max(n[0].length, n[1].length);
|
|
9658
|
-
var incr = n.length == 3
|
|
9659
|
-
? Math.abs(numeric(n[2]))
|
|
9660
|
-
: 1;
|
|
9661
|
-
var test = lte;
|
|
9662
|
-
var reverse = y < x;
|
|
9663
|
-
if (reverse) {
|
|
9664
|
-
incr *= -1;
|
|
9665
|
-
test = gte;
|
|
9666
|
-
}
|
|
9667
|
-
var pad = n.some(isPadded);
|
|
9668
|
-
|
|
9669
|
-
N = [];
|
|
9670
|
-
|
|
9671
|
-
for (var i = x; test(i, y); i += incr) {
|
|
9672
|
-
var c;
|
|
9673
|
-
if (isAlphaSequence) {
|
|
9674
|
-
c = String.fromCharCode(i);
|
|
9675
|
-
if (c === '\\')
|
|
9676
|
-
c = '';
|
|
9677
|
-
} else {
|
|
9678
|
-
c = String(i);
|
|
9679
|
-
if (pad) {
|
|
9680
|
-
var need = width - c.length;
|
|
9681
|
-
if (need > 0) {
|
|
9682
|
-
var z = new Array(need + 1).join('0');
|
|
9683
|
-
if (i < 0)
|
|
9684
|
-
c = '-' + z + c.slice(1);
|
|
9685
|
-
else
|
|
9686
|
-
c = z + c;
|
|
9687
|
-
}
|
|
9688
|
-
}
|
|
9689
|
-
}
|
|
9690
|
-
N.push(c);
|
|
9691
|
-
}
|
|
9692
|
-
} else {
|
|
9693
|
-
N = concatMap(n, function(el) { return expand$1(el, false) });
|
|
9694
|
-
}
|
|
9695
|
-
|
|
9696
|
-
for (var j = 0; j < N.length; j++) {
|
|
9697
|
-
for (var k = 0; k < post.length; k++) {
|
|
9698
|
-
var expansion = pre + N[j] + post[k];
|
|
9699
|
-
if (!isTop || isSequence || expansion)
|
|
9700
|
-
expansions.push(expansion);
|
|
9701
|
-
}
|
|
9702
|
-
}
|
|
9703
|
-
|
|
9704
|
-
return expansions;
|
|
9705
|
-
}
|
|
9706
|
-
|
|
9707
|
-
var minimatch_1 = minimatch$1;
|
|
9708
|
-
minimatch$1.Minimatch = Minimatch$1;
|
|
9709
|
-
|
|
9710
|
-
var path$i = { sep: '/' };
|
|
9711
|
-
try {
|
|
9712
|
-
path$i = require('path');
|
|
9713
|
-
} catch (er) {}
|
|
9714
|
-
|
|
9715
|
-
var GLOBSTAR = minimatch$1.GLOBSTAR = Minimatch$1.GLOBSTAR = {};
|
|
9716
|
-
var expand = braceExpansion;
|
|
9717
|
-
|
|
9718
|
-
var plTypes = {
|
|
9719
|
-
'!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
|
|
9720
|
-
'?': { open: '(?:', close: ')?' },
|
|
9721
|
-
'+': { open: '(?:', close: ')+' },
|
|
9722
|
-
'*': { open: '(?:', close: ')*' },
|
|
9723
|
-
'@': { open: '(?:', close: ')' }
|
|
9724
|
-
};
|
|
9725
|
-
|
|
9726
|
-
// any single thing other than /
|
|
9727
|
-
// don't need to escape / when using new RegExp()
|
|
9728
|
-
var qmark = '[^/]';
|
|
9729
|
-
|
|
9730
|
-
// * => any number of characters
|
|
9731
|
-
var star = qmark + '*?';
|
|
9732
|
-
|
|
9733
|
-
// ** when dots are allowed. Anything goes, except .. and .
|
|
9734
|
-
// not (^ or / followed by one or two dots followed by $ or /),
|
|
9735
|
-
// followed by anything, any number of times.
|
|
9736
|
-
var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?';
|
|
9737
|
-
|
|
9738
|
-
// not a ^ or / followed by a dot,
|
|
9739
|
-
// followed by anything, any number of times.
|
|
9740
|
-
var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?';
|
|
9741
|
-
|
|
9742
|
-
// characters that need to be escaped in RegExp.
|
|
9743
|
-
var reSpecials = charSet('().*{}+?[]^$\\!');
|
|
9744
|
-
|
|
9745
|
-
// "abc" -> { a:true, b:true, c:true }
|
|
9746
|
-
function charSet (s) {
|
|
9747
|
-
return s.split('').reduce(function (set, c) {
|
|
9748
|
-
set[c] = true;
|
|
9749
|
-
return set
|
|
9750
|
-
}, {})
|
|
9751
|
-
}
|
|
9752
|
-
|
|
9753
|
-
// normalizes slashes.
|
|
9754
|
-
var slashSplit = /\/+/;
|
|
9755
|
-
|
|
9756
|
-
minimatch$1.filter = filter;
|
|
9757
|
-
function filter (pattern, options) {
|
|
9758
|
-
options = options || {};
|
|
9759
|
-
return function (p, i, list) {
|
|
9760
|
-
return minimatch$1(p, pattern, options)
|
|
9761
|
-
}
|
|
9762
|
-
}
|
|
9763
|
-
|
|
9764
|
-
function ext (a, b) {
|
|
9765
|
-
a = a || {};
|
|
9766
|
-
b = b || {};
|
|
9767
|
-
var t = {};
|
|
9768
|
-
Object.keys(b).forEach(function (k) {
|
|
9769
|
-
t[k] = b[k];
|
|
9770
|
-
});
|
|
9771
|
-
Object.keys(a).forEach(function (k) {
|
|
9772
|
-
t[k] = a[k];
|
|
9773
|
-
});
|
|
9774
|
-
return t
|
|
9775
|
-
}
|
|
9776
|
-
|
|
9777
|
-
minimatch$1.defaults = function (def) {
|
|
9778
|
-
if (!def || !Object.keys(def).length) return minimatch$1
|
|
9779
|
-
|
|
9780
|
-
var orig = minimatch$1;
|
|
9781
|
-
|
|
9782
|
-
var m = function minimatch (p, pattern, options) {
|
|
9783
|
-
return orig.minimatch(p, pattern, ext(def, options))
|
|
9784
|
-
};
|
|
9785
|
-
|
|
9786
|
-
m.Minimatch = function Minimatch (pattern, options) {
|
|
9787
|
-
return new orig.Minimatch(pattern, ext(def, options))
|
|
9788
|
-
};
|
|
9789
|
-
|
|
9790
|
-
return m
|
|
9791
|
-
};
|
|
9792
|
-
|
|
9793
|
-
Minimatch$1.defaults = function (def) {
|
|
9794
|
-
if (!def || !Object.keys(def).length) return Minimatch$1
|
|
9795
|
-
return minimatch$1.defaults(def).Minimatch
|
|
9796
|
-
};
|
|
9797
|
-
|
|
9798
|
-
function minimatch$1 (p, pattern, options) {
|
|
9799
|
-
if (typeof pattern !== 'string') {
|
|
9800
|
-
throw new TypeError('glob pattern string required')
|
|
9801
|
-
}
|
|
9802
|
-
|
|
9803
|
-
if (!options) options = {};
|
|
9804
|
-
|
|
9805
|
-
// shortcut: comments match nothing.
|
|
9806
|
-
if (!options.nocomment && pattern.charAt(0) === '#') {
|
|
9807
|
-
return false
|
|
9808
|
-
}
|
|
9809
|
-
|
|
9810
|
-
// "" only matches ""
|
|
9811
|
-
if (pattern.trim() === '') return p === ''
|
|
9812
|
-
|
|
9813
|
-
return new Minimatch$1(pattern, options).match(p)
|
|
9814
|
-
}
|
|
9815
|
-
|
|
9816
|
-
function Minimatch$1 (pattern, options) {
|
|
9817
|
-
if (!(this instanceof Minimatch$1)) {
|
|
9818
|
-
return new Minimatch$1(pattern, options)
|
|
9819
|
-
}
|
|
9820
|
-
|
|
9821
|
-
if (typeof pattern !== 'string') {
|
|
9822
|
-
throw new TypeError('glob pattern string required')
|
|
9823
|
-
}
|
|
9824
|
-
|
|
9825
|
-
if (!options) options = {};
|
|
9826
|
-
pattern = pattern.trim();
|
|
9827
|
-
|
|
9828
|
-
// windows support: need to use /, not \
|
|
9829
|
-
if (path$i.sep !== '/') {
|
|
9830
|
-
pattern = pattern.split(path$i.sep).join('/');
|
|
9831
|
-
}
|
|
9832
|
-
|
|
9833
|
-
this.options = options;
|
|
9834
|
-
this.set = [];
|
|
9835
|
-
this.pattern = pattern;
|
|
9836
|
-
this.regexp = null;
|
|
9837
|
-
this.negate = false;
|
|
9838
|
-
this.comment = false;
|
|
9839
|
-
this.empty = false;
|
|
9840
|
-
|
|
9841
|
-
// make the set of regexps etc.
|
|
9842
|
-
this.make();
|
|
9843
|
-
}
|
|
9844
|
-
|
|
9845
|
-
Minimatch$1.prototype.debug = function () {};
|
|
9846
|
-
|
|
9847
|
-
Minimatch$1.prototype.make = make;
|
|
9848
|
-
function make () {
|
|
9849
|
-
// don't do it more than once.
|
|
9850
|
-
if (this._made) return
|
|
9851
|
-
|
|
9852
|
-
var pattern = this.pattern;
|
|
9853
|
-
var options = this.options;
|
|
9854
|
-
|
|
9855
|
-
// empty patterns and comments match nothing.
|
|
9856
|
-
if (!options.nocomment && pattern.charAt(0) === '#') {
|
|
9857
|
-
this.comment = true;
|
|
9858
|
-
return
|
|
9859
|
-
}
|
|
9860
|
-
if (!pattern) {
|
|
9861
|
-
this.empty = true;
|
|
9862
|
-
return
|
|
9863
|
-
}
|
|
9864
|
-
|
|
9865
|
-
// step 1: figure out negation, etc.
|
|
9866
|
-
this.parseNegate();
|
|
9867
|
-
|
|
9868
|
-
// step 2: expand braces
|
|
9869
|
-
var set = this.globSet = this.braceExpand();
|
|
9870
|
-
|
|
9871
|
-
if (options.debug) this.debug = console.error;
|
|
9872
|
-
|
|
9873
|
-
this.debug(this.pattern, set);
|
|
9874
|
-
|
|
9875
|
-
// step 3: now we have a set, so turn each one into a series of path-portion
|
|
9876
|
-
// matching patterns.
|
|
9877
|
-
// These will be regexps, except in the case of "**", which is
|
|
9878
|
-
// set to the GLOBSTAR object for globstar behavior,
|
|
9879
|
-
// and will not contain any / characters
|
|
9880
|
-
set = this.globParts = set.map(function (s) {
|
|
9881
|
-
return s.split(slashSplit)
|
|
9882
|
-
});
|
|
9883
|
-
|
|
9884
|
-
this.debug(this.pattern, set);
|
|
9885
|
-
|
|
9886
|
-
// glob --> regexps
|
|
9887
|
-
set = set.map(function (s, si, set) {
|
|
9888
|
-
return s.map(this.parse, this)
|
|
9889
|
-
}, this);
|
|
9890
|
-
|
|
9891
|
-
this.debug(this.pattern, set);
|
|
9892
|
-
|
|
9893
|
-
// filter out everything that didn't compile properly.
|
|
9894
|
-
set = set.filter(function (s) {
|
|
9895
|
-
return s.indexOf(false) === -1
|
|
9896
|
-
});
|
|
9897
|
-
|
|
9898
|
-
this.debug(this.pattern, set);
|
|
9899
|
-
|
|
9900
|
-
this.set = set;
|
|
9901
|
-
}
|
|
9902
|
-
|
|
9903
|
-
Minimatch$1.prototype.parseNegate = parseNegate;
|
|
9904
|
-
function parseNegate () {
|
|
9905
|
-
var pattern = this.pattern;
|
|
9906
|
-
var negate = false;
|
|
9907
|
-
var options = this.options;
|
|
9908
|
-
var negateOffset = 0;
|
|
9909
|
-
|
|
9910
|
-
if (options.nonegate) return
|
|
9911
|
-
|
|
9912
|
-
for (var i = 0, l = pattern.length
|
|
9913
|
-
; i < l && pattern.charAt(i) === '!'
|
|
9914
|
-
; i++) {
|
|
9915
|
-
negate = !negate;
|
|
9916
|
-
negateOffset++;
|
|
9917
|
-
}
|
|
9918
|
-
|
|
9919
|
-
if (negateOffset) this.pattern = pattern.substr(negateOffset);
|
|
9920
|
-
this.negate = negate;
|
|
9921
|
-
}
|
|
9922
|
-
|
|
9923
|
-
// Brace expansion:
|
|
9924
|
-
// a{b,c}d -> abd acd
|
|
9925
|
-
// a{b,}c -> abc ac
|
|
9926
|
-
// a{0..3}d -> a0d a1d a2d a3d
|
|
9927
|
-
// a{b,c{d,e}f}g -> abg acdfg acefg
|
|
9928
|
-
// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
|
|
9929
|
-
//
|
|
9930
|
-
// Invalid sets are not expanded.
|
|
9931
|
-
// a{2..}b -> a{2..}b
|
|
9932
|
-
// a{b}c -> a{b}c
|
|
9933
|
-
minimatch$1.braceExpand = function (pattern, options) {
|
|
9934
|
-
return braceExpand(pattern, options)
|
|
9935
|
-
};
|
|
9936
|
-
|
|
9937
|
-
Minimatch$1.prototype.braceExpand = braceExpand;
|
|
9938
|
-
|
|
9939
|
-
function braceExpand (pattern, options) {
|
|
9940
|
-
if (!options) {
|
|
9941
|
-
if (this instanceof Minimatch$1) {
|
|
9942
|
-
options = this.options;
|
|
9943
|
-
} else {
|
|
9944
|
-
options = {};
|
|
9945
|
-
}
|
|
9946
|
-
}
|
|
9947
|
-
|
|
9948
|
-
pattern = typeof pattern === 'undefined'
|
|
9949
|
-
? this.pattern : pattern;
|
|
9950
|
-
|
|
9951
|
-
if (typeof pattern === 'undefined') {
|
|
9952
|
-
throw new TypeError('undefined pattern')
|
|
9953
|
-
}
|
|
9954
|
-
|
|
9955
|
-
if (options.nobrace ||
|
|
9956
|
-
!pattern.match(/\{.*\}/)) {
|
|
9957
|
-
// shortcut. no need to expand.
|
|
9958
|
-
return [pattern]
|
|
9959
|
-
}
|
|
9960
|
-
|
|
9961
|
-
return expand(pattern)
|
|
9962
|
-
}
|
|
9963
|
-
|
|
9964
|
-
// parse a component of the expanded set.
|
|
9965
|
-
// At this point, no pattern may contain "/" in it
|
|
9966
|
-
// so we're going to return a 2d array, where each entry is the full
|
|
9967
|
-
// pattern, split on '/', and then turned into a regular expression.
|
|
9968
|
-
// A regexp is made at the end which joins each array with an
|
|
9969
|
-
// escaped /, and another full one which joins each regexp with |.
|
|
9970
|
-
//
|
|
9971
|
-
// Following the lead of Bash 4.1, note that "**" only has special meaning
|
|
9972
|
-
// when it is the *only* thing in a path portion. Otherwise, any series
|
|
9973
|
-
// of * is equivalent to a single *. Globstar behavior is enabled by
|
|
9974
|
-
// default, and can be disabled by setting options.noglobstar.
|
|
9975
|
-
Minimatch$1.prototype.parse = parse;
|
|
9976
|
-
var SUBPARSE = {};
|
|
9977
|
-
function parse (pattern, isSub) {
|
|
9978
|
-
if (pattern.length > 1024 * 64) {
|
|
9979
|
-
throw new TypeError('pattern is too long')
|
|
9980
|
-
}
|
|
9981
|
-
|
|
9982
|
-
var options = this.options;
|
|
9983
|
-
|
|
9984
|
-
// shortcuts
|
|
9985
|
-
if (!options.noglobstar && pattern === '**') return GLOBSTAR
|
|
9986
|
-
if (pattern === '') return ''
|
|
9987
|
-
|
|
9988
|
-
var re = '';
|
|
9989
|
-
var hasMagic = !!options.nocase;
|
|
9990
|
-
var escaping = false;
|
|
9991
|
-
// ? => one single character
|
|
9992
|
-
var patternListStack = [];
|
|
9993
|
-
var negativeLists = [];
|
|
9994
|
-
var stateChar;
|
|
9995
|
-
var inClass = false;
|
|
9996
|
-
var reClassStart = -1;
|
|
9997
|
-
var classStart = -1;
|
|
9998
|
-
// . and .. never match anything that doesn't start with .,
|
|
9999
|
-
// even when options.dot is set.
|
|
10000
|
-
var patternStart = pattern.charAt(0) === '.' ? '' // anything
|
|
10001
|
-
// not (start or / followed by . or .. followed by / or end)
|
|
10002
|
-
: options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
|
|
10003
|
-
: '(?!\\.)';
|
|
10004
|
-
var self = this;
|
|
10005
|
-
|
|
10006
|
-
function clearStateChar () {
|
|
10007
|
-
if (stateChar) {
|
|
10008
|
-
// we had some state-tracking character
|
|
10009
|
-
// that wasn't consumed by this pass.
|
|
10010
|
-
switch (stateChar) {
|
|
10011
|
-
case '*':
|
|
10012
|
-
re += star;
|
|
10013
|
-
hasMagic = true;
|
|
10014
|
-
break
|
|
10015
|
-
case '?':
|
|
10016
|
-
re += qmark;
|
|
10017
|
-
hasMagic = true;
|
|
10018
|
-
break
|
|
10019
|
-
default:
|
|
10020
|
-
re += '\\' + stateChar;
|
|
10021
|
-
break
|
|
10022
|
-
}
|
|
10023
|
-
self.debug('clearStateChar %j %j', stateChar, re);
|
|
10024
|
-
stateChar = false;
|
|
10025
|
-
}
|
|
10026
|
-
}
|
|
10027
|
-
|
|
10028
|
-
for (var i = 0, len = pattern.length, c
|
|
10029
|
-
; (i < len) && (c = pattern.charAt(i))
|
|
10030
|
-
; i++) {
|
|
10031
|
-
this.debug('%s\t%s %s %j', pattern, i, re, c);
|
|
10032
|
-
|
|
10033
|
-
// skip over any that are escaped.
|
|
10034
|
-
if (escaping && reSpecials[c]) {
|
|
10035
|
-
re += '\\' + c;
|
|
10036
|
-
escaping = false;
|
|
10037
|
-
continue
|
|
10038
|
-
}
|
|
10039
|
-
|
|
10040
|
-
switch (c) {
|
|
10041
|
-
case '/':
|
|
10042
|
-
// completely not allowed, even escaped.
|
|
10043
|
-
// Should already be path-split by now.
|
|
10044
|
-
return false
|
|
10045
|
-
|
|
10046
|
-
case '\\':
|
|
10047
|
-
clearStateChar();
|
|
10048
|
-
escaping = true;
|
|
10049
|
-
continue
|
|
10050
|
-
|
|
10051
|
-
// the various stateChar values
|
|
10052
|
-
// for the "extglob" stuff.
|
|
10053
|
-
case '?':
|
|
10054
|
-
case '*':
|
|
10055
|
-
case '+':
|
|
10056
|
-
case '@':
|
|
10057
|
-
case '!':
|
|
10058
|
-
this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c);
|
|
10059
|
-
|
|
10060
|
-
// all of those are literals inside a class, except that
|
|
10061
|
-
// the glob [!a] means [^a] in regexp
|
|
10062
|
-
if (inClass) {
|
|
10063
|
-
this.debug(' in class');
|
|
10064
|
-
if (c === '!' && i === classStart + 1) c = '^';
|
|
10065
|
-
re += c;
|
|
10066
|
-
continue
|
|
10067
|
-
}
|
|
10068
|
-
|
|
10069
|
-
// if we already have a stateChar, then it means
|
|
10070
|
-
// that there was something like ** or +? in there.
|
|
10071
|
-
// Handle the stateChar, then proceed with this one.
|
|
10072
|
-
self.debug('call clearStateChar %j', stateChar);
|
|
10073
|
-
clearStateChar();
|
|
10074
|
-
stateChar = c;
|
|
10075
|
-
// if extglob is disabled, then +(asdf|foo) isn't a thing.
|
|
10076
|
-
// just clear the statechar *now*, rather than even diving into
|
|
10077
|
-
// the patternList stuff.
|
|
10078
|
-
if (options.noext) clearStateChar();
|
|
10079
|
-
continue
|
|
10080
|
-
|
|
10081
|
-
case '(':
|
|
10082
|
-
if (inClass) {
|
|
10083
|
-
re += '(';
|
|
10084
|
-
continue
|
|
10085
|
-
}
|
|
10086
|
-
|
|
10087
|
-
if (!stateChar) {
|
|
10088
|
-
re += '\\(';
|
|
10089
|
-
continue
|
|
10090
|
-
}
|
|
10091
|
-
|
|
10092
|
-
patternListStack.push({
|
|
10093
|
-
type: stateChar,
|
|
10094
|
-
start: i - 1,
|
|
10095
|
-
reStart: re.length,
|
|
10096
|
-
open: plTypes[stateChar].open,
|
|
10097
|
-
close: plTypes[stateChar].close
|
|
10098
|
-
});
|
|
10099
|
-
// negation is (?:(?!js)[^/]*)
|
|
10100
|
-
re += stateChar === '!' ? '(?:(?!(?:' : '(?:';
|
|
10101
|
-
this.debug('plType %j %j', stateChar, re);
|
|
10102
|
-
stateChar = false;
|
|
10103
|
-
continue
|
|
10104
|
-
|
|
10105
|
-
case ')':
|
|
10106
|
-
if (inClass || !patternListStack.length) {
|
|
10107
|
-
re += '\\)';
|
|
10108
|
-
continue
|
|
10109
|
-
}
|
|
10110
|
-
|
|
10111
|
-
clearStateChar();
|
|
10112
|
-
hasMagic = true;
|
|
10113
|
-
var pl = patternListStack.pop();
|
|
10114
|
-
// negation is (?:(?!js)[^/]*)
|
|
10115
|
-
// The others are (?:<pattern>)<type>
|
|
10116
|
-
re += pl.close;
|
|
10117
|
-
if (pl.type === '!') {
|
|
10118
|
-
negativeLists.push(pl);
|
|
10119
|
-
}
|
|
10120
|
-
pl.reEnd = re.length;
|
|
10121
|
-
continue
|
|
10122
|
-
|
|
10123
|
-
case '|':
|
|
10124
|
-
if (inClass || !patternListStack.length || escaping) {
|
|
10125
|
-
re += '\\|';
|
|
10126
|
-
escaping = false;
|
|
10127
|
-
continue
|
|
10128
|
-
}
|
|
10129
|
-
|
|
10130
|
-
clearStateChar();
|
|
10131
|
-
re += '|';
|
|
10132
|
-
continue
|
|
10133
|
-
|
|
10134
|
-
// these are mostly the same in regexp and glob
|
|
10135
|
-
case '[':
|
|
10136
|
-
// swallow any state-tracking char before the [
|
|
10137
|
-
clearStateChar();
|
|
10138
|
-
|
|
10139
|
-
if (inClass) {
|
|
10140
|
-
re += '\\' + c;
|
|
10141
|
-
continue
|
|
10142
|
-
}
|
|
10143
|
-
|
|
10144
|
-
inClass = true;
|
|
10145
|
-
classStart = i;
|
|
10146
|
-
reClassStart = re.length;
|
|
10147
|
-
re += c;
|
|
10148
|
-
continue
|
|
10149
|
-
|
|
10150
|
-
case ']':
|
|
10151
|
-
// a right bracket shall lose its special
|
|
10152
|
-
// meaning and represent itself in
|
|
10153
|
-
// a bracket expression if it occurs
|
|
10154
|
-
// first in the list. -- POSIX.2 2.8.3.2
|
|
10155
|
-
if (i === classStart + 1 || !inClass) {
|
|
10156
|
-
re += '\\' + c;
|
|
10157
|
-
escaping = false;
|
|
10158
|
-
continue
|
|
10159
|
-
}
|
|
10160
|
-
|
|
10161
|
-
// handle the case where we left a class open.
|
|
10162
|
-
// "[z-a]" is valid, equivalent to "\[z-a\]"
|
|
10163
|
-
if (inClass) {
|
|
10164
|
-
// split where the last [ was, make sure we don't have
|
|
10165
|
-
// an invalid re. if so, re-walk the contents of the
|
|
10166
|
-
// would-be class to re-translate any characters that
|
|
10167
|
-
// were passed through as-is
|
|
10168
|
-
// TODO: It would probably be faster to determine this
|
|
10169
|
-
// without a try/catch and a new RegExp, but it's tricky
|
|
10170
|
-
// to do safely. For now, this is safe and works.
|
|
10171
|
-
var cs = pattern.substring(classStart + 1, i);
|
|
10172
|
-
try {
|
|
10173
|
-
RegExp('[' + cs + ']');
|
|
10174
|
-
} catch (er) {
|
|
10175
|
-
// not a valid class!
|
|
10176
|
-
var sp = this.parse(cs, SUBPARSE);
|
|
10177
|
-
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]';
|
|
10178
|
-
hasMagic = hasMagic || sp[1];
|
|
10179
|
-
inClass = false;
|
|
10180
|
-
continue
|
|
10181
|
-
}
|
|
10182
|
-
}
|
|
10183
|
-
|
|
10184
|
-
// finish up the class.
|
|
10185
|
-
hasMagic = true;
|
|
10186
|
-
inClass = false;
|
|
10187
|
-
re += c;
|
|
10188
|
-
continue
|
|
10189
|
-
|
|
10190
|
-
default:
|
|
10191
|
-
// swallow any state char that wasn't consumed
|
|
10192
|
-
clearStateChar();
|
|
10193
|
-
|
|
10194
|
-
if (escaping) {
|
|
10195
|
-
// no need
|
|
10196
|
-
escaping = false;
|
|
10197
|
-
} else if (reSpecials[c]
|
|
10198
|
-
&& !(c === '^' && inClass)) {
|
|
10199
|
-
re += '\\';
|
|
10200
|
-
}
|
|
10201
|
-
|
|
10202
|
-
re += c;
|
|
10203
|
-
|
|
10204
|
-
} // switch
|
|
10205
|
-
} // for
|
|
10206
|
-
|
|
10207
|
-
// handle the case where we left a class open.
|
|
10208
|
-
// "[abc" is valid, equivalent to "\[abc"
|
|
10209
|
-
if (inClass) {
|
|
10210
|
-
// split where the last [ was, and escape it
|
|
10211
|
-
// this is a huge pita. We now have to re-walk
|
|
10212
|
-
// the contents of the would-be class to re-translate
|
|
10213
|
-
// any characters that were passed through as-is
|
|
10214
|
-
cs = pattern.substr(classStart + 1);
|
|
10215
|
-
sp = this.parse(cs, SUBPARSE);
|
|
10216
|
-
re = re.substr(0, reClassStart) + '\\[' + sp[0];
|
|
10217
|
-
hasMagic = hasMagic || sp[1];
|
|
10218
|
-
}
|
|
10219
|
-
|
|
10220
|
-
// handle the case where we had a +( thing at the *end*
|
|
10221
|
-
// of the pattern.
|
|
10222
|
-
// each pattern list stack adds 3 chars, and we need to go through
|
|
10223
|
-
// and escape any | chars that were passed through as-is for the regexp.
|
|
10224
|
-
// Go through and escape them, taking care not to double-escape any
|
|
10225
|
-
// | chars that were already escaped.
|
|
10226
|
-
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
10227
|
-
var tail = re.slice(pl.reStart + pl.open.length);
|
|
10228
|
-
this.debug('setting tail', re, pl);
|
|
10229
|
-
// maybe some even number of \, then maybe 1 \, followed by a |
|
|
10230
|
-
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
|
|
10231
|
-
if (!$2) {
|
|
10232
|
-
// the | isn't already escaped, so escape it.
|
|
10233
|
-
$2 = '\\';
|
|
10234
|
-
}
|
|
10235
|
-
|
|
10236
|
-
// need to escape all those slashes *again*, without escaping the
|
|
10237
|
-
// one that we need for escaping the | character. As it works out,
|
|
10238
|
-
// escaping an even number of slashes can be done by simply repeating
|
|
10239
|
-
// it exactly after itself. That's why this trick works.
|
|
10240
|
-
//
|
|
10241
|
-
// I am sorry that you have to see this.
|
|
10242
|
-
return $1 + $1 + $2 + '|'
|
|
10243
|
-
});
|
|
10244
|
-
|
|
10245
|
-
this.debug('tail=%j\n %s', tail, tail, pl, re);
|
|
10246
|
-
var t = pl.type === '*' ? star
|
|
10247
|
-
: pl.type === '?' ? qmark
|
|
10248
|
-
: '\\' + pl.type;
|
|
10249
|
-
|
|
10250
|
-
hasMagic = true;
|
|
10251
|
-
re = re.slice(0, pl.reStart) + t + '\\(' + tail;
|
|
10252
|
-
}
|
|
10253
|
-
|
|
10254
|
-
// handle trailing things that only matter at the very end.
|
|
10255
|
-
clearStateChar();
|
|
10256
|
-
if (escaping) {
|
|
10257
|
-
// trailing \\
|
|
10258
|
-
re += '\\\\';
|
|
10259
|
-
}
|
|
10260
|
-
|
|
10261
|
-
// only need to apply the nodot start if the re starts with
|
|
10262
|
-
// something that could conceivably capture a dot
|
|
10263
|
-
var addPatternStart = false;
|
|
10264
|
-
switch (re.charAt(0)) {
|
|
10265
|
-
case '.':
|
|
10266
|
-
case '[':
|
|
10267
|
-
case '(': addPatternStart = true;
|
|
10268
|
-
}
|
|
10269
|
-
|
|
10270
|
-
// Hack to work around lack of negative lookbehind in JS
|
|
10271
|
-
// A pattern like: *.!(x).!(y|z) needs to ensure that a name
|
|
10272
|
-
// like 'a.xyz.yz' doesn't match. So, the first negative
|
|
10273
|
-
// lookahead, has to look ALL the way ahead, to the end of
|
|
10274
|
-
// the pattern.
|
|
10275
|
-
for (var n = negativeLists.length - 1; n > -1; n--) {
|
|
10276
|
-
var nl = negativeLists[n];
|
|
10277
|
-
|
|
10278
|
-
var nlBefore = re.slice(0, nl.reStart);
|
|
10279
|
-
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
|
|
10280
|
-
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
|
|
10281
|
-
var nlAfter = re.slice(nl.reEnd);
|
|
10282
|
-
|
|
10283
|
-
nlLast += nlAfter;
|
|
10284
|
-
|
|
10285
|
-
// Handle nested stuff like *(*.js|!(*.json)), where open parens
|
|
10286
|
-
// mean that we should *not* include the ) in the bit that is considered
|
|
10287
|
-
// "after" the negated section.
|
|
10288
|
-
var openParensBefore = nlBefore.split('(').length - 1;
|
|
10289
|
-
var cleanAfter = nlAfter;
|
|
10290
|
-
for (i = 0; i < openParensBefore; i++) {
|
|
10291
|
-
cleanAfter = cleanAfter.replace(/\)[+*?]?/, '');
|
|
10292
|
-
}
|
|
10293
|
-
nlAfter = cleanAfter;
|
|
10294
|
-
|
|
10295
|
-
var dollar = '';
|
|
10296
|
-
if (nlAfter === '' && isSub !== SUBPARSE) {
|
|
10297
|
-
dollar = '$';
|
|
10298
|
-
}
|
|
10299
|
-
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
|
|
10300
|
-
re = newRe;
|
|
10301
|
-
}
|
|
10302
|
-
|
|
10303
|
-
// if the re is not "" at this point, then we need to make sure
|
|
10304
|
-
// it doesn't match against an empty path part.
|
|
10305
|
-
// Otherwise a/* will match a/, which it should not.
|
|
10306
|
-
if (re !== '' && hasMagic) {
|
|
10307
|
-
re = '(?=.)' + re;
|
|
10308
|
-
}
|
|
10309
|
-
|
|
10310
|
-
if (addPatternStart) {
|
|
10311
|
-
re = patternStart + re;
|
|
10312
|
-
}
|
|
10313
|
-
|
|
10314
|
-
// parsing just a piece of a larger pattern.
|
|
10315
|
-
if (isSub === SUBPARSE) {
|
|
10316
|
-
return [re, hasMagic]
|
|
10317
|
-
}
|
|
10318
|
-
|
|
10319
|
-
// skip the regexp for non-magical patterns
|
|
10320
|
-
// unescape anything in it, though, so that it'll be
|
|
10321
|
-
// an exact match against a file etc.
|
|
10322
|
-
if (!hasMagic) {
|
|
10323
|
-
return globUnescape(pattern)
|
|
10324
|
-
}
|
|
10325
|
-
|
|
10326
|
-
var flags = options.nocase ? 'i' : '';
|
|
10327
|
-
try {
|
|
10328
|
-
var regExp = new RegExp('^' + re + '$', flags);
|
|
10329
|
-
} catch (er) {
|
|
10330
|
-
// If it was an invalid regular expression, then it can't match
|
|
10331
|
-
// anything. This trick looks for a character after the end of
|
|
10332
|
-
// the string, which is of course impossible, except in multi-line
|
|
10333
|
-
// mode, but it's not a /m regex.
|
|
10334
|
-
return new RegExp('$.')
|
|
10335
|
-
}
|
|
10336
|
-
|
|
10337
|
-
regExp._glob = pattern;
|
|
10338
|
-
regExp._src = re;
|
|
10339
|
-
|
|
10340
|
-
return regExp
|
|
10341
|
-
}
|
|
10342
|
-
|
|
10343
|
-
minimatch$1.makeRe = function (pattern, options) {
|
|
10344
|
-
return new Minimatch$1(pattern, options || {}).makeRe()
|
|
10345
|
-
};
|
|
10346
|
-
|
|
10347
|
-
Minimatch$1.prototype.makeRe = makeRe;
|
|
10348
|
-
function makeRe () {
|
|
10349
|
-
if (this.regexp || this.regexp === false) return this.regexp
|
|
10350
|
-
|
|
10351
|
-
// at this point, this.set is a 2d array of partial
|
|
10352
|
-
// pattern strings, or "**".
|
|
10353
|
-
//
|
|
10354
|
-
// It's better to use .match(). This function shouldn't
|
|
10355
|
-
// be used, really, but it's pretty convenient sometimes,
|
|
10356
|
-
// when you just want to work with a regex.
|
|
10357
|
-
var set = this.set;
|
|
10358
|
-
|
|
10359
|
-
if (!set.length) {
|
|
10360
|
-
this.regexp = false;
|
|
10361
|
-
return this.regexp
|
|
10362
|
-
}
|
|
10363
|
-
var options = this.options;
|
|
10364
|
-
|
|
10365
|
-
var twoStar = options.noglobstar ? star
|
|
10366
|
-
: options.dot ? twoStarDot
|
|
10367
|
-
: twoStarNoDot;
|
|
10368
|
-
var flags = options.nocase ? 'i' : '';
|
|
10369
|
-
|
|
10370
|
-
var re = set.map(function (pattern) {
|
|
10371
|
-
return pattern.map(function (p) {
|
|
10372
|
-
return (p === GLOBSTAR) ? twoStar
|
|
10373
|
-
: (typeof p === 'string') ? regExpEscape(p)
|
|
10374
|
-
: p._src
|
|
10375
|
-
}).join('\\\/')
|
|
10376
|
-
}).join('|');
|
|
10377
|
-
|
|
10378
|
-
// must match entire pattern
|
|
10379
|
-
// ending in a * or ** will make it less strict.
|
|
10380
|
-
re = '^(?:' + re + ')$';
|
|
10381
|
-
|
|
10382
|
-
// can match anything, as long as it's not this.
|
|
10383
|
-
if (this.negate) re = '^(?!' + re + ').*$';
|
|
10384
|
-
|
|
10385
|
-
try {
|
|
10386
|
-
this.regexp = new RegExp(re, flags);
|
|
10387
|
-
} catch (ex) {
|
|
10388
|
-
this.regexp = false;
|
|
10389
|
-
}
|
|
10390
|
-
return this.regexp
|
|
10391
|
-
}
|
|
10392
|
-
|
|
10393
|
-
minimatch$1.match = function (list, pattern, options) {
|
|
10394
|
-
options = options || {};
|
|
10395
|
-
var mm = new Minimatch$1(pattern, options);
|
|
10396
|
-
list = list.filter(function (f) {
|
|
10397
|
-
return mm.match(f)
|
|
10398
|
-
});
|
|
10399
|
-
if (mm.options.nonull && !list.length) {
|
|
10400
|
-
list.push(pattern);
|
|
10401
|
-
}
|
|
10402
|
-
return list
|
|
10403
|
-
};
|
|
10404
|
-
|
|
10405
|
-
Minimatch$1.prototype.match = match;
|
|
10406
|
-
function match (f, partial) {
|
|
10407
|
-
this.debug('match', f, this.pattern);
|
|
10408
|
-
// short-circuit in the case of busted things.
|
|
10409
|
-
// comments, etc.
|
|
10410
|
-
if (this.comment) return false
|
|
10411
|
-
if (this.empty) return f === ''
|
|
10412
|
-
|
|
10413
|
-
if (f === '/' && partial) return true
|
|
10414
|
-
|
|
10415
|
-
var options = this.options;
|
|
10416
|
-
|
|
10417
|
-
// windows: need to use /, not \
|
|
10418
|
-
if (path$i.sep !== '/') {
|
|
10419
|
-
f = f.split(path$i.sep).join('/');
|
|
10420
|
-
}
|
|
10421
|
-
|
|
10422
|
-
// treat the test path as a set of pathparts.
|
|
10423
|
-
f = f.split(slashSplit);
|
|
10424
|
-
this.debug(this.pattern, 'split', f);
|
|
10425
|
-
|
|
10426
|
-
// just ONE of the pattern sets in this.set needs to match
|
|
10427
|
-
// in order for it to be valid. If negating, then just one
|
|
10428
|
-
// match means that we have failed.
|
|
10429
|
-
// Either way, return on the first hit.
|
|
10430
|
-
|
|
10431
|
-
var set = this.set;
|
|
10432
|
-
this.debug(this.pattern, 'set', set);
|
|
10433
|
-
|
|
10434
|
-
// Find the basename of the path by looking for the last non-empty segment
|
|
10435
|
-
var filename;
|
|
10436
|
-
var i;
|
|
10437
|
-
for (i = f.length - 1; i >= 0; i--) {
|
|
10438
|
-
filename = f[i];
|
|
10439
|
-
if (filename) break
|
|
10440
|
-
}
|
|
10441
|
-
|
|
10442
|
-
for (i = 0; i < set.length; i++) {
|
|
10443
|
-
var pattern = set[i];
|
|
10444
|
-
var file = f;
|
|
10445
|
-
if (options.matchBase && pattern.length === 1) {
|
|
10446
|
-
file = [filename];
|
|
10447
|
-
}
|
|
10448
|
-
var hit = this.matchOne(file, pattern, partial);
|
|
10449
|
-
if (hit) {
|
|
10450
|
-
if (options.flipNegate) return true
|
|
10451
|
-
return !this.negate
|
|
10452
|
-
}
|
|
10453
|
-
}
|
|
10454
|
-
|
|
10455
|
-
// didn't get any hits. this is success if it's a negative
|
|
10456
|
-
// pattern, failure otherwise.
|
|
10457
|
-
if (options.flipNegate) return false
|
|
10458
|
-
return this.negate
|
|
10459
|
-
}
|
|
10460
|
-
|
|
10461
|
-
// set partial to true to test if, for example,
|
|
10462
|
-
// "/a/b" matches the start of "/*/b/*/d"
|
|
10463
|
-
// Partial means, if you run out of file before you run
|
|
10464
|
-
// out of pattern, then that's fine, as long as all
|
|
10465
|
-
// the parts match.
|
|
10466
|
-
Minimatch$1.prototype.matchOne = function (file, pattern, partial) {
|
|
10467
|
-
var options = this.options;
|
|
10468
|
-
|
|
10469
|
-
this.debug('matchOne',
|
|
10470
|
-
{ 'this': this, file: file, pattern: pattern });
|
|
10471
|
-
|
|
10472
|
-
this.debug('matchOne', file.length, pattern.length);
|
|
10473
|
-
|
|
10474
|
-
for (var fi = 0,
|
|
10475
|
-
pi = 0,
|
|
10476
|
-
fl = file.length,
|
|
10477
|
-
pl = pattern.length
|
|
10478
|
-
; (fi < fl) && (pi < pl)
|
|
10479
|
-
; fi++, pi++) {
|
|
10480
|
-
this.debug('matchOne loop');
|
|
10481
|
-
var p = pattern[pi];
|
|
10482
|
-
var f = file[fi];
|
|
10483
|
-
|
|
10484
|
-
this.debug(pattern, p, f);
|
|
10485
|
-
|
|
10486
|
-
// should be impossible.
|
|
10487
|
-
// some invalid regexp stuff in the set.
|
|
10488
|
-
if (p === false) return false
|
|
10489
|
-
|
|
10490
|
-
if (p === GLOBSTAR) {
|
|
10491
|
-
this.debug('GLOBSTAR', [pattern, p, f]);
|
|
10492
|
-
|
|
10493
|
-
// "**"
|
|
10494
|
-
// a/**/b/**/c would match the following:
|
|
10495
|
-
// a/b/x/y/z/c
|
|
10496
|
-
// a/x/y/z/b/c
|
|
10497
|
-
// a/b/x/b/x/c
|
|
10498
|
-
// a/b/c
|
|
10499
|
-
// To do this, take the rest of the pattern after
|
|
10500
|
-
// the **, and see if it would match the file remainder.
|
|
10501
|
-
// If so, return success.
|
|
10502
|
-
// If not, the ** "swallows" a segment, and try again.
|
|
10503
|
-
// This is recursively awful.
|
|
10504
|
-
//
|
|
10505
|
-
// a/**/b/**/c matching a/b/x/y/z/c
|
|
10506
|
-
// - a matches a
|
|
10507
|
-
// - doublestar
|
|
10508
|
-
// - matchOne(b/x/y/z/c, b/**/c)
|
|
10509
|
-
// - b matches b
|
|
10510
|
-
// - doublestar
|
|
10511
|
-
// - matchOne(x/y/z/c, c) -> no
|
|
10512
|
-
// - matchOne(y/z/c, c) -> no
|
|
10513
|
-
// - matchOne(z/c, c) -> no
|
|
10514
|
-
// - matchOne(c, c) yes, hit
|
|
10515
|
-
var fr = fi;
|
|
10516
|
-
var pr = pi + 1;
|
|
10517
|
-
if (pr === pl) {
|
|
10518
|
-
this.debug('** at the end');
|
|
10519
|
-
// a ** at the end will just swallow the rest.
|
|
10520
|
-
// We have found a match.
|
|
10521
|
-
// however, it will not swallow /.x, unless
|
|
10522
|
-
// options.dot is set.
|
|
10523
|
-
// . and .. are *never* matched by **, for explosively
|
|
10524
|
-
// exponential reasons.
|
|
10525
|
-
for (; fi < fl; fi++) {
|
|
10526
|
-
if (file[fi] === '.' || file[fi] === '..' ||
|
|
10527
|
-
(!options.dot && file[fi].charAt(0) === '.')) return false
|
|
10528
|
-
}
|
|
10529
|
-
return true
|
|
10530
|
-
}
|
|
10531
|
-
|
|
10532
|
-
// ok, let's see if we can swallow whatever we can.
|
|
10533
|
-
while (fr < fl) {
|
|
10534
|
-
var swallowee = file[fr];
|
|
10535
|
-
|
|
10536
|
-
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
|
|
10537
|
-
|
|
10538
|
-
// XXX remove this slice. Just pass the start index.
|
|
10539
|
-
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
10540
|
-
this.debug('globstar found match!', fr, fl, swallowee);
|
|
10541
|
-
// found a match.
|
|
10542
|
-
return true
|
|
10543
|
-
} else {
|
|
10544
|
-
// can't swallow "." or ".." ever.
|
|
10545
|
-
// can only swallow ".foo" when explicitly asked.
|
|
10546
|
-
if (swallowee === '.' || swallowee === '..' ||
|
|
10547
|
-
(!options.dot && swallowee.charAt(0) === '.')) {
|
|
10548
|
-
this.debug('dot detected!', file, fr, pattern, pr);
|
|
10549
|
-
break
|
|
10550
|
-
}
|
|
10551
|
-
|
|
10552
|
-
// ** swallows a segment, and continue.
|
|
10553
|
-
this.debug('globstar swallow a segment, and continue');
|
|
10554
|
-
fr++;
|
|
10555
|
-
}
|
|
10556
|
-
}
|
|
10557
|
-
|
|
10558
|
-
// no match was found.
|
|
10559
|
-
// However, in partial mode, we can't say this is necessarily over.
|
|
10560
|
-
// If there's more *pattern* left, then
|
|
10561
|
-
if (partial) {
|
|
10562
|
-
// ran out of file
|
|
10563
|
-
this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
|
|
10564
|
-
if (fr === fl) return true
|
|
10565
|
-
}
|
|
10566
|
-
return false
|
|
10567
|
-
}
|
|
10568
|
-
|
|
10569
|
-
// something other than **
|
|
10570
|
-
// non-magic patterns just have to match exactly
|
|
10571
|
-
// patterns with magic have been turned into regexps.
|
|
10572
|
-
var hit;
|
|
10573
|
-
if (typeof p === 'string') {
|
|
10574
|
-
if (options.nocase) {
|
|
10575
|
-
hit = f.toLowerCase() === p.toLowerCase();
|
|
10576
|
-
} else {
|
|
10577
|
-
hit = f === p;
|
|
10578
|
-
}
|
|
10579
|
-
this.debug('string match', p, f, hit);
|
|
10580
|
-
} else {
|
|
10581
|
-
hit = f.match(p);
|
|
10582
|
-
this.debug('pattern match', p, f, hit);
|
|
10583
|
-
}
|
|
10584
|
-
|
|
10585
|
-
if (!hit) return false
|
|
10586
|
-
}
|
|
10587
|
-
|
|
10588
|
-
// Note: ending in / means that we'll get a final ""
|
|
10589
|
-
// at the end of the pattern. This can only match a
|
|
10590
|
-
// corresponding "" at the end of the file.
|
|
10591
|
-
// If the file ends in /, then it can only match a
|
|
10592
|
-
// a pattern that ends in /, unless the pattern just
|
|
10593
|
-
// doesn't have any more for it. But, a/b/ should *not*
|
|
10594
|
-
// match "a/b/*", even though "" matches against the
|
|
10595
|
-
// [^/]*? pattern, except in partial mode, where it might
|
|
10596
|
-
// simply not be reached yet.
|
|
10597
|
-
// However, a/b/ should still satisfy a/*
|
|
10598
|
-
|
|
10599
|
-
// now either we fell off the end of the pattern, or we're done.
|
|
10600
|
-
if (fi === fl && pi === pl) {
|
|
10601
|
-
// ran out of pattern and filename at the same time.
|
|
10602
|
-
// an exact hit!
|
|
10603
|
-
return true
|
|
10604
|
-
} else if (fi === fl) {
|
|
10605
|
-
// ran out of file, but still had pattern left.
|
|
10606
|
-
// this is ok if we're doing the match as part of
|
|
10607
|
-
// a glob fs traversal.
|
|
10608
|
-
return partial
|
|
10609
|
-
} else if (pi === pl) {
|
|
10610
|
-
// ran out of pattern, still have file left.
|
|
10611
|
-
// this is only acceptable if we're on the very last
|
|
10612
|
-
// empty segment of a file with a trailing slash.
|
|
10613
|
-
// a/* should match a/b/
|
|
10614
|
-
var emptyFileEnd = (fi === fl - 1) && (file[fi] === '');
|
|
10615
|
-
return emptyFileEnd
|
|
10616
|
-
}
|
|
10617
|
-
|
|
10618
|
-
// should be unreachable.
|
|
10619
|
-
throw new Error('wtf?')
|
|
10620
|
-
};
|
|
10621
|
-
|
|
10622
|
-
// replace stuff like \* with *
|
|
10623
|
-
function globUnescape (s) {
|
|
10624
|
-
return s.replace(/\\(.)/g, '$1')
|
|
10625
|
-
}
|
|
10626
|
-
|
|
10627
|
-
function regExpEscape (s) {
|
|
10628
|
-
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
|
|
10629
|
-
}
|
|
10630
|
-
|
|
10631
|
-
var inherits = {exports: {}};
|
|
10632
|
-
|
|
10633
|
-
var inherits_browser = {exports: {}};
|
|
10634
|
-
|
|
10635
|
-
var hasRequiredInherits_browser;
|
|
10636
|
-
|
|
10637
|
-
function requireInherits_browser () {
|
|
10638
|
-
if (hasRequiredInherits_browser) return inherits_browser.exports;
|
|
10639
|
-
hasRequiredInherits_browser = 1;
|
|
10640
|
-
if (typeof Object.create === 'function') {
|
|
10641
|
-
// implementation from standard node.js 'util' module
|
|
10642
|
-
inherits_browser.exports = function inherits(ctor, superCtor) {
|
|
10643
|
-
if (superCtor) {
|
|
10644
|
-
ctor.super_ = superCtor;
|
|
10645
|
-
ctor.prototype = Object.create(superCtor.prototype, {
|
|
10646
|
-
constructor: {
|
|
10647
|
-
value: ctor,
|
|
10648
|
-
enumerable: false,
|
|
10649
|
-
writable: true,
|
|
10650
|
-
configurable: true
|
|
10651
|
-
}
|
|
10652
|
-
});
|
|
10653
|
-
}
|
|
10654
|
-
};
|
|
10655
|
-
} else {
|
|
10656
|
-
// old school shim for old browsers
|
|
10657
|
-
inherits_browser.exports = function inherits(ctor, superCtor) {
|
|
10658
|
-
if (superCtor) {
|
|
10659
|
-
ctor.super_ = superCtor;
|
|
10660
|
-
var TempCtor = function () {};
|
|
10661
|
-
TempCtor.prototype = superCtor.prototype;
|
|
10662
|
-
ctor.prototype = new TempCtor();
|
|
10663
|
-
ctor.prototype.constructor = ctor;
|
|
10664
|
-
}
|
|
10665
|
-
};
|
|
10666
|
-
}
|
|
10667
|
-
return inherits_browser.exports;
|
|
10668
|
-
}
|
|
10669
|
-
|
|
10670
|
-
try {
|
|
10671
|
-
var util$1 = require('util');
|
|
10672
|
-
/* istanbul ignore next */
|
|
10673
|
-
if (typeof util$1.inherits !== 'function') throw '';
|
|
10674
|
-
inherits.exports = util$1.inherits;
|
|
10675
|
-
} catch (e) {
|
|
10676
|
-
/* istanbul ignore next */
|
|
10677
|
-
inherits.exports = requireInherits_browser();
|
|
10678
|
-
}
|
|
10679
|
-
|
|
10680
|
-
var inheritsExports = inherits.exports;
|
|
10681
|
-
|
|
10682
|
-
var pathIsAbsolute = {exports: {}};
|
|
10683
|
-
|
|
10684
|
-
function posix(path) {
|
|
10685
|
-
return path.charAt(0) === '/';
|
|
10686
|
-
}
|
|
10687
|
-
|
|
10688
|
-
function win32$1(path) {
|
|
10689
|
-
// https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
|
|
10690
|
-
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
|
10691
|
-
var result = splitDeviceRe.exec(path);
|
|
10692
|
-
var device = result[1] || '';
|
|
10693
|
-
var isUnc = Boolean(device && device.charAt(1) !== ':');
|
|
10694
|
-
|
|
10695
|
-
// UNC paths are always absolute
|
|
10696
|
-
return Boolean(result[2] || isUnc);
|
|
10697
|
-
}
|
|
10698
|
-
|
|
10699
|
-
pathIsAbsolute.exports = process.platform === 'win32' ? win32$1 : posix;
|
|
10700
|
-
pathIsAbsolute.exports.posix = posix;
|
|
10701
|
-
pathIsAbsolute.exports.win32 = win32$1;
|
|
10702
|
-
|
|
10703
|
-
var pathIsAbsoluteExports = pathIsAbsolute.exports;
|
|
10704
|
-
|
|
10705
|
-
var common = {};
|
|
10706
|
-
|
|
10707
|
-
common.alphasort = alphasort;
|
|
10708
|
-
common.alphasorti = alphasorti;
|
|
10709
|
-
common.setopts = setopts;
|
|
10710
|
-
common.ownProp = ownProp;
|
|
10711
|
-
common.makeAbs = makeAbs;
|
|
10712
|
-
common.finish = finish;
|
|
10713
|
-
common.mark = mark;
|
|
10714
|
-
common.isIgnored = isIgnored;
|
|
10715
|
-
common.childrenIgnored = childrenIgnored;
|
|
10716
|
-
|
|
10717
|
-
function ownProp (obj, field) {
|
|
10718
|
-
return Object.prototype.hasOwnProperty.call(obj, field)
|
|
10719
|
-
}
|
|
10720
|
-
|
|
10721
|
-
var path$h = require$$1$1;
|
|
10722
|
-
var minimatch = minimatch_1;
|
|
10723
|
-
var isAbsolute = pathIsAbsoluteExports;
|
|
10724
|
-
var Minimatch = minimatch.Minimatch;
|
|
10725
|
-
|
|
10726
|
-
function alphasorti (a, b) {
|
|
10727
|
-
return a.toLowerCase().localeCompare(b.toLowerCase())
|
|
10728
|
-
}
|
|
10729
|
-
|
|
10730
|
-
function alphasort (a, b) {
|
|
10731
|
-
return a.localeCompare(b)
|
|
10732
|
-
}
|
|
10733
|
-
|
|
10734
|
-
function setupIgnores (self, options) {
|
|
10735
|
-
self.ignore = options.ignore || [];
|
|
10736
|
-
|
|
10737
|
-
if (!Array.isArray(self.ignore))
|
|
10738
|
-
self.ignore = [self.ignore];
|
|
10739
|
-
|
|
10740
|
-
if (self.ignore.length) {
|
|
10741
|
-
self.ignore = self.ignore.map(ignoreMap);
|
|
10742
|
-
}
|
|
10743
|
-
}
|
|
10744
|
-
|
|
10745
|
-
// ignore patterns are always in dot:true mode.
|
|
10746
|
-
function ignoreMap (pattern) {
|
|
10747
|
-
var gmatcher = null;
|
|
10748
|
-
if (pattern.slice(-3) === '/**') {
|
|
10749
|
-
var gpattern = pattern.replace(/(\/\*\*)+$/, '');
|
|
10750
|
-
gmatcher = new Minimatch(gpattern, { dot: true });
|
|
10751
|
-
}
|
|
10752
|
-
|
|
10753
|
-
return {
|
|
10754
|
-
matcher: new Minimatch(pattern, { dot: true }),
|
|
10755
|
-
gmatcher: gmatcher
|
|
10756
|
-
}
|
|
10757
|
-
}
|
|
10758
|
-
|
|
10759
|
-
function setopts (self, pattern, options) {
|
|
10760
|
-
if (!options)
|
|
10761
|
-
options = {};
|
|
10762
|
-
|
|
10763
|
-
// base-matching: just use globstar for that.
|
|
10764
|
-
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
|
10765
|
-
if (options.noglobstar) {
|
|
10766
|
-
throw new Error("base matching requires globstar")
|
|
10767
|
-
}
|
|
10768
|
-
pattern = "**/" + pattern;
|
|
10769
|
-
}
|
|
10770
|
-
|
|
10771
|
-
self.silent = !!options.silent;
|
|
10772
|
-
self.pattern = pattern;
|
|
10773
|
-
self.strict = options.strict !== false;
|
|
10774
|
-
self.realpath = !!options.realpath;
|
|
10775
|
-
self.realpathCache = options.realpathCache || Object.create(null);
|
|
10776
|
-
self.follow = !!options.follow;
|
|
10777
|
-
self.dot = !!options.dot;
|
|
10778
|
-
self.mark = !!options.mark;
|
|
10779
|
-
self.nodir = !!options.nodir;
|
|
10780
|
-
if (self.nodir)
|
|
10781
|
-
self.mark = true;
|
|
10782
|
-
self.sync = !!options.sync;
|
|
10783
|
-
self.nounique = !!options.nounique;
|
|
10784
|
-
self.nonull = !!options.nonull;
|
|
10785
|
-
self.nosort = !!options.nosort;
|
|
10786
|
-
self.nocase = !!options.nocase;
|
|
10787
|
-
self.stat = !!options.stat;
|
|
10788
|
-
self.noprocess = !!options.noprocess;
|
|
10789
|
-
self.absolute = !!options.absolute;
|
|
10790
|
-
|
|
10791
|
-
self.maxLength = options.maxLength || Infinity;
|
|
10792
|
-
self.cache = options.cache || Object.create(null);
|
|
10793
|
-
self.statCache = options.statCache || Object.create(null);
|
|
10794
|
-
self.symlinks = options.symlinks || Object.create(null);
|
|
10795
|
-
|
|
10796
|
-
setupIgnores(self, options);
|
|
10797
|
-
|
|
10798
|
-
self.changedCwd = false;
|
|
10799
|
-
var cwd = process.cwd();
|
|
10800
|
-
if (!ownProp(options, "cwd"))
|
|
10801
|
-
self.cwd = cwd;
|
|
10802
|
-
else {
|
|
10803
|
-
self.cwd = path$h.resolve(options.cwd);
|
|
10804
|
-
self.changedCwd = self.cwd !== cwd;
|
|
10805
|
-
}
|
|
10806
|
-
|
|
10807
|
-
self.root = options.root || path$h.resolve(self.cwd, "/");
|
|
10808
|
-
self.root = path$h.resolve(self.root);
|
|
10809
|
-
if (process.platform === "win32")
|
|
10810
|
-
self.root = self.root.replace(/\\/g, "/");
|
|
10811
|
-
|
|
10812
|
-
// TODO: is an absolute `cwd` supposed to be resolved against `root`?
|
|
10813
|
-
// e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
|
|
10814
|
-
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd);
|
|
10815
|
-
if (process.platform === "win32")
|
|
10816
|
-
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/");
|
|
10817
|
-
self.nomount = !!options.nomount;
|
|
10818
|
-
|
|
10819
|
-
// disable comments and negation in Minimatch.
|
|
10820
|
-
// Note that they are not supported in Glob itself anyway.
|
|
10821
|
-
options.nonegate = true;
|
|
10822
|
-
options.nocomment = true;
|
|
10823
|
-
|
|
10824
|
-
self.minimatch = new Minimatch(pattern, options);
|
|
10825
|
-
self.options = self.minimatch.options;
|
|
10826
|
-
}
|
|
10827
|
-
|
|
10828
|
-
function finish (self) {
|
|
10829
|
-
var nou = self.nounique;
|
|
10830
|
-
var all = nou ? [] : Object.create(null);
|
|
10831
|
-
|
|
10832
|
-
for (var i = 0, l = self.matches.length; i < l; i ++) {
|
|
10833
|
-
var matches = self.matches[i];
|
|
10834
|
-
if (!matches || Object.keys(matches).length === 0) {
|
|
10835
|
-
if (self.nonull) {
|
|
10836
|
-
// do like the shell, and spit out the literal glob
|
|
10837
|
-
var literal = self.minimatch.globSet[i];
|
|
10838
|
-
if (nou)
|
|
10839
|
-
all.push(literal);
|
|
10840
|
-
else
|
|
10841
|
-
all[literal] = true;
|
|
10842
|
-
}
|
|
10843
|
-
} else {
|
|
10844
|
-
// had matches
|
|
10845
|
-
var m = Object.keys(matches);
|
|
10846
|
-
if (nou)
|
|
10847
|
-
all.push.apply(all, m);
|
|
10848
|
-
else
|
|
10849
|
-
m.forEach(function (m) {
|
|
10850
|
-
all[m] = true;
|
|
10851
|
-
});
|
|
10852
|
-
}
|
|
10853
|
-
}
|
|
10854
|
-
|
|
10855
|
-
if (!nou)
|
|
10856
|
-
all = Object.keys(all);
|
|
10857
|
-
|
|
10858
|
-
if (!self.nosort)
|
|
10859
|
-
all = all.sort(self.nocase ? alphasorti : alphasort);
|
|
10860
|
-
|
|
10861
|
-
// at *some* point we statted all of these
|
|
10862
|
-
if (self.mark) {
|
|
10863
|
-
for (var i = 0; i < all.length; i++) {
|
|
10864
|
-
all[i] = self._mark(all[i]);
|
|
10865
|
-
}
|
|
10866
|
-
if (self.nodir) {
|
|
10867
|
-
all = all.filter(function (e) {
|
|
10868
|
-
var notDir = !(/\/$/.test(e));
|
|
10869
|
-
var c = self.cache[e] || self.cache[makeAbs(self, e)];
|
|
10870
|
-
if (notDir && c)
|
|
10871
|
-
notDir = c !== 'DIR' && !Array.isArray(c);
|
|
10872
|
-
return notDir
|
|
10873
|
-
});
|
|
10874
|
-
}
|
|
10875
|
-
}
|
|
10876
|
-
|
|
10877
|
-
if (self.ignore.length)
|
|
10878
|
-
all = all.filter(function(m) {
|
|
10879
|
-
return !isIgnored(self, m)
|
|
10880
|
-
});
|
|
10881
|
-
|
|
10882
|
-
self.found = all;
|
|
10883
|
-
}
|
|
10884
|
-
|
|
10885
|
-
function mark (self, p) {
|
|
10886
|
-
var abs = makeAbs(self, p);
|
|
10887
|
-
var c = self.cache[abs];
|
|
10888
|
-
var m = p;
|
|
10889
|
-
if (c) {
|
|
10890
|
-
var isDir = c === 'DIR' || Array.isArray(c);
|
|
10891
|
-
var slash = p.slice(-1) === '/';
|
|
10892
|
-
|
|
10893
|
-
if (isDir && !slash)
|
|
10894
|
-
m += '/';
|
|
10895
|
-
else if (!isDir && slash)
|
|
10896
|
-
m = m.slice(0, -1);
|
|
10897
|
-
|
|
10898
|
-
if (m !== p) {
|
|
10899
|
-
var mabs = makeAbs(self, m);
|
|
10900
|
-
self.statCache[mabs] = self.statCache[abs];
|
|
10901
|
-
self.cache[mabs] = self.cache[abs];
|
|
10902
|
-
}
|
|
10903
|
-
}
|
|
10904
|
-
|
|
10905
|
-
return m
|
|
10906
|
-
}
|
|
10907
|
-
|
|
10908
|
-
// lotta situps...
|
|
10909
|
-
function makeAbs (self, f) {
|
|
10910
|
-
var abs = f;
|
|
10911
|
-
if (f.charAt(0) === '/') {
|
|
10912
|
-
abs = path$h.join(self.root, f);
|
|
10913
|
-
} else if (isAbsolute(f) || f === '') {
|
|
10914
|
-
abs = f;
|
|
10915
|
-
} else if (self.changedCwd) {
|
|
10916
|
-
abs = path$h.resolve(self.cwd, f);
|
|
10917
|
-
} else {
|
|
10918
|
-
abs = path$h.resolve(f);
|
|
10919
|
-
}
|
|
10920
|
-
|
|
10921
|
-
if (process.platform === 'win32')
|
|
10922
|
-
abs = abs.replace(/\\/g, '/');
|
|
10923
|
-
|
|
10924
|
-
return abs
|
|
10925
|
-
}
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
|
|
10929
|
-
// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
|
|
10930
|
-
function isIgnored (self, path) {
|
|
10931
|
-
if (!self.ignore.length)
|
|
10932
|
-
return false
|
|
10933
|
-
|
|
10934
|
-
return self.ignore.some(function(item) {
|
|
10935
|
-
return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
|
|
10936
|
-
})
|
|
10937
|
-
}
|
|
10938
|
-
|
|
10939
|
-
function childrenIgnored (self, path) {
|
|
10940
|
-
if (!self.ignore.length)
|
|
10941
|
-
return false
|
|
10942
|
-
|
|
10943
|
-
return self.ignore.some(function(item) {
|
|
10944
|
-
return !!(item.gmatcher && item.gmatcher.match(path))
|
|
10945
|
-
})
|
|
10946
|
-
}
|
|
10947
|
-
|
|
10948
|
-
var sync;
|
|
10949
|
-
var hasRequiredSync;
|
|
10950
|
-
|
|
10951
|
-
function requireSync () {
|
|
10952
|
-
if (hasRequiredSync) return sync;
|
|
10953
|
-
hasRequiredSync = 1;
|
|
10954
|
-
sync = globSync;
|
|
10955
|
-
globSync.GlobSync = GlobSync;
|
|
10956
|
-
|
|
10957
|
-
var fs = fs$l;
|
|
10958
|
-
var rp = fs_realpath;
|
|
10959
|
-
var minimatch = minimatch_1;
|
|
10960
|
-
minimatch.Minimatch;
|
|
10961
|
-
requireGlob().Glob;
|
|
10962
|
-
var path = require$$1$1;
|
|
10963
|
-
var assert = require$$6;
|
|
10964
|
-
var isAbsolute = pathIsAbsoluteExports;
|
|
10965
|
-
var common$1 = common;
|
|
10966
|
-
common$1.alphasort;
|
|
10967
|
-
common$1.alphasorti;
|
|
10968
|
-
var setopts = common$1.setopts;
|
|
10969
|
-
var ownProp = common$1.ownProp;
|
|
10970
|
-
var childrenIgnored = common$1.childrenIgnored;
|
|
10971
|
-
var isIgnored = common$1.isIgnored;
|
|
10972
|
-
|
|
10973
|
-
function globSync (pattern, options) {
|
|
10974
|
-
if (typeof options === 'function' || arguments.length === 3)
|
|
10975
|
-
throw new TypeError('callback provided to sync glob\n'+
|
|
10976
|
-
'See: https://github.com/isaacs/node-glob/issues/167')
|
|
10977
|
-
|
|
10978
|
-
return new GlobSync(pattern, options).found
|
|
10979
|
-
}
|
|
10980
|
-
|
|
10981
|
-
function GlobSync (pattern, options) {
|
|
10982
|
-
if (!pattern)
|
|
10983
|
-
throw new Error('must provide pattern')
|
|
10984
|
-
|
|
10985
|
-
if (typeof options === 'function' || arguments.length === 3)
|
|
10986
|
-
throw new TypeError('callback provided to sync glob\n'+
|
|
10987
|
-
'See: https://github.com/isaacs/node-glob/issues/167')
|
|
10988
|
-
|
|
10989
|
-
if (!(this instanceof GlobSync))
|
|
10990
|
-
return new GlobSync(pattern, options)
|
|
10991
|
-
|
|
10992
|
-
setopts(this, pattern, options);
|
|
10993
|
-
|
|
10994
|
-
if (this.noprocess)
|
|
10995
|
-
return this
|
|
10996
|
-
|
|
10997
|
-
var n = this.minimatch.set.length;
|
|
10998
|
-
this.matches = new Array(n);
|
|
10999
|
-
for (var i = 0; i < n; i ++) {
|
|
11000
|
-
this._process(this.minimatch.set[i], i, false);
|
|
11001
|
-
}
|
|
11002
|
-
this._finish();
|
|
11003
|
-
}
|
|
11004
|
-
|
|
11005
|
-
GlobSync.prototype._finish = function () {
|
|
11006
|
-
assert(this instanceof GlobSync);
|
|
11007
|
-
if (this.realpath) {
|
|
11008
|
-
var self = this;
|
|
11009
|
-
this.matches.forEach(function (matchset, index) {
|
|
11010
|
-
var set = self.matches[index] = Object.create(null);
|
|
11011
|
-
for (var p in matchset) {
|
|
11012
|
-
try {
|
|
11013
|
-
p = self._makeAbs(p);
|
|
11014
|
-
var real = rp.realpathSync(p, self.realpathCache);
|
|
11015
|
-
set[real] = true;
|
|
11016
|
-
} catch (er) {
|
|
11017
|
-
if (er.syscall === 'stat')
|
|
11018
|
-
set[self._makeAbs(p)] = true;
|
|
11019
|
-
else
|
|
11020
|
-
throw er
|
|
11021
|
-
}
|
|
11022
|
-
}
|
|
11023
|
-
});
|
|
11024
|
-
}
|
|
11025
|
-
common$1.finish(this);
|
|
11026
|
-
};
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
GlobSync.prototype._process = function (pattern, index, inGlobStar) {
|
|
11030
|
-
assert(this instanceof GlobSync);
|
|
11031
|
-
|
|
11032
|
-
// Get the first [n] parts of pattern that are all strings.
|
|
11033
|
-
var n = 0;
|
|
11034
|
-
while (typeof pattern[n] === 'string') {
|
|
11035
|
-
n ++;
|
|
11036
|
-
}
|
|
11037
|
-
// now n is the index of the first one that is *not* a string.
|
|
11038
|
-
|
|
11039
|
-
// See if there's anything else
|
|
11040
|
-
var prefix;
|
|
11041
|
-
switch (n) {
|
|
11042
|
-
// if not, then this is rather simple
|
|
11043
|
-
case pattern.length:
|
|
11044
|
-
this._processSimple(pattern.join('/'), index);
|
|
11045
|
-
return
|
|
11046
|
-
|
|
11047
|
-
case 0:
|
|
11048
|
-
// pattern *starts* with some non-trivial item.
|
|
11049
|
-
// going to readdir(cwd), but not include the prefix in matches.
|
|
11050
|
-
prefix = null;
|
|
11051
|
-
break
|
|
11052
|
-
|
|
11053
|
-
default:
|
|
11054
|
-
// pattern has some string bits in the front.
|
|
11055
|
-
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
|
11056
|
-
// or 'relative' like '../baz'
|
|
11057
|
-
prefix = pattern.slice(0, n).join('/');
|
|
11058
|
-
break
|
|
11059
|
-
}
|
|
11060
|
-
|
|
11061
|
-
var remain = pattern.slice(n);
|
|
11062
|
-
|
|
11063
|
-
// get the list of entries.
|
|
11064
|
-
var read;
|
|
11065
|
-
if (prefix === null)
|
|
11066
|
-
read = '.';
|
|
11067
|
-
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
|
|
11068
|
-
if (!prefix || !isAbsolute(prefix))
|
|
11069
|
-
prefix = '/' + prefix;
|
|
11070
|
-
read = prefix;
|
|
11071
|
-
} else
|
|
11072
|
-
read = prefix;
|
|
11073
|
-
|
|
11074
|
-
var abs = this._makeAbs(read);
|
|
11075
|
-
|
|
11076
|
-
//if ignored, skip processing
|
|
11077
|
-
if (childrenIgnored(this, read))
|
|
11078
|
-
return
|
|
11079
|
-
|
|
11080
|
-
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
|
|
11081
|
-
if (isGlobStar)
|
|
11082
|
-
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
|
|
11083
|
-
else
|
|
11084
|
-
this._processReaddir(prefix, read, abs, remain, index, inGlobStar);
|
|
11085
|
-
};
|
|
11086
|
-
|
|
11087
|
-
|
|
11088
|
-
GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
|
|
11089
|
-
var entries = this._readdir(abs, inGlobStar);
|
|
11090
|
-
|
|
11091
|
-
// if the abs isn't a dir, then nothing can match!
|
|
11092
|
-
if (!entries)
|
|
11093
|
-
return
|
|
11094
|
-
|
|
11095
|
-
// It will only match dot entries if it starts with a dot, or if
|
|
11096
|
-
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
|
11097
|
-
var pn = remain[0];
|
|
11098
|
-
var negate = !!this.minimatch.negate;
|
|
11099
|
-
var rawGlob = pn._glob;
|
|
11100
|
-
var dotOk = this.dot || rawGlob.charAt(0) === '.';
|
|
11101
|
-
|
|
11102
|
-
var matchedEntries = [];
|
|
11103
|
-
for (var i = 0; i < entries.length; i++) {
|
|
11104
|
-
var e = entries[i];
|
|
11105
|
-
if (e.charAt(0) !== '.' || dotOk) {
|
|
11106
|
-
var m;
|
|
11107
|
-
if (negate && !prefix) {
|
|
11108
|
-
m = !e.match(pn);
|
|
11109
|
-
} else {
|
|
11110
|
-
m = e.match(pn);
|
|
11111
|
-
}
|
|
11112
|
-
if (m)
|
|
11113
|
-
matchedEntries.push(e);
|
|
11114
|
-
}
|
|
11115
|
-
}
|
|
11116
|
-
|
|
11117
|
-
var len = matchedEntries.length;
|
|
11118
|
-
// If there are no matched entries, then nothing matches.
|
|
11119
|
-
if (len === 0)
|
|
11120
|
-
return
|
|
11121
|
-
|
|
11122
|
-
// if this is the last remaining pattern bit, then no need for
|
|
11123
|
-
// an additional stat *unless* the user has specified mark or
|
|
11124
|
-
// stat explicitly. We know they exist, since readdir returned
|
|
11125
|
-
// them.
|
|
11126
|
-
|
|
11127
|
-
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
11128
|
-
if (!this.matches[index])
|
|
11129
|
-
this.matches[index] = Object.create(null);
|
|
11130
|
-
|
|
11131
|
-
for (var i = 0; i < len; i ++) {
|
|
11132
|
-
var e = matchedEntries[i];
|
|
11133
|
-
if (prefix) {
|
|
11134
|
-
if (prefix.slice(-1) !== '/')
|
|
11135
|
-
e = prefix + '/' + e;
|
|
11136
|
-
else
|
|
11137
|
-
e = prefix + e;
|
|
11138
|
-
}
|
|
11139
|
-
|
|
11140
|
-
if (e.charAt(0) === '/' && !this.nomount) {
|
|
11141
|
-
e = path.join(this.root, e);
|
|
11142
|
-
}
|
|
11143
|
-
this._emitMatch(index, e);
|
|
11144
|
-
}
|
|
11145
|
-
// This was the last one, and no stats were needed
|
|
11146
|
-
return
|
|
11147
|
-
}
|
|
11148
|
-
|
|
11149
|
-
// now test all matched entries as stand-ins for that part
|
|
11150
|
-
// of the pattern.
|
|
11151
|
-
remain.shift();
|
|
11152
|
-
for (var i = 0; i < len; i ++) {
|
|
11153
|
-
var e = matchedEntries[i];
|
|
11154
|
-
var newPattern;
|
|
11155
|
-
if (prefix)
|
|
11156
|
-
newPattern = [prefix, e];
|
|
11157
|
-
else
|
|
11158
|
-
newPattern = [e];
|
|
11159
|
-
this._process(newPattern.concat(remain), index, inGlobStar);
|
|
11160
|
-
}
|
|
11161
|
-
};
|
|
11162
|
-
|
|
11163
|
-
|
|
11164
|
-
GlobSync.prototype._emitMatch = function (index, e) {
|
|
11165
|
-
if (isIgnored(this, e))
|
|
11166
|
-
return
|
|
11167
|
-
|
|
11168
|
-
var abs = this._makeAbs(e);
|
|
11169
|
-
|
|
11170
|
-
if (this.mark)
|
|
11171
|
-
e = this._mark(e);
|
|
11172
|
-
|
|
11173
|
-
if (this.absolute) {
|
|
11174
|
-
e = abs;
|
|
11175
|
-
}
|
|
11176
|
-
|
|
11177
|
-
if (this.matches[index][e])
|
|
11178
|
-
return
|
|
11179
|
-
|
|
11180
|
-
if (this.nodir) {
|
|
11181
|
-
var c = this.cache[abs];
|
|
11182
|
-
if (c === 'DIR' || Array.isArray(c))
|
|
11183
|
-
return
|
|
11184
|
-
}
|
|
11185
|
-
|
|
11186
|
-
this.matches[index][e] = true;
|
|
11187
|
-
|
|
11188
|
-
if (this.stat)
|
|
11189
|
-
this._stat(e);
|
|
11190
|
-
};
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
GlobSync.prototype._readdirInGlobStar = function (abs) {
|
|
11194
|
-
// follow all symlinked directories forever
|
|
11195
|
-
// just proceed as if this is a non-globstar situation
|
|
11196
|
-
if (this.follow)
|
|
11197
|
-
return this._readdir(abs, false)
|
|
11198
|
-
|
|
11199
|
-
var entries;
|
|
11200
|
-
var lstat;
|
|
11201
|
-
try {
|
|
11202
|
-
lstat = fs.lstatSync(abs);
|
|
11203
|
-
} catch (er) {
|
|
11204
|
-
if (er.code === 'ENOENT') {
|
|
11205
|
-
// lstat failed, doesn't exist
|
|
11206
|
-
return null
|
|
11207
|
-
}
|
|
11208
|
-
}
|
|
11209
|
-
|
|
11210
|
-
var isSym = lstat && lstat.isSymbolicLink();
|
|
11211
|
-
this.symlinks[abs] = isSym;
|
|
11212
|
-
|
|
11213
|
-
// If it's not a symlink or a dir, then it's definitely a regular file.
|
|
11214
|
-
// don't bother doing a readdir in that case.
|
|
11215
|
-
if (!isSym && lstat && !lstat.isDirectory())
|
|
11216
|
-
this.cache[abs] = 'FILE';
|
|
11217
|
-
else
|
|
11218
|
-
entries = this._readdir(abs, false);
|
|
11219
|
-
|
|
11220
|
-
return entries
|
|
11221
|
-
};
|
|
11222
|
-
|
|
11223
|
-
GlobSync.prototype._readdir = function (abs, inGlobStar) {
|
|
11224
|
-
|
|
11225
|
-
if (inGlobStar && !ownProp(this.symlinks, abs))
|
|
11226
|
-
return this._readdirInGlobStar(abs)
|
|
11227
|
-
|
|
11228
|
-
if (ownProp(this.cache, abs)) {
|
|
11229
|
-
var c = this.cache[abs];
|
|
11230
|
-
if (!c || c === 'FILE')
|
|
11231
|
-
return null
|
|
11232
|
-
|
|
11233
|
-
if (Array.isArray(c))
|
|
11234
|
-
return c
|
|
11235
|
-
}
|
|
11236
|
-
|
|
11237
|
-
try {
|
|
11238
|
-
return this._readdirEntries(abs, fs.readdirSync(abs))
|
|
11239
|
-
} catch (er) {
|
|
11240
|
-
this._readdirError(abs, er);
|
|
11241
|
-
return null
|
|
11242
|
-
}
|
|
11243
|
-
};
|
|
11244
|
-
|
|
11245
|
-
GlobSync.prototype._readdirEntries = function (abs, entries) {
|
|
11246
|
-
// if we haven't asked to stat everything, then just
|
|
11247
|
-
// assume that everything in there exists, so we can avoid
|
|
11248
|
-
// having to stat it a second time.
|
|
11249
|
-
if (!this.mark && !this.stat) {
|
|
11250
|
-
for (var i = 0; i < entries.length; i ++) {
|
|
11251
|
-
var e = entries[i];
|
|
11252
|
-
if (abs === '/')
|
|
11253
|
-
e = abs + e;
|
|
11254
|
-
else
|
|
11255
|
-
e = abs + '/' + e;
|
|
11256
|
-
this.cache[e] = true;
|
|
11257
|
-
}
|
|
11258
|
-
}
|
|
11259
|
-
|
|
11260
|
-
this.cache[abs] = entries;
|
|
11261
|
-
|
|
11262
|
-
// mark and cache dir-ness
|
|
11263
|
-
return entries
|
|
11264
|
-
};
|
|
11265
|
-
|
|
11266
|
-
GlobSync.prototype._readdirError = function (f, er) {
|
|
11267
|
-
// handle errors, and cache the information
|
|
11268
|
-
switch (er.code) {
|
|
11269
|
-
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
|
11270
|
-
case 'ENOTDIR': // totally normal. means it *does* exist.
|
|
11271
|
-
var abs = this._makeAbs(f);
|
|
11272
|
-
this.cache[abs] = 'FILE';
|
|
11273
|
-
if (abs === this.cwdAbs) {
|
|
11274
|
-
var error = new Error(er.code + ' invalid cwd ' + this.cwd);
|
|
11275
|
-
error.path = this.cwd;
|
|
11276
|
-
error.code = er.code;
|
|
11277
|
-
throw error
|
|
11278
|
-
}
|
|
11279
|
-
break
|
|
11280
|
-
|
|
11281
|
-
case 'ENOENT': // not terribly unusual
|
|
11282
|
-
case 'ELOOP':
|
|
11283
|
-
case 'ENAMETOOLONG':
|
|
11284
|
-
case 'UNKNOWN':
|
|
11285
|
-
this.cache[this._makeAbs(f)] = false;
|
|
11286
|
-
break
|
|
11287
|
-
|
|
11288
|
-
default: // some unusual error. Treat as failure.
|
|
11289
|
-
this.cache[this._makeAbs(f)] = false;
|
|
11290
|
-
if (this.strict)
|
|
11291
|
-
throw er
|
|
11292
|
-
if (!this.silent)
|
|
11293
|
-
console.error('glob error', er);
|
|
11294
|
-
break
|
|
11295
|
-
}
|
|
11296
|
-
};
|
|
11297
|
-
|
|
11298
|
-
GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
|
|
11299
|
-
|
|
11300
|
-
var entries = this._readdir(abs, inGlobStar);
|
|
11301
|
-
|
|
11302
|
-
// no entries means not a dir, so it can never have matches
|
|
11303
|
-
// foo.txt/** doesn't match foo.txt
|
|
11304
|
-
if (!entries)
|
|
11305
|
-
return
|
|
11306
|
-
|
|
11307
|
-
// test without the globstar, and with every child both below
|
|
11308
|
-
// and replacing the globstar.
|
|
11309
|
-
var remainWithoutGlobStar = remain.slice(1);
|
|
11310
|
-
var gspref = prefix ? [ prefix ] : [];
|
|
11311
|
-
var noGlobStar = gspref.concat(remainWithoutGlobStar);
|
|
11312
|
-
|
|
11313
|
-
// the noGlobStar pattern exits the inGlobStar state
|
|
11314
|
-
this._process(noGlobStar, index, false);
|
|
11315
|
-
|
|
11316
|
-
var len = entries.length;
|
|
11317
|
-
var isSym = this.symlinks[abs];
|
|
11318
|
-
|
|
11319
|
-
// If it's a symlink, and we're in a globstar, then stop
|
|
11320
|
-
if (isSym && inGlobStar)
|
|
11321
|
-
return
|
|
11322
|
-
|
|
11323
|
-
for (var i = 0; i < len; i++) {
|
|
11324
|
-
var e = entries[i];
|
|
11325
|
-
if (e.charAt(0) === '.' && !this.dot)
|
|
11326
|
-
continue
|
|
11327
|
-
|
|
11328
|
-
// these two cases enter the inGlobStar state
|
|
11329
|
-
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
|
|
11330
|
-
this._process(instead, index, true);
|
|
11331
|
-
|
|
11332
|
-
var below = gspref.concat(entries[i], remain);
|
|
11333
|
-
this._process(below, index, true);
|
|
11334
|
-
}
|
|
11335
|
-
};
|
|
11336
|
-
|
|
11337
|
-
GlobSync.prototype._processSimple = function (prefix, index) {
|
|
11338
|
-
// XXX review this. Shouldn't it be doing the mounting etc
|
|
11339
|
-
// before doing stat? kinda weird?
|
|
11340
|
-
var exists = this._stat(prefix);
|
|
11341
|
-
|
|
11342
|
-
if (!this.matches[index])
|
|
11343
|
-
this.matches[index] = Object.create(null);
|
|
11344
|
-
|
|
11345
|
-
// If it doesn't exist, then just mark the lack of results
|
|
11346
|
-
if (!exists)
|
|
11347
|
-
return
|
|
11348
|
-
|
|
11349
|
-
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
11350
|
-
var trail = /[\/\\]$/.test(prefix);
|
|
11351
|
-
if (prefix.charAt(0) === '/') {
|
|
11352
|
-
prefix = path.join(this.root, prefix);
|
|
11353
|
-
} else {
|
|
11354
|
-
prefix = path.resolve(this.root, prefix);
|
|
11355
|
-
if (trail)
|
|
11356
|
-
prefix += '/';
|
|
11357
|
-
}
|
|
11358
|
-
}
|
|
11359
|
-
|
|
11360
|
-
if (process.platform === 'win32')
|
|
11361
|
-
prefix = prefix.replace(/\\/g, '/');
|
|
11362
|
-
|
|
11363
|
-
// Mark this as a match
|
|
11364
|
-
this._emitMatch(index, prefix);
|
|
11365
|
-
};
|
|
11366
|
-
|
|
11367
|
-
// Returns either 'DIR', 'FILE', or false
|
|
11368
|
-
GlobSync.prototype._stat = function (f) {
|
|
11369
|
-
var abs = this._makeAbs(f);
|
|
11370
|
-
var needDir = f.slice(-1) === '/';
|
|
11371
|
-
|
|
11372
|
-
if (f.length > this.maxLength)
|
|
11373
|
-
return false
|
|
11374
|
-
|
|
11375
|
-
if (!this.stat && ownProp(this.cache, abs)) {
|
|
11376
|
-
var c = this.cache[abs];
|
|
11377
|
-
|
|
11378
|
-
if (Array.isArray(c))
|
|
11379
|
-
c = 'DIR';
|
|
11380
|
-
|
|
11381
|
-
// It exists, but maybe not how we need it
|
|
11382
|
-
if (!needDir || c === 'DIR')
|
|
11383
|
-
return c
|
|
11384
|
-
|
|
11385
|
-
if (needDir && c === 'FILE')
|
|
11386
|
-
return false
|
|
11387
|
-
|
|
11388
|
-
// otherwise we have to stat, because maybe c=true
|
|
11389
|
-
// if we know it exists, but not what it is.
|
|
11390
|
-
}
|
|
11391
|
-
var stat = this.statCache[abs];
|
|
11392
|
-
if (!stat) {
|
|
11393
|
-
var lstat;
|
|
11394
|
-
try {
|
|
11395
|
-
lstat = fs.lstatSync(abs);
|
|
11396
|
-
} catch (er) {
|
|
11397
|
-
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
|
11398
|
-
this.statCache[abs] = false;
|
|
11399
|
-
return false
|
|
11400
|
-
}
|
|
11401
|
-
}
|
|
11402
|
-
|
|
11403
|
-
if (lstat && lstat.isSymbolicLink()) {
|
|
11404
|
-
try {
|
|
11405
|
-
stat = fs.statSync(abs);
|
|
11406
|
-
} catch (er) {
|
|
11407
|
-
stat = lstat;
|
|
11408
|
-
}
|
|
11409
|
-
} else {
|
|
11410
|
-
stat = lstat;
|
|
11411
|
-
}
|
|
11412
|
-
}
|
|
11413
|
-
|
|
11414
|
-
this.statCache[abs] = stat;
|
|
11415
|
-
|
|
11416
|
-
var c = true;
|
|
11417
|
-
if (stat)
|
|
11418
|
-
c = stat.isDirectory() ? 'DIR' : 'FILE';
|
|
11419
|
-
|
|
11420
|
-
this.cache[abs] = this.cache[abs] || c;
|
|
11421
|
-
|
|
11422
|
-
if (needDir && c === 'FILE')
|
|
11423
|
-
return false
|
|
11424
|
-
|
|
11425
|
-
return c
|
|
11426
|
-
};
|
|
11427
|
-
|
|
11428
|
-
GlobSync.prototype._mark = function (p) {
|
|
11429
|
-
return common$1.mark(this, p)
|
|
11430
|
-
};
|
|
11431
|
-
|
|
11432
|
-
GlobSync.prototype._makeAbs = function (f) {
|
|
11433
|
-
return common$1.makeAbs(this, f)
|
|
11434
|
-
};
|
|
11435
|
-
return sync;
|
|
11436
|
-
}
|
|
11437
|
-
|
|
11438
|
-
// Returns a wrapper function that returns a wrapped callback
|
|
11439
|
-
// The wrapper function should do some stuff, and return a
|
|
11440
|
-
// presumably different callback function.
|
|
11441
|
-
// This makes sure that own properties are retained, so that
|
|
11442
|
-
// decorations and such are not lost along the way.
|
|
11443
|
-
var wrappy_1 = wrappy$2;
|
|
11444
|
-
function wrappy$2 (fn, cb) {
|
|
11445
|
-
if (fn && cb) return wrappy$2(fn)(cb)
|
|
11446
|
-
|
|
11447
|
-
if (typeof fn !== 'function')
|
|
11448
|
-
throw new TypeError('need wrapper function')
|
|
11449
|
-
|
|
11450
|
-
Object.keys(fn).forEach(function (k) {
|
|
11451
|
-
wrapper[k] = fn[k];
|
|
11452
|
-
});
|
|
11453
|
-
|
|
11454
|
-
return wrapper
|
|
11455
|
-
|
|
11456
|
-
function wrapper() {
|
|
11457
|
-
var args = new Array(arguments.length);
|
|
11458
|
-
for (var i = 0; i < args.length; i++) {
|
|
11459
|
-
args[i] = arguments[i];
|
|
11460
|
-
}
|
|
11461
|
-
var ret = fn.apply(this, args);
|
|
11462
|
-
var cb = args[args.length-1];
|
|
11463
|
-
if (typeof ret === 'function' && ret !== cb) {
|
|
11464
|
-
Object.keys(cb).forEach(function (k) {
|
|
11465
|
-
ret[k] = cb[k];
|
|
11466
|
-
});
|
|
11467
|
-
}
|
|
11468
|
-
return ret
|
|
11469
|
-
}
|
|
11470
|
-
}
|
|
11471
|
-
|
|
11472
|
-
var once$2 = {exports: {}};
|
|
11473
|
-
|
|
11474
|
-
var wrappy$1 = wrappy_1;
|
|
11475
|
-
once$2.exports = wrappy$1(once$1);
|
|
11476
|
-
once$2.exports.strict = wrappy$1(onceStrict);
|
|
11477
|
-
|
|
11478
|
-
once$1.proto = once$1(function () {
|
|
11479
|
-
Object.defineProperty(Function.prototype, 'once', {
|
|
11480
|
-
value: function () {
|
|
11481
|
-
return once$1(this)
|
|
11482
|
-
},
|
|
11483
|
-
configurable: true
|
|
11484
|
-
});
|
|
11485
|
-
|
|
11486
|
-
Object.defineProperty(Function.prototype, 'onceStrict', {
|
|
11487
|
-
value: function () {
|
|
11488
|
-
return onceStrict(this)
|
|
11489
|
-
},
|
|
11490
|
-
configurable: true
|
|
11491
|
-
});
|
|
11492
|
-
});
|
|
11493
|
-
|
|
11494
|
-
function once$1 (fn) {
|
|
11495
|
-
var f = function () {
|
|
11496
|
-
if (f.called) return f.value
|
|
11497
|
-
f.called = true;
|
|
11498
|
-
return f.value = fn.apply(this, arguments)
|
|
11499
|
-
};
|
|
11500
|
-
f.called = false;
|
|
11501
|
-
return f
|
|
11502
|
-
}
|
|
11503
|
-
|
|
11504
|
-
function onceStrict (fn) {
|
|
11505
|
-
var f = function () {
|
|
11506
|
-
if (f.called)
|
|
11507
|
-
throw new Error(f.onceError)
|
|
11508
|
-
f.called = true;
|
|
11509
|
-
return f.value = fn.apply(this, arguments)
|
|
11510
|
-
};
|
|
11511
|
-
var name = fn.name || 'Function wrapped with `once`';
|
|
11512
|
-
f.onceError = name + " shouldn't be called more than once";
|
|
11513
|
-
f.called = false;
|
|
11514
|
-
return f
|
|
11515
|
-
}
|
|
11516
|
-
|
|
11517
|
-
var onceExports = once$2.exports;
|
|
11518
|
-
|
|
11519
|
-
var wrappy = wrappy_1;
|
|
11520
|
-
var reqs = Object.create(null);
|
|
11521
|
-
var once = onceExports;
|
|
11522
|
-
|
|
11523
|
-
var inflight_1 = wrappy(inflight);
|
|
11524
|
-
|
|
11525
|
-
function inflight (key, cb) {
|
|
11526
|
-
if (reqs[key]) {
|
|
11527
|
-
reqs[key].push(cb);
|
|
11528
|
-
return null
|
|
11529
|
-
} else {
|
|
11530
|
-
reqs[key] = [cb];
|
|
11531
|
-
return makeres(key)
|
|
11532
|
-
}
|
|
11533
|
-
}
|
|
11534
|
-
|
|
11535
|
-
function makeres (key) {
|
|
11536
|
-
return once(function RES () {
|
|
11537
|
-
var cbs = reqs[key];
|
|
11538
|
-
var len = cbs.length;
|
|
11539
|
-
var args = slice(arguments);
|
|
11540
|
-
|
|
11541
|
-
// XXX It's somewhat ambiguous whether a new callback added in this
|
|
11542
|
-
// pass should be queued for later execution if something in the
|
|
11543
|
-
// list of callbacks throws, or if it should just be discarded.
|
|
11544
|
-
// However, it's such an edge case that it hardly matters, and either
|
|
11545
|
-
// choice is likely as surprising as the other.
|
|
11546
|
-
// As it happens, we do go ahead and schedule it for later execution.
|
|
11547
|
-
try {
|
|
11548
|
-
for (var i = 0; i < len; i++) {
|
|
11549
|
-
cbs[i].apply(null, args);
|
|
11550
|
-
}
|
|
11551
|
-
} finally {
|
|
11552
|
-
if (cbs.length > len) {
|
|
11553
|
-
// added more in the interim.
|
|
11554
|
-
// de-zalgo, just in case, but don't call again.
|
|
11555
|
-
cbs.splice(0, len);
|
|
11556
|
-
process.nextTick(function () {
|
|
11557
|
-
RES.apply(null, args);
|
|
11558
|
-
});
|
|
11559
|
-
} else {
|
|
11560
|
-
delete reqs[key];
|
|
11561
|
-
}
|
|
11562
|
-
}
|
|
11563
|
-
})
|
|
11564
|
-
}
|
|
11565
|
-
|
|
11566
|
-
function slice (args) {
|
|
11567
|
-
var length = args.length;
|
|
11568
|
-
var array = [];
|
|
11569
|
-
|
|
11570
|
-
for (var i = 0; i < length; i++) array[i] = args[i];
|
|
11571
|
-
return array
|
|
11572
|
-
}
|
|
11573
|
-
|
|
11574
|
-
var glob_1;
|
|
11575
|
-
var hasRequiredGlob;
|
|
11576
|
-
|
|
11577
|
-
function requireGlob () {
|
|
11578
|
-
if (hasRequiredGlob) return glob_1;
|
|
11579
|
-
hasRequiredGlob = 1;
|
|
11580
|
-
// Approach:
|
|
11581
|
-
//
|
|
11582
|
-
// 1. Get the minimatch set
|
|
11583
|
-
// 2. For each pattern in the set, PROCESS(pattern, false)
|
|
11584
|
-
// 3. Store matches per-set, then uniq them
|
|
11585
|
-
//
|
|
11586
|
-
// PROCESS(pattern, inGlobStar)
|
|
11587
|
-
// Get the first [n] items from pattern that are all strings
|
|
11588
|
-
// Join these together. This is PREFIX.
|
|
11589
|
-
// If there is no more remaining, then stat(PREFIX) and
|
|
11590
|
-
// add to matches if it succeeds. END.
|
|
11591
|
-
//
|
|
11592
|
-
// If inGlobStar and PREFIX is symlink and points to dir
|
|
11593
|
-
// set ENTRIES = []
|
|
11594
|
-
// else readdir(PREFIX) as ENTRIES
|
|
11595
|
-
// If fail, END
|
|
11596
|
-
//
|
|
11597
|
-
// with ENTRIES
|
|
11598
|
-
// If pattern[n] is GLOBSTAR
|
|
11599
|
-
// // handle the case where the globstar match is empty
|
|
11600
|
-
// // by pruning it out, and testing the resulting pattern
|
|
11601
|
-
// PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
|
|
11602
|
-
// // handle other cases.
|
|
11603
|
-
// for ENTRY in ENTRIES (not dotfiles)
|
|
11604
|
-
// // attach globstar + tail onto the entry
|
|
11605
|
-
// // Mark that this entry is a globstar match
|
|
11606
|
-
// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
|
|
11607
|
-
//
|
|
11608
|
-
// else // not globstar
|
|
11609
|
-
// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
|
|
11610
|
-
// Test ENTRY against pattern[n]
|
|
11611
|
-
// If fails, continue
|
|
11612
|
-
// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
|
|
11613
|
-
//
|
|
11614
|
-
// Caveat:
|
|
11615
|
-
// Cache all stats and readdirs results to minimize syscall. Since all
|
|
11616
|
-
// we ever care about is existence and directory-ness, we can just keep
|
|
11617
|
-
// `true` for files, and [children,...] for directories, or `false` for
|
|
11618
|
-
// things that don't exist.
|
|
11619
|
-
|
|
11620
|
-
glob_1 = glob;
|
|
11621
|
-
|
|
11622
|
-
var fs = fs$l;
|
|
11623
|
-
var rp = fs_realpath;
|
|
11624
|
-
var minimatch = minimatch_1;
|
|
11625
|
-
minimatch.Minimatch;
|
|
11626
|
-
var inherits = inheritsExports;
|
|
11627
|
-
var EE = require$$4.EventEmitter;
|
|
11628
|
-
var path = require$$1$1;
|
|
11629
|
-
var assert = require$$6;
|
|
11630
|
-
var isAbsolute = pathIsAbsoluteExports;
|
|
11631
|
-
var globSync = requireSync();
|
|
11632
|
-
var common$1 = common;
|
|
11633
|
-
common$1.alphasort;
|
|
11634
|
-
common$1.alphasorti;
|
|
11635
|
-
var setopts = common$1.setopts;
|
|
11636
|
-
var ownProp = common$1.ownProp;
|
|
11637
|
-
var inflight = inflight_1;
|
|
11638
|
-
var childrenIgnored = common$1.childrenIgnored;
|
|
11639
|
-
var isIgnored = common$1.isIgnored;
|
|
11640
|
-
|
|
11641
|
-
var once = onceExports;
|
|
11642
|
-
|
|
11643
|
-
function glob (pattern, options, cb) {
|
|
11644
|
-
if (typeof options === 'function') cb = options, options = {};
|
|
11645
|
-
if (!options) options = {};
|
|
11646
|
-
|
|
11647
|
-
if (options.sync) {
|
|
11648
|
-
if (cb)
|
|
11649
|
-
throw new TypeError('callback provided to sync glob')
|
|
11650
|
-
return globSync(pattern, options)
|
|
11651
|
-
}
|
|
11652
|
-
|
|
11653
|
-
return new Glob(pattern, options, cb)
|
|
11654
|
-
}
|
|
11655
|
-
|
|
11656
|
-
glob.sync = globSync;
|
|
11657
|
-
var GlobSync = glob.GlobSync = globSync.GlobSync;
|
|
11658
|
-
|
|
11659
|
-
// old api surface
|
|
11660
|
-
glob.glob = glob;
|
|
11661
|
-
|
|
11662
|
-
function extend (origin, add) {
|
|
11663
|
-
if (add === null || typeof add !== 'object') {
|
|
11664
|
-
return origin
|
|
11665
|
-
}
|
|
11666
|
-
|
|
11667
|
-
var keys = Object.keys(add);
|
|
11668
|
-
var i = keys.length;
|
|
11669
|
-
while (i--) {
|
|
11670
|
-
origin[keys[i]] = add[keys[i]];
|
|
11671
|
-
}
|
|
11672
|
-
return origin
|
|
11673
|
-
}
|
|
11674
|
-
|
|
11675
|
-
glob.hasMagic = function (pattern, options_) {
|
|
11676
|
-
var options = extend({}, options_);
|
|
11677
|
-
options.noprocess = true;
|
|
11678
|
-
|
|
11679
|
-
var g = new Glob(pattern, options);
|
|
11680
|
-
var set = g.minimatch.set;
|
|
11681
|
-
|
|
11682
|
-
if (!pattern)
|
|
11683
|
-
return false
|
|
11684
|
-
|
|
11685
|
-
if (set.length > 1)
|
|
11686
|
-
return true
|
|
11687
|
-
|
|
11688
|
-
for (var j = 0; j < set[0].length; j++) {
|
|
11689
|
-
if (typeof set[0][j] !== 'string')
|
|
11690
|
-
return true
|
|
11691
|
-
}
|
|
11692
|
-
|
|
11693
|
-
return false
|
|
11694
|
-
};
|
|
11695
|
-
|
|
11696
|
-
glob.Glob = Glob;
|
|
11697
|
-
inherits(Glob, EE);
|
|
11698
|
-
function Glob (pattern, options, cb) {
|
|
11699
|
-
if (typeof options === 'function') {
|
|
11700
|
-
cb = options;
|
|
11701
|
-
options = null;
|
|
11702
|
-
}
|
|
11703
|
-
|
|
11704
|
-
if (options && options.sync) {
|
|
11705
|
-
if (cb)
|
|
11706
|
-
throw new TypeError('callback provided to sync glob')
|
|
11707
|
-
return new GlobSync(pattern, options)
|
|
11708
|
-
}
|
|
11709
|
-
|
|
11710
|
-
if (!(this instanceof Glob))
|
|
11711
|
-
return new Glob(pattern, options, cb)
|
|
11712
|
-
|
|
11713
|
-
setopts(this, pattern, options);
|
|
11714
|
-
this._didRealPath = false;
|
|
11715
|
-
|
|
11716
|
-
// process each pattern in the minimatch set
|
|
11717
|
-
var n = this.minimatch.set.length;
|
|
11718
|
-
|
|
11719
|
-
// The matches are stored as {<filename>: true,...} so that
|
|
11720
|
-
// duplicates are automagically pruned.
|
|
11721
|
-
// Later, we do an Object.keys() on these.
|
|
11722
|
-
// Keep them as a list so we can fill in when nonull is set.
|
|
11723
|
-
this.matches = new Array(n);
|
|
11724
|
-
|
|
11725
|
-
if (typeof cb === 'function') {
|
|
11726
|
-
cb = once(cb);
|
|
11727
|
-
this.on('error', cb);
|
|
11728
|
-
this.on('end', function (matches) {
|
|
11729
|
-
cb(null, matches);
|
|
11730
|
-
});
|
|
11731
|
-
}
|
|
11732
|
-
|
|
11733
|
-
var self = this;
|
|
11734
|
-
this._processing = 0;
|
|
11735
|
-
|
|
11736
|
-
this._emitQueue = [];
|
|
11737
|
-
this._processQueue = [];
|
|
11738
|
-
this.paused = false;
|
|
11739
|
-
|
|
11740
|
-
if (this.noprocess)
|
|
11741
|
-
return this
|
|
11742
|
-
|
|
11743
|
-
if (n === 0)
|
|
11744
|
-
return done()
|
|
11745
|
-
|
|
11746
|
-
var sync = true;
|
|
11747
|
-
for (var i = 0; i < n; i ++) {
|
|
11748
|
-
this._process(this.minimatch.set[i], i, false, done);
|
|
11749
|
-
}
|
|
11750
|
-
sync = false;
|
|
11751
|
-
|
|
11752
|
-
function done () {
|
|
11753
|
-
--self._processing;
|
|
11754
|
-
if (self._processing <= 0) {
|
|
11755
|
-
if (sync) {
|
|
11756
|
-
process.nextTick(function () {
|
|
11757
|
-
self._finish();
|
|
11758
|
-
});
|
|
11759
|
-
} else {
|
|
11760
|
-
self._finish();
|
|
11761
|
-
}
|
|
11762
|
-
}
|
|
11763
|
-
}
|
|
11764
|
-
}
|
|
11765
|
-
|
|
11766
|
-
Glob.prototype._finish = function () {
|
|
11767
|
-
assert(this instanceof Glob);
|
|
11768
|
-
if (this.aborted)
|
|
11769
|
-
return
|
|
11770
|
-
|
|
11771
|
-
if (this.realpath && !this._didRealpath)
|
|
11772
|
-
return this._realpath()
|
|
11773
|
-
|
|
11774
|
-
common$1.finish(this);
|
|
11775
|
-
this.emit('end', this.found);
|
|
11776
|
-
};
|
|
11777
|
-
|
|
11778
|
-
Glob.prototype._realpath = function () {
|
|
11779
|
-
if (this._didRealpath)
|
|
11780
|
-
return
|
|
11781
|
-
|
|
11782
|
-
this._didRealpath = true;
|
|
11783
|
-
|
|
11784
|
-
var n = this.matches.length;
|
|
11785
|
-
if (n === 0)
|
|
11786
|
-
return this._finish()
|
|
11787
|
-
|
|
11788
|
-
var self = this;
|
|
11789
|
-
for (var i = 0; i < this.matches.length; i++)
|
|
11790
|
-
this._realpathSet(i, next);
|
|
11791
|
-
|
|
11792
|
-
function next () {
|
|
11793
|
-
if (--n === 0)
|
|
11794
|
-
self._finish();
|
|
11795
|
-
}
|
|
11796
|
-
};
|
|
11797
|
-
|
|
11798
|
-
Glob.prototype._realpathSet = function (index, cb) {
|
|
11799
|
-
var matchset = this.matches[index];
|
|
11800
|
-
if (!matchset)
|
|
11801
|
-
return cb()
|
|
11802
|
-
|
|
11803
|
-
var found = Object.keys(matchset);
|
|
11804
|
-
var self = this;
|
|
11805
|
-
var n = found.length;
|
|
11806
|
-
|
|
11807
|
-
if (n === 0)
|
|
11808
|
-
return cb()
|
|
11809
|
-
|
|
11810
|
-
var set = this.matches[index] = Object.create(null);
|
|
11811
|
-
found.forEach(function (p, i) {
|
|
11812
|
-
// If there's a problem with the stat, then it means that
|
|
11813
|
-
// one or more of the links in the realpath couldn't be
|
|
11814
|
-
// resolved. just return the abs value in that case.
|
|
11815
|
-
p = self._makeAbs(p);
|
|
11816
|
-
rp.realpath(p, self.realpathCache, function (er, real) {
|
|
11817
|
-
if (!er)
|
|
11818
|
-
set[real] = true;
|
|
11819
|
-
else if (er.syscall === 'stat')
|
|
11820
|
-
set[p] = true;
|
|
11821
|
-
else
|
|
11822
|
-
self.emit('error', er); // srsly wtf right here
|
|
11823
|
-
|
|
11824
|
-
if (--n === 0) {
|
|
11825
|
-
self.matches[index] = set;
|
|
11826
|
-
cb();
|
|
11827
|
-
}
|
|
11828
|
-
});
|
|
11829
|
-
});
|
|
11830
|
-
};
|
|
11831
|
-
|
|
11832
|
-
Glob.prototype._mark = function (p) {
|
|
11833
|
-
return common$1.mark(this, p)
|
|
11834
|
-
};
|
|
11835
|
-
|
|
11836
|
-
Glob.prototype._makeAbs = function (f) {
|
|
11837
|
-
return common$1.makeAbs(this, f)
|
|
11838
|
-
};
|
|
11839
|
-
|
|
11840
|
-
Glob.prototype.abort = function () {
|
|
11841
|
-
this.aborted = true;
|
|
11842
|
-
this.emit('abort');
|
|
11843
|
-
};
|
|
11844
|
-
|
|
11845
|
-
Glob.prototype.pause = function () {
|
|
11846
|
-
if (!this.paused) {
|
|
11847
|
-
this.paused = true;
|
|
11848
|
-
this.emit('pause');
|
|
11849
|
-
}
|
|
11850
|
-
};
|
|
11851
|
-
|
|
11852
|
-
Glob.prototype.resume = function () {
|
|
11853
|
-
if (this.paused) {
|
|
11854
|
-
this.emit('resume');
|
|
11855
|
-
this.paused = false;
|
|
11856
|
-
if (this._emitQueue.length) {
|
|
11857
|
-
var eq = this._emitQueue.slice(0);
|
|
11858
|
-
this._emitQueue.length = 0;
|
|
11859
|
-
for (var i = 0; i < eq.length; i ++) {
|
|
11860
|
-
var e = eq[i];
|
|
11861
|
-
this._emitMatch(e[0], e[1]);
|
|
11862
|
-
}
|
|
11863
|
-
}
|
|
11864
|
-
if (this._processQueue.length) {
|
|
11865
|
-
var pq = this._processQueue.slice(0);
|
|
11866
|
-
this._processQueue.length = 0;
|
|
11867
|
-
for (var i = 0; i < pq.length; i ++) {
|
|
11868
|
-
var p = pq[i];
|
|
11869
|
-
this._processing--;
|
|
11870
|
-
this._process(p[0], p[1], p[2], p[3]);
|
|
11871
|
-
}
|
|
11872
|
-
}
|
|
11873
|
-
}
|
|
11874
|
-
};
|
|
11875
|
-
|
|
11876
|
-
Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
|
|
11877
|
-
assert(this instanceof Glob);
|
|
11878
|
-
assert(typeof cb === 'function');
|
|
11879
|
-
|
|
11880
|
-
if (this.aborted)
|
|
11881
|
-
return
|
|
11882
|
-
|
|
11883
|
-
this._processing++;
|
|
11884
|
-
if (this.paused) {
|
|
11885
|
-
this._processQueue.push([pattern, index, inGlobStar, cb]);
|
|
11886
|
-
return
|
|
11887
|
-
}
|
|
11888
|
-
|
|
11889
|
-
//console.error('PROCESS %d', this._processing, pattern)
|
|
11890
|
-
|
|
11891
|
-
// Get the first [n] parts of pattern that are all strings.
|
|
11892
|
-
var n = 0;
|
|
11893
|
-
while (typeof pattern[n] === 'string') {
|
|
11894
|
-
n ++;
|
|
11895
|
-
}
|
|
11896
|
-
// now n is the index of the first one that is *not* a string.
|
|
11897
|
-
|
|
11898
|
-
// see if there's anything else
|
|
11899
|
-
var prefix;
|
|
11900
|
-
switch (n) {
|
|
11901
|
-
// if not, then this is rather simple
|
|
11902
|
-
case pattern.length:
|
|
11903
|
-
this._processSimple(pattern.join('/'), index, cb);
|
|
11904
|
-
return
|
|
11905
|
-
|
|
11906
|
-
case 0:
|
|
11907
|
-
// pattern *starts* with some non-trivial item.
|
|
11908
|
-
// going to readdir(cwd), but not include the prefix in matches.
|
|
11909
|
-
prefix = null;
|
|
11910
|
-
break
|
|
11911
|
-
|
|
11912
|
-
default:
|
|
11913
|
-
// pattern has some string bits in the front.
|
|
11914
|
-
// whatever it starts with, whether that's 'absolute' like /foo/bar,
|
|
11915
|
-
// or 'relative' like '../baz'
|
|
11916
|
-
prefix = pattern.slice(0, n).join('/');
|
|
11917
|
-
break
|
|
11918
|
-
}
|
|
11919
|
-
|
|
11920
|
-
var remain = pattern.slice(n);
|
|
11921
|
-
|
|
11922
|
-
// get the list of entries.
|
|
11923
|
-
var read;
|
|
11924
|
-
if (prefix === null)
|
|
11925
|
-
read = '.';
|
|
11926
|
-
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
|
|
11927
|
-
if (!prefix || !isAbsolute(prefix))
|
|
11928
|
-
prefix = '/' + prefix;
|
|
11929
|
-
read = prefix;
|
|
11930
|
-
} else
|
|
11931
|
-
read = prefix;
|
|
11932
|
-
|
|
11933
|
-
var abs = this._makeAbs(read);
|
|
11934
|
-
|
|
11935
|
-
//if ignored, skip _processing
|
|
11936
|
-
if (childrenIgnored(this, read))
|
|
11937
|
-
return cb()
|
|
11938
|
-
|
|
11939
|
-
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
|
|
11940
|
-
if (isGlobStar)
|
|
11941
|
-
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
|
|
11942
|
-
else
|
|
11943
|
-
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
|
|
11944
|
-
};
|
|
11945
|
-
|
|
11946
|
-
Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
11947
|
-
var self = this;
|
|
11948
|
-
this._readdir(abs, inGlobStar, function (er, entries) {
|
|
11949
|
-
return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
|
|
11950
|
-
});
|
|
11951
|
-
};
|
|
11952
|
-
|
|
11953
|
-
Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
11954
|
-
|
|
11955
|
-
// if the abs isn't a dir, then nothing can match!
|
|
11956
|
-
if (!entries)
|
|
11957
|
-
return cb()
|
|
11958
|
-
|
|
11959
|
-
// It will only match dot entries if it starts with a dot, or if
|
|
11960
|
-
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
|
|
11961
|
-
var pn = remain[0];
|
|
11962
|
-
var negate = !!this.minimatch.negate;
|
|
11963
|
-
var rawGlob = pn._glob;
|
|
11964
|
-
var dotOk = this.dot || rawGlob.charAt(0) === '.';
|
|
11965
|
-
|
|
11966
|
-
var matchedEntries = [];
|
|
11967
|
-
for (var i = 0; i < entries.length; i++) {
|
|
11968
|
-
var e = entries[i];
|
|
11969
|
-
if (e.charAt(0) !== '.' || dotOk) {
|
|
11970
|
-
var m;
|
|
11971
|
-
if (negate && !prefix) {
|
|
11972
|
-
m = !e.match(pn);
|
|
11973
|
-
} else {
|
|
11974
|
-
m = e.match(pn);
|
|
11975
|
-
}
|
|
11976
|
-
if (m)
|
|
11977
|
-
matchedEntries.push(e);
|
|
11978
|
-
}
|
|
11979
|
-
}
|
|
11980
|
-
|
|
11981
|
-
//console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
|
|
11982
|
-
|
|
11983
|
-
var len = matchedEntries.length;
|
|
11984
|
-
// If there are no matched entries, then nothing matches.
|
|
11985
|
-
if (len === 0)
|
|
11986
|
-
return cb()
|
|
11987
|
-
|
|
11988
|
-
// if this is the last remaining pattern bit, then no need for
|
|
11989
|
-
// an additional stat *unless* the user has specified mark or
|
|
11990
|
-
// stat explicitly. We know they exist, since readdir returned
|
|
11991
|
-
// them.
|
|
11992
|
-
|
|
11993
|
-
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
11994
|
-
if (!this.matches[index])
|
|
11995
|
-
this.matches[index] = Object.create(null);
|
|
11996
|
-
|
|
11997
|
-
for (var i = 0; i < len; i ++) {
|
|
11998
|
-
var e = matchedEntries[i];
|
|
11999
|
-
if (prefix) {
|
|
12000
|
-
if (prefix !== '/')
|
|
12001
|
-
e = prefix + '/' + e;
|
|
12002
|
-
else
|
|
12003
|
-
e = prefix + e;
|
|
12004
|
-
}
|
|
12005
|
-
|
|
12006
|
-
if (e.charAt(0) === '/' && !this.nomount) {
|
|
12007
|
-
e = path.join(this.root, e);
|
|
12008
|
-
}
|
|
12009
|
-
this._emitMatch(index, e);
|
|
12010
|
-
}
|
|
12011
|
-
// This was the last one, and no stats were needed
|
|
12012
|
-
return cb()
|
|
12013
|
-
}
|
|
12014
|
-
|
|
12015
|
-
// now test all matched entries as stand-ins for that part
|
|
12016
|
-
// of the pattern.
|
|
12017
|
-
remain.shift();
|
|
12018
|
-
for (var i = 0; i < len; i ++) {
|
|
12019
|
-
var e = matchedEntries[i];
|
|
12020
|
-
if (prefix) {
|
|
12021
|
-
if (prefix !== '/')
|
|
12022
|
-
e = prefix + '/' + e;
|
|
12023
|
-
else
|
|
12024
|
-
e = prefix + e;
|
|
12025
|
-
}
|
|
12026
|
-
this._process([e].concat(remain), index, inGlobStar, cb);
|
|
12027
|
-
}
|
|
12028
|
-
cb();
|
|
12029
|
-
};
|
|
12030
|
-
|
|
12031
|
-
Glob.prototype._emitMatch = function (index, e) {
|
|
12032
|
-
if (this.aborted)
|
|
12033
|
-
return
|
|
12034
|
-
|
|
12035
|
-
if (isIgnored(this, e))
|
|
12036
|
-
return
|
|
12037
|
-
|
|
12038
|
-
if (this.paused) {
|
|
12039
|
-
this._emitQueue.push([index, e]);
|
|
12040
|
-
return
|
|
12041
|
-
}
|
|
12042
|
-
|
|
12043
|
-
var abs = isAbsolute(e) ? e : this._makeAbs(e);
|
|
12044
|
-
|
|
12045
|
-
if (this.mark)
|
|
12046
|
-
e = this._mark(e);
|
|
12047
|
-
|
|
12048
|
-
if (this.absolute)
|
|
12049
|
-
e = abs;
|
|
12050
|
-
|
|
12051
|
-
if (this.matches[index][e])
|
|
12052
|
-
return
|
|
12053
|
-
|
|
12054
|
-
if (this.nodir) {
|
|
12055
|
-
var c = this.cache[abs];
|
|
12056
|
-
if (c === 'DIR' || Array.isArray(c))
|
|
12057
|
-
return
|
|
12058
|
-
}
|
|
12059
|
-
|
|
12060
|
-
this.matches[index][e] = true;
|
|
12061
|
-
|
|
12062
|
-
var st = this.statCache[abs];
|
|
12063
|
-
if (st)
|
|
12064
|
-
this.emit('stat', e, st);
|
|
12065
|
-
|
|
12066
|
-
this.emit('match', e);
|
|
12067
|
-
};
|
|
12068
|
-
|
|
12069
|
-
Glob.prototype._readdirInGlobStar = function (abs, cb) {
|
|
12070
|
-
if (this.aborted)
|
|
12071
|
-
return
|
|
12072
|
-
|
|
12073
|
-
// follow all symlinked directories forever
|
|
12074
|
-
// just proceed as if this is a non-globstar situation
|
|
12075
|
-
if (this.follow)
|
|
12076
|
-
return this._readdir(abs, false, cb)
|
|
12077
|
-
|
|
12078
|
-
var lstatkey = 'lstat\0' + abs;
|
|
12079
|
-
var self = this;
|
|
12080
|
-
var lstatcb = inflight(lstatkey, lstatcb_);
|
|
12081
|
-
|
|
12082
|
-
if (lstatcb)
|
|
12083
|
-
fs.lstat(abs, lstatcb);
|
|
12084
|
-
|
|
12085
|
-
function lstatcb_ (er, lstat) {
|
|
12086
|
-
if (er && er.code === 'ENOENT')
|
|
12087
|
-
return cb()
|
|
12088
|
-
|
|
12089
|
-
var isSym = lstat && lstat.isSymbolicLink();
|
|
12090
|
-
self.symlinks[abs] = isSym;
|
|
12091
|
-
|
|
12092
|
-
// If it's not a symlink or a dir, then it's definitely a regular file.
|
|
12093
|
-
// don't bother doing a readdir in that case.
|
|
12094
|
-
if (!isSym && lstat && !lstat.isDirectory()) {
|
|
12095
|
-
self.cache[abs] = 'FILE';
|
|
12096
|
-
cb();
|
|
12097
|
-
} else
|
|
12098
|
-
self._readdir(abs, false, cb);
|
|
12099
|
-
}
|
|
12100
|
-
};
|
|
12101
|
-
|
|
12102
|
-
Glob.prototype._readdir = function (abs, inGlobStar, cb) {
|
|
12103
|
-
if (this.aborted)
|
|
12104
|
-
return
|
|
12105
|
-
|
|
12106
|
-
cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb);
|
|
12107
|
-
if (!cb)
|
|
12108
|
-
return
|
|
12109
|
-
|
|
12110
|
-
//console.error('RD %j %j', +inGlobStar, abs)
|
|
12111
|
-
if (inGlobStar && !ownProp(this.symlinks, abs))
|
|
12112
|
-
return this._readdirInGlobStar(abs, cb)
|
|
12113
|
-
|
|
12114
|
-
if (ownProp(this.cache, abs)) {
|
|
12115
|
-
var c = this.cache[abs];
|
|
12116
|
-
if (!c || c === 'FILE')
|
|
12117
|
-
return cb()
|
|
12118
|
-
|
|
12119
|
-
if (Array.isArray(c))
|
|
12120
|
-
return cb(null, c)
|
|
12121
|
-
}
|
|
12122
|
-
fs.readdir(abs, readdirCb(this, abs, cb));
|
|
12123
|
-
};
|
|
12124
|
-
|
|
12125
|
-
function readdirCb (self, abs, cb) {
|
|
12126
|
-
return function (er, entries) {
|
|
12127
|
-
if (er)
|
|
12128
|
-
self._readdirError(abs, er, cb);
|
|
12129
|
-
else
|
|
12130
|
-
self._readdirEntries(abs, entries, cb);
|
|
12131
|
-
}
|
|
12132
|
-
}
|
|
12133
|
-
|
|
12134
|
-
Glob.prototype._readdirEntries = function (abs, entries, cb) {
|
|
12135
|
-
if (this.aborted)
|
|
12136
|
-
return
|
|
12137
|
-
|
|
12138
|
-
// if we haven't asked to stat everything, then just
|
|
12139
|
-
// assume that everything in there exists, so we can avoid
|
|
12140
|
-
// having to stat it a second time.
|
|
12141
|
-
if (!this.mark && !this.stat) {
|
|
12142
|
-
for (var i = 0; i < entries.length; i ++) {
|
|
12143
|
-
var e = entries[i];
|
|
12144
|
-
if (abs === '/')
|
|
12145
|
-
e = abs + e;
|
|
12146
|
-
else
|
|
12147
|
-
e = abs + '/' + e;
|
|
12148
|
-
this.cache[e] = true;
|
|
12149
|
-
}
|
|
12150
|
-
}
|
|
12151
|
-
|
|
12152
|
-
this.cache[abs] = entries;
|
|
12153
|
-
return cb(null, entries)
|
|
12154
|
-
};
|
|
12155
|
-
|
|
12156
|
-
Glob.prototype._readdirError = function (f, er, cb) {
|
|
12157
|
-
if (this.aborted)
|
|
12158
|
-
return
|
|
12159
|
-
|
|
12160
|
-
// handle errors, and cache the information
|
|
12161
|
-
switch (er.code) {
|
|
12162
|
-
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
|
|
12163
|
-
case 'ENOTDIR': // totally normal. means it *does* exist.
|
|
12164
|
-
var abs = this._makeAbs(f);
|
|
12165
|
-
this.cache[abs] = 'FILE';
|
|
12166
|
-
if (abs === this.cwdAbs) {
|
|
12167
|
-
var error = new Error(er.code + ' invalid cwd ' + this.cwd);
|
|
12168
|
-
error.path = this.cwd;
|
|
12169
|
-
error.code = er.code;
|
|
12170
|
-
this.emit('error', error);
|
|
12171
|
-
this.abort();
|
|
12172
|
-
}
|
|
12173
|
-
break
|
|
12174
|
-
|
|
12175
|
-
case 'ENOENT': // not terribly unusual
|
|
12176
|
-
case 'ELOOP':
|
|
12177
|
-
case 'ENAMETOOLONG':
|
|
12178
|
-
case 'UNKNOWN':
|
|
12179
|
-
this.cache[this._makeAbs(f)] = false;
|
|
12180
|
-
break
|
|
12181
|
-
|
|
12182
|
-
default: // some unusual error. Treat as failure.
|
|
12183
|
-
this.cache[this._makeAbs(f)] = false;
|
|
12184
|
-
if (this.strict) {
|
|
12185
|
-
this.emit('error', er);
|
|
12186
|
-
// If the error is handled, then we abort
|
|
12187
|
-
// if not, we threw out of here
|
|
12188
|
-
this.abort();
|
|
12189
|
-
}
|
|
12190
|
-
if (!this.silent)
|
|
12191
|
-
console.error('glob error', er);
|
|
12192
|
-
break
|
|
12193
|
-
}
|
|
12194
|
-
|
|
12195
|
-
return cb()
|
|
12196
|
-
};
|
|
12197
|
-
|
|
12198
|
-
Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
12199
|
-
var self = this;
|
|
12200
|
-
this._readdir(abs, inGlobStar, function (er, entries) {
|
|
12201
|
-
self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
|
|
12202
|
-
});
|
|
12203
|
-
};
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
12207
|
-
//console.error('pgs2', prefix, remain[0], entries)
|
|
12208
|
-
|
|
12209
|
-
// no entries means not a dir, so it can never have matches
|
|
12210
|
-
// foo.txt/** doesn't match foo.txt
|
|
12211
|
-
if (!entries)
|
|
12212
|
-
return cb()
|
|
12213
|
-
|
|
12214
|
-
// test without the globstar, and with every child both below
|
|
12215
|
-
// and replacing the globstar.
|
|
12216
|
-
var remainWithoutGlobStar = remain.slice(1);
|
|
12217
|
-
var gspref = prefix ? [ prefix ] : [];
|
|
12218
|
-
var noGlobStar = gspref.concat(remainWithoutGlobStar);
|
|
12219
|
-
|
|
12220
|
-
// the noGlobStar pattern exits the inGlobStar state
|
|
12221
|
-
this._process(noGlobStar, index, false, cb);
|
|
12222
|
-
|
|
12223
|
-
var isSym = this.symlinks[abs];
|
|
12224
|
-
var len = entries.length;
|
|
12225
|
-
|
|
12226
|
-
// If it's a symlink, and we're in a globstar, then stop
|
|
12227
|
-
if (isSym && inGlobStar)
|
|
12228
|
-
return cb()
|
|
12229
|
-
|
|
12230
|
-
for (var i = 0; i < len; i++) {
|
|
12231
|
-
var e = entries[i];
|
|
12232
|
-
if (e.charAt(0) === '.' && !this.dot)
|
|
12233
|
-
continue
|
|
12234
|
-
|
|
12235
|
-
// these two cases enter the inGlobStar state
|
|
12236
|
-
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
|
|
12237
|
-
this._process(instead, index, true, cb);
|
|
12238
|
-
|
|
12239
|
-
var below = gspref.concat(entries[i], remain);
|
|
12240
|
-
this._process(below, index, true, cb);
|
|
12241
|
-
}
|
|
12242
|
-
|
|
12243
|
-
cb();
|
|
12244
|
-
};
|
|
12245
|
-
|
|
12246
|
-
Glob.prototype._processSimple = function (prefix, index, cb) {
|
|
12247
|
-
// XXX review this. Shouldn't it be doing the mounting etc
|
|
12248
|
-
// before doing stat? kinda weird?
|
|
12249
|
-
var self = this;
|
|
12250
|
-
this._stat(prefix, function (er, exists) {
|
|
12251
|
-
self._processSimple2(prefix, index, er, exists, cb);
|
|
12252
|
-
});
|
|
12253
|
-
};
|
|
12254
|
-
Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
|
|
12255
|
-
|
|
12256
|
-
//console.error('ps2', prefix, exists)
|
|
12257
|
-
|
|
12258
|
-
if (!this.matches[index])
|
|
12259
|
-
this.matches[index] = Object.create(null);
|
|
12260
|
-
|
|
12261
|
-
// If it doesn't exist, then just mark the lack of results
|
|
12262
|
-
if (!exists)
|
|
12263
|
-
return cb()
|
|
12264
|
-
|
|
12265
|
-
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
12266
|
-
var trail = /[\/\\]$/.test(prefix);
|
|
12267
|
-
if (prefix.charAt(0) === '/') {
|
|
12268
|
-
prefix = path.join(this.root, prefix);
|
|
12269
|
-
} else {
|
|
12270
|
-
prefix = path.resolve(this.root, prefix);
|
|
12271
|
-
if (trail)
|
|
12272
|
-
prefix += '/';
|
|
12273
|
-
}
|
|
12274
|
-
}
|
|
12275
|
-
|
|
12276
|
-
if (process.platform === 'win32')
|
|
12277
|
-
prefix = prefix.replace(/\\/g, '/');
|
|
12278
|
-
|
|
12279
|
-
// Mark this as a match
|
|
12280
|
-
this._emitMatch(index, prefix);
|
|
12281
|
-
cb();
|
|
12282
|
-
};
|
|
12283
|
-
|
|
12284
|
-
// Returns either 'DIR', 'FILE', or false
|
|
12285
|
-
Glob.prototype._stat = function (f, cb) {
|
|
12286
|
-
var abs = this._makeAbs(f);
|
|
12287
|
-
var needDir = f.slice(-1) === '/';
|
|
12288
|
-
|
|
12289
|
-
if (f.length > this.maxLength)
|
|
12290
|
-
return cb()
|
|
12291
|
-
|
|
12292
|
-
if (!this.stat && ownProp(this.cache, abs)) {
|
|
12293
|
-
var c = this.cache[abs];
|
|
12294
|
-
|
|
12295
|
-
if (Array.isArray(c))
|
|
12296
|
-
c = 'DIR';
|
|
12297
|
-
|
|
12298
|
-
// It exists, but maybe not how we need it
|
|
12299
|
-
if (!needDir || c === 'DIR')
|
|
12300
|
-
return cb(null, c)
|
|
12301
|
-
|
|
12302
|
-
if (needDir && c === 'FILE')
|
|
12303
|
-
return cb()
|
|
12304
|
-
|
|
12305
|
-
// otherwise we have to stat, because maybe c=true
|
|
12306
|
-
// if we know it exists, but not what it is.
|
|
12307
|
-
}
|
|
12308
|
-
var stat = this.statCache[abs];
|
|
12309
|
-
if (stat !== undefined) {
|
|
12310
|
-
if (stat === false)
|
|
12311
|
-
return cb(null, stat)
|
|
12312
|
-
else {
|
|
12313
|
-
var type = stat.isDirectory() ? 'DIR' : 'FILE';
|
|
12314
|
-
if (needDir && type === 'FILE')
|
|
12315
|
-
return cb()
|
|
12316
|
-
else
|
|
12317
|
-
return cb(null, type, stat)
|
|
12318
|
-
}
|
|
12319
|
-
}
|
|
12320
|
-
|
|
12321
|
-
var self = this;
|
|
12322
|
-
var statcb = inflight('stat\0' + abs, lstatcb_);
|
|
12323
|
-
if (statcb)
|
|
12324
|
-
fs.lstat(abs, statcb);
|
|
12325
|
-
|
|
12326
|
-
function lstatcb_ (er, lstat) {
|
|
12327
|
-
if (lstat && lstat.isSymbolicLink()) {
|
|
12328
|
-
// If it's a symlink, then treat it as the target, unless
|
|
12329
|
-
// the target does not exist, then treat it as a file.
|
|
12330
|
-
return fs.stat(abs, function (er, stat) {
|
|
12331
|
-
if (er)
|
|
12332
|
-
self._stat2(f, abs, null, lstat, cb);
|
|
12333
|
-
else
|
|
12334
|
-
self._stat2(f, abs, er, stat, cb);
|
|
12335
|
-
})
|
|
12336
|
-
} else {
|
|
12337
|
-
self._stat2(f, abs, er, lstat, cb);
|
|
12338
|
-
}
|
|
12339
|
-
}
|
|
12340
|
-
};
|
|
12341
|
-
|
|
12342
|
-
Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
|
|
12343
|
-
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
|
|
12344
|
-
this.statCache[abs] = false;
|
|
12345
|
-
return cb()
|
|
12346
|
-
}
|
|
12347
|
-
|
|
12348
|
-
var needDir = f.slice(-1) === '/';
|
|
12349
|
-
this.statCache[abs] = stat;
|
|
12350
|
-
|
|
12351
|
-
if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
|
|
12352
|
-
return cb(null, false, stat)
|
|
12353
|
-
|
|
12354
|
-
var c = true;
|
|
12355
|
-
if (stat)
|
|
12356
|
-
c = stat.isDirectory() ? 'DIR' : 'FILE';
|
|
12357
|
-
this.cache[abs] = this.cache[abs] || c;
|
|
12358
|
-
|
|
12359
|
-
if (needDir && c === 'FILE')
|
|
12360
|
-
return cb()
|
|
12361
|
-
|
|
12362
|
-
return cb(null, c, stat)
|
|
12363
|
-
};
|
|
12364
|
-
return glob_1;
|
|
12365
|
-
}
|
|
12366
|
-
|
|
12367
|
-
var globExports = requireGlob();
|
|
12368
|
-
var glob = /*@__PURE__*/getDefaultExportFromCjs(globExports);
|
|
12369
|
-
|
|
12370
|
-
const getGlobPattern = (basePath) => {
|
|
12371
|
-
const newPath = require$$1$1.posix.normalize(basePath);
|
|
12372
|
-
return require$$1$1.join(newPath, "**/*.@(js|mjs).map");
|
|
12373
|
-
};
|
|
12374
|
-
const decomposePath = (options, sourcemapFilePath) => {
|
|
12375
|
-
if (require$$1$1.extname(sourcemapFilePath) !== ".map") {
|
|
12376
|
-
throw new Error(`The file ${chalk.green.bold(sourcemapFilePath)} is not a sourcemap.`);
|
|
12377
|
-
}
|
|
12378
|
-
const minifiedFilePath = sourcemapFilePath.replace(/\.map$/, "");
|
|
12379
|
-
const relativePath = minifiedFilePath.replace(options.basePath, "");
|
|
12380
|
-
const minifiedUrl = options.minifiedPathPrefix ? require$$1$1.join(options.minifiedPathPrefix, relativePath) : relativePath;
|
|
12381
|
-
return {
|
|
12382
|
-
minifiedFilePath,
|
|
12383
|
-
minifiedUrl,
|
|
12384
|
-
relativePath
|
|
12385
|
-
};
|
|
12386
|
-
};
|
|
12387
|
-
const getSourcemapsFiles = (options) => {
|
|
12388
|
-
const globPattern = getGlobPattern(options.basePath);
|
|
12389
|
-
const sourcemapFilesList = glob.sync(globPattern);
|
|
12390
|
-
const sourcemapFiles = sourcemapFilesList.map((sourcemapFilePath) => {
|
|
12391
|
-
return {
|
|
12392
|
-
...decomposePath(options, sourcemapFilePath),
|
|
12393
|
-
sourcemapFilePath,
|
|
12394
|
-
minifiedPathPrefix: options.minifiedPathPrefix
|
|
12395
|
-
};
|
|
12396
|
-
});
|
|
12397
|
-
return sourcemapFiles;
|
|
12398
|
-
};
|
|
12399
|
-
|
|
12400
|
-
var retry$4 = {};
|
|
12401
|
-
|
|
12402
|
-
function RetryOperation(timeouts, options) {
|
|
12403
|
-
// Compatibility for the old (timeouts, retryForever) signature
|
|
12404
|
-
if (typeof options === 'boolean') {
|
|
12405
|
-
options = { forever: options };
|
|
12406
|
-
}
|
|
12407
|
-
|
|
12408
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
12409
|
-
this._timeouts = timeouts;
|
|
12410
|
-
this._options = options || {};
|
|
12411
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
12412
|
-
this._fn = null;
|
|
12413
|
-
this._errors = [];
|
|
12414
|
-
this._attempts = 1;
|
|
12415
|
-
this._operationTimeout = null;
|
|
12416
|
-
this._operationTimeoutCb = null;
|
|
12417
|
-
this._timeout = null;
|
|
12418
|
-
this._operationStart = null;
|
|
12419
|
-
this._timer = null;
|
|
12420
|
-
|
|
12421
|
-
if (this._options.forever) {
|
|
12422
|
-
this._cachedTimeouts = this._timeouts.slice(0);
|
|
12423
|
-
}
|
|
12424
|
-
}
|
|
12425
|
-
var retry_operation = RetryOperation;
|
|
12426
|
-
|
|
12427
|
-
RetryOperation.prototype.reset = function() {
|
|
12428
|
-
this._attempts = 1;
|
|
12429
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
12430
|
-
};
|
|
12431
|
-
|
|
12432
|
-
RetryOperation.prototype.stop = function() {
|
|
12433
|
-
if (this._timeout) {
|
|
12434
|
-
clearTimeout(this._timeout);
|
|
12435
|
-
}
|
|
12436
|
-
if (this._timer) {
|
|
12437
|
-
clearTimeout(this._timer);
|
|
12438
|
-
}
|
|
12439
|
-
|
|
12440
|
-
this._timeouts = [];
|
|
12441
|
-
this._cachedTimeouts = null;
|
|
12442
|
-
};
|
|
12443
|
-
|
|
12444
|
-
RetryOperation.prototype.retry = function(err) {
|
|
12445
|
-
if (this._timeout) {
|
|
12446
|
-
clearTimeout(this._timeout);
|
|
12447
|
-
}
|
|
12448
|
-
|
|
12449
|
-
if (!err) {
|
|
12450
|
-
return false;
|
|
12451
|
-
}
|
|
12452
|
-
var currentTime = new Date().getTime();
|
|
12453
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
12454
|
-
this._errors.push(err);
|
|
12455
|
-
this._errors.unshift(new Error('RetryOperation timeout occurred'));
|
|
12456
|
-
return false;
|
|
12457
|
-
}
|
|
12458
|
-
|
|
12459
|
-
this._errors.push(err);
|
|
12460
|
-
|
|
12461
|
-
var timeout = this._timeouts.shift();
|
|
12462
|
-
if (timeout === undefined) {
|
|
12463
|
-
if (this._cachedTimeouts) {
|
|
12464
|
-
// retry forever, only keep last error
|
|
12465
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
12466
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
12467
|
-
} else {
|
|
12468
|
-
return false;
|
|
12469
|
-
}
|
|
12470
|
-
}
|
|
12471
|
-
|
|
12472
|
-
var self = this;
|
|
12473
|
-
this._timer = setTimeout(function() {
|
|
12474
|
-
self._attempts++;
|
|
12475
|
-
|
|
12476
|
-
if (self._operationTimeoutCb) {
|
|
12477
|
-
self._timeout = setTimeout(function() {
|
|
12478
|
-
self._operationTimeoutCb(self._attempts);
|
|
12479
|
-
}, self._operationTimeout);
|
|
12480
|
-
|
|
12481
|
-
if (self._options.unref) {
|
|
12482
|
-
self._timeout.unref();
|
|
12483
|
-
}
|
|
12484
|
-
}
|
|
12485
|
-
|
|
12486
|
-
self._fn(self._attempts);
|
|
12487
|
-
}, timeout);
|
|
12488
|
-
|
|
12489
|
-
if (this._options.unref) {
|
|
12490
|
-
this._timer.unref();
|
|
12491
|
-
}
|
|
12492
|
-
|
|
12493
|
-
return true;
|
|
12494
|
-
};
|
|
12495
|
-
|
|
12496
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
12497
|
-
this._fn = fn;
|
|
12498
|
-
|
|
12499
|
-
if (timeoutOps) {
|
|
12500
|
-
if (timeoutOps.timeout) {
|
|
12501
|
-
this._operationTimeout = timeoutOps.timeout;
|
|
12502
|
-
}
|
|
12503
|
-
if (timeoutOps.cb) {
|
|
12504
|
-
this._operationTimeoutCb = timeoutOps.cb;
|
|
12505
|
-
}
|
|
12506
|
-
}
|
|
12507
|
-
|
|
12508
|
-
var self = this;
|
|
12509
|
-
if (this._operationTimeoutCb) {
|
|
12510
|
-
this._timeout = setTimeout(function() {
|
|
12511
|
-
self._operationTimeoutCb();
|
|
12512
|
-
}, self._operationTimeout);
|
|
12513
|
-
}
|
|
12514
|
-
|
|
12515
|
-
this._operationStart = new Date().getTime();
|
|
12516
|
-
|
|
12517
|
-
this._fn(this._attempts);
|
|
12518
|
-
};
|
|
12519
|
-
|
|
12520
|
-
RetryOperation.prototype.try = function(fn) {
|
|
12521
|
-
console.log('Using RetryOperation.try() is deprecated');
|
|
12522
|
-
this.attempt(fn);
|
|
12523
|
-
};
|
|
12524
|
-
|
|
12525
|
-
RetryOperation.prototype.start = function(fn) {
|
|
12526
|
-
console.log('Using RetryOperation.start() is deprecated');
|
|
12527
|
-
this.attempt(fn);
|
|
12528
|
-
};
|
|
12529
|
-
|
|
12530
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
12531
|
-
|
|
12532
|
-
RetryOperation.prototype.errors = function() {
|
|
12533
|
-
return this._errors;
|
|
12534
|
-
};
|
|
9253
|
+
RetryOperation.prototype.errors = function() {
|
|
9254
|
+
return this._errors;
|
|
9255
|
+
};
|
|
12535
9256
|
|
|
12536
9257
|
RetryOperation.prototype.attempts = function() {
|
|
12537
9258
|
return this._attempts;
|
|
@@ -13507,7 +10228,7 @@ const checkFile = async (path) => {
|
|
|
13507
10228
|
exists: true
|
|
13508
10229
|
};
|
|
13509
10230
|
try {
|
|
13510
|
-
const stats = await fs$
|
|
10231
|
+
const stats = await fs$j.promises.stat(path);
|
|
13511
10232
|
if (stats.size === 0) {
|
|
13512
10233
|
validity.empty = true;
|
|
13513
10234
|
}
|
|
@@ -13580,9 +10301,9 @@ const getPayload = async (sourcemap, metadata, prefix, git) => {
|
|
|
13580
10301
|
{
|
|
13581
10302
|
files: git.trackedFilesMatcher.matchSourcemap(
|
|
13582
10303
|
sourcemap.sourcemapFilePath,
|
|
13583
|
-
() => {
|
|
10304
|
+
(reason) => {
|
|
13584
10305
|
warnings.push(
|
|
13585
|
-
`No tracked files found for sources contained in ${sourcemap.sourcemapFilePath}`
|
|
10306
|
+
`No tracked files found for sources contained in ${sourcemap.sourcemapFilePath}: "${reason}"`
|
|
13586
10307
|
);
|
|
13587
10308
|
}
|
|
13588
10309
|
),
|
|
@@ -13664,11 +10385,11 @@ const doRequest = async (url, getData2, onRetry) => {
|
|
|
13664
10385
|
);
|
|
13665
10386
|
};
|
|
13666
10387
|
const getFile = async (path, options) => {
|
|
13667
|
-
if (typeof fs$
|
|
13668
|
-
const blob = await fs$
|
|
10388
|
+
if (typeof fs$j.openAsBlob === "function") {
|
|
10389
|
+
const blob = await fs$j.openAsBlob(path, { type: options.contentType });
|
|
13669
10390
|
return new buffer$2.File([blob], options.filename);
|
|
13670
10391
|
} else {
|
|
13671
|
-
const stream = require$$0$2.Readable.toWeb(fs$
|
|
10392
|
+
const stream = require$$0$2.Readable.toWeb(fs$j.createReadStream(path));
|
|
13672
10393
|
const blob = await new Response(stream).blob();
|
|
13673
10394
|
const file = new buffer$2.File([blob], options.filename, { type: options.contentType });
|
|
13674
10395
|
return file;
|
|
@@ -13710,8 +10431,14 @@ const upload = async (payloads, options, context, log) => {
|
|
|
13710
10431
|
};
|
|
13711
10432
|
for (const payload of payloads) {
|
|
13712
10433
|
const metadata = {
|
|
13713
|
-
sourcemap: payload.content.get("source_map")?.path
|
|
13714
|
-
|
|
10434
|
+
sourcemap: payload.content.get("source_map")?.path.replace(
|
|
10435
|
+
context.outputDir,
|
|
10436
|
+
"."
|
|
10437
|
+
),
|
|
10438
|
+
file: payload.content.get("minified_file")?.path.replace(
|
|
10439
|
+
context.outputDir,
|
|
10440
|
+
"."
|
|
10441
|
+
)
|
|
13715
10442
|
};
|
|
13716
10443
|
log(`Queuing ${green(metadata.sourcemap)} | ${green(metadata.file)}`);
|
|
13717
10444
|
queue.add(async () => {
|
|
@@ -13737,7 +10464,7 @@ const sendSourcemaps = async (sourcemaps, options, context, log) => {
|
|
|
13737
10464
|
git_repository_url: context.git?.remote,
|
|
13738
10465
|
git_commit_sha: context.git?.hash,
|
|
13739
10466
|
plugin_version: context.version,
|
|
13740
|
-
project_path:
|
|
10467
|
+
project_path: context.outputDir,
|
|
13741
10468
|
service: options.service,
|
|
13742
10469
|
type: "js_sourcemap",
|
|
13743
10470
|
version: options.releaseVersion
|
|
@@ -13768,7 +10495,7 @@ const sendSourcemaps = async (sourcemaps, options, context, log) => {
|
|
|
13768
10495
|
const uploadSourcemaps = async (options, context, log) => {
|
|
13769
10496
|
const green = chalk.green.bold;
|
|
13770
10497
|
const configurationString = Object.entries(options.sourcemaps).map(([key, value]) => ` - ${key}: ${green(value.toString())}`).join("\n");
|
|
13771
|
-
const sourcemaps = getSourcemapsFiles(options.sourcemaps);
|
|
10498
|
+
const sourcemaps = getSourcemapsFiles(options.sourcemaps, context);
|
|
13772
10499
|
const summary = defaultOutdent`
|
|
13773
10500
|
Uploading ${green(sourcemaps.length.toString())} sourcemaps with configuration:
|
|
13774
10501
|
${configurationString}
|
|
@@ -13814,9 +10541,6 @@ const validateSourcemapsOptions = (config) => {
|
|
|
13814
10541
|
errors: []
|
|
13815
10542
|
};
|
|
13816
10543
|
if (validatedOptions.sourcemaps) {
|
|
13817
|
-
if (!validatedOptions.sourcemaps.basePath) {
|
|
13818
|
-
toReturn.errors.push(`${red("sourcemaps.basePath")} is required.`);
|
|
13819
|
-
}
|
|
13820
10544
|
if (!validatedOptions.sourcemaps.releaseVersion) {
|
|
13821
10545
|
toReturn.errors.push(`${red("sourcemaps.releaseVersion")} is required.`);
|
|
13822
10546
|
}
|
|
@@ -14438,7 +11162,7 @@ function clone$1 (obj) {
|
|
|
14438
11162
|
return copy
|
|
14439
11163
|
}
|
|
14440
11164
|
|
|
14441
|
-
var fs$h = fs$
|
|
11165
|
+
var fs$h = fs$j;
|
|
14442
11166
|
var polyfills = polyfills$1;
|
|
14443
11167
|
var legacy = legacyStreams;
|
|
14444
11168
|
var clone = clone_1;
|
|
@@ -14524,7 +11248,7 @@ if (!fs$h[gracefulQueue]) {
|
|
|
14524
11248
|
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
|
|
14525
11249
|
process.on('exit', function() {
|
|
14526
11250
|
debug(fs$h[gracefulQueue]);
|
|
14527
|
-
require$$
|
|
11251
|
+
require$$5.equal(fs$h[gracefulQueue].length, 0);
|
|
14528
11252
|
});
|
|
14529
11253
|
}
|
|
14530
11254
|
}
|
|
@@ -15696,7 +12420,7 @@ var copy$1 = {
|
|
|
15696
12420
|
|
|
15697
12421
|
const fs$a = gracefulFs;
|
|
15698
12422
|
const path$a = require$$1$1;
|
|
15699
|
-
const assert = require$$
|
|
12423
|
+
const assert = require$$5;
|
|
15700
12424
|
|
|
15701
12425
|
const isWindows = (process.platform === 'win32');
|
|
15702
12426
|
|
|
@@ -16016,7 +12740,7 @@ var remove$3 = {
|
|
|
16016
12740
|
};
|
|
16017
12741
|
|
|
16018
12742
|
const u$7 = universalify.fromCallback;
|
|
16019
|
-
const fs$9 = fs$
|
|
12743
|
+
const fs$9 = fs$j;
|
|
16020
12744
|
const path$9 = require$$1$1;
|
|
16021
12745
|
const mkdir$5 = mkdirs_1;
|
|
16022
12746
|
const remove$2 = remove$3;
|
|
@@ -16386,7 +13110,7 @@ var _fs;
|
|
|
16386
13110
|
try {
|
|
16387
13111
|
_fs = gracefulFs;
|
|
16388
13112
|
} catch (_) {
|
|
16389
|
-
_fs = fs$
|
|
13113
|
+
_fs = fs$j;
|
|
16390
13114
|
}
|
|
16391
13115
|
|
|
16392
13116
|
function readFile (file, options, callback) {
|
|
@@ -16844,7 +13568,7 @@ var output$1 = {
|
|
|
16844
13568
|
|
|
16845
13569
|
// Export fs.promises as a getter property so that we don't trigger
|
|
16846
13570
|
// ExperimentalWarning before fs.promises is actually accessed.
|
|
16847
|
-
const fs = fs$
|
|
13571
|
+
const fs = fs$j;
|
|
16848
13572
|
if (Object.getOwnPropertyDescriptor(fs, 'promises')) {
|
|
16849
13573
|
Object.defineProperty(module.exports, 'promises', {
|
|
16850
13574
|
get () { return fs.promises }
|
|
@@ -29145,9 +25869,9 @@ function createBuildContext(initialOptions) {
|
|
|
29145
25869
|
if (initialOptions.outdir && emittedFile.source && outFileName) {
|
|
29146
25870
|
const outPath = require$$1$1.resolve(initialOptions.outdir, outFileName);
|
|
29147
25871
|
const outDir = require$$1$1.dirname(outPath);
|
|
29148
|
-
if (!fs$
|
|
29149
|
-
fs$
|
|
29150
|
-
fs$
|
|
25872
|
+
if (!fs$j.existsSync(outDir))
|
|
25873
|
+
fs$j.mkdirSync(outDir, { recursive: true });
|
|
25874
|
+
fs$j.writeFileSync(outPath, emittedFile.source);
|
|
29151
25875
|
}
|
|
29152
25876
|
},
|
|
29153
25877
|
getWatchFiles() {
|
|
@@ -29259,7 +25983,7 @@ function getEsbuildPlugin(factory) {
|
|
|
29259
25983
|
return result.contents;
|
|
29260
25984
|
if (fsContentsCache)
|
|
29261
25985
|
return fsContentsCache;
|
|
29262
|
-
return fsContentsCache = await fs$
|
|
25986
|
+
return fsContentsCache = await fs$j.promises.readFile(args.path, "utf8");
|
|
29263
25987
|
}
|
|
29264
25988
|
};
|
|
29265
25989
|
const _result = await onTransformCb(newArgs);
|
|
@@ -29840,8 +26564,8 @@ function getRspackPlugin(factory) {
|
|
|
29840
26564
|
});
|
|
29841
26565
|
}
|
|
29842
26566
|
if (plugin.writeBundle) {
|
|
29843
|
-
compiler.hooks.afterEmit.
|
|
29844
|
-
plugin.writeBundle();
|
|
26567
|
+
compiler.hooks.afterEmit.tapPromise(plugin.name, async () => {
|
|
26568
|
+
await plugin.writeBundle();
|
|
29845
26569
|
});
|
|
29846
26570
|
}
|
|
29847
26571
|
}
|
|
@@ -30010,7 +26734,7 @@ function getWebpackPlugin(factory) {
|
|
|
30010
26734
|
const isExternal = typeof resolveIdResult === "string" ? false : resolveIdResult.external === true;
|
|
30011
26735
|
if (isExternal)
|
|
30012
26736
|
externalModules.add(resolved);
|
|
30013
|
-
if (!fs$
|
|
26737
|
+
if (!fs$j.existsSync(resolved)) {
|
|
30014
26738
|
resolved = normalizeAbsolutePath(
|
|
30015
26739
|
plugin.__virtualModulePrefix + encodeURIComponent(resolved)
|
|
30016
26740
|
// URI encode id so webpack doesn't think it's part of the path
|
|
@@ -30082,8 +26806,8 @@ function getWebpackPlugin(factory) {
|
|
|
30082
26806
|
});
|
|
30083
26807
|
}
|
|
30084
26808
|
if (plugin.writeBundle) {
|
|
30085
|
-
compiler.hooks.afterEmit.
|
|
30086
|
-
plugin.writeBundle();
|
|
26809
|
+
compiler.hooks.afterEmit.tapPromise(plugin.name, async () => {
|
|
26810
|
+
await plugin.writeBundle();
|
|
30087
26811
|
});
|
|
30088
26812
|
}
|
|
30089
26813
|
}
|
|
@@ -30152,7 +26876,7 @@ const buildPluginFactory = ({
|
|
|
30152
26876
|
|
|
30153
26877
|
var name = "@datadog/esbuild-plugin";
|
|
30154
26878
|
var packageManager = "yarn@4.0.2";
|
|
30155
|
-
var version = "2.0.2-dev-
|
|
26879
|
+
var version = "2.0.2-dev-8";
|
|
30156
26880
|
var license = "MIT";
|
|
30157
26881
|
var author = "Datadog";
|
|
30158
26882
|
var description = "Datadog ESBuild Plugin";
|
|
@@ -30208,8 +26932,8 @@ var devDependencies = {
|
|
|
30208
26932
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
30209
26933
|
"@types/babel__core": "^7",
|
|
30210
26934
|
"@types/babel__preset-env": "^7",
|
|
30211
|
-
esbuild: "0.
|
|
30212
|
-
rollup: "4.
|
|
26935
|
+
esbuild: "0.21.5",
|
|
26936
|
+
rollup: "4.18.0",
|
|
30213
26937
|
"rollup-plugin-dts": "6.1.0",
|
|
30214
26938
|
"rollup-plugin-esbuild": "6.1.1",
|
|
30215
26939
|
typescript: "5.4.3"
|