@automattic/vip 2.9.1 → 2.9.4

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/CONTRIBUTING.md CHANGED
@@ -131,3 +131,9 @@ For these cases:
131
131
  1. Follow the release steps outlined above (as a `patch` release).
132
132
 
133
133
  Then, repeat for any additional versions that we need to patch.
134
+
135
+ ### go-search-replace binaries
136
+
137
+ Some unit tests require some go-search-replace executable binary files to run. Binaries files for several OS architectures can be downloaded from https://github.com/Automattic/go-search-replace/releases/
138
+
139
+ If, for some reason, you need to compile these binaries yourself, please follow instructions at https://github.com/Automattic/go-search-replace
package/README.md CHANGED
@@ -27,6 +27,29 @@ By default, we record information about the usage of this tool using an in-house
27
27
 
28
28
  ## Changelog
29
29
 
30
+ ### 2.9.4 (07 April 2022)
31
+ - #996 Clean up lint warnings
32
+ - #1001 Fix reconnect event listeners
33
+ - #1000 Bump socket.io-client from 4.0.1 to 4.4.1
34
+
35
+ ### 2.9.3 (29 March 2022)
36
+ - #995 Add debug call to dev-envs handleCLIException
37
+ - #992 Add --debug flag to all commands
38
+ - #993 [dev-env] Fix in caching version list.
39
+ - #994 Fix typo in error message
40
+ - #990 [dev-env] Add check for wp folder map add/php_healthcheck
41
+ - #991 Adds optional channing since `progress` can be null as per GraphQL schema
42
+ - #989 Fixes unit test error `bsdthread_register error`
43
+ - #987 Add support for M1 Macs in the search-replace tests
44
+
45
+ ### 2.9.2 (9 March 2022)
46
+ - #980 [dev-env] Fix/tag formatting on stapled images
47
+ - #986 Clean the build folder prior to rebuilding it
48
+ - #985 Adding webP to the list of accepted extensions for files
49
+ - #972 Run tests in Windows Env
50
+
51
+ https://github.com/Automattic/vip/releases/tag/v2.9.2
52
+
30
53
  ### 2.9.1 (2 March 2022)
31
54
  - #982 Remove unused dependencies - Fixes Error: Cannot find module 'core-js'
32
55
  - #978 [dev-env] Added phpmyadmin proxy value
@@ -40,6 +40,8 @@ services:
40
40
  image: ghcr.io/automattic/vip-container-images/php-fpm:7.4
41
41
  command: run.sh
42
42
  working_dir: /wp
43
+ healthcheck:
44
+ test: 'cat /wp/wp-includes/pomo/mo.php'
43
45
  environment:
44
46
  XDEBUG: <%= xdebug ? 'enable' : 'disable' %>
45
47
  STATSD: <%= statsd ? 'enable' : 'disable' %>
@@ -12,8 +12,6 @@
12
12
 
13
13
  var _fs = _interopRequireDefault(require("fs"));
14
14
 
15
- var _chalk = _interopRequireDefault(require("chalk"));
16
-
17
15
  var _command = _interopRequireDefault(require("../lib/cli/command"));
18
16
 
19
17
  var _devEnvironmentCli = require("../lib/dev-environment/dev-environment-cli");
@@ -54,8 +54,6 @@ var _progress = require("../lib/cli/progress");
54
54
 
55
55
  var _isMultiSite = require("../lib/validations/is-multi-site");
56
56
 
57
- var _path = _interopRequireDefault(require("path"));
58
-
59
57
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
60
58
 
