@teambit/pnpm 1.0.107 → 1.0.108

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/lynx.ts ADDED
@@ -0,0 +1,606 @@
1
+ import semver from 'semver';
2
+ import parsePackageName from 'parse-package-name';
3
+ import { initDefaultReporter } from '@pnpm/default-reporter';
4
+ import { streamParser } from '@pnpm/logger';
5
+ import { StoreController, WantedDependency } from '@pnpm/package-store';
6
+ import { rebuild } from '@pnpm/plugin-commands-rebuild';
7
+ import { createOrConnectStoreController, CreateStoreControllerOptions } from '@pnpm/store-connection-manager';
8
+ import { sortPackages } from '@pnpm/sort-packages';
9
+ import {
10
+ ResolvedPackageVersion,
11
+ Registries,
12
+ NPM_REGISTRY,
13
+ Registry,
14
+ PackageManagerProxyConfig,
15
+ PackageManagerNetworkConfig,
16
+ } from '@teambit/dependency-resolver';
17
+ import { BitError } from '@teambit/bit-error';
18
+ import {
19
+ MutatedProject,
20
+ mutateModules,
21
+ InstallOptions,
22
+ PeerDependencyIssuesByProjects,
23
+ ProjectOptions,
24
+ } from '@pnpm/core';
25
+ import * as pnpm from '@pnpm/core';
26
+ import { createClient, ClientOptions } from '@pnpm/client';
27
+ import { pickRegistryForPackage } from '@pnpm/pick-registry-for-package';
28
+ import { restartWorkerPool, finishWorkers } from '@pnpm/worker';
29
+ import { createPkgGraph } from '@pnpm/workspace.pkgs-graph';
30
+ import { PackageManifest, ProjectManifest, ReadPackageHook } from '@pnpm/types';
31
+ import { Logger } from '@teambit/logger';
32
+ import toNerfDart from 'nerf-dart';
33
+ import { pnpmErrorToBitError } from './pnpm-error-to-bit-error';
34
+ import { readConfig } from './read-config';
35
+
36
+ const installsRunning: Record<string, Promise<any>> = {};
37
+ const cafsLocker = new Map<string, number>();
38
+
39
+ type RegistriesMap = {
40
+ default: string;
41
+ [registryName: string]: string;
42
+ };
43
+
44
+ const STORE_CACHE: Record<string, { ctrl: StoreController; dir: string }> = {};
45
+
46
+ async function createStoreController(
47
+ options: {
48
+ rootDir: string;
49
+ storeDir?: string;
50
+ cacheDir: string;
51
+ registries: Registries;
52
+ proxyConfig: PackageManagerProxyConfig;
53
+ networkConfig: PackageManagerNetworkConfig;
54
+ } & Pick<CreateStoreControllerOptions, 'packageImportMethod' | 'pnpmHomeDir' | 'preferOffline'>
55
+ ): Promise<{ ctrl: StoreController; dir: string }> {
56
+ const authConfig = getAuthConfig(options.registries);
57
+ const opts: CreateStoreControllerOptions = {
58
+ dir: options.rootDir,
59
+ cacheDir: options.cacheDir,
60
+ cafsLocker,
61
+ storeDir: options.storeDir,
62
+ rawConfig: authConfig,
63
+ verifyStoreIntegrity: true,
64
+ httpProxy: options.proxyConfig?.httpProxy,
65
+ httpsProxy: options.proxyConfig?.httpsProxy,
66
+ ca: options.networkConfig?.ca,
67
+ cert: options.networkConfig?.cert,
68
+ key: options.networkConfig?.key,
69
+ localAddress: options.networkConfig?.localAddress,
70
+ noProxy: options.proxyConfig?.noProxy,
71
+ strictSsl: options.networkConfig.strictSSL,
72
+ maxSockets: options.networkConfig.maxSockets,
73
+ networkConcurrency: options.networkConfig.networkConcurrency,
74
+ packageImportMethod: options.packageImportMethod,
75
+ preferOffline: options.preferOffline,
76
+ resolveSymlinksInInjectedDirs: true,
77
+ pnpmHomeDir: options.pnpmHomeDir,
78
+ };
79
+ // We should avoid the recreation of store.
80
+ // The store holds cache that makes subsequent resolutions faster.
81
+ const cacheKey = JSON.stringify(opts);
82
+ if (!STORE_CACHE[cacheKey]) {
83
+ // Although it would be enough to call createNewStoreController(),
84
+ // that doesn't resolve the store directory location.
85
+ STORE_CACHE[cacheKey] = await createOrConnectStoreController(opts);
86
+ }
87
+ return STORE_CACHE[cacheKey];
88
+ }
89
+
90
+ async function generateResolverAndFetcher(
91
+ cacheDir: string,
92
+ registries: Registries,
93
+ proxyConfig: PackageManagerProxyConfig = {},
94
+ networkConfig: PackageManagerNetworkConfig = {}
95
+ ) {
96
+ const pnpmConfig = await readConfig();
97
+ const authConfig = getAuthConfig(registries);
98
+ const opts: ClientOptions = {
99
+ authConfig: Object.assign({}, pnpmConfig.config.rawConfig, authConfig),
100
+ cacheDir,
101
+ httpProxy: proxyConfig?.httpProxy,
102
+ httpsProxy: proxyConfig?.httpsProxy,
103
+ ca: networkConfig?.ca,
104
+ cert: networkConfig?.cert,
105
+ key: networkConfig?.key,
106
+ localAddress: networkConfig?.localAddress,
107
+ noProxy: proxyConfig?.noProxy,
108
+ strictSsl: networkConfig.strictSSL,
109
+ timeout: networkConfig.fetchTimeout,
110
+ rawConfig: pnpmConfig.config.rawConfig,
111
+ retry: {
112
+ factor: networkConfig.fetchRetryFactor,
113
+ maxTimeout: networkConfig.fetchRetryMaxtimeout,
114
+ minTimeout: networkConfig.fetchRetryMintimeout,
115
+ retries: networkConfig.fetchRetries,
116
+ },
117
+ };
118
+ const result = createClient(opts);
119
+ return result;
120
+ }
121
+
122
+ export async function getPeerDependencyIssues(
123
+ manifestsByPaths: Record<string, any>,
124
+ opts: {
125
+ storeDir?: string;
126
+ cacheDir: string;
127
+ registries: Registries;
128
+ rootDir: string;
129
+ proxyConfig: PackageManagerProxyConfig;
130
+ networkConfig: PackageManagerNetworkConfig;
131
+ overrides?: Record<string, string>;
132
+ } & Pick<CreateStoreControllerOptions, 'packageImportMethod' | 'pnpmHomeDir'>
133
+ ): Promise<PeerDependencyIssuesByProjects> {
134
+ const projects: ProjectOptions[] = [];
135
+ const workspacePackages = {};
136
+ for (const [rootDir, manifest] of Object.entries(manifestsByPaths)) {
137
+ projects.push({
138
+ buildIndex: 0, // this is not used while searching for peer issues anyway
139
+ manifest,
140
+ rootDir,
141
+ });
142
+ workspacePackages[manifest.name] = workspacePackages[manifest.name] || {};
143
+ workspacePackages[manifest.name][manifest.version] = { dir: rootDir, manifest };
144
+ }
145
+ const registriesMap = getRegistriesMap(opts.registries);
146
+ const storeController = await createStoreController({
147
+ ...opts,
148
+ rootDir: opts.rootDir,
149
+ });
150
+ return pnpm.getPeerDependencyIssues(projects, {
151
+ autoInstallPeers: false,
152
+ excludeLinksFromLockfile: true,
153
+ storeController: storeController.ctrl,
154
+ storeDir: storeController.dir,
155
+ overrides: opts.overrides,
156
+ workspacePackages,
157
+ registries: registriesMap,
158
+ });
159
+ }
160
+
161
+ export type RebuildFn = (opts: { pending?: boolean; skipIfHasSideEffectsCache?: boolean }) => Promise<void>;
162
+
163
+ export interface ReportOptions {
164
+ appendOnly?: boolean;
165
+ throttleProgress?: number;
166
+ hideAddedPkgsProgress?: boolean;
167
+ hideProgressPrefix?: boolean;
168
+ hideLifecycleOutput?: boolean;
169
+ }
170
+
171
+ export async function install(
172
+ rootDir: string,
173
+ manifestsByPaths: Record<string, ProjectManifest>,
174
+ storeDir: string | undefined,
175
+ cacheDir: string,
176
+ registries: Registries,
177
+ proxyConfig: PackageManagerProxyConfig = {},
178
+ networkConfig: PackageManagerNetworkConfig = {},
179
+ options: {
180
+ updateAll?: boolean;
181
+ nodeLinker?: 'hoisted' | 'isolated';
182
+ overrides?: Record<string, string>;
183
+ rootComponents?: boolean;
184
+ rootComponentsForCapsules?: boolean;
185
+ includeOptionalDeps?: boolean;
186
+ reportOptions?: ReportOptions;
187
+ hidePackageManagerOutput?: boolean;
188
+ dryRun?: boolean;
189
+ dedupeInjectedDeps?: boolean;
190
+ } & Pick<
191
+ InstallOptions,
192
+ | 'publicHoistPattern'
193
+ | 'hoistPattern'
194
+ | 'lockfileOnly'
195
+ | 'nodeVersion'
196
+ | 'engineStrict'
197
+ | 'excludeLinksFromLockfile'
198
+ | 'peerDependencyRules'
199
+ | 'neverBuiltDependencies'
200
+ | 'ignorePackageManifest'
201
+ > &
202
+ Pick<CreateStoreControllerOptions, 'packageImportMethod' | 'pnpmHomeDir' | 'preferOffline'>,
203
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
204
+ logger?: Logger
205
+ ): Promise<{ dependenciesChanged: boolean; rebuild: RebuildFn; storeDir: string }> {
206
+ let externalDependencies: Set<string> | undefined;
207
+ const readPackage: ReadPackageHook[] = [];
208
+ if (options?.rootComponents && !options?.rootComponentsForCapsules) {
209
+ externalDependencies = new Set(
210
+ Object.values(manifestsByPaths)
211
+ .map(({ name }) => name)
212
+ .filter(Boolean) as string[]
213
+ );
214
+ readPackage.push(readPackageHook as ReadPackageHook);
215
+ }
216
+ if (!manifestsByPaths[rootDir].dependenciesMeta) {
217
+ manifestsByPaths = {
218
+ ...manifestsByPaths,
219
+ [rootDir]: {
220
+ ...manifestsByPaths[rootDir],
221
+ dependenciesMeta: {},
222
+ },
223
+ };
224
+ }
225
+ if (options?.rootComponentsForCapsules) {
226
+ readPackage.push(readPackageHookForCapsules as ReadPackageHook);
227
+ }
228
+ const { allProjects, packagesToBuild, workspacePackages } = groupPkgs(manifestsByPaths, {
229
+ update: options?.updateAll,
230
+ });
231
+ const registriesMap = getRegistriesMap(registries);
232
+ const authConfig = getAuthConfig(registries);
233
+ const storeController = await createStoreController({
234
+ rootDir,
235
+ storeDir,
236
+ cacheDir,
237
+ registries,
238
+ preferOffline: options?.preferOffline,
239
+ proxyConfig,
240
+ networkConfig,
241
+ packageImportMethod: options?.packageImportMethod,
242
+ pnpmHomeDir: options?.pnpmHomeDir,
243
+ });
244
+ const opts: InstallOptions = {
245
+ allProjects,
246
+ autoInstallPeers: false,
247
+ confirmModulesPurge: false,
248
+ storeDir: storeController.dir,
249
+ dedupePeerDependents: true,
250
+ dedupeInjectedDeps: options.dedupeInjectedDeps,
251
+ dir: rootDir,
252
+ storeController: storeController.ctrl,
253
+ workspacePackages,
254
+ preferFrozenLockfile: true,
255
+ pruneLockfileImporters: true,
256
+ lockfileOnly: options.lockfileOnly ?? false,
257
+ modulesCacheMaxAge: Infinity, // pnpm should never prune the virtual store. Bit does it on its own.
258
+ neverBuiltDependencies: options.neverBuiltDependencies,
259
+ registries: registriesMap,
260
+ resolutionMode: 'highest',
261
+ rawConfig: authConfig,
262
+ hooks: { readPackage },
263
+ externalDependencies,
264
+ strictPeerDependencies: false,
265
+ resolveSymlinksInInjectedDirs: true,
266
+ resolvePeersFromWorkspaceRoot: true,
267
+ dedupeDirectDeps: true,
268
+ include: {
269
+ dependencies: true,
270
+ devDependencies: true,
271
+ optionalDependencies: options?.includeOptionalDeps !== false,
272
+ },
273
+ ...options,
274
+ excludeLinksFromLockfile: options.excludeLinksFromLockfile ?? true,
275
+ peerDependencyRules: {
276
+ allowAny: ['*'],
277
+ ignoreMissing: ['*'],
278
+ ...options?.peerDependencyRules,
279
+ },
280
+ depth: options.updateAll ? Infinity : 0,
281
+ disableRelinkLocalDirDeps: true,
282
+ };
283
+
284
+ let dependenciesChanged = false;
285
+ if (!options.dryRun) {
286
+ let stopReporting: Function | undefined;
287
+ if (!options.hidePackageManagerOutput) {
288
+ stopReporting = initReporter({
289
+ ...options.reportOptions,
290
+ hideAddedPkgsProgress: options.lockfileOnly,
291
+ });
292
+ }
293
+ try {
294
+ await installsRunning[rootDir];
295
+ await restartWorkerPool();
296
+ installsRunning[rootDir] = mutateModules(packagesToBuild, opts);
297
+ const { stats } = await installsRunning[rootDir];
298
+ dependenciesChanged = stats.added + stats.removed + stats.linkedToRoot > 0;
299
+ delete installsRunning[rootDir];
300
+ } catch (err: any) {
301
+ if (logger) {
302
+ logger.warn('got an error from pnpm mutateModules function', err);
303
+ }
304
+ throw pnpmErrorToBitError(err);
305
+ } finally {
306
+ stopReporting?.();
307
+ await finishWorkers();
308
+ }
309
+ }
310
+ return {
311
+ dependenciesChanged,
312
+ rebuild: async (rebuildOpts) => {
313
+ let stopReporting: Function | undefined;
314
+ const _opts = {
315
+ ...opts,
316
+ ...rebuildOpts,
317
+ cacheDir,
318
+ } as any; // eslint-disable-line @typescript-eslint/no-explicit-any
319
+ if (!_opts.hidePackageManagerOutput) {
320
+ stopReporting = initReporter({
321
+ appendOnly: true,
322
+ hideLifecycleOutput: true,
323
+ });
324
+ }
325
+ try {
326
+ await rebuild.handler(_opts, []);
327
+ } finally {
328
+ stopReporting?.();
329
+ }
330
+ },
331
+ storeDir: storeController.dir,
332
+ };
333
+ }
334
+
335
+ function initReporter(opts?: ReportOptions) {
336
+ return initDefaultReporter({
337
+ context: {
338
+ argv: [],
339
+ },
340
+ reportingOptions: {
341
+ appendOnly: opts?.appendOnly ?? false,
342
+ throttleProgress: opts?.throttleProgress ?? 200,
343
+ hideAddedPkgsProgress: opts?.hideAddedPkgsProgress,
344
+ hideProgressPrefix: opts?.hideProgressPrefix,
345
+ hideLifecycleOutput: opts?.hideLifecycleOutput,
346
+ },
347
+ streamParser,
348
+ // Linked in core aspects are excluded from the output to reduce noise.
349
+ // Other @teambit/ dependencies will be shown.
350
+ // Only those that are symlinked from outside the workspace will be hidden.
351
+ filterPkgsDiff: (diff) => !diff.name.startsWith('@teambit/') || !diff.from,
352
+ });
353
+ }
354
+
355
+ /**
356
+ * This hook is used when installation is executed inside a capsule.
357
+ * The components in the capsules should get their peer dependencies installed,
358
+ * so this hook converts any peer dependencies into runtime dependencies.
359
+ * Also, any local dependencies are extended with the "injected" option,
360
+ * this tells pnpm to hard link the packages instead of symlinking them.
361
+ */
362
+ function readPackageHookForCapsules(pkg: PackageManifest, workspaceDir?: string): PackageManifest {
363
+ // workspaceDir is set only for workspace packages
364
+ if (workspaceDir) {
365
+ return readDependencyPackageHook({
366
+ ...pkg,
367
+ dependencies: {
368
+ ...pkg.peerDependencies,
369
+ ...pkg.dependencies,
370
+ },
371
+ });
372
+ }
373
+ return readDependencyPackageHook(pkg);
374
+ }
375
+
376
+ /**
377
+ * This hook is used when installation happens in a Bit workspace.
378
+ * We need a different hook for this case because unlike in a capsule, in a workspace,
379
+ * the package manager only links workspace components to subdependencies.
380
+ * For direct dependencies, Bit's linking is used.
381
+ */
382
+ function readPackageHook(pkg: PackageManifest, workspaceDir?: string): PackageManifest {
383
+ if (!pkg.dependencies) {
384
+ return pkg;
385
+ }
386
+ // workspaceDir is set only for workspace packages
387
+ if (workspaceDir && !workspaceDir.includes('.bit_roots')) {
388
+ return readWorkspacePackageHook(pkg);
389
+ }
390
+ return readDependencyPackageHook(pkg);
391
+ }
392
+
393
+ /**
394
+ * This hook adds the "injected" option to any workspace dependency.
395
+ * The injected option tell pnpm to hard link the packages instead of symlinking them.
396
+ */
397
+ function readDependencyPackageHook(pkg: PackageManifest): PackageManifest {
398
+ const dependenciesMeta = pkg.dependenciesMeta ?? {};
399
+ for (const [name, version] of Object.entries(pkg.dependencies ?? {})) {
400
+ if (version.startsWith('workspace:')) {
401
+ // This instructs pnpm to hard link the component from the workspace, not symlink it.
402
+ dependenciesMeta[name] = { injected: true };
403
+ }
404
+ }
405
+ return {
406
+ ...pkg,
407
+ dependenciesMeta,
408
+ };
409
+ }
410
+
411
+ /**
412
+ * This hook is used when installation happens in a Bit workspace.
413
+ * It is applied on workspace projects, and it removes any references to other workspace projects.
414
+ * This is needed because Bit has its own linking for workspace projects.
415
+ * pnpm should not override the links created by Bit.
416
+ * Otherwise, the IDE would reference workspace projects from inside `node_modules/.pnpm`.
417
+ */
418
+ function readWorkspacePackageHook(pkg: PackageManifest): PackageManifest {
419
+ const newDeps = {};
420
+ for (const [name, version] of Object.entries(pkg.dependencies ?? {})) {
421
+ if (!version.startsWith('workspace:')) {
422
+ newDeps[name] = version;
423
+ }
424
+ }
425
+ return {
426
+ ...pkg,
427
+ dependencies: {
428
+ ...pkg.peerDependencies,
429
+ ...newDeps,
430
+ },
431
+ };
432
+ }
433
+
434
+ function groupPkgs(manifestsByPaths: Record<string, ProjectManifest>, opts: { update?: boolean }) {
435
+ const pkgs = Object.entries(manifestsByPaths).map(([dir, manifest]) => ({ dir, manifest }));
436
+ const { graph } = createPkgGraph(pkgs);
437
+ const chunks = sortPackages(graph as any);
438
+
439
+ // This will create local link by pnpm to a component exists in the ws.
440
+ // it will later deleted by the link process
441
+ // we keep it here to better support case like this:
442
+ // compA@1.0.0 uses compB@1.0.0
443
+ // I have compB@2.0.0 in my workspace
444
+ // now I install compA@1.0.0
445
+ // compA is hoisted to the root and install B@1.0.0 hoisted to the root as well
446
+ // now we will make link to B@2.0.0 and A will break
447
+ // with this we will have a link to the local B by pnpm so it will install B@1.0.0 inside A
448
+ // then when overriding the link, A will still works
449
+ // This is the rational behind not deleting this completely, but need further check that it really works
450
+ const packagesToBuild: MutatedProject[] = []; // @pnpm/core will use this to install the packages
451
+ const allProjects: ProjectOptions[] = [];
452
+ const workspacePackages = {}; // @pnpm/core will use this to link packages to each other
453
+
454
+ chunks.forEach((dirs, buildIndex) => {
455
+ for (const rootDir of dirs) {
456
+ const manifest = manifestsByPaths[rootDir];
457
+ allProjects.push({
458
+ buildIndex,
459
+ manifest,
460
+ rootDir,
461
+ });
462
+ packagesToBuild.push({
463
+ rootDir,
464
+ mutation: 'install',
465
+ update: opts.update,
466
+ });
467
+ if (manifest.name) {
468
+ workspacePackages[manifest.name] = workspacePackages[manifest.name] || {};
469
+ workspacePackages[manifest.name][manifest.version] = { dir: rootDir, manifest };
470
+ }
471
+ }
472
+ });
473
+ return { packagesToBuild, allProjects, workspacePackages };
474
+ }
475
+
476
+ export async function resolveRemoteVersion(
477
+ packageName: string,
478
+ rootDir: string,
479
+ cacheDir: string,
480
+ registries: Registries,
481
+ proxyConfig: PackageManagerProxyConfig = {},
482
+ networkConfig: PackageManagerNetworkConfig = {}
483
+ ): Promise<ResolvedPackageVersion> {
484
+ const { resolve } = await generateResolverAndFetcher(cacheDir, registries, proxyConfig, networkConfig);
485
+ const resolveOpts = {
486
+ lockfileDir: rootDir,
487
+ preferredVersions: {},
488
+ projectDir: rootDir,
489
+ registry: '',
490
+ };
491
+ try {
492
+ const parsedPackage = parsePackageName(packageName);
493
+ const registriesMap = getRegistriesMap(registries);
494
+ const registry = pickRegistryForPackage(registriesMap, parsedPackage.name);
495
+ const wantedDep: WantedDependency = {
496
+ alias: parsedPackage.name,
497
+ pref: parsedPackage.version,
498
+ };
499
+ resolveOpts.registry = registry;
500
+ const val = await resolve(wantedDep, resolveOpts);
501
+ if (!val.manifest) {
502
+ throw new BitError('The resolved package has no manifest');
503
+ }
504
+ const wantedRange =
505
+ parsedPackage.version && semver.validRange(parsedPackage.version) ? parsedPackage.version : undefined;
506
+
507
+ return {
508
+ packageName: val.manifest.name,
509
+ version: val.manifest.version,
510
+ wantedRange,
511
+ isSemver: true,
512
+ resolvedVia: val.resolvedVia,
513
+ };
514
+ } catch (e: any) {
515
+ if (!e.message?.includes('is not a valid string')) {
516
+ throw pnpmErrorToBitError(e);
517
+ }
518
+ // The provided package is probably a git url or path to a folder
519
+ const wantedDep: WantedDependency = {
520
+ alias: undefined,
521
+ pref: packageName,
522
+ };
523
+ const val = await resolve(wantedDep, resolveOpts);
524
+ if (!val.manifest) {
525
+ throw new BitError('The resolved package has no manifest');
526
+ }
527
+ if (!val.normalizedPref) {
528
+ throw new BitError('The resolved package has no version');
529
+ }
530
+ return {
531
+ packageName: val.manifest.name,
532
+ version: val.normalizedPref,
533
+ isSemver: false,
534
+ resolvedVia: val.resolvedVia,
535
+ };
536
+ }
537
+ }
538
+
539
+ function getRegistriesMap(registries: Registries): RegistriesMap {
540
+ const registriesMap = {
541
+ default: registries.defaultRegistry.uri || NPM_REGISTRY,
542
+ };
543
+
544
+ Object.entries(registries.scopes).forEach(([registryName, registry]) => {
545
+ registriesMap[`@${registryName}`] = registry.uri;
546
+ });
547
+ return registriesMap;
548
+ }
549
+
550
+ function getAuthConfig(registries: Registries): Record<string, any> {
551
+ const res: any = {};
552
+ res.registry = registries.defaultRegistry.uri;
553
+ if (registries.defaultRegistry.alwaysAuth) {
554
+ res['always-auth'] = true;
555
+ }
556
+ const defaultAuthTokens = getAuthTokenForRegistry(registries.defaultRegistry, true);
557
+ defaultAuthTokens.forEach(({ keyName, val }) => {
558
+ res[keyName] = val;
559
+ });
560
+
561
+ Object.entries(registries.scopes).forEach(([, registry]) => {
562
+ const authTokens = getAuthTokenForRegistry(registry);
563
+ authTokens.forEach(({ keyName, val }) => {
564
+ res[keyName] = val;
565
+ });
566
+ if (registry.alwaysAuth) {
567
+ const nerfed = toNerfDart(registry.uri);
568
+ const alwaysAuthKeyName = `${nerfed}:always-auth`;
569
+ res[alwaysAuthKeyName] = true;
570
+ }
571
+ });
572
+ return res;
573
+ }
574
+
575
+ function getAuthTokenForRegistry(registry: Registry, isDefault = false): { keyName: string; val: string }[] {
576
+ const nerfed = toNerfDart(registry.uri);
577
+ if (registry.originalAuthType === 'authToken') {
578
+ return [
579
+ {
580
+ keyName: `${nerfed}:_authToken`,
581
+ val: registry.originalAuthValue || '',
582
+ },
583
+ ];
584
+ }
585
+ if (registry.originalAuthType === 'auth') {
586
+ return [
587
+ {
588
+ keyName: isDefault ? '_auth' : `${nerfed}:_auth`,
589
+ val: registry.originalAuthValue || '',
590
+ },
591
+ ];
592
+ }
593
+ if (registry.originalAuthType === 'user-pass') {
594
+ return [
595
+ {
596
+ keyName: `${nerfed}:username`,
597
+ val: registry.originalAuthValue?.split(':')[0] || '',
598
+ },
599
+ {
600
+ keyName: `${nerfed}:_password`,
601
+ val: registry.originalAuthValue?.split(':')[1] || '',
602
+ },
603
+ ];
604
+ }
605
+ return [];
606
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/pnpm",
3
- "version": "1.0.107",
3
+ "version": "1.0.108",
4
4
  "homepage": "https://bit.cloud/teambit/dependencies/pnpm",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.dependencies",
8
8
  "name": "pnpm",
9
- "version": "1.0.107"
9
+ "version": "1.0.108"
10
10
  },
