@atlaspack/package-manager 2.12.1-dev.3450 → 2.12.1-dev.3466
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/lib/index.js +1169 -1169
- package/lib/index.js.map +1 -1
- package/package.json +12 -12
- package/src/MockPackageInstaller.js +1 -1
- package/src/NodePackageManager.js +13 -13
- package/src/Npm.js +1 -1
- package/src/Pnpm.js +4 -4
- package/src/Yarn.js +3 -3
- package/src/installPackage.js +6 -6
- package/src/promiseFromProcess.js +1 -1
- package/test/NodePackageManager.test.js +4 -4
- package/test/validateModuleSpecifiers.test.js +2 -2
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaspack/package-manager",
|
3
|
-
"version": "2.12.1-dev.
|
3
|
+
"version": "2.12.1-dev.3466+9a12fb8bd",
|
4
4
|
"description": "Blazing fast, zero configuration web application bundler",
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
6
6
|
"publishConfig": {
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"types": false,
|
26
26
|
"main": {
|
27
27
|
"includeNodeModules": {
|
28
|
-
"@atlaspack/
|
28
|
+
"@atlaspack/build-cache": false,
|
29
29
|
"@atlaspack/diagnostic": false,
|
30
30
|
"@atlaspack/fs": false,
|
31
31
|
"@atlaspack/logger": false,
|
@@ -39,14 +39,14 @@
|
|
39
39
|
}
|
40
40
|
},
|
41
41
|
"dependencies": {
|
42
|
-
"@atlaspack/diagnostic": "2.12.1-dev.
|
43
|
-
"@atlaspack/fs": "2.12.1-dev.
|
44
|
-
"@atlaspack/logger": "2.12.1-dev.
|
45
|
-
"@atlaspack/node-resolver-core": "3.3.1-dev.
|
46
|
-
"@atlaspack/types": "2.12.1-dev.
|
47
|
-
"@atlaspack/utils": "2.12.1-dev.
|
48
|
-
"@atlaspack/workers": "2.12.1-dev.
|
49
|
-
"@swc/core": "^1.
|
42
|
+
"@atlaspack/diagnostic": "2.12.1-dev.3466+9a12fb8bd",
|
43
|
+
"@atlaspack/fs": "2.12.1-dev.3466+9a12fb8bd",
|
44
|
+
"@atlaspack/logger": "2.12.1-dev.3466+9a12fb8bd",
|
45
|
+
"@atlaspack/node-resolver-core": "3.3.1-dev.3466+9a12fb8bd",
|
46
|
+
"@atlaspack/types": "2.12.1-dev.3466+9a12fb8bd",
|
47
|
+
"@atlaspack/utils": "2.12.1-dev.3466+9a12fb8bd",
|
48
|
+
"@atlaspack/workers": "2.12.1-dev.3466+9a12fb8bd",
|
49
|
+
"@swc/core": "^1.7.26",
|
50
50
|
"semver": "^7.5.2"
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
@@ -56,7 +56,7 @@
|
|
56
56
|
"split2": "^3.1.1"
|
57
57
|
},
|
58
58
|
"peerDependencies": {
|
59
|
-
"@atlaspack/
|
59
|
+
"@atlaspack/build-cache": "^2.12.0"
|
60
60
|
},
|
61
61
|
"browser": {
|
62
62
|
"./src/NodePackageManager.js": false,
|
@@ -64,5 +64,5 @@
|
|
64
64
|
"./src/Pnpm.js": false,
|
65
65
|
"./src/Yarn.js": false
|
66
66
|
},
|
67
|
-
"gitHead": "
|
67
|
+
"gitHead": "9a12fb8bd1b72e407ed043e20337dc60fbec9cbe"
|
68
68
|
}
|
@@ -10,7 +10,7 @@ import type {FilePath} from '@atlaspack/types';
|
|
10
10
|
|
11
11
|
import path from 'path';
|
12
12
|
import {ncp} from '@atlaspack/fs';
|
13
|
-
import {registerSerializableClass} from '@atlaspack/
|
13
|
+
import {registerSerializableClass} from '@atlaspack/build-cache';
|
14
14
|
import pkg from '../package.json';
|
15
15
|
import {moduleRequestsFromDependencyMap} from './utils';
|
16
16
|
|
@@ -14,7 +14,7 @@ import type {
|
|
14
14
|
PackageManagerResolveResult,
|
15
15
|
} from '@atlaspack/types';
|
16
16
|
|
17
|
-
import {registerSerializableClass} from '@atlaspack/
|
17
|
+
import {registerSerializableClass} from '@atlaspack/build-cache';
|
18
18
|
import ThrowableDiagnostic, {
|
19
19
|
encodeJSONKeyComponent,
|
20
20
|
escapeMarkdown,
|
@@ -77,7 +77,7 @@ export class NodePackageManager implements PackageManager {
|
|
77
77
|
this.installer = installer;
|
78
78
|
|
79
79
|
// $FlowFixMe - no type for _extensions
|
80
|
-
this.currentExtensions = Object.keys(Module._extensions).map(e =>
|
80
|
+
this.currentExtensions = Object.keys(Module._extensions).map((e) =>
|
81
81
|
e.substring(1),
|
82
82
|
);
|
83
83
|
}
|
@@ -88,10 +88,10 @@ export class NodePackageManager implements PackageManager {
|
|
88
88
|
this.fs instanceof NodeFS && process.versions.pnp == null
|
89
89
|
? undefined
|
90
90
|
: {
|
91
|
-
canonicalize: path => this.fs.realpathSync(path),
|
92
|
-
read: path => this.fs.readFileSync(path),
|
93
|
-
isFile: path => this.fs.statSync(path).isFile(),
|
94
|
-
isDir: path => this.fs.statSync(path).isDirectory(),
|
91
|
+
canonicalize: (path) => this.fs.realpathSync(path),
|
92
|
+
read: (path) => this.fs.readFileSync(path),
|
93
|
+
isFile: (path) => this.fs.statSync(path).isFile(),
|
94
|
+
isDir: (path) => this.fs.statSync(path).isDirectory(),
|
95
95
|
},
|
96
96
|
mode: 2,
|
97
97
|
entries: ENTRIES,
|
@@ -192,7 +192,7 @@ export class NodePackageManager implements PackageManager {
|
|
192
192
|
// We assume that the extension list will change in size - as these tools usually add support for
|
193
193
|
// additional extensions.
|
194
194
|
if (extensions.length !== this.currentExtensions.length) {
|
195
|
-
this.currentExtensions = extensions.map(e => e.substring(1));
|
195
|
+
this.currentExtensions = extensions.map((e) => e.substring(1));
|
196
196
|
this.resolver = this._createResolver();
|
197
197
|
}
|
198
198
|
|
@@ -200,7 +200,7 @@ export class NodePackageManager implements PackageManager {
|
|
200
200
|
Module._cache[filePath] = m;
|
201
201
|
|
202
202
|
// Patch require within this module so it goes through our require
|
203
|
-
m.require = id => {
|
203
|
+
m.require = (id) => {
|
204
204
|
return this.requireSync(id, filePath);
|
205
205
|
};
|
206
206
|
|
@@ -212,7 +212,7 @@ export class NodePackageManager implements PackageManager {
|
|
212
212
|
};
|
213
213
|
|
214
214
|
// $FlowFixMe
|
215
|
-
nativeFS.statSync = filename => {
|
215
|
+
nativeFS.statSync = (filename) => {
|
216
216
|
return this.fs.statSync(filename);
|
217
217
|
};
|
218
218
|
|
@@ -320,7 +320,7 @@ export class NodePackageManager implements PackageManager {
|
|
320
320
|
}
|
321
321
|
|
322
322
|
throw new ThrowableDiagnostic({
|
323
|
-
diagnostic: conflicts.fields.map(field => ({
|
323
|
+
diagnostic: conflicts.fields.map((field) => ({
|
324
324
|
message: md`Could not find module "${name}", but it was listed in package.json. Run your package manager first.`,
|
325
325
|
origin: '@atlaspack/package-manager',
|
326
326
|
codeFrames: [
|
@@ -371,7 +371,7 @@ export class NodePackageManager implements PackageManager {
|
|
371
371
|
code: conflicts.json,
|
372
372
|
codeHighlights: generateJSONCodeHighlights(
|
373
373
|
conflicts.json,
|
374
|
-
conflicts.fields.map(field => ({
|
374
|
+
conflicts.fields.map((field) => ({
|
375
375
|
key: `/${field}/${encodeJSONKeyComponent(name)}`,
|
376
376
|
type: 'key',
|
377
377
|
message: 'Found this conflicting local requirement.',
|
@@ -509,10 +509,10 @@ export class NodePackageManager implements PackageManager {
|
|
509
509
|
// cannot be intercepted. Instead, ask the resolver to parse the file and recursively analyze the deps.
|
510
510
|
if (resolved.type === 2) {
|
511
511
|
let invalidations = this.resolver.getInvalidations(resolved.resolved);
|
512
|
-
invalidations.invalidateOnFileChange.forEach(i =>
|
512
|
+
invalidations.invalidateOnFileChange.forEach((i) =>
|
513
513
|
res.invalidateOnFileChange.add(i),
|
514
514
|
);
|
515
|
-
invalidations.invalidateOnFileCreate.forEach(i =>
|
515
|
+
invalidations.invalidateOnFileCreate.forEach((i) =>
|
516
516
|
res.invalidateOnFileCreate.push(i),
|
517
517
|
);
|
518
518
|
res.invalidateOnStartup ||= invalidations.invalidateOnStartup;
|
package/src/Npm.js
CHANGED
@@ -6,7 +6,7 @@ import path from 'path';
|
|
6
6
|
import spawn from 'cross-spawn';
|
7
7
|
import logger from '@atlaspack/logger';
|
8
8
|
import promiseFromProcess from './promiseFromProcess';
|
9
|
-
import {registerSerializableClass} from '@atlaspack/
|
9
|
+
import {registerSerializableClass} from '@atlaspack/build-cache';
|
10
10
|
import {npmSpecifierFromModuleRequest} from './utils';
|
11
11
|
|
12
12
|
// $FlowFixMe
|
package/src/Pnpm.js
CHANGED
@@ -10,7 +10,7 @@ import logger from '@atlaspack/logger';
|
|
10
10
|
import split from 'split2';
|
11
11
|
import JSONParseStream from './JSONParseStream';
|
12
12
|
import promiseFromProcess from './promiseFromProcess';
|
13
|
-
import {registerSerializableClass} from '@atlaspack/
|
13
|
+
import {registerSerializableClass} from '@atlaspack/build-cache';
|
14
14
|
import {exec, npmSpecifierFromModuleRequest} from './utils';
|
15
15
|
|
16
16
|
// $FlowFixMe
|
@@ -123,7 +123,7 @@ export class Pnpm implements PackageInstaller {
|
|
123
123
|
installProcess.stdout
|
124
124
|
.pipe(split())
|
125
125
|
.pipe(new JSONParseStream())
|
126
|
-
.on('error', e => {
|
126
|
+
.on('error', (e) => {
|
127
127
|
logger.warn({
|
128
128
|
origin: '@atlaspack/package-manager',
|
129
129
|
message: e.chunk,
|
@@ -150,10 +150,10 @@ export class Pnpm implements PackageInstaller {
|
|
150
150
|
|
151
151
|
let stderr = [];
|
152
152
|
installProcess.stderr
|
153
|
-
.on('data', str => {
|
153
|
+
.on('data', (str) => {
|
154
154
|
stderr.push(str.toString());
|
155
155
|
})
|
156
|
-
.on('error', e => {
|
156
|
+
.on('error', (e) => {
|
157
157
|
logger.warn({
|
158
158
|
origin: '@atlaspack/package-manager',
|
159
159
|
message: e.message,
|
package/src/Yarn.js
CHANGED
@@ -8,7 +8,7 @@ import logger from '@atlaspack/logger';
|
|
8
8
|
import split from 'split2';
|
9
9
|
import JSONParseStream from './JSONParseStream';
|
10
10
|
import promiseFromProcess from './promiseFromProcess';
|
11
|
-
import {registerSerializableClass} from '@atlaspack/
|
11
|
+
import {registerSerializableClass} from '@atlaspack/build-cache';
|
12
12
|
import {exec, npmSpecifierFromModuleRequest} from './utils';
|
13
13
|
|
14
14
|
// $FlowFixMe
|
@@ -93,7 +93,7 @@ export class Yarn implements PackageInstaller {
|
|
93
93
|
// Invoking yarn with --json provides streaming, newline-delimited JSON output.
|
94
94
|
.pipe(split())
|
95
95
|
.pipe(new JSONParseStream())
|
96
|
-
.on('error', e => {
|
96
|
+
.on('error', (e) => {
|
97
97
|
logger.error(e, '@atlaspack/package-manager');
|
98
98
|
})
|
99
99
|
.on('data', (message: YarnStdOutMessage) => {
|
@@ -120,7 +120,7 @@ export class Yarn implements PackageInstaller {
|
|
120
120
|
installProcess.stderr
|
121
121
|
.pipe(split())
|
122
122
|
.pipe(new JSONParseStream())
|
123
|
-
.on('error', e => {
|
123
|
+
.on('error', (e) => {
|
124
124
|
logger.error(e, '@atlaspack/package-manager');
|
125
125
|
})
|
126
126
|
.on('data', (message: YarnStdErrMessage) => {
|
package/src/installPackage.js
CHANGED
@@ -24,7 +24,7 @@ import WorkerFarm from '@atlaspack/workers';
|
|
24
24
|
|
25
25
|
import {Npm} from './Npm';
|
26
26
|
import {Yarn} from './Yarn';
|
27
|
-
import {Pnpm} from './Pnpm
|
27
|
+
import {Pnpm} from './Pnpm';
|
28
28
|
import {getConflictingLocalDependencies} from './utils';
|
29
29
|
import getCurrentPackageManager from './getCurrentPackageManager';
|
30
30
|
import validateModuleSpecifier from './validateModuleSpecifier';
|
@@ -38,7 +38,7 @@ async function install(
|
|
38
38
|
options: InstallOptions = {},
|
39
39
|
): Promise<void> {
|
40
40
|
let {installPeers = true, saveDev = true, packageInstaller} = options;
|
41
|
-
let moduleNames = modules.map(m => m.name).join(', ');
|
41
|
+
let moduleNames = modules.map((m) => m.name).join(', ');
|
42
42
|
|
43
43
|
logger.progress(`Installing ${moduleNames}...`);
|
44
44
|
|
@@ -68,7 +68,7 @@ async function install(
|
|
68
68
|
|
69
69
|
if (installPeers) {
|
70
70
|
await Promise.all(
|
71
|
-
modules.map(m =>
|
71
|
+
modules.map((m) =>
|
72
72
|
installPeerDependencies(
|
73
73
|
fs,
|
74
74
|
packageManager,
|
@@ -121,7 +121,7 @@ async function installPeerDependencies(
|
|
121
121
|
code: conflicts.json,
|
122
122
|
codeHighlights: generateJSONCodeHighlights(
|
123
123
|
conflicts.json,
|
124
|
-
conflicts.fields.map(field => ({
|
124
|
+
conflicts.fields.map((field) => ({
|
125
125
|
key: `/${field}/${encodeJSONKeyComponent(name)}`,
|
126
126
|
type: 'key',
|
127
127
|
message: 'Found this conflicting local requirement.',
|
@@ -206,7 +206,7 @@ export function _addToInstallQueue(
|
|
206
206
|
projectRoot: FilePath,
|
207
207
|
options?: InstallOptions,
|
208
208
|
): Promise<mixed> {
|
209
|
-
modules = modules.map(request => ({
|
209
|
+
modules = modules.map((request) => ({
|
210
210
|
name: validateModuleSpecifier(request.name),
|
211
211
|
range: request.range,
|
212
212
|
}));
|
@@ -215,7 +215,7 @@ export function _addToInstallQueue(
|
|
215
215
|
// If a request comes in for a module that is currently installing, don't bother
|
216
216
|
// enqueuing it.
|
217
217
|
let modulesToInstall = modules.filter(
|
218
|
-
m => !modulesInstalling.has(getModuleRequestKey(m)),
|
218
|
+
(m) => !modulesInstalling.has(getModuleRequestKey(m)),
|
219
219
|
);
|
220
220
|
if (modulesToInstall.length) {
|
221
221
|
for (let m of modulesToInstall) {
|
@@ -7,7 +7,7 @@ export default function promiseFromProcess(
|
|
7
7
|
): Promise<void> {
|
8
8
|
return new Promise((resolve, reject) => {
|
9
9
|
childProcess.on('error', reject);
|
10
|
-
childProcess.on('close', code => {
|
10
|
+
childProcess.on('close', (code) => {
|
11
11
|
if (code !== 0) {
|
12
12
|
reject(new Error('Child process failed'));
|
13
13
|
return;
|
@@ -49,7 +49,7 @@ describe('NodePackageManager', function () {
|
|
49
49
|
|
50
50
|
beforeEach(() => {
|
51
51
|
workerFarm = new WorkerFarm({
|
52
|
-
workerPath: require.resolve('@atlaspack/core/
|
52
|
+
workerPath: require.resolve('@atlaspack/core/worker'),
|
53
53
|
});
|
54
54
|
fs = new OverlayFS(new MemoryFS(workerFarm), new NodeFS());
|
55
55
|
packageInstaller = new MockPackageInstaller();
|
@@ -167,7 +167,7 @@ describe('NodePackageManager', function () {
|
|
167
167
|
path.join(FIXTURES_DIR, 'has-a-not-yet-installed/index.js'),
|
168
168
|
{shouldAutoInstall: true},
|
169
169
|
),
|
170
|
-
err => {
|
170
|
+
(err) => {
|
171
171
|
invariant(err instanceof ThrowableDiagnostic);
|
172
172
|
assert(err.message.includes('Run your package manager'));
|
173
173
|
return true;
|
@@ -258,7 +258,7 @@ describe('NodePackageManager', function () {
|
|
258
258
|
range: '^2.0.0',
|
259
259
|
},
|
260
260
|
),
|
261
|
-
err => {
|
261
|
+
(err) => {
|
262
262
|
invariant(err instanceof ThrowableDiagnostic);
|
263
263
|
assert.equal(
|
264
264
|
err.message,
|
@@ -370,7 +370,7 @@ describe('NodePackageManager', function () {
|
|
370
370
|
shouldAutoInstall: true,
|
371
371
|
},
|
372
372
|
),
|
373
|
-
err => {
|
373
|
+
(err) => {
|
374
374
|
assert(err instanceof ThrowableDiagnostic);
|
375
375
|
assert.equal(
|
376
376
|
err.message,
|
@@ -15,7 +15,7 @@ describe('Validate Module Specifiers', () => {
|
|
15
15
|
];
|
16
16
|
|
17
17
|
assert.deepEqual(
|
18
|
-
modules.map(module => validateModuleSpecifier(module)),
|
18
|
+
modules.map((module) => validateModuleSpecifier(module)),
|
19
19
|
[
|
20
20
|
'@atlaspack/transformer-posthtml',
|
21
21
|
'@some-org/package@v1.0.0',
|
@@ -31,7 +31,7 @@ describe('Validate Module Specifiers', () => {
|
|
31
31
|
let modules = ['./somewhere.js', './hello/world.js', '~/hello/world.js'];
|
32
32
|
|
33
33
|
assert.deepEqual(
|
34
|
-
modules.map(module => validateModuleSpecifier(module)),
|
34
|
+
modules.map((module) => validateModuleSpecifier(module)),
|
35
35
|
['', '', ''],
|
36
36
|
);
|
37
37
|
});
|