Migrate server to TypeScript 7 (tsgo) (#8039)

* Migrate server to TypeScript 7 (tsgo)

Bump typescript to ^7.0.0 in ep_etherpad-lite and bin. Fix the two
diagnostics the new compiler reports: an unguarded spread of
splitTextLines' nullable result in TextLinesMutator (silenced with
@ts-ignore, matching the sibling push calls), and per-element overload
errors on the hooks.ts test-case concat that a single @ts-ignore no
longer covers (replaced with an explicit any[] cast).

admin and ui intentionally stay on TypeScript 6: their build depends on
openapi-typescript, which uses the JS compiler API that tsgo does not
expose until 7.1.

pnpm-workspace.yaml gains minimum-release-age exclusions for the
freshly released typescript 7 packages.

* Address review: null-safe splitTextLines spread, typed hook test cases

Replace the @ts-ignore-only approach with a real null guard
(splitTextLines(text) ?? []) in TextLinesMutator.insert, and replace
the any[] cast in hooks.ts with an explicit HookFnTestCase type so the
concatenated test cases stay shape-checked.

* Type _curSplice as [number, number, ...string[]], drop 21 ts-ignores

The tuple was declared [number, number?] but it actually carries the
lines to insert after the two splice numbers (the JSDoc already said
so). Typing it correctly removes every curSplice-related ts-ignore in
the file, including the one added earlier in this branch. The two
remaining ignores are about StringArrayLike lines, unrelated to this
migration.

No behavior change: types and casts only. tsc --noEmit clean,
easysync mutation tests pass.

---------

Co-authored-by: SamTV12345 <40429738+samtv12345@users.noreply.github.com>
This commit is contained in:
정건우(ignite) 2026-07-28 04:00:32 +09:00 committed by GitHub
parent b7bbacc2b2
commit 66dd455124
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 316 additions and 99 deletions

View file

