mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-27 18:46:18 -04:00
chore: enable TypeScript's erasableSyntaxOnly config (#10365)
* chore: configure `erasableSyntaxOnly`
* refactor: remove class property access modifiers in constructor
```
../dedupe/check/src/DedupeCheckIssuesError.ts:5:16 - error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
5 constructor (public dedupeCheckIssues: DedupeCheckIssues) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../reviewing/dependencies-hierarchy/src/getTree.ts:243:24 - error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
243 private constructor (private readonly keypath: readonly string[]) {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
* chore: migrate from enum types
```
../pkg-manager/plugin-commands-installation/src/import/index.ts:66:6 - error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
66 enum YarnLockType {
~~~~~~~~~~~~
../lockfile/detect-dep-types/src/index.ts:5:13 - error TS1294: This syntax is not allowed when 'erasableSyntaxOnly' is enabled.
5 export enum DepType {
~~~~~~~
```
* chore: add changelog
* chore: remove `ts-node` dev dependency (#10371)
* chore: remove `ts-node` dev dependency
* chore: remove `ts-node` usages from `package.json` scripts
This commit is contained in:
9
.changeset/seven-turtles-attack.md
Normal file
9
.changeset/seven-turtles-attack.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": patch
|
||||
"@pnpm/reviewing.dependencies-hierarchy": patch
|
||||
"@pnpm/lockfile.detect-dep-types": patch
|
||||
"@pnpm/dedupe.check": patch
|
||||
pnpm: patch
|
||||
---
|
||||
|
||||
Removed TypeScript specific syntax (such as enums and visibility modifiers in constructors) to enable `erasableSyntaxOnly`.
|
||||
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"write-release-text": "node --loader ts-node/esm src/main.ts",
|
||||
"write-release-text": "node src/main.ts",
|
||||
"lint": "eslint src/**/*.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"composite": true,
|
||||
"declaration": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "nodenext",
|
||||
"moduleResolution": "nodenext",
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
"scripts": {
|
||||
"prepublishOnly": "pnpm run compile",
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"test-with-preview": "ts-node test",
|
||||
"_test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm run compile && pnpm run _test",
|
||||
"start": "tsc --watch",
|
||||
|
||||
@@ -2,7 +2,10 @@ import { type DedupeCheckIssues } from '@pnpm/dedupe.types'
|
||||
import { PnpmError } from '@pnpm/error'
|
||||
|
||||
export class DedupeCheckIssuesError extends PnpmError {
|
||||
constructor (public dedupeCheckIssues: DedupeCheckIssues) {
|
||||
public dedupeCheckIssues: DedupeCheckIssues
|
||||
|
||||
constructor (dedupeCheckIssues: DedupeCheckIssues) {
|
||||
super('DEDUPE_CHECK_ISSUES', 'Dedupe --check found changes to the lockfile')
|
||||
this.dedupeCheckIssues = dedupeCheckIssues
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@ import { type LockfileObject, type PackageSnapshots, type ResolvedDependencies }
|
||||
import * as dp from '@pnpm/dependency-path'
|
||||
import { type DepPath } from '@pnpm/types'
|
||||
|
||||
export enum DepType {
|
||||
DevOnly,
|
||||
DevAndProd,
|
||||
ProdOnly
|
||||
}
|
||||
export const DepType = {
|
||||
DevOnly: 0,
|
||||
DevAndProd: 1,
|
||||
ProdOnly: 2,
|
||||
} as const
|
||||
|
||||
export type DepType = (typeof DepType)[keyof typeof DepType]
|
||||
|
||||
export type DepTypes = Record<string, DepType>
|
||||
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
"test-pkgs-main": "pnpm remove-temp-dir && pnpm run --no-sort --workspace-concurrency=1 -r _test",
|
||||
"test-branch": "pnpm pretest && pnpm lint && git remote set-branches --add origin main && git fetch origin main && pnpm run test-pkgs-branch",
|
||||
"test-pkgs-branch": "pnpm remove-temp-dir && pnpm --workspace-concurrency=1 --filter=...[origin/main] run --no-sort _test",
|
||||
"compile-only": "pnpm --config.useNodeVersion=24.6.0 exec ts-node __utils__/scripts/src/typecheck-only.ts && pnpm -F pnpm compile",
|
||||
"compile-only": "pnpm --config.useNodeVersion=24.6.0 node __utils__/scripts/src/typecheck-only.ts && pnpm -F pnpm compile",
|
||||
"compile": "pnpm compile-only && pnpm run update-manifests",
|
||||
"watch": "pnpm --filter=@pnpm/fetch run compile && pnpm --filter=pnpm run compile --watch",
|
||||
"make-lcov": "shx mkdir -p coverage && lcov-result-merger './packages/*/coverage/lcov.info' 'coverage/lcov.info'",
|
||||
"update-manifests": "pnpm run meta-updater && pnpm install",
|
||||
"meta-updater": "pnpm --filter=@pnpm-private/updater compile && pnpm exec meta-updater",
|
||||
"lint:meta": "pnpm run meta-updater --test",
|
||||
"copy-artifacts": "ts-node __utils__/scripts/src/copy-artifacts.ts",
|
||||
"copy-artifacts": "node __utils__/scripts/src/copy-artifacts.ts",
|
||||
"make-release-description": "pnpm --filter=@pnpm/get-release-text run write-release-text",
|
||||
"release": "pnpm --filter=@pnpm/exe publish --tag=next-11 --access=public && pnpm publish --filter=!pnpm --filter=!@pnpm/exe --access=public && pnpm publish --filter=pnpm --tag=next-11 --access=public",
|
||||
"dev-setup": "pnpm -C=./pnpm/dev link -g"
|
||||
@@ -56,7 +56,6 @@
|
||||
"rimraf": "catalog:",
|
||||
"shx": "catalog:",
|
||||
"ts-jest": "catalog:",
|
||||
"ts-node": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"verdaccio": "catalog:"
|
||||
},
|
||||
|
||||
@@ -63,14 +63,16 @@ interface YarnPackageLock {
|
||||
[name: string]: YarnLockPackage
|
||||
}
|
||||
|
||||
enum YarnLockType {
|
||||
yarn = 'yarn',
|
||||
yarn2 = 'yarn2'
|
||||
}
|
||||
const YarnLockType = {
|
||||
yarn: 'yarn',
|
||||
yarn2: 'yarn2',
|
||||
} as const
|
||||
|
||||
type YarnLockType = (typeof YarnLockType)[keyof typeof YarnLockType]
|
||||
|
||||
// copy from yarn v1
|
||||
interface YarnLock2Struct {
|
||||
type: YarnLockType.yarn2
|
||||
type: typeof YarnLockType.yarn2
|
||||
object: YarnPackageLock
|
||||
}
|
||||
|
||||
|
||||
37
pnpm-lock.yaml
generated
37
pnpm-lock.yaml
generated
@@ -732,9 +732,6 @@ catalogs:
|
||||
ts-jest-resolver:
|
||||
specifier: 2.0.1
|
||||
version: 2.0.1
|
||||
ts-node:
|
||||
specifier: ^10.9.2
|
||||
version: 10.9.2
|
||||
typescript:
|
||||
specifier: 5.9.2
|
||||
version: 5.9.2
|
||||
@@ -921,9 +918,6 @@ importers:
|
||||
ts-jest:
|
||||
specifier: 'catalog:'
|
||||
version: 29.4.1(@babel/core@7.28.3)(@jest/transform@30.0.5(@babel/types@7.28.2))(@jest/types@30.0.5)(babel-jest@30.0.5(@babel/core@7.28.3)(@babel/types@7.28.2))(jest-util@30.0.5)(jest@30.0.5(@babel/types@7.28.2)(@types/node@22.15.30)(ts-node@10.9.2(@types/node@22.15.30)(typescript@5.9.2)))(typescript@5.9.2)
|
||||
ts-node:
|
||||
specifier: 'catalog:'
|
||||
version: 10.9.2(@types/node@22.15.30)(typescript@5.9.2)
|
||||
typescript:
|
||||
specifier: 'catalog:'
|
||||
version: 5.9.2
|
||||
@@ -17513,6 +17507,7 @@ snapshots:
|
||||
'@cspotcode/source-map-support@0.8.1':
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.9
|
||||
optional: true
|
||||
|
||||
'@cypress/request@3.0.9':
|
||||
dependencies:
|
||||
@@ -17937,6 +17932,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@jridgewell/resolve-uri': 3.1.2
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
optional: true
|
||||
|
||||
'@manypkg/find-root@1.1.0':
|
||||
dependencies:
|
||||
@@ -19255,13 +19251,17 @@ snapshots:
|
||||
dependencies:
|
||||
defer-to-connect: 2.0.1
|
||||
|
||||
'@tsconfig/node10@1.0.11': {}
|
||||
'@tsconfig/node10@1.0.11':
|
||||
optional: true
|
||||
|
||||
'@tsconfig/node12@1.0.11': {}
|
||||
'@tsconfig/node12@1.0.11':
|
||||
optional: true
|
||||
|
||||
'@tsconfig/node14@1.0.3': {}
|
||||
'@tsconfig/node14@1.0.3':
|
||||
optional: true
|
||||
|
||||
'@tsconfig/node16@1.0.4': {}
|
||||
'@tsconfig/node16@1.0.4':
|
||||
optional: true
|
||||
|
||||
'@tybys/wasm-util@0.10.0':
|
||||
dependencies:
|
||||
@@ -20069,6 +20069,7 @@ snapshots:
|
||||
acorn-walk@8.3.4:
|
||||
dependencies:
|
||||
acorn: 8.14.1
|
||||
optional: true
|
||||
|
||||
acorn@8.14.1: {}
|
||||
|
||||
@@ -20186,7 +20187,8 @@ snapshots:
|
||||
readable-stream: 2.3.8
|
||||
optional: true
|
||||
|
||||
arg@4.1.3: {}
|
||||
arg@4.1.3:
|
||||
optional: true
|
||||
|
||||
argparse@1.0.10:
|
||||
dependencies:
|
||||
@@ -20844,7 +20846,8 @@ snapshots:
|
||||
optionalDependencies:
|
||||
typescript: 5.9.2
|
||||
|
||||
create-require@1.1.1: {}
|
||||
create-require@1.1.1:
|
||||
optional: true
|
||||
|
||||
cross-env@10.0.0:
|
||||
dependencies:
|
||||
@@ -21099,7 +21102,8 @@ snapshots:
|
||||
fastest-levenshtein: 1.0.16
|
||||
lodash.deburr: 4.1.0
|
||||
|
||||
diff@4.0.2: {}
|
||||
diff@4.0.2:
|
||||
optional: true
|
||||
|
||||
diff@5.2.0: {}
|
||||
|
||||
@@ -25323,6 +25327,7 @@ snapshots:
|
||||
typescript: 5.9.2
|
||||
v8-compile-cache-lib: 3.0.1
|
||||
yn: 3.1.1
|
||||
optional: true
|
||||
|
||||
ts-toolbelt@9.6.0: {}
|
||||
|
||||
@@ -25557,7 +25562,8 @@ snapshots:
|
||||
|
||||
uuid@9.0.1: {}
|
||||
|
||||
v8-compile-cache-lib@3.0.1: {}
|
||||
v8-compile-cache-lib@3.0.1:
|
||||
optional: true
|
||||
|
||||
v8-compile-cache@2.4.0: {}
|
||||
|
||||
@@ -25965,7 +25971,8 @@ snapshots:
|
||||
dependencies:
|
||||
buffer-crc32: 1.0.0
|
||||
|
||||
yn@3.1.1: {}
|
||||
yn@3.1.1:
|
||||
optional: true
|
||||
|
||||
yocto-queue@0.1.0: {}
|
||||
|
||||
|
||||
@@ -302,7 +302,6 @@ catalog:
|
||||
tree-kill: ^1.2.2
|
||||
ts-jest: 29.4.1
|
||||
ts-jest-resolver: 2.0.1
|
||||
ts-node: ^10.9.2
|
||||
typescript: 5.9.2
|
||||
unified: ^9.2.2
|
||||
uuid: ^9.0.1
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
},
|
||||
"unpkg": "dist/pnpm.mjs",
|
||||
"scripts": {
|
||||
"bundle": "pnpm --config.useNodeVersion=24.6.0 exec ts-node bundle.ts",
|
||||
"bundle": "pnpm --config.useNodeVersion=24.6.0 node bundle.ts",
|
||||
"start": "tsc --watch",
|
||||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"pretest:e2e": "rimraf node_modules/.bin/pnpm",
|
||||
|
||||
@@ -240,7 +240,11 @@ function getTreeHelper (
|
||||
* Useful for detecting cycles.
|
||||
*/
|
||||
class Keypath {
|
||||
private constructor (private readonly keypath: readonly string[]) {}
|
||||
private readonly keypath: readonly string[]
|
||||
|
||||
private constructor (keypath: readonly string[]) {
|
||||
this.keypath = keypath
|
||||
}
|
||||
|
||||
public static initialize (treeNodeId: TreeNodeId): Keypath {
|
||||
return new Keypath([serializeTreeNodeId(treeNodeId)])
|
||||
|
||||
Reference in New Issue
Block a user