mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-28 11:01:30 -04:00
## Summary Rename all internal packages so their npm names follow the `@pnpm/<domain>.<leaf>` convention, matching their directory structure. Also rename directories to remove redundancy and improve clarity. ### Bulk rename (94 packages) All `@pnpm/` packages now derive their name from their directory path using dot-separated segments. Exceptions: `packages/`, `__utils__/`, and `pnpm/artifacts/` keep leaf names only. ### Directory renames (removing redundant prefixes) - `cli/cli-meta` → `cli/meta`, `cli/cli-utils` → `cli/utils` - `config/config` → `config/reader`, `config/config-writer` → `config/writer` - `fetching/fetching-types` → `fetching/types` - `lockfile/lockfile-to-pnp` → `lockfile/to-pnp` - `store/store-connection-manager` → `store/connection-manager` - `store/store-controller-types` → `store/controller-types` - `store/store-path` → `store/path` ### Targeted renames (clarity improvements) - `deps/dependency-path` → `deps/path` (`@pnpm/deps.path`) - `deps/calc-dep-state` → `deps/graph-hasher` (`@pnpm/deps.graph-hasher`) - `deps/inspection/dependencies-hierarchy` → `deps/inspection/tree-builder` (`@pnpm/deps.inspection.tree-builder`) - `bins/link-bins` → `bins/linker`, `bins/remove-bins` → `bins/remover`, `bins/package-bins` → `bins/resolver` - `installing/get-context` → `installing/context` - `store/package-store` → `store/controller` - `pkg-manifest/manifest-utils` → `pkg-manifest/utils` ### Manifest reader/writer renames - `workspace/read-project-manifest` → `workspace/project-manifest-reader` (`@pnpm/workspace.project-manifest-reader`) - `workspace/write-project-manifest` → `workspace/project-manifest-writer` (`@pnpm/workspace.project-manifest-writer`) - `workspace/read-manifest` → `workspace/workspace-manifest-reader` (`@pnpm/workspace.workspace-manifest-reader`) - `workspace/manifest-writer` → `workspace/workspace-manifest-writer` (`@pnpm/workspace.workspace-manifest-writer`) ### Workspace package renames - `workspace/find-packages` → `workspace/projects-reader` - `workspace/find-workspace-dir` → `workspace/root-finder` - `workspace/resolve-workspace-range` → `workspace/range-resolver` - `workspace/filter-packages-from-dir` merged into `workspace/filter-workspace-packages` → `workspace/projects-filter` ### Domain moves - `pkg-manifest/read-project-manifest` → `workspace/project-manifest-reader` - `pkg-manifest/write-project-manifest` → `workspace/project-manifest-writer` - `pkg-manifest/exportable-manifest` → `releasing/exportable-manifest` ### Scope - 1206 files changed - Updated: package.json names/deps, TypeScript imports, tsconfig references, changeset files, renovate.json, test fixtures, import ordering
274 lines
6.8 KiB
TypeScript
274 lines
6.8 KiB
TypeScript
import { LOCKFILE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants'
|
|
import { addDependenciesToPackage, install } from '@pnpm/installing.deps-installer'
|
|
import { prepareEmpty } from '@pnpm/prepare'
|
|
import { getIntegrity } from '@pnpm/registry-mock'
|
|
import { rimrafSync } from '@zkochan/rimraf'
|
|
import { writeYamlFileSync } from 'write-yaml-file'
|
|
|
|
import { testDefaults } from '../utils/index.js'
|
|
|
|
const RESOLUTIONS = [
|
|
{
|
|
targets: [
|
|
{
|
|
os: 'darwin',
|
|
cpu: 'arm64',
|
|
},
|
|
],
|
|
resolution: {
|
|
type: 'binary',
|
|
archive: 'zip',
|
|
url: 'https://github.com/oven-sh/bun/releases/download/bun-v1.2.19/bun-darwin-aarch64.zip',
|
|
integrity: 'sha256-Z0pIN4NC76rcPCkVlrVzAQ88I4iVj3xEZ42H9vt1mZE=',
|
|
prefix: 'bun-darwin-aarch64',
|
|
bin: 'bun',
|
|
},
|
|
},
|
|
{
|
|
targets: [
|
|
{
|
|
os: 'darwin',
|
|
cpu: 'x64',
|
|
},
|
|
],
|
|
resolution: {
|
|
type: 'binary',
|
|
archive: 'zip',
|
|
url: 'https://github.com/oven-sh/bun/releases/download/bun-v1.2.19/bun-darwin-x64.zip',
|
|
integrity: 'sha256-39fkxHMRtdvTgjCzz9NX9dC+ro75eZYsW0EAj8QcJaA=',
|
|
prefix: 'bun-darwin-x64',
|
|
bin: 'bun',
|
|
},
|
|
},
|
|
{
|
|
targets: [
|
|
{
|
|
os: 'linux',
|
|
cpu: 'arm64',
|
|
libc: 'musl',
|
|
},
|
|
],
|
|
resolution: {
|
|
type: 'binary',
|
|
archive: 'zip',
|
|
url: 'https://github.com/oven-sh/bun/releases/download/bun-v1.2.19/bun-linux-aarch64-musl.zip',
|
|
integrity: 'sha256-ECBLT4ZeQCUI1pVr75O+Y11qek3cl0lCGxY2qseZZbY=',
|
|
prefix: 'bun-linux-aarch64-musl',
|
|
bin: 'bun',
|
|
},
|
|
},
|
|
{
|
|
targets: [
|
|
{
|
|
os: 'linux',
|
|
cpu: 'arm64',
|
|
},
|
|
],
|
|
resolution: {
|
|
type: 'binary',
|
|
archive: 'zip',
|
|
url: 'https://github.com/oven-sh/bun/releases/download/bun-v1.2.19/bun-linux-aarch64.zip',
|
|
integrity: 'sha256-/P1HHNvVp4/Uo5DinMzSu3AEpJ01K6A3rzth1P1dC4M=',
|
|
prefix: 'bun-linux-aarch64',
|
|
bin: 'bun',
|
|
},
|
|
},
|
|
{
|
|
targets: [
|
|
{
|
|
os: 'linux',
|
|
cpu: 'x64',
|
|
libc: 'musl',
|
|
},
|
|
],
|
|
resolution: {
|
|
type: 'binary',
|
|
archive: 'zip',
|
|
url: 'https://github.com/oven-sh/bun/releases/download/bun-v1.2.19/bun-linux-x64-musl.zip',
|
|
integrity: 'sha256-3M13Zi0KtkLSgO704yFtYCru4VGfdTXKHYOsqRjo/os=',
|
|
prefix: 'bun-linux-x64-musl',
|
|
bin: 'bun',
|
|
},
|
|
},
|
|
{
|
|
targets: [
|
|
{
|
|
os: 'linux',
|
|
cpu: 'x64',
|
|
},
|
|
],
|
|
resolution: {
|
|
type: 'binary',
|
|
archive: 'zip',
|
|
url: 'https://github.com/oven-sh/bun/releases/download/bun-v1.2.19/bun-linux-x64.zip',
|
|
integrity: 'sha256-w9PBTppeyD/2fQrP525DFa0G2p809Z/HsTgTeCyvH2Y=',
|
|
prefix: 'bun-linux-x64',
|
|
bin: 'bun',
|
|
},
|
|
},
|
|
{
|
|
targets: [
|
|
{
|
|
os: 'win32',
|
|
cpu: 'x64',
|
|
},
|
|
],
|
|
resolution: {
|
|
type: 'binary',
|
|
archive: 'zip',
|
|
url: 'https://github.com/oven-sh/bun/releases/download/bun-v1.2.19/bun-windows-x64.zip',
|
|
integrity: 'sha256-pIj0ZM5nsw4Ayw6lay9i5JuBw/zqe6kkYdNiJLBvdfg=',
|
|
prefix: 'bun-windows-x64',
|
|
bin: 'bun.exe',
|
|
},
|
|
},
|
|
]
|
|
|
|
test('installing Bun runtime', async () => {
|
|
const project = prepareEmpty()
|
|
const { updatedManifest: manifest } = await addDependenciesToPackage({}, ['bun@runtime:1.2.19'], testDefaults({ fastUnpack: false }))
|
|
|
|
project.isExecutable('.bin/bun')
|
|
expect(project.readLockfile()).toStrictEqual({
|
|
settings: {
|
|
autoInstallPeers: true,
|
|
excludeLinksFromLockfile: false,
|
|
},
|
|
importers: {
|
|
'.': {
|
|
dependencies: {
|
|
bun: {
|
|
specifier: 'runtime:1.2.19',
|
|
version: 'runtime:1.2.19',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
lockfileVersion: LOCKFILE_VERSION,
|
|
packages: {
|
|
'bun@runtime:1.2.19': {
|
|
hasBin: true,
|
|
resolution: {
|
|
type: 'variations',
|
|
variants: RESOLUTIONS,
|
|
},
|
|
version: '1.2.19',
|
|
},
|
|
},
|
|
snapshots: {
|
|
'bun@runtime:1.2.19': {},
|
|
},
|
|
})
|
|
|
|
rimrafSync('node_modules')
|
|
await install(manifest, testDefaults({ frozenLockfile: true }, {
|
|
offline: true, // We want to verify that Bun is resolved from cache.
|
|
}))
|
|
project.isExecutable('.bin/bun')
|
|
|
|
await addDependenciesToPackage(manifest, ['@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0'], testDefaults({ fastUnpack: false }))
|
|
project.has('@pnpm.e2e/dep-of-pkg-with-1-dep')
|
|
|
|
expect(project.readLockfile()).toStrictEqual({
|
|
settings: {
|
|
autoInstallPeers: true,
|
|
excludeLinksFromLockfile: false,
|
|
},
|
|
importers: {
|
|
'.': {
|
|
dependencies: {
|
|
bun: {
|
|
specifier: 'runtime:1.2.19',
|
|
version: 'runtime:1.2.19',
|
|
},
|
|
'@pnpm.e2e/dep-of-pkg-with-1-dep': {
|
|
specifier: '100.1.0',
|
|
version: '100.1.0',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
lockfileVersion: LOCKFILE_VERSION,
|
|
packages: {
|
|
'bun@runtime:1.2.19': {
|
|
hasBin: true,
|
|
resolution: {
|
|
type: 'variations',
|
|
variants: RESOLUTIONS,
|
|
},
|
|
version: '1.2.19',
|
|
},
|
|
'@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0': {
|
|
resolution: {
|
|
integrity: getIntegrity('@pnpm.e2e/dep-of-pkg-with-1-dep', '100.1.0'),
|
|
},
|
|
},
|
|
},
|
|
snapshots: {
|
|
'bun@runtime:1.2.19': {},
|
|
'@pnpm.e2e/dep-of-pkg-with-1-dep@100.1.0': {},
|
|
},
|
|
})
|
|
})
|
|
|
|
test('installing Bun runtime fails if offline mode is used and Bun not found locally', async () => {
|
|
prepareEmpty()
|
|
await expect(
|
|
addDependenciesToPackage({}, ['bun@runtime:1.2.19'], testDefaults({ fastUnpack: false }, { offline: true }))
|
|
).rejects.toThrow(/Failed to resolve bun@1.2.19 in package mirror/)
|
|
})
|
|
|
|
test('installing Bun runtime fails if integrity check fails', async () => {
|
|
prepareEmpty()
|
|
|
|
writeYamlFileSync(WANTED_LOCKFILE, {
|
|
settings: {
|
|
autoInstallPeers: true,
|
|
excludeLinksFromLockfile: false,
|
|
},
|
|
importers: {
|
|
'.': {
|
|
devDependencies: {
|
|
bun: {
|
|
specifier: 'runtime:1.2.19',
|
|
version: 'runtime:1.2.19',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
lockfileVersion: LOCKFILE_VERSION,
|
|
packages: {
|
|
'bun@runtime:1.2.19': {
|
|
hasBin: true,
|
|
resolution: {
|
|
type: 'variations',
|
|
variants: RESOLUTIONS.map((resolutionVariant) => ({
|
|
...resolutionVariant,
|
|
resolution: {
|
|
...resolutionVariant.resolution,
|
|
integrity: 'sha256-0000000000000000000000000000000000000000000=',
|
|
},
|
|
})),
|
|
},
|
|
version: '1.2.19',
|
|
},
|
|
},
|
|
snapshots: {
|
|
'bun@runtime:1.2.19': {},
|
|
},
|
|
}, {
|
|
lineWidth: -1,
|
|
})
|
|
|
|
const manifest = {
|
|
devDependencies: {
|
|
bun: 'runtime:1.2.19',
|
|
},
|
|
}
|
|
await expect(install(manifest, testDefaults({ frozenLockfile: true }, {
|
|
retry: {
|
|
retries: 0,
|
|
},
|
|
}))).rejects.toThrow(/Got unexpected checksum for/)
|
|
})
|