11
11
  "dependencies": {
12
12
  "@pnpm/config": "20.2.0",
@@ -34,33 +34,29 @@
34
34
  "@pnpm/list": "^9.1.7",
35
35
  "@pnpm/modules-yaml": "12.1.5",
36
36
  "@pnpm/reviewing.dependencies-hierarchy": "^2.1.6",
37
- "core-js": "^3.0.0",
38
- "@babel/runtime": "7.20.0",
39
37
  "@teambit/bit-error": "0.0.404",
40
38
  "@teambit/harmony": "0.4.6",
41
39
  "@teambit/ui-foundation.ui.use-box.menu": "1.0.7",
42
- "@teambit/dependency-resolver": "1.0.107",
43
- "@teambit/logger": "0.0.932",
44
- "@teambit/cli": "0.0.839",
45
- "@teambit/component": "1.0.107",
46
- "@teambit/ui": "1.0.107"
40
+ "@teambit/dependency-resolver": "1.0.108",
41
+ "@teambit/logger": "0.0.933",
42
+ "@teambit/cli": "0.0.840",
43
+ "@teambit/component": "1.0.108",
44
+ "@teambit/ui": "1.0.108"
47
45
  },
48
46
  "devDependencies": {
49
47
  "@types/lodash": "4.14.165",
50
48
  "@types/semver": "7.3.4",
51
49
  "@types/fs-extra": "9.0.7",
52
- "@types/react": "^17.0.8",
53
50
  "@types/mocha": "9.1.0",
54
- "@types/node": "12.20.4",
55
- "@types/react-dom": "^17.0.5",
56
- "@types/jest": "^26.0.0",
57
- "@types/testing-library__jest-dom": "5.9.5",
51
+ "@types/jest": "^29.2.2",
52
+ "@types/testing-library__jest-dom": "^5.9.5",
53
+ "@teambit/harmony.envs.core-aspect-env": "0.0.13",
58
54
  "@teambit/dependencies.aspect-docs.pnpm": "0.0.165"
59
55
  },
60
56
  "peerDependencies": {
61
- "@teambit/legacy": "1.0.624",
62
- "react": "^16.8.0 || ^17.0.0",
63
- "react-dom": "^16.8.0 || ^17.0.0"
57
+ "react": "^17.0.0 || ^18.0.0",
58
+ "@types/react": "^18.2.12",
59
+ "@teambit/legacy": "1.0.624"
64
60
  },
65
61
  "license": "Apache-2.0",
66
62
  "optionalDependencies": {},
@@ -74,7 +70,7 @@
74
70
  },
75
71
  "private": false,
76
72
  "engines": {
77
- "node": ">=12.22.0"
73
+ "node": ">=16.0.0"
78
74
  },
79
75
  "repository": {
80
76
  "type": "git",
@@ -83,12 +79,9 @@
83
79
  "keywords": [
84
80
  "bit",
85
81
  "bit-aspect",
82
+ "bit-core-aspect",
86
83
  "components",
87
84
  "collaboration",
88
- "web",
89
- "react",
90
- "react-components",
91
- "angular",
92
- "angular-components"
85
+ "web"
93
86
  ]
94
87
  }