@ohos-ports/parcel-package-manager 2.16.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/index.d.ts +40 -0
  3. package/lib/index.d.ts +10 -0
  4. package/lib/index.js +1968 -0
  5. package/lib/index.js.map +1 -0
  6. package/package.json +73 -0
  7. package/src/JSONParseStream.js +39 -0
  8. package/src/MockPackageInstaller.js +94 -0
  9. package/src/NodePackageManager.js +662 -0
  10. package/src/Npm.js +94 -0
  11. package/src/Pnpm.js +194 -0
  12. package/src/Yarn.js +157 -0
  13. package/src/getCurrentPackageManager.js +17 -0
  14. package/src/index.js +19 -0
  15. package/src/installPackage.js +284 -0
  16. package/src/promiseFromProcess.js +19 -0
  17. package/src/utils.js +93 -0
  18. package/src/validateModuleSpecifier.js +12 -0
  19. package/test/NodePackageManager.test.js +387 -0
  20. package/test/fixtures/empty/package.json +1 -0
  21. package/test/fixtures/has-a-not-yet-installed/package.json +5 -0
  22. package/test/fixtures/has-foo/node_modules/foo/index.js +1 -0
  23. package/test/fixtures/has-foo/node_modules/foo/package.json +3 -0
  24. package/test/fixtures/has-foo/node_modules/index.js +0 -0
  25. package/test/fixtures/has-foo/package.json +5 -0
  26. package/test/fixtures/has-foo/subpackage/package.json +1 -0
  27. package/test/fixtures/packages/a/index.js +1 -0
  28. package/test/fixtures/packages/a/package.json +3 -0
  29. package/test/fixtures/packages/foo-2.0/index.js +1 -0
  30. package/test/fixtures/packages/foo-2.0/package.json +4 -0
  31. package/test/fixtures/packages/peers/index.js +1 -0
  32. package/test/fixtures/packages/peers/package.json +7 -0
  33. package/test/fixtures/packages/peers-2.0/index.js +1 -0
  34. package/test/fixtures/packages/peers-2.0/package.json +7 -0
  35. package/test/getCurrentPackageManager.test.js +28 -0
  36. package/test/validateModuleSpecifiers.test.js +38 -0
