rollup 2.51.0 → 2.52.1

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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.51.0
4
- Sun, 06 Jun 2021 11:27:34 GMT - commit 592b9fed918ccc99d48ece917a70015ac1898e52
3
+ Rollup.js v2.52.1
4
+ Thu, 17 Jun 2021 05:22:05 GMT - commit bef5fe8a573648f73c258ce9adf1a7ff3ffb129d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -11,7 +11,7 @@
11
11
  import * as require$$0$1 from 'path';
12
12
  import require$$0__default, { sep, resolve } from 'path';
13
13
  import require$$0$2 from 'util';
14
- import { defaultOnWarn, ensureArray as ensureArray$1, warnUnknownOptions, fseventsImporter, rollupInternal } from './rollup.js';
14
+ import { defaultOnWarn, ensureArray as ensureArray$1, warnUnknownOptions, error, errInvalidOption, printQuotedStringList, treeshakePresets, fseventsImporter, rollupInternal } from './rollup.js';
15
15
  import require$$2, { platform } from 'os';
16
16
  import require$$0$3 from 'events';
17
17
  import fs__default from 'fs';
@@ -1731,7 +1731,8 @@ const depth = token => {
1731
1731
  /**
1732
1732
  * Quickly scans a glob pattern and returns an object with a handful of
1733
1733
  * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
1734
- * `glob` (the actual pattern), and `negated` (true if the path starts with `!`).
1734
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
1735
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
1735
1736
  *
1736
1737
  * ```js
1737
1738
  * const pm = require('picomatch');
@@ -1765,6 +1766,7 @@ const scan$1 = (input, options) => {
1765
1766
  let braceEscaped = false;
1766
1767
  let backslashes = false;
1767
1768
  let negated = false;
1769
+ let negatedExtglob = false;
1768
1770
  let finished = false;
1769
1771
  let braces = 0;
1770
1772
  let prev;
@@ -1876,6 +1878,9 @@ const scan$1 = (input, options) => {
1876
1878
  isGlob = token.isGlob = true;
1877
1879
  isExtglob = token.isExtglob = true;
1878
1880
  finished = true;
1881
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
1882
+ negatedExtglob = true;
1883
+ }
1879
1884
 
1880
1885
  if (scanToEnd === true) {
1881
1886
  while (eos() !== true && (code = advance())) {
@@ -2029,7 +2034,8 @@ const scan$1 = (input, options) => {
2029
2034
  isGlob,
2030
2035
  isExtglob,
2031
2036
  isGlobstar,
2032
- negated
2037
+ negated,
2038
+ negatedExtglob
2033
2039
  };
2034
2040
 
2035
2041
  if (opts.tokens === true) {
@@ -2168,7 +2174,7 @@ const parse$1 = (input, options) => {
2168
2174
  START_ANCHOR
2169
2175
  } = PLATFORM_CHARS;
2170
2176
 
2171
- const globstar = (opts) => {
2177
+ const globstar = opts => {
2172
2178
  return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
2173
2179
  };
2174
2180
 
@@ -2218,12 +2224,13 @@ const parse$1 = (input, options) => {
2218
2224
 
2219
2225
  const eos = () => state.index === len - 1;
2220
2226
  const peek = state.peek = (n = 1) => input[state.index + n];
2221
- const advance = state.advance = () => input[++state.index];
2227
+ const advance = state.advance = () => input[++state.index] || '';
2222
2228
  const remaining = () => input.slice(state.index + 1);
2223
2229
  const consume = (value = '', num = 0) => {
2224
2230
  state.consumed += value;
2225
2231
  state.index += num;
2226
2232
  };
2233
+
2227
2234
  const append = token => {
2228
2235
  state.output += token.output != null ? token.output : token.value;
2229
2236
  consume(token.value);
@@ -2279,7 +2286,7 @@ const parse$1 = (input, options) => {
2279
2286
  }
2280
2287
  }
2281
2288
 
2282
- if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) {
2289
+ if (extglobs.length && tok.type !== 'paren') {
2283
2290
  extglobs[extglobs.length - 1].inner += tok.value;
2284
2291
  }
2285
2292
 
@@ -2311,6 +2318,7 @@ const parse$1 = (input, options) => {
2311
2318
 
2312
2319
  const extglobClose = token => {
2313
2320
  let output = token.close + (opts.capture ? ')' : '');
2321
+ let rest;
2314
2322
 
2315
2323
  if (token.type === 'negate') {
2316
2324
  let extglobStar = star;
@@ -2323,6 +2331,10 @@ const parse$1 = (input, options) => {
2323
2331
  output = token.close = `)$))${extglobStar}`;
2324
2332
  }
2325
2333
 
2334
+ if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
2335
+ output = token.close = `)${rest})${extglobStar})`;
2336
+ }
2337
+
2326
2338
  if (token.prev.type === 'bos') {
2327
2339
  state.negatedExtglob = true;
2328
2340
  }
@@ -2432,9 +2444,9 @@ const parse$1 = (input, options) => {
2432
2444
  }
2433
2445
 
2434
2446
  if (opts.unescape === true) {
2435
- value = advance() || '';
2447
+ value = advance();
2436
2448
  } else {
2437
- value += advance() || '';
2449
+ value += advance();
2438
2450
  }
2439
2451
 
2440
2452
  if (state.brackets === 0) {
@@ -3098,7 +3110,7 @@ parse$1.fastpaths = (input, options) => {
3098
3110
  star = `(${star})`;
3099
3111
  }
3100
3112
 
3101
- const globstar = (opts) => {
3113
+ const globstar = opts => {
3102
3114
  if (opts.noglobstar === true) return star;
3103
3115
  return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
3104
3116
  };
@@ -3384,68 +3396,71 @@ picomatch$4.parse = (pattern, options) => {
3384
3396
  picomatch$4.scan = (input, options) => scan(input, options);
3385
3397
 
3386
3398
  /**
3387
- * Create a regular expression from a parsed glob pattern.
3388
- *
3389
- * ```js
3390
- * const picomatch = require('picomatch');
3391
- * const state = picomatch.parse('*.js');
3392
- * // picomatch.compileRe(state[, options]);
3399
+ * Compile a regular expression from the `state` object returned by the
3400
+ * [parse()](#parse) method.
3393
3401
  *
3394
- * console.log(picomatch.compileRe(state));
3395
- * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
3396
- * ```
3397
- * @param {String} `state` The object returned from the `.parse` method.
3402
+ * @param {Object} `state`
3398
3403
  * @param {Object} `options`
3399
- * @return {RegExp} Returns a regex created from the given pattern.
3404
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
3405
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
3406
+ * @return {RegExp}
3400
3407
  * @api public
3401
3408
  */
3402
3409
 
3403
- picomatch$4.compileRe = (parsed, options, returnOutput = false, returnState = false) => {
3410
+ picomatch$4.compileRe = (state, options, returnOutput = false, returnState = false) => {
3404
3411
  if (returnOutput === true) {
3405
- return parsed.output;
3412
+ return state.output;
3406
3413
  }
3407
3414
 
3408
3415
  const opts = options || {};
3409
3416
  const prepend = opts.contains ? '' : '^';
3410
3417
  const append = opts.contains ? '' : '$';
3411
3418
 
3412
- let source = `${prepend}(?:${parsed.output})${append}`;
3413
- if (parsed && parsed.negated === true) {
3419
+ let source = `${prepend}(?:${state.output})${append}`;
3420
+ if (state && state.negated === true) {
3414
3421
  source = `^(?!${source}).*$`;
3415
3422
  }
3416
3423
 
3417
3424
  const regex = picomatch$4.toRegex(source, options);
3418
3425
  if (returnState === true) {
3419
- regex.state = parsed;
3426
+ regex.state = state;
3420
3427
  }
3421
3428
 
3422
3429
  return regex;
3423
3430
  };
3424
3431
 
3425
- picomatch$4.makeRe = (input, options, returnOutput = false, returnState = false) => {
3432
+ /**
3433
+ * Create a regular expression from a parsed glob pattern.
3434
+ *
3435
+ * ```js
3436
+ * const picomatch = require('picomatch');
3437
+ * const state = picomatch.parse('*.js');
3438
+ * // picomatch.compileRe(state[, options]);
3439
+ *
3440
+ * console.log(picomatch.compileRe(state));
3441
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
3442
+ * ```
3443
+ * @param {String} `state` The object returned from the `.parse` method.
3444
+ * @param {Object} `options`
3445
+ * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
3446
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
3447
+ * @return {RegExp} Returns a regex created from the given pattern.
3448
+ * @api public
3449
+ */
3450
+
3451
+ picomatch$4.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
3426
3452
  if (!input || typeof input !== 'string') {
3427
3453
  throw new TypeError('Expected a non-empty string');
3428
3454
  }
3429
3455
 
3430
- const opts = options || {};
3431
3456
  let parsed = { negated: false, fastpaths: true };
3432
- let prefix = '';
3433
- let output;
3434
-
3435
- if (input.startsWith('./')) {
3436
- input = input.slice(2);
3437
- prefix = parsed.prefix = './';
3438
- }
3439
3457
 
3440
- if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
3441
- output = parse.fastpaths(input, options);
3458
+ if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
3459
+ parsed.output = parse.fastpaths(input, options);
3442
3460
  }
3443
3461
 
3444
- if (output === undefined) {
3462
+ if (!parsed.output) {
3445
3463
  parsed = parse(input, options);
3446
- parsed.prefix = prefix + (parsed.prefix || '');
3447
- } else {
3448
- parsed.output = output;
3449
3464
  }
3450
3465
 
3451
3466
  return picomatch$4.compileRe(parsed, options, returnOutput, returnState);
@@ -4032,7 +4047,7 @@ function mergeOptions(config, rawCommandOptions = { external: [], globals: undef
4032
4047
  if (outputOptionsArray.length === 0)
4033
4048
  outputOptionsArray.push({});
4034
4049
  const outputOptions = outputOptionsArray.map(singleOutputOptions => mergeOutputOptions(singleOutputOptions, command, warn));
4035
- warnUnknownOptions(command, Object.keys(inputOptions).concat(Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapPathTransform'), Object.keys(commandAliases), 'config', 'environment', 'plugin', 'silent', 'failAfterWarnings', 'stdin', 'waitForBundleInput'), 'CLI flags', warn, /^_$|output$|config/);
4050
+ warnUnknownOptions(command, Object.keys(inputOptions).concat(Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapPathTransform'), Object.keys(commandAliases), 'config', 'environment', 'plugin', 'silent', 'failAfterWarnings', 'stdin', 'waitForBundleInput', 'configPlugin'), 'CLI flags', warn, /^_$|output$|config/);
4036
4051
  inputOptions.output = outputOptions;
4037
4052
  return inputOptions;
4038
4053
  }
@@ -4077,7 +4092,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
4077
4092
  preserveSymlinks: getOption('preserveSymlinks'),
4078
4093
  shimMissingExports: getOption('shimMissingExports'),
4079
4094
  strictDeprecations: getOption('strictDeprecations'),
4080
- treeshake: getObjectOption(config, overrides, 'treeshake'),
4095
+ treeshake: getObjectOption(config, overrides, 'treeshake', objectifyTreeshakeOption),
4081
4096
  watch: getWatch(config, overrides, 'watch')
4082
4097
  };
4083
4098
  warnUnknownOptions(config, Object.keys(inputOptions), 'input options', inputOptions.onwarn, /^output$/);
@@ -4092,26 +4107,33 @@ const getExternal = (config, overrides) => {
4092
4107
  const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
4093
4108
  ? warning => config.onwarn(warning, defaultOnWarnHandler)
4094
4109
  : defaultOnWarnHandler;
4095
- const getObjectOption = (config, overrides, name) => {
4096
- const commandOption = normalizeObjectOptionValue(overrides[name]);
4097
- const configOption = normalizeObjectOptionValue(config[name]);
4110
+ const getObjectOption = (config, overrides, name, objectifyValue = value => (typeof value === 'object' ? value : {})) => {
4111
+ const commandOption = normalizeObjectOptionValue(overrides[name], objectifyValue);
4112
+ const configOption = normalizeObjectOptionValue(config[name], objectifyValue);
4098
4113
  if (commandOption !== undefined) {
4099
4114
  return commandOption && { ...configOption, ...commandOption };
4100
4115
  }
4101
4116
  return configOption;
4102
4117
  };
4118
+ const objectifyTreeshakeOption = (value) => {
4119
+ if (typeof value === 'string') {
4120
+ const preset = treeshakePresets[value];
4121
+ if (preset) {
4122
+ return preset;
4123
+ }
4124
+ error(errInvalidOption('treeshake', `valid values are false, true, ${printQuotedStringList(Object.keys(treeshakePresets))}. You can also supply an object for more fine-grained control`));
4125
+ }
4126
+ return typeof value === 'object' ? value : {};
4127
+ };
4103
4128
  const getWatch = (config, overrides, name) => config.watch !== false && getObjectOption(config, overrides, name);
4104
- const normalizeObjectOptionValue = (optionValue) => {
4129
+ const normalizeObjectOptionValue = (optionValue, objectifyValue) => {
4105
4130
  if (!optionValue) {
4106
4131
  return optionValue;
4107
4132
  }
4108
4133
  if (Array.isArray(optionValue)) {
4109
- return optionValue.reduce((result, value) => value && result && { ...result, ...value }, {});
4110
- }
4111
- if (typeof optionValue !== 'object') {
4112
- return {};
4134
+ return optionValue.reduce((result, value) => value && result && { ...result, ...objectifyValue(value) }, {});
4113
4135
  }
4114
- return optionValue;
4136
+ return objectifyValue(optionValue);
4115
4137
  };
4116
4138
  function mergeOutputOptions(config, overrides, warn) {
4117
4139
  const getOption = (name) => { var _a; return (_a = overrides[name]) !== null && _a !== void 0 ? _a : config[name]; };
@@ -4185,7 +4207,8 @@ const realpath$1 = promisify$3(fs$3.realpath);
4185
4207
  */
4186
4208
 
4187
4209
  const BANG$2 = '!';
4188
- const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP']);
4210
+ const RECURSIVE_ERROR_CODE = 'READDIRP_RECURSIVE_ERROR';
4211
+ const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP', RECURSIVE_ERROR_CODE]);
4189
4212
  const FILE_TYPE = 'files';
4190
4213
  const DIR_TYPE = 'directories';
4191
4214
  const FILE_DIR_TYPE = 'files_directories';
@@ -4193,6 +4216,8 @@ const EVERYTHING_TYPE = 'all';
4193
4216
  const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE];
4194
4217
 
4195
4218
  const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code);
4219
+ const [maj, min] = process.versions.node.split('.').slice(0, 2).map(n => Number.parseInt(n, 10));
4220
+ const wantBigintFsStats = process.platform === 'win32' && (maj > 10 || (maj === 10 && min >= 5));
4196
4221
 
4197
4222
  const normalizeFilter = filter => {
4198
4223
  if (filter === undefined) return;
@@ -4255,7 +4280,7 @@ class ReaddirpStream extends Readable {
4255
4280
 
4256
4281
  const statMethod = opts.lstat ? lstat$2 : stat$3;
4257
4282
  // Use bigint stats if it's windows and stat() supports options (node 10+).
4258
- if (process.platform === 'win32' && stat$3.length === 3) {
4283
+ if (wantBigintFsStats) {
4259
4284
  this._stat = path => statMethod(path, { bigint: true });
4260
4285
  } else {
4261
4286
  this._stat = statMethod;
@@ -4330,7 +4355,7 @@ class ReaddirpStream extends Readable {
4330
4355
  } catch (error) {
4331
4356
  this._onError(error);
4332
4357
  }
4333
- return {files, depth, path};
4358
+ return { files, depth, path };
4334
4359
  }
4335
4360
 
4336
4361
  async _formatEntry(dirent, path) {
@@ -4338,7 +4363,7 @@ class ReaddirpStream extends Readable {
4338
4363
  try {
4339
4364
  const basename = this._isDirent ? dirent.name : dirent;
4340
4365
  const fullPath = sysPath$3.resolve(sysPath$3.join(path, basename));
4341
- entry = {path: sysPath$3.relative(this._root, fullPath), fullPath, basename};
4366
+ entry = { path: sysPath$3.relative(this._root, fullPath), fullPath, basename };
4342
4367
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
4343
4368
  } catch (err) {
4344
4369
  this._onError(err);
@@ -4378,9 +4403,11 @@ class ReaddirpStream extends Readable {
4378
4403
  if (entryRealPathStats.isDirectory()) {
4379
4404
  const len = entryRealPath.length;
4380
4405
  if (full.startsWith(entryRealPath) && full.substr(len, 1) === sysPath$3.sep) {
4381
- return this._onError(new Error(
4406
+ const recursiveError = new Error(
4382
4407
  `Circular symlink detected: "${full}" points to "${entryRealPath}"`
4383
- ));
4408
+ );
4409
+ recursiveError.code = RECURSIVE_ERROR_CODE;
4410
+ return this._onError(recursiveError);
4384
4411
  }
4385
4412
  return 'directory';
4386
4413
  }
@@ -4973,6 +5000,7 @@ var constants = {};
4973
5000
 
4974
5001
  const {sep} = require$$0__default;
4975
5002
  const {platform} = process;
5003
+ const os = require$$2;
4976
5004
 
4977
5005
  exports.EV_ALL = 'all';
4978
5006
  exports.EV_READY = 'ready';
@@ -5032,6 +5060,7 @@ exports.IDENTITY_FN = val => val;
5032
5060
  exports.isWindows = platform === 'win32';
5033
5061
  exports.isMacos = platform === 'darwin';
5034
5062
  exports.isLinux = platform === 'linux';
5063
+ exports.isIBMi = os.type() === 'OS400';
5035
5064
  }(constants));
5036
5065
 
5037
5066
  const fs$2 = fs__default;
@@ -5777,7 +5806,8 @@ const createFSEventsInstance = (path, callback) => {
5777
5806
  * @returns {Function} closer
5778
5807
  */
5779
5808
  function setFSEventsListener(path, realPath, listener, rawEmitter) {
5780
- let watchPath = sysPath$1.extname(path) ? sysPath$1.dirname(path) : path;
5809
+ let watchPath = sysPath$1.extname(realPath) ? sysPath$1.dirname(realPath) : realPath;
5810
+
5781
5811
  const parentPath = sysPath$1.dirname(watchPath);
5782
5812
  let cont = FSEventsWatchers.get(watchPath);
5783
5813
 
@@ -6243,7 +6273,8 @@ const {
6243
6273
  EMPTY_FN,
6244
6274
 
6245
6275
  isWindows,
6246
- isMacos
6276
+ isMacos,
6277
+ isIBMi
6247
6278
  } = constants;
6248
6279
 
6249
6280
  const stat = promisify(fs.stat);
@@ -6525,6 +6556,11 @@ constructor(_opts) {
6525
6556
  opts.usePolling = isMacos;
6526
6557
  }
6527
6558
 
6559
+ // Always default to polling on IBM i because fs.watch() is not available on IBM i.
6560
+ if(isIBMi) {
6561
+ opts.usePolling = true;
6562
+ }
6563
+
6528
6564
  // Global override (useful for end-developers that need to force polling for all
6529
6565
  // instances of chokidar, regardless of usage/dependency depth)
6530
6566
  const envPoll = process.env.CHOKIDAR_USEPOLLING;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.51.0
4
- Sun, 06 Jun 2021 11:27:34 GMT - commit 592b9fed918ccc99d48ece917a70015ac1898e52
3
+ Rollup.js v2.52.1
4
+ Thu, 17 Jun 2021 05:22:05 GMT - commit bef5fe8a573648f73c258ce9adf1a7ff3ffb129d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup