mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-27 18:46:18 -04:00
feat: use ESM instead of commonjs (#9870)
This commit is contained in:
188
.changeset/five-lies-travel.md
Normal file
188
.changeset/five-lies-travel.md
Normal file
@@ -0,0 +1,188 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": major
|
||||
"@pnpm/plugin-commands-store-inspecting": major
|
||||
"@pnpm/plugin-commands-completion": major
|
||||
"@pnpm/plugin-commands-publishing": major
|
||||
"@pnpm/plugin-commands-script-runners": major
|
||||
"@pnpm/write-project-manifest": major
|
||||
"@pnpm/filter-workspace-packages": major
|
||||
"@pnpm/read-project-manifest": major
|
||||
"@pnpm/plugin-commands-licenses": major
|
||||
"@pnpm/plugin-commands-outdated": major
|
||||
"@pnpm/tools.plugin-commands-self-updater": major
|
||||
"@pnpm/workspace.filter-packages-from-dir": major
|
||||
"@pnpm/plugin-commands-patching": major
|
||||
"@pnpm/read-projects-context": major
|
||||
"@pnpm/plugin-commands-listing": major
|
||||
"@pnpm/resolve-workspace-range": major
|
||||
"@pnpm/pick-registry-for-package": major
|
||||
"@pnpm/make-dedicated-lockfile": major
|
||||
"@pnpm/parse-wanted-dependency": major
|
||||
"@pnpm/resolve-dependencies": major
|
||||
"@pnpm/exportable-manifest": major
|
||||
"@pnpm/plugin-commands-deploy": major
|
||||
"@pnpm/reviewing.dependencies-hierarchy": major
|
||||
"@pnpm/plugin-commands-doctor": major
|
||||
"@pnpm/plugin-commands-audit": major
|
||||
"@pnpm/plugin-commands-setup": major
|
||||
"@pnpm/read-package-json": major
|
||||
"@pnpm/resolving.jsr-specifier-parser": major
|
||||
"@pnpm/store-connection-manager": major
|
||||
"@pnpm/workspace.injected-deps-syncer": major
|
||||
"@pnpm/package-is-installable": major
|
||||
"@pnpm/plugin-commands-config": major
|
||||
"@pnpm/plugin-commands-init": major
|
||||
"@pnpm/pkg-manager.direct-dep-linker": major
|
||||
"@pnpm/package-requester": major
|
||||
"@pnpm/plugin-commands-rebuild": major
|
||||
"@pnpm/plugin-commands-server": major
|
||||
"@pnpm/store-controller-types": major
|
||||
"@pnpm/find-workspace-dir": major
|
||||
"@pnpm/common-cli-options-help": major
|
||||
"@pnpm/normalize-registries": major
|
||||
"@pnpm/lockfile.preferred-versions": major
|
||||
"@pnpm/render-peer-issues": major
|
||||
"@pnpm/modules-cleaner": major
|
||||
"@pnpm/manifest-utils": major
|
||||
"@pnpm/plugin-commands-store": major
|
||||
"@pnpm/get-release-text": major
|
||||
"@pnpm/prepare-temp-dir": major
|
||||
"@pnpm/directory-fetcher": major
|
||||
"@pnpm/fs.is-empty-dir-or-nothing": major
|
||||
"@pnpm/default-resolver": major
|
||||
"@pnpm/tarball-resolver": major
|
||||
"@pnpm/test-ipc-server": major
|
||||
"@pnpm/lockfile.detect-dep-types": major
|
||||
"@pnpm/lockfile.settings-checker": major
|
||||
"@pnpm/license-scanner": major
|
||||
"@pnpm/workspace.manifest-writer": major
|
||||
"@pnpm/assert-project": major
|
||||
"@pnpm/catalogs.protocol-parser": major
|
||||
"@pnpm/tarball-fetcher": major
|
||||
"@pnpm/lockfile-to-pnp": major
|
||||
"@pnpm/dependency-path": major
|
||||
"@pnpm/modules-yaml": major
|
||||
"@pnpm/package-bins": major
|
||||
"@pnpm/local-resolver": major
|
||||
"@pnpm/eslint-config": major
|
||||
"@pnpm/test-fixtures": major
|
||||
"@pnpm/plugin-commands-env": major
|
||||
"@pnpm/env.system-node-version": major
|
||||
"@pnpm/exec.pkg-requires-build": major
|
||||
"@pnpm/fetching.binary-fetcher": major
|
||||
"@pnpm/fs.indexed-pkg-importer": major
|
||||
"@pnpm/hooks.read-package-hook": major
|
||||
"@pnpm/calc-dep-state": major
|
||||
"@pnpm/get-context": major
|
||||
"@pnpm/remove-bins": major
|
||||
"@pnpm/resolving.deno-resolver": major
|
||||
"@pnpm/resolver-base": major
|
||||
"@pnpm/create-cafs-store": major
|
||||
"@pnpm/workspace.find-packages": major
|
||||
"@pnpm/workspace.read-manifest": major
|
||||
"@pnpm/sort-packages": major
|
||||
"@pnpm/assert-store": major
|
||||
"@pnpm/parse-overrides": major
|
||||
"@pnpm/dedupe.issues-renderer": major
|
||||
"@pnpm/mount-modules": major
|
||||
"@pnpm/fetching-types": major
|
||||
"@pnpm/real-hoist": major
|
||||
"@pnpm/resolving.bun-resolver": major
|
||||
"@pnpm/git-resolver": major
|
||||
"@pnpm/npm-resolver": major
|
||||
"@pnpm/jest-config": major
|
||||
"@pnpm/config.deps-installer": major
|
||||
"@pnpm/fetcher-base": major
|
||||
"@pnpm/pick-fetcher": major
|
||||
"@pnpm/symlink-dependency": major
|
||||
"@pnpm/lockfile.verification": major
|
||||
"@pnpm/core-loggers": major
|
||||
"@pnpm/link-bins": major
|
||||
"@pnpm/workspace.spec-parser": major
|
||||
"@pnpm/default-reporter": major
|
||||
"@pnpm/config.config-writer": major
|
||||
"@pnpm/crypto.object-hasher": major
|
||||
"@pnpm/deps.graph-sequencer": major
|
||||
"@pnpm/exec.pnpm-cli-runner": major
|
||||
"@pnpm/prepare-package": major
|
||||
"@pnpm/git-fetcher": major
|
||||
"@pnpm/object.property-path": major
|
||||
"@pnpm/patching.apply-patch": major
|
||||
"@pnpm/headless": major
|
||||
"@pnpm/text.comments-parser": major
|
||||
"@pnpm/workspace.pkgs-graph": major
|
||||
"@pnpm/crypto.shasums-file": major
|
||||
"@pnpm/exec.build-commands": major
|
||||
"@pnpm/read-modules-dir": major
|
||||
"@pnpm/network.auth-header": major
|
||||
"@pnpm/package-store": major
|
||||
"@pnpm/tsconfig": major
|
||||
"@pnpm/parse-cli-args": major
|
||||
"@pnpm/deps.graph-builder": major
|
||||
"@pnpm/build-modules": major
|
||||
"@pnpm/lockfile.filtering": major
|
||||
"@pnpm/object.key-sorting": major
|
||||
"@pnpm/constants": major
|
||||
"@pnpm/git-utils": major
|
||||
"@pnpm/client": major
|
||||
"@pnpm/exe": major
|
||||
"@pnpm/outdated": major
|
||||
"@pnpm/testing.temp-store": major
|
||||
"@pnpm/prepare": major
|
||||
"@pnpm/scripts": major
|
||||
"@pnpm/catalogs.resolver": major
|
||||
"@pnpm/node.resolver": major
|
||||
"@pnpm/hoist": major
|
||||
"@pnpm/semver.peer-range": major
|
||||
"@pnpm/node.fetcher": major
|
||||
"@pnpm/fs.find-packages": major
|
||||
"@pnpm/fs.hard-link-dir": major
|
||||
"@pnpm/core": major
|
||||
"@pnpm/cafs-types": major
|
||||
"@pnpm/store-path": major
|
||||
"@pnpm/catalogs.config": major
|
||||
"@pnpm/lockfile.merger": major
|
||||
"@pnpm/lockfile.pruner": major
|
||||
"@pnpm/lockfile.walker": major
|
||||
"@pnpm/logger": major
|
||||
"@pnpm/patching.config": major
|
||||
"@pnpm/workspace.state": major
|
||||
"@pnpm/cache.commands": major
|
||||
"@pnpm/catalogs.types": major
|
||||
"@pnpm/matcher": major
|
||||
"@pnpm/lifecycle": major
|
||||
"@pnpm/graceful-fs": major
|
||||
"@pnpm/pnpmfile": major
|
||||
"@pnpm/audit": major
|
||||
"@pnpm/lockfile.types": major
|
||||
"@pnpm/lockfile.utils": major
|
||||
"@pnpm/error": major
|
||||
"@pnpm/types": major
|
||||
"@pnpm/patching.types": major
|
||||
"@pnpm/list": major
|
||||
"@pnpm-private/updater": major
|
||||
"@pnpm/cli-utils": major
|
||||
"@pnpm/config": major
|
||||
"@pnpm/fetch": major
|
||||
"@pnpm/cli-meta": major
|
||||
"@pnpm/dedupe.check": major
|
||||
"@pnpm/dedupe.types": major
|
||||
"@pnpm/run-npm": major
|
||||
"@pnpm/server": major
|
||||
"@pnpm-private/typings": major
|
||||
"@pnpm/command": major
|
||||
"@pnpm/crypto.hash": major
|
||||
"@pnpm/deps.status": major
|
||||
"@pnpm/fs.packlist": major
|
||||
"@pnpm/hooks.types": major
|
||||
"@pnpm/lockfile.fs": major
|
||||
"@pnpm/store.cafs": major
|
||||
"@pnpm/tools.path": major
|
||||
"@pnpm/cache.api": major
|
||||
"@pnpm/env.path": major
|
||||
"pd": major
|
||||
"@pnpm/worker": major
|
||||
"pnpm": major
|
||||
---
|
||||
|
||||
This package is now pure ESM.
|
||||
@@ -183,8 +183,9 @@ async function updateTSConfig (
|
||||
extends: '../tsconfig.json',
|
||||
compilerOptions: {
|
||||
noEmit: false,
|
||||
outDir: '../test.lib',
|
||||
rootDir: '.',
|
||||
outDir: '../node_modules/.test.lib',
|
||||
rootDir: '..',
|
||||
isolatedModules: true,
|
||||
},
|
||||
include: [
|
||||
'**/*.ts',
|
||||
@@ -277,9 +278,9 @@ async function updateManifest (workspaceDir: string, manifest: ProjectManifest,
|
||||
if (manifest.name === '@pnpm/core') {
|
||||
// @pnpm/core tests currently works only with port 7769 due to the usage of
|
||||
// the next package: pkg-with-tarball-dep-from-registry
|
||||
scripts._test = `cross-env PNPM_REGISTRY_MOCK_PORT=${registryMockPortForCore} jest`
|
||||
scripts._test = `cross-env PNPM_REGISTRY_MOCK_PORT=${registryMockPortForCore} NODE_OPTIONS=--experimental-vm-modules jest`
|
||||
} else {
|
||||
scripts._test = 'jest'
|
||||
scripts._test = 'cross-env NODE_OPTIONS=--experimental-vm-modules jest'
|
||||
}
|
||||
break
|
||||
}
|
||||
@@ -287,7 +288,7 @@ async function updateManifest (workspaceDir: string, manifest: ProjectManifest,
|
||||
if (fs.existsSync(path.join(dir, 'test'))) {
|
||||
scripts = {
|
||||
...(manifest.scripts as Record<string, string>),
|
||||
_test: 'jest',
|
||||
_test: 'cross-env NODE_OPTIONS=--experimental-vm-modules jest',
|
||||
test: 'pnpm run compile && pnpm run _test',
|
||||
}
|
||||
} else {
|
||||
@@ -368,7 +369,7 @@ async function updateManifest (workspaceDir: string, manifest: ProjectManifest,
|
||||
})
|
||||
}
|
||||
return sortKeysInManifest({
|
||||
type: 'commonjs',
|
||||
type: 'module',
|
||||
...manifest,
|
||||
bugs: {
|
||||
url: 'https://github.com/pnpm/pnpm/issues',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": "src",
|
||||
"module": "ES2020"
|
||||
"module": "nodenext"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
scripts:
|
||||
step1: node ../pnpm/dist/pnpm.cjs install -rf --frozen-lockfile --no-shared-workspace-lockfile --no-link-workspace-packages
|
||||
step2: node ../pnpm/dist/pnpm.cjs install -rf --frozen-lockfile --no-shared-workspace-lockfile --no-link-workspace-packages
|
||||
step3: node ../pnpm/dist/pnpm.cjs install -rf -C fixtureWithLinks --frozen-lockfile --link-workspace-packages --no-shared-workspace-lockfile
|
||||
step4: cd ./fixture-with-external-shrinkwrap/pkg && node ../../../pnpm/dist/pnpm.cjs install -f --frozen-lockfile
|
||||
step5: cd ./custom-modules-dir && node ../../pnpm/dist/pnpm.cjs install -f --frozen-lockfile
|
||||
step1: node ../pnpm/dist/pnpm.mjs install -rf --frozen-lockfile --no-shared-workspace-lockfile --no-link-workspace-packages
|
||||
step2: node ../pnpm/dist/pnpm.mjs install -rf --frozen-lockfile --no-shared-workspace-lockfile --no-link-workspace-packages
|
||||
step3: node ../pnpm/dist/pnpm.mjs install -rf -C fixtureWithLinks --frozen-lockfile --link-workspace-packages --no-shared-workspace-lockfile
|
||||
step4: cd ./fixture-with-external-shrinkwrap/pkg && node ../../../pnpm/dist/pnpm.mjs install -f --frozen-lockfile
|
||||
step5: cd ./custom-modules-dir && node ../../pnpm/dist/pnpm.mjs install -f --frozen-lockfile
|
||||
prepareFixtures: >
|
||||
pnpm run step1 &&
|
||||
pnpm run step2 &&
|
||||
|
||||
13
__patches__/@pnpm__npm-lifecycle.patch
Normal file
13
__patches__/@pnpm__npm-lifecycle.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/index.js b/index.js
|
||||
index 8506b4c43670dd8ddb490001f2c2a5649b11f326..af35d94765e23a4e9b46b0e332ffd37061e05968 100644
|
||||
--- a/index.js
|
||||
+++ b/index.js
|
||||
@@ -87,7 +87,7 @@ function lifecycle (pkg, stage, wd, opts) {
|
||||
// Instead, we use the path to the exe file.
|
||||
env.npm_execpath = process.execPath
|
||||
} else {
|
||||
- env.npm_execpath = require.main ? require.main.filename : process.cwd()
|
||||
+ env.npm_execpath = process.argv[1] ?? process.cwd()
|
||||
}
|
||||
env.INIT_CWD = process.cwd()
|
||||
env.npm_config_node_gyp = env.npm_config_node_gyp || DEFAULT_NODE_GYP_PATH
|
||||
11
__typings__/local.d.ts
vendored
11
__typings__/local.d.ts
vendored
@@ -29,10 +29,15 @@ declare module '@pnpm/npm-conf' {
|
||||
export = anything
|
||||
}
|
||||
|
||||
declare module '@pnpm/npm-conf/lib/util' {
|
||||
declare module '@pnpm/npm-conf/lib/util.js' {
|
||||
export function parseField (types: any, field: string, value: any): unknown
|
||||
}
|
||||
|
||||
declare module '@pnpm/npm-conf/lib/conf' {
|
||||
const anything: any
|
||||
export = anything
|
||||
}
|
||||
|
||||
declare module '@pnpm/npm-lifecycle' {
|
||||
const anything: any
|
||||
export = anything
|
||||
@@ -104,6 +109,10 @@ declare module 'read-package-json' {
|
||||
export = anything
|
||||
}
|
||||
|
||||
declare module 'split-cmd/index.modern.mjs' {
|
||||
export function split (command: string): string[]
|
||||
}
|
||||
|
||||
declare module 'stacktracey' {
|
||||
const anything: any
|
||||
export = anything
|
||||
|
||||
2
__typings__/typed.d.ts
vendored
2
__typings__/typed.d.ts
vendored
@@ -64,7 +64,7 @@ declare module 'strip-comments-strings' {
|
||||
str: string, replacer?: CodeItemReplacer): string
|
||||
}
|
||||
|
||||
declare module 'bin-links/lib/fix-bin' {
|
||||
declare module 'bin-links/lib/fix-bin.js' {
|
||||
function fixBin (path: string, execMode: number): Promise<void>
|
||||
export = fixBin
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"type": "module",
|
||||
"types": "lib/index.d.ts",
|
||||
"files": [
|
||||
"lib/"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import util from 'util'
|
||||
import { createRequire } from 'module'
|
||||
import { assertStore } from '@pnpm/assert-store'
|
||||
import { WANTED_LOCKFILE } from '@pnpm/constants'
|
||||
import { type LockfileFile } from '@pnpm/lockfile.types'
|
||||
@@ -10,6 +11,8 @@ import { sync as readYamlFile } from 'read-yaml-file'
|
||||
import writePkg from 'write-pkg'
|
||||
import isExecutable from './isExecutable.js'
|
||||
|
||||
const require = createRequire(import.meta.url)
|
||||
|
||||
export { isExecutable, type Modules }
|
||||
|
||||
export interface Project {
|
||||
@@ -88,7 +91,6 @@ export function assertProject (projectPath: string, encodedRegistryName?: string
|
||||
return {
|
||||
dir: () => projectPath,
|
||||
requireModule (pkgName: string) {
|
||||
// eslint-disable-next-line
|
||||
return require(path.join(modules, pkgName))
|
||||
},
|
||||
has (pkgName: string, _modulesDir?: string) {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import fs from 'fs'
|
||||
import isWindows from 'is-windows'
|
||||
import { sync as isexe } from 'isexe'
|
||||
import isExe from 'isexe'
|
||||
|
||||
const IS_WINDOWS = isWindows()
|
||||
|
||||
// eslint-disable-next-line
|
||||
export default (ok: (value: any, comment: string) => void, filePath: string): void => {
|
||||
if (IS_WINDOWS) {
|
||||
ok(isexe(`${filePath}.cmd`), `${filePath}.cmd is executable`)
|
||||
ok(isExe.sync(`${filePath}.cmd`), `${filePath}.cmd is executable`)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import path from 'path'
|
||||
import { assertProject } from '../src/index.js'
|
||||
|
||||
test('assertProject()', async () => {
|
||||
const project = assertProject(path.join(__dirname, '../../..'))
|
||||
const project = assertProject(path.join(import.meta.dirname, '../../..'))
|
||||
|
||||
project.has('rimraf')
|
||||
project.hasNot('sfdsff3g34') // cspell:disable-line
|
||||
@@ -12,7 +12,7 @@ test('assertProject()', async () => {
|
||||
})
|
||||
|
||||
test('assertProject() store functions', async () => {
|
||||
const project = assertProject(path.join(__dirname, 'fixture/project'), 'registry.npmjs.org')
|
||||
const project = assertProject(path.join(import.meta.dirname, 'fixture/project'), 'registry.npmjs.org')
|
||||
|
||||
expect(typeof project.getStorePath()).toBe('string')
|
||||
project.storeHas('is-positive', '3.1.0')
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"type": "module",
|
||||
"types": "lib/index.d.ts",
|
||||
"files": [
|
||||
"lib/"
|
||||
|
||||
@@ -4,7 +4,7 @@ import { assertStore } from '@pnpm/assert-store'
|
||||
import { STORE_VERSION } from '@pnpm/constants'
|
||||
|
||||
test('assertStore() store assertions', async () => {
|
||||
const storePath = path.join(__dirname, `fixture/store/${STORE_VERSION}/`)
|
||||
const storePath = path.join(import.meta.dirname, `fixture/store/${STORE_VERSION}/`)
|
||||
const encodedRegistryName = 'registry.npmjs.org'
|
||||
const store = assertStore(storePath, encodedRegistryName)
|
||||
|
||||
@@ -14,7 +14,7 @@ test('assertStore() store assertions', async () => {
|
||||
})
|
||||
|
||||
test('assertStore() resolve', async () => {
|
||||
const storePath = path.join(__dirname, `fixture/store/${STORE_VERSION}/`)
|
||||
const storePath = path.join(import.meta.dirname, `fixture/store/${STORE_VERSION}/`)
|
||||
const encodedRegistryName = 'registry.npmjs.org'
|
||||
const store = assertStore(storePath, encodedRegistryName)
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -4,16 +4,14 @@ import pkgDeb from 'pkg-deb'
|
||||
import pkgRhel from 'pkg-rpm'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
const artifactDir = path.join(__dirname, '../../packages/artifacts/linux-x64')
|
||||
const pnpmDir = path.join(__dirname, '../../packages/pnpm')
|
||||
const artifactDir = path.join(import.meta.dirname, '../../packages/artifacts/linux-x64')
|
||||
const pnpmDir = path.join(import.meta.dirname, '../../packages/pnpm')
|
||||
const pnpmManifest = JSON.parse(fs.readFileSync(path.join(pnpmDir, 'package.json'), 'utf8'))
|
||||
|
||||
const opts = {
|
||||
name: 'pnpm',
|
||||
version: pnpmManifest.version,
|
||||
dest: path.join(__dirname, '../../dist'),
|
||||
dest: path.join(import.meta.dirname, '../../dist'),
|
||||
src: pnpmDir,
|
||||
input: path.join(artifactDir, 'pnpm'),
|
||||
arch: 'x64',
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import js from '@eslint/js'
|
||||
import { FlatCompat } from '@eslint/eslintrc'
|
||||
import noDupeConditions from './no-dupe-conditions.js'
|
||||
import jestPlugin from 'eslint-plugin-jest'
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
baseDirectory: import.meta.dirname,
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all
|
||||
})
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": "src",
|
||||
"module": "ES2020"
|
||||
"module": "nodenext"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
const path = require('path')
|
||||
import path from 'path'
|
||||
|
||||
const config = {
|
||||
preset: "ts-jest",
|
||||
resolver: path.join(__dirname, 'node_modules/ts-jest-resolver'),
|
||||
preset: "ts-jest/presets/default-esm",
|
||||
resolver: path.join(import.meta.dirname, 'node_modules/ts-jest-resolver'),
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
useESM: true,
|
||||
},
|
||||
},
|
||||
extensionsToTreatAsEsm: ['.ts'],
|
||||
transform: {
|
||||
'^.+\\.tsx?$': ['ts-jest', {
|
||||
// For most projects, the tsconfig.json and test/tsconfig.json are almost
|
||||
// exactly the same. But it's more correct to point to test/tsconfig.json
|
||||
// to prevent surprises in the future.
|
||||
tsconfig: 'test/tsconfig.json'
|
||||
}]
|
||||
}],
|
||||
},
|
||||
testMatch: ["**/test/**/*.[jt]s?(x)", "**/src/**/*.test.ts"],
|
||||
testEnvironment: "node",
|
||||
@@ -18,14 +24,14 @@ const config = {
|
||||
testPathIgnorePatterns: ["/fixtures/", "/__fixtures__/", "<rootDir>/test/utils/.+"],
|
||||
modulePathIgnorePatterns: ['\/__fixtures__\/.*'],
|
||||
testTimeout: 4 * 60 * 1000, // 4 minutes
|
||||
setupFilesAfterEnv: [path.join(__dirname, "setupFilesAfterEnv.js")],
|
||||
setupFilesAfterEnv: [path.join(import.meta.dirname, "setupFilesAfterEnv.js")],
|
||||
maxWorkers: "50%",
|
||||
}
|
||||
|
||||
if (process.env.PNPM_SCRIPT_SRC_DIR) {
|
||||
const pathAsArr = process.env.PNPM_SCRIPT_SRC_DIR.split(path.sep)
|
||||
const packageName = pathAsArr[pathAsArr.length - 1]
|
||||
config.cacheDirectory = path.join(__dirname, ".jest-cache", packageName)
|
||||
config.cacheDirectory = path.join(import.meta.dirname, ".jest-cache", packageName)
|
||||
}
|
||||
|
||||
// We are running test script from pnpm command, this seems to confuse tests
|
||||
@@ -36,4 +42,4 @@ for (const key of Object.keys(process.env)) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = config
|
||||
export default config
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const path = require('path')
|
||||
const baseConfig = require('./config')
|
||||
import baseConfig from './config.js'
|
||||
|
||||
module.exports = baseConfig
|
||||
export default baseConfig
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"version": "1000.0.0",
|
||||
"private": true,
|
||||
"main": "jest-preset.js",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@pnpm/registry-mock": "catalog:",
|
||||
"@pnpm/worker": "workspace:*",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { finishWorkers } = require('@pnpm/worker')
|
||||
import { finishWorkers } from '@pnpm/worker'
|
||||
|
||||
afterAll(async () => {
|
||||
await finishWorkers()
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
const getPort = require('get-port')
|
||||
const { promisify } = require('util')
|
||||
const kill = promisify(require('tree-kill'))
|
||||
import getPort from 'get-port'
|
||||
import { promisify } from 'util'
|
||||
import treeKill from 'tree-kill'
|
||||
const kill = promisify(treeKill)
|
||||
|
||||
module.exports = async () => {
|
||||
export default async () => {
|
||||
if (!process.env.PNPM_REGISTRY_MOCK_PORT) {
|
||||
process.env.PNPM_REGISTRY_MOCK_PORT = (await getPort({ port: getPort.makeRange(7700, 7800) })).toString()
|
||||
}
|
||||
const { start, prepare } = require('@pnpm/registry-mock')
|
||||
const { start, prepare } = await import('@pnpm/registry-mock')
|
||||
prepare()
|
||||
const server = start({
|
||||
// Verdaccio stopped working properly on Node.js 22.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = () => {
|
||||
export default () => {
|
||||
return global.killServer?.()
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
const path = require('path')
|
||||
const baseConfig = require('./../config')
|
||||
import path from 'path'
|
||||
import baseConfig from './../config.js'
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
...baseConfig,
|
||||
// Many tests change the dist tags of packages.
|
||||
// Unfortunately, this means that if two such tests will run at the same time,
|
||||
// they may break each other.
|
||||
maxWorkers: 1,
|
||||
globalSetup: path.join(__dirname, 'globalSetup.js'),
|
||||
globalTeardown: path.join(__dirname, 'globalTeardown.js'),
|
||||
globalSetup: path.join(import.meta.dirname, 'globalSetup.js'),
|
||||
globalTeardown: path.join(import.meta.dirname, 'globalTeardown.js'),
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"name": "@pnpm/prepare-temp-dir",
|
||||
"version": "1000.0.0",
|
||||
"main": "lib/index.js",
|
||||
"type": "module",
|
||||
"types": "lib/index.d.ts",
|
||||
"devDependencies": {
|
||||
"@pnpm/prepare-temp-dir": "workspace:*",
|
||||
|
||||
@@ -3,7 +3,7 @@ import path from 'path'
|
||||
|
||||
// The testing folder should be outside of the project to avoid lookup in the project's node_modules
|
||||
// Not using the OS temp directory due to issues on Windows CI.
|
||||
const tmpBaseDir = path.join(__dirname, '../../../../pnpm_tmp')
|
||||
const tmpBaseDir = path.join(import.meta.dirname, '../../../../pnpm_tmp')
|
||||
|
||||
const tmpPath = path.join(tmpBaseDir, `${getFilesCountInDir(tmpBaseDir).toString()}_${process.pid.toString()}`)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"version": "1000.0.0",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@pnpm/assert-project": "workspace:*",
|
||||
"@pnpm/prepare-temp-dir": "workspace:*",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"name": "@pnpm/scripts",
|
||||
"version": "1000.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@pnpm/workspace.find-packages": "catalog:",
|
||||
"@pnpm/workspace.read-manifest": "catalog:",
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as execa from 'execa'
|
||||
import path from 'path'
|
||||
import makeEmptyDir from 'make-empty-dir'
|
||||
|
||||
const repoRoot = path.join(__dirname, '../../..')
|
||||
const repoRoot = path.join(import.meta.dirname, '../../..')
|
||||
const dest = path.join(repoRoot, 'dist')
|
||||
const artifactsDir = path.join(repoRoot, 'pnpm/artifacts')
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ import glob from 'fast-glob'
|
||||
import normalizePath from 'normalize-path'
|
||||
import path from 'path'
|
||||
|
||||
const repoRoot = path.resolve(__dirname, '../../../')
|
||||
const repoRoot = path.resolve(import.meta.dirname, '../../../')
|
||||
const typeCheckDir = path.resolve(repoRoot, '__typecheck__')
|
||||
const typingsDir = path.resolve(__dirname, '__typings__')
|
||||
const typingsDir = path.resolve(import.meta.dirname, '__typings__')
|
||||
|
||||
async function main (): Promise<void> {
|
||||
const workspace = await readWorkspaceManifest(repoRoot)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"type": "module",
|
||||
"types": "lib/index.d.ts",
|
||||
"files": [
|
||||
"lib/"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
require('../lib/clientBin')
|
||||
import {} from '../lib/clientBin.js'
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"version": "1000.0.0",
|
||||
"private": true,
|
||||
"main": "lib/index.js",
|
||||
"type": "module",
|
||||
"types": "lib/index.d.ts",
|
||||
"bin": {
|
||||
"test-ipc-server-client": "./bin/test-ipc-server-client.js"
|
||||
@@ -16,10 +17,13 @@
|
||||
"scripts": {
|
||||
"lint": "eslint src/**/*.ts test/**/*.ts",
|
||||
"compile": "rimraf tsconfig.tsbuildinfo lib && tsc --build",
|
||||
"test": "pnpm run compile && jest"
|
||||
"test": "pnpm run compile && cross-env NODE_OPTIONS=--experimental-vm-modules jest"
|
||||
},
|
||||
"keywords": [
|
||||
"pnpm",
|
||||
"pnpm10"
|
||||
]
|
||||
],
|
||||
"jest": {
|
||||
"preset": "@pnpm/jest-config"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/// <reference lib="esnext.disposable" />
|
||||
import execa from 'execa'
|
||||
import fs from 'fs'
|
||||
import net from 'net'
|
||||
import path from 'path'
|
||||
import execa from 'execa'
|
||||
import { setTimeout } from 'timers/promises'
|
||||
import { promisify } from 'util'
|
||||
import { prepare } from '@pnpm/prepare'
|
||||
import { createTestIpcServer } from '@pnpm/test-ipc-server'
|
||||
|
||||
const pnpmBin = path.join(__dirname, '../../../pnpm/bin/pnpm.cjs')
|
||||
const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs')
|
||||
|
||||
describe('TestEchoServer', () => {
|
||||
describe('lifecycle', () => {
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"composite": true,
|
||||
"declaration": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"module": "nodenext",
|
||||
"moduleResolution": "nodenext",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"preserveConstEnums": true,
|
||||
|
||||
2
cache/api/package.json
vendored
2
cache/api/package.json
vendored
@@ -14,7 +14,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
|
||||
4
cache/commands/package.json
vendored
4
cache/commands/package.json
vendored
@@ -14,7 +14,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -26,7 +26,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"compile": "tsc --build && pnpm run lint --fix"
|
||||
|
||||
2
cache/commands/src/cache.cmd.ts
vendored
2
cache/commands/src/cache.cmd.ts
vendored
@@ -3,7 +3,7 @@ import { docsUrl } from '@pnpm/cli-utils'
|
||||
import { type Config, types as allTypes } from '@pnpm/config'
|
||||
import { FULL_FILTERED_META_DIR, ABBREVIATED_META_DIR } from '@pnpm/constants'
|
||||
import { getStorePath } from '@pnpm/store-path'
|
||||
import pick from 'ramda/src/pick'
|
||||
import { pick } from 'ramda'
|
||||
import renderHelp from 'render-help'
|
||||
import {
|
||||
cacheList,
|
||||
|
||||
2
cache/commands/test/cacheDelete.cmd.test.ts
vendored
2
cache/commands/test/cacheDelete.cmd.test.ts
vendored
@@ -5,7 +5,7 @@ import execa from 'execa'
|
||||
import { cache } from '@pnpm/cache.commands'
|
||||
import { sync as rimraf } from '@zkochan/rimraf'
|
||||
|
||||
const pnpmBin = path.join(__dirname, '../../../pnpm/bin/pnpm.cjs')
|
||||
const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs')
|
||||
const REGISTRY = `http://localhost:${REGISTRY_MOCK_PORT}/`
|
||||
|
||||
describe('cache delete', () => {
|
||||
|
||||
2
cache/commands/test/cacheList.cmd.test.ts
vendored
2
cache/commands/test/cacheList.cmd.test.ts
vendored
@@ -5,7 +5,7 @@ import execa from 'execa'
|
||||
import { cache } from '@pnpm/cache.commands'
|
||||
import { sync as rimraf } from '@zkochan/rimraf'
|
||||
|
||||
const pnpmBin = path.join(__dirname, '../../../pnpm/bin/pnpm.cjs')
|
||||
const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs')
|
||||
const REGISTRY = `http://localhost:${REGISTRY_MOCK_PORT}/`
|
||||
|
||||
describe('cache', () => {
|
||||
|
||||
2
cache/commands/test/cacheView.cmd.test.ts
vendored
2
cache/commands/test/cacheView.cmd.test.ts
vendored
@@ -5,7 +5,7 @@ import execa from 'execa'
|
||||
import { cache } from '@pnpm/cache.commands'
|
||||
import { sync as rimraf } from '@zkochan/rimraf'
|
||||
|
||||
const pnpmBin = path.join(__dirname, '../../../pnpm/bin/pnpm.cjs')
|
||||
const pnpmBin = path.join(import.meta.dirname, '../../../pnpm/bin/pnpm.mjs')
|
||||
const REGISTRY = `http://localhost:${REGISTRY_MOCK_PORT}/`
|
||||
|
||||
describe('cache view', () => {
|
||||
|
||||
5
cache/commands/test/tsconfig.json
vendored
5
cache/commands/test/tsconfig.json
vendored
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -29,7 +29,7 @@
|
||||
"compile": "tsc --build && pnpm run lint --fix",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"_test": "jest"
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pnpm/error": "workspace:*"
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -29,7 +29,7 @@
|
||||
"compile": "tsc --build && pnpm run lint --fix",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"_test": "jest"
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@pnpm/catalogs.protocol-parser": "workspace:*"
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -29,7 +29,7 @@
|
||||
"compile": "tsc --build && pnpm run lint --fix",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"_test": "jest"
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pnpm/catalogs.protocol-parser": "workspace:^",
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -28,7 +28,7 @@
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"compile": "tsc --build && pnpm run lint --fix",
|
||||
"_test": "jest"
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pnpm/types": "workspace:*",
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import path from 'path'
|
||||
import { type DependencyManifest } from '@pnpm/types'
|
||||
import loadJsonFile from 'load-json-file'
|
||||
|
||||
const defaultManifest = {
|
||||
name: process.env.npm_package_name != null && process.env.npm_package_name !== ''
|
||||
? process.env.npm_package_name
|
||||
@@ -10,21 +6,7 @@ const defaultManifest = {
|
||||
? process.env.npm_package_version
|
||||
: '0.0.0',
|
||||
}
|
||||
let pkgJson
|
||||
if (require.main == null) {
|
||||
pkgJson = defaultManifest
|
||||
} else {
|
||||
try {
|
||||
pkgJson = {
|
||||
...defaultManifest,
|
||||
...loadJsonFile.sync<DependencyManifest>(
|
||||
path.join(path.dirname(require.main.filename), '../package.json')
|
||||
),
|
||||
}
|
||||
} catch {
|
||||
pkgJson = defaultManifest
|
||||
}
|
||||
}
|
||||
const pkgJson = defaultManifest
|
||||
|
||||
export const packageManager = {
|
||||
name: pkgJson.name,
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -28,7 +28,7 @@
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"compile": "tsc --build && pnpm run lint --fix",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"_test": "jest"
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pnpm/cli-meta": "workspace:*",
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -28,7 +28,7 @@
|
||||
"start": "tsc --watch",
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"just-test-preview": "ts-node test --type-check",
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"compile": "tsc --build && pnpm run lint --fix"
|
||||
|
||||
@@ -6,7 +6,7 @@ import { type PnpmError } from '@pnpm/error'
|
||||
import { renderPeerIssues } from '@pnpm/render-peer-issues'
|
||||
import { type PeerDependencyIssuesByProjects } from '@pnpm/types'
|
||||
import chalk from 'chalk'
|
||||
import equals from 'ramda/src/equals'
|
||||
import { equals } from 'ramda'
|
||||
import StackTracey from 'stacktracey'
|
||||
import { EOL } from './constants.js'
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@ import type * as logs from '@pnpm/core-loggers'
|
||||
import { type BaseManifest } from '@pnpm/types'
|
||||
import * as Rx from 'rxjs'
|
||||
import { filter, map, mapTo, reduce, scan, startWith, take } from 'rxjs/operators'
|
||||
import mergeRight from 'ramda/src/mergeRight'
|
||||
import difference from 'ramda/src/difference'
|
||||
import { mergeRight, difference } from 'ramda'
|
||||
|
||||
export interface PackageDiff {
|
||||
added: boolean
|
||||
|
||||
@@ -2,7 +2,7 @@ import { type StatsLog } from '@pnpm/core-loggers'
|
||||
import * as Rx from 'rxjs'
|
||||
import { filter, take, reduce, map } from 'rxjs/operators'
|
||||
import chalk from 'chalk'
|
||||
import repeat from 'ramda/src/repeat'
|
||||
import { repeat } from 'ramda'
|
||||
import stringLength from 'string-length'
|
||||
import { EOL } from '../constants.js'
|
||||
import {
|
||||
|
||||
@@ -21,7 +21,7 @@ import { map, skip, take } from 'rxjs/operators'
|
||||
import chalk from 'chalk'
|
||||
import normalizeNewline from 'normalize-newline'
|
||||
import { firstValueFrom } from 'rxjs'
|
||||
import repeat from 'ramda/src/repeat'
|
||||
import { repeat } from 'ramda'
|
||||
import { formatWarn } from '../src/reporterForClient/utils/formatWarn.js'
|
||||
|
||||
const formatErrorCode = (code: string) => chalk.bgRed.black(`\u2009${code}\u2009`)
|
||||
|
||||
@@ -68,7 +68,7 @@ test('prints no matching version error when many dist-tags exist', async () => {
|
||||
expect.assertions(1)
|
||||
|
||||
const err = Object.assign(new PnpmError('NO_MATCHING_VERSION', 'No matching version found for pnpm@1000.0.0'), {
|
||||
packageMeta: loadJsonFile.sync(path.join(__dirname, 'pnpm-meta.json')),
|
||||
packageMeta: loadJsonFile.sync(path.join(import.meta.dirname, 'pnpm-meta.json')),
|
||||
})
|
||||
logger.error(err, err)
|
||||
|
||||
@@ -94,7 +94,7 @@ test('prints no matching version error when only the latest dist-tag exists', as
|
||||
expect.assertions(1)
|
||||
|
||||
const err = Object.assign(new PnpmError('NO_MATCHING_VERSION', 'No matching version found for is-positive@1000.0.0'), {
|
||||
packageMeta: loadJsonFile.sync(path.join(__dirname, 'is-positive-meta.json')),
|
||||
packageMeta: loadJsonFile.sync(path.join(import.meta.dirname, 'is-positive-meta.json')),
|
||||
})
|
||||
logger.error(err, err)
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -25,7 +25,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"start": "tsc --watch",
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -26,7 +26,7 @@
|
||||
"scripts": {
|
||||
"start": "tsc --watch",
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"compile": "tsc --build && pnpm run lint --fix"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { type CompletionItem, getShellFromEnv } from '@pnpm/tabtab'
|
||||
import { type CompletionFunc } from '@pnpm/command'
|
||||
import { split as splitCmd } from 'split-cmd'
|
||||
import { split as splitCmd } from 'split-cmd/index.modern.mjs'
|
||||
import tabtab from '@pnpm/tabtab'
|
||||
import {
|
||||
currentTypedWordType,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import nopt from '@pnpm/nopt'
|
||||
import omit from 'ramda/src/omit'
|
||||
import { omit } from 'ramda'
|
||||
|
||||
export interface CompletionCtx {
|
||||
last: string
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { type ProjectManifest, type PnpmSettings } from '@pnpm/types'
|
||||
import { tryReadProjectManifest } from '@pnpm/read-project-manifest'
|
||||
import { updateWorkspaceManifest } from '@pnpm/workspace.manifest-writer'
|
||||
import equals from 'ramda/src/equals'
|
||||
import { equals } from 'ramda'
|
||||
|
||||
export interface WriteSettingsOptions {
|
||||
updatedSettings: PnpmSettings
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -28,7 +28,7 @@
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"test-with-preview": "ts-node test",
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"start": "tsc --watch",
|
||||
"compile": "tsc --build && pnpm run lint --fix"
|
||||
|
||||
@@ -9,9 +9,7 @@ import {
|
||||
type ProjectManifest,
|
||||
type PnpmSettings,
|
||||
} from '@pnpm/types'
|
||||
import mapValues from 'ramda/src/map'
|
||||
import omit from 'ramda/src/omit'
|
||||
import pick from 'ramda/src/pick'
|
||||
import { map as mapValues, omit, pick } from 'ramda'
|
||||
import { globalWarn } from '@pnpm/logger'
|
||||
|
||||
export type OptionsFromRootManifest = {
|
||||
|
||||
@@ -216,7 +216,7 @@ export async function getConfig (opts: {
|
||||
if (warn) warnings.push(warn)
|
||||
}
|
||||
{
|
||||
const warn = npmConfig.addFile(path.resolve(path.join(__dirname, 'pnpmrc')), 'pnpm-builtin')
|
||||
const warn = npmConfig.addFile(path.resolve(path.join(import.meta.dirname, 'pnpmrc')), 'pnpm-builtin')
|
||||
if (warn) warnings.push(warn)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import util from 'util'
|
||||
import camelcaseKeys from 'camelcase-keys'
|
||||
import { envReplace } from '@pnpm/config.env-replace'
|
||||
import { readIniFile } from 'read-ini-file'
|
||||
import { parseField } from '@pnpm/npm-conf/lib/util'
|
||||
import { parseField } from '@pnpm/npm-conf/lib/util.js'
|
||||
import { types } from './types.js'
|
||||
|
||||
export type LocalConfig = Record<string, string> & { hoist?: boolean }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import npmTypes from '@pnpm/npm-conf/lib/types'
|
||||
import npmTypes from '@pnpm/npm-conf/lib/types.js'
|
||||
|
||||
export const types = Object.assign({
|
||||
'auto-install-peers': Boolean,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import os, { cpus } from 'os'
|
||||
import { jest } from '@jest/globals'
|
||||
import os, { cpus } from 'os'
|
||||
import { getDefaultWorkspaceConcurrency, resetAvailableParallelismCache, getWorkspaceConcurrency } from '../lib/concurrency.js'
|
||||
|
||||
const hostCores = cpus().length
|
||||
|
||||
@@ -6,7 +6,6 @@ import path from 'path'
|
||||
import pathName from 'path-name'
|
||||
import symlinkDir from 'symlink-dir'
|
||||
import { homedir } from 'os'
|
||||
import { getConfig } from '@pnpm/config'
|
||||
|
||||
const globalBinDir = path.join(homedir(), '.local', 'pnpm')
|
||||
const isWindows = process.platform === 'win32'
|
||||
@@ -19,8 +18,8 @@ jest.mock('@pnpm/npm-conf/lib/conf', () => {
|
||||
constructor (base: any, types: any) {
|
||||
super(base, types)
|
||||
const globalPrefixDirName = isWindows ? 'global-bin-dir-windows' : 'global-bin-dir'
|
||||
this.prefix = this.globalPrefix = path.join(__dirname, globalPrefixDirName)
|
||||
this.localPrefix = __dirname
|
||||
this.prefix = this.globalPrefix = path.join(import.meta.dirname, globalPrefixDirName)
|
||||
this.localPrefix = import.meta.dirname
|
||||
}
|
||||
|
||||
get (name: string) {
|
||||
@@ -36,6 +35,8 @@ jest.mock('@pnpm/npm-conf/lib/conf', () => {
|
||||
return MockedConf
|
||||
})
|
||||
|
||||
const { getConfig } = await import('@pnpm/config')
|
||||
|
||||
test('respects global-bin-dir in npmrc', async () => {
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {
|
||||
@@ -56,7 +57,7 @@ test('respects global-bin-dir rather than dir', async () => {
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {
|
||||
global: true,
|
||||
dir: __dirname,
|
||||
dir: import.meta.dirname,
|
||||
},
|
||||
env: {
|
||||
[pathName]: `${globalBinDir}${path.delimiter}${process.env[pathName]!}`,
|
||||
@@ -74,7 +75,7 @@ test('an exception is thrown when the global dir is not in PATH', async () => {
|
||||
getConfig({
|
||||
cliOptions: {
|
||||
global: true,
|
||||
dir: __dirname,
|
||||
dir: import.meta.dirname,
|
||||
},
|
||||
env: {
|
||||
[pathName]: process.env[pathName],
|
||||
@@ -97,7 +98,7 @@ test('the global directory may be a symlink to a directory that is in PATH', asy
|
||||
cliOptions: {
|
||||
global: true,
|
||||
'global-bin-dir': globalBinDirSymlink,
|
||||
dir: __dirname,
|
||||
dir: import.meta.dirname,
|
||||
},
|
||||
env: {
|
||||
[pathName]: `${globalBinDirTarget}${path.delimiter}${process.env[pathName]!}`,
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import PATH from 'path-name'
|
||||
import { getCurrentBranch } from '@pnpm/git-utils'
|
||||
import { getConfig } from '@pnpm/config'
|
||||
import loadNpmConf from '@pnpm/npm-conf'
|
||||
import { prepare, prepareEmpty } from '@pnpm/prepare'
|
||||
import { fixtures } from '@pnpm/test-fixtures'
|
||||
@@ -11,7 +9,10 @@ import { jest } from '@jest/globals'
|
||||
|
||||
import symlinkDir from 'symlink-dir'
|
||||
|
||||
jest.mock('@pnpm/git-utils', () => ({ getCurrentBranch: jest.fn() }))
|
||||
jest.unstable_mockModule('@pnpm/git-utils', () => ({ getCurrentBranch: jest.fn() }))
|
||||
|
||||
const { getConfig } = await import('@pnpm/config')
|
||||
const { getCurrentBranch } = await import('@pnpm/git-utils')
|
||||
|
||||
// To override any local settings,
|
||||
// we force the default values of config
|
||||
@@ -25,10 +26,10 @@ delete process.env.npm_config_node_version
|
||||
delete process.env.npm_config_fetch_retries
|
||||
|
||||
const env = {
|
||||
PNPM_HOME: __dirname,
|
||||
[PATH]: __dirname,
|
||||
PNPM_HOME: import.meta.dirname,
|
||||
[PATH]: import.meta.dirname,
|
||||
}
|
||||
const f = fixtures(__dirname)
|
||||
const f = fixtures(import.meta.dirname)
|
||||
|
||||
test('getConfig()', async () => {
|
||||
const { config } = await getConfig({
|
||||
@@ -195,7 +196,7 @@ test('when using --global, link-workspace-packages, shared-workspace-lockfile an
|
||||
test('registries of scoped packages are read and normalized', async () => {
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {
|
||||
userconfig: path.join(__dirname, 'scoped-registries.ini'),
|
||||
userconfig: path.join(import.meta.dirname, 'scoped-registries.ini'),
|
||||
},
|
||||
packageManager: {
|
||||
name: 'pnpm',
|
||||
@@ -219,7 +220,7 @@ test('registries in current directory\'s .npmrc have bigger priority then global
|
||||
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {
|
||||
userconfig: path.join(__dirname, 'scoped-registries.ini'),
|
||||
userconfig: path.join(import.meta.dirname, 'scoped-registries.ini'),
|
||||
},
|
||||
packageManager: {
|
||||
name: 'pnpm',
|
||||
@@ -607,7 +608,7 @@ test('all CLI options are added to the config', async () => {
|
||||
})
|
||||
|
||||
test('local prefix search stops on pnpm-workspace.yaml', async () => {
|
||||
const workspaceDir = path.join(__dirname, 'has-workspace-yaml')
|
||||
const workspaceDir = path.join(import.meta.dirname, 'has-workspace-yaml')
|
||||
process.chdir(workspaceDir)
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {},
|
||||
@@ -621,7 +622,7 @@ test('local prefix search stops on pnpm-workspace.yaml', async () => {
|
||||
})
|
||||
|
||||
test('reads workspacePackagePatterns', async () => {
|
||||
const workspaceDir = path.join(__dirname, 'fixtures/pkg-with-valid-workspace-yaml')
|
||||
const workspaceDir = path.join(import.meta.dirname, 'fixtures/pkg-with-valid-workspace-yaml')
|
||||
process.chdir(workspaceDir)
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {},
|
||||
@@ -636,7 +637,7 @@ test('reads workspacePackagePatterns', async () => {
|
||||
})
|
||||
|
||||
test('setting workspace-concurrency to negative number', async () => {
|
||||
const workspaceDir = path.join(__dirname, 'fixtures/pkg-with-valid-workspace-yaml')
|
||||
const workspaceDir = path.join(import.meta.dirname, 'fixtures/pkg-with-valid-workspace-yaml')
|
||||
process.chdir(workspaceDir)
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {
|
||||
@@ -664,7 +665,7 @@ test('respects test-pattern', async () => {
|
||||
expect(config.testPattern).toBeUndefined()
|
||||
}
|
||||
{
|
||||
const workspaceDir = path.join(__dirname, 'using-test-pattern')
|
||||
const workspaceDir = path.join(import.meta.dirname, 'using-test-pattern')
|
||||
process.chdir(workspaceDir)
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {},
|
||||
@@ -830,7 +831,7 @@ test('getConfig() sets sideEffectsCacheRead and sideEffectsCacheWrite when side-
|
||||
test('getConfig() should read cafile', async () => {
|
||||
const { config } = await getConfig({
|
||||
cliOptions: {
|
||||
cafile: path.join(__dirname, 'cafile.txt'),
|
||||
cafile: path.join(import.meta.dirname, 'cafile.txt'),
|
||||
},
|
||||
packageManager: {
|
||||
name: 'pnpm',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { fixtures } from '@pnpm/test-fixtures'
|
||||
import { readLocalConfig } from '@pnpm/config'
|
||||
|
||||
const f = fixtures(__dirname)
|
||||
const f = fixtures(import.meta.dirname)
|
||||
|
||||
test('readLocalConfig parse number field', async () => {
|
||||
const config = await readLocalConfig(f.find('has-number-setting'))
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -28,7 +28,7 @@
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"test-with-preview": "ts-node test",
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"start": "tsc --watch",
|
||||
"compile": "tsc --build && pnpm run lint --fix"
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -28,7 +28,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"compile": "tsc --build && pnpm run lint --fix"
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { type Registries } from '@pnpm/types'
|
||||
import normalizeRegistryUrl from 'normalize-registry-url'
|
||||
import mapValues from 'ramda/src/map'
|
||||
import { map as mapValues } from 'ramda'
|
||||
|
||||
export const DEFAULT_REGISTRIES: Registries = {
|
||||
default: 'https://registry.npmjs.org/',
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -25,7 +25,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"start": "tsc --watch",
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { jest } from '@jest/globals'
|
||||
import type * as DetectLibc from 'detect-libc'
|
||||
import { checkPlatform } from '../lib/checkPlatform.js'
|
||||
|
||||
const packageId = 'registry.npmjs.org/foo/1.0.0'
|
||||
|
||||
@@ -12,6 +11,8 @@ jest.mock('detect-libc', () => {
|
||||
}
|
||||
})
|
||||
|
||||
const { checkPlatform } = await import('../lib/checkPlatform.js')
|
||||
|
||||
test('target cpu wrong', () => {
|
||||
const target = {
|
||||
cpu: 'enten-cpu',
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -24,7 +24,7 @@
|
||||
"!*.map"
|
||||
],
|
||||
"scripts": {
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -24,7 +24,7 @@
|
||||
"!*.map"
|
||||
],
|
||||
"scripts": {
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -26,7 +26,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"compile": "tsc --build && pnpm run lint --fix"
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { config } from '@pnpm/plugin-commands-config'
|
||||
import { runNpm } from '@pnpm/run-npm'
|
||||
import { jest } from '@jest/globals'
|
||||
|
||||
jest.mock('@pnpm/run-npm', () => ({
|
||||
jest.unstable_mockModule('@pnpm/run-npm', () => ({
|
||||
runNpm: jest.fn(),
|
||||
}))
|
||||
|
||||
const { config } = await import('@pnpm/plugin-commands-config')
|
||||
const { runNpm } = await import('@pnpm/run-npm')
|
||||
|
||||
describe.each(
|
||||
[
|
||||
'_auth',
|
||||
@@ -21,7 +22,7 @@ describe.each(
|
||||
const configOpts = {
|
||||
dir: process.cwd(),
|
||||
cliOptions: {},
|
||||
configDir: __dirname, // this doesn't matter, it won't be used
|
||||
configDir: import.meta.dirname, // this doesn't matter, it won't be used
|
||||
rawConfig: {},
|
||||
}
|
||||
it(`should set ${key}`, async () => {
|
||||
@@ -39,7 +40,7 @@ describe.each(
|
||||
json: true,
|
||||
dir: process.cwd(),
|
||||
cliOptions: {},
|
||||
configDir: __dirname, // this doesn't matter, it won't be used
|
||||
configDir: import.meta.dirname, // this doesn't matter, it won't be used
|
||||
rawConfig: {},
|
||||
}
|
||||
it(`should set ${key}`, async () => {
|
||||
@@ -68,7 +69,7 @@ describe.each(
|
||||
json: true,
|
||||
dir: process.cwd(),
|
||||
cliOptions: {},
|
||||
configDir: __dirname, // this doesn't matter, it won't be used
|
||||
configDir: import.meta.dirname, // this doesn't matter, it won't be used
|
||||
rawConfig: {},
|
||||
}
|
||||
it(`${key} should reject a non-string value`, async () => {
|
||||
@@ -87,7 +88,7 @@ describe.each(
|
||||
const configOpts = {
|
||||
dir: process.cwd(),
|
||||
cliOptions: {},
|
||||
configDir: __dirname, // this doesn't matter, it won't be used
|
||||
configDir: import.meta.dirname, // this doesn't matter, it won't be used
|
||||
rawConfig: {},
|
||||
}
|
||||
it('should set _auth', async () => {
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "../test.lib",
|
||||
"rootDir": "."
|
||||
"outDir": "../node_modules/.test.lib",
|
||||
"rootDir": "..",
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/pnpm/pnpm/issues"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"exports": {
|
||||
@@ -27,7 +27,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"_test": "jest",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"compile": "tsc --build && pnpm run lint --fix"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user