Skip to content

Commit 3c376e9

Browse files
dkryaklinclaude
andcommitted
chore: address maintainer review feedback (round 2)
- README: fix stale [tests] link pointing at the never-existing `src/__tests__/index.js` — should be `test/index.js`. - .gitignore: add `.DS_Store` (macOS noise). - scripts/benchmark-jison.ts: dynamic imports → static imports, as the maintainer asked. Reviewer noted dynamic imports aren't needed once Node 20 compat is dropped. - tsconfig: extract a shared tsconfig.base.json; tsconfig.json (lint / IDE, noEmit) and tsconfig.build.json (emit dist/) now `extends` it, removing ~10 lines of duplicated compiler options across the two children. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8a14d8a commit 3c376e9

6 files changed

Lines changed: 25 additions & 25 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
2+
.DS_Store
23
test/fixtures/*.actual.css
34
src/parser.js
45
yarn-error.log

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,5 +258,5 @@ npm test
258258
[PostCSS]: https://github.com/postcss
259259
[PostCSS Calc]: https://github.com/postcss/postcss-calc
260260
[PostCSS Custom Properties]: https://github.com/postcss/postcss-custom-properties
261-
[tests]: src/__tests__/index.js
261+
[tests]: test/index.js
262262
[W3C calc() implementation]: https://www.w3.org/TR/css3-values/#calc-notation

scripts/benchmark-jison.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ import { join, dirname } from 'node:path';
55
import { fileURLToPath } from 'node:url';
66
import postcss, { type AcceptedPlugin } from 'postcss';
77

8+
import jisonPlugin from '../src/index.js';
9+
import prattPlugin from '../src/pratt/src/plugin/plugin.ts';
10+
811
interface BenchResult {
912
name: string;
1013
perRun: number;
1114
total: number;
1215
}
1316

1417
async function main(): Promise<void> {
15-
// Dynamic imports so CJS/ESM interop works under tsx.
16-
const jisonPlugin = (await import('../src/index.js')).default as () => AcceptedPlugin;
17-
const prattPlugin = (await import('../src/pratt/src/plugin/plugin.ts')).default as () => AcceptedPlugin;
18-
1918
const HERE = dirname(fileURLToPath(import.meta.url));
2019
const CORPUS_DIR = join(HERE, '..', 'src', 'pratt', 'test', 'corpus');
2120

@@ -48,8 +47,8 @@ async function main(): Promise<void> {
4847
console.log(`CSS size: ${css.length} bytes, ${calcs.length} declarations`);
4948
console.log(`Iterations: ${ITERATIONS} each\n`);
5049

51-
const jison = await bench('jison', jisonPlugin);
52-
const pratt = await bench('pratt', prattPlugin);
50+
const jison = await bench('jison', jisonPlugin as () => AcceptedPlugin);
51+
const pratt = await bench('pratt', prattPlugin as () => AcceptedPlugin);
5352

5453
console.log(` ${jison.name}: ${jison.perRun.toFixed(2)}ms / run (${jison.total.toFixed(0)}ms total)`);
5554
console.log(` ${pratt.name}: ${pratt.perRun.toFixed(2)}ms / run (${pratt.total.toFixed(0)}ms total)`);

tsconfig.base.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2022",
4+
"lib": ["es2022"],
5+
"strict": true,
6+
"noUncheckedIndexedAccess": true,
7+
"noImplicitOverride": true,
8+
"allowImportingTsExtensions": true,
9+
"skipLibCheck": true,
10+
"types": ["node"]
11+
}
12+
}

tsconfig.build.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1+
// Build config. Emits dist/ with declarations from the shipped sources only.
12
{
3+
"extends": "./tsconfig.base.json",
24
"compilerOptions": {
3-
"target": "es2022",
4-
"lib": ["es2022"],
55
"module": "nodenext",
66
"moduleResolution": "nodenext",
7-
"strict": true,
8-
"noUncheckedIndexedAccess": true,
9-
"noImplicitOverride": true,
107
"esModuleInterop": true,
11-
"allowImportingTsExtensions": true,
128
"rewriteRelativeImportExtensions": true,
139
"declaration": true,
14-
"skipLibCheck": true,
1510
"outDir": "dist",
16-
"rootDir": ".",
17-
"types": ["node"]
11+
"rootDir": "."
1812
},
1913
"include": ["src/index.ts", "src/pratt/src/**/*.ts"],
2014
"exclude": ["src/pratt/src/plugin/plugin-csstools.ts"]

tsconfig.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1+
// Lint / IDE / typecheck config. Covers src + scripts + tests, emits nothing.
12
{
3+
"extends": "./tsconfig.base.json",
24
"compilerOptions": {
3-
"target": "es2022",
4-
"lib": ["es2022"],
55
"module": "esnext",
66
"moduleResolution": "bundler",
7-
"strict": true,
8-
"noUncheckedIndexedAccess": true,
9-
"noImplicitOverride": true,
10-
"allowImportingTsExtensions": true,
117
"verbatimModuleSyntax": true,
12-
"noEmit": true,
13-
"skipLibCheck": true,
14-
"types": ["node"]
8+
"noEmit": true
159
},
1610
"include": ["src/index.ts", "src/pratt/**/*.ts", "scripts/**/*.ts"]
1711
}

0 commit comments

Comments
 (0)