@atlaspack/package-manager 2.14.21-typescript-bc4459c37.0 → 2.14.21

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 (44) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/index.d.ts +40 -0
  3. package/lib/JSONParseStream.js +2 -1
  4. package/lib/NodePackageManager.js +24 -44
  5. package/lib/Npm.js +1 -2
  6. package/lib/Pnpm.js +4 -18
  7. package/lib/Yarn.js +3 -17
  8. package/lib/getCurrentPackageManager.js +1 -3
  9. package/lib/index.d.ts +8 -8
  10. package/lib/installPackage.js +0 -1
  11. package/lib/nodejsConditions.js +0 -6
  12. package/lib/promiseFromProcess.js +0 -2
  13. package/package.json +17 -17
  14. package/src/{JSONParseStream.ts → JSONParseStream.js} +7 -8
  15. package/src/{MockPackageInstaller.ts → MockPackageInstaller.js} +6 -4
  16. package/src/{NodePackageManager.ts → NodePackageManager.js} +51 -72
  17. package/src/{Npm.ts → Npm.js} +9 -9
  18. package/src/{Pnpm.ts → Pnpm.js} +50 -68
  19. package/src/{Yarn.ts → Yarn.js} +25 -38
  20. package/src/{getCurrentPackageManager.ts → getCurrentPackageManager.js} +4 -9
  21. package/src/{index.ts → index.js} +2 -0
  22. package/src/{installPackage.ts → installPackage.js} +6 -5
  23. package/src/{nodejsConditions.ts → nodejsConditions.js} +3 -6
  24. package/src/promiseFromProcess.js +19 -0
  25. package/src/{utils.ts → utils.js} +11 -21
  26. package/src/{validateModuleSpecifier.ts → validateModuleSpecifier.js} +2 -0
  27. package/test/{NodePackageManager.test.ts → NodePackageManager.test.js} +15 -13
  28. package/test/{getCurrentPackageManager.test.ts → getCurrentPackageManager.test.js} +1 -0
  29. package/test/{validateModuleSpecifiers.test.ts → validateModuleSpecifiers.test.js} +3 -2
  30. package/LICENSE +0 -201
  31. package/lib/JSONParseStream.d.ts +0 -6
  32. package/lib/MockPackageInstaller.d.ts +0 -14
  33. package/lib/NodePackageManager.d.ts +0 -36
  34. package/lib/Npm.d.ts +0 -4
  35. package/lib/Pnpm.d.ts +0 -5
  36. package/lib/Yarn.d.ts +0 -5
  37. package/lib/getCurrentPackageManager.d.ts +0 -4
  38. package/lib/installPackage.d.ts +0 -5
  39. package/lib/nodejsConditions.d.ts +0 -3
  40. package/lib/promiseFromProcess.d.ts +0 -2
  41. package/lib/utils.d.ts +0 -15
  42. package/lib/validateModuleSpecifier.d.ts +0 -1
  43. package/src/promiseFromProcess.ts +0 -23
  44. package/tsconfig.json +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaspack/package-manager
2
2
 
3
+ ## 2.14.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @atlaspack/fs@2.15.16
9
+ - @atlaspack/types@2.15.11
10
+ - @atlaspack/workers@2.14.21
11
+ - @atlaspack/utils@2.17.3
12
+ - @atlaspack/node-resolver-core@3.5.21
13
+
3
14
  ## 2.14.20
4
15
 
5
16
  ### Patch Changes
