Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
99b6763
deps: migrate pnpm internals to v11 (1100.x)
zkochan Apr 14, 2026
6a44184
fix: drop unused authConfig in lynx install flow
zkochan Apr 14, 2026
d42e6e3
fix: make PeerDependencyIssuesByProjects a type-only import
zkochan Apr 14, 2026
e58ce80
fix: drop @pnpm/error import from pnpm-error spec (v11 ESM compatibil…
zkochan Apr 14, 2026
264ee81
fix: avoid ESM imports in CJS tests for pnpm v11 compat
zkochan Apr 14, 2026
9fa93e8
test(pnpm): drop unit specs blocked by v11 ESM-in-capsule incompat
zkochan Apr 14, 2026
80f5e29
test: skip .npmrc hoist-pattern test obsoleted by pnpm v11
zkochan Apr 14, 2026
6a8fdbe
fix: respect neverBuiltDependencies via allowBuilds in pnpm v11
zkochan Apr 14, 2026
7d571e3
fix: preserve neverBuiltDependencies override in v11 allowBuild flow
zkochan Apr 14, 2026
00071a5
fix: load @pnpm/releasing.commands via dynamic import in packer
zkochan Apr 14, 2026
0dfd7ae
fix: bypass babel import() transform in packer
zkochan Apr 14, 2026
231f3c8
chore: drop new Function() import workaround via babel preset-env exc…
zkochan Apr 30, 2026
2e6fe4b
refactor: replace ESM workarounds in tests with dynamic import()
zkochan Apr 30, 2026
e6ca4a7
fix(dep-resolver): make @teambit/legacy backward-compat link best-effort
zkochan May 5, 2026
39a2d4a
fix(lint): drop unreachable statements flagged by oxlint 1.62
zkochan May 5, 2026
ee23c8d
chore: refresh pnpm-lock after rebase + bit install
zkochan May 5, 2026
37f4352
fix(packer): load @pnpm/releasing.commands via a .cjs helper
zkochan May 5, 2026
dc64b1f
test(pnpm): rewrite hoist-pattern capsule test against pnpm-workspace…
zkochan May 5, 2026
b5a5332
chore: trim verbose comments left over from pnpm v11 migration
zkochan May 5, 2026
96a8f5e
test(pnpm): remove obsolete .npmrc hoist-pattern capsule test
zkochan May 5, 2026
22bbbe9
deps: bump @pnpm/* internals to highest 110x versions
zkochan May 5, 2026
8acfd2c
Revert "fix(dep-resolver): make @teambit/legacy backward-compat link …
zkochan May 5, 2026
c811bd5
Revert "test(pnpm): drop unit specs blocked by v11 ESM-in-capsule inc…
zkochan May 5, 2026
e492234
test(pnpm): drop lockfile-deps-graph-converter spec (capsule still tr…
zkochan May 5, 2026
5b4142c
test(pnpm): override @babel/register to ^7.28 and restore lockfile spec
zkochan May 5, 2026
15315ab
refactor(pnpm): use upstream getNetworkConfigs/getDefaultCreds
zkochan May 5, 2026
5e43dc3
test(pnpm): drop lockfile spec & @babel/register override
zkochan May 5, 2026
b9d14f9
test(pnpm): restore lockfile-deps-graph-converter spec via init() pat…
zkochan May 5, 2026
2f1811d
Merge branch 'master' into pnpm11
zkochan May 6, 2026
ff31aa8
address copilot review
zkochan May 6, 2026
e890532
deps: bump @pnpm/* internals to latest 110x versions
zkochan May 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = function (api) {
},
useBuiltIns: 'usage',
corejs: 3,
exclude: ['@babel/plugin-transform-dynamic-import'],
},
],
];
Expand Down
2 changes: 1 addition & 1 deletion components/legacy/e2e-helper/npm-ci-registry.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint no-console: 0 */
import { addUser, REGISTRY_MOCK_PORT, start as startRegistryMock, prepare } from '@pnpm/registry-mock';
import type { ChildProcess } from 'child_process';
import { fetch } from '@pnpm/fetch';
import fs from 'fs-extra';
import execa from 'execa';
import * as path from 'path';
Expand Down Expand Up @@ -69,6 +68,7 @@ export class NpmCiRegistry {
resolved = true;
let fetchResults;
try {
const { fetch } = await import('@pnpm/network.fetch');
fetchResults = await fetch(`http://localhost:${REGISTRY_MOCK_PORT}/is-odd`, {
retry: {
minTimeout: 1000,
Expand Down
8 changes: 6 additions & 2 deletions e2e/harmony/dependency-resolver.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import chai, { expect } from 'chai';
import path from 'path';
import fs from 'fs-extra';
import type { Modules } from '@pnpm/modules-yaml';
import { readModulesManifest } from '@pnpm/modules-yaml';
import type { Modules } from '@pnpm/installing.modules-yaml';
import { generateRandomStr } from '@teambit/toolbox.string.random';
import rimraf from 'rimraf';
import { Extensions } from '@teambit/legacy.constants';
Expand All @@ -13,6 +12,11 @@ chai.use(chaiFs);

chai.use(assertArrays);

async function readModulesManifest(modulesDir: string): Promise<Modules | null> {
const m = await import('@pnpm/installing.modules-yaml');
return m.readModulesManifest(modulesDir);
}

describe('dependency-resolver extension', function () {
let helper: Helper;
this.timeout(0);
Expand Down
30 changes: 3 additions & 27 deletions e2e/harmony/pkg-manager-config.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import path from 'path';
import chai, { expect } from 'chai';
import { readModulesManifest } from '@pnpm/modules-yaml';
import chaiString from 'chai-string';

import { Helper, NpmCiRegistry, supportNpmCiRegistryTesting } from '@teambit/legacy.e2e-helper';
import chaiFs from 'chai-fs';
import { Helper, NpmCiRegistry, supportNpmCiRegistryTesting } from '@teambit/legacy.e2e-helper';

chai.use(chaiFs);
chai.use(chaiString);

(supportNpmCiRegistryTesting ? describe : describe.skip)(
'package manager rc file is read from the workspace directory when installation is in a capsule',
'workspace .yarnrc.yml is read by Yarn when installation is in a capsule',
function () {
this.timeout(0);
Comment on lines 10 to 13
let helper: Helper;
Expand Down Expand Up @@ -66,29 +65,6 @@ chai.use(chaiString);
expect(isPositivePath).to.be.a.path();
});
});
describe('using pnpm', () => {
before(() => {
helper.scopeHelper.reInitWorkspace({
npmrcConfig: {
'hoist-pattern[]': 'foo',
},
});
helper.extensions.workspaceJsonc.addKeyValToDependencyResolver('packageManager', `teambit.dependencies/pnpm`);
helper.scopeHelper.addRemoteScope();
helper.workspaceJsonc.setupDefault();
helper.fixtures.populateComponents(1);
helper.extensions.addExtensionToVariant('comp1', `${envId1}@0.0.1`);
helper.capsules.removeScopeAspectCapsules();
helper.command.status(); // populate capsules.
});
it('workspace .npmrc is taken into account when running install in the capsule', async () => {
const { scopeAspectsCapsulesRootDir } = helper.command.capsuleListParsed();
const modulesState = await readModulesManifest(
path.join(scopeAspectsCapsulesRootDir, `${helper.scopes.remote}_node-env-1@0.0.1/node_modules`)
);
expect(modulesState?.hoistPattern?.[0]).to.eq('foo');
});
});
after(() => {
npmCiRegistry.destroy();
});
Comment on lines 68 to 70
Expand Down
8 changes: 6 additions & 2 deletions e2e/harmony/pnpm-default-hoisting.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { expect } from 'chai';
import path from 'path';
import type { Modules } from '@pnpm/modules-yaml';
import { readModulesManifest } from '@pnpm/modules-yaml';
import type { Modules } from '@pnpm/installing.modules-yaml';
import { Helper } from '@teambit/legacy.e2e-helper';

async function readModulesManifest(modulesDir: string): Promise<Modules | null> {
const m = await import('@pnpm/installing.modules-yaml');
return m.readModulesManifest(modulesDir);
}

describe('pnpm install with default settings', function () {
let helper: Helper;
let modulesState: Modules | null;
Expand Down
9,175 changes: 5,359 additions & 3,816 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion scopes/component/modules/merge-helper/merge-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,5 @@ export async function mergeFiles({
${chalk.bold('command:')} ${err.command}
${chalk.bold('message:')} ${err.message}
${chalk.bold('original error:')} ${err.stderr}`);
throw err;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import fs from 'fs-extra';
import { assign, parse } from 'comment-json';
import { ComponentID } from '@teambit/component-id';
import { readCAFileSync } from '@pnpm/network.ca-file';
import { parseBareSpecifier } from '@pnpm/npm-resolver';
import { parseBareSpecifier } from '@pnpm/resolving.npm-resolver';
import type { SourceFile } from '@teambit/component.sources';
import type { ProjectManifest, DependencyManifest } from '@pnpm/types';
import semver, { SemVer } from 'semver';
Expand Down
2 changes: 1 addition & 1 deletion scopes/dependencies/dependency-resolver/package-manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PeerDependencyIssuesByProjects } from '@pnpm/core';
import type { PeerDependencyIssuesByProjects } from '@pnpm/installing.deps-installer';
import type { PeerDependencyRules, ProjectManifest, DependencyManifest } from '@pnpm/types';
import type { ComponentID, ComponentMap, Component } from '@teambit/component';
import { type DependenciesGraph } from '@teambit/objects';
Expand Down
4 changes: 2 additions & 2 deletions scopes/dependencies/pnpm/get-proxy-config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { PackageManagerProxyConfig } from '@teambit/dependency-resolver';
import type { Config } from '@pnpm/config';
import type { Config } from '@pnpm/config.reader';

export function getProxyConfig(config: Config): PackageManagerProxyConfig {
const httpProxy = config.httpProxy;
const httpsProxy = config.httpsProxy || httpProxy;
const proxyConfig: PackageManagerProxyConfig = {
httpProxy,
httpsProxy,
noProxy: config.rawConfig.noproxy,
noProxy: config.authConfig.noproxy,
};
return proxyConfig;
}
Expand Down
10 changes: 5 additions & 5 deletions scopes/dependencies/pnpm/get-registries.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import getCredentialsByURI from 'credentials-by-uri';
import type { RegistriesMap } from '@teambit/dependency-resolver';
import { stripTrailingChar } from '@teambit/toolbox.string.strip-trailing-char';
import type { Config } from '@pnpm/config';
import type { Config } from '@pnpm/config.reader';
import { isEmpty } from 'lodash';
import toNerfDart from 'nerf-dart';

Expand All @@ -15,11 +15,11 @@ export function getRegistries(config: Config): RegistriesMap {

Object.keys(config.registries).forEach((regName) => {
const uri = config.registries[regName];
let credentials = getCredentialsByURI(config.rawConfig, uri);
let originalAuthConfig = getOriginalAuthConfigByUri(config.rawConfig, uri);
let credentials = getCredentialsByURI(config.authConfig, uri);
let originalAuthConfig = getOriginalAuthConfigByUri(config.authConfig, uri);
if (isEmpty(credentials)) {
credentials = getCredentialsByURI(config.rawConfig, switchTrailingSlash(uri));
originalAuthConfig = getOriginalAuthConfigByUri(config.rawConfig, switchTrailingSlash(uri));
credentials = getCredentialsByURI(config.authConfig, switchTrailingSlash(uri));
originalAuthConfig = getOriginalAuthConfigByUri(config.authConfig, switchTrailingSlash(uri));
}
registriesMap[regName] = {
uri,
Expand Down
12 changes: 12 additions & 0 deletions scopes/dependencies/pnpm/load-pnpm-esm.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

// Native CJS so Babel's modules-commonjs transform leaves the import() alone.
// @pnpm/deps.path and @pnpm/lockfile.fs are ESM-only and must go through
// Node's ESM loader.
exports.loadEsm = async () => {
const [dp, lockfileFs] = await Promise.all([
import('@pnpm/deps.path'),
import('@pnpm/lockfile.fs'),
]);
return { dp, getLockfileImporterId: lockfileFs.getLockfileImporterId };
};
29 changes: 20 additions & 9 deletions scopes/dependencies/pnpm/lockfile-deps-graph-converter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import path from 'path';
import { ComponentID } from '@teambit/component';
import { DependenciesGraph, type PackagesMap, type DependencyEdge } from '@teambit/objects';
import { convertLockfileToGraph, convertGraphToLockfile } from './lockfile-deps-graph-converter';
import {
convertLockfileToGraph,
convertGraphToLockfile,
init as initLockfileDepsGraphConverter,
} from './lockfile-deps-graph-converter';
import { type BitLockfileFile } from './lynx';
import { expect } from 'chai';

before(async () => {
await initLockfileDepsGraphConverter();
});

describe('convertLockfileToGraph simple case', () => {
const lockfile: BitLockfileFile = {
bit: {
Expand Down Expand Up @@ -108,14 +116,17 @@ describe('convertLockfileToGraph simple case', () => {
},
},
};
const graph = convertLockfileToGraph(lockfile, {
pkgName: 'comp1',
componentRelativeDir: 'comps/comp1',
componentRootDir: 'node_modules/.bit_roots/env',
componentIdByPkgName: new Map([
['comp1', ComponentID.fromString('my-scope/comp1@1.0.0')],
['comp2', ComponentID.fromString('my-scope/comp2@1.0.0')],
]),
let graph: DependenciesGraph;
before(() => {
graph = convertLockfileToGraph(lockfile, {
pkgName: 'comp1',
componentRelativeDir: 'comps/comp1',
componentRootDir: 'node_modules/.bit_roots/env',
componentIdByPkgName: new Map([
['comp1', ComponentID.fromString('my-scope/comp1@1.0.0')],
['comp2', ComponentID.fromString('my-scope/comp2@1.0.0')],
]),
});
});
const expected = {
schemaVersion: '2.0',
Expand Down
30 changes: 25 additions & 5 deletions scopes/dependencies/pnpm/lockfile-deps-graph-converter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import path from 'path';
import { type ProjectManifest } from '@pnpm/types';
import { type LockfileFileProjectResolvedDependencies } from '@pnpm/lockfile.types';
import { type ResolveFunction } from '@pnpm/client';
import * as dp from '@pnpm/dependency-path';
import { type ResolveFunction } from '@pnpm/installing.client';
import type * as Dp from '@pnpm/deps.path';
import type { getLockfileImporterId as GetLockfileImporterId } from '@pnpm/lockfile.fs';
import { pick, partition } from 'lodash';
import { BitError } from '@teambit/bit-error';
import { snapToSemver } from '@teambit/component-package-version';
Expand All @@ -18,10 +19,29 @@ import {
type CalcDepsGraphForComponentOptions,
type ComponentIdByPkgName,
} from '@teambit/dependency-resolver';
import { getLockfileImporterId } from '@pnpm/lockfile.fs';
import normalizePath from 'normalize-path';
import { type BitLockfileFile } from './lynx';

// @pnpm/deps.path and @pnpm/lockfile.fs are ESM-only; load them through a .cjs
// shim so the require() chain in the build capsule's mocha runner doesn't trip
// on the transitive ESM import. Call `init()` once before invoking the public
// converters; helpers reach for these module-level slots synchronously.
let dp!: typeof Dp;
let getLockfileImporterId!: typeof GetLockfileImporterId;
let loading: Promise<void> | undefined;

export function init(): Promise<void> {
loading ??= (async () => {
const { loadEsm } = require('./load-pnpm-esm.cjs') as {
loadEsm: () => Promise<{ dp: typeof Dp; getLockfileImporterId: typeof GetLockfileImporterId }>;
};
const m = await loadEsm();
dp = m.dp;
getLockfileImporterId = m.getLockfileImporterId;
})();
return loading;
}

function convertLockfileToGraphFromCapsule(
lockfile: BitLockfileFile,
{
Expand Down Expand Up @@ -336,7 +356,7 @@ export async function convertGraphToLockfile(
);
if ('integrity' in resolution && resolution.integrity) {
lockfile.packages[pkgToResolve.pkgId].resolution = {
integrity: resolution.integrity,
integrity: resolution.integrity as string,
};
}
}
Expand Down Expand Up @@ -399,7 +419,7 @@ function getPkgsToResolve(lockfile: BitLockfileFile, manifests: Record<string, P
return pkgsToResolve;
}

function depPathToRef(depPath: dp.DependencyPath): string {
function depPathToRef(depPath: Dp.DependencyPath): string {
return `${depPath.version}${depPath.patchHash ?? ''}${depPath.peerDepGraphHash ?? ''}`;
}

Expand Down
Loading