package/lib/index.js ADDED
@@ -0,0 +1,1968 @@
1
+ var $i45p4$fs = require("fs");
2
+ var $i45p4$child_process = require("child_process");
3
+ var $i45p4$path = require("path");
4
+ var $i45p4$parcelcore = require("@parcel/core");
5
+ var $i45p4$parceldiagnostic = require("@parcel/diagnostic");
6
+ var $i45p4$parcelfs = require("@parcel/fs");
7
+ var $i45p4$module = require("module");
8
+ var $i45p4$semver = require("semver");
9
+ var $i45p4$parcellogger = require("@parcel/logger");
10
+ var $i45p4$parcelutils = require("@parcel/utils");
11
+ var $i45p4$parcelnoderesolvercore = require("@parcel/node-resolver-core");
12
+ var $i45p4$url = require("url");
13
+ var $i45p4$swccore = require("@swc/core");
14
+ var $i45p4$assert = require("assert");
15
+ var $i45p4$util = require("util");
16
+ var $i45p4$parcelworkers = require("@parcel/workers");
17
+ var $i45p4$stream = require("stream");
18
+ var $i45p4$string_decoder = require("string_decoder");
19
+
20
+
21
+ function $parcel$interopDefault(a) {
22
+ return a && a.__esModule ? a.default : a;
23
+ }
24
+
25
+ function $parcel$export(e, n, v, s) {
26
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
27
+ }
28
+
29
+ var $parcel$global = globalThis;
30
+
31
+ function $parcel$exportWildcard(dest, source) {
32
+ Object.keys(source).forEach(function(key) {
33
+ if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {
34
+ return;
35
+ }
36
+
37
+ Object.defineProperty(dest, key, {
38
+ enumerable: true,
39
+ get: function get() {
40
+ return source[key];
41
+ }
42
+ });
43
+ });
44
+
45
+ return dest;
46
+ }
47
+
48
+ var $parcel$modules = {};
49
+ var $parcel$inits = {};
50
+
51
+ var parcelRequire = $parcel$global["parcelRequire0b48"];
52
+
53
+ if (parcelRequire == null) {
54
+ parcelRequire = function(id) {
55
+ if (id in $parcel$modules) {
56
+ return $parcel$modules[id].exports;
57
+ }
58
+ if (id in $parcel$inits) {
59
+ var init = $parcel$inits[id];
60
+ delete $parcel$inits[id];
61
+ var module = {id: id, exports: {}};
62
+ $parcel$modules[id] = module;
63
+ init.call(module.exports, module, module.exports);
64
+ return module.exports;
65
+ }
66
+ var err = new Error("Cannot find module '" + id + "'");
67
+ err.code = 'MODULE_NOT_FOUND';
68
+ throw err;
69
+ };
70
+
71
+ parcelRequire.register = function register(id, init) {
72
+ $parcel$inits[id] = init;
73
+ };
74
+
75
+ $parcel$global["parcelRequire0b48"] = parcelRequire;
76
+ }
77
+
78
+ var parcelRegister = parcelRequire.register;
79
+ parcelRegister("12izX", function(module, exports) {
80
+ module.exports = $0c1463b961b3f1b4$var$isexe;
81
+ $0c1463b961b3f1b4$var$isexe.sync = $0c1463b961b3f1b4$var$sync;
82
+
83
+ function $0c1463b961b3f1b4$var$checkPathExt(path, options) {
84
+ var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
85
+ if (!pathext) return true;
86
+ pathext = pathext.split(';');
87
+ if (pathext.indexOf('') !== -1) return true;
88
+ for(var i = 0; i < pathext.length; i++){
89
+ var p = pathext[i].toLowerCase();
90
+ if (p && path.substr(-p.length).toLowerCase() === p) return true;
91
+ }
92
+ return false;
93
+ }
94
+ function $0c1463b961b3f1b4$var$checkStat(stat, path, options) {
95
+ if (!stat.isSymbolicLink() && !stat.isFile()) return false;
96
+ return $0c1463b961b3f1b4$var$checkPathExt(path, options);
97
+ }
98
+ function $0c1463b961b3f1b4$var$isexe(path, options, cb) {
99
+ $i45p4$fs.stat(path, function(er, stat) {
100
+ cb(er, er ? false : $0c1463b961b3f1b4$var$checkStat(stat, path, options));
101
+ });
102
+ }
103
+ function $0c1463b961b3f1b4$var$sync(path, options) {
104
+ return $0c1463b961b3f1b4$var$checkStat($i45p4$fs.statSync(path), path, options);
105
+ }
106
+
107
+ });
108
+
109
+ parcelRegister("fYIqr", function(module, exports) {
110
+ module.exports = $ba1eeb918b75f5a8$var$isexe;
111
+ $ba1eeb918b75f5a8$var$isexe.sync = $ba1eeb918b75f5a8$var$sync;
112
+
113
+ function $ba1eeb918b75f5a8$var$isexe(path, options, cb) {
114
+ $i45p4$fs.stat(path, function(er, stat) {
115
+ cb(er, er ? false : $ba1eeb918b75f5a8$var$checkStat(stat, options));
116
+ });
117
+ }
118
+ function $ba1eeb918b75f5a8$var$sync(path, options) {
119
+ return $ba1eeb918b75f5a8$var$checkStat($i45p4$fs.statSync(path), options);
120
+ }
121
+ function $ba1eeb918b75f5a8$var$checkStat(stat, options) {
122
+ return stat.isFile() && $ba1eeb918b75f5a8$var$checkMode(stat, options);
123
+ }
124
+ function $ba1eeb918b75f5a8$var$checkMode(stat, options) {
125
+ var mod = stat.mode;
126
+ var uid = stat.uid;
127
+ var gid = stat.gid;
128
+ var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
129
+ var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
130
+ var u = parseInt('100', 8);
131
+ var g = parseInt('010', 8);
132
+ var o = parseInt('001', 8);
133
+ var ug = u | g;
134
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
135
+ return ret;
136
+ }
137
+
138
+ });
139
+
140
+ parcelRegister("3lhdG", function(module, exports) {
141
+ 'use strict';
142
+
143
+ var $26f0b0c0ae54f47e$require$exec = $i45p4$child_process.exec;
144
+
145
+ var $26f0b0c0ae54f47e$require$execSync = $i45p4$child_process.execSync;
146
+
147
+
148
+ var $26f0b0c0ae54f47e$var$access = $i45p4$fs.access;
149
+ var $26f0b0c0ae54f47e$var$accessSync = $i45p4$fs.accessSync;
150
+ var $26f0b0c0ae54f47e$var$constants = $i45p4$fs.constants || $i45p4$fs;
151
+ var $26f0b0c0ae54f47e$var$isUsingWindows = process.platform == 'win32';
152
+ var $26f0b0c0ae54f47e$var$fileNotExists = function(commandName, callback) {
153
+ $26f0b0c0ae54f47e$var$access(commandName, $26f0b0c0ae54f47e$var$constants.F_OK, function(err) {
154
+ callback(!err);
155
+ });
156
+ };
157
+ var $26f0b0c0ae54f47e$var$fileNotExistsSync = function(commandName) {
158
+ try {
159
+ $26f0b0c0ae54f47e$var$accessSync(commandName, $26f0b0c0ae54f47e$var$constants.F_OK);
160
+ return false;
161
+ } catch (e) {
162
+ return true;
163
+ }
164
+ };
165
+ var $26f0b0c0ae54f47e$var$localExecutable = function(commandName, callback) {
166
+ $26f0b0c0ae54f47e$var$access(commandName, $26f0b0c0ae54f47e$var$constants.F_OK | $26f0b0c0ae54f47e$var$constants.X_OK, function(err) {
167
+ callback(null, !err);
168
+ });
169
+ };
170
+ var $26f0b0c0ae54f47e$var$localExecutableSync = function(commandName) {
171
+ try {
172
+ $26f0b0c0ae54f47e$var$accessSync(commandName, $26f0b0c0ae54f47e$var$constants.F_OK | $26f0b0c0ae54f47e$var$constants.X_OK);
173
+ return true;
174
+ } catch (e) {
175
+ return false;
176
+ }
177
+ };
178
+ var $26f0b0c0ae54f47e$var$commandExistsUnix = function(commandName, cleanedCommandName, callback) {
179
+ $26f0b0c0ae54f47e$var$fileNotExists(commandName, function(isFile) {
180
+ if (!isFile) {
181
+ var child = $26f0b0c0ae54f47e$require$exec('command -v ' + cleanedCommandName + ' 2>/dev/null' + ' && { echo >&1 ' + cleanedCommandName + '; exit 0; }', function(error, stdout, stderr) {
182
+ callback(null, !!stdout);
183
+ });
184
+ return;
185
+ }
186
+ $26f0b0c0ae54f47e$var$localExecutable(commandName, callback);
187
+ });
188
+ };
189
+ var $26f0b0c0ae54f47e$var$commandExistsWindows = function(commandName, cleanedCommandName, callback) {
190
+ // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator
191
+ if (!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName)) {
192
+ callback(null, false);
193
+ return;
194
+ }
195
+ var child = $26f0b0c0ae54f47e$require$exec('where ' + cleanedCommandName, function(error) {
196
+ if (error !== null) callback(null, false);
197
+ else callback(null, true);
198
+ });
199
+ };
200
+ var $26f0b0c0ae54f47e$var$commandExistsUnixSync = function(commandName, cleanedCommandName) {
201
+ if ($26f0b0c0ae54f47e$var$fileNotExistsSync(commandName)) try {
202
+ var stdout = $26f0b0c0ae54f47e$require$execSync('command -v ' + cleanedCommandName + ' 2>/dev/null' + ' && { echo >&1 ' + cleanedCommandName + '; exit 0; }');
203
+ return !!stdout;
204
+ } catch (error) {
205
+ return false;
206
+ }
207
+ return $26f0b0c0ae54f47e$var$localExecutableSync(commandName);
208
+ };
209
+ var $26f0b0c0ae54f47e$var$commandExistsWindowsSync = function(commandName, cleanedCommandName, callback) {
210
+ // Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator
211
+ if (!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName)) return false;
212
+ try {
213
+ var stdout = $26f0b0c0ae54f47e$require$execSync('where ' + cleanedCommandName, {
214
+ stdio: []
215
+ });
216
+ return !!stdout;
217
+ } catch (error) {
218
+ return false;
219
+ }
220
+ };
221
+ var $26f0b0c0ae54f47e$var$cleanInput = function(s) {
222
+ if (/[^A-Za-z0-9_\/:=-]/.test(s)) {
223
+ s = "'" + s.replace(/'/g, "'\\''") + "'";
224
+ s = s.replace(/^(?:'')+/g, '') // unduplicate single-quote at the beginning
225
+ .replace(/\\'''/g, "\\'"); // remove non-escaped single-quote if there are enclosed between 2 escaped
226
+ }
227
+ return s;
228
+ };
229
+ if ($26f0b0c0ae54f47e$var$isUsingWindows) $26f0b0c0ae54f47e$var$cleanInput = function(s) {
230
+ var isPathName = /[\\]/.test(s);
231
+ if (isPathName) {
232
+ var dirname = '"' + $i45p4$path.dirname(s) + '"';
233
+ var basename = '"' + $i45p4$path.basename(s) + '"';
234
+ return dirname + ':' + basename;
235
+ }
236
+ return '"' + s + '"';
237
+ };
238
+ module.exports = function commandExists(commandName, callback) {
239
+ var cleanedCommandName = $26f0b0c0ae54f47e$var$cleanInput(commandName);
240
+ if (!callback && typeof Promise !== 'undefined') return new Promise(function(resolve, reject) {
241
+ commandExists(commandName, function(error, output) {
242
+ if (output) resolve(commandName);
243
+ else reject(error);
244
+ });
245
+ });
246
+ if ($26f0b0c0ae54f47e$var$isUsingWindows) $26f0b0c0ae54f47e$var$commandExistsWindows(commandName, cleanedCommandName, callback);
247
+ else $26f0b0c0ae54f47e$var$commandExistsUnix(commandName, cleanedCommandName, callback);
248
+ };
249
+ module.exports.sync = function(commandName) {
250
+ var cleanedCommandName = $26f0b0c0ae54f47e$var$cleanInput(commandName);
251
+ if ($26f0b0c0ae54f47e$var$isUsingWindows) return $26f0b0c0ae54f47e$var$commandExistsWindowsSync(commandName, cleanedCommandName);
252
+ else return $26f0b0c0ae54f47e$var$commandExistsUnixSync(commandName, cleanedCommandName);
253
+ };
254
+
255
+ });
256
+
257
+ parcelRegister("jd2hZ", function(module, exports) {
258
+
259
+ $parcel$export(module.exports, "NodePackageManager", () => NodePackageManager, (v) => NodePackageManager = v);
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+ var $32AGp = parcelRequire("32AGp");
271
+
272
+ var $b3vcY = parcelRequire("b3vcY");
273
+
274
+ var $jeDhm = parcelRequire("jeDhm");
275
+
276
+
277
+
278
+ // Package.json fields. Must match package_json.rs.
279
+ const MAIN = 1;
280
+ const SOURCE = 4;
281
+ const NODE_CONDITION = 8;
282
+ const SOURCE_CONDITION = 131072;
283
+ const ENTRIES = MAIN | SOURCE;
284
+ const CONDITIONS = NODE_CONDITION | SOURCE_CONDITION;
285
+ const NODE_MODULES = `${(0, ($parcel$interopDefault($i45p4$path))).sep}node_modules${(0, ($parcel$interopDefault($i45p4$path))).sep}`;
286
+ const IS_FILE = 1;
287
+ const IS_DIR = 2;
288
+ const IS_SYMLINK = 4;
289
+ // There can be more than one instance of NodePackageManager, but node has only a single module cache.
290
+ // Therefore, the resolution cache and the map of parent to child modules should also be global.
291
+ const cache = new Map();
292
+ const children = new Map();
293
+ const invalidationsCache = new Map();
294
+ class NodePackageManager {
295
+ constructor(fs, projectRoot, installer){
296
+ this.fs = fs;
297
+ this.projectRoot = projectRoot;
298
+ this.installer = installer;
299
+ // $FlowFixMe - no type for _extensions
300
+ this.currentExtensions = Object.keys((0, ($parcel$interopDefault($i45p4$module)))._extensions).map((e)=>e.substring(1));
301
+ }
302
+ _createResolver() {
303
+ return new (0, $i45p4$parcelnoderesolvercore.ResolverBase)(this.projectRoot, {
304
+ fs: this.fs instanceof (0, $i45p4$parcelfs.NodeFS) && process.versions.pnp == null ? undefined : {
305
+ read: (path)=>this.fs.readFileSync(path),
306
+ kind: (path)=>{
307
+ let flags = 0;
308
+ try {
309
+ let stat = this.fs.lstatSync(path);
310
+ if (stat.isSymbolicLink()) {
311
+ flags |= IS_SYMLINK;
312
+ stat = this.fs.statSync(path);
313
+ }
314
+ if (stat.isFile()) flags |= IS_FILE;
315
+ else if (stat.isDirectory()) flags |= IS_DIR;
316
+ } catch (err) {
317
+ // ignore
318
+ }
319
+ return flags;
320
+ },
321
+ readLink: (path)=>this.fs.readlinkSync(path)
322
+ },
323
+ mode: 2,
324
+ entries: ENTRIES,
325
+ conditions: CONDITIONS,
326
+ packageExports: true,
327
+ moduleDirResolver: process.versions.pnp != null ? (module1, from)=>{
328
+ // $FlowFixMe[prop-missing]
329
+ let pnp = (0, ($parcel$interopDefault($i45p4$module))).findPnpApi((0, ($parcel$interopDefault($i45p4$path))).dirname(from));
330
+ return pnp.resolveToUnqualified(// append slash to force loading builtins from npm
331
+ module1 + '/', from);
332
+ } : undefined,
333
+ extensions: this.currentExtensions,
334
+ typescript: true
335
+ });
336
+ }
337
+ static deserialize(opts) {
338
+ return new NodePackageManager(opts.fs, opts.projectRoot, opts.installer);
339
+ }
340
+ serialize() {
341
+ return {
342
+ $$raw: false,
343
+ fs: this.fs,
344
+ projectRoot: this.projectRoot,
345
+ installer: this.installer
346
+ };
347
+ }
348
+ async require(name, from, opts) {
349
+ let { resolved, type } = await this.resolve(name, from, opts);
350
+ if (type === 2) {
351
+ (0, ($parcel$interopDefault($i45p4$parcellogger))).warn({
352
+ message: 'ES module dependencies are experimental.',
353
+ origin: '@parcel/package-manager',
354
+ codeFrames: [
355
+ {
356
+ filePath: resolved,
357
+ codeHighlights: []
358
+ }
359
+ ]
360
+ });
361
+ // On Windows, Node requires absolute paths to be file URLs.
362
+ if (process.platform === 'win32' && (0, ($parcel$interopDefault($i45p4$path))).isAbsolute(resolved)) resolved = (0, $i45p4$url.pathToFileURL)(resolved);
363
+ // $FlowFixMe
364
+ return import(resolved);
365
+ }
366
+ return this.load(resolved, from);
367
+ }
368
+ requireSync(name, from) {
369
+ let { resolved } = this.resolveSync(name, from);
370
+ return this.load(resolved, from);
371
+ }
372
+ load(filePath, from) {
373
+ if (!(0, ($parcel$interopDefault($i45p4$path))).isAbsolute(filePath)) // Node builtin module
374
+ // $FlowFixMe
375
+ return require(filePath);
376
+ // $FlowFixMe[prop-missing]
377
+ const cachedModule = (0, ($parcel$interopDefault($i45p4$module)))._cache[filePath];
378
+ if (cachedModule !== undefined) return cachedModule.exports;
379
+ // $FlowFixMe
380
+ let m = new (0, ($parcel$interopDefault($i45p4$module)))(filePath, (0, ($parcel$interopDefault($i45p4$module)))._cache[from] || module.parent);
381
+ // $FlowFixMe _extensions not in type
382
+ const extensions = Object.keys((0, ($parcel$interopDefault($i45p4$module)))._extensions);
383
+ // This handles supported extensions changing due to, for example, esbuild/register being used
384
+ // We assume that the extension list will change in size - as these tools usually add support for
385
+ // additional extensions.
386
+ if (extensions.length !== this.currentExtensions.length) {
387
+ this.currentExtensions = extensions.map((e)=>e.substring(1));
388
+ this.resolver = this._createResolver();
389
+ }
390
+ // $FlowFixMe[prop-missing]
391
+ (0, ($parcel$interopDefault($i45p4$module)))._cache[filePath] = m;
392
+ // Patch require within this module so it goes through our require
393
+ m.require = (id)=>{
394
+ return this.requireSync(id, filePath);
395
+ };
396
+ // Patch `fs.readFileSync` temporarily so that it goes through our file system
397
+ let { readFileSync, statSync } = (0, ($parcel$interopDefault($i45p4$fs)));
398
+ // $FlowFixMe
399
+ (0, ($parcel$interopDefault($i45p4$fs))).readFileSync = (filename, encoding)=>{
400
+ return this.fs.readFileSync(filename, encoding);
401
+ };
402
+ // $FlowFixMe
403
+ (0, ($parcel$interopDefault($i45p4$fs))).statSync = (filename)=>{
404
+ return this.fs.statSync(filename);
405
+ };
406
+ if (!filePath.includes(NODE_MODULES)) {
407
+ let extname = (0, ($parcel$interopDefault($i45p4$path))).extname(filePath);
408
+ if ((extname === '.ts' || extname === '.tsx' || extname === '.mts' || extname === '.cts') && // $FlowFixMe
409
+ !(0, ($parcel$interopDefault($i45p4$module)))._extensions[extname]) {
410
+ let compile = m._compile;
411
+ m._compile = (code, filename)=>{
412
+ let out = (0, $i45p4$swccore.transformSync)(code, {
413
+ filename: filename,
414
+ module: {
415
+ type: 'commonjs',
416
+ ignoreDynamic: true
417
+ }
418
+ });
419
+ compile.call(m, out.code, filename);
420
+ };
421
+ // $FlowFixMe
422
+ (0, ($parcel$interopDefault($i45p4$module)))._extensions[extname] = (m, filename)=>{
423
+ // $FlowFixMe
424
+ delete (0, ($parcel$interopDefault($i45p4$module)))._extensions[extname];
425
+ // $FlowFixMe
426
+ (0, ($parcel$interopDefault($i45p4$module)))._extensions['.js'](m, filename);
427
+ };
428
+ }
429
+ }
430
+ try {
431
+ m.load(filePath);
432
+ } catch (err) {
433
+ // $FlowFixMe[prop-missing]
434
+ delete (0, ($parcel$interopDefault($i45p4$module)))._cache[filePath];
435
+ throw err;
436
+ } finally{
437
+ // $FlowFixMe
438
+ (0, ($parcel$interopDefault($i45p4$fs))).readFileSync = readFileSync;
439
+ // $FlowFixMe
440
+ (0, ($parcel$interopDefault($i45p4$fs))).statSync = statSync;
441
+ }
442
+ return m.exports;
443
+ }
444
+ async resolve(id, from, options) {
445
+ let basedir = (0, ($parcel$interopDefault($i45p4$path))).dirname(from);
446
+ let key = basedir + ':' + id;
447
+ let resolved = cache.get(key);
448
+ if (!resolved) {
449
+ let [name] = (0, $i45p4$parcelutils.getModuleParts)(id);
450
+ try {
451
+ resolved = this.resolveInternal(id, from);
452
+ } catch (e) {
453
+ if (e.code !== 'MODULE_NOT_FOUND' || options?.shouldAutoInstall !== true || id.startsWith('.') // a local file, don't autoinstall
454
+ ) {
455
+ if (e.code === 'MODULE_NOT_FOUND' && options?.shouldAutoInstall !== true) {
456
+ let err = new (0, ($parcel$interopDefault($i45p4$parceldiagnostic)))({
457
+ diagnostic: {
458
+ message: (0, $i45p4$parceldiagnostic.escapeMarkdown)(e.message),
459
+ hints: [
460
+ 'Autoinstall is disabled, please install this package manually and restart Parcel.'
461
+ ]
462
+ }
463
+ });
464
+ // $FlowFixMe - needed for loadParcelPlugin
465
+ err.code = 'MODULE_NOT_FOUND';
466
+ throw err;
467
+ } else throw e;
468
+ }
469
+ let conflicts = await (0, $32AGp.getConflictingLocalDependencies)(this.fs, name, from, this.projectRoot);
470
+ if (conflicts == null) {
471
+ this.invalidate(id, from);
472
+ await this.install([
473
+ {
474
+ name: name,
475
+ range: options?.range
476
+ }
477
+ ], from, {
478
+ saveDev: options?.saveDev ?? true
479
+ });
480
+ return this.resolve(id, from, {
481
+ ...options,
482
+ shouldAutoInstall: false
483
+ });
484
+ }
485
+ throw new (0, ($parcel$interopDefault($i45p4$parceldiagnostic)))({
486
+ diagnostic: conflicts.fields.map((field)=>({
487
+ message: (0, $i45p4$parceldiagnostic.md)`Could not find module "${name}", but it was listed in package.json. Run your package manager first.`,
488
+ origin: '@parcel/package-manager',
489
+ codeFrames: [
490
+ {
491
+ filePath: conflicts.filePath,
492
+ language: 'json',
493
+ code: conflicts.json,
494
+ codeHighlights: (0, $i45p4$parceldiagnostic.generateJSONCodeHighlights)(conflicts.json, [
495
+ {
496
+ key: `/${field}/${(0, $i45p4$parceldiagnostic.encodeJSONKeyComponent)(name)}`,
497
+ type: 'key',
498
+ message: 'Defined here, but not installed'
499
+ }
500
+ ])
501
+ }
502
+ ]
503
+ }))
504
+ });
505
+ }
506
+ let range = options?.range;
507
+ if (range != null) {
508
+ let pkg = resolved.pkg;
509
+ if (pkg == null || !(0, ($parcel$interopDefault($i45p4$semver))).satisfies(pkg.version, range)) {
510
+ let conflicts = await (0, $32AGp.getConflictingLocalDependencies)(this.fs, name, from, this.projectRoot);
511
+ if (conflicts == null && options?.shouldAutoInstall === true) {
512
+ this.invalidate(id, from);
513
+ await this.install([
514
+ {
515
+ name: name,
516
+ range: range
517
+ }
518
+ ], from);
519
+ return this.resolve(id, from, {
520
+ ...options,
521
+ shouldAutoInstall: false
522
+ });
523
+ } else if (conflicts != null) throw new (0, ($parcel$interopDefault($i45p4$parceldiagnostic)))({
524
+ diagnostic: {
525
+ message: (0, $i45p4$parceldiagnostic.md)`Could not find module "${name}" satisfying ${range}.`,
526
+ origin: '@parcel/package-manager',
527
+ codeFrames: [
528
+ {
529
+ filePath: conflicts.filePath,
530
+ language: 'json',
531
+ code: conflicts.json,
532
+ codeHighlights: (0, $i45p4$parceldiagnostic.generateJSONCodeHighlights)(conflicts.json, conflicts.fields.map((field)=>({
533
+ key: `/${field}/${(0, $i45p4$parceldiagnostic.encodeJSONKeyComponent)(name)}`,
534
+ type: 'key',
535
+ message: 'Found this conflicting local requirement.'
536
+ })))
537
+ }
538
+ ]
539
+ }
540
+ });
541
+ let version = pkg?.version;
542
+ let message = (0, $i45p4$parceldiagnostic.md)`Could not resolve package "${name}" that satisfies ${range}.`;
543
+ if (version != null) message += (0, $i45p4$parceldiagnostic.md)` Found ${version}.`;
544
+ throw new (0, ($parcel$interopDefault($i45p4$parceldiagnostic)))({
545
+ diagnostic: {
546
+ message: message,
547
+ hints: [
548
+ 'Looks like the incompatible version was installed transitively. Add this package as a direct dependency with a compatible version range.'
549
+ ]
550
+ }
551
+ });
552
+ }
553
+ }
554
+ cache.set(key, resolved);
555
+ invalidationsCache.clear();
556
+ // Add the specifier as a child to the parent module.
557
+ // Don't do this if the specifier was an absolute path, as this was likely a dynamically resolved path
558
+ // (e.g. babel uses require() to load .babelrc.js configs and we don't want them to be added as children of babel itself).
559
+ if (!(0, ($parcel$interopDefault($i45p4$path))).isAbsolute(name)) {
560
+ let moduleChildren = children.get(from);
561
+ if (!moduleChildren) {
562
+ moduleChildren = new Set();
563
+ children.set(from, moduleChildren);
564
+ }
565
+ moduleChildren.add(name);
566
+ }
567
+ }
568
+ return resolved;
569
+ }
570
+ resolveSync(name, from) {
571
+ let basedir = (0, ($parcel$interopDefault($i45p4$path))).dirname(from);
572
+ let key = basedir + ':' + name;
573
+ let resolved = cache.get(key);
574
+ if (!resolved) {
575
+ resolved = this.resolveInternal(name, from);
576
+ cache.set(key, resolved);
577
+ invalidationsCache.clear();
578
+ if (!(0, ($parcel$interopDefault($i45p4$path))).isAbsolute(name)) {
579
+ let moduleChildren = children.get(from);
580
+ if (!moduleChildren) {
581
+ moduleChildren = new Set();
582
+ children.set(from, moduleChildren);
583
+ }
584
+ moduleChildren.add(name);
585
+ }
586
+ }
587
+ return resolved;
588
+ }
589
+ async install(modules, from, opts) {
590
+ await (0, $b3vcY.installPackage)(this.fs, this, modules, from, this.projectRoot, {
591
+ packageInstaller: this.installer,
592
+ ...opts
593
+ });
594
+ }
595
+ getInvalidations(name, from) {
596
+ let basedir = (0, ($parcel$interopDefault($i45p4$path))).dirname(from);
597
+ let resolved = cache.get(basedir + ':' + name);
598
+ if (resolved && (0, ($parcel$interopDefault($i45p4$path))).isAbsolute(resolved.resolved)) {
599
+ let cached = invalidationsCache.get(resolved.resolved);
600
+ if (cached != null) return cached;
601
+ let res = {
602
+ invalidateOnFileCreate: [],
603
+ invalidateOnFileChange: new Set(),
604
+ invalidateOnStartup: false
605
+ };
606
+ let seen = new Set();
607
+ let addKey = (name, from)=>{
608
+ let basedir = (0, ($parcel$interopDefault($i45p4$path))).dirname(from);
609
+ let key = basedir + ':' + name;
610
+ if (seen.has(key)) return;
611
+ seen.add(key);
612
+ let resolved = cache.get(key);
613
+ if (!resolved || !(0, ($parcel$interopDefault($i45p4$path))).isAbsolute(resolved.resolved)) return;
614
+ res.invalidateOnFileCreate.push(...resolved.invalidateOnFileCreate);
615
+ res.invalidateOnFileChange.add(resolved.resolved);
616
+ for (let file of resolved.invalidateOnFileChange)res.invalidateOnFileChange.add(file);
617
+ let moduleChildren = children.get(resolved.resolved);
618
+ if (moduleChildren) for (let specifier of moduleChildren)addKey(specifier, resolved.resolved);
619
+ };
620
+ addKey(name, from);
621
+ // If this is an ES module, we won't have any of the dependencies because import statements
622
+ // cannot be intercepted. Instead, ask the resolver to parse the file and recursively analyze the deps.
623
+ if (resolved.type === 2) {
624
+ let invalidations = this.resolver.getInvalidations(resolved.resolved);
625
+ invalidations.invalidateOnFileChange.forEach((i)=>res.invalidateOnFileChange.add(i));
626
+ invalidations.invalidateOnFileCreate.forEach((i)=>res.invalidateOnFileCreate.push(i));
627
+ res.invalidateOnStartup ||= invalidations.invalidateOnStartup;
628
+ if (res.invalidateOnStartup) (0, ($parcel$interopDefault($i45p4$parcellogger))).warn({
629
+ message: (0, $i45p4$parceldiagnostic.md)`${(0, ($parcel$interopDefault($i45p4$path))).relative(this.projectRoot, resolved.resolved)} contains non-statically analyzable dependencies in its module graph. This causes Parcel to invalidate the cache on startup.`,
630
+ origin: '@parcel/package-manager'
631
+ });
632
+ }
633
+ invalidationsCache.set(resolved.resolved, res);
634
+ return res;
635
+ }
636
+ return {
637
+ invalidateOnFileCreate: [],
638
+ invalidateOnFileChange: new Set(),
639
+ invalidateOnStartup: false
640
+ };
641
+ }
642
+ invalidate(name, from) {
643
+ let seen = new Set();
644
+ let invalidate = (name, from)=>{
645
+ let basedir = (0, ($parcel$interopDefault($i45p4$path))).dirname(from);
646
+ let key = basedir + ':' + name;
647
+ if (seen.has(key)) return;
648
+ seen.add(key);
649
+ let resolved = cache.get(key);
650
+ if (!resolved || !(0, ($parcel$interopDefault($i45p4$path))).isAbsolute(resolved.resolved)) return;
651
+ invalidationsCache.delete(resolved.resolved);
652
+ // $FlowFixMe
653
+ let module1 = (0, ($parcel$interopDefault($i45p4$module)))._cache[resolved.resolved];
654
+ if (module1) // $FlowFixMe
655
+ delete (0, ($parcel$interopDefault($i45p4$module)))._cache[resolved.resolved];
656
+ let moduleChildren = children.get(resolved.resolved);
657
+ if (moduleChildren) for (let specifier of moduleChildren)invalidate(specifier, resolved.resolved);
658
+ children.delete(resolved.resolved);
659
+ cache.delete(key);
660
+ };
661
+ invalidate(name, from);
662
+ this.resolver = this._createResolver();
663
+ }
664
+ resolveInternal(name, from) {
665
+ if (this.resolver == null) this.resolver = this._createResolver();
666
+ let res = this.resolver.resolve({
667
+ filename: name,
668
+ specifierType: 'commonjs',
669
+ parent: from
670
+ });
671
+ // Invalidate whenever the .pnp.js file changes.
672
+ // TODO: only when we actually resolve a node_modules package?
673
+ if (process.versions.pnp != null && res.invalidateOnFileChange) {
674
+ // $FlowFixMe[prop-missing]
675
+ let pnp = (0, ($parcel$interopDefault($i45p4$module))).findPnpApi((0, ($parcel$interopDefault($i45p4$path))).dirname(from));
676
+ res.invalidateOnFileChange.push(pnp.resolveToUnqualified('pnpapi', null));
677
+ }
678
+ if (res.error) {
679
+ let e = new Error(`Could not resolve module "${name}" from "${from}"`);
680
+ // $FlowFixMe
681
+ e.code = 'MODULE_NOT_FOUND';
682
+ throw e;
683
+ }
684
+ switch(res.resolution.type){
685
+ case 'Path':
686
+ {
687
+ let self = this;
688
+ let resolved = res.resolution.value;
689
+ return {
690
+ resolved: resolved,
691
+ invalidateOnFileChange: new Set(res.invalidateOnFileChange),
692
+ invalidateOnFileCreate: res.invalidateOnFileCreate,
693
+ type: res.moduleType,
694
+ get pkg () {
695
+ let pkgPath = self.fs.findAncestorFile([
696
+ 'package.json'
697
+ ], resolved, self.projectRoot);
698
+ return pkgPath ? JSON.parse(self.fs.readFileSync(pkgPath, 'utf8')) : null;
699
+ }
700
+ };
701
+ }
702
+ case 'Builtin':
703
+ {
704
+ let { scheme, module: module1 } = res.resolution.value;
705
+ return {
706
+ resolved: scheme ? `${scheme}:${module1}` : module1,
707
+ invalidateOnFileChange: new Set(res.invalidateOnFileChange),
708
+ invalidateOnFileCreate: res.invalidateOnFileCreate,
709
+ type: res.moduleType
710
+ };
711
+ }
712
+ default:
713
+ throw new Error('Unknown resolution type');
714
+ }
715
+ }
716
+ }
717
+ (0, $i45p4$parcelcore.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($jeDhm))).version}:NodePackageManager`, NodePackageManager);
718
+
719
+ });
720
+ parcelRegister("32AGp", function(module, exports) {
721
+
722
+ $parcel$export(module.exports, "exec", () => $236e0378d2f4cade$export$78e3044358792147);
723
+ $parcel$export(module.exports, "npmSpecifierFromModuleRequest", () => $236e0378d2f4cade$export$44a673cac0f09696);
724
+ $parcel$export(module.exports, "moduleRequestsFromDependencyMap", () => $236e0378d2f4cade$export$8e3ae06b6f2ee6e2);
725
+ $parcel$export(module.exports, "getConflictingLocalDependencies", () => $236e0378d2f4cade$export$ab9915b45c70a034);
726
+
727
+
728
+
729
+
730
+
731
+ const $236e0378d2f4cade$export$78e3044358792147 = (0, $i45p4$child_process.exec) ? (0, $i45p4$util.promisify)((0, $i45p4$child_process.exec)) : // _exec is undefined in browser builds
732
+ (0, $i45p4$child_process.exec);
733
+ function $236e0378d2f4cade$export$44a673cac0f09696(moduleRequest) {
734
+ return moduleRequest.range != null ? [
735
+ moduleRequest.name,
736
+ moduleRequest.range
737
+ ].join('@') : moduleRequest.name;
738
+ }
739
+ function $236e0378d2f4cade$export$8e3ae06b6f2ee6e2(dependencyMap) {
740
+ return Object.entries(dependencyMap).map(([name, range])=>{
741
+ (0, ($parcel$interopDefault($i45p4$assert)))(typeof range === 'string');
742
+ return {
743
+ name: name,
744
+ range: range
745
+ };
746
+ });
747
+ }
748
+ async function $236e0378d2f4cade$export$ab9915b45c70a034(fs, name, local, projectRoot) {
749
+ let pkgPath = await (0, $i45p4$parcelutils.resolveConfig)(fs, local, [
750
+ 'package.json'
751
+ ], projectRoot);
752
+ if (pkgPath == null) return;
753
+ let pkgStr = await fs.readFile(pkgPath, 'utf8');
754
+ let pkg;
755
+ try {
756
+ pkg = JSON.parse(pkgStr);
757
+ } catch (e) {
758
+ // TODO: codeframe
759
+ throw new (0, ($parcel$interopDefault($i45p4$parceldiagnostic)))({
760
+ diagnostic: {
761
+ message: 'Failed to parse package.json',
762
+ origin: '@parcel/package-manager'
763
+ }
764
+ });
765
+ }
766
+ if (typeof pkg !== 'object' || pkg == null) // TODO: codeframe
767
+ throw new (0, ($parcel$interopDefault($i45p4$parceldiagnostic)))({
768
+ diagnostic: {
769
+ message: 'Expected package.json contents to be an object.',
770
+ origin: '@parcel/package-manager'
771
+ }
772
+ });
773
+ let fields = [];
774
+ for (let field of [
775
+ 'dependencies',
776
+ 'devDependencies',
777
+ 'peerDependencies'
778
+ ])if (typeof pkg[field] === 'object' && pkg[field] != null && pkg[field][name] != null) fields.push(field);
779
+ if (fields.length > 0) return {
780
+ filePath: pkgPath,
781
+ json: pkgStr,
782
+ fields: fields
783
+ };
784
+ }
785
+
786
+ });
787
+
788
+ parcelRegister("b3vcY", function(module, exports) {
789
+
790
+ $parcel$export(module.exports, "_addToInstallQueue", () => $80c82ed7748ddc94$export$f09e6d5146bb6da1);
791
+ $parcel$export(module.exports, "installPackage", () => $80c82ed7748ddc94$export$9c0565d18deefc7f);
792
+
793
+
794
+
795
+ var $axmO7 = parcelRequire("axmO7");
796
+
797
+
798
+
799
+
800
+
801
+
802
+ var $lLPK6 = parcelRequire("lLPK6");
803
+
804
+ var $eZHZZ = parcelRequire("eZHZZ");
805
+
806
+ var $buj7e = parcelRequire("buj7e");
807
+
808
+ var $32AGp = parcelRequire("32AGp");
809
+
810
+ var $cXMMx = parcelRequire("cXMMx");
811
+
812
+ var $b405e = parcelRequire("b405e");
813
+
814
+ var $80c82ed7748ddc94$var$$parcel$__dirname = $i45p4$path.resolve(__dirname, "../src");
815
+
816
+ var $80c82ed7748ddc94$var$$parcel$__filename = $i45p4$path.resolve(__dirname, "../src", "installPackage.js");
817
+ async function $80c82ed7748ddc94$var$install(fs, packageManager, modules, from, projectRoot, options = {}) {
818
+ let { installPeers: installPeers = true, saveDev: saveDev = true, packageInstaller: packageInstaller } = options;
819
+ let moduleNames = modules.map((m)=>m.name).join(', ');
820
+ (0, ($parcel$interopDefault($i45p4$parcellogger))).progress(`Installing ${moduleNames}...`);
821
+ let fromPkgPath = await (0, $i45p4$parcelutils.resolveConfig)(fs, from, [
822
+ 'package.json'
823
+ ], projectRoot);
824
+ let cwd = fromPkgPath ? (0, ($parcel$interopDefault($i45p4$path))).dirname(fromPkgPath) : fs.cwd();
825
+ if (!packageInstaller) packageInstaller = await $80c82ed7748ddc94$var$determinePackageInstaller(fs, from, projectRoot);
826
+ try {
827
+ await packageInstaller.install({
828
+ modules: modules,
829
+ saveDev: saveDev,
830
+ cwd: cwd,
831
+ packagePath: fromPkgPath,
832
+ fs: fs
833
+ });
834
+ } catch (err) {
835
+ throw new Error(`Failed to install ${moduleNames}: ${err.message}`);
836
+ }
837
+ if (installPeers) await Promise.all(modules.map((m)=>$80c82ed7748ddc94$var$installPeerDependencies(fs, packageManager, m, from, projectRoot, options)));
838
+ }
839
+ async function $80c82ed7748ddc94$var$installPeerDependencies(fs, packageManager, module, from, projectRoot, options) {
840
+ const { resolved: resolved } = await packageManager.resolve(module.name, from);
841
+ const modulePkg = (0, (/*@__PURE__*/$parcel$interopDefault($axmO7)))(await (0, $i45p4$parcelutils.loadConfig)(fs, resolved, [
842
+ 'package.json'
843
+ ], projectRoot)).config;
844
+ const peers = modulePkg.peerDependencies || {};
845
+ let modules = [];
846
+ for (let [name, range] of Object.entries(peers)){
847
+ (0, ($parcel$interopDefault($i45p4$assert)))(typeof range === 'string');
848
+ let conflicts = await (0, $32AGp.getConflictingLocalDependencies)(fs, name, from, projectRoot);
849
+ if (conflicts) {
850
+ let { pkg: pkg } = await packageManager.resolve(name, from);
851
+ (0, ($parcel$interopDefault($i45p4$assert)))(pkg);
852
+ if (!(0, ($parcel$interopDefault($i45p4$semver))).satisfies(pkg.version, range)) throw new (0, ($parcel$interopDefault($i45p4$parceldiagnostic)))({
853
+ diagnostic: {
854
+ message: (0, $i45p4$parceldiagnostic.md)`Could not install the peer dependency "${name}" for "${module.name}", installed version ${pkg.version} is incompatible with ${range}`,
855
+ origin: '@parcel/package-manager',
856
+ codeFrames: [
857
+ {
858
+ filePath: conflicts.filePath,
859
+ language: 'json',
860
+ code: conflicts.json,
861
+ codeHighlights: (0, $i45p4$parceldiagnostic.generateJSONCodeHighlights)(conflicts.json, conflicts.fields.map((field)=>({
862
+ key: `/${field}/${(0, $i45p4$parceldiagnostic.encodeJSONKeyComponent)(name)}`,
863
+ type: 'key',
864
+ message: 'Found this conflicting local requirement.'
865
+ })))
866
+ }
867
+ ]
868
+ }
869
+ });
870
+ continue;
871
+ }
872
+ modules.push({
873
+ name: name,
874
+ range: range
875
+ });
876
+ }
877
+ if (modules.length) await $80c82ed7748ddc94$var$install(fs, packageManager, modules, from, projectRoot, Object.assign({}, options, {
878
+ installPeers: false
879
+ }));
880
+ }
881
+ async function $80c82ed7748ddc94$var$determinePackageInstaller(fs, filepath, projectRoot) {
882
+ let configFile = await (0, $i45p4$parcelutils.resolveConfig)(fs, filepath, [
883
+ 'package-lock.json',
884
+ 'pnpm-lock.yaml',
885
+ 'yarn.lock'
886
+ ], projectRoot);
887
+ let configName = configFile && (0, ($parcel$interopDefault($i45p4$path))).basename(configFile);
888
+ // Always use the package manager that seems to be used in the project,
889
+ // falling back to a different one wouldn't update the existing lockfile.
890
+ if (configName === 'package-lock.json') return new (0, $lLPK6.Npm)();
891
+ else if (configName === 'pnpm-lock.yaml') return new (0, $buj7e.Pnpm)();
892
+ else if (configName === 'yarn.lock') return new (0, $eZHZZ.Yarn)();
893
+ let currentPackageManager = (0, $cXMMx.default)()?.name;
894
+ if (currentPackageManager === 'npm') return new (0, $lLPK6.Npm)();
895
+ else if (currentPackageManager === 'yarn') return new (0, $eZHZZ.Yarn)();
896
+ else if (currentPackageManager === 'pnpm') return new (0, $buj7e.Pnpm)();
897
+ if (await (0, $eZHZZ.Yarn).exists()) return new (0, $eZHZZ.Yarn)();
898
+ else if (await (0, $buj7e.Pnpm).exists()) return new (0, $buj7e.Pnpm)();
899
+ else return new (0, $lLPK6.Npm)();
900
+ }
901
+ let $80c82ed7748ddc94$var$queue = new (0, $i45p4$parcelutils.PromiseQueue)({
902
+ maxConcurrent: 1
903
+ });
904
+ let $80c82ed7748ddc94$var$modulesInstalling = new Set();
905
+ function $80c82ed7748ddc94$export$f09e6d5146bb6da1(fs, packageManager, modules, filePath, projectRoot, options) {
906
+ modules = modules.map((request)=>({
907
+ name: (0, $b405e.default)(request.name),
908
+ range: request.range
909
+ }));
910
+ // Wrap PromiseQueue and track modules that are currently installing.
911
+ // If a request comes in for a module that is currently installing, don't bother
912
+ // enqueuing it.
913
+ let modulesToInstall = modules.filter((m)=>!$80c82ed7748ddc94$var$modulesInstalling.has($80c82ed7748ddc94$var$getModuleRequestKey(m)));
914
+ if (modulesToInstall.length) {
915
+ for (let m of modulesToInstall)$80c82ed7748ddc94$var$modulesInstalling.add($80c82ed7748ddc94$var$getModuleRequestKey(m));
916
+ $80c82ed7748ddc94$var$queue.add(()=>$80c82ed7748ddc94$var$install(fs, packageManager, modulesToInstall, filePath, projectRoot, options).then(()=>{
917
+ for (let m of modulesToInstall)$80c82ed7748ddc94$var$modulesInstalling.delete($80c82ed7748ddc94$var$getModuleRequestKey(m));
918
+ })).then(()=>{}, ()=>{});
919
+ }
920
+ return $80c82ed7748ddc94$var$queue.run();
921
+ }
922
+ function $80c82ed7748ddc94$export$9c0565d18deefc7f(fs, packageManager, modules, filePath, projectRoot, options) {
923
+ if ((0, ($parcel$interopDefault($i45p4$parcelworkers))).isWorker()) {
924
+ let workerApi = (0, ($parcel$interopDefault($i45p4$parcelworkers))).getWorkerApi();
925
+ // TODO this should really be `__filename` but without the rewriting.
926
+ let bundlePath = !process.env.PARCEL_SELF_BUILD ? (0, ($parcel$interopDefault($i45p4$path))).join($80c82ed7748ddc94$var$$parcel$__dirname, '..', 'lib/index.js') : $80c82ed7748ddc94$var$$parcel$__filename;
927
+ return workerApi.callMaster({
928
+ location: bundlePath,
929
+ args: [
930
+ fs,
931
+ packageManager,
932
+ modules,
933
+ filePath,
934
+ projectRoot,
935
+ options
936
+ ],
937
+ method: '_addToInstallQueue'
938
+ });
939
+ }
940
+ return $80c82ed7748ddc94$export$f09e6d5146bb6da1(fs, packageManager, modules, filePath, projectRoot, options);
941
+ }
942
+ function $80c82ed7748ddc94$var$getModuleRequestKey(moduleRequest) {
943
+ return [
944
+ moduleRequest.name,
945
+ moduleRequest.range
946
+ ].join('@');
947
+ }
948
+
949
+ });
950
+ parcelRegister("axmO7", function(module, exports) {
951
+ 'use strict';
952
+ function $7abead83372a61d2$var$nullthrows(x, message) {
953
+ if (x != null) return x;
954
+ var error = new Error(message !== undefined ? message : 'Got unexpected ' + x);
955
+ error.framesToPop = 1; // Skip nullthrows's own stack frame.
956
+ throw error;
957
+ }
958
+ module.exports = $7abead83372a61d2$var$nullthrows;
959
+ module.exports.default = $7abead83372a61d2$var$nullthrows;
960
+ Object.defineProperty(module.exports, '__esModule', {
961
+ value: true
962
+ });
963
+
964
+ });
965
+
966
+ parcelRegister("lLPK6", function(module, exports) {
967
+
968
+ $parcel$export(module.exports, "Npm", () => $fd961fc31634a95d$export$bc651973ec076cd0);
969
+
970
+
971
+ var $e6aVH = parcelRequire("e6aVH");
972
+
973
+
974
+ var $fs99M = parcelRequire("fs99M");
975
+
976
+
977
+ var $32AGp = parcelRequire("32AGp");
978
+
979
+ var $jeDhm = parcelRequire("jeDhm");
980
+ const $fd961fc31634a95d$var$NPM_CMD = 'npm';
981
+ class $fd961fc31634a95d$export$bc651973ec076cd0 {
982
+ async install({ modules: modules, cwd: cwd, fs: fs, packagePath: packagePath, saveDev: saveDev = true }) {
983
+ // npm doesn't auto-create a package.json when installing,
984
+ // so create an empty one if needed.
985
+ if (packagePath == null) await fs.writeFile((0, ($parcel$interopDefault($i45p4$path))).join(cwd, 'package.json'), '{}');
986
+ let args = [
987
+ 'install',
988
+ '--json',
989
+ saveDev ? '--save-dev' : '--save'
990
+ ].concat(modules.map((0, $32AGp.npmSpecifierFromModuleRequest)));
991
+ // When Parcel is run by npm (e.g. via package.json scripts), several environment variables are
992
+ // added. When parcel in turn calls npm again, these can cause npm to behave stragely, so we
993
+ // filter them out when installing packages.
994
+ let env = {};
995
+ for(let key in process.env)if (!key.startsWith('npm_') && key !== 'INIT_CWD' && key !== 'NODE_ENV') env[key] = process.env[key];
996
+ let installProcess = (0, (/*@__PURE__*/$parcel$interopDefault($e6aVH)))($fd961fc31634a95d$var$NPM_CMD, args, {
997
+ cwd: cwd,
998
+ env: env
999
+ });
1000
+ let stdout = '';
1001
+ installProcess.stdout.on('data', (buf)=>{
1002
+ stdout += buf.toString();
1003
+ });
1004
+ let stderr = [];
1005
+ installProcess.stderr.on('data', (buf)=>{
1006
+ stderr.push(buf.toString().trim());
1007
+ });
1008
+ try {
1009
+ await (0, $fs99M.default)(installProcess);
1010
+ let results = JSON.parse(stdout);
1011
+ let addedCount = results.added.length;
1012
+ if (addedCount > 0) (0, ($parcel$interopDefault($i45p4$parcellogger))).log({
1013
+ origin: '@parcel/package-manager',
1014
+ message: `Added ${addedCount} packages via npm`
1015
+ });
1016
+ // Since we succeeded, stderr might have useful information not included
1017
+ // in the json written to stdout. It's also not necessary to log these as
1018
+ // errors as they often aren't.
1019
+ for (let message of stderr)if (message.length > 0) (0, ($parcel$interopDefault($i45p4$parcellogger))).log({
1020
+ origin: '@parcel/package-manager',
1021
+ message: message
1022
+ });
1023
+ } catch (e) {
1024
+ throw new Error('npm failed to install modules: ' + e.message + ' - ' + stderr.join('\n'));
1025
+ }
1026
+ }
1027
+ }
1028
+ (0, $i45p4$parcelcore.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($jeDhm))).version}:Npm`, $fd961fc31634a95d$export$bc651973ec076cd0);
1029
+
1030
+ });
1031
+ parcelRegister("e6aVH", function(module, exports) {
1032
+ 'use strict';
1033
+
1034
+
1035
+ var $wHEkS = parcelRequire("wHEkS");
1036
+
1037
+ var $5XKEQ = parcelRequire("5XKEQ");
1038
+ function $a43a1aa555fd1c31$var$spawn(command, args, options) {
1039
+ // Parse the arguments
1040
+ const parsed = $wHEkS(command, args, options);
1041
+ // Spawn the child process
1042
+ const spawned = $i45p4$child_process.spawn(parsed.command, parsed.args, parsed.options);
1043
+ // Hook into child process "exit" event to emit an error if the command
1044
+ // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
1045
+ $5XKEQ.hookChildProcess(spawned, parsed);
1046
+ return spawned;
1047
+ }
1048
+ function $a43a1aa555fd1c31$var$spawnSync(command, args, options) {
1049
+ // Parse the arguments
1050
+ const parsed = $wHEkS(command, args, options);
1051
+ // Spawn the child process
1052
+ const result = $i45p4$child_process.spawnSync(parsed.command, parsed.args, parsed.options);
1053
+ // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
1054
+ result.error = result.error || $5XKEQ.verifyENOENTSync(result.status, parsed);
1055
+ return result;
1056
+ }
1057
+ module.exports = $a43a1aa555fd1c31$var$spawn;
1058
+ module.exports.spawn = $a43a1aa555fd1c31$var$spawn;
1059
+ module.exports.sync = $a43a1aa555fd1c31$var$spawnSync;
1060
+ module.exports._parse = $wHEkS;
1061
+ module.exports._enoent = $5XKEQ;
1062
+
1063
+ });
1064
+ parcelRegister("wHEkS", function(module, exports) {
1065
+ 'use strict';
1066
+
1067
+
1068
+ var $8HV7x = parcelRequire("8HV7x");
1069
+
1070
+ var $8JtRc = parcelRequire("8JtRc");
1071
+
1072
+ var $S9QOg = parcelRequire("S9QOg");
1073
+ const $0624d92b8231a485$var$isWin = process.platform === 'win32';
1074
+ const $0624d92b8231a485$var$isExecutableRegExp = /\.(?:com|exe)$/i;
1075
+ const $0624d92b8231a485$var$isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
1076
+ function $0624d92b8231a485$var$detectShebang(parsed) {
1077
+ parsed.file = $8HV7x(parsed);
1078
+ const shebang = parsed.file && $S9QOg(parsed.file);
1079
+ if (shebang) {
1080
+ parsed.args.unshift(parsed.file);
1081
+ parsed.command = shebang;
1082
+ return $8HV7x(parsed);
1083
+ }
1084
+ return parsed.file;
1085
+ }
1086
+ function $0624d92b8231a485$var$parseNonShell(parsed) {
1087
+ if (!$0624d92b8231a485$var$isWin) return parsed;
1088
+ // Detect & add support for shebangs
1089
+ const commandFile = $0624d92b8231a485$var$detectShebang(parsed);
1090
+ // We don't need a shell if the command filename is an executable
1091
+ const needsShell = !$0624d92b8231a485$var$isExecutableRegExp.test(commandFile);
1092
+ // If a shell is required, use cmd.exe and take care of escaping everything correctly
1093
+ // Note that `forceShell` is an hidden option used only in tests
1094
+ if (parsed.options.forceShell || needsShell) {
1095
+ // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
1096
+ // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
1097
+ // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,
1098
+ // we need to double escape them
1099
+ const needsDoubleEscapeMetaChars = $0624d92b8231a485$var$isCmdShimRegExp.test(commandFile);
1100
+ // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
1101
+ // This is necessary otherwise it will always fail with ENOENT in those cases
1102
+ parsed.command = $i45p4$path.normalize(parsed.command);
1103
+ // Escape command & arguments
1104
+ parsed.command = $8JtRc.command(parsed.command);
1105
+ parsed.args = parsed.args.map((arg)=>$8JtRc.argument(arg, needsDoubleEscapeMetaChars));
1106
+ const shellCommand = [
1107
+ parsed.command
1108
+ ].concat(parsed.args).join(' ');
1109
+ parsed.args = [
1110
+ '/d',
1111
+ '/s',
1112
+ '/c',
1113
+ `"${shellCommand}"`
1114
+ ];
1115
+ parsed.command = process.env.comspec || 'cmd.exe';
1116
+ parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
1117
+ }
1118
+ return parsed;
1119
+ }
1120
+ function $0624d92b8231a485$var$parse(command, args, options) {
1121
+ // Normalize arguments, similar to nodejs
1122
+ if (args && !Array.isArray(args)) {
1123
+ options = args;
1124
+ args = null;
1125
+ }
1126
+ args = args ? args.slice(0) : []; // Clone array to avoid changing the original
1127
+ options = Object.assign({}, options); // Clone object to avoid changing the original
1128
+ // Build our parsed object
1129
+ const parsed = {
1130
+ command: command,
1131
+ args: args,
1132
+ options: options,
1133
+ file: undefined,
1134
+ original: {
1135
+ command: command,
1136
+ args: args
1137
+ }
1138
+ };
1139
+ // Delegate further parsing to shell or non-shell
1140
+ return options.shell ? parsed : $0624d92b8231a485$var$parseNonShell(parsed);
1141
+ }
1142
+ module.exports = $0624d92b8231a485$var$parse;
1143
+
1144
+ });
1145
+ parcelRegister("8HV7x", function(module, exports) {
1146
+ 'use strict';
1147
+
1148
+
1149
+ var $gQCz1 = parcelRequire("gQCz1");
1150
+
1151
+ var $lfSFu = parcelRequire("lfSFu");
1152
+ function $656ea5dc096f611c$var$resolveCommandAttempt(parsed, withoutPathExt) {
1153
+ const env = parsed.options.env || process.env;
1154
+ const cwd = process.cwd();
1155
+ const hasCustomCwd = parsed.options.cwd != null;
1156
+ // Worker threads do not have process.chdir()
1157
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
1158
+ // If a custom `cwd` was specified, we need to change the process cwd
1159
+ // because `which` will do stat calls but does not support a custom cwd
1160
+ if (shouldSwitchCwd) try {
1161
+ process.chdir(parsed.options.cwd);
1162
+ } catch (err) {
1163
+ /* Empty */ }
1164
+ let resolved;
1165
+ try {
1166
+ resolved = $gQCz1.sync(parsed.command, {
1167
+ path: env[$lfSFu({
1168
+ env: env
1169
+ })],
1170
+ pathExt: withoutPathExt ? $i45p4$path.delimiter : undefined
1171
+ });
1172
+ } catch (e) {
1173
+ /* Empty */ } finally{
1174
+ if (shouldSwitchCwd) process.chdir(cwd);
1175
+ }
1176
+ // If we successfully resolved, ensure that an absolute path is returned
1177
+ // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
1178
+ if (resolved) resolved = $i45p4$path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
1179
+ return resolved;
1180
+ }
1181
+ function $656ea5dc096f611c$var$resolveCommand(parsed) {
1182
+ return $656ea5dc096f611c$var$resolveCommandAttempt(parsed) || $656ea5dc096f611c$var$resolveCommandAttempt(parsed, true);
1183
+ }
1184
+ module.exports = $656ea5dc096f611c$var$resolveCommand;
1185
+
1186
+ });
1187
+ parcelRegister("gQCz1", function(module, exports) {
1188
+ const $c43f6aa8d0c0cebe$var$isWindows = process.platform === 'win32' || process.env.OSTYPE === 'cygwin' || process.env.OSTYPE === 'msys';
1189
+
1190
+ const $c43f6aa8d0c0cebe$var$COLON = $c43f6aa8d0c0cebe$var$isWindows ? ';' : ':';
1191
+
1192
+ var $xnA1W = parcelRequire("xnA1W");
1193
+ const $c43f6aa8d0c0cebe$var$getNotFoundError = (cmd)=>Object.assign(new Error(`not found: ${cmd}`), {
1194
+ code: 'ENOENT'
1195
+ });
1196
+ const $c43f6aa8d0c0cebe$var$getPathInfo = (cmd, opt)=>{
1197
+ const colon = opt.colon || $c43f6aa8d0c0cebe$var$COLON;
1198
+ // If it has a slash, then we don't bother searching the pathenv.
1199
+ // just check the file itself, and that's it.
1200
+ const pathEnv = cmd.match(/\//) || $c43f6aa8d0c0cebe$var$isWindows && cmd.match(/\\/) ? [
1201
+ ''
1202
+ ] : [
1203
+ // windows always checks the cwd first
1204
+ ...$c43f6aa8d0c0cebe$var$isWindows ? [
1205
+ process.cwd()
1206
+ ] : [],
1207
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */ '').split(colon)
1208
+ ];
1209
+ const pathExtExe = $c43f6aa8d0c0cebe$var$isWindows ? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM' : '';
1210
+ const pathExt = $c43f6aa8d0c0cebe$var$isWindows ? pathExtExe.split(colon) : [
1211
+ ''
1212
+ ];
1213
+ if ($c43f6aa8d0c0cebe$var$isWindows) {
1214
+ if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') pathExt.unshift('');
1215
+ }
1216
+ return {
1217
+ pathEnv: pathEnv,
1218
+ pathExt: pathExt,
1219
+ pathExtExe: pathExtExe
1220
+ };
1221
+ };
1222
+ const $c43f6aa8d0c0cebe$var$which = (cmd, opt, cb)=>{
1223
+ if (typeof opt === 'function') {
1224
+ cb = opt;
1225
+ opt = {};
1226
+ }
1227
+ if (!opt) opt = {};
1228
+ const { pathEnv: pathEnv, pathExt: pathExt, pathExtExe: pathExtExe } = $c43f6aa8d0c0cebe$var$getPathInfo(cmd, opt);
1229
+ const found = [];
1230
+ const step = (i)=>new Promise((resolve, reject)=>{
1231
+ if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject($c43f6aa8d0c0cebe$var$getNotFoundError(cmd));
1232
+ const ppRaw = pathEnv[i];
1233
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
1234
+ const pCmd = $i45p4$path.join(pathPart, cmd);
1235
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
1236
+ resolve(subStep(p, i, 0));
1237
+ });
1238
+ const subStep = (p, i, ii)=>new Promise((resolve, reject)=>{
1239
+ if (ii === pathExt.length) return resolve(step(i + 1));
1240
+ const ext = pathExt[ii];
1241
+ $xnA1W(p + ext, {
1242
+ pathExt: pathExtExe
1243
+ }, (er, is)=>{
1244
+ if (!er && is) {
1245
+ if (opt.all) found.push(p + ext);
1246
+ else return resolve(p + ext);
1247
+ }
1248
+ return resolve(subStep(p, i, ii + 1));
1249
+ });
1250
+ });
1251
+ return cb ? step(0).then((res)=>cb(null, res), cb) : step(0);
1252
+ };
1253
+ const $c43f6aa8d0c0cebe$var$whichSync = (cmd, opt)=>{
1254
+ opt = opt || {};
1255
+ const { pathEnv: pathEnv, pathExt: pathExt, pathExtExe: pathExtExe } = $c43f6aa8d0c0cebe$var$getPathInfo(cmd, opt);
1256
+ const found = [];
1257
+ for(let i = 0; i < pathEnv.length; i++){
1258
+ const ppRaw = pathEnv[i];
1259
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
1260
+ const pCmd = $i45p4$path.join(pathPart, cmd);
1261
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
1262
+ for(let j = 0; j < pathExt.length; j++){
1263
+ const cur = p + pathExt[j];
1264
+ try {
1265
+ const is = $xnA1W.sync(cur, {
1266
+ pathExt: pathExtExe
1267
+ });
1268
+ if (is) {
1269
+ if (opt.all) found.push(cur);
1270
+ else return cur;
1271
+ }
1272
+ } catch (ex) {}
1273
+ }
1274
+ }
1275
+ if (opt.all && found.length) return found;
1276
+ if (opt.nothrow) return null;
1277
+ throw $c43f6aa8d0c0cebe$var$getNotFoundError(cmd);
1278
+ };
1279
+ module.exports = $c43f6aa8d0c0cebe$var$which;
1280
+ $c43f6aa8d0c0cebe$var$which.sync = $c43f6aa8d0c0cebe$var$whichSync;
1281
+
1282
+ });
1283
+ parcelRegister("xnA1W", function(module, exports) {
1284
+
1285
+ var $06455fb49d6aed3b$var$core;
1286
+
1287
+
1288
+ if (process.platform === 'win32' || $parcel$global.TESTING_WINDOWS) $06455fb49d6aed3b$var$core = (parcelRequire("12izX"));
1289
+ else $06455fb49d6aed3b$var$core = (parcelRequire("fYIqr"));
1290
+ module.exports = $06455fb49d6aed3b$var$isexe;
1291
+ $06455fb49d6aed3b$var$isexe.sync = $06455fb49d6aed3b$var$sync;
1292
+ function $06455fb49d6aed3b$var$isexe(path, options, cb) {
1293
+ if (typeof options === 'function') {
1294
+ cb = options;
1295
+ options = {};
1296
+ }
1297
+ if (!cb) {
1298
+ if (typeof Promise !== 'function') throw new TypeError('callback not provided');
1299
+ return new Promise(function(resolve, reject) {
1300
+ $06455fb49d6aed3b$var$isexe(path, options || {}, function(er, is) {
1301
+ if (er) reject(er);
1302
+ else resolve(is);
1303
+ });
1304
+ });
1305
+ }
1306
+ $06455fb49d6aed3b$var$core(path, options || {}, function(er, is) {
1307
+ // ignore EACCES because that just means we aren't allowed to run it
1308
+ if (er) {
1309
+ if (er.code === 'EACCES' || options && options.ignoreErrors) {
1310
+ er = null;
1311
+ is = false;
1312
+ }
1313
+ }
1314
+ cb(er, is);
1315
+ });
1316
+ }
1317
+ function $06455fb49d6aed3b$var$sync(path, options) {
1318
+ // my kingdom for a filtered catch
1319
+ try {
1320
+ return $06455fb49d6aed3b$var$core.sync(path, options || {});
1321
+ } catch (er) {
1322
+ if (options && options.ignoreErrors || er.code === 'EACCES') return false;
1323
+ else throw er;
1324
+ }
1325
+ }
1326
+
1327
+ });
1328
+
1329
+
1330
+ parcelRegister("lfSFu", function(module, exports) {
1331
+ 'use strict';
1332
+ const $f79567a520e4b451$var$pathKey = (options = {})=>{
1333
+ const environment = options.env || process.env;
1334
+ const platform = options.platform || process.platform;
1335
+ if (platform !== 'win32') return 'PATH';
1336
+ return Object.keys(environment).reverse().find((key)=>key.toUpperCase() === 'PATH') || 'Path';
1337
+ };
1338
+ module.exports = $f79567a520e4b451$var$pathKey;
1339
+ // TODO: Remove this for the next major release
1340
+ module.exports.default = $f79567a520e4b451$var$pathKey;
1341
+
1342
+ });
1343
+
1344
+
1345
+ parcelRegister("8JtRc", function(module, exports) {
1346
+
1347
+ $parcel$export(module.exports, "command", () => $65b9afb0fc8cc124$export$ae50443ffc990749, (v) => $65b9afb0fc8cc124$export$ae50443ffc990749 = v);
1348
+ $parcel$export(module.exports, "argument", () => $65b9afb0fc8cc124$export$6ea29ee575e3f5ff, (v) => $65b9afb0fc8cc124$export$6ea29ee575e3f5ff = v);
1349
+ var $65b9afb0fc8cc124$export$ae50443ffc990749;
1350
+ var $65b9afb0fc8cc124$export$6ea29ee575e3f5ff;
1351
+ 'use strict';
1352
+ // See http://www.robvanderwoude.com/escapechars.php
1353
+ const $65b9afb0fc8cc124$var$metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
1354
+ function $65b9afb0fc8cc124$var$escapeCommand(arg) {
1355
+ // Escape meta chars
1356
+ arg = arg.replace($65b9afb0fc8cc124$var$metaCharsRegExp, '^$1');
1357
+ return arg;
1358
+ }
1359
+ function $65b9afb0fc8cc124$var$escapeArgument(arg, doubleEscapeMetaChars) {
1360
+ // Convert to string
1361
+ arg = `${arg}`;
1362
+ // Algorithm below is based on https://qntm.org/cmd
1363
+ // It's slightly altered to disable JS backtracking to avoid hanging on specially crafted input
1364
+ // Please see https://github.com/moxystudio/node-cross-spawn/pull/160 for more information
1365
+ // Sequence of backslashes followed by a double quote:
1366
+ // double up all the backslashes and escape the double quote
1367
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
1368
+ // Sequence of backslashes followed by the end of the string
1369
+ // (which will become a double quote later):
1370
+ // double up all the backslashes
1371
+ arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1');
1372
+ // All other backslashes occur literally
1373
+ // Quote the whole thing:
1374
+ arg = `"${arg}"`;
1375
+ // Escape meta chars
1376
+ arg = arg.replace($65b9afb0fc8cc124$var$metaCharsRegExp, '^$1');
1377
+ // Double escape meta chars if necessary
1378
+ if (doubleEscapeMetaChars) arg = arg.replace($65b9afb0fc8cc124$var$metaCharsRegExp, '^$1');
1379
+ return arg;
1380
+ }
1381
+ $65b9afb0fc8cc124$export$ae50443ffc990749 = $65b9afb0fc8cc124$var$escapeCommand;
1382
+ $65b9afb0fc8cc124$export$6ea29ee575e3f5ff = $65b9afb0fc8cc124$var$escapeArgument;
1383
+
1384
+ });
1385
+
1386
+ parcelRegister("S9QOg", function(module, exports) {
1387
+ 'use strict';
1388
+
1389
+
1390
+ var $c1SBZ = parcelRequire("c1SBZ");
1391
+ function $0a2caf6af036a4d5$var$readShebang(command) {
1392
+ // Read the first 150 bytes from the file
1393
+ const size = 150;
1394
+ const buffer = Buffer.alloc(size);
1395
+ let fd;
1396
+ try {
1397
+ fd = $i45p4$fs.openSync(command, 'r');
1398
+ $i45p4$fs.readSync(fd, buffer, 0, size, 0);
1399
+ $i45p4$fs.closeSync(fd);
1400
+ } catch (e) {}
1401
+ // Attempt to extract shebang (null is returned if not a shebang)
1402
+ return $c1SBZ(buffer.toString());
1403
+ }
1404
+ module.exports = $0a2caf6af036a4d5$var$readShebang;
1405
+
1406
+ });
1407
+ parcelRegister("c1SBZ", function(module, exports) {
1408
+ 'use strict';
1409
+
1410
+ var $87mH3 = parcelRequire("87mH3");
1411
+ module.exports = (string = '')=>{
1412
+ const match = string.match($87mH3);
1413
+ if (!match) return null;
1414
+ const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
1415
+ const binary = path.split('/').pop();
1416
+ if (binary === 'env') return argument;
1417
+ return argument ? `${binary} ${argument}` : binary;
1418
+ };
1419
+
1420
+ });
1421
+ parcelRegister("87mH3", function(module, exports) {
1422
+ 'use strict';
1423
+ module.exports = /^#!(.*)/;
1424
+
1425
+ });
1426
+
1427
+
1428
+
1429
+
1430
+ parcelRegister("5XKEQ", function(module, exports) {
1431
+ 'use strict';
1432
+ const $4576a7b8ccaf1ed6$var$isWin = process.platform === 'win32';
1433
+ function $4576a7b8ccaf1ed6$var$notFoundError(original, syscall) {
1434
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
1435
+ code: 'ENOENT',
1436
+ errno: 'ENOENT',
1437
+ syscall: `${syscall} ${original.command}`,
1438
+ path: original.command,
1439
+ spawnargs: original.args
1440
+ });
1441
+ }
1442
+ function $4576a7b8ccaf1ed6$var$hookChildProcess(cp, parsed) {
1443
+ if (!$4576a7b8ccaf1ed6$var$isWin) return;
1444
+ const originalEmit = cp.emit;
1445
+ cp.emit = function(name, arg1) {
1446
+ // If emitting "exit" event and exit code is 1, we need to check if
1447
+ // the command exists and emit an "error" instead
1448
+ // See https://github.com/IndigoUnited/node-cross-spawn/issues/16
1449
+ if (name === 'exit') {
1450
+ const err = $4576a7b8ccaf1ed6$var$verifyENOENT(arg1, parsed);
1451
+ if (err) return originalEmit.call(cp, 'error', err);
1452
+ }
1453
+ return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params
1454
+ };
1455
+ }
1456
+ function $4576a7b8ccaf1ed6$var$verifyENOENT(status, parsed) {
1457
+ if ($4576a7b8ccaf1ed6$var$isWin && status === 1 && !parsed.file) return $4576a7b8ccaf1ed6$var$notFoundError(parsed.original, 'spawn');
1458
+ return null;
1459
+ }
1460
+ function $4576a7b8ccaf1ed6$var$verifyENOENTSync(status, parsed) {
1461
+ if ($4576a7b8ccaf1ed6$var$isWin && status === 1 && !parsed.file) return $4576a7b8ccaf1ed6$var$notFoundError(parsed.original, 'spawnSync');
1462
+ return null;
1463
+ }
1464
+ module.exports = {
1465
+ hookChildProcess: $4576a7b8ccaf1ed6$var$hookChildProcess,
1466
+ verifyENOENT: $4576a7b8ccaf1ed6$var$verifyENOENT,
1467
+ verifyENOENTSync: $4576a7b8ccaf1ed6$var$verifyENOENTSync,
1468
+ notFoundError: $4576a7b8ccaf1ed6$var$notFoundError
1469
+ };
1470
+
1471
+ });
1472
+
1473
+
1474
+ parcelRegister("fs99M", function(module, exports) {
1475
+
1476
+ $parcel$export(module.exports, "default", () => $b40092e356814152$export$2e2bcd8739ae039);
1477
+ function $b40092e356814152$export$2e2bcd8739ae039(childProcess) {
1478
+ return new Promise((resolve, reject)=>{
1479
+ childProcess.on('error', reject);
1480
+ childProcess.on('close', (code)=>{
1481
+ if (code !== 0) {
1482
+ reject(new Error('Child process failed'));
1483
+ return;
1484
+ }
1485
+ resolve();
1486
+ });
1487
+ });
1488
+ }
1489
+
1490
+ });
1491
+
1492
+ parcelRegister("jeDhm", function(module, exports) {
1493
+ module.exports = JSON.parse("{\"name\":\"@parcel/package-manager\",\"version\":\"2.16.4\",\"description\":\"Blazing fast, zero configuration web application bundler\",\"license\":\"MIT\",\"publishConfig\":{\"access\":\"public\"},\"funding\":{\"type\":\"opencollective\",\"url\":\"https://opencollective.com/parcel\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/parcel-bundler/parcel.git\"},\"main\":\"lib/index.js\",\"source\":\"src/index.js\",\"types\":\"index.d.ts\",\"engines\":{\"node\":\">= 16.0.0\"},\"scripts\":{\"build-ts\":\"mkdir -p lib && flow-to-ts src/index.js > lib/index.d.ts\",\"check-ts\":\"tsc --noEmit index.d.ts\",\"test\":\"mocha test\"},\"targets\":{\"types\":false,\"main\":{\"includeNodeModules\":{\"@parcel/core\":false,\"@parcel/diagnostic\":false,\"@parcel/fs\":false,\"@parcel/logger\":false,\"@parcel/node-resolver-core\":false,\"@parcel/types\":false,\"@parcel/utils\":false,\"@parcel/workers\":false,\"@swc/core\":false,\"semver\":false}}},\"dependencies\":{\"@parcel/diagnostic\":\"2.16.4\",\"@parcel/fs\":\"2.16.4\",\"@parcel/logger\":\"2.16.4\",\"@parcel/node-resolver-core\":\"3.7.4\",\"@parcel/types\":\"2.16.4\",\"@parcel/utils\":\"2.16.4\",\"@parcel/workers\":\"2.16.4\",\"@swc/core\":\"^1.11.24\",\"semver\":\"^7.7.1\"},\"devDependencies\":{\"command-exists\":\"^1.2.9\",\"cross-spawn\":\"^7.0.6\",\"nullthrows\":\"^1.1.1\",\"split2\":\"^4.2.0\"},\"peerDependencies\":{\"@parcel/core\":\"^2.16.4\"},\"browser\":{\"./src/NodePackageManager.js\":false,\"./src/Npm.js\":false,\"./src/Pnpm.js\":false,\"./src/Yarn.js\":false},\"gitHead\":\"59484858a1a0bcbb71f74088956bb437a2db6505\"}");
1494
+
1495
+ });
1496
+
1497
+
1498
+ parcelRegister("eZHZZ", function(module, exports) {
1499
+
1500
+ $parcel$export(module.exports, "Yarn", () => $aea8e475eee44f94$export$8db243e2edc9d1b8);
1501
+
1502
+ var $fPtcL = parcelRequire("fPtcL");
1503
+
1504
+ var $e6aVH = parcelRequire("e6aVH");
1505
+
1506
+
1507
+ var $8gROC = parcelRequire("8gROC");
1508
+
1509
+ var $2MhVX = parcelRequire("2MhVX");
1510
+
1511
+ var $fs99M = parcelRequire("fs99M");
1512
+
1513
+
1514
+ var $32AGp = parcelRequire("32AGp");
1515
+
1516
+ var $jeDhm = parcelRequire("jeDhm");
1517
+ const $aea8e475eee44f94$var$YARN_CMD = 'yarn';
1518
+ let $aea8e475eee44f94$var$hasYarn;
1519
+ let $aea8e475eee44f94$var$yarnVersion;
1520
+ class $aea8e475eee44f94$export$8db243e2edc9d1b8 {
1521
+ static async exists() {
1522
+ if ($aea8e475eee44f94$var$hasYarn != null) return $aea8e475eee44f94$var$hasYarn;
1523
+ try {
1524
+ $aea8e475eee44f94$var$hasYarn = Boolean(await (0, (/*@__PURE__*/$parcel$interopDefault($fPtcL)))('yarn'));
1525
+ } catch (err) {
1526
+ $aea8e475eee44f94$var$hasYarn = false;
1527
+ }
1528
+ return $aea8e475eee44f94$var$hasYarn;
1529
+ }
1530
+ async install({ modules: modules, cwd: cwd, saveDev: saveDev = true }) {
1531
+ if ($aea8e475eee44f94$var$yarnVersion == null) {
1532
+ let version = await (0, $32AGp.exec)('yarn --version');
1533
+ $aea8e475eee44f94$var$yarnVersion = parseInt(version.stdout, 10);
1534
+ }
1535
+ let args = [
1536
+ 'add',
1537
+ '--json'
1538
+ ].concat(modules.map((0, $32AGp.npmSpecifierFromModuleRequest)));
1539
+ if (saveDev) {
1540
+ args.push('-D');
1541
+ if ($aea8e475eee44f94$var$yarnVersion < 2) args.push('-W');
1542
+ }
1543
+ // When Parcel is run by Yarn (e.g. via package.json scripts), several environment variables are
1544
+ // added. When parcel in turn calls Yarn again, these can cause Yarn to behave stragely, so we
1545
+ // filter them out when installing packages.
1546
+ let env = {};
1547
+ for(let key in process.env)if (!key.startsWith('npm_') && key !== 'YARN_WRAP_OUTPUT' && key !== 'INIT_CWD' && key !== 'NODE_ENV') env[key] = process.env[key];
1548
+ let installProcess = (0, (/*@__PURE__*/$parcel$interopDefault($e6aVH)))($aea8e475eee44f94$var$YARN_CMD, args, {
1549
+ cwd: cwd,
1550
+ env: env
1551
+ });
1552
+ installProcess.stdout// Invoking yarn with --json provides streaming, newline-delimited JSON output.
1553
+ .pipe((0, (/*@__PURE__*/$parcel$interopDefault($8gROC)))()).pipe(new (0, $2MhVX.default)()).on('error', (e)=>{
1554
+ (0, ($parcel$interopDefault($i45p4$parcellogger))).error(e, '@parcel/package-manager');
1555
+ }).on('data', (message)=>{
1556
+ switch(message.type){
1557
+ case 'step':
1558
+ (0, ($parcel$interopDefault($i45p4$parcellogger))).progress($aea8e475eee44f94$var$prefix(`[${message.data.current}/${message.data.total}] ${message.data.message}`));
1559
+ return;
1560
+ case 'success':
1561
+ case 'info':
1562
+ (0, ($parcel$interopDefault($i45p4$parcellogger))).info({
1563
+ origin: '@parcel/package-manager',
1564
+ message: $aea8e475eee44f94$var$prefix(message.data)
1565
+ });
1566
+ return;
1567
+ default:
1568
+ }
1569
+ });
1570
+ installProcess.stderr.pipe((0, (/*@__PURE__*/$parcel$interopDefault($8gROC)))()).pipe(new (0, $2MhVX.default)()).on('error', (e)=>{
1571
+ (0, ($parcel$interopDefault($i45p4$parcellogger))).error(e, '@parcel/package-manager');
1572
+ }).on('data', (message)=>{
1573
+ switch(message.type){
1574
+ case 'warning':
1575
+ (0, ($parcel$interopDefault($i45p4$parcellogger))).warn({
1576
+ origin: '@parcel/package-manager',
1577
+ message: $aea8e475eee44f94$var$prefix(message.data)
1578
+ });
1579
+ return;
1580
+ case 'error':
1581
+ (0, ($parcel$interopDefault($i45p4$parcellogger))).error({
1582
+ origin: '@parcel/package-manager',
1583
+ message: $aea8e475eee44f94$var$prefix(message.data)
1584
+ });
1585
+ return;
1586
+ default:
1587
+ }
1588
+ });
1589
+ try {
1590
+ return await (0, $fs99M.default)(installProcess);
1591
+ } catch (e) {
1592
+ throw new Error('Yarn failed to install modules:' + e.message);
1593
+ }
1594
+ }
1595
+ }
1596
+ function $aea8e475eee44f94$var$prefix(message) {
1597
+ return 'yarn: ' + message;
1598
+ }
1599
+ (0, $i45p4$parcelcore.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($jeDhm))).version}:Yarn`, $aea8e475eee44f94$export$8db243e2edc9d1b8);
1600
+
1601
+ });
1602
+ parcelRegister("fPtcL", function(module, exports) {
1603
+
1604
+ module.exports = (parcelRequire("3lhdG"));
1605
+
1606
+ });
1607
+
1608
+ parcelRegister("8gROC", function(module, exports) {
1609
+ /*
1610
+ Copyright (c) 2014-2021, Matteo Collina <hello@matteocollina.com>
1611
+
1612
+ Permission to use, copy, modify, and/or distribute this software for any
1613
+ purpose with or without fee is hereby granted, provided that the above
1614
+ copyright notice and this permission notice appear in all copies.
1615
+
1616
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1617
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1618
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1619
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1620
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1621
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
1622
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1623
+ */ 'use strict';
1624
+
1625
+ var $60598ffc0d28b800$require$Transform = $i45p4$stream.Transform;
1626
+
1627
+ var $60598ffc0d28b800$require$StringDecoder = $i45p4$string_decoder.StringDecoder;
1628
+ const $60598ffc0d28b800$var$kLast = Symbol('last');
1629
+ const $60598ffc0d28b800$var$kDecoder = Symbol('decoder');
1630
+ function $60598ffc0d28b800$var$transform(chunk, enc, cb) {
1631
+ let list;
1632
+ if (this.overflow) {
1633
+ const buf = this[$60598ffc0d28b800$var$kDecoder].write(chunk);
1634
+ list = buf.split(this.matcher);
1635
+ if (list.length === 1) return cb() // Line ending not found. Discard entire chunk.
1636
+ ;
1637
+ // Line ending found. Discard trailing fragment of previous line and reset overflow state.
1638
+ list.shift();
1639
+ this.overflow = false;
1640
+ } else {
1641
+ this[$60598ffc0d28b800$var$kLast] += this[$60598ffc0d28b800$var$kDecoder].write(chunk);
1642
+ list = this[$60598ffc0d28b800$var$kLast].split(this.matcher);
1643
+ }
1644
+ this[$60598ffc0d28b800$var$kLast] = list.pop();
1645
+ for(let i = 0; i < list.length; i++)try {
1646
+ $60598ffc0d28b800$var$push(this, this.mapper(list[i]));
1647
+ } catch (error) {
1648
+ return cb(error);
1649
+ }
1650
+ this.overflow = this[$60598ffc0d28b800$var$kLast].length > this.maxLength;
1651
+ if (this.overflow && !this.skipOverflow) {
1652
+ cb(new Error('maximum buffer reached'));
1653
+ return;
1654
+ }
1655
+ cb();
1656
+ }
1657
+ function $60598ffc0d28b800$var$flush(cb) {
1658
+ // forward any gibberish left in there
1659
+ this[$60598ffc0d28b800$var$kLast] += this[$60598ffc0d28b800$var$kDecoder].end();
1660
+ if (this[$60598ffc0d28b800$var$kLast]) try {
1661
+ $60598ffc0d28b800$var$push(this, this.mapper(this[$60598ffc0d28b800$var$kLast]));
1662
+ } catch (error) {
1663
+ return cb(error);
1664
+ }
1665
+ cb();
1666
+ }
1667
+ function $60598ffc0d28b800$var$push(self, val) {
1668
+ if (val !== undefined) self.push(val);
1669
+ }
1670
+ function $60598ffc0d28b800$var$noop(incoming) {
1671
+ return incoming;
1672
+ }
1673
+ function $60598ffc0d28b800$var$split(matcher, mapper, options) {
1674
+ // Set defaults for any arguments not supplied.
1675
+ matcher = matcher || /\r?\n/;
1676
+ mapper = mapper || $60598ffc0d28b800$var$noop;
1677
+ options = options || {};
1678
+ // Test arguments explicitly.
1679
+ switch(arguments.length){
1680
+ case 1:
1681
+ // If mapper is only argument.
1682
+ if (typeof matcher === 'function') {
1683
+ mapper = matcher;
1684
+ matcher = /\r?\n/;
1685
+ // If options is only argument.
1686
+ } else if (typeof matcher === 'object' && !(matcher instanceof RegExp) && !matcher[Symbol.split]) {
1687
+ options = matcher;
1688
+ matcher = /\r?\n/;
1689
+ }
1690
+ break;
1691
+ case 2:
1692
+ // If mapper and options are arguments.
1693
+ if (typeof matcher === 'function') {
1694
+ options = mapper;
1695
+ mapper = matcher;
1696
+ matcher = /\r?\n/;
1697
+ // If matcher and options are arguments.
1698
+ } else if (typeof mapper === 'object') {
1699
+ options = mapper;
1700
+ mapper = $60598ffc0d28b800$var$noop;
1701
+ }
1702
+ }
1703
+ options = Object.assign({}, options);
1704
+ options.autoDestroy = true;
1705
+ options.transform = $60598ffc0d28b800$var$transform;
1706
+ options.flush = $60598ffc0d28b800$var$flush;
1707
+ options.readableObjectMode = true;
1708
+ const stream = new $60598ffc0d28b800$require$Transform(options);
1709
+ stream[$60598ffc0d28b800$var$kLast] = '';
1710
+ stream[$60598ffc0d28b800$var$kDecoder] = new $60598ffc0d28b800$require$StringDecoder('utf8');
1711
+ stream.matcher = matcher;
1712
+ stream.mapper = mapper;
1713
+ stream.maxLength = options.maxLength;
1714
+ stream.skipOverflow = options.skipOverflow || false;
1715
+ stream.overflow = false;
1716
+ stream._destroy = function(err, cb) {
1717
+ // Weird Node v12 bug that we need to work around
1718
+ this._writableState.errorEmitted = false;
1719
+ cb(err);
1720
+ };
1721
+ return stream;
1722
+ }
1723
+ module.exports = $60598ffc0d28b800$var$split;
1724
+
1725
+ });
1726
+
1727
+ parcelRegister("2MhVX", function(module, exports) {
1728
+
1729
+ $parcel$export(module.exports, "default", () => $205df9be7e041f3d$export$2e2bcd8739ae039);
1730
+
1731
+
1732
+ class $205df9be7e041f3d$export$2e2bcd8739ae039 extends (0, $i45p4$stream.Transform) {
1733
+ constructor(options){
1734
+ super({
1735
+ ...options,
1736
+ objectMode: true
1737
+ });
1738
+ }
1739
+ // $FlowFixMe We are in object mode, so we emit objects, not strings
1740
+ _transform(chunk, encoding, callback) {
1741
+ try {
1742
+ let parsed;
1743
+ try {
1744
+ parsed = JSON.parse(chunk.toString());
1745
+ } catch (e) {
1746
+ // Be permissive and ignoreJSON parse errors in case there was
1747
+ // a non-JSON line in the package manager's stdout.
1748
+ (0, ($parcel$interopDefault($i45p4$parcellogger))).verbose({
1749
+ message: 'Ignored invalid JSON message: ' + chunk.toString(),
1750
+ origin: '@parcel/package-manager'
1751
+ });
1752
+ return;
1753
+ }
1754
+ callback(null, parsed);
1755
+ } catch (err) {
1756
+ callback(err);
1757
+ }
1758
+ }
1759
+ }
1760
+
1761
+ });
1762
+
1763
+
1764
+ parcelRegister("buj7e", function(module, exports) {
1765
+
1766
+ $parcel$export(module.exports, "Pnpm", () => $85d1530af77bb266$export$ad678da47ffaf985);
1767
+
1768
+
1769
+
1770
+ var $fPtcL = parcelRequire("fPtcL");
1771
+
1772
+ var $e6aVH = parcelRequire("e6aVH");
1773
+
1774
+
1775
+ var $8gROC = parcelRequire("8gROC");
1776
+
1777
+ var $2MhVX = parcelRequire("2MhVX");
1778
+
1779
+ var $fs99M = parcelRequire("fs99M");
1780
+
1781
+
1782
+ var $32AGp = parcelRequire("32AGp");
1783
+
1784
+ var $jeDhm = parcelRequire("jeDhm");
1785
+ const $85d1530af77bb266$var$PNPM_CMD = 'pnpm';
1786
+ let $85d1530af77bb266$var$hasPnpm;
1787
+ let $85d1530af77bb266$var$pnpmVersion;
1788
+ class $85d1530af77bb266$export$ad678da47ffaf985 {
1789
+ static async exists() {
1790
+ if ($85d1530af77bb266$var$hasPnpm != null) return $85d1530af77bb266$var$hasPnpm;
1791
+ try {
1792
+ $85d1530af77bb266$var$hasPnpm = Boolean(await (0, (/*@__PURE__*/$parcel$interopDefault($fPtcL)))('pnpm'));
1793
+ } catch (err) {
1794
+ $85d1530af77bb266$var$hasPnpm = false;
1795
+ }
1796
+ return $85d1530af77bb266$var$hasPnpm;
1797
+ }
1798
+ async install({ modules: modules, cwd: cwd, saveDev: saveDev = true }) {
1799
+ if ($85d1530af77bb266$var$pnpmVersion == null) {
1800
+ let version = await (0, $32AGp.exec)('pnpm --version');
1801
+ $85d1530af77bb266$var$pnpmVersion = parseInt(version.stdout, 10);
1802
+ }
1803
+ let args = [
1804
+ 'add',
1805
+ '--reporter',
1806
+ 'ndjson'
1807
+ ];
1808
+ if (saveDev) args.push('-D');
1809
+ if ($85d1530af77bb266$var$pnpmVersion >= 7) {
1810
+ if ((0, ($parcel$interopDefault($i45p4$fs))).existsSync((0, ($parcel$interopDefault($i45p4$path))).join(cwd, 'pnpm-workspace.yaml'))) // installs in workspace root (regardless of cwd)
1811
+ args.push('-w');
1812
+ } else // ignores workspace root check
1813
+ args.push('-W');
1814
+ args = args.concat(modules.map((0, $32AGp.npmSpecifierFromModuleRequest)));
1815
+ let env = {};
1816
+ for(let key in process.env)if (!key.startsWith('npm_') && key !== 'INIT_CWD' && key !== 'NODE_ENV') env[key] = process.env[key];
1817
+ let addedCount = 0, removedCount = 0;
1818
+ let installProcess = (0, (/*@__PURE__*/$parcel$interopDefault($e6aVH)))($85d1530af77bb266$var$PNPM_CMD, args, {
1819
+ cwd: cwd,
1820
+ env: env
1821
+ });
1822
+ installProcess.stdout.pipe((0, (/*@__PURE__*/$parcel$interopDefault($8gROC)))()).pipe(new (0, $2MhVX.default)()).on('error', (e)=>{
1823
+ (0, ($parcel$interopDefault($i45p4$parcellogger))).warn({
1824
+ origin: '@parcel/package-manager',
1825
+ message: e.chunk,
1826
+ stack: e.stack
1827
+ });
1828
+ }).on('data', (json)=>{
1829
+ if (json.level === 'error') (0, ($parcel$interopDefault($i45p4$parcellogger))).error({
1830
+ origin: '@parcel/package-manager',
1831
+ message: json.err.message,
1832
+ stack: json.err.stack
1833
+ });
1834
+ else if (json.level === 'info' && typeof json.message === 'string') (0, ($parcel$interopDefault($i45p4$parcellogger))).info({
1835
+ origin: '@parcel/package-manager',
1836
+ message: $85d1530af77bb266$var$prefix(json.message)
1837
+ });
1838
+ else if (json.name === 'pnpm:stats') {
1839
+ addedCount += json.added ?? 0;
1840
+ removedCount += json.removed ?? 0;
1841
+ }
1842
+ });
1843
+ let stderr = [];
1844
+ installProcess.stderr.on('data', (str)=>{
1845
+ stderr.push(str.toString());
1846
+ }).on('error', (e)=>{
1847
+ (0, ($parcel$interopDefault($i45p4$parcellogger))).warn({
1848
+ origin: '@parcel/package-manager',
1849
+ message: e.message
1850
+ });
1851
+ });
1852
+ try {
1853
+ await (0, $fs99M.default)(installProcess);
1854
+ if (addedCount > 0 || removedCount > 0) (0, ($parcel$interopDefault($i45p4$parcellogger))).log({
1855
+ origin: '@parcel/package-manager',
1856
+ message: `Added ${addedCount} ${removedCount > 0 ? `and removed ${removedCount} ` : ''}packages via pnpm`
1857
+ });
1858
+ // Since we succeeded, stderr might have useful information not included
1859
+ // in the json written to stdout. It's also not necessary to log these as
1860
+ // errors as they often aren't.
1861
+ for (let message of stderr)(0, ($parcel$interopDefault($i45p4$parcellogger))).log({
1862
+ origin: '@parcel/package-manager',
1863
+ message: message
1864
+ });
1865
+ } catch (e) {
1866
+ throw new Error('pnpm failed to install modules');
1867
+ }
1868
+ }
1869
+ }
1870
+ function $85d1530af77bb266$var$prefix(message) {
1871
+ return 'pnpm: ' + message;
1872
+ }
1873
+ (0, $i45p4$parcelcore.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($jeDhm))).version}:Pnpm`, $85d1530af77bb266$export$ad678da47ffaf985);
1874
+
1875
+ });
1876
+
1877
+ parcelRegister("cXMMx", function(module, exports) {
1878
+
1879
+ $parcel$export(module.exports, "default", () => $9700d5cfd04c8596$export$2e2bcd8739ae039);
1880
+ function $9700d5cfd04c8596$export$2e2bcd8739ae039(userAgent = process.env.npm_config_user_agent) {
1881
+ if (!userAgent) return undefined;
1882
+ const pmSpec = userAgent.split(' ')[0];
1883
+ const separatorPos = pmSpec.lastIndexOf('/');
1884
+ const name = pmSpec.substring(0, separatorPos);
1885
+ return {
1886
+ name: name,
1887
+ version: pmSpec.substring(separatorPos + 1)
1888
+ };
1889
+ }
1890
+
1891
+ });
1892
+
1893
+ parcelRegister("b405e", function(module, exports) {
1894
+
1895
+ $parcel$export(module.exports, "default", () => $80e021fbed76242f$export$2e2bcd8739ae039);
1896
+ const $80e021fbed76242f$var$MODULE_REGEX = /^((@[^/\s]+\/){0,1}([^/\s.~]+[^/\s]*)){1}(@[^/\s]+){0,1}/;
1897
+ function $80e021fbed76242f$export$2e2bcd8739ae039(moduleName) {
1898
+ let matches = $80e021fbed76242f$var$MODULE_REGEX.exec(moduleName);
1899
+ if (matches) return matches[0];
1900
+ return '';
1901
+ }
1902
+
1903
+ });
1904
+
1905
+
1906
+
1907
+
1908
+ $parcel$export(module.exports, "_addToInstallQueue", () => (parcelRequire("b3vcY"))._addToInstallQueue);
1909
+
1910
+ var $lLPK6 = parcelRequire("lLPK6");
1911
+
1912
+ var $buj7e = parcelRequire("buj7e");
1913
+
1914
+ var $eZHZZ = parcelRequire("eZHZZ");
1915
+ var $afea74298363e136$exports = {};
1916
+
1917
+ $parcel$export($afea74298363e136$exports, "MockPackageInstaller", () => $afea74298363e136$export$75a986c28df5fb9b);
1918
+
1919
+
1920
+
1921
+
1922
+ var $jeDhm = parcelRequire("jeDhm");
1923
+
1924
+ var $32AGp = parcelRequire("32AGp");
1925
+ class $afea74298363e136$export$75a986c28df5fb9b {
1926
+ packages = new Map();
1927
+ register(packageName, fs, packagePath) {
1928
+ this.packages.set(packageName, {
1929
+ fs: fs,
1930
+ packagePath: packagePath
1931
+ });
1932
+ }
1933
+ async install({ modules: modules, fs: fs, cwd: cwd, packagePath: packagePath, saveDev: saveDev = true }) {
1934
+ if (packagePath == null) {
1935
+ packagePath = (0, ($parcel$interopDefault($i45p4$path))).join(cwd, 'package.json');
1936
+ await fs.writeFile(packagePath, '{}');
1937
+ }
1938
+ let pkg = JSON.parse(await fs.readFile(packagePath, 'utf8'));
1939
+ let key = saveDev ? 'devDependencies' : 'dependencies';
1940
+ if (!pkg[key]) pkg[key] = {};
1941
+ for (let module of modules)pkg[key][module.name] = '^' + await this.installPackage(module, fs, packagePath);
1942
+ await fs.writeFile(packagePath, JSON.stringify(pkg));
1943
+ }
1944
+ async installPackage(moduleRequest, fs, packagePath) {
1945
+ let pkg = this.packages.get(moduleRequest.name);
1946
+ if (!pkg) throw new Error('Unknown package ' + moduleRequest.name);
1947
+ let dest = (0, ($parcel$interopDefault($i45p4$path))).join((0, ($parcel$interopDefault($i45p4$path))).dirname(packagePath), 'node_modules', moduleRequest.name);
1948
+ await (0, $i45p4$parcelfs.ncp)(pkg.fs, pkg.packagePath, fs, dest);
1949
+ let packageJSON = JSON.parse(await fs.readFile((0, ($parcel$interopDefault($i45p4$path))).join(dest, 'package.json'), 'utf8'));
1950
+ if (packageJSON.dependencies != null) for (let dep of (0, $32AGp.moduleRequestsFromDependencyMap)(packageJSON.dependencies))await this.installPackage(dep, fs, packagePath);
1951
+ return packageJSON.version;
1952
+ }
1953
+ }
1954
+ (0, $i45p4$parcelcore.registerSerializableClass)(`${(0, (/*@__PURE__*/$parcel$interopDefault($jeDhm))).version}:MockPackageInstaller`, $afea74298363e136$export$75a986c28df5fb9b);
1955
+
1956
+
1957
+
1958
+ var $jd2hZ = parcelRequire("jd2hZ");
1959
+
1960
+ var $b3vcY = parcelRequire("b3vcY");
1961
+ $parcel$exportWildcard(module.exports, $lLPK6);
1962
+ $parcel$exportWildcard(module.exports, $buj7e);
1963
+ $parcel$exportWildcard(module.exports, $eZHZZ);
1964
+ $parcel$exportWildcard(module.exports, $afea74298363e136$exports);
1965
+ $parcel$exportWildcard(module.exports, $jd2hZ);
1966
+
1967
+
1968
+ //# sourceMappingURL=index.js.map