@ -16,7 +16,7 @@
"devDependencies": {
"@types/node": "^26.1.1",
"@types/semver": "^7.7.1",
"typescript": "^6.0.3"
"typescript": "^7.0.0"
},
"scripts": {
"makeDocs": "node --import tsx make_docs.ts",

324
pnpm-lock.yaml generated
View file

@ -166,7 +166,7 @@ importers:
version: 4.23.1
ueberdb2:
specifier: 6.1.16
version: 6.1.16(@elastic/elasticsearch@9.4.2)(async@3.2.6)(cassandra-driver@4.9.0)(dirty-ts@1.1.8)(mongodb@7.4.0(socks@2.8.9))(mssql@12.7.0)(mysql2@3.23.1(@types/node@26.1.1))(nano@11.0.6)(pg@8.22.0)(redis@6.1.0(@opentelemetry/api@1.9.1))(rethinkdb@2.4.2)(rusty-store-kv@1.3.1)(surrealdb@2.0.8(tslib@2.8.1)(typescript@6.0.3))
version: 6.1.16(@elastic/elasticsearch@9.4.2)(async@3.2.6)(cassandra-driver@4.9.0)(dirty-ts@1.1.8)(mongodb@7.4.0(socks@2.8.9))(mssql@12.7.0)(mysql2@3.23.1(@types/node@26.1.1))(nano@11.0.6)(pg@8.22.0)(redis@6.1.0(@opentelemetry/api@1.9.1))(rethinkdb@2.4.2)(rusty-store-kv@1.3.1)(surrealdb@2.0.8(tslib@2.8.1)(typescript@7.0.2))
devDependencies:
'@types/node':
specifier: ^26.1.1
@ -175,8 +175,8 @@ importers:
specifier: ^7.7.1
version: 7.7.1
typescript:
specifier: ^6.0.3
version: 6.0.3
specifier: ^7.0.0
version: 7.0.2
doc:
dependencies:
@ -300,7 +300,7 @@ importers:
version: 9.0.3
oidc-provider:
specifier: 9.10.0
version: 9.10.0
version: 9.10.0(supports-color@8.1.1)
openapi-backend:
specifier: ^5.18.0
version: 5.18.0
@ -351,7 +351,7 @@ importers:
version: 10.3.0
surrealdb:
specifier: ^2.0.8
version: 2.0.8(tslib@2.8.1)(typescript@6.0.3)
version: 2.0.8(tslib@2.8.1)(typescript@7.0.2)
tinycon:
specifier: 0.6.8
version: 0.6.8
@ -360,7 +360,7 @@ importers:
version: 4.23.1
ueberdb2:
specifier: 6.1.16
version: 6.1.16(@elastic/elasticsearch@9.4.2)(async@3.2.6)(cassandra-driver@4.9.0)(dirty-ts@1.1.8)(mongodb@7.4.0(socks@2.8.9))(mssql@12.7.0)(mysql2@3.23.1(@types/node@26.1.1))(nano@11.0.6)(pg@8.22.0)(redis@6.1.0(@opentelemetry/api@1.9.1))(rethinkdb@2.4.2)(rusty-store-kv@1.3.1)(surrealdb@2.0.8(tslib@2.8.1)(typescript@6.0.3))
version: 6.1.16(@elastic/elasticsearch@9.4.2)(async@3.2.6)(cassandra-driver@4.9.0)(dirty-ts@1.1.8)(mongodb@7.4.0(socks@2.8.9))(mssql@12.7.0)(mysql2@3.23.1(@types/node@26.1.1))(nano@11.0.6)(pg@8.22.0)(redis@6.1.0(@opentelemetry/api@1.9.1))(rethinkdb@2.4.2)(rusty-store-kv@1.3.1)(surrealdb@2.0.8(tslib@2.8.1)(typescript@7.0.2))
underscore:
specifier: 1.13.8
version: 1.13.8
@ -451,7 +451,7 @@ importers:
version: 10.6.0
eslint-config-etherpad:
specifier: ^4.0.5
version: 4.0.5(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3)
version: 4.0.5(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2)
etherpad-cli-client:
specifier: ^4.0.3
version: 4.0.3
@ -480,8 +480,8 @@ importers:
specifier: ^7.2.2
version: 7.2.2
typescript:
specifier: ^6.0.3
version: 6.0.3
specifier: ^7.0.0
version: 7.0.2
vitest:
specifier: ^4.1.10
version: 4.1.10(@opentelemetry/api@1.9.1)(@types/node@26.1.1)(jsdom@29.1.1(@noble/hashes@1.8.0))(vite@8.1.4(@types/node@26.1.1)(esbuild@0.28.1)(tsx@4.23.1))
@ -2104,6 +2104,126 @@ packages:
resolution: {integrity: sha512-UexrHGnGTpbuQHct2ExOc2ZcFbGUS9FOesCxxqdBGcpI1BxYu/LZ6U8Aq6/72XtF/qRBk9nhuGHFJIXXMhPMdw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@typescript/typescript-aix-ppc64@7.0.2':
resolution: {integrity: sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==}
engines: {node: '>=16.20.0'}
cpu: [ppc64]
os: [aix]
'@typescript/typescript-darwin-arm64@7.0.2':
resolution: {integrity: sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [darwin]
'@typescript/typescript-darwin-x64@7.0.2':
resolution: {integrity: sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [darwin]
'@typescript/typescript-freebsd-arm64@7.0.2':
resolution: {integrity: sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [freebsd]
'@typescript/typescript-freebsd-x64@7.0.2':
resolution: {integrity: sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [freebsd]
'@typescript/typescript-linux-arm64@7.0.2':
resolution: {integrity: sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [linux]
'@typescript/typescript-linux-arm@7.0.2':
resolution: {integrity: sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==}
engines: {node: '>=16.20.0'}
cpu: [arm]
os: [linux]
'@typescript/typescript-linux-loong64@7.0.2':
resolution: {integrity: sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==}
engines: {node: '>=16.20.0'}
cpu: [loong64]
os: [linux]
'@typescript/typescript-linux-mips64el@7.0.2':
resolution: {integrity: sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==}
engines: {node: '>=16.20.0'}
cpu: [mips64el]
os: [linux]
'@typescript/typescript-linux-ppc64@7.0.2':
resolution: {integrity: sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==}
engines: {node: '>=16.20.0'}
cpu: [ppc64]
os: [linux]
'@typescript/typescript-linux-riscv64@7.0.2':
resolution: {integrity: sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==}
engines: {node: '>=16.20.0'}
cpu: [riscv64]
os: [linux]
'@typescript/typescript-linux-s390x@7.0.2':
resolution: {integrity: sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==}
engines: {node: '>=16.20.0'}
cpu: [s390x]
os: [linux]
'@typescript/typescript-linux-x64@7.0.2':
resolution: {integrity: sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [linux]
'@typescript/typescript-netbsd-arm64@7.0.2':
resolution: {integrity: sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [netbsd]
'@typescript/typescript-netbsd-x64@7.0.2':
resolution: {integrity: sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [netbsd]
'@typescript/typescript-openbsd-arm64@7.0.2':
resolution: {integrity: sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [openbsd]
'@typescript/typescript-openbsd-x64@7.0.2':
resolution: {integrity: sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [openbsd]
'@typescript/typescript-sunos-x64@7.0.2':
resolution: {integrity: sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [sunos]
'@typescript/typescript-win32-arm64@7.0.2':
resolution: {integrity: sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==}
engines: {node: '>=16.20.0'}
cpu: [arm64]
os: [win32]
'@typescript/typescript-win32-x64@7.0.2':
resolution: {integrity: sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==}
engines: {node: '>=16.20.0'}
cpu: [x64]
os: [win32]
'@typespec/ts-http-runtime@0.3.6':
resolution: {integrity: sha512-jIXhD0eWQ1JA6ln/5Dltyx22UxWNrw0hZmhy2rlv6m6KgF7kplHx3g0fzi09lNmTJQRR91OlemYp3xFnvDK9og==}
engines: {node: '>=20.0.0'}
@ -5388,6 +5508,11 @@ packages:
engines: {node: '>=14.17'}
hasBin: true
typescript@7.0.2:
resolution: {integrity: sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==}
engines: {node: '>=16.20.0'}
hasBin: true
ueberdb2@6.1.16:
resolution: {integrity: sha512-2VlpUIjperGGzZzH2AqrhZfviA3BmA3qgw+LHbDxXgOoiBRMV1P9IFkFK4wBDf3gMyj9/jBNoil5QOwkvXLj4A==}
engines: {node: '>=24.0.0'}
@ -6382,7 +6507,7 @@ snapshots:
dependencies:
vary: 1.1.2
'@koa/router@15.7.0(koa@3.2.1)':
'@koa/router@15.7.0(koa@3.2.1)(supports-color@8.1.1)':
dependencies:
debug: 4.4.3(supports-color@8.1.1)
http-errors: 2.0.1
@ -6959,11 +7084,11 @@ snapshots:
'@surrealdb/cbor@2.0.0-alpha.4': {}
'@surrealdb/sqon@0.1.0(tslib@2.8.1)(typescript@6.0.3)':
'@surrealdb/sqon@0.1.0(tslib@2.8.1)(typescript@7.0.2)':
dependencies:
'@surrealdb/cbor': 2.0.0-alpha.4
tslib: 2.8.1
typescript: 6.0.3
typescript: 7.0.2
uuidv7: 1.2.1
'@swc/helpers@0.5.23':
@ -7245,21 +7370,21 @@ snapshots:
dependencies:
'@types/node': 26.1.1
'@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3)':
'@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2)':
dependencies:
'@eslint-community/regexpp': 4.12.2
'@typescript-eslint/parser': 7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3)
'@typescript-eslint/parser': 7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2)
'@typescript-eslint/scope-manager': 7.18.0
'@typescript-eslint/type-utils': 7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3)
'@typescript-eslint/utils': 7.18.0(eslint@10.6.0)(typescript@6.0.3)
'@typescript-eslint/type-utils': 7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2)
'@typescript-eslint/utils': 7.18.0(eslint@10.6.0)(typescript@7.0.2)
'@typescript-eslint/visitor-keys': 7.18.0
eslint: 10.6.0
graphemer: 1.4.0
ignore: 5.3.2
natural-compare: 1.4.0
ts-api-utils: 1.4.3(typescript@6.0.3)
ts-api-utils: 1.4.3(typescript@7.0.2)
optionalDependencies:
typescript: 6.0.3
typescript: 7.0.2
transitivePeerDependencies:
- supports-color
@ -7279,16 +7404,16 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3)':
'@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2)':
dependencies:
'@typescript-eslint/scope-manager': 7.18.0
'@typescript-eslint/types': 7.18.0
'@typescript-eslint/typescript-estree': 7.18.0(supports-color@8.1.1)(typescript@6.0.3)
'@typescript-eslint/typescript-estree': 7.18.0(supports-color@8.1.1)(typescript@7.0.2)
'@typescript-eslint/visitor-keys': 7.18.0
debug: 4.4.3(supports-color@8.1.1)
eslint: 10.6.0
optionalDependencies:
typescript: 6.0.3
typescript: 7.0.2
transitivePeerDependencies:
- supports-color
@ -7327,15 +7452,15 @@ snapshots:
dependencies:
typescript: 6.0.3
'@typescript-eslint/type-utils@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3)':
'@typescript-eslint/type-utils@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2)':
dependencies:
'@typescript-eslint/typescript-estree': 7.18.0(supports-color@8.1.1)(typescript@6.0.3)
'@typescript-eslint/utils': 7.18.0(eslint@10.6.0)(typescript@6.0.3)
'@typescript-eslint/typescript-estree': 7.18.0(supports-color@8.1.1)(typescript@7.0.2)
'@typescript-eslint/utils': 7.18.0(eslint@10.6.0)(typescript@7.0.2)
debug: 4.4.3(supports-color@8.1.1)
eslint: 10.6.0
ts-api-utils: 1.4.3(typescript@6.0.3)
ts-api-utils: 1.4.3(typescript@7.0.2)
optionalDependencies:
typescript: 6.0.3
typescript: 7.0.2
transitivePeerDependencies:
- supports-color
@ -7355,7 +7480,7 @@ snapshots:
'@typescript-eslint/types@8.63.0': {}
'@typescript-eslint/typescript-estree@7.18.0(supports-color@8.1.1)(typescript@6.0.3)':
'@typescript-eslint/typescript-estree@7.18.0(supports-color@8.1.1)(typescript@7.0.2)':
dependencies:
'@typescript-eslint/types': 7.18.0
'@typescript-eslint/visitor-keys': 7.18.0
@ -7364,9 +7489,9 @@ snapshots:
is-glob: 4.0.3
minimatch: 10.2.5
semver: 7.8.5
ts-api-utils: 1.4.3(typescript@6.0.3)
ts-api-utils: 1.4.3(typescript@7.0.2)
optionalDependencies:
typescript: 6.0.3
typescript: 7.0.2
transitivePeerDependencies:
- supports-color
@ -7385,12 +7510,12 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/utils@7.18.0(eslint@10.6.0)(typescript@6.0.3)':
'@typescript-eslint/utils@7.18.0(eslint@10.6.0)(typescript@7.0.2)':
dependencies:
'@eslint-community/eslint-utils': 4.9.1(eslint@10.6.0)
'@typescript-eslint/scope-manager': 7.18.0
'@typescript-eslint/types': 7.18.0
'@typescript-eslint/typescript-estree': 7.18.0(supports-color@8.1.1)(typescript@6.0.3)
'@typescript-eslint/typescript-estree': 7.18.0(supports-color@8.1.1)(typescript@7.0.2)
eslint: 10.6.0
transitivePeerDependencies:
- supports-color
@ -7417,6 +7542,66 @@ snapshots:
'@typescript-eslint/types': 8.63.0
eslint-visitor-keys: 5.0.1
'@typescript/typescript-aix-ppc64@7.0.2':
optional: true
'@typescript/typescript-darwin-arm64@7.0.2':
optional: true
'@typescript/typescript-darwin-x64@7.0.2':
optional: true
'@typescript/typescript-freebsd-arm64@7.0.2':
optional: true
'@typescript/typescript-freebsd-x64@7.0.2':
optional: true
'@typescript/typescript-linux-arm64@7.0.2':
optional: true
'@typescript/typescript-linux-arm@7.0.2':
optional: true
'@typescript/typescript-linux-loong64@7.0.2':
optional: true
'@typescript/typescript-linux-mips64el@7.0.2':
optional: true
'@typescript/typescript-linux-ppc64@7.0.2':
optional: true
'@typescript/typescript-linux-riscv64@7.0.2':
optional: true
'@typescript/typescript-linux-s390x@7.0.2':
optional: true
'@typescript/typescript-linux-x64@7.0.2':
optional: true
'@typescript/typescript-netbsd-arm64@7.0.2':
optional: true
'@typescript/typescript-netbsd-x64@7.0.2':
optional: true
'@typescript/typescript-openbsd-arm64@7.0.2':
optional: true
'@typescript/typescript-openbsd-x64@7.0.2':
optional: true
'@typescript/typescript-sunos-x64@7.0.2':
optional: true
'@typescript/typescript-win32-arm64@7.0.2':
optional: true
'@typescript/typescript-win32-x64@7.0.2':
optional: true
'@typespec/ts-http-runtime@0.3.6':
dependencies:
http-proxy-agent: 7.0.2
@ -8402,17 +8587,17 @@ snapshots:
eslint: 10.6.0
semver: 7.8.5
eslint-config-etherpad@4.0.5(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3):
eslint-config-etherpad@4.0.5(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2):
dependencies:
'@rushstack/eslint-patch': 1.16.1
'@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3)
'@typescript-eslint/parser': 7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3)
eslint-import-resolver-typescript: 3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1)
'@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2)
'@typescript-eslint/parser': 7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2)
eslint-import-resolver-typescript: 3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1)
eslint-plugin-cypress: 2.15.2(eslint@10.6.0)
eslint-plugin-eslint-comments: 3.2.0(eslint@10.6.0)
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1))(eslint@10.6.0)
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1))(eslint@10.6.0)
eslint-plugin-mocha: 10.5.0(eslint@10.6.0)
eslint-plugin-n: 17.24.0(eslint@10.6.0)(typescript@6.0.3)
eslint-plugin-n: 17.24.0(eslint@10.6.0)(typescript@7.0.2)
eslint-plugin-prefer-arrow: 1.2.3(eslint@10.6.0)
eslint-plugin-promise: 6.6.0(eslint@10.6.0)
eslint-plugin-you-dont-need-lodash-underscore: 6.14.0
@ -8431,7 +8616,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1):
eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1):
dependencies:
'@nolyfill/is-core-module': 1.0.39
debug: 4.4.3(supports-color@8.1.1)
@ -8442,18 +8627,18 @@ snapshots:
stable-hash: 0.0.5
tinyglobby: 0.2.17
optionalDependencies:
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1))(eslint@10.6.0)
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1))(eslint@10.6.0)
transitivePeerDependencies:
- supports-color
eslint-module-utils@2.14.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint-import-resolver-node@0.3.10)(eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1))(eslint@10.6.0):
eslint-module-utils@2.14.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint-import-resolver-node@0.3.10)(eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1))(eslint@10.6.0):
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3)
'@typescript-eslint/parser': 7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2)
eslint: 10.6.0
eslint-import-resolver-node: 0.3.10
eslint-import-resolver-typescript: 3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1)
eslint-import-resolver-typescript: 3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1)
transitivePeerDependencies:
- supports-color
@ -8475,7 +8660,7 @@ snapshots:
eslint: 10.6.0
ignore: 5.3.2
eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1))(eslint@10.6.0):
eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1))(eslint@10.6.0):
dependencies:
'@rtsao/scc': 1.1.0
array-includes: 3.1.9
@ -8486,7 +8671,7 @@ snapshots:
doctrine: 2.1.0
eslint: 10.6.0
eslint-import-resolver-node: 0.3.10
eslint-module-utils: 2.14.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint-import-resolver-node@0.3.10)(eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1))(eslint@10.6.0)
eslint-module-utils: 2.14.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint-import-resolver-node@0.3.10)(eslint-import-resolver-typescript@3.9.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2))(eslint@10.6.0))(eslint@10.6.0)(supports-color@8.1.1))(eslint@10.6.0)
hasown: 2.0.4
is-core-module: 2.16.2
is-glob: 4.0.3
@ -8498,7 +8683,7 @@ snapshots:
string.prototype.trimend: 1.0.10
tsconfig-paths: 3.15.0
optionalDependencies:
'@typescript-eslint/parser': 7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@6.0.3)
'@typescript-eslint/parser': 7.18.0(eslint@10.6.0)(supports-color@8.1.1)(typescript@7.0.2)
transitivePeerDependencies:
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
@ -8511,7 +8696,7 @@ snapshots:
globals: 13.24.0
rambda: 7.5.0
eslint-plugin-n@17.24.0(eslint@10.6.0)(typescript@6.0.3):
eslint-plugin-n@17.24.0(eslint@10.6.0)(typescript@7.0.2):
dependencies:
'@eslint-community/eslint-utils': 4.9.1(eslint@10.6.0)
enhanced-resolve: 5.24.2
@ -8522,7 +8707,7 @@ snapshots:
globrex: 0.1.2
ignore: 5.3.2
semver: 7.8.5
ts-declaration-location: 1.0.7(typescript@6.0.3)
ts-declaration-location: 1.0.7(typescript@7.0.2)
transitivePeerDependencies:
- typescript
@ -9955,10 +10140,10 @@ snapshots:
obug@2.1.3: {}
oidc-provider@9.10.0:
oidc-provider@9.10.0(supports-color@8.1.1):
dependencies:
'@koa/cors': 5.0.0
'@koa/router': 15.7.0(koa@3.2.1)
'@koa/router': 15.7.0(koa@3.2.1)(supports-color@8.1.1)
debug: 4.4.3(supports-color@8.1.1)
eta: 4.6.0
jose: 6.2.4
@ -10937,11 +11122,11 @@ snapshots:
supports-preserve-symlinks-flag@1.0.0: {}
surrealdb@2.0.8(tslib@2.8.1)(typescript@6.0.3):
surrealdb@2.0.8(tslib@2.8.1)(typescript@7.0.2):
dependencies:
'@surrealdb/sqon': 0.1.0(tslib@2.8.1)(typescript@6.0.3)
'@surrealdb/sqon': 0.1.0(tslib@2.8.1)(typescript@7.0.2)
tslib: 2.8.1
typescript: 6.0.3
typescript: 7.0.2
swagger-schema-official@2.0.0-bab6bed: {}
@ -11025,18 +11210,18 @@ snapshots:
trough@2.2.0: {}
ts-api-utils@1.4.3(typescript@6.0.3):
ts-api-utils@1.4.3(typescript@7.0.2):
dependencies:
typescript: 6.0.3
typescript: 7.0.2
ts-api-utils@2.5.0(typescript@6.0.3):
dependencies:
typescript: 6.0.3
ts-declaration-location@1.0.7(typescript@6.0.3):
ts-declaration-location@1.0.7(typescript@7.0.2):
dependencies:
picomatch: 4.0.5
typescript: 6.0.3
typescript: 7.0.2
tsconfig-paths@3.15.0:
dependencies:
@ -11108,7 +11293,30 @@ snapshots:
typescript@6.0.3: {}
ueberdb2@6.1.16(@elastic/elasticsearch@9.4.2)(async@3.2.6)(cassandra-driver@4.9.0)(dirty-ts@1.1.8)(mongodb@7.4.0(socks@2.8.9))(mssql@12.7.0)(mysql2@3.23.1(@types/node@26.1.1))(nano@11.0.6)(pg@8.22.0)(redis@6.1.0(@opentelemetry/api@1.9.1))(rethinkdb@2.4.2)(rusty-store-kv@1.3.1)(surrealdb@2.0.8(tslib@2.8.1)(typescript@6.0.3)):
typescript@7.0.2:
optionalDependencies:
'@typescript/typescript-aix-ppc64': 7.0.2
'@typescript/typescript-darwin-arm64': 7.0.2
'@typescript/typescript-darwin-x64': 7.0.2
'@typescript/typescript-freebsd-arm64': 7.0.2
'@typescript/typescript-freebsd-x64': 7.0.2
'@typescript/typescript-linux-arm': 7.0.2
'@typescript/typescript-linux-arm64': 7.0.2
'@typescript/typescript-linux-loong64': 7.0.2
'@typescript/typescript-linux-mips64el': 7.0.2
'@typescript/typescript-linux-ppc64': 7.0.2
'@typescript/typescript-linux-riscv64': 7.0.2
'@typescript/typescript-linux-s390x': 7.0.2
'@typescript/typescript-linux-x64': 7.0.2
'@typescript/typescript-netbsd-arm64': 7.0.2
'@typescript/typescript-netbsd-x64': 7.0.2
'@typescript/typescript-openbsd-arm64': 7.0.2
'@typescript/typescript-openbsd-x64': 7.0.2
'@typescript/typescript-sunos-x64': 7.0.2
'@typescript/typescript-win32-arm64': 7.0.2
'@typescript/typescript-win32-x64': 7.0.2
ueberdb2@6.1.16(@elastic/elasticsearch@9.4.2)(async@3.2.6)(cassandra-driver@4.9.0)(dirty-ts@1.1.8)(mongodb@7.4.0(socks@2.8.9))(mssql@12.7.0)(mysql2@3.23.1(@types/node@26.1.1))(nano@11.0.6)(pg@8.22.0)(redis@6.1.0(@opentelemetry/api@1.9.1))(rethinkdb@2.4.2)(rusty-store-kv@1.3.1)(surrealdb@2.0.8(tslib@2.8.1)(typescript@7.0.2)):
optionalDependencies:
'@elastic/elasticsearch': 9.4.2
async: 3.2.6
@ -11122,7 +11330,7 @@ snapshots:
redis: 6.1.0(@opentelemetry/api@1.9.1)
rethinkdb: 2.4.2
rusty-store-kv: 1.3.1
surrealdb: 2.0.8(tslib@2.8.1)(typescript@6.0.3)
surrealdb: 2.0.8(tslib@2.8.1)(typescript@7.0.2)
uid-safe@2.1.5:
dependencies:

