Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3d3660f
deps: migrate pnpm internals to v12
zkochan Jul 15, 2026
aacaa7f
Merge remote-tracking branch 'upstream/master' into pnpm11-fresh
zkochan Jul 21, 2026
dda3274
Merge branch 'master' into pnpm11-fresh
zkochan Jul 21, 2026
ba15aca
Merge upstream/master and update @pnpm/napi to 12.0.0-beta.0
zkochan Jul 29, 2026
6a74c76
fix(pnpm): support v12 network config shape
zkochan Jul 29, 2026
a0b09ad
fix(pnpm): trust lockfile during lynx installs
zkochan Jul 29, 2026
6ba5db3
fix(pnpm): install peers for dependency-free workspace projects
zkochan Jul 29, 2026
721951b
fix: stop overriding the package manager's network concurrency default
zkochan Jul 30, 2026
74230ec
fix: update @pnpm/cli.default-reporter to stop duplicated output lines
zkochan Jul 30, 2026
1088d53
fix: send registry auth headers to the pnpm engine
zkochan Jul 30, 2026
c18f3a8
fix: disable minimumReleaseAge unless the workspace configures it
zkochan Jul 30, 2026
ca3088b
fix: forward dedupePeers to the pnpm engine
zkochan Jul 30, 2026
a3c10a0
Merge remote-tracking branch 'upstream/master' into pnpm11-fresh
zkochan Jul 30, 2026
1c08ec7
chore: update @pnpm/napi to 12.0.0-beta.1 and drop engine workarounds
zkochan Jul 30, 2026
4bcf2b4
fix: record npmjs integrity for @pnpm packages resolved before the re…
zkochan Jul 30, 2026
b00274e
refactor: read pnpm config through the napi engine
zkochan Jul 30, 2026
22889f6
chore: update @pnpm/napi to 12.0.0-beta.2 and read config through the…
zkochan Jul 30, 2026
ecf0d52
chore: resolve the @pnpm scope from the bit.cloud mirror again
zkochan Jul 30, 2026
e984543
Merge remote-tracking branch 'upstream/master' into pnpm11-fresh
zkochan Jul 30, 2026
24da2db
chore: refresh lockfile after the upstream merge
zkochan Jul 30, 2026
48f886c
fix: finish the config.reader removal in the pnpm component
zkochan Jul 31, 2026
80abc7c
fix: forward network config to peer-issue queries, prune graphs itera…
zkochan Jul 31, 2026
71e45eb
fix: address the verified review findings across the dependency graph…
zkochan Jul 31, 2026
9b1ec1d
fix: prune lockfile entries with an explicit stack
zkochan Jul 31, 2026
e3761d5
fix(e2e): cap spawned bit children's JS heap instead of inheriting th…
zkochan Jul 31, 2026
16a8488
Merge remote-tracking branch 'upstream/master' into pnpm11-fresh
zkochan Jul 31, 2026
dc08413
chore: refresh lockfile after the upstream merge
zkochan Jul 31, 2026
b2920a1
fix: satisfy the import-type lint and fit the deep-chain test in the …
zkochan Jul 31, 2026
f0d4261
fix: harden the child heap cap and prune converter lockfile entries i…
zkochan Jul 31, 2026
d393ee0
fix: skip importer refs that have no registry form instead of asserting
zkochan Jul 31, 2026
27c26fb
fix(pkg): require the pnpm engine lazily in the packer
zkochan Jul 31, 2026
5330745
fix(pnpm): require the resolver factory lazily
zkochan Jul 31, 2026
6908795
fix: accept unversioned and scoped npm: aliases in version validation
zkochan Jul 31, 2026
0ab9444
chore: update the default reporter and drop the env-replace override
zkochan Jul 31, 2026
c2ab6a1
ci: force the mirror-available @pnpm util versions in the bvm bundle …
zkochan Jul 31, 2026
ae65b53
docs(pnpm): note why the TLS fields need no explicit-settings gate
zkochan Jul 31, 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
83 changes: 75 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ commands:
cd <<parameters.directory>> &&
pnpm init &&
echo "node-linker=hoisted" >> .npmrc &&
echo "package-import-method=copy" >> .npmrc &&
echo "registry=https://node-registry.bit.cloud" >> .npmrc &&
echo "user-agent=bvm-bundle-circleci" >> .npmrc &&
pnpm dlx @ialdama/jsonmod --key pnpm.overrides.uri-js --values npm:uri-js-replace &&
Expand All @@ -115,6 +116,8 @@ commands:
pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.postcss@8" --values "^8.4.19" &&
pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.ajv@6" --values "^6.12.6" &&
pnpm dlx json -I -f package.json -e "this.pnpm.overrides['@teambit/semantics.entities.semantic-schema']='^0.0.99'" &&
pnpm dlx json -I -f package.json -e "this.pnpm.overrides['@pnpm/util.lex-comparator']='3.0.2'" &&
pnpm dlx json -I -f package.json -e "this.pnpm.overrides['@pnpm/config.nerf-dart']='1.0.1'" &&
pnpm add @teambit/bit --os=<<parameters.os>> --cpu=<<parameters.cpu>>

