diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index f76f0b610..5e12ffc7e 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -64,6 +64,6 @@ jobs: - name: 📼 Re-record terminal captures if: steps.capture-paths.outputs.changed == 'true' - run: node --experimental-strip-types capture/record.ts + run: node capture/record.ts - uses: autofix-ci/action@7a166d7532b277f34e16238930461bf77f9d7ed8 # 7a166d7532b277f34e16238930461bf77f9d7ed8 diff --git a/.github/workflows/cli-bench.yml b/.github/workflows/cli-bench.yml index 626ac3d92..38d8a7492 100644 --- a/.github/workflows/cli-bench.yml +++ b/.github/workflows/cli-bench.yml @@ -37,7 +37,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: 📊 Run benchmark suites - run: node --experimental-strip-types bench/run.ts --baseline ref:${{ github.event.pull_request.base.sha }} --suite startup --suite modules --suite footprint --out bench-report/report.md + run: node bench/run.ts --baseline ref:${{ github.event.pull_request.base.sha }} --suite startup --suite modules --suite footprint --out bench-report/report.md - name: ⏫ Upload report uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 diff --git a/bench/ab.ts b/bench/ab.ts index 85a9df64f..0501dbe31 100644 --- a/bench/ab.ts +++ b/bench/ab.ts @@ -9,7 +9,7 @@ import { formatDelta, formatMs, markdownTable, summarise } from './lib/stats.ts' * Interleaved startup comparison between arbitrary local builds, for answering * "did this patch cost anything" without going through the full suite. * - * Usage: `node --experimental-strip-types bench/ab.ts --bin with=/path/bin/nuxi.mjs --bin without=/other/bin/nuxi.mjs --case --version` + * Usage: `node bench/ab.ts --bin with=/path/bin/nuxi.mjs --bin without=/other/bin/nuxi.mjs --case --version` */ const { values } = parseArgs({ options: { diff --git a/package.json b/package.json index 95306d57e..d98923293 100644 --- a/package.json +++ b/package.json @@ -22,14 +22,14 @@ "dev": "pnpm -r build --watch", "lint": "eslint .", "lint:fix": "eslint --fix .", - "bench:cli": "node --experimental-strip-types bench/run.ts", - "docs:generate": "node --experimental-strip-types ./scripts/generate-command-docs.ts", + "bench:cli": "node bench/run.ts", + "docs:generate": "node ./scripts/generate-command-docs.ts", "nuxi": "node ./packages/nuxi/bin/nuxi.mjs", "nuxt": "node ./packages/nuxt-cli/bin/nuxi.mjs", "nuxi-bun": "bun --bun ./packages/nuxt-cli/bin/nuxi.mjs", - "postinstall": "node --experimental-strip-types ./scripts/generate-data.ts && pnpm build", + "postinstall": "node ./scripts/generate-data.ts && pnpm build", "test:types": "tsc --noEmit", - "test:docs": "node --experimental-strip-types ./scripts/generate-command-docs.ts --check", + "test:docs": "node ./scripts/generate-command-docs.ts --check", "test:knip": "knip", "test:dist": "pnpm -r test:dist", "test:unit": "vitest --coverage --run && pnpm --filter nuxt-cli-playground test --run" diff --git a/packages/create-nuxt/package.json b/packages/create-nuxt/package.json index ba22be012..28d1c4c9a 100644 --- a/packages/create-nuxt/package.json +++ b/packages/create-nuxt/package.json @@ -27,7 +27,7 @@ "scripts": { "build": "tsdown", "prepack": "tsdown", - "test:dist": "node --experimental-strip-types ../../scripts/check-dist.ts" + "test:dist": "node ../../scripts/check-dist.ts" }, "devDependencies": { "@bomb.sh/tab": "^0.0.22", diff --git a/packages/create-nuxt/test/unit/init-flow.spec.ts b/packages/create-nuxt/test/unit/init-flow.spec.ts index b3ef3b5d6..9eac7c4be 100644 --- a/packages/create-nuxt/test/unit/init-flow.spec.ts +++ b/packages/create-nuxt/test/unit/init-flow.spec.ts @@ -72,8 +72,11 @@ const initCommand = await import('../../src/init').then(r => r.default) let cwd: string class ExitError extends Error { - constructor(readonly code: number | undefined) { + readonly code: number | undefined + + constructor(code: number | undefined) { super(`process.exit(${code})`) + this.code = code } } diff --git a/packages/create-nuxt/test/unit/network-failures.spec.ts b/packages/create-nuxt/test/unit/network-failures.spec.ts index 93d667154..474f9779f 100644 --- a/packages/create-nuxt/test/unit/network-failures.spec.ts +++ b/packages/create-nuxt/test/unit/network-failures.spec.ts @@ -21,8 +21,11 @@ async function closedPort(): Promise { } class ExitError extends Error { - constructor(readonly code: number | undefined) { + readonly code: number | undefined + + constructor(code: number | undefined) { super(`process.exit(${code})`) + this.code = code } } diff --git a/packages/nuxi/package.json b/packages/nuxi/package.json index 9824dd6a8..9bcd0d8b9 100644 --- a/packages/nuxi/package.json +++ b/packages/nuxi/package.json @@ -30,7 +30,7 @@ "scripts": { "build": "tsdown", "prepack": "pnpm build", - "test:dist": "node ./bin/nuxi.mjs info ../../playground && node --experimental-strip-types ../../scripts/check-dist.ts" + "test:dist": "node ./bin/nuxi.mjs info ../../playground && node ../../scripts/check-dist.ts" }, "peerDependencies": { "@nuxt/cli": ">=3.26.0", diff --git a/packages/nuxt-cli/package.json b/packages/nuxt-cli/package.json index 2c91fae82..a16ac8beb 100644 --- a/packages/nuxt-cli/package.json +++ b/packages/nuxt-cli/package.json @@ -33,7 +33,7 @@ "build": "tsdown", "dev:prepare": "tsdown --watch", "prepack": "tsdown", - "test:dist": "node --experimental-strip-types ../../scripts/check-dist.ts && node --experimental-strip-types ../../scripts/check-loading-page.ts" + "test:dist": "node ../../scripts/check-dist.ts && node ../../scripts/check-loading-page.ts" }, "peerDependencies": { "@nuxt/docs": "^4.0.0", diff --git a/packages/nuxt-cli/src/dev/utils.ts b/packages/nuxt-cli/src/dev/utils.ts index c0b4a0c49..7e818f74e 100644 --- a/packages/nuxt-cli/src/dev/utils.ts +++ b/packages/nuxt-cli/src/dev/utils.ts @@ -430,9 +430,13 @@ export class NuxtDevServer extends EventEmitter { progress: DevProgress = this.#progress listener!: Listener - constructor(private options: NuxtDevServerOptions) { + private options: NuxtDevServerOptions + + constructor(options: NuxtDevServerOptions) { super() + this.options = options + this.loadDebounced = debounce(async () => { const reason = this.#pendingReason this.#pendingReason = undefined diff --git a/packages/nuxt-cli/test/unit/commands/network-failures.spec.ts b/packages/nuxt-cli/test/unit/commands/network-failures.spec.ts index 12f849229..790570b58 100644 --- a/packages/nuxt-cli/test/unit/commands/network-failures.spec.ts +++ b/packages/nuxt-cli/test/unit/commands/network-failures.spec.ts @@ -25,8 +25,11 @@ async function closedPort(): Promise { } class ExitError extends Error { - constructor(readonly code: number | undefined) { + readonly code: number | undefined + + constructor(code: number | undefined) { super(`process.exit(${code})`) + this.code = code } } diff --git a/packages/nuxt-cli/test/unit/commands/upgrade-run.spec.ts b/packages/nuxt-cli/test/unit/commands/upgrade-run.spec.ts index 40a6c843c..c0f649b1a 100644 --- a/packages/nuxt-cli/test/unit/commands/upgrade-run.spec.ts +++ b/packages/nuxt-cli/test/unit/commands/upgrade-run.spec.ts @@ -54,8 +54,11 @@ const { render, screen } = await import('../../utils/terminal') const upgrade = await import('../../../src/commands/upgrade').then(r => r.default) class ExitError extends Error { - constructor(readonly code: number | undefined) { + readonly code: number | undefined + + constructor(code: number | undefined) { super(`process.exit(${code})`) + this.code = code } } diff --git a/packages/nuxt-cli/test/unit/dev/initialize.spec.ts b/packages/nuxt-cli/test/unit/dev/initialize.spec.ts index fe3b55151..70ea1b76c 100644 --- a/packages/nuxt-cli/test/unit/dev/initialize.spec.ts +++ b/packages/nuxt-cli/test/unit/dev/initialize.spec.ts @@ -27,8 +27,11 @@ vi.mock('../../../src/dev/utils', () => ({ load = vi.fn(() => Promise.resolve()) progress = { onUpdate: vi.fn(() => () => {}), close: vi.fn() } - constructor(readonly options: Record) { + options: Record + + constructor(options: Record) { super() + this.options = options devServers.push(this) } diff --git a/packages/nuxt-cli/test/unit/loading-client.spec.ts b/packages/nuxt-cli/test/unit/loading-client.spec.ts index 744cc263c..012e116af 100644 --- a/packages/nuxt-cli/test/unit/loading-client.spec.ts +++ b/packages/nuxt-cli/test/unit/loading-client.spec.ts @@ -62,7 +62,10 @@ function run(options: Partial = {}, fetchImpl?: typeof fe const sources: { readyState: number }[] = [] vi.stubGlobal('EventSource', class { readyState = 0 - constructor(readonly url: string) { + url: string + + constructor(url: string) { + this.url = url sources.push(this) } diff --git a/tsconfig.json b/tsconfig.json index c357b78c3..57c21eeca 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,7 @@ "noUnusedLocals": true, "noEmit": true, "allowSyntheticDefaultImports": true, + "erasableSyntaxOnly": true, "skipLibCheck": true }, "exclude": [