View file

@ -56,3 +56,24 @@ minimumReleaseAgeExclude:
- mysql2@3.22.6
- oidc-provider@9.9.0
- sql-escaper@1.4.0
- '@typescript/typescript-aix-ppc64@7.0.2'
- '@typescript/typescript-darwin-arm64@7.0.2'
- '@typescript/typescript-darwin-x64@7.0.2'
- '@typescript/typescript-freebsd-arm64@7.0.2'
- '@typescript/typescript-freebsd-x64@7.0.2'
- '@typescript/typescript-linux-arm64@7.0.2'
- '@typescript/typescript-linux-arm@7.0.2'
- '@typescript/typescript-linux-loong64@7.0.2'
- '@typescript/typescript-linux-mips64el@7.0.2'
- '@typescript/typescript-linux-ppc64@7.0.2'
- '@typescript/typescript-linux-riscv64@7.0.2'
- '@typescript/typescript-linux-s390x@7.0.2'
- '@typescript/typescript-linux-x64@7.0.2'
- '@typescript/typescript-netbsd-arm64@7.0.2'
- '@typescript/typescript-netbsd-x64@7.0.2'
- '@typescript/typescript-openbsd-arm64@7.0.2'
- '@typescript/typescript-openbsd-x64@7.0.2'
- '@typescript/typescript-sunos-x64@7.0.2'
- '@typescript/typescript-win32-arm64@7.0.2'
- '@typescript/typescript-win32-x64@7.0.2'
- typescript@7.0.2