# Bundle installation for Windows (with Windows-specific configs)
Expand All @@ -133,6 +136,7 @@ commands:
cd <<parameters.directory>> &&
pnpm init &&
echo "node-linker=hoisted" >> .npmrc &&
echo "package-import-method=copy" >> .npmrc &&
echo "registry=https://node-registry.bit.cloud" >> .npmrc &&
echo "user-agent=bvm-bundle-circleci" >> .npmrc &&
echo "prefer-symlinked-executables=false" >> .npmrc &&
Expand All @@ -145,8 +149,58 @@ commands:
pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.postcss@8" --values "^8.4.19" &&
pnpm dlx @ialdama/jsonmod --key "pnpm.overrides.ajv@6" --values "^6.12.6" &&
pnpm dlx json -I -f package.json -e "this.pnpm.overrides['@teambit/semantics.entities.semantic-schema']='^0.0.99'" &&
pnpm dlx json -I -f package.json -e "this.pnpm.overrides['@pnpm/util.lex-comparator']='3.0.2'" &&
pnpm dlx json -I -f package.json -e "this.pnpm.overrides['@pnpm/config.nerf-dart']='1.0.1'" &&
pnpm add @teambit/bit --os=win32 --cpu=<<parameters.cpu>>

verify_pnpm_napi_bundle:
parameters:
package:
type: string
directory:
type: string
default: "bit-${BIT_VERSION}"
steps:
- run:
name: verify @pnpm/<<parameters.package>> native binary
command: |
cd <<parameters.directory>>
PNPM_NAPI_PACKAGE="<<parameters.package>>" node \<<'NODE'
const fs = require('fs');
Comment thread
zkochan marked this conversation as resolved.
Resolved
const path = require('path');

const packageName = process.env.PNPM_NAPI_PACKAGE;
const candidates = [
path.join(process.cwd(), 'node_modules', '@pnpm', packageName, 'pnpm-napi.node'),
path.join(process.cwd(), 'node_modules', '.pnpm', 'node_modules', '@pnpm', packageName, 'pnpm-napi.node'),
];
const found = candidates.find((candidate) => fs.existsSync(candidate));
if (found) {
console.log(`Found @pnpm/${packageName} native binary at ${path.relative(process.cwd(), found)}`);
process.exit(0);
}

const installedPackages = [];
for (const baseDir of [
path.join(process.cwd(), 'node_modules', '@pnpm'),
path.join(process.cwd(), 'node_modules', '.pnpm', 'node_modules', '@pnpm'),
]) {
if (!fs.existsSync(baseDir)) continue;
for (const entry of fs.readdirSync(baseDir)) {
if (entry.startsWith('napi.')) installedPackages.push(path.relative(process.cwd(), path.join(baseDir, entry)));
}
}

