@atlaspack/package-manager 2.14.5-canary.20 → 2.14.5-canary.201

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 (63) hide show
  1. package/CHANGELOG.md +298 -0
  2. package/dist/JSONParseStream.js +37 -0
  3. package/dist/MockPackageInstaller.js +54 -0
  4. package/dist/NodePackageManager.js +559 -0
  5. package/dist/Npm.js +73 -0
  6. package/dist/Pnpm.js +140 -0
  7. package/dist/Yarn.js +124 -0
  8. package/dist/getCurrentPackageManager.js +17 -0
  9. package/dist/index.js +24 -0
  10. package/dist/installPackage.js +197 -0
  11. package/dist/nodejsConditions.js +39 -0
  12. package/dist/promiseFromProcess.js +16 -0
  13. package/dist/utils.js +76 -0
  14. package/dist/validateModuleSpecifier.js +11 -0
  15. package/lib/JSONParseStream.js +52 -0
  16. package/lib/MockPackageInstaller.js +79 -0
  17. package/lib/NodePackageManager.js +621 -0
  18. package/lib/Npm.js +106 -0
  19. package/lib/Pnpm.js +185 -0
  20. package/lib/Yarn.js +160 -0
  21. package/lib/getCurrentPackageManager.js +20 -0
  22. package/lib/index.js +64 -5211
  23. package/lib/installPackage.js +222 -0
  24. package/lib/nodejsConditions.js +41 -0
  25. package/lib/promiseFromProcess.js +20 -0
  26. package/lib/types/JSONParseStream.d.ts +6 -0
  27. package/lib/types/MockPackageInstaller.d.ts +14 -0
  28. package/lib/types/NodePackageManager.d.ts +37 -0
  29. package/lib/types/Npm.d.ts +4 -0
  30. package/lib/types/Pnpm.d.ts +5 -0
  31. package/lib/types/Yarn.d.ts +5 -0
  32. package/lib/types/getCurrentPackageManager.d.ts +4 -0
  33. package/lib/types/index.d.ts +10 -0
  34. package/lib/types/installPackage.d.ts +5 -0
  35. package/lib/types/nodejsConditions.d.ts +3 -0
  36. package/lib/types/promiseFromProcess.d.ts +2 -0
  37. package/lib/types/utils.d.ts +15 -0
  38. package/lib/types/validateModuleSpecifier.d.ts +1 -0
  39. package/lib/utils.js +101 -0
  40. package/lib/validateModuleSpecifier.js +14 -0
  41. package/package.json +17 -20
  42. package/src/{JSONParseStream.js → JSONParseStream.ts} +8 -7
  43. package/src/{MockPackageInstaller.js → MockPackageInstaller.ts} +4 -6
  44. package/src/{NodePackageManager.js → NodePackageManager.ts} +125 -73
  45. package/src/{Npm.js → Npm.ts} +9 -9
  46. package/src/{Pnpm.js → Pnpm.ts} +68 -50
  47. package/src/{Yarn.js → Yarn.ts} +38 -25
  48. package/src/{getCurrentPackageManager.js → getCurrentPackageManager.ts} +9 -4
  49. package/src/{index.js → index.ts} +0 -2
  50. package/src/{installPackage.js → installPackage.ts} +4 -6
  51. package/src/{nodejsConditions.js → nodejsConditions.ts} +6 -3
  52. package/src/promiseFromProcess.ts +23 -0
  53. package/src/{utils.js → utils.ts} +21 -11
  54. package/src/{validateModuleSpecifier.js → validateModuleSpecifier.ts} +0 -2
  55. package/test/{NodePackageManager.test.js → NodePackageManager.test.ts} +19 -16
  56. package/test/{getCurrentPackageManager.test.js → getCurrentPackageManager.test.ts} +0 -1
  57. package/test/{validateModuleSpecifiers.test.js → validateModuleSpecifiers.test.ts} +2 -3
  58. package/tsconfig.json +33 -0
  59. package/tsconfig.tsbuildinfo +1 -0
  60. package/index.d.ts +0 -40
  61. package/lib/index.d.ts +0 -10
  62. package/lib/index.js.map +0 -1
  63. package/src/promiseFromProcess.js +0 -19
package/CHANGELOG.md CHANGED
@@ -1,5 +1,303 @@
1
1
  # @atlaspack/package-manager
