Skip to content

Commit c0e93a2

Browse files
committed
Revert "Use --experimental-transform-types"
This reverts commit d3b1caf.
1 parent d3b1caf commit c0e93a2

37 files changed

+122
-142
lines changed

Diff for: .github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fetch-depth: 1
1313
- uses: actions/setup-node@v3
1414
with:
15-
node-version: 22
15+
node-version: 21
1616
- uses: pnpm/action-setup@v2
1717
with:
1818
version: latest

Diff for: .github/workflows/deploy-web.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fetch-depth: 1
1313
- uses: actions/setup-node@v3
1414
with:
15-
node-version: 22
15+
node-version: 21
1616
- uses: pnpm/action-setup@v2
1717
with:
1818
version: latest

Diff for: .github/workflows/version-or-publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fetch-depth: 1
2121
- uses: actions/setup-node@v3
2222
with:
23-
node-version: 22
23+
node-version: 21
2424
- uses: pnpm/action-setup@v2
2525
with:
2626
version: latest

Diff for: package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@
1111
"build": "pnpm tsc && pnpm -r build",
1212
"format": "prettier --write \"**/*.{ts,json,css}\"",
1313
"test": "pnpm -r test",
14-
"test-js": "pnpm tsc && pnpm -r test-js",
1514
"check-dts": "tsc -p tsconfig.check-dts.json",
1615
"start": "pnpm --filter @arethetypeswrong/web start",
1716
"version": "changeset version && pnpm install --lockfile-only"
1817
},
1918
"devDependencies": {
2019
"@changesets/cli": "^2.27.1",
2120
"prettier": "^3.0.3",
22-
"typescript": "npm:@typescript-deploys/[email protected]"
21+
"typescript": "5.6.1-rc"
2322
},
2423
"engines": {
25-
"node": ">=22",
24+
"node": ">=18",
2625
"pnpm": ">=8"
2726
}
2827
}

Diff for: packages/cli/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
"tsc": "tsc -b",
4141
"local:install": "npm install -g .",
4242
"local:uninstall": "npm uninstall -g @arethetypeswrong/cli",
43-
"test": "node --experimental-transform-types --conditions=@arethetypeswrong/source --test 'test/**/*.test.ts'",
44-
"test-js": "node --experimental-transform-types --test 'test/**/*.test.ts'",
43+
"test": "tsc -b test && node --test 'test/dist/**/*.test.js'",
4544
"prepack": "pnpm tsc"
4645
},
4746
"type": "module",

Diff for: packages/cli/src/getExitCode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { CheckResult } from "@arethetypeswrong/core";
2-
import { problemFlags } from "./problemUtils.ts";
3-
import type { RenderOptions } from "./render/index.ts";
2+
import { problemFlags } from "./problemUtils.js";
3+
import type { RenderOptions } from "./render/index.js";
44