View file

@ -131,7 +131,7 @@
"sinon": "^22.0.0",
"split-grid": "^1.0.11",
"supertest": "^7.2.2",
"typescript": "^6.0.3",
"typescript": "^7.0.0",
"vitest": "^4.1.10"
},
"engines": {

View file

@ -13,7 +13,10 @@ import {splitTextLines} from "./Changeset";
*/
class TextLinesMutator {
private _lines: string[];
private _curSplice: [number, number?];
// Args for a future this._lines.splice(): [index, deleteCount, ...linesToInsert].
// Indexing past the two leading numbers yields `string | number` to the compiler even though
// elements from index 2 on are always strings, hence the `as string` casts below.
private _curSplice: [number, number, ...string[]];
private _inSplice: boolean;
private _curLine: number;
private _curCol: number;
@ -132,9 +135,7 @@ class TextLinesMutator {
*/
_putCurLineInSplice() {
if (!this._isCurLineInSplice()) {
// @ts-ignore
this._curSplice.push(this._linesGet(this._curSplice[0] + this._curSplice[1]));
// @ts-ignore
this._curSplice[1]++;
}
// TODO should be the same as this._curSplice.length - 1
@ -211,7 +212,6 @@ class TextLinesMutator {
* @returns {string} joined lines
*/
const nextKLinesText = (k: number) => {
// @ts-ignore
const m = this._curSplice[0] + this._curSplice[1];
return this._linesSlice(m, m + k).join('');
};
@ -219,29 +219,22 @@ class TextLinesMutator {
let removed = '';
if (this._isCurLineInSplice()) {
if (this._curCol === 0) {
// @ts-ignore
removed = this._curSplice[this._curSplice.length - 1];
removed = this._curSplice[this._curSplice.length - 1] as string;
this._curSplice.length--;
removed += nextKLinesText(L - 1);
// @ts-ignore
this._curSplice[1] += L - 1;
} else {
removed = nextKLinesText(L - 1);
// @ts-ignore
this._curSplice[1] += L - 1;
const sline = this._curSplice.length - 1;
// @ts-ignore
removed = this._curSplice[sline].substring(this._curCol) + removed;
// @ts-ignore
this._curSplice[sline] = this._curSplice[sline].substring(0, this._curCol) +
// @ts-ignore
removed = (this._curSplice[sline] as string).substring(this._curCol) + removed;
this._curSplice[sline] = (this._curSplice[sline] as string).substring(0, this._curCol) +
this._linesGet(this._curSplice[0] + this._curSplice[1]);
// @ts-ignore
this._curSplice[1] += 1;
}
} else {
removed = nextKLinesText(L);
this._curSplice[1]! += L;
this._curSplice[1] += L;
}
return removed;
}
@ -260,12 +253,9 @@ class TextLinesMutator {
// although the line is put into splice, curLine is not increased, because
// only some chars are removed not the whole line
const sline = this._putCurLineInSplice();
// @ts-ignore
const removed = this._curSplice[sline].substring(this._curCol, this._curCol + N);
// @ts-ignore
this._curSplice[sline] = this._curSplice[sline].substring(0, this._curCol) +
// @ts-ignore
this._curSplice[sline].substring(this._curCol + N);
const line = this._curSplice[sline] as string;
const removed = line.substring(this._curCol, this._curCol + N);
this._curSplice[sline] = line.substring(0, this._curCol) + line.substring(this._curCol + N);
return removed;
}
@ -275,34 +265,29 @@ class TextLinesMutator {
* @param {string} text - the text to insert
* @param {number} L - number of newlines in text
*/
insert(text: string | any[], L: any) {
insert(text: string, L: number) {
if (!text) return;
if (!this._inSplice) this._enterSplice();
if (L) {
// @ts-ignore
const newLines = splitTextLines(text);
const newLines = splitTextLines(text) ?? [];
if (this._isCurLineInSplice()) {
const sline = this._curSplice.length - 1;
/** @type {string} */
const theLine = this._curSplice[sline];
const theLine = this._curSplice[sline] as string;
const lineCol = this._curCol;
// Insert the chars up to `curCol` and the first new line.
// @ts-ignore
this._curSplice[sline] = theLine.substring(0, lineCol) + newLines[0];
this._curLine++;
newLines!.splice(0, 1);
newLines.splice(0, 1);
// insert the remaining new lines
// @ts-ignore
this._curSplice.push(...newLines);
this._curLine += newLines!.length;
this._curLine += newLines.length;
// insert the remaining chars from the "old" line (e.g. the line we were in
// when we started to insert new lines)
// @ts-ignore
this._curSplice.push(theLine.substring(lineCol));
this._curCol = 0; // TODO(doc) why is this not set to the length of last line?
} else {
this._curSplice.push(...newLines);
this._curLine += newLines!.length;
this._curLine += newLines.length;
}
} else {
// There are no additional lines. Although the line is put into splice, curLine is not
@ -315,10 +300,8 @@ class TextLinesMutator {
'https://github.com/ether/etherpad-lite/issues/2802');
console.error(err.stack || err.toString());
}
// @ts-ignore
this._curSplice[sline] = this._curSplice[sline].substring(0, this._curCol) + text +
// @ts-ignore
this._curSplice[sline].substring(this._curCol);
const line = this._curSplice[sline] as string;
this._curSplice[sline] = line.substring(0, this._curCol) + text + line.substring(this._curCol);
this._curCol += text.length;
}
}
@ -331,7 +314,6 @@ class TextLinesMutator {
hasMore() {
let docLines = this._linesLength();
if (this._inSplice) {
// @ts-ignore
docLines += this._curSplice.length - 2 - this._curSplice[1];
}
return this._curLine < docLines;

View file

@ -65,7 +65,14 @@ describe(__filename, function () {
});
// Hook functions that should work for both synchronous and asynchronous hooks.
const supportedSyncHookFunctions = [
type HookFnTestCase = {
name: string;
fn: (hn: any, ctx: any, cb?: any) => any;
want?: unknown;
wantErr?: string;
syncOk?: boolean;
};
const supportedSyncHookFunctions: HookFnTestCase[] = [
{
name: 'return non-Promise value, with callback parameter',
fn: (hn:Function, ctx:any, cb:Function) => 'val',
@ -563,7 +570,6 @@ describe(__filename, function () {
});
describe('supported hook function styles', function () {
// @ts-ignore
const supportedHookFunctions = supportedSyncHookFunctions.concat([
{
name: 'legacy async cb',