2
2
 
3
+ ## 2.14.31
4
+
5
+ ### Patch Changes
6
+
7
+ - [#785](https://github.com/atlassian-labs/atlaspack/pull/785) [`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922) Thanks [@matt-koko](https://github.com/matt-koko)! - We need to re-publish every package in Atlaspack with the corrected types field.
8
+
9
+ - Updated dependencies [[`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922)]:
10
+ - @atlaspack/build-cache@2.13.6
11
+ - @atlaspack/diagnostic@2.14.4
12
+ - @atlaspack/fs@2.15.26
13
+ - @atlaspack/logger@2.14.23
14
+ - @atlaspack/types@2.15.21
15
+ - @atlaspack/utils@2.19.3
16
+ - @atlaspack/workers@2.14.31
17
+ - @atlaspack/node-resolver-core@3.7.2
18
+
19
+ ## 2.14.30
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies []:
24
+ - @atlaspack/fs@2.15.25
25
+ - @atlaspack/utils@2.19.2
26
+ - @atlaspack/node-resolver-core@3.7.1
27
+ - @atlaspack/logger@2.14.22
28
+ - @atlaspack/types@2.15.20
29
+ - @atlaspack/workers@2.14.30
30
+
31
+ ## 2.14.29
32
+
33
+ ### Patch Changes
34
+
35
+ - [#764](https://github.com/atlassian-labs/atlaspack/pull/764) [`58ddd5d`](https://github.com/atlassian-labs/atlaspack/commit/58ddd5d79adde2ac5dc4c60ca575e4705a91e592) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Fix using Atlaspack linked with source files
36
+
37
+ - Updated dependencies [[`53dd47b`](https://github.com/atlassian-labs/atlaspack/commit/53dd47bd6d23cd47f87297347f03a609ab38a03d)]:
38
+ - @atlaspack/node-resolver-core@3.7.0
39
+ - @atlaspack/fs@2.15.24
40
+ - @atlaspack/utils@2.19.1
41
+ - @atlaspack/logger@2.14.21
42
+ - @atlaspack/types@2.15.19
43
+ - @atlaspack/workers@2.14.29
44
+
45
+ ## 2.14.28
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767)]:
50
+ - @atlaspack/utils@2.19.0
51
+ - @atlaspack/fs@2.15.23
52
+ - @atlaspack/node-resolver-core@3.6.4
53
+ - @atlaspack/workers@2.14.28
54
+ - @atlaspack/logger@2.14.20
55
+ - @atlaspack/types@2.15.18
56
+
57
+ ## 2.14.27
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies []:
62
+ - @atlaspack/fs@2.15.22
63
+ - @atlaspack/utils@2.18.4
64
+ - @atlaspack/node-resolver-core@3.6.3
65
+ - @atlaspack/logger@2.14.19
66
+ - @atlaspack/types@2.15.17
67
+ - @atlaspack/workers@2.14.27
68
+
69
+ ## 2.14.26
70
+
71
+ ### Patch Changes
72
+
73
+ - [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
74
+
75
+ - Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
76
+ - @atlaspack/node-resolver-core@3.6.2
77
+ - @atlaspack/build-cache@2.13.5
78
+ - @atlaspack/diagnostic@2.14.3
79
+ - @atlaspack/workers@2.14.26
80
+ - @atlaspack/logger@2.14.18
81
+ - @atlaspack/types@2.15.16
82
+ - @atlaspack/utils@2.18.3
83
+ - @atlaspack/fs@2.15.21
84
+
85
+ ## 2.14.25
86
+
87
+ ### Patch Changes
88
+
89
+ - Updated dependencies []:
90
+ - @atlaspack/fs@2.15.20
91
+ - @atlaspack/utils@2.18.2
92
+ - @atlaspack/node-resolver-core@3.6.1
93
+ - @atlaspack/logger@2.14.17
94
+ - @atlaspack/types@2.15.15
95
+ - @atlaspack/workers@2.14.25
96
+
97
+ ## 2.14.24
98
+
99
+ ### Patch Changes
100
+
101
+ - Updated dependencies [[`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45)]:
102
+ - @atlaspack/node-resolver-core@3.6.0
103
+ - @atlaspack/fs@2.15.19
104
+ - @atlaspack/logger@2.14.16
105
+ - @atlaspack/utils@2.18.1
106
+ - @atlaspack/types@2.15.14
107
+ - @atlaspack/workers@2.14.24
108
+
109
+ ## 2.14.23
110
+
111
+ ### Patch Changes
112
+
113
+ - Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
114
+ - @atlaspack/utils@2.18.0
115
+ - @atlaspack/fs@2.15.18
116
+ - @atlaspack/node-resolver-core@3.5.23
117
+ - @atlaspack/workers@2.14.23
118
+ - @atlaspack/logger@2.14.15
119
+ - @atlaspack/types@2.15.13
120
+
121
+ ## 2.14.22
122
+
123
+ ### Patch Changes
124
+
125
+ - [#720](https://github.com/atlassian-labs/atlaspack/pull/720) [`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94) Thanks [@alshdavid](https://github.com/alshdavid)! - Migrate to TypeScript
126
+
127
+ - Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94)]:
128
+ - @atlaspack/node-resolver-core@3.5.22
129
+ - @atlaspack/build-cache@2.13.4
130
+ - @atlaspack/diagnostic@2.14.2
131
+ - @atlaspack/workers@2.14.22
132
+ - @atlaspack/logger@2.14.14
133
+ - @atlaspack/types@2.15.12
134
+ - @atlaspack/utils@2.17.4
135
+ - @atlaspack/fs@2.15.17
136
+
137
+ ## 2.14.21
138
+
139
+ ### Patch Changes
140
+
141
+ - Updated dependencies []:
142
+ - @atlaspack/fs@2.15.16
143
+ - @atlaspack/types@2.15.11
144
+ - @atlaspack/workers@2.14.21
145
+ - @atlaspack/utils@2.17.3
146
+ - @atlaspack/node-resolver-core@3.5.21
147
+
148
+ ## 2.14.20
149
+
150
+ ### Patch Changes
151
+
152
+ - Updated dependencies []:
153
+ - @atlaspack/fs@2.15.15
154
+ - @atlaspack/utils@2.17.2
155
+ - @atlaspack/node-resolver-core@3.5.20
156
+ - @atlaspack/types@2.15.10
157
+ - @atlaspack/workers@2.14.20
158
+
159
+ ## 2.14.19
160
+
161
+ ### Patch Changes
162
+
163
+ - Updated dependencies []:
164
+ - @atlaspack/fs@2.15.14
165
+ - @atlaspack/utils@2.17.1
166
+ - @atlaspack/node-resolver-core@3.5.19
167
+ - @atlaspack/types@2.15.9
168
+ - @atlaspack/workers@2.14.19
169
+
170
+ ## 2.14.18
171
+
172
+ ### Patch Changes
173
+
174
+ - [#645](https://github.com/atlassian-labs/atlaspack/pull/645) [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3) Thanks [@alshdavid](https://github.com/alshdavid)! - Updated build system and added some extra test-specific code
175
+
176
+ - [#682](https://github.com/atlassian-labs/atlaspack/pull/682) [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56) Thanks [@alshdavid](https://github.com/alshdavid)! - Updating build system
177
+
178
+ - Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417), [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56)]:
179
+ - @atlaspack/utils@2.17.0
180
+ - @atlaspack/fs@2.15.13
181
+ - @atlaspack/node-resolver-core@3.5.18
182
+ - @atlaspack/workers@2.14.18
183
+ - @atlaspack/logger@2.14.13
184
+ - @atlaspack/types@2.15.8
185
+
186
+ ## 2.14.17
187
+
188
+ ### Patch Changes
189
+
190
+ - Updated dependencies []:
191
+ - @atlaspack/fs@2.15.12
192
+ - @atlaspack/logger@2.14.12
193
+ - @atlaspack/utils@2.16.1
194
+ - @atlaspack/node-resolver-core@3.5.17
195
+ - @atlaspack/workers@2.14.17
196
+ - @atlaspack/types@2.15.7
197
+
198
+ ## 2.14.16
199
+
200
+ ### Patch Changes
201
+
202
+ - Updated dependencies [[`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
203
+ - @atlaspack/utils@2.16.0
204
+ - @atlaspack/fs@2.15.11
205
+ - @atlaspack/node-resolver-core@3.5.16
206
+ - @atlaspack/workers@2.14.16
207
+ - @atlaspack/types@2.15.6
208
+
209
+ ## 2.14.15
210
+
211
+ ### Patch Changes
212
+
213
+ - Updated dependencies []:
214
+ - @atlaspack/fs@2.15.10
215
+ - @atlaspack/utils@2.15.3
216
+ - @atlaspack/node-resolver-core@3.5.15
217
+ - @atlaspack/types@2.15.5
218
+ - @atlaspack/workers@2.14.15
219
+
220
+ ## 2.14.14
221
+
222
+ ### Patch Changes
223
+
224
+ - Updated dependencies []:
225
+ - @atlaspack/fs@2.15.9
226
+ - @atlaspack/utils@2.15.2
227
+ - @atlaspack/node-resolver-core@3.5.14
228
+ - @atlaspack/types@2.15.4
229
+ - @atlaspack/workers@2.14.14
230
+
231
+ ## 2.14.13
232
+
233
+ ### Patch Changes
234
+
235
+ - Updated dependencies [[`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb)]:
236
+ - @atlaspack/workers@2.14.13
237
+ - @atlaspack/logger@2.14.11
238
+ - @atlaspack/fs@2.15.8
239
+ - @atlaspack/types@2.15.3
240
+ - @atlaspack/utils@2.15.1
241
+ - @atlaspack/node-resolver-core@3.5.13
242
+
243
+ ## 2.14.12
244
+
245
+ ### Patch Changes
246
+
247
+ - Updated dependencies [[`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
248
+ - @atlaspack/utils@2.15.0
249
+ - @atlaspack/fs@2.15.7
250
+ - @atlaspack/node-resolver-core@3.5.12
251
+ - @atlaspack/workers@2.14.12
252
+ - @atlaspack/types@2.15.2
253
+
254
+ ## 2.14.11
255
+
256
+ ### Patch Changes
257
+
258
+ - Updated dependencies []:
259
+ - @atlaspack/fs@2.15.6
260
+ - @atlaspack/utils@2.14.11
261
+ - @atlaspack/node-resolver-core@3.5.11
262
+ - @atlaspack/types@2.15.1
263
+ - @atlaspack/workers@2.14.11
264
+
265
+ ## 2.14.10
266
+
267
+ ### Patch Changes
268
+
269
+ - Updated dependencies [[`0999fb7`](https://github.com/atlassian-labs/atlaspack/commit/0999fb78da519a6c7582d212883e515fcf6c1252), [`51aba5f`](https://github.com/atlassian-labs/atlaspack/commit/51aba5fc0e49235ee06bbc3c376f48c3e7da5c4b), [`1e32d4e`](https://github.com/atlassian-labs/atlaspack/commit/1e32d4eae6b3af3968e8a0ef97d35b4347fd4196)]:
270
+ - @atlaspack/fs@2.15.5
271
+ - @atlaspack/types@2.15.0
272
+ - @atlaspack/node-resolver-core@3.5.10
273
+ - @atlaspack/workers@2.14.10
274
+ - @atlaspack/logger@2.14.10
275
+ - @atlaspack/utils@2.14.10
276
+
277
+ ## 2.14.9
278
+
279
+ ### Patch Changes
280
+
281
+ - Updated dependencies [[`e4d966c`](https://github.com/atlassian-labs/atlaspack/commit/e4d966c3c9c4292c5013372ae65b10d19d4bacc6)]:
282
+ - @atlaspack/fs@2.15.4
283
+ - @atlaspack/logger@2.14.9
284
+ - @atlaspack/utils@2.14.9
285
+ - @atlaspack/node-resolver-core@3.5.9
286
+ - @atlaspack/workers@2.14.9
287
+ - @atlaspack/types@2.14.9
288
+
289
+ ## 2.14.8
290
+
291
+ ### Patch Changes
292
+
293
+ - Updated dependencies [[`3a3e8e7`](https://github.com/atlassian-labs/atlaspack/commit/3a3e8e7be9e2dffd7304436d792f0f595d59665a), [`1ab0a27`](https://github.com/atlassian-labs/atlaspack/commit/1ab0a275aeca40350415e2b03e7440d1dddc6228), [`b8a4ae8`](https://github.com/atlassian-labs/atlaspack/commit/b8a4ae8f83dc0a83d8b145c5f729936ce52080a3)]:
294
+ - @atlaspack/fs@2.15.3
295
+ - @atlaspack/utils@2.14.8
296
+ - @atlaspack/node-resolver-core@3.5.8
297
+ - @atlaspack/logger@2.14.8
298
+ - @atlaspack/types@2.14.8
299
+ - @atlaspack/workers@2.14.8
300
+
3
301
  ## 2.14.7
4
302
 
5
303
  ### Patch Changes
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const logger_1 = __importDefault(require("@atlaspack/logger"));
7
+ const stream_1 = require("stream");
8
+ // Transforms chunks of json strings to parsed objects.
9
+ // Pair with split2 to parse stream of newline-delimited text.
10
+ class JSONParseStream extends stream_1.Transform {
11
+ constructor(options) {
12
+ // @ts-expect-error TS2698
13
+ super({ ...options, objectMode: true });
14
+ }
15
+ _transform(chunk, encoding, callback) {
16
+ try {
17
+ let parsed;
18
+ try {
19
+ parsed = JSON.parse(chunk.toString());
20
+ }
21
+ catch (e) {
22
+ // Be permissive and ignoreJSON parse errors in case there was
23
+ // a non-JSON line in the package manager's stdout.
24
+ logger_1.default.verbose({
25
+ message: 'Ignored invalid JSON message: ' + chunk.toString(),
26
+ origin: '@atlaspack/package-manager',
27
+ });
28
+ return;
29
+ }
30
+ callback(null, parsed);
31
+ }
32
+ catch (err) {
33
+ callback(err);
34
+ }
35
+ }
36
+ }
37
+ exports.default = JSONParseStream;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MockPackageInstaller = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const build_cache_1 = require("@atlaspack/build-cache");
9
+ const fs_1 = require("@atlaspack/fs");
10
+ const package_json_1 = __importDefault(require("../package.json"));
11
+ const utils_1 = require("./utils");
12
+ // This PackageInstaller implementation simply copies files from one filesystem to another.
13
+ // Mostly useful for testing purposes.
14
+ class MockPackageInstaller {
15
+ constructor() {
16
+ this.packages = new Map();
17
+ }
18
+ register(packageName, fs, packagePath) {
19
+ this.packages.set(packageName, { fs, packagePath });
20
+ }
21
+ async install({ modules, fs, cwd, packagePath, saveDev = true, }) {
22
+ if (packagePath == null) {
23
+ packagePath = path_1.default.join(cwd, 'package.json');
24
+ await fs.writeFile(packagePath, '{}');
25
+ }
26
+ let pkg = JSON.parse(await fs.readFile(packagePath, 'utf8'));
27
+ let key = saveDev ? 'devDependencies' : 'dependencies';
28
+ if (!pkg[key]) {
29
+ pkg[key] = {};
30
+ }
31
+ for (let module of modules) {
32
+ pkg[key][module.name] =
33
+ '^' + (await this.installPackage(module, fs, packagePath));
34
+ }
35
+ await fs.writeFile(packagePath, JSON.stringify(pkg));
36
+ }
37
+ async installPackage(moduleRequest, fs, packagePath) {
38
+ let pkg = this.packages.get(moduleRequest.name);
39
+ if (!pkg) {
40
+ throw new Error('Unknown package ' + moduleRequest.name);
41
+ }
42
+ let dest = path_1.default.join(path_1.default.dirname(packagePath), 'node_modules', moduleRequest.name);
43
+ await (0, fs_1.ncp)(pkg.fs, pkg.packagePath, fs, dest);
44
+ let packageJSON = JSON.parse(await fs.readFile(path_1.default.join(dest, 'package.json'), 'utf8'));
45
+ if (packageJSON.dependencies != null) {
46
+ for (let dep of (0, utils_1.moduleRequestsFromDependencyMap)(packageJSON.dependencies)) {
47
+ await this.installPackage(dep, fs, packagePath);
48
+ }
49
+ }
50
+ return packageJSON.version;
51
+ }
52
+ }
53
+ exports.MockPackageInstaller = MockPackageInstaller;
54
+ (0, build_cache_1.registerSerializableClass)(`${package_json_1.default.version}:MockPackageInstaller`, MockPackageInstaller);