61
59
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -90,7 +90,7 @@ const bindStreamEvents = ({
90
90
  stdoutStream.on('error', err => {
91
91
  commandRunning = false; // TODO handle this better
92
92
 
93
- console.log('Error: ' + err.message);
93
+ console.error('Error: ' + err.message);
94
94
  });
95
95
  stdoutStream.on('end', async () => {
96
96
  subShellRl.clearLine();
@@ -396,7 +396,7 @@ const launchCommandAndGetStreams = async ({
396
396
  isSubShell,
397
397
  stdoutStream: currentJob.stdoutStream
398
398
  });
399
- currentJob.socket.on('reconnect', async () => {
399
+ currentJob.socket.io.on('reconnect', async () => {
400
400
  // Close old streams
401
401
  unpipeStreamsFromProcess({
402
402
  stdin: currentJob.stdinStream,
@@ -422,7 +422,7 @@ const launchCommandAndGetStreams = async ({
422
422
 
423
423
  subShellRl.resume();
424
424
  });
425
- currentJob.socket.on('reconnect_attempt', () => {
425
+ currentJob.socket.io.on('reconnect_attempt', () => {
426
426
  // create a new input stream so that we can still catch things like SIGINT while reconnectin
427
427
  if (currentJob.stdinStream) {
428
428
  process.stdin.unpipe(currentJob.stdinStream);
@@ -37,6 +37,8 @@ var _rollbar = require("../rollbar");
37
37
 
38
38
  var exit = _interopRequireWildcard(require("./exit"));
39
39
 
40
+ var _debug = _interopRequireDefault(require("debug"));
41
+
40
42
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41
43
 
42
44
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -80,7 +82,8 @@ _args.default.argv = async function (argv, cb) {
80
82
  const options = this.parse(parsedAlias.argv, {
81
83
  help: false,
82
84
  name,
83
- version: false
85
+ version: false,
86
+ debug: false
84
87
  });
85
88
 
86
89
  if (options.h || options.help) {
@@ -89,6 +92,10 @@ _args.default.argv = async function (argv, cb) {
89
92
 
90
93
  if (options.v || options.version) {
91
94
  this.showVersion();
95
+ }
96
+
97
+ if (options.debug || options.d) {
98
+ _debug.default.enable(options.debug === true ? '*' : options.debug);
92
99
  } // If we have both an --app/--env and an alias, we need to give a warning
93
100
 
94
101
 
@@ -128,6 +135,7 @@ _args.default.argv = async function (argv, cb) {
128
135
  switch (command.usage) {
129
136
  case 'help':
130
137
  case 'version':
138
+ case 'debug':
131
139
  return false;
132
140
 
133
141
  default:
@@ -576,6 +584,8 @@ function _default(opts) {
576
584
 
577
585
  _args.default.option('version', 'Output the version number');
578
586
 
587
+ _args.default.option('debug', 'Activate debug output');
588
+
579
589
  return _args.default;
580
590
  }
581
591
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DEV_ENVIRONMENT_WORDPRESS_VERSION_FILE = exports.DEV_ENVIRONMENT_WORDPRESS_CACHE_KEY = exports.DEV_ENVIRONMENT_WORDPRESS_VERSIONS_URI = exports.DEV_ENVIRONMENT_RAW_GITHUB_HOST = exports.DEV_ENVIRONMENT_COMPONENTS = exports.DEV_ENVIRONMENT_NOT_FOUND = exports.DEV_ENVIRONMENT_PROMPT_INTRO = exports.DEV_ENVIRONMENT_DEFAULTS = exports.DEV_ENVIRONMENT_FULL_COMMAND = exports.DEV_ENVIRONMENT_SUBCOMMAND = void 0;
6
+ exports.DEV_ENVIRONMENT_WORDPRESS_VERSION_TTL = exports.DEV_ENVIRONMENT_WORDPRESS_CACHE_KEY = exports.DEV_ENVIRONMENT_WORDPRESS_VERSIONS_URI = exports.DEV_ENVIRONMENT_RAW_GITHUB_HOST = exports.DEV_ENVIRONMENT_COMPONENTS = exports.DEV_ENVIRONMENT_NOT_FOUND = exports.DEV_ENVIRONMENT_PROMPT_INTRO = exports.DEV_ENVIRONMENT_DEFAULTS = exports.DEV_ENVIRONMENT_FULL_COMMAND = exports.DEV_ENVIRONMENT_SUBCOMMAND = void 0;
7
7
  const DEV_ENVIRONMENT_SUBCOMMAND = 'dev-env';
8
8
  exports.DEV_ENVIRONMENT_SUBCOMMAND = DEV_ENVIRONMENT_SUBCOMMAND;
9
9
  const DEV_ENVIRONMENT_FULL_COMMAND = `vip ${DEV_ENVIRONMENT_SUBCOMMAND}`;
@@ -25,7 +25,8 @@ const DEV_ENVIRONMENT_RAW_GITHUB_HOST = 'raw.githubusercontent.com';
25
25
  exports.DEV_ENVIRONMENT_RAW_GITHUB_HOST = DEV_ENVIRONMENT_RAW_GITHUB_HOST;
26
26
  const DEV_ENVIRONMENT_WORDPRESS_VERSIONS_URI = '/Automattic/vip-container-images/master/wordpress/versions.json';
27
27
  exports.DEV_ENVIRONMENT_WORDPRESS_VERSIONS_URI = DEV_ENVIRONMENT_WORDPRESS_VERSIONS_URI;
28
- const DEV_ENVIRONMENT_WORDPRESS_CACHE_KEY = 'worpress-versions.json';
28
+ const DEV_ENVIRONMENT_WORDPRESS_CACHE_KEY = 'wordpress-versions.json';
29
29
  exports.DEV_ENVIRONMENT_WORDPRESS_CACHE_KEY = DEV_ENVIRONMENT_WORDPRESS_CACHE_KEY;
30
- const DEV_ENVIRONMENT_WORDPRESS_VERSION_FILE = 'wordpress/wp-includes/version.php';
31
- exports.DEV_ENVIRONMENT_WORDPRESS_VERSION_FILE = DEV_ENVIRONMENT_WORDPRESS_VERSION_FILE;
30
+ const DEV_ENVIRONMENT_WORDPRESS_VERSION_TTL = 86400; // once per day
31
+
32
+ exports.DEV_ENVIRONMENT_WORDPRESS_VERSION_TTL = DEV_ENVIRONMENT_WORDPRESS_VERSION_TTL;
@@ -65,6 +65,14 @@ function handleCLIException(exception) {
65
65
 
66
66
  message = message.replace('ERROR: ', '');
67
67
  console.log(errorPrefix, message);
68
+
69
+ if (!process.env.DEBUG) {
70
+ console.log(`Please re-run the command with "${_chalk.default.bold('DEBUG=@automattic/vip:bin:dev-environment')}" prepended to it and provide the stack trace on the support ticket.`);
71
+ console.log(_chalk.default.bold('\nExample:\n'));
72
+ console.log('DEBUG=@automattic/vip:bin:dev-environment vip dev-env create\n');
73
+ }
74
+
75
+ debug(exception);
68
76
  }
69
77
  }
70
78
 
@@ -338,16 +346,21 @@ async function promptForComponent(component, allowLocal, defaultObject) {
338
346
 
339
347
  if (component === 'wordpress') {
340
348
  const message = `${messagePrefix}Which version would you like`;
341
- const tagChoices = await getTagChoices(); // First tag not: "Pre-Release"
349
+ const tagChoices = await getTagChoices(); // Tag strings come back from the api with excess whitespace
350
+ // This strips the whitespace for matching to the defaultObject.tag
351
+
352
+ const formatted = tagChoices.map(elm => {
353
+ return elm.trim();
354
+ }); // First tag not: "Pre-Release"
342
355
 
343
- const firstNonPreRelease = tagChoices.find(tag => {
344
- return !tag.match(/Pre\-Release/g);
356
+ const firstNonPreRelease = formatted.find(img => {
357
+ return !img.match(/Pre\-Release/g);
345
358
  }); // Set initialTagIndex as the first non Pre-Release
346
359
 
347
- let initialTagIndex = tagChoices.indexOf(firstNonPreRelease);
360
+ let initialTagIndex = formatted.indexOf(firstNonPreRelease);
348
361
 
349
362
  if (defaultObject !== null && defaultObject !== void 0 && defaultObject.tag) {
350
- const defaultTagIndex = tagChoices.indexOf(defaultObject.tag);
363
+ const defaultTagIndex = formatted.indexOf(defaultObject.tag);
351
364
 
352
365
  if (defaultTagIndex !== -1) {
353
366
  initialTagIndex = defaultTagIndex;
@@ -356,10 +369,21 @@ async function promptForComponent(component, allowLocal, defaultObject) {
356
369
 
357
370
  const selectTag = new _enquirer.Select({
358
371
  message,
359
- choices: tagChoices,
372
+ choices: formatted,
360
373
  initial: initialTagIndex
361
374
  });
362
- const tag = await selectTag.run();
375
+ const option = await selectTag.run(); // Validate the input
376
+ // Some of the options are like: '5.7 → 5.7.5'
377
+ // Extract first occurrence of something that looks like a tag
378
+
379
+ const tagRgx = new RegExp(/(\d+\.\d+(?:\.\d+)?)/);
380
+ const match = tagRgx.exec(option);
381
+
382
+ if (!Array.isArray(match) || match.length < 2) {
383
+ throw new Error(`Invalid WordPress selection: ${option}`);
384
+ }
385
+
386
+ const tag = match[1];
363
387
  return {
364
388
  mode: modeResult,
365
389
  tag
@@ -88,9 +88,9 @@ async function startEnvironment(slug, options) {
88
88
  throw new Error(_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND);
89
89
  }
90
90
 
91
- await updateWordPressImage(instancePath, options);
91
+ const updated = await updateWordPressImage(slug);
92
92
 
93
- if (options.skipRebuild) {
93
+ if (options.skipRebuild && !updated) {
94
94
  await (0, _devEnvironmentLando.landoStart)(instancePath);
95
95
  } else {
96
96
  await (0, _devEnvironmentLando.landoRebuild)(instancePath);
@@ -466,20 +466,29 @@ async function importMediaPath(slug, filePath) {
466
466
  * - If there is a newer version of the WordPress version currently used
467
467
  * - A choice to use a different image
468
468
  *
469
- * @param {Object=} instancePath Path to local profile
470
- * @param {Object=} options options
469
+ * @param {Object=} slug slug
470
+ * @return {boolean} boolean
471
471
  */
472
472
 
473
473
 
474
- async function updateWordPressImage(instancePath, options) {
474
+ async function updateWordPressImage(slug) {
475
475
  const versions = await getVersionList();
476
476
  const refRgx = new RegExp(/\d+\.\d+(?:\.\d+)?/);
477
- const vsnRgx = new RegExp(/\$wp_version \= \'(.*)\'\;/);
478
- const landoFile = `${instancePath}/.lando.yml`;
479
- const versionFile = `${instancePath}/${_devEnvironment.DEV_ENVIRONMENT_WORDPRESS_VERSION_FILE}`; // If versionFile doesn't exist it means that the environment has not been initiated.
477
+ let message, envData, currentWordPressTag; // Get the current environment configuration
480
478
 
481
- if (!_fs.default.existsSync(versionFile)) {
482
- return;
479
+ try {
480
+ envData = readEnvironmentData(slug);
481
+ currentWordPressTag = envData.wordpress.tag;
482
+ } catch (error) {
483
+ // This can throw an exception if the env is build with older vip version
484
+ if ('ENOENT' === error.code) {
485
+ message = 'Environment was created before update was supported.\n\n';
486
+ message += 'To update environment please destroy it and create a new one.';
487
+ } else {
488
+ message = `An error prevented reading the configuration of: ${slug}\n\n ${error}`;
489
+ }
490
+
491
+ (0, _devEnvironmentCli.handleCLIException)(new Error(message));
483
492
  } // filter
484
493
 
485
494
 
@@ -490,32 +499,20 @@ async function updateWordPressImage(instancePath, options) {
490
499
  filteredVersions.sort((before, after) => before.tag < after.tag ? 1 : -1); // Newest WordPress Image
491
500
 
492
501
  const newestWordPressImage = filteredVersions[0];
493
- console.log('The most recent WordPress version available is: ' + _chalk.default.green(newestWordPressImage.tag)); // Currently Used WordPress Version
494
-
495
- const code = _fs.default.readFileSync(versionFile).toString();
496
-
497
- const versionCode = vsnRgx.exec(code);
498
- let currentWordPressVersion = null;
499
-
500
- if (null === versionCode) {
501
- console.log('Cannot determine the currently installed WordPress version.');
502
- } else {
503
- currentWordPressVersion = versionCode[1];
504
- } // If the currently used version is the most up to date: exit.
505
-
502
+ console.log('The most recent WordPress version available is: ' + _chalk.default.green(newestWordPressImage.tag)); // If the currently used version is the most up to date: exit.
506
503
 
507
- if (currentWordPressVersion === newestWordPressImage.ref) {
508
- console.log('Environment WordPress version is: ' + _chalk.default.green(currentWordPressVersion) + ' ... 😎 nice! ');
509
- return;
504
+ if (currentWordPressTag === newestWordPressImage.ref) {
505
+ console.log('Environment WordPress version is: ' + _chalk.default.green(currentWordPressTag) + ' ... 😎 nice! ');
506
+ return false;
510
507
  } // Determine if there is an image available for the current WordPress version
511
508
 
512
509
 
513
510
  const match = filteredVersions.find(({
514
511
  ref
515
- }) => ref === currentWordPressVersion); // If there is no available image for the currently installed version, give user a path to change
512
+ }) => ref === currentWordPressTag); // If there is no available image for the currently installed version, give user a path to change
516
513
 
517
514
  if (typeof match === 'undefined') {
518
- console.log(`Installed WordPress: ${currentWordPressVersion} has no available container image in repository. `);
515
+ console.log(`Installed WordPress: ${currentWordPressTag} has no available container image in repository. `);
519
516
  console.log('You must select a new WordPress image to continue... ');
520
517
  } else {
521
518
  console.log('Environment WordPress version is: ' + _chalk.default.yellow(match.ref));
@@ -529,28 +526,19 @@ async function updateWordPressImage(instancePath, options) {
529
526
  }); // If the user takes the new WP version path
530
527
 
531
528
  if (confirm.upgrade) {
532
- console.log('Upgrading from: ' + _chalk.default.yellow(match.ref) + ' to:'); // Select a new image
529
+ console.log('Upgrading from: ' + _chalk.default.yellow(currentWordPressTag) + ' to:'); // Select a new image
533
530
 
534
531
  const choice = await (0, _devEnvironmentCli.promptForComponent)('wordpress');
535
532
  const version = filteredVersions.find(({
536
533
  tag
537
- }) => tag.trim() === choice.tag.trim());
538
- const selectedImage = `ghcr.io/automattic/vip-container-images/wordpress:${version.tag}`; // Change the lando file and rebuild.
539
-
540
- const data = _fs.default.readFileSync(landoFile, {
541
- encoding: 'utf8',
542
- flag: 'r'
543
- });
544
-
545
- const edit = data.replace(/ghcr\.io\/.*wordpress\:.*\d+\.\d+(?:\.\d+)?/g, selectedImage);
546
-
547
- _fs.default.writeFileSync(landoFile, edit); // Stage for rebuild
548
-
534
+ }) => tag.trim() === choice.tag.trim()); // Write new data and stage for rebuild
549
535
 
550
- options.skipRebuild = false;
536
+ envData.wordpress.tag = version.tag;
537
+ await updateEnvironment(envData);
538
+ return true;
551
539
  }
552
540
 
553
- return;
541
+ return false;
554
542
  }
555
543
  /**
556
544
  * Makes a web call to raw.githubusercontent.com
@@ -146,7 +146,7 @@ function buildErrorMessage(importFailed) {
146
146
  }
147
147
 
148
148
  message += _chalk.default.red(importFailed.error ? importFailed.error : importFailed);
149
- message += '\n\nPlease check the status of your Import using `vip import status @appId.production`';
149
+ message += '\n\nPlease check the status of your Import using `vip import media status @mysite.production`';
150
150
  message += '\n\nIf this error persists and you are not sure on how to fix, please contact support\n';
151
151
  return message;
152
152
  }
@@ -47,7 +47,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
47
47
  const debug = (0, _debug.default)('@automattic/vip:lib:search-and-replace');
48
48
 
49
49
  const flatten = arr => {
50
- return arr.reduce(function (flat, toFlatten) {
50
+ return arr.reduce((flat, toFlatten) => {
51
51
  return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten);
52
52
  }, []);
53
53
  };
@@ -254,6 +254,8 @@ ${maybeExitPrompt}
254
254
 
255
255
  const getResults = () => new Promise((resolve, reject) => {
256
256
  const checkStatus = async () => {
257
+ var _importJob$progress$s, _importJob$progress, _importJob$progress$s2, _importJob$progress2;
258
+
257
259
  let status;
258
260
 
259
261
  try {
@@ -322,8 +324,8 @@ ${maybeExitPrompt}
322
324
  return resolve('No import job found');
323
325
  }
324
326
 
325
- jobStatus = importJob.progress.status;
326
- jobSteps = importJob.progress.steps;
327
+ jobStatus = (_importJob$progress$s = (_importJob$progress = importJob.progress) === null || _importJob$progress === void 0 ? void 0 : _importJob$progress.status) !== null && _importJob$progress$s !== void 0 ? _importJob$progress$s : 'unknown';
328
+ jobSteps = (_importJob$progress$s2 = (_importJob$progress2 = importJob.progress) === null || _importJob$progress2 === void 0 ? void 0 : _importJob$progress2.steps) !== null && _importJob$progress$s2 !== void 0 ? _importJob$progress$s2 : [];
327
329
  createdAt = importJob.createdAt;
328
330
  completedAt = importJob.completedAt;
329
331
  const {
@@ -17,7 +17,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
  * External dependencies
18
18
  */
19
19
  // Accepted media file extensions
20
- const acceptedExtensions = ['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'svg', 'tiff', 'tif', 'ico', 'asf', 'asx', 'wmv', 'wmx', 'wm', 'avi', 'divx', 'mov', 'qt', 'mpeg', 'mpg', 'mpe', 'mp4', 'm4v', 'ogv', 'webm', 'mkv', '3gp', '3gpp', '3g2', '3gp2', 'txt', 'asc', 'c', 'cc', 'h', 'srt', 'csv', 'tsv', 'ics', 'rtx', 'css', 'vtt', 'dfxp', 'mp3', 'm4a', 'm4b', 'ra', 'ram', 'wav', 'ogg', 'oga', 'mid', 'midi', 'wma', 'wax', 'mka', 'rtf', 'js', 'pdf', 'class', 'psd', 'xcf', 'doc', 'pot', 'pps', 'ppt', 'wri', 'xla', 'xls', 'xlt', 'xlw', 'mdb', 'mpp', 'docx', 'docm', 'dotx', 'dotm', 'xlsx', 'xlsm', 'xlsb', 'xltx', 'xltm', 'xlam', 'pptx', 'pptm', 'ppsx', 'ppsm', 'potx', 'potm', 'ppam', 'sldx', 'sldm', 'onetoc', ' onetoc2', 'onetmp', 'onepkg', 'oxps', 'xps', 'odt', 'odp', 'ods', 'odg', 'odc', 'odb', 'odf', 'wp', 'wpd', 'key', 'numbers', 'pages'];
20
+ const acceptedExtensions = ['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'svg', 'tiff', 'tif', 'ico', 'asf', 'asx', 'wmv', 'wmx', 'wm', 'avi', 'divx', 'mov', 'qt', 'mpeg', 'mpg', 'mpe', 'mp4', 'm4v', 'ogv', 'webm', 'mkv', '3gp', '3gpp', '3g2', '3gp2', 'txt', 'asc', 'c', 'cc', 'h', 'srt', 'csv', 'tsv', 'ics', 'rtx', 'css', 'vtt', 'dfxp', 'mp3', 'm4a', 'm4b', 'ra', 'ram', 'wav', 'ogg', 'oga', 'mid', 'midi', 'wma', 'wax', 'mka', 'rtf', 'js', 'pdf', 'class', 'psd', 'xcf', 'doc', 'pot', 'pps', 'ppt', 'wri', 'xla', 'xls', 'xlt', 'xlw', 'mdb', 'mpp', 'docx', 'docm', 'dotx', 'dotm', 'xlsx', 'xlsm', 'xlsb', 'xltx', 'xltm', 'xlam', 'pptx', 'pptm', 'ppsx', 'ppsm', 'potx', 'potm', 'ppam', 'sldx', 'sldm', 'onetoc', ' onetoc2', 'onetmp', 'onepkg', 'oxps', 'xps', 'odt', 'odp', 'ods', 'odg', 'odc', 'odb', 'odf', 'webp', 'wp', 'wpd', 'key', 'numbers', 'pages'];
21
21
  /**
22
22
  * Character validation global variables
23
23
  *
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "2.9.1",
3
+ "version": "2.9.4",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -3792,6 +3792,16 @@
3792
3792
  "@sinonjs/commons": "^1.7.0"
3793
3793
  }
3794
3794
  },
3795
+ "@socket.io/base64-arraybuffer": {
3796
+ "version": "1.0.2",
3797
+ "resolved": "https://registry.npmjs.org/@socket.io/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
3798
+ "integrity": "sha512-dOlCBKnDw4iShaIsH/bxujKTM18+2TOAsYz+KSc11Am38H4q5Xw8Bbz97ZYdrVNM+um3p7w86Bvvmcn9q+5+eQ=="
3799
+ },
3800
+ "@socket.io/component-emitter": {
3801
+ "version": "3.0.0",
3802
+ "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.0.0.tgz",
3803
+ "integrity": "sha512-2pTGuibAXJswAPJjaKisthqS/NOK5ypG4LYT6tEAV0S/mxW0zOIvYvGK0V8w8+SHxAm6vRMSjqSalFXeBAqs+Q=="
3804
+ },
3795
3805
  "@szmarczak/http-timer": {
3796
3806
  "version": "1.1.2",
3797
3807
  "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz",
@@ -3847,11 +3857,6 @@
3847
3857
  "@babel/types": "^7.3.0"
3848
3858
  }
3849
3859
  },
3850
- "@types/component-emitter": {
3851
- "version": "1.2.10",
3852
- "resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.10.tgz",
3853
- "integrity": "sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg=="
3854
- },
3855
3860
  "@types/graceful-fs": {
3856
3861
  "version": "4.1.4",
3857
3862
  "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.4.tgz",
@@ -4832,11 +4837,6 @@
4832
4837
  }
4833
4838
  }
4834
4839
  },
4835
- "base64-arraybuffer": {
4836
- "version": "0.1.4",
4837
- "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz",
4838
- "integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI="
4839
- },
4840
4840
  "base64-js": {
4841
4841
  "version": "1.5.1",
4842
4842
  "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
@@ -5392,8 +5392,8 @@
5392
5392
  }
5393
5393
  },
5394
5394
  "cli-table": {
5395
- "version": "github:automattic/cli-table#7b14232ba779929e1859b267bf753c150d90a618",
5396
- "from": "github:automattic/cli-table#7b14232",
5395
+ "version": "git+ssh://git@github.com/automattic/cli-table.git#7b14232ba779929e1859b267bf753c150d90a618",
5396
+ "from": "cli-table@github:automattic/cli-table#7b14232",
5397
5397
  "requires": {
5398
5398
  "chalk": "^2.4.1",
5399
5399
  "wcwidth": "^1.0.1"
@@ -6251,34 +6251,34 @@
6251
6251
  }
6252
6252
  },
6253
6253
  "engine.io-client": {
6254
- "version": "5.0.1",
6255
- "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-5.0.1.tgz",
6256
- "integrity": "sha512-CQtGN3YwfvbxVwpPugcsHe5rHT4KgT49CEcQppNtu9N7WxbPN0MAG27lGaem7bvtCFtGNLSL+GEqXsFSz36jTg==",
6254
+ "version": "6.1.1",
6255
+ "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.1.1.tgz",
6256
+ "integrity": "sha512-V05mmDo4gjimYW+FGujoGmmmxRaDsrVr7AXA3ZIfa04MWM1jOfZfUwou0oNqhNwy/votUDvGDt4JA4QF4e0b4g==",
6257
6257
  "requires": {
6258
- "base64-arraybuffer": "0.1.4",
6259
- "component-emitter": "~1.3.0",
6258
+ "@socket.io/component-emitter": "~3.0.0",
6260
6259
  "debug": "~4.3.1",
6261
- "engine.io-parser": "~4.0.1",
6260
+ "engine.io-parser": "~5.0.0",
6262
6261
  "has-cors": "1.1.0",
6263
6262
  "parseqs": "0.0.6",
6264
6263
  "parseuri": "0.0.6",
6265
- "ws": "~7.4.2",
6264
+ "ws": "~8.2.3",
6265
+ "xmlhttprequest-ssl": "~2.0.0",
6266
6266
  "yeast": "0.1.2"
6267
6267
  },
6268
6268
  "dependencies": {
6269
- "component-emitter": {
6270
- "version": "1.3.0",
6271
- "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
6272
- "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
6269
+ "ws": {
6270
+ "version": "8.2.3",
6271
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz",
6272
+ "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA=="
6273
6273
  }
6274
6274
  }
6275
6275
  },
6276
6276
  "engine.io-parser": {
6277
- "version": "4.0.2",
6278
- "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-4.0.2.tgz",
6279
- "integrity": "sha512-sHfEQv6nmtJrq6TKuIz5kyEKH/qSdK56H/A+7DnAuUPWosnIZAS2NHNcPLmyjtY3cGS/MqJdZbUjW97JU72iYg==",
6277
+ "version": "5.0.3",
6278
+ "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.3.tgz",
6279
+ "integrity": "sha512-BtQxwF27XUNnSafQLvDi0dQ8s3i6VgzSoQMJacpIcGNrlUdfHSKbgm3jmjCVvQluGzqwujQMPAoMai3oYSTurg==",
6280
6280
  "requires": {
6281
- "base64-arraybuffer": "0.1.4"
6281
+ "@socket.io/base64-arraybuffer": "~1.0.2"
6282
6282
  }
6283
6283
  },
6284
6284
  "enquirer": {
@@ -6602,8 +6602,8 @@
6602
6602
  "dev": true
6603
6603
  },
6604
6604
  "eslint-config-wpvip": {
6605
- "version": "github:automattic/eslint-config-wpvip#c6605d1c3a545d43ac2149cd464ec3c38ebc58d5",
6606
- "from": "github:automattic/eslint-config-wpvip#c6605d1",
6605
+ "version": "git+ssh://git@github.com/automattic/eslint-config-wpvip.git#c6605d1c3a545d43ac2149cd464ec3c38ebc58d5",
6606
+ "from": "eslint-config-wpvip@github:automattic/eslint-config-wpvip#c6605d1",
6607
6607
  "dev": true,
6608
6608
  "requires": {
6609
6609
  "eslint-config-wpcalypso": "^4.0.0"
@@ -10021,8 +10021,8 @@
10021
10021
  "dev": true
10022
10022
  },
10023
10023
  "lando": {
10024
- "version": "git+https://github.com/Automattic/lando-cli.git#57d2cd8a23e73b3e5165c3e2862b42aa0881ef2f",
10025
- "from": "git+https://github.com/Automattic/lando-cli.git#v3.5.1-patch2021_12_06",
10024
+ "version": "git+ssh://git@github.com/Automattic/lando-cli.git#57d2cd8a23e73b3e5165c3e2862b42aa0881ef2f",
10025
+ "from": "lando@git+https://github.com/Automattic/lando-cli.git#v3.5.1-patch2021_12_06",
10026
10026
  "requires": {
10027
10027
  "@lando/platformsh": "^0.6.0",
10028
10028
  "axios": "0.21.4",
@@ -12822,41 +12822,25 @@
12822
12822
  }
12823
12823
  },
12824
12824
  "socket.io-client": {
12825
- "version": "4.0.1",
12826
- "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.0.1.tgz",
12827
- "integrity": "sha512-6AkaEG5zrVuSVW294cH1chioag9i1OqnCYjKwTc3EBGXbnyb98Lw7yMa40ifLjFj3y6fsFKsd0llbUZUCRf3Qw==",
12825
+ "version": "4.4.1",
12826
+ "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.4.1.tgz",
12827
+ "integrity": "sha512-N5C/L5fLNha5Ojd7Yeb/puKcPWWcoB/A09fEjjNsg91EDVr5twk/OEyO6VT9dlLSUNY85NpW6KBhVMvaLKQ3vQ==",
12828
12828
  "requires": {
12829
- "@types/component-emitter": "^1.2.10",
12829
+ "@socket.io/component-emitter": "~3.0.0",
12830
12830
  "backo2": "~1.0.2",
12831
- "component-emitter": "~1.3.0",
12832
- "debug": "~4.3.1",
12833
- "engine.io-client": "~5.0.0",
12831
+ "debug": "~4.3.2",
12832
+ "engine.io-client": "~6.1.1",
12834
12833
  "parseuri": "0.0.6",
12835
- "socket.io-parser": "~4.0.4"
12836
- },
12837
- "dependencies": {
12838
- "component-emitter": {
12839
- "version": "1.3.0",
12840
- "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
12841
- "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
12842
- }
12834
+ "socket.io-parser": "~4.1.1"
12843
12835
  }
12844
12836
  },
12845
12837
  "socket.io-parser": {
12846
- "version": "4.0.4",
12847
- "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz",
12848
- "integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==",
12838
+ "version": "4.1.2",
12839
+ "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.1.2.tgz",
12840
+ "integrity": "sha512-j3kk71QLJuyQ/hh5F/L2t1goqzdTL0gvDzuhTuNSwihfuFUrcSji0qFZmJJPtG6Rmug153eOPsUizeirf1IIog==",
12849
12841
  "requires": {
12850
- "@types/component-emitter": "^1.2.10",
12851
- "component-emitter": "~1.3.0",
12842
+ "@socket.io/component-emitter": "~3.0.0",
12852
12843
  "debug": "~4.3.1"
12853
- },
12854
- "dependencies": {
12855
- "component-emitter": {
12856
- "version": "1.3.0",
12857
- "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
12858
- "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
12859
- }
12860
12844
  }
12861
12845
  },
12862
12846
  "socket.io-stream": {
@@ -14293,7 +14277,8 @@
14293
14277
  "ws": {
14294
14278
  "version": "7.4.6",
14295
14279
  "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz",
14296
- "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A=="
14280
+ "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==",
14281
+ "dev": true
14297
14282
  },
14298
14283
  "xdg-basedir": {
14299
14284
  "version": "4.0.0",
@@ -14326,6 +14311,11 @@
14326
14311
  "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
14327
14312
  "dev": true
14328
14313
  },
14314
+ "xmlhttprequest-ssl": {
14315
+ "version": "2.0.0",
14316
+ "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz",
14317
+ "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A=="
14318
+ },
14329
14319
  "xtend": {
14330
14320
  "version": "4.0.2",
14331
14321
  "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "2.9.1",
3
+ "version": "2.9.4",
4
4
  "description": "The VIP Javascript library & CLI",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -42,7 +42,8 @@
42
42
  },
43
43
  "scripts": {
44
44
  "test": "npm run lint && npm run flow && jest --coverage",
45
- "prepare": "npm run build",
45
+ "clean": "rimraf dist",
46
+ "prepare": "npm run clean && npm run build",
46
47
  "prepack": "npm run prepareConfig:publish",
47
48
  "postinstall": "node ./helpers/check-version.js",
48
49
  "build": "npm run prepareConfig:local && babel src -d dist",
@@ -100,7 +101,8 @@
100
101
  "jest": "27.2.1",
101
102
  "nock": "13.0.11",
102
103
  "prettier": "npm:wp-prettier@2.0.5",
103
- "publish-please": "5.5.2"
104
+ "publish-please": "5.5.2",
105
+ "rimraf": "3.0.2"
104
106
  },
105
107
  "dependencies": {
106
108
  "@apollo/client": "^3.3.6",
@@ -124,7 +126,7 @@
124
126
  "rollbar": "2.22.0",
125
127
  "semver": "7.3.5",
126
128
  "single-line-log": "1.1.2",
127
- "socket.io-client": "4.0.1",
129
+ "socket.io-client": "4.4.1",
128
130
  "socket.io-stream": "0.9.1",
129
131
  "socks-proxy-agent": "^5.0.0",
130
132
  "update-notifier": "4.1.3",