55
export function getExitCode(analysis: CheckResult, opts?: RenderOptions): number {
66
if (!analysis.types) {

Diff for: packages/cli/src/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import { readFile, stat, unlink } from "fs/promises";
1010
import { createRequire } from "module";
1111
import path from "path";
1212
import readline from "readline";
13-
import { problemFlags } from "./problemUtils.ts";
14-
import { readConfig } from "./readConfig.ts";
15-
import * as render from "./render/index.ts";
13+
import { problemFlags } from "./problemUtils.js";
14+
import { readConfig } from "./readConfig.js";
15+
import * as render from "./render/index.js";
1616
import { major, minor } from "semver";
17-
import { getExitCode } from "./getExitCode.ts";
17+
import { getExitCode } from "./getExitCode.js";
1818

1919
const packageJson = createRequire(import.meta.url)("../package.json");
2020
const version = packageJson.version;
@@ -74,8 +74,8 @@ particularly ESM-related module resolution issues.`,
7474
.option("--exclude-entrypoints <entrypoints...>", "Specify entrypoints to exclude from checking.")
7575
.option(
7676
"--entrypoints-legacy",
77-
"In packages without the `exports` field, every file is an entry point. Specifying this option " +
78-
"only takes effect when no entrypoints are automatically detected, or explicitly provided with other options.",
77+
'In packages without the `exports` field, every file is an entry point. Specifying this option ' +
78+
'only takes effect when no entrypoints are automatically detected, or explicitly provided with other options.'
7979
)
8080
.addOption(
8181
new Option("--ignore-rules <rules...>", "Specify rules to ignore").choices(Object.values(problemFlags)).default([]),

Diff for: packages/cli/src/readConfig.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Command } from "commander";
22
import { readFile } from "fs/promises";
3-
import { problemFlags } from "./problemUtils.ts";
3+
import { problemFlags } from "./problemUtils.js";
44

55
export async function readConfig(program: Command, alternate = ".attw.json") {
66
try {

Diff for: packages/cli/src/render/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { problemFlags } from "../problemUtils.ts";
1+
import type { problemFlags } from "../problemUtils.js";
22

33
export type Format = "auto" | "table" | "table-flipped" | "ascii" | "json";
44
export interface RenderOptions {
@@ -9,5 +9,5 @@ export interface RenderOptions {
99
emoji?: boolean;
1010
}
1111

12-
export * from "./typed.ts";
13-
export * from "./untyped.ts";
12+
export * from "./typed.js";
13+
export * from "./untyped.js";

Diff for: packages/cli/src/render/typed.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import chalk from "chalk";
55
import Table, { type GenericTable, type HorizontalTableRow } from "cli-table3";
66
import { marked } from "marked";
77
import TerminalRenderer from "marked-terminal";
8-
import { moduleKinds, problemFlags, resolutionKinds } from "../problemUtils.ts";
9-
import { asciiTable } from "./asciiTable.ts";
10-
import type { RenderOptions } from "./index.ts";
8+
import { moduleKinds, problemFlags, resolutionKinds } from "../problemUtils.js";
9+
import { asciiTable } from "./asciiTable.js";
10+
import type { RenderOptions } from "./index.js";
1111

1212
export async function typed(
1313
analysis: core.Analysis,

Diff for: packages/cli/test/snapshots.test.ts

+20-21
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { access, readFile, writeFile } from "fs/promises";
2+
import { execSync, type SpawnSyncReturns } from "child_process";
13
import assert from "node:assert";
2-
import { spawnSync } from "node:child_process";
3-
import { access, readFile, writeFile } from "node:fs/promises";
44
import { after, describe, test } from "node:test";
55

6-
const attw = new URL("../src/index.ts", import.meta.url).pathname;
6+
const attw = `node ${new URL("../../dist/index.js", import.meta.url).pathname}`;
77
const updateSnapshots = process.env.UPDATE_SNAPSHOTS || process.env.U;
88
const testFilter = (process.env.TEST_FILTER || process.env.T)?.toLowerCase();
99

@@ -34,11 +34,11 @@ const tests = [
3434

3535
[
3636
37-
`--definitely-typed ${new URL("../../core/test/fixtures/@[email protected]", import.meta.url).pathname}`,
37+
`--definitely-typed ${new URL("../../../core/test/fixtures/@[email protected]", import.meta.url).pathname}`,
3838
],
3939
[
4040
41-
`--definitely-typed ${new URL("../../core/test/fixtures/@[email protected]", import.meta.url).pathname}`,
41+
`--definitely-typed ${new URL("../../../core/test/fixtures/@[email protected]", import.meta.url).pathname}`,
4242
],
4343

4444
["[email protected]", "--entrypoints-legacy --ignore-rules=cjs-only-exports-default"],
@@ -68,22 +68,21 @@ describe("snapshots", async () => {
6868
}
6969

7070
test(fixture, async () => {
71-
const tarballPath = new URL(`../../core/test/fixtures/${tarball}`, import.meta.url).pathname;
72-
const {
73-
stdout,
74-
stderr,
75-
status = 1,
76-
} = spawnSync(
77-
process.execPath,
78-
[...process.execArgv, attw, tarballPath, ...(options ?? defaultOpts).split(" ")],
79-
{
71+
const tarballPath = new URL(`../../../core/test/fixtures/${tarball}`, import.meta.url).pathname;
72+
let stdout;
73+
let stderr = "";
74+
let exitCode = 0;
75+
try {
76+
stdout = execSync(`${attw} ${tarballPath} ${options ?? defaultOpts}`, {
8077
encoding: "utf8",
81-
stdio: "pipe",
82-
env: { ...process.env, FORCE_COLOR: "0", NODE_OPTIONS: "--no-warnings" },
83-
},
84-
);
85-
86-
const snapshotURL = new URL(`snapshots/${fixture}.md`, import.meta.url);
78+
env: { ...process.env, FORCE_COLOR: "0" },
79+
});
80+
} catch (error) {
81+
stdout = (error as SpawnSyncReturns<string>).stdout;
82+
stderr = (error as SpawnSyncReturns<string>).stderr;
83+
exitCode = (error as SpawnSyncReturns<string>).status ?? 1;
84+
}
85+
const snapshotURL = new URL(`../snapshots/${fixture}.md`, import.meta.url);
8786
// prettier-ignore
8887
const expectedSnapshot = [
8988
`# ${fixture}`,
@@ -95,7 +94,7 @@ describe("snapshots", async () => {
9594
"",
9695
"```",
9796
"",
98-
`Exit code: ${status}`,
97+
`Exit code: ${exitCode}`,
9998
].join("\n");
10099

101100
if (

Diff for: packages/cli/test/tsconfig.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
2-
"extends": "../../../tsconfig.test.json",
2+
"extends": "../../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"lib": ["es2019"],
5+
"module": "nodenext",
6+
"outDir": "dist",
7+
"types": ["node"]
8+
},
39
"references": [
410
{
511
"path": ".."

Diff for: packages/cli/tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"extends": "../../tsconfig.base.json",
33
"compilerOptions": {
44
"module": "nodenext",
5-
"rewriteRelativeImportExtensions": true,
65
"rootDir": "src",
76
"types": ["node", "ts-expose-internals"],
87
"outDir": "./dist",

Diff for: packages/core/package.json

+6-10
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,29 @@
1919
},
2020
"scripts": {
2121
"tsc": "tsc",
22-
"test": "node --experimental-transform-types --conditions=@arethetypeswrong/source --test 'test/**/*.test.ts'",
23-
"test-js": "node --experimental-transform-types --test 'test/**/*.test.ts'",
22+
"test": "tsc -b test && node --test 'test/dist/**/*.test.js'",
2423
"snapshot": "node scripts/createSnapshotFixture.js",
2524
"prepack": "pnpm tsc"
2625
},
2726
"type": "module",
2827
"imports": {
29-
"#internal/*": {
30-
"@arethetypeswrong/source": "./src/internal/*.ts",
31-
"default": "./dist/internal/*.js"
32-
}
28+
"#internal/*": "./dist/internal/*"
3329
},
3430
"exports": {
3531
".": {
36-
"@arethetypeswrong/source": "./src/index.ts",
32+
"development": "./src/index.ts",
3733
"default": "./dist/index.js"
3834
},
3935
"./types": {
40-
"@arethetypeswrong/source": "./src/types.ts",
36+
"development": "./src/types.ts",
4137
"default": "./dist/types.js"
4238
},
4339
"./utils": {
44-
"@arethetypeswrong/source": "./src/utils.ts",
40+
"development": "./src/utils.ts",
4541
"default": "./dist/utils.js"
4642
},
4743
"./problems": {
48-
"@arethetypeswrong/source": "./src/problems.ts",
44+
"development": "./src/problems.ts",
4945
"default": "./dist/problems.js"
5046
},
5147
"./versions": {

Diff for: packages/core/src/checkPackage.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import type { Package } from "./createPackage.ts";
2-
import checks from "./internal/checks/index.ts";
3-
import type { AnyCheck, CheckDependenciesContext } from "./internal/defineCheck.ts";
4-
import { createCompilerHosts } from "./internal/multiCompilerHost.ts";
1+
import type { Package } from "./createPackage.js";
2+
import checks from "./internal/checks/index.js";
3+
import type { AnyCheck, CheckDependenciesContext } from "./internal/defineCheck.js";
4+
import { createCompilerHosts } from "./internal/multiCompilerHost.js";
55
import type {
66
AnalysisTypes,
77
CheckResult,
88
EntrypointResolutionAnalysis,
99
Problem,
1010
ProgramInfo,
1111
ResolutionOption,
12-
} from "./types.ts";
13-
import { getResolutionOption, visitResolutions } from "./utils.ts";
14-
import { getEntrypointInfo, getModuleKinds, getBuildTools } from "./internal/getEntrypointInfo.ts";
12+
} from "./types.js";
13+
import { getResolutionOption, visitResolutions } from "./utils.js";
14+
import { getEntrypointInfo, getModuleKinds, getBuildTools } from "./internal/getEntrypointInfo.js";
1515

1616
export interface CheckPackageOptions {
1717
/**

Diff for: packages/core/src/createPackage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { untar } from "@andrewbranch/untar.js";
22
import { Gunzip } from "fflate";
33
import { major, maxSatisfying, minor, valid, validRange } from "semver";
44
import ts from "typescript";
5-
import { parsePackageSpec, type ParsedPackageSpec } from "./utils.ts";
5+
import { parsePackageSpec, type ParsedPackageSpec } from "./utils.js";
66

77
export class Package {
88
#files: Record<string, string | Uint8Array> = {};

Diff for: packages/core/src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * from "./checkPackage.ts";
2-
export * from "./createPackage.ts";
3-
export type * from "./types.ts";
1+
export * from "./checkPackage.js";
2+
export * from "./createPackage.js";
3+
export type * from "./types.js";

Diff for: packages/core/src/internal/checks/cjsOnlyExportsDefault.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import ts from "typescript";
2-
import { defineCheck } from "../defineCheck.ts";
2+
import { defineCheck } from "../defineCheck.js";
33

44
export default defineCheck({
55
name: "CJSOnlyExportsDefault",

Diff for: packages/core/src/internal/checks/entrypointResolutions.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ts from "typescript";
2-
import type { Problem } from "../../types.ts";
3-
import { resolvedThroughFallback } from "../../utils.ts";
4-
import { defineCheck } from "../defineCheck.ts";
2+
import type { Problem } from "../../types.js";
3+
import { resolvedThroughFallback } from "../../utils.js";
4+
import { defineCheck } from "../defineCheck.js";
55

66
export default defineCheck({
77
name: "EntrypointResolutions",

Diff for: packages/core/src/internal/checks/exportDefaultDisagreement.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ts from "typescript";
2-
import { defineCheck } from "../defineCheck.ts";
3-
import { getProbableExports, type Export } from "../getProbableExports.ts";
4-
import { getResolutionOption } from "../../utils.ts";
2+
import { defineCheck } from "../defineCheck.js";
3+
import { getProbableExports, type Export } from "../getProbableExports.js";
4+
import { getResolutionOption } from "../../utils.js";
55

66
const bindOptions: ts.CompilerOptions = {
77
target: ts.ScriptTarget.Latest,

Diff for: packages/core/src/internal/checks/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import cjsOnlyExportsDefault from "./cjsOnlyExportsDefault.ts";
2-
import entrypointResolutions from "./entrypointResolutions.ts";
3-
import exportDefaultDisagreement from "./exportDefaultDisagreement.ts";
4-
import internalResolutionError from "./internalResolutionError.ts";
5-
import moduleKindDisagreement from "./moduleKindDisagreement.ts";
6-
import unexpectedModuleSyntax from "./unexpectedModuleSyntax.ts";
1+
import cjsOnlyExportsDefault from "./cjsOnlyExportsDefault.js";
2+
import entrypointResolutions from "./entrypointResolutions.js";
3+
import exportDefaultDisagreement from "./exportDefaultDisagreement.js";
4+
import internalResolutionError from "./internalResolutionError.js";
5+
import moduleKindDisagreement from "./moduleKindDisagreement.js";
6+
import unexpectedModuleSyntax from "./unexpectedModuleSyntax.js";
77

88
export default [
99
entrypointResolutions,

Diff for: packages/core/src/internal/checks/internalResolutionError.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ts from "typescript";
2-
import { defineCheck } from "../defineCheck.ts";
3-
import type { InternalResolutionErrorProblem } from "../../types.ts";
2+
import { defineCheck } from "../defineCheck.js";
3+
import type { InternalResolutionErrorProblem } from "../../types.js";
44

55
export default defineCheck({
66
name: "InternalResolutionError",

Diff for: packages/core/src/internal/checks/moduleKindDisagreement.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import ts from "typescript";
2-
import { defineCheck } from "../defineCheck.ts";
2+
import { defineCheck } from "../defineCheck.js";
33

44
export default defineCheck({
55
name: "ModuleKindDisagreement",

Diff for: packages/core/src/internal/checks/unexpectedModuleSyntax.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import ts from "typescript";
2-
import { defineCheck } from "../defineCheck.ts";
2+
import { defineCheck } from "../defineCheck.js";
33

44
export default defineCheck({
55
name: "UnexpectedModuleSyntax",

Diff for: packages/core/src/internal/defineCheck.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { Package } from "../createPackage.ts";
2-
import type { CompilerHosts } from "./multiCompilerHost.ts";
3-
import type { Analysis, Problem, ResolutionKind, ResolutionOption } from "../types.ts";
1+
import type { Package } from "../createPackage.js";
2+
import type { CompilerHosts } from "./multiCompilerHost.js";
3+
import type { Analysis, Problem, ResolutionKind, ResolutionOption } from "../types.js";
44

55
export interface CheckDependenciesContext<EnumerateFiles extends boolean = false> extends CheckExecutionContext {
66
subpath: string;

0 commit comments

Comments
 (0)