console.error(`Missing @pnpm/${packageName}/pnpm-napi.node in Bit CLI bundle`);
console.error(`Checked:\n${candidates.map((candidate) => ` - ${path.relative(process.cwd(), candidate)}`).join('\n')}`);
console.error(
installedPackages.length
? `Installed @pnpm/napi platform packages:\n${installedPackages.map((pkg) => ` - ${pkg}`).join('\n')}`
: 'No @pnpm/napi platform packages were found'
);
process.exit(1);
NODE

# Bit configuration
bit_config:
parameters:
Expand Down Expand Up @@ -307,6 +361,7 @@ commands:
--exclude=bit-${BIT_VERSION}/.npmrc
--exclude=bit-${BIT_VERSION}/package.json
--exclude=bit-${BIT_VERSION}/pnpm-lock.yaml
--exclude=bit-${BIT_VERSION}/pnpm-workspace.yaml
bit-${BIT_VERSION}

# Docker commands
Expand Down Expand Up @@ -496,6 +551,7 @@ commands:
# The timings manifest is derived from actual CI node run times; refresh it occasionally
# with: node scripts/generate-e2e-timings.js
command: 'cd bit && node scripts/split-e2e-tests.js | xargs npm run mocha-circleci << parameters.bit_bin >>'
no_output_timeout: '50m'
environment:
MOCHA_FILE: junit/e2e-test-results.xml
when: always
Expand Down Expand Up @@ -967,6 +1023,8 @@ jobs:
- setup_bit_version
- setup_pnpm
- install_bit_bundle
- verify_pnpm_napi_bundle:
package: "napi.linux-x64"
- optimize_node_modules
- run:
name: copy lockfile
Expand All @@ -976,10 +1034,12 @@ jobs:
name: move to linux folder
command: mkdir linux && mv bit-${BIT_VERSION}.tar.gz linux/bit-${BIT_VERSION}.tar.gz
- run:
name: install bit for Linux arm64
command: >
cd bit-${BIT_VERSION} &&
pnpm install --os=linux --cpu=arm64
name: reset bundle directory for Linux arm64
command: rm -rf bit-${BIT_VERSION} && mkdir bit-${BIT_VERSION}
- install_bit_bundle:
cpu: "arm64"
- verify_pnpm_napi_bundle:
package: "napi.linux-arm64"
- optimize_node_modules:
platform: arm64
- compress_bit
Expand Down Expand Up @@ -1012,16 +1072,21 @@ jobs:
- setup_pnpm
- install_bit_bundle:
os: "darwin"
- verify_pnpm_napi_bundle:
package: "napi.darwin-x64"
- optimize_node_modules
- compress_bit
- run:
name: move to macos folder
command: mkdir macos && mv bit-${BIT_VERSION}.tar.gz macos/bit-${BIT_VERSION}.tar.gz
- run:
name: install bit for macOS arm64
command: >
cd bit-${BIT_VERSION} &&
pnpm install --os=darwin --cpu=arm64
name: reset bundle directory for macOS arm64
command: rm -rf bit-${BIT_VERSION} && mkdir bit-${BIT_VERSION}
- install_bit_bundle:
os: "darwin"
cpu: "arm64"
- verify_pnpm_napi_bundle:
package: "napi.darwin-arm64"
- optimize_node_modules:
platform: arm64
- compress_bit
Expand Down Expand Up @@ -1050,6 +1115,8 @@ jobs:
- setup_bit_version
- setup_pnpm
- install_bit_bundle_windows
- verify_pnpm_napi_bundle:
package: "napi.win32-x64"
- optimize_node_modules
- compress_bit
- run:
Expand Down
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
28 changes: 27 additions & 1 deletion components/legacy/e2e-helper/e2e-command-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ export default class CommandHelper {
if (isBitCommand) cmd = cmd.replace('bit', this.bitBin);
const featuresTogglePrefix = isBitCommand ? this._getFeatureToggleCmdPrefix(overrideFeatures) : '';
const cmdWithFeatures = featuresTogglePrefix + cmd;
const env = envVariables ? { ...process.env, ...envVariables } : undefined;
const env = {
...process.env,
...envVariables,
...childNodeOptions(envVariables?.NODE_OPTIONS ?? process.env.NODE_OPTIONS),
};
if (this.debugMode) console.log(rightpad(chalk.green('command: '), 20, ' '), cmdWithFeatures); // eslint-disable-line no-console
// `spawnSync` gets the data from stderr, `shell: true` is needed for Windows to get the output.
const cmdOutput = getStderrAsPartOfTheOutput
Expand Down Expand Up @@ -1033,3 +1037,25 @@ export default class CommandHelper {
return JSON.parse(result);
}
}

