diff --git a/config/reader/src/Config.ts b/config/reader/src/Config.ts index ac529d45f4..256bbf20b5 100644 --- a/config/reader/src/Config.ts +++ b/config/reader/src/Config.ts @@ -246,7 +246,6 @@ export interface Config extends AuthInfo, OptionsFromRootManifest { export interface ConfigWithDeprecatedSettings extends Config { globalPrefix?: string proxy?: string - shamefullyFlatten?: boolean } export const PROJECT_CONFIG_FIELDS = [ diff --git a/config/reader/src/configFileKey.ts b/config/reader/src/configFileKey.ts index 6707242d13..74853d7b64 100644 --- a/config/reader/src/configFileKey.ts +++ b/config/reader/src/configFileKey.ts @@ -91,7 +91,6 @@ export const excludedPnpmKeys = [ 'link-workspace-packages', 'lockfile', 'lockfile-dir', - 'lockfile-directory', 'lockfile-include-tarball-url', 'lockfile-only', 'manage-package-manager-versions', @@ -117,7 +116,6 @@ export const excludedPnpmKeys = [ 'save-peer', 'save-workspace-protocol', 'script-shell', - 'shamefully-flatten', 'shamefully-hoist', 'shared-workspace-lockfile', 'shell-emulator', diff --git a/config/reader/src/index.ts b/config/reader/src/index.ts index a3e9bd4658..5f1e71cf16 100644 --- a/config/reader/src/index.ts +++ b/config/reader/src/index.ts @@ -119,9 +119,6 @@ export async function getConfig (opts: { if (cliOptions['shamefully-hoist'] === true) { throw new PnpmError('CONFIG_CONFLICT_HOIST', '--shamefully-hoist cannot be used with --no-hoist') } - if (cliOptions['shamefully-flatten'] === true) { - throw new PnpmError('CONFIG_CONFLICT_HOIST', '--shamefully-flatten cannot be used with --no-hoist') - } if (cliOptions['hoist-pattern']) { throw new PnpmError('CONFIG_CONFLICT_HOIST', '--hoist-pattern cannot be used with --no-hoist') } @@ -522,10 +519,6 @@ export async function getConfig (opts: { pnpmConfig.extraEnv['NODE_PATH'] = pathAbsolute(path.join(virtualStoreDir, 'node_modules'), cwd) } - if (pnpmConfig.shamefullyFlatten) { - warnings.push('The "shamefully-flatten" setting has been renamed to "shamefully-hoist". Also, in most cases you won\'t need "shamefully-hoist". Since v4, a semistrict node_modules structure is on by default (via hoist-pattern=[*]).') - pnpmConfig.shamefullyHoist = true - } if (!pnpmConfig.cacheDir) { pnpmConfig.cacheDir = getCacheDir(process) } diff --git a/config/reader/src/types.ts b/config/reader/src/types.ts index 695275a46b..82c1a02b26 100644 --- a/config/reader/src/types.ts +++ b/config/reader/src/types.ts @@ -58,7 +58,6 @@ export const pnpmTypes = { 'link-workspace-packages': [Boolean, 'deep'], lockfile: Boolean, 'lockfile-dir': String, - 'lockfile-directory': String, // TODO: deprecate 'lockfile-include-tarball-url': Boolean, 'lockfile-only': Boolean, loglevel: ['silent', 'error', 'warn', 'info', 'debug'], @@ -100,7 +99,6 @@ export const pnpmTypes = { 'save-catalog-name': String, 'save-workspace-protocol': Boolean, 'script-shell': String, - 'shamefully-flatten': Boolean, 'shamefully-hoist': Boolean, 'shared-workspace-lockfile': Boolean, 'shell-emulator': Boolean, diff --git a/config/reader/test/index.ts b/config/reader/test/index.ts index 9138f4a06d..d57656696d 100644 --- a/config/reader/test/index.ts +++ b/config/reader/test/index.ts @@ -534,26 +534,6 @@ test('extraBinPaths', async () => { } }) -test('convert shamefully-flatten to hoist-pattern=* and warn', async () => { - const { config, warnings } = await getConfig({ - cliOptions: { - 'shamefully-flatten': true, - }, - packageManager: { - name: 'pnpm', - version: '1.0.0', - }, - }) - - expect(config.hoistPattern).toStrictEqual(['*']) - expect(config.shamefullyHoist).toBeTruthy() - expect(warnings).toStrictEqual([ - 'The "shamefully-flatten" setting has been renamed to "shamefully-hoist". ' + - 'Also, in most cases you won\'t need "shamefully-hoist". ' + - 'Since v4, a semistrict node_modules structure is on by default (via hoist-pattern=[*]).', - ]) -}) - // hoist → hoistPattern processing is done in @pnpm/cli.utils test('hoist-pattern is unchanged if --no-hoist used', async () => { const { config } = await getConfig({ @@ -586,22 +566,6 @@ test('throw error if --no-hoist is used with --shamefully-hoist', async () => { }) }) -test('throw error if --no-hoist is used with --shamefully-flatten', async () => { - await expect(getConfig({ - cliOptions: { - hoist: false, - 'shamefully-flatten': true, - }, - packageManager: { - name: 'pnpm', - version: '1.0.0', - }, - })).rejects.toMatchObject({ - code: 'ERR_PNPM_CONFIG_CONFLICT_HOIST', - message: '--shamefully-flatten cannot be used with --no-hoist', - }) -}) - test('throw error if --no-hoist is used with --hoist-pattern', async () => { await expect(getConfig({ cliOptions: { diff --git a/fs/msgpack-file/README.md b/fs/msgpack-file/README.md deleted file mode 100644 index a9ab9841ac..0000000000 --- a/fs/msgpack-file/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# @pnpm/fs.msgpack-file - -> MessagePack file serialization utilities for pnpm - -[![npm version](https://img.shields.io/npm/v/@pnpm/fs.msgpack-file.svg)](https://www.npmjs.com/package/@pnpm/fs.msgpack-file) - -## Installation - -```sh -pnpm add @pnpm/fs.msgpack-file -``` - -## Usage - -```typescript -import { - readMsgpackFile, - readMsgpackFileSync, - writeMsgpackFile, - writeMsgpackFileSync, -} from '@pnpm/fs.msgpack-file' - -// Async -await writeMsgpackFile('data.mpk', { foo: 'bar' }) -const data = await readMsgpackFile('data.mpk') - -// Sync -writeMsgpackFileSync('data.mpk', { foo: 'bar' }) -const data = readMsgpackFileSync('data.mpk') -``` - -## Features - -- Uses [msgpackr](https://github.com/kriszyp/msgpackr) for fast MessagePack serialization -- Supports `Map` and `Set` types natively -- Record structure optimization enabled for 2-3x faster decoding - -## License - -MIT diff --git a/fs/msgpack-file/package.json b/fs/msgpack-file/package.json deleted file mode 100644 index d8cb60a27a..0000000000 --- a/fs/msgpack-file/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@pnpm/fs.msgpack-file", - "version": "1100.0.0-0", - "description": "Msgpack serialization utilities for pnpm cache files", - "keywords": [ - "pnpm", - "pnpm11" - ], - "license": "MIT", - "funding": "https://opencollective.com/pnpm", - "repository": "https://github.com/pnpm/pnpm/tree/main/fs/msgpack-file", - "homepage": "https://github.com/pnpm/pnpm/tree/main/fs/msgpack-file#readme", - "bugs": { - "url": "https://github.com/pnpm/pnpm/issues" - }, - "type": "module", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "exports": { - ".": "./lib/index.js" - }, - "files": [ - "lib", - "!*.map" - ], - "scripts": { - "compile": "tsgo --build && pnpm run lint --fix", - "watch": "tsgo --build --watch", - "prepublishOnly": "pnpm run compile", - "test": "pnpm run compile && pnpm run _test", - "lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"", - "_test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest" - }, - "dependencies": { - "@pnpm/fs.graceful-fs": "workspace:*", - "msgpackr": "catalog:" - }, - "devDependencies": { - "@pnpm/fs.msgpack-file": "workspace:*", - "tempy": "catalog:" - }, - "engines": { - "node": ">=22.13" - }, - "jest": { - "preset": "@pnpm/jest-config" - } -} diff --git a/fs/msgpack-file/src/index.ts b/fs/msgpack-file/src/index.ts deleted file mode 100644 index 635a544df7..0000000000 --- a/fs/msgpack-file/src/index.ts +++ /dev/null @@ -1,45 +0,0 @@ -import gfs from '@pnpm/fs.graceful-fs' -import { Packr } from 'msgpackr' - -/** - * Create a Packr instance with record structure optimization enabled. - * This provides 2-3x faster decoding performance by reusing object structures - * and using integer keys instead of string property names. - */ -const packr = new Packr({ - useRecords: true, - // moreTypes: true enables better type preservation for undefined, etc. - moreTypes: true, -}) - -/** - * Write data to a file in msgpack format (synchronous) - */ -export function writeMsgpackFileSync (filePath: string, data: unknown): void { - const buffer = packr.pack(data) - gfs.writeFileSync(filePath, buffer) -} - -/** - * Read msgpack data from a file (synchronous) - */ -export function readMsgpackFileSync (filePath: string): T { - const buffer = gfs.readFileSync(filePath) - return packr.unpack(buffer) as T -} - -/** - * Read msgpack data from a file (async) - */ -export async function readMsgpackFile (filePath: string): Promise { - const buffer = await gfs.readFile(filePath) - return packr.unpack(buffer) as T -} - -/** - * Write data to a file in msgpack format (async) - */ -export async function writeMsgpackFile (filePath: string, data: unknown): Promise { - const buffer = packr.pack(data) - await gfs.writeFile(filePath, buffer) -} diff --git a/fs/msgpack-file/test/index.test.ts b/fs/msgpack-file/test/index.test.ts deleted file mode 100644 index da7014e8c0..0000000000 --- a/fs/msgpack-file/test/index.test.ts +++ /dev/null @@ -1,89 +0,0 @@ -import fs from 'node:fs' - -import { - readMsgpackFile, - readMsgpackFileSync, - writeMsgpackFile, - writeMsgpackFileSync, -} from '@pnpm/fs.msgpack-file' -import { temporaryDirectory } from 'tempy' - -describe('msgpack-file', () => { - let tmpDir: string - - beforeEach(() => { - tmpDir = temporaryDirectory() - }) - - test('writeFileSync and readFileSync', () => { - const filePath = `${tmpDir}/test.mpk` - const data = { - foo: 'bar', - baz: 123, - nested: { - a: 1, - b: 2, - }, - } - - writeMsgpackFileSync(filePath, data) - expect(fs.existsSync(filePath)).toBe(true) - - const readData = readMsgpackFileSync(filePath) - expect(readData).toEqual(data) - }) - - test('writeFile and readFile (async)', async () => { - const filePath = `${tmpDir}/test-async.mpk` - const data = { - foo: 'bar', - baz: 123, - nested: { - a: 1, - b: 2, - }, - } - - await writeMsgpackFile(filePath, data) - expect(fs.existsSync(filePath)).toBe(true) - - const readData = await readMsgpackFile(filePath) - expect(readData).toEqual(data) - }) - - test('it should support Map and Set serialization (moreTypes: true)', () => { - const filePath = `${tmpDir}/map-set.mpk` - const data = { - map: new Map([['key1', 'value1'], ['key2', 'value2']]), - set: new Set([1, 2, 3, 3]), - } - - writeMsgpackFileSync(filePath, data) - const readData = readMsgpackFileSync(filePath) // eslint-disable-line @typescript-eslint/no-explicit-any - - expect(readData.map).toBeInstanceOf(Map) - expect(readData.map.get('key1')).toBe('value1') - expect(readData.set).toBeInstanceOf(Set) - expect(readData.set.has(1)).toBe(true) - expect(readData.set.size).toBe(3) - }) - - test('it should use record structures for optimization (useRecords: true)', () => { - const filePath = `${tmpDir}/records.mpk` - const structure = { name: 'pkg', version: '1.0.0' } - const data = [ - structure, - structure, - structure, - ] - - writeMsgpackFileSync(filePath, data) - const readData = readMsgpackFileSync(filePath) // eslint-disable-line @typescript-eslint/no-explicit-any - - expect(readData).toHaveLength(3) - expect(readData[0]).toEqual(structure) - expect(readData[2]).toEqual(structure) - }) -}) - - diff --git a/fs/msgpack-file/test/tsconfig.json b/fs/msgpack-file/test/tsconfig.json deleted file mode 100644 index 67ce5e1d0e..0000000000 --- a/fs/msgpack-file/test/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "noEmit": false, - "outDir": "../node_modules/.test.lib", - "rootDir": "..", - "isolatedModules": true - }, - "include": [ - "**/*.ts", - "../../../__typings__/**/*.d.ts" - ], - "references": [ - { - "path": ".." - } - ] -} diff --git a/fs/msgpack-file/tsconfig.json b/fs/msgpack-file/tsconfig.json deleted file mode 100644 index 98b41a9535..0000000000 --- a/fs/msgpack-file/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "@pnpm/tsconfig", - "compilerOptions": { - "outDir": "lib", - "rootDir": "src" - }, - "include": [ - "src/**/*.ts", - "../../__typings__/**/*.d.ts" - ], - "references": [ - { - "path": "../graceful-fs" - } - ] -} diff --git a/fs/msgpack-file/tsconfig.lint.json b/fs/msgpack-file/tsconfig.lint.json deleted file mode 100644 index 1bbe711971..0000000000 --- a/fs/msgpack-file/tsconfig.lint.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": [ - "src/**/*.ts", - "test/**/*.ts", - "../../__typings__/**/*.d.ts" - ] -} diff --git a/installing/commands/src/add.ts b/installing/commands/src/add.ts index e7dd01f4e5..3ee33ef0b7 100644 --- a/installing/commands/src/add.ts +++ b/installing/commands/src/add.ts @@ -47,7 +47,6 @@ export function rcOptionsTypes (): Record { 'libc', 'link-workspace-packages', 'lockfile-dir', - 'lockfile-directory', 'lockfile-only', 'lockfile', 'modules-dir', @@ -72,7 +71,6 @@ export function rcOptionsTypes (): Record { 'save-prefix', 'save-prod', 'save-workspace-protocol', - 'shamefully-flatten', 'shamefully-hoist', 'shared-workspace-lockfile', 'side-effects-cache-readonly', diff --git a/installing/commands/src/install.ts b/installing/commands/src/install.ts index c3f29ffb75..ceb3830470 100644 --- a/installing/commands/src/install.ts +++ b/installing/commands/src/install.ts @@ -37,7 +37,6 @@ export function rcOptionsTypes (): Record { 'libc', 'link-workspace-packages', 'lockfile-dir', - 'lockfile-directory', 'lockfile-only', 'lockfile', 'merge-git-branch-lockfiles', @@ -57,7 +56,6 @@ export function rcOptionsTypes (): Record { 'reporter', 'save-workspace-protocol', 'scripts-prepend-node-path', - 'shamefully-flatten', 'shamefully-hoist', 'shared-workspace-lockfile', 'side-effects-cache-readonly', diff --git a/installing/commands/src/remove.ts b/installing/commands/src/remove.ts index 480c3564fa..e4488507d6 100644 --- a/installing/commands/src/remove.ts +++ b/installing/commands/src/remove.ts @@ -52,7 +52,6 @@ export function rcOptionsTypes (): Record { 'global-pnpmfile', 'global', 'lockfile-dir', - 'lockfile-directory', 'lockfile-only', 'lockfile', 'node-linker', diff --git a/installing/commands/src/update/index.ts b/installing/commands/src/update/index.ts index da8e03ff41..2426cfbfa0 100644 --- a/installing/commands/src/update/index.ts +++ b/installing/commands/src/update/index.ts @@ -42,7 +42,6 @@ export function rcOptionsTypes (): Record { 'ignore-pnpmfile', 'ignore-scripts', 'lockfile-dir', - 'lockfile-directory', 'lockfile-only', 'lockfile', 'lockfile-include-tarball-url', @@ -64,7 +63,6 @@ export function rcOptionsTypes (): Record { 'save-prefix', 'save-workspace-protocol', 'scripts-prepend-node-path', - 'shamefully-flatten', 'shamefully-hoist', 'shared-workspace-lockfile', 'side-effects-cache-readonly', diff --git a/installing/deps-installer/package.json b/installing/deps-installer/package.json index b826067983..dce63ef3aa 100644 --- a/installing/deps-installer/package.json +++ b/installing/deps-installer/package.json @@ -127,7 +127,6 @@ "@jest/globals": "catalog:", "@pnpm/assert-project": "workspace:*", "@pnpm/assert-store": "workspace:*", - "@pnpm/fs.msgpack-file": "workspace:*", "@pnpm/installing.deps-installer": "workspace:*", "@pnpm/lockfile.types": "workspace:*", "@pnpm/logger": "workspace:*", diff --git a/installing/deps-installer/tsconfig.json b/installing/deps-installer/tsconfig.json index 0f05225b14..9144a93536 100644 --- a/installing/deps-installer/tsconfig.json +++ b/installing/deps-installer/tsconfig.json @@ -90,9 +90,6 @@ { "path": "../../exec/lifecycle" }, - { - "path": "../../fs/msgpack-file" - }, { "path": "../../fs/read-modules-dir" }, diff --git a/installing/package-requester/package.json b/installing/package-requester/package.json index 0c5282a9a6..811a6d18c5 100644 --- a/installing/package-requester/package.json +++ b/installing/package-requester/package.json @@ -63,7 +63,6 @@ }, "devDependencies": { "@jest/globals": "catalog:", - "@pnpm/fs.msgpack-file": "workspace:*", "@pnpm/installing.client": "workspace:*", "@pnpm/installing.package-requester": "workspace:*", "@pnpm/logger": "workspace:*", diff --git a/installing/package-requester/tsconfig.json b/installing/package-requester/tsconfig.json index 9dfe23e299..ef5a5fbf8a 100644 --- a/installing/package-requester/tsconfig.json +++ b/installing/package-requester/tsconfig.json @@ -39,9 +39,6 @@ { "path": "../../fs/graceful-fs" }, - { - "path": "../../fs/msgpack-file" - }, { "path": "../../hooks/types" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4b45a8dde1..d68dd98656 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4443,22 +4443,6 @@ importers: specifier: workspace:* version: 'link:' - fs/msgpack-file: - dependencies: - '@pnpm/fs.graceful-fs': - specifier: workspace:* - version: link:../graceful-fs - msgpackr: - specifier: 'catalog:' - version: 1.11.8 - devDependencies: - '@pnpm/fs.msgpack-file': - specifier: workspace:* - version: 'link:' - tempy: - specifier: 'catalog:' - version: 3.0.0 - fs/packlist: dependencies: npm-packlist: @@ -5303,9 +5287,6 @@ importers: '@pnpm/assert-store': specifier: workspace:* version: link:../../__utils__/assert-store - '@pnpm/fs.msgpack-file': - specifier: workspace:* - version: link:../../fs/msgpack-file '@pnpm/installing.deps-installer': specifier: workspace:* version: 'link:' @@ -6059,9 +6040,6 @@ importers: '@jest/globals': specifier: 'catalog:' version: 30.3.0 - '@pnpm/fs.msgpack-file': - specifier: workspace:* - version: link:../../fs/msgpack-file '@pnpm/installing.client': specifier: workspace:* version: link:../client @@ -7143,9 +7121,6 @@ importers: '@pnpm/exec.run-npm': specifier: workspace:* version: link:../exec/run-npm - '@pnpm/fs.msgpack-file': - specifier: workspace:* - version: link:../fs/msgpack-file '@pnpm/hooks.pnpmfile': specifier: workspace:* version: link:../hooks/pnpmfile diff --git a/pnpm/package.json b/pnpm/package.json index a712b651c0..5cd6693846 100644 --- a/pnpm/package.json +++ b/pnpm/package.json @@ -102,7 +102,6 @@ "@pnpm/error": "workspace:*", "@pnpm/exec.commands": "workspace:*", "@pnpm/exec.run-npm": "workspace:*", - "@pnpm/fs.msgpack-file": "workspace:*", "@pnpm/installing.client": "workspace:*", "@pnpm/installing.commands": "workspace:*", "@pnpm/installing.env-installer": "workspace:*", diff --git a/pnpm/src/parseCliArgs.ts b/pnpm/src/parseCliArgs.ts index 932b58f401..0bc7c91dc3 100644 --- a/pnpm/src/parseCliArgs.ts +++ b/pnpm/src/parseCliArgs.ts @@ -9,9 +9,7 @@ import { import { shorthands as universalShorthands } from './shorthands.js' const RENAMED_OPTIONS = { - 'lockfile-directory': 'lockfile-dir', prefix: 'dir', - 'shrinkwrap-directory': 'lockfile-dir', store: 'store-dir', } diff --git a/pnpm/test/install/misc.ts b/pnpm/test/install/misc.ts index ae7ddb9500..c97fe1a19b 100644 --- a/pnpm/test/install/misc.ts +++ b/pnpm/test/install/misc.ts @@ -111,7 +111,7 @@ test('install from any location via the --prefix flag', async () => { test('install with external lockfile directory', async () => { const project = prepare() - await execPnpm(['install', 'is-positive', '--lockfile-directory', path.resolve('..')]) + await execPnpm(['install', 'is-positive', '--lockfile-dir', path.resolve('..')]) project.has('is-positive') diff --git a/pnpm/tsconfig.json b/pnpm/tsconfig.json index e242a8d0e4..6c7bfa5a26 100644 --- a/pnpm/tsconfig.json +++ b/pnpm/tsconfig.json @@ -98,9 +98,6 @@ { "path": "../exec/run-npm" }, - { - "path": "../fs/msgpack-file" - }, { "path": "../hooks/pnpmfile" },