package/index.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ import type {
2
+ FilePath,
3
+ PackageInstaller,
4
+ PackageManager,
5
+ PackageManagerResolveResult,
6
+ } from '@atlaspack/types';
7
+ import type {FileSystem} from '@atlaspack/fs';
8
+
9
+ export type {PackageManagerResolveResult};
10
+ export type {PackageManagerResolveResult as ResolveResult};
11
+
12
+ export type {
13
+ PackageManager,
14
+ InstallOptions,
15
+ InstallerOptions,
16
+ PackageInstaller,
17
+ Invalidations,
18
+ ModuleRequest,
19
+ } from '@atlaspack/types';
20
+
21
+ export const Npm: {
22
+ new (): PackageInstaller;
23
+ };
24
+ export const Pnpm: {
25
+ new (): PackageInstaller;
26
+ };
27
+ export const Yarn: {
28
+ new (): PackageInstaller;
29
+ };
30
+
31
+ export const MockPackageInstaller: {
32
+ new (): PackageInstaller;
33
+ };
34
+ export const NodePackageManager: {
35
+ new (
36
+ fs: FileSystem,
37
+ projectRoot: FilePath,
38
+ installer?: PackageInstaller,
39
+ ): PackageManager;
40
+ };
@@ -23,12 +23,13 @@ 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
27
26
  super({
28
27
  ...options,
29
28
  objectMode: true
30
29
  });
31
30
  }