/**
* The e2e runner is started with a large `--max-old-space-size` (5GB on CI),
* and spawned `bit` children inherit it through NODE_OPTIONS. V8 grows its
* heap toward whatever it is allowed before applying real GC pressure, so a
* single child can balloon past the CI container's memory limit and get
* OOM-killed even though it runs fine in a fraction of that. Cap children to
* a size that fits the container instead of the runner's allowance.
*/
function childNodeOptions(nodeOptions: string | undefined): { NODE_OPTIONS: string } {
const tokens = (nodeOptions ?? '').split(/\s+/).filter(Boolean);
const withoutHeapCap: string[] = [];
for (let i = 0; i < tokens.length; i += 1) {
if (tokens[i] === '--max-old-space-size') {
i += 1; // the split flag form carries its value in the next token
continue;
}
if (tokens[i].startsWith('--max-old-space-size=')) continue;
withoutHeapCap.push(tokens[i]);
}
return { NODE_OPTIONS: [...withoutHeapCap, '--max-old-space-size=2048'].join(' ') };
}
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 @@ -79,6 +78,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
25 changes: 17 additions & 8 deletions e2e/harmony/dependency-resolver.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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 yaml from 'js-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 +13,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 Expand Up @@ -491,16 +496,20 @@ describe('dependency-resolver extension', function () {
it('should be able to install the env on a new workspace with no errors and install the latest of the pkg dep', () => {
helper.scopeHelper.reInitWorkspace();
helper.scopeHelper.addRemoteScope();
helper.extensions.workspaceJsonc.addKeyValToDependencyResolver('minimumReleaseAge', 0);
helper.command.install(helper.general.getPackageNameByCompName('empty-env'));

const envPkgJson = helper.fs.readJsonFile(
`node_modules/${helper.general.getPackageNameByCompName('empty-env')}/package.json`
);
const envPackageName = helper.general.getPackageNameByCompName('empty-env');
const envPkgJsonPath = `node_modules/${envPackageName}/package.json`;
const envPkgJson = helper.fs.readJsonFile(envPkgJsonPath);
expect(envPkgJson.dependencies[examplePkg]).to.equal('*');

const pkgJsonPath = path.join('node_modules', '.pnpm/@[email protected]/node_modules/@ci/lodash/package.json');
const pkgJson = helper.fs.readJsonFile(pkgJsonPath);
expect(pkgJson.version).to.equal('0.0.2');
const lockfile = yaml.load(fs.readFileSync(path.join(helper.scopes.localPath, 'pnpm-lock.yaml'), 'utf8')) as any;
const envSnapshot = Object.entries(lockfile.snapshots).find(([depPath]) =>
depPath.startsWith(`${envPackageName}@0.0.2`)
)?.[1] as any;
expect(lockfile.packages).to.have.property(`${examplePkg}@0.0.2`);
expect(envSnapshot?.dependencies?.[examplePkg]).to.equal('0.0.2');
});
});
});
Expand Down
14 changes: 6 additions & 8 deletions e2e/harmony/deps-graph-reimport.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ chai.use(chaiFs);
npmCiRegistry.configureCustomNameInPackageJsonHarmony(name);
await npmCiRegistry.init();
npmCiRegistry.setRegistry();
helper.extensions.workspaceJsonc.addKeyValToDependencyResolver('minimumReleaseAge', 0);
helper.env.setCustomNewEnv(
undefined,
undefined,
Expand Down Expand Up @@ -65,6 +66,7 @@ chai.use(chaiFs);
helper.scopeHelper.reInitWorkspace();
helper.scopeHelper.addRemoteScope();
npmCiRegistry.setRegistry();
helper.extensions.workspaceJsonc.addKeyValToDependencyResolver('minimumReleaseAge', 0);
helper.extensions.workspaceJsonc.addKeyValToDependencyResolver('rootComponents', true);
helper.command.import(`${helper.scopes.remote}/[email protected] ${helper.scopes.remote}/comp2@latest`);

Expand Down Expand Up @@ -96,6 +98,7 @@ chai.use(chaiFs);
npmCiRegistry.configureCustomNameInPackageJsonHarmony(name);
await npmCiRegistry.init();
npmCiRegistry.setRegistry();
helper.extensions.workspaceJsonc.addKeyValToDependencyResolver('minimumReleaseAge', 0);
helper.env.setCustomNewEnv(
undefined,
undefined,
Expand Down Expand Up @@ -128,6 +131,7 @@ chai.use(chaiFs);
helper.scopeHelper.reInitWorkspace();
helper.scopeHelper.addRemoteScope();
npmCiRegistry.setRegistry();
helper.extensions.workspaceJsonc.addKeyValToDependencyResolver('minimumReleaseAge', 0);
helper.fs.createFile('foo', 'foo.js', `require("@pnpm.e2e/abc"); require("@ci/${randomStr}.bar");`);
helper.command.addComponent('foo');
helper.extensions.addExtensionToVariant('foo', `${helper.scopes.remote}/custom-env/[email protected]`, {});
Expand All @@ -143,6 +147,7 @@ chai.use(chaiFs);
helper.scopeHelper.reInitWorkspace();
helper.scopeHelper.addRemoteScope();
npmCiRegistry.setRegistry();
helper.extensions.workspaceJsonc.addKeyValToDependencyResolver('minimumReleaseAge', 0);
helper.fs.createFile('baz', 'baz.js', `require("@pnpm.e2e/abc"); require("@ci/${randomStr}.bar");`);
helper.command.addComponent('baz');
helper.extensions.addExtensionToVariant('baz', `${helper.scopes.remote}/custom-env/[email protected]`, {});
Expand All @@ -153,6 +158,7 @@ chai.use(chaiFs);
helper.scopeHelper.reInitWorkspace();
helper.scopeHelper.addRemoteScope();
npmCiRegistry.setRegistry();
helper.extensions.workspaceJsonc.addKeyValToDependencyResolver('minimumReleaseAge', 0);
helper.command.import(
`${helper.scopes.remote}/foo@latest ${helper.scopes.remote}/bar@latest ${helper.scopes.remote}/baz@latest`
);
Expand All @@ -171,13 +177,5 @@ chai.use(chaiFs);
expect(lockfile.packages).to.have.property('@pnpm.e2e/[email protected]');
expect(lockfile.packages).to.have.property('@pnpm.e2e/[email protected]');
});
// Documents a known limitation of the merge: highest-wins is applied only to the root
// edge. Transitive snapshots from lower-version graphs still reference the older
// versions of non-peer packages, so pnpm retains them in the lockfile. (Peer versions
// get reconciled across the workspace at install time, so they don't leak; regular
// dependencies do.)
it('currently leaves the lower version of non-peer transitives in the lockfile', () => {
expect(lockfile.packages).to.have.property('@pnpm.e2e/[email protected]');
});
});
});
Loading