Skip to content

Commit ffe212d

Browse files
KrisBraunclaude
andcommitted
fix(twister): resolve exemplar package self-imports in lint and editors
The example twists under src/exemplars import @plotday/twister by package name so their embedded sources show real import paths, but only the build config could resolve that self-reference — `pnpm lint` (tsc --noEmit) and editors reported TS2307/TS2339 on those files. Bundler moduleResolution and the package's own export condition now live in the base tsconfig; the CommonJS CLI build gets a standalone config since bundler resolution is incompatible with its output (TS5095/TS5098). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 4ea7f2d commit ffe212d

4 files changed

Lines changed: 23 additions & 14 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@plotday/twister": patch
3+
---
4+
5+
Fixed: package lint and editor type resolution for the exemplar sources' package self-imports (bundler moduleResolution now applies package-wide; the CommonJS CLI build uses its own standalone config).

‎twister/tsconfig.build.json‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,7 @@
88
"declarationMap": true,
99
"sourceMap": true,
1010
"noEmit": false,
11-
"composite": false,
12-
// src/exemplars/*.ts import "@plotday/twister" by package name (so the
13-
// embedded LLM-facing examples show real import paths, not relative
14-
// ones). Resolving that self-reference requires the same
15-
// moduleResolution + custom condition tsconfig.base.json already grants
16-
// downstream twist/connector projects for the reverse case (resolving
17-
// @plotday/twister straight to this package's src/*). Scoped to this
18-
// build-only config (not tsconfig.json / tsconfig.cli.json) since
19-
// "bundler" resolution is incompatible with tsconfig.cli.json's
20-
// CommonJS output (TS5095).
21-
"moduleResolution": "bundler",
22-
"customConditions": ["@plotday/connector"]
11+
"composite": false
2312
},
2413
"include": ["src/**/*.ts"],
2514
"exclude": [

‎twister/tsconfig.cli.json‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
{
22
"$schema": "https://json.schemastore.org/tsconfig",
3-
"extends": "./tsconfig.json",
3+
// Standalone (does not extend tsconfig.json): the base config uses
4+
// "bundler" moduleResolution + customConditions so the exemplars'
5+
// package self-imports resolve, and both options are incompatible with
6+
// this config's CommonJS output (TS5095/TS5098).
47
"compilerOptions": {
58
"module": "CommonJS",
9+
"moduleResolution": "node",
610
"target": "ES2020",
711
"lib": ["ES2020"],
812
"outDir": "./bin",
913
"rootDir": "./cli",
1014
"resolveJsonModule": true,
1115
"esModuleInterop": true,
16+
"allowSyntheticDefaultImports": true,
17+
"forceConsistentCasingInFileNames": true,
1218
"skipLibCheck": true,
19+
"strict": true,
20+
"sourceMap": true,
1321
"noEmit": false
1422
},
1523
"include": ["cli/**/*.ts"]

‎twister/tsconfig.json‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
"target": "ESNext",
66
"lib": ["ES2021", "ES2022.error", "WebWorker"],
77
"module": "ESNext",
8-
"moduleResolution": "node",
8+
// src/exemplars/*.ts import "@plotday/twister" by package name (so the
9+
// embedded LLM-facing examples show real import paths). Resolving that
10+
// self-reference needs bundler resolution + the custom condition that
11+
// downstream twist/connector projects already use for the reverse case.
12+
// tsconfig.cli.json overrides moduleResolution back to "node" for its
13+
// CommonJS output ("bundler" is incompatible with CommonJS, TS5095).
14+
"moduleResolution": "bundler",
15+
"customConditions": ["@plotday/connector"],
916
"resolveJsonModule": true,
1017
"allowJs": true,
1118
"checkJs": false,

0 commit comments

Comments
 (0)