@atlaspack/package-manager 2.14.20 → 2.14.21-typescript-80839fbd5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright (c) 2024 Atlassian US., Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -23,13 +23,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
23
23
  // Pair with split2 to parse stream of newline-delimited text.
24
24
  class JSONParseStream extends _stream().Transform {
25
25
  constructor(options) {
26
+ // @ts-expect-error TS2698
26
27
  super({
27
28
  ...options,
28
29
  objectMode: true
29
30
  });
30
31
  }
31
-
32
- // $FlowFixMe We are in object mode, so we emit objects, not strings
33
32
  _transform(chunk, encoding, callback) {
34
33
  try {
35
34
  let parsed;
@@ -123,14 +123,18 @@ const invalidationsCache = new Map();
123
123
  // See https://github.com/nodejs/node/blob/master/lib/internal/modules/cjs/loader.js
124
124
  // for reference to Node internals.
125
125
  class NodePackageManager {
126
+ // @ts-expect-error TS2749
127
+
126
128
  constructor(fs, projectRoot, installer) {
127
129
  this.fs = fs;
128
130
  this.projectRoot = projectRoot;
129
131
  this.installer = installer;
130
132
 
131
- // $FlowFixMe - no type for _extensions
133
+ // @ts-expect-error TS2339
132
134
  this.currentExtensions = Object.keys(_module().default._extensions).map(e => e.substring(1));
133
135
  }
136
+
137
+ // @ts-expect-error TS2749
134
138
  _createResolver() {
135
139
  return new (_nodeResolverCore().ResolverBase)(this.projectRoot, {
136
140
  fs: this.fs instanceof _fs().NodeFS && process.versions.pnp == null ? undefined : {
@@ -143,7 +147,7 @@ class NodePackageManager {
143
147
  entries: ENTRIES,
144
148
  packageExports: true,
145
149
  moduleDirResolver: process.versions.pnp != null ? (module, from) => {
146
- // $FlowFixMe[prop-missing]
150
+ // @ts-expect-error TS2339
147
151
  let pnp = _module().default.findPnpApi(_path().default.dirname(from));
148
152
  return pnp.resolveToUnqualified(
149
153
  // append slash to force loading builtins from npm
@@ -181,10 +185,9 @@ class NodePackageManager {
181
185
 
182
186
  // On Windows, Node requires absolute paths to be file URLs.
183
187
  if (process.platform === 'win32' && _path().default.isAbsolute(resolved)) {
188
+ // @ts-expect-error TS2322
184
189
  resolved = (0, _url().pathToFileURL)(resolved);
185
190
  }
186
-
187
- // $FlowFixMe
188
191
  return import(resolved);
189
192
  }
190
193
  return this.load(resolved, from);
@@ -198,20 +201,19 @@ class NodePackageManager {
198
201
  load(filePath, from) {
199
202
  if (!_path().default.isAbsolute(filePath)) {
200
203
  // Node builtin module
201
- // $FlowFixMe
202
204
  return require(filePath);
203
205
  }
204
206
 
205
- // $FlowFixMe[prop-missing]
207
+ // @ts-expect-error TS2339
206
208
  const cachedModule = _module().default._cache[filePath];
207
209
  if (cachedModule !== undefined) {
208
210
  return cachedModule.exports;
209
211
  }
210
212
 
211
- // $FlowFixMe
213
+ // @ts-expect-error TS2339
212
214
  let m = new (_module().default)(filePath, _module().default._cache[from] || module.parent);
213
215
 
214
- // $FlowFixMe _extensions not in type
216
+ // @ts-expect-error TS2339
215
217
  const extensions = Object.keys(_module().default._extensions);
216
218
  // This handles supported extensions changing due to, for example, esbuild/register being used
217
219
  // We assume that the extension list will change in size - as these tools usually add support for
@@ -221,7 +223,7 @@ class NodePackageManager {
221
223
  this.resolver = this._createResolver();
222
224
  }
223
225
 
224
- // $FlowFixMe[prop-missing]
226
+ // @ts-expect-error TS2339
225
227
  _module().default._cache[filePath] = m;
226
228
 
227
229
  // Patch require within this module so it goes through our require
@@ -234,21 +236,23 @@ class NodePackageManager {
234
236
  readFileSync,
235
237
  statSync
236
238
  } = _fs2().default;
237
- // $FlowFixMe
239
+ // @ts-expect-error TS2322
238
240
  _fs2().default.readFileSync = (filename, encoding) => {
239
241
  return this.fs.readFileSync(filename, encoding);
240
242
  };
241
243
 
242
- // $FlowFixMe
244
+ // @ts-expect-error TS2540
243
245
  _fs2().default.statSync = filename => {
244
246
  return this.fs.statSync(filename);
245
247
  };
246
248
  if (!filePath.includes(NODE_MODULES)) {
247
249
  let extname = _path().default.extname(filePath);
248
250
  if ((extname === '.ts' || extname === '.tsx' || extname === '.mts' || extname === '.cts') &&
249
- // $FlowFixMe
251
+ // @ts-expect-error TS2339
250
252
  !_module().default._extensions[extname]) {
253
+ // @ts-expect-error TS2339
251
254
  let compile = m._compile;
255
+ // @ts-expect-error TS2339
252
256
  m._compile = (code, filename) => {
253
257
  let out = (0, _core().transformSync)(code, {
254
258
  filename,
@@ -259,25 +263,25 @@ class NodePackageManager {
259
263
  compile.call(m, out.code, filename);
260
264
  };
261
265
 
262
- // $FlowFixMe
266
+ // @ts-expect-error TS2339
263
267
  _module().default._extensions[extname] = (m, filename) => {
264
- // $FlowFixMe
268
+ // @ts-expect-error TS2339
265
269
  delete _module().default._extensions[extname];
266
- // $FlowFixMe
270
+ // @ts-expect-error TS2339
267
271
  _module().default._extensions['.js'](m, filename);
268
272
  };
269
273
  }
270
274
  }
271
275
  try {
276
+ // @ts-expect-error TS2339
272
277
  m.load(filePath);
273
278
  } catch (err) {
274
- // $FlowFixMe[prop-missing]
279
+ // @ts-expect-error TS2339
275
280
  delete _module().default._cache[filePath];
276
281
  throw err;
277
282
  } finally {
278
- // $FlowFixMe
279
283
  _fs2().default.readFileSync = readFileSync;
280
- // $FlowFixMe
284
+ // @ts-expect-error TS2540
281
285
  _fs2().default.statSync = statSync;
282
286
  }
283
287
  return m.exports;
@@ -300,7 +304,7 @@ class NodePackageManager {
300
304
  hints: ['Autoinstall is disabled, please install this package manually and restart Parcel.']
301
305
  }
302
306
  });
303
- // $FlowFixMe - needed for loadParcelPlugin
307
+ // @ts-expect-error TS2339
304
308
  err.code = 'MODULE_NOT_FOUND';
305
309
  throw err;
306
310
  } else {
@@ -323,6 +327,7 @@ class NodePackageManager {
323
327
  }
324
328
  throw new (_diagnostic().default)({
325
329
  diagnostic: conflicts.fields.map(field => ({
330
+ // @ts-expect-error TS2345
326
331
  message: (0, _diagnostic().md)`Could not find module "${name}", but it was listed in package.json. Run your package manager first.`,
327
332
  origin: '@atlaspack/package-manager',
328
333
  codeFrames: [{
@@ -356,6 +361,7 @@ class NodePackageManager {
356
361
  } else if (conflicts != null) {
357
362
  throw new (_diagnostic().default)({
358
363
  diagnostic: {
364
+ // @ts-expect-error TS2345
359
365
  message: (0, _diagnostic().md)`Could not find module "${name}" satisfying ${range}.`,
360
366
  origin: '@atlaspack/package-manager',
361
367
  codeFrames: [{
@@ -372,8 +378,10 @@ class NodePackageManager {
372
378
  });
373
379
  }
374
380
  let version = pkg === null || pkg === void 0 ? void 0 : pkg.version;
381
+ // @ts-expect-error TS2345
375
382
  let message = (0, _diagnostic().md)`Could not resolve package "${name}" that satisfies ${range}.`;
376
383
  if (version != null) {
384
+ // @ts-expect-error TS2345
377
385
  message += (0, _diagnostic().md)` Found ${version}.`;
378
386
  }
379
387
  throw new (_diagnostic().default)({
@@ -452,6 +460,8 @@ class NodePackageManager {
452
460
  if (!resolved || !_path().default.isAbsolute(resolved.resolved)) {
453
461
  return;
454
462
  }
463
+
464
+ // @ts-expect-error TS2345
455
465
  res.invalidateOnFileCreate.push(...resolved.invalidateOnFileCreate);
456
466
  res.invalidateOnFileChange.add(resolved.resolved);
457
467
  for (let file of resolved.invalidateOnFileChange) {
@@ -470,17 +480,25 @@ class NodePackageManager {
470
480
  // cannot be intercepted. Instead, ask the resolver to parse the file and recursively analyze the deps.
471
481
  if (resolved.type === 2) {
472
482
  let invalidations = this.resolver.getInvalidations(resolved.resolved);
483
+ // @ts-expect-error TS7006
473
484
  invalidations.invalidateOnFileChange.forEach(i => res.invalidateOnFileChange.add(i));
474
- invalidations.invalidateOnFileCreate.forEach(i => res.invalidateOnFileCreate.push(i));
485
+ // @ts-expect-error TS7006
486
+ invalidations.invalidateOnFileCreate.forEach(i =>
487
+ // @ts-expect-error TS2345
488
+ res.invalidateOnFileCreate.push(i));
475
489
  res.invalidateOnStartup ||= invalidations.invalidateOnStartup;
476
490
  if (res.invalidateOnStartup) {
477
491
  _logger().default.warn({
492
+ // @ts-expect-error TS2345
478
493
  message: (0, _diagnostic().md)`${_path().default.relative(this.projectRoot, resolved.resolved)} contains non-statically analyzable dependencies in its module graph. This causes Parcel to invalidate the cache on startup.`,
479
494
  origin: '@atlaspack/package-manager'
480
495
  });
481
496
  }
482
497
  }
498
+
499
+ // @ts-expect-error TS2345
483
500
  invalidationsCache.set(resolved.resolved, res);
501
+ // @ts-expect-error TS2322
484
502
  return res;
485
503
  }
486
504
  return {
@@ -513,10 +531,10 @@ class NodePackageManager {
513
531
  }
514
532
  invalidationsCache.delete(resolved.resolved);
515
533
 
516
- // $FlowFixMe
534
+ // @ts-expect-error TS2339
517
535
  let module = _module().default._cache[resolved.resolved];
518
536
  if (module) {
519
- // $FlowFixMe
537
+ // @ts-expect-error TS2339
520
538
  delete _module().default._cache[resolved.resolved];
521
539
  }
522
540
  let moduleChildren = children.get(resolved.resolved);
@@ -545,16 +563,17 @@ class NodePackageManager {
545
563
  // Invalidate whenever the .pnp.js file changes.
546
564
  // TODO: only when we actually resolve a node_modules package?
547
565
  if (process.versions.pnp != null && res.invalidateOnFileChange) {
548
- // $FlowFixMe[prop-missing]
566
+ // @ts-expect-error TS2339
549
567
  let pnp = _module().default.findPnpApi(_path().default.dirname(from));
550
568
  res.invalidateOnFileChange.push(pnp.resolveToUnqualified('pnpapi', null));
551
569
  }
552
570
  if (res.error) {
553
571
  let e = new Error(`Could not resolve module "${name}" from "${from}"`);
554
- // $FlowFixMe
572
+ // @ts-expect-error TS2339
555
573
  e.code = 'MODULE_NOT_FOUND';
556
574
  throw e;
557
575
  }
576
+ // @ts-expect-error TS7034
558
577
  let getPkg;
559
578
  switch (res.resolution.type) {
560
579
  case 'Path':
@@ -570,6 +589,7 @@ class NodePackageManager {
570
589
  invalidateOnFileCreate: res.invalidateOnFileCreate,
571
590
  type: res.moduleType,
572
591
  get pkg() {
592
+ // @ts-expect-error TS7005
573
593
  return getPkg();
574
594
  }
575
595
  };
package/lib/Npm.js CHANGED
@@ -36,7 +36,8 @@ var _promiseFromProcess = _interopRequireDefault(require("./promiseFromProcess")
36
36
  var _utils = require("./utils");
37
37
  var _package = _interopRequireDefault(require("../package.json"));
38
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
- // $FlowFixMe
39
+ // @ts-expect-error TS7016
40
+
40
41
  const NPM_CMD = 'npm';
41
42
  class Npm {
42
43
  async install({
package/lib/Pnpm.js CHANGED
@@ -58,7 +58,12 @@ var _promiseFromProcess = _interopRequireDefault(require("./promiseFromProcess")
58
58
  var _utils = require("./utils");
59
59
  var _package = _interopRequireDefault(require("../package.json"));
60
60
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
61
- // $FlowFixMe
61
+ // @ts-expect-error TS7016
62
+
63
+ // @ts-expect-error TS7016
64
+
65
+ // @ts-expect-error TS7016
66
+
62
67
  const PNPM_CMD = 'pnpm';
63
68
  let hasPnpm;
64
69
  let pnpmVersion;
@@ -81,6 +86,7 @@ class Pnpm {
81
86
  }) {
82
87
  if (pnpmVersion == null) {
83
88
  let version = await (0, _utils.exec)('pnpm --version');
89
+ // @ts-expect-error TS2345
84
90
  pnpmVersion = parseInt(version.stdout, 10);
85
91
  }
86
92
  let args = ['add', '--reporter', 'ndjson'];
@@ -109,7 +115,11 @@ class Pnpm {
109
115
  cwd,
110
116
  env
111
117
  });
112
- installProcess.stdout.pipe((0, _split().default)()).pipe(new _JSONParseStream.default()).on('error', e => {
118
+ installProcess.stdout.pipe((0, _split().default)())
119
+ // @ts-expect-error TS2554
120
+ .pipe(new _JSONParseStream.default())
121
+ // @ts-expect-error TS7006
122
+ .on('error', e => {
113
123
  _logger().default.warn({
114
124
  origin: '@atlaspack/package-manager',
115
125
  message: e.chunk,
@@ -133,9 +143,13 @@ class Pnpm {
133
143
  }
134
144
  });
135
145
  let stderr = [];
136
- installProcess.stderr.on('data', str => {
146
+ installProcess.stderr
147
+ // @ts-expect-error TS7006
148
+ .on('data', str => {
137
149
  stderr.push(str.toString());
138
- }).on('error', e => {
150
+ })
151
+ // @ts-expect-error TS7006
152
+ .on('error', e => {
139
153
  _logger().default.warn({
140
154
  origin: '@atlaspack/package-manager',
141
155
  message: e.message
package/lib/Yarn.js CHANGED
@@ -44,7 +44,12 @@ var _promiseFromProcess = _interopRequireDefault(require("./promiseFromProcess")
44
44
  var _utils = require("./utils");
45
45
  var _package = _interopRequireDefault(require("../package.json"));
46
46
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
- // $FlowFixMe
47
+ // @ts-expect-error TS7016
48
+
49
+ // @ts-expect-error TS7016
50
+
51
+ // @ts-expect-error TS7016
52
+
48
53
  const YARN_CMD = 'yarn';
49
54
  let hasYarn;
50
55
  let yarnVersion;
@@ -67,6 +72,7 @@ class Yarn {
67
72
  }) {
68
73
  if (yarnVersion == null) {
69
74
  let version = await (0, _utils.exec)('yarn --version');
75
+ // @ts-expect-error TS2345
70
76
  yarnVersion = parseInt(version.stdout, 10);
71
77
  }
72
78
  let args = ['add', '--json'].concat(modules.map(_utils.npmSpecifierFromModuleRequest));
@@ -92,7 +98,11 @@ class Yarn {
92
98
  });
93
99
  installProcess.stdout
94
100
  // Invoking yarn with --json provides streaming, newline-delimited JSON output.
95
- .pipe((0, _split().default)()).pipe(new _JSONParseStream.default()).on('error', e => {
101
+ .pipe((0, _split().default)())
102
+ // @ts-expect-error TS2554
103
+ .pipe(new _JSONParseStream.default())
104
+ // @ts-expect-error TS7006
105
+ .on('error', e => {
96
106
  _logger().default.error(e, '@atlaspack/package-manager');
97
107
  }).on('data', message => {
98
108
  switch (message.type) {
@@ -111,7 +121,11 @@ class Yarn {
111
121
  }
112
122
  });
113
123
 
114
- installProcess.stderr.pipe((0, _split().default)()).pipe(new _JSONParseStream.default()).on('error', e => {
124
+ installProcess.stderr.pipe((0, _split().default)())
125
+ // @ts-expect-error TS2554
126
+ .pipe(new _JSONParseStream.default())
127
+ // @ts-expect-error TS7006
128
+ .on('error', e => {
115
129
  _logger().default.error(e, '@atlaspack/package-manager');
116
130
  }).on('data', message => {
117
131
  switch (message.type) {
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = getCurrentPackageManager;
7
- function getCurrentPackageManager(userAgent = process.env.npm_config_user_agent) {
7
+ function getCurrentPackageManager(
8
+ // @ts-expect-error TS2322
9
+ userAgent = process.env.npm_config_user_agent) {
8
10
  if (!userAgent) {
9
11
  return undefined;
10
12
  }
@@ -116,6 +116,7 @@ async function installPeerDependencies(fs, packageManager, module, from, project
116
116
  if (!_semver().default.satisfies(pkg.version, range)) {
117
117
  throw new (_diagnostic().default)({
118
118
  diagnostic: {
119
+ // @ts-expect-error TS2345
119
120
  message: (0, _diagnostic().md)`Could not install the peer dependency "${name}" for "${module.name}", installed version ${pkg.version} is incompatible with ${range}`,
120
121
  origin: '@atlaspack/package-manager',
121
122
  codeFrames: [{
@@ -15,6 +15,7 @@ function _process() {
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
  // https://nodejs.org/api/packages.html#conditional-exports
17
17
  // TODO We don't support { "type": "module" }
18
+ // @ts-expect-error TS4104
18
19
  const defaultNodejsConditions = exports.defaultNodejsConditions = Object.freeze(['node-addons', 'node',
19
20
  // 'import',
20
21
  'require', 'module-sync', 'default']);
@@ -26,10 +27,15 @@ function getConditionsFromEnv() {
26
27
  const conditions = [];
27
28
  for (const arg of [..._process().default.execArgv, ...(_process().default.env.NODE_OPTIONS || '').split(' ')]) {
28
29
  if (arg.startsWith('--conditions=')) {
30
+ // @ts-expect-error TS2345
29
31
  conditions.push(arg.substring(13));
30
32
  }
31
33
  }
34
+
35
+ // @ts-expect-error TS4104
32
36
  envConditions = Object.freeze([...conditions, ...defaultNodejsConditions]);
33
37
  }
38
+
39
+ // @ts-expect-error TS2322
34
40
  return envConditions;
35
41
  }
@@ -12,6 +12,8 @@ function promiseFromProcess(childProcess) {
12
12
  reject(new Error('Child process failed'));
13
13
  return;
14
14
  }
15
+
16
+ // @ts-expect-error TS2794
15
17
  resolve();
16
18
  });
17
19
  });