31
+
32
+ // $FlowFixMe We are in object mode, so we emit objects, not strings
32
33
  _transform(chunk, encoding, callback) {
33
34
  try {
34
35
  let parsed;
@@ -123,18 +123,14 @@ 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
-
128
126
  constructor(fs, projectRoot, installer) {
129
127
  this.fs = fs;
130
128
  this.projectRoot = projectRoot;
131
129
  this.installer = installer;
132
130
 
133
- // @ts-expect-error TS2339
131
+ // $FlowFixMe - no type for _extensions
134
132
  this.currentExtensions = Object.keys(_module().default._extensions).map(e => e.substring(1));
135
133
  }
136
-
137
- // @ts-expect-error TS2749
138
134
  _createResolver() {
139
135
  return new (_nodeResolverCore().ResolverBase)(this.projectRoot, {
140
136
  fs: this.fs instanceof _fs().NodeFS && process.versions.pnp == null ? undefined : {
@@ -147,7 +143,7 @@ class NodePackageManager {
147
143
  entries: ENTRIES,
148
144
  packageExports: true,
149
145
  moduleDirResolver: process.versions.pnp != null ? (module, from) => {
150
- // @ts-expect-error TS2339
146
+ // $FlowFixMe[prop-missing]
151
147
  let pnp = _module().default.findPnpApi(_path().default.dirname(from));
152
148
  return pnp.resolveToUnqualified(
153
149
  // append slash to force loading builtins from npm
@@ -185,9 +181,10 @@ class NodePackageManager {
185
181
 
186
182
  // On Windows, Node requires absolute paths to be file URLs.
187
183
  if (process.platform === 'win32' && _path().default.isAbsolute(resolved)) {
188
- // @ts-expect-error TS2322
189
184
  resolved = (0, _url().pathToFileURL)(resolved);
190
185
  }
186
+
187
+ // $FlowFixMe
191
188
  return import(resolved);
192
189
  }
193
190
  return this.load(resolved, from);
@@ -201,19 +198,20 @@ class NodePackageManager {
201
198
  load(filePath, from) {
202
199
  if (!_path().default.isAbsolute(filePath)) {
203
200
  // Node builtin module
201
+ // $FlowFixMe
204
202
  return require(filePath);
205
203
  }
206
204
 
207
- // @ts-expect-error TS2339
205
+ // $FlowFixMe[prop-missing]
208
206
  const cachedModule = _module().default._cache[filePath];
209
207
  if (cachedModule !== undefined) {
210
208
  return cachedModule.exports;
211
209
  }
212
210
 
213
- // @ts-expect-error TS2339
211
+ // $FlowFixMe
214
212
  let m = new (_module().default)(filePath, _module().default._cache[from] || module.parent);
215
213
 
216
- // @ts-expect-error TS2339
214
+ // $FlowFixMe _extensions not in type
217
215
  const extensions = Object.keys(_module().default._extensions);
218
216
  // This handles supported extensions changing due to, for example, esbuild/register being used
219
217
  // We assume that the extension list will change in size - as these tools usually add support for
@@ -223,7 +221,7 @@ class NodePackageManager {
223
221
  this.resolver = this._createResolver();
224
222
  }
225
223
 
226
- // @ts-expect-error TS2339
224
+ // $FlowFixMe[prop-missing]
227
225
  _module().default._cache[filePath] = m;
228
226
 
229
227
  // Patch require within this module so it goes through our require
@@ -236,23 +234,21 @@ class NodePackageManager {
236
234
  readFileSync,
237
235
  statSync
238
236
  } = _fs2().default;
239
- // @ts-expect-error TS2322
237
+ // $FlowFixMe
240
238
  _fs2().default.readFileSync = (filename, encoding) => {
241
239
  return this.fs.readFileSync(filename, encoding);
242
240
  };
243
241
 
244
- // @ts-expect-error TS2540
242
+ // $FlowFixMe
245
243
  _fs2().default.statSync = filename => {
246
244
  return this.fs.statSync(filename);
247
245
  };
248
246
  if (!filePath.includes(NODE_MODULES)) {
249
247
  let extname = _path().default.extname(filePath);
250
248
  if ((extname === '.ts' || extname === '.tsx' || extname === '.mts' || extname === '.cts') &&
251
- // @ts-expect-error TS2339
249
+ // $FlowFixMe
252
250
  !_module().default._extensions[extname]) {
253
- // @ts-expect-error TS2339
254
251
  let compile = m._compile;
255
- // @ts-expect-error TS2339
256
252
  m._compile = (code, filename) => {
257
253
  let out = (0, _core().transformSync)(code, {
258
254
  filename,
@@ -263,25 +259,25 @@ class NodePackageManager {
263
259
  compile.call(m, out.code, filename);
264
260
  };
265
261
 
266
- // @ts-expect-error TS2339
262
+ // $FlowFixMe
267
263
  _module().default._extensions[extname] = (m, filename) => {
268
- // @ts-expect-error TS2339
264
+ // $FlowFixMe
269
265
  delete _module().default._extensions[extname];
270
- // @ts-expect-error TS2339
266
+ // $FlowFixMe
271
267
  _module().default._extensions['.js'](m, filename);
272
268
  };
273
269
  }
274
270
  }
275
271
  try {
276
- // @ts-expect-error TS2339
277
272
  m.load(filePath);
278
273
  } catch (err) {
279
- // @ts-expect-error TS2339
274
+ // $FlowFixMe[prop-missing]
280
275
  delete _module().default._cache[filePath];
281
276
  throw err;
282
277
  } finally {
278
+ // $FlowFixMe
283
279
  _fs2().default.readFileSync = readFileSync;
284
- // @ts-expect-error TS2540
280
+ // $FlowFixMe
285
281
  _fs2().default.statSync = statSync;
286
282
  }
287
283
  return m.exports;
@@ -304,7 +300,7 @@ class NodePackageManager {
304
300
  hints: ['Autoinstall is disabled, please install this package manually and restart Parcel.']
305
301
  }
306
302
  });
307
- // @ts-expect-error TS2339
303
+ // $FlowFixMe - needed for loadParcelPlugin
308
304
  err.code = 'MODULE_NOT_FOUND';
309
305
  throw err;
310
306
  } else {
@@ -327,7 +323,6 @@ class NodePackageManager {
327
323
  }
328
324
  throw new (_diagnostic().default)({
329
325
  diagnostic: conflicts.fields.map(field => ({
330
- // @ts-expect-error TS2345
331
326
  message: (0, _diagnostic().md)`Could not find module "${name}", but it was listed in package.json. Run your package manager first.`,
332
327
  origin: '@atlaspack/package-manager',
333
328
  codeFrames: [{
@@ -361,7 +356,6 @@ class NodePackageManager {
361
356
  } else if (conflicts != null) {
362
357
  throw new (_diagnostic().default)({
363
358
  diagnostic: {
364
- // @ts-expect-error TS2345
365
359
  message: (0, _diagnostic().md)`Could not find module "${name}" satisfying ${range}.`,
366
360
  origin: '@atlaspack/package-manager',
367
361
  codeFrames: [{
@@ -378,10 +372,8 @@ class NodePackageManager {
378
372
  });
379
373
  }
380
374
  let version = pkg === null || pkg === void 0 ? void 0 : pkg.version;
381
- // @ts-expect-error TS2345
382
375
  let message = (0, _diagnostic().md)`Could not resolve package "${name}" that satisfies ${range}.`;
383
376
  if (version != null) {
384
- // @ts-expect-error TS2345
385
377
  message += (0, _diagnostic().md)` Found ${version}.`;
386
378
  }
387
379
  throw new (_diagnostic().default)({
@@ -460,8 +452,6 @@ class NodePackageManager {
460
452
  if (!resolved || !_path().default.isAbsolute(resolved.resolved)) {
461
453
  return;
462
454
  }
463
-
464
- // @ts-expect-error TS2345
465
455
  res.invalidateOnFileCreate.push(...resolved.invalidateOnFileCreate);
466
456
  res.invalidateOnFileChange.add(resolved.resolved);
467
457
  for (let file of resolved.invalidateOnFileChange) {
@@ -480,25 +470,17 @@ class NodePackageManager {
480
470
  // cannot be intercepted. Instead, ask the resolver to parse the file and recursively analyze the deps.
481
471
  if (resolved.type === 2) {
482
472
  let invalidations = this.resolver.getInvalidations(resolved.resolved);
483
- // @ts-expect-error TS7006
484
473
  invalidations.invalidateOnFileChange.forEach(i => res.invalidateOnFileChange.add(i));
485
- // @ts-expect-error TS7006
486
- invalidations.invalidateOnFileCreate.forEach(i =>
487
- // @ts-expect-error TS2345
488
- res.invalidateOnFileCreate.push(i));
474
+ invalidations.invalidateOnFileCreate.forEach(i => res.invalidateOnFileCreate.push(i));
489
475
  res.invalidateOnStartup ||= invalidations.invalidateOnStartup;
490
476
  if (res.invalidateOnStartup) {
491
477
  _logger().default.warn({
492
- // @ts-expect-error TS2345
493
478
  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.`,
494
479
  origin: '@atlaspack/package-manager'
495
480
  });
496
481
  }
497
482
  }
498
-
499
- // @ts-expect-error TS2345
500
483
  invalidationsCache.set(resolved.resolved, res);
501
- // @ts-expect-error TS2322
502
484
  return res;
503
485
  }
504
486
  return {
@@ -531,10 +513,10 @@ class NodePackageManager {
531
513
  }
532
514
  invalidationsCache.delete(resolved.resolved);
533
515
 
534
- // @ts-expect-error TS2339
516
+ // $FlowFixMe
535
517
  let module = _module().default._cache[resolved.resolved];
536
518
  if (module) {
537
- // @ts-expect-error TS2339
519
+ // $FlowFixMe
538
520
  delete _module().default._cache[resolved.resolved];
539
521
  }
540
522
  let moduleChildren = children.get(resolved.resolved);
@@ -563,17 +545,16 @@ class NodePackageManager {
563
545
  // Invalidate whenever the .pnp.js file changes.
564
546
  // TODO: only when we actually resolve a node_modules package?
565
547
  if (process.versions.pnp != null && res.invalidateOnFileChange) {
566
- // @ts-expect-error TS2339
548
+ // $FlowFixMe[prop-missing]
567
549
  let pnp = _module().default.findPnpApi(_path().default.dirname(from));
568
550
  res.invalidateOnFileChange.push(pnp.resolveToUnqualified('pnpapi', null));
569
551
  }
570
552
  if (res.error) {
571
553
  let e = new Error(`Could not resolve module "${name}" from "${from}"`);
572
- // @ts-expect-error TS2339
554
+ // $FlowFixMe
573
555
  e.code = 'MODULE_NOT_FOUND';
574
556
  throw e;
575
557
  }
576
- // @ts-expect-error TS7034
577
558
  let getPkg;
578
559
  switch (res.resolution.type) {
579
560
  case 'Path':
@@ -589,7 +570,6 @@ class NodePackageManager {
589
570
  invalidateOnFileCreate: res.invalidateOnFileCreate,
590
571
  type: res.moduleType,
591
572
  get pkg() {
592
- // @ts-expect-error TS7005
593
573
  return getPkg();
594
574
  }
595
575
  };
package/lib/Npm.js CHANGED
@@ -36,8 +36,7 @@ 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
- // @ts-expect-error TS7016
40
-
39
+ // $FlowFixMe
41
40
  const NPM_CMD = 'npm';
42
41
  class Npm {
43
42
  async install({
package/lib/Pnpm.js CHANGED
@@ -58,12 +58,7 @@ 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
- // @ts-expect-error TS7016
62
-
63
- // @ts-expect-error TS7016
64
-
65
- // @ts-expect-error TS7016
66
-
61
+ // $FlowFixMe
67
62
  const PNPM_CMD = 'pnpm';
68
63
  let hasPnpm;
69
64
  let pnpmVersion;
@@ -86,7 +81,6 @@ class Pnpm {
86
81
  }) {
87
82
  if (pnpmVersion == null) {
88
83
  let version = await (0, _utils.exec)('pnpm --version');
89
- // @ts-expect-error TS2345
90
84
  pnpmVersion = parseInt(version.stdout, 10);
91
85
  }
92
86
  let args = ['add', '--reporter', 'ndjson'];
@@ -115,11 +109,7 @@ class Pnpm {
115
109
  cwd,
116
110
  env
117
111
  });
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 => {
112
+ installProcess.stdout.pipe((0, _split().default)()).pipe(new _JSONParseStream.default()).on('error', e => {
123
113
  _logger().default.warn({
124
114
  origin: '@atlaspack/package-manager',
125
115
  message: e.chunk,
@@ -143,13 +133,9 @@ class Pnpm {
143
133
  }
144
134
  });
145
135
  let stderr = [];
146
- installProcess.stderr
147
- // @ts-expect-error TS7006
148
- .on('data', str => {
136
+ installProcess.stderr.on('data', str => {
149
137
  stderr.push(str.toString());
150
- })
151
- // @ts-expect-error TS7006
152
- .on('error', e => {
138
+ }).on('error', e => {
153
139
  _logger().default.warn({
154
140
  origin: '@atlaspack/package-manager',
155
141
  message: e.message
package/lib/Yarn.js CHANGED
@@ -44,12 +44,7 @@ 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
- // @ts-expect-error TS7016
48
-
49
- // @ts-expect-error TS7016
50
-
51
- // @ts-expect-error TS7016
52
-
47
+ // $FlowFixMe
53
48
  const YARN_CMD = 'yarn';
54
49
  let hasYarn;
55
50
  let yarnVersion;
@@ -72,7 +67,6 @@ class Yarn {
72
67
  }) {
73
68
  if (yarnVersion == null) {
74
69
  let version = await (0, _utils.exec)('yarn --version');
75
- // @ts-expect-error TS2345
76
70
  yarnVersion = parseInt(version.stdout, 10);
77
71
  }
78
72
  let args = ['add', '--json'].concat(modules.map(_utils.npmSpecifierFromModuleRequest));
@@ -98,11 +92,7 @@ class Yarn {
98
92
  });
99
93
  installProcess.stdout
100
94
  // Invoking yarn with --json provides streaming, newline-delimited JSON output.
101
- .pipe((0, _split().default)())
102
- // @ts-expect-error TS2554
103
- .pipe(new _JSONParseStream.default())
104
- // @ts-expect-error TS7006
105
- .on('error', e => {
95
+ .pipe((0, _split().default)()).pipe(new _JSONParseStream.default()).on('error', e => {
106
96
  _logger().default.error(e, '@atlaspack/package-manager');
107
97
  }).on('data', message => {
108
98
  switch (message.type) {
@@ -121,11 +111,7 @@ class Yarn {
121
111
  }
122
112
  });
123
113
 
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 => {
114
+ installProcess.stderr.pipe((0, _split().default)()).pipe(new _JSONParseStream.default()).on('error', e => {
129
115
  _logger().default.error(e, '@atlaspack/package-manager');
130
116
  }).on('data', message => {
131
117
  switch (message.type) {
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = getCurrentPackageManager;
7
- function getCurrentPackageManager(
8
- // @ts-expect-error TS2322
9
- userAgent = process.env.npm_config_user_agent) {
7
+ function getCurrentPackageManager(userAgent = process.env.npm_config_user_agent) {
10
8
  if (!userAgent) {
11
9
  return undefined;
12
10
  }
package/lib/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import type { PackageManagerResolveResult } from '@atlaspack/types';
2
- export type { PackageManager, Invalidations, PackageInstaller, ModuleRequest, } from '@atlaspack/types';
3
- export * from './Npm';
4
- export * from './Pnpm';
5
- export * from './Yarn';
6
- export * from './MockPackageInstaller';
7
- export * from './NodePackageManager';
8
- export { _addToInstallQueue } from './installPackage';
1
+ import type { PackageManagerResolveResult } from "@atlaspack/types";
2
+ export type { PackageManager, Invalidations, PackageInstaller, ModuleRequest } from "@atlaspack/types";
3
+ export * from "./Npm";
4
+ export * from "./Pnpm";
5
+ export * from "./Yarn";
6
+ export * from "./MockPackageInstaller";
7
+ export * from "./NodePackageManager";
8
+ export { _addToInstallQueue } from "./installPackage";
9
9
  export type { PackageManagerResolveResult };
10
10
  export type { PackageManagerResolveResult as ResolveResult };
@@ -116,7 +116,6 @@ 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
120
119
  message: (0, _diagnostic().md)`Could not install the peer dependency "${name}" for "${module.name}", installed version ${pkg.version} is incompatible with ${range}`,
121
120
  origin: '@atlaspack/package-manager',
122
121
  codeFrames: [{
@@ -15,7 +15,6 @@ 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
19
18
  const defaultNodejsConditions = exports.defaultNodejsConditions = Object.freeze(['node-addons', 'node',
20
19
  // 'import',
21
20
  'require', 'module-sync', 'default']);
@@ -27,15 +26,10 @@ function getConditionsFromEnv() {
27
26
  const conditions = [];
28
27
  for (const arg of [..._process().default.execArgv, ...(_process().default.env.NODE_OPTIONS || '').split(' ')]) {
29
28
  if (arg.startsWith('--conditions=')) {
30
- // @ts-expect-error TS2345
31
29
  conditions.push(arg.substring(13));
32
30
  }
33
31
  }
34
-
35
- // @ts-expect-error TS4104
36
32
  envConditions = Object.freeze([...conditions, ...defaultNodejsConditions]);
37
33
  }
38
-
39
- // @ts-expect-error TS2322
40
34
  return envConditions;
41
35
  }
@@ -12,8 +12,6 @@ function promiseFromProcess(childProcess) {
12
12
  reject(new Error('Child process failed'));
13
13
  return;
14
14
  }
15
-
16
- // @ts-expect-error TS2794
17
15
  resolve();
18
16
  });
19
17
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/package-manager",
3
- "version": "2.14.21-typescript-bc4459c37.0",
3
+ "version": "2.14.21",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "publishConfig": {
@@ -10,14 +10,15 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/atlassian-labs/atlaspack.git"
12
12
  },
13
- "main": "./lib/index.js",
14
- "source": "./src/index.ts",
15
- "types": "./lib/index.d.ts",
13
+ "main": "lib/index.js",
14
+ "source": "src/index.js",
15
+ "types": "index.d.ts",
16
16
  "engines": {
17
17
  "node": ">= 16.0.0"
18
18
  },
19
19
  "scripts": {
20
- "check-ts": "tsc --emitDeclarationOnly --rootDir src",
20
+ "build-ts": "mkdir -p lib && flow-to-ts src/index.js > lib/index.d.ts",
21
+ "check-ts": "tsc --noEmit index.d.ts",
21
22
  "test": "mocha test"
22
23
  },
23
24
  "targets": {
@@ -38,19 +39,19 @@
38
39
  }
39
40
  },
40
41
  "dependencies": {
41
- "@atlaspack/build-cache": "2.13.4-typescript-bc4459c37.0",
42
- "@atlaspack/diagnostic": "2.14.2-typescript-bc4459c37.0",
43
- "@atlaspack/fs": "2.15.16-typescript-bc4459c37.0",
44
- "@atlaspack/logger": "2.14.14-typescript-bc4459c37.0",
45
- "@atlaspack/node-resolver-core": "3.5.21-typescript-bc4459c37.0",
46
- "@atlaspack/types": "2.15.11-typescript-bc4459c37.0",
47
- "@atlaspack/utils": "2.17.3-typescript-bc4459c37.0",
48
- "@atlaspack/workers": "2.14.21-typescript-bc4459c37.0",
42
+ "@atlaspack/build-cache": "2.13.3",
43
+ "@atlaspack/diagnostic": "2.14.1",
44
+ "@atlaspack/fs": "2.15.16",
45
+ "@atlaspack/logger": "2.14.13",
46
+ "@atlaspack/node-resolver-core": "3.5.21",
47
+ "@atlaspack/types": "2.15.11",
48
+ "@atlaspack/utils": "2.17.3",
49
+ "@atlaspack/workers": "2.14.21",
49
50
  "@swc/core": "^1.10.0",
51
+ "semver": "^7.5.2",
50
52
  "command-exists": "^1.2.6",
51
53
  "cross-spawn": "^6.0.4",
52
54
  "nullthrows": "^1.1.1",
53
- "semver": "^7.5.2",
54
55
  "split2": "^3.1.1"
55
56
  },
56
57
  "browser": {
@@ -59,6 +60,5 @@
59
60
  "./src/Pnpm.js": false,
60
61
  "./src/Yarn.js": false
61
62
  },
62
- "type": "commonjs",
63
- "gitHead": "bc4459c37a38ef1f74772126637e1d8841d1fcb0"
64
- }
63
+ "type": "commonjs"
64
+ }
@@ -1,3 +1,5 @@
1
+ // @flow strict-local
2
+
1
3
  import type {JSONObject} from '@atlaspack/types';
2
4
 
3
5
  import logger from '@atlaspack/logger';
@@ -6,24 +8,21 @@ import {Transform} from 'stream';
6
8
  // Transforms chunks of json strings to parsed objects.
7
9
  // Pair with split2 to parse stream of newline-delimited text.
8
10
  export default class JSONParseStream extends Transform {
9
- constructor(options: unknown) {
10
- // @ts-expect-error TS2698
11
+ constructor(options: mixed) {
11
12
  super({...options, objectMode: true});
12
13
  }
13
14
 
15
+ // $FlowFixMe We are in object mode, so we emit objects, not strings
14
16
  _transform(
15
17
  chunk: Buffer | string,
16
18
  encoding: string,
17
- callback: (
18
- err?: Error | null | undefined,
19
- parsed?: JSONObject | null | undefined,
20
- ) => unknown,
19
+ callback: (err: ?Error, parsed: ?JSONObject) => mixed,
21
20
  ) {
22
21
  try {
23
22
  let parsed;
24
23
  try {
25
24
  parsed = JSON.parse(chunk.toString());
26
- } catch (e: any) {
25
+ } catch (e) {
27
26
  // Be permissive and ignoreJSON parse errors in case there was
28
27
  // a non-JSON line in the package manager's stdout.
29
28
  logger.verbose({
@@ -33,7 +32,7 @@ export default class JSONParseStream extends Transform {
33
32
  return;
34
33
  }
35
34
  callback(null, parsed);
36
- } catch (err: any) {
35
+ } catch (err) {
37
36
  callback(err);
38
37
  }
39
38
  }
@@ -1,3 +1,5 @@
1
+ // @flow
2
+
1
3
  import type {
2
4
  ModuleRequest,
3
5
  PackageInstaller,
@@ -12,10 +14,10 @@ import {ncp} from '@atlaspack/fs';
12
14
  import pkg from '../package.json';
13
15
  import {moduleRequestsFromDependencyMap} from './utils';
14
16
 
15
- type Package = {
16
- fs: FileSystem;
17
- packagePath: FilePath;
18
- };
17
+ type Package = {|
18
+ fs: FileSystem,
19
+ packagePath: FilePath,
20
+ |};
19
21
 
20
22
  // This PackageInstaller implementation simply copies files from one filesystem to another.
21
23
  // Mostly useful for testing purposes.