@dialecte/cli 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +23 -23
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -19,7 +19,7 @@ npm i -D @dialecte/cli # provides the `dialecte` binary
19
19
 
20
20
  ```
21
21
  dialecte coverage # generate complete, schema-driven type-coverage probes
22
- dialecte bench [--check] # measure type-instantiation cost (tsc --extendedDiagnostics); --check gates CI
22
+ dialecte bench [--check] # measure the type-instantiation cost of your own types (library .d.ts skipped); --check gates CI
23
23
  dialecte audit # render the public type surface and flag readability issues (C1–C6)
24
24
  dialecte --help
25
25
  ```
package/dist/cli.js CHANGED
@@ -358,6 +358,26 @@ var METRICS = [
358
358
  ];
359
359
  var STABLE_METRICS = ["Instantiations", "Types", "Symbols"];
360
360
  var THRESHOLD = 0.05;
361
+ function isolatedTsconfig(params) {
362
+ const { tsconfig, file } = params;
363
+ return {
364
+ extends: `./${tsconfig}`,
365
+ compilerOptions: {
366
+ noEmit: true,
367
+ skipLibCheck: true,
368
+ rootDir: ".",
369
+ declaration: false,
370
+ declarationMap: false,
371
+ emitDeclarationOnly: false
372
+ },
373
+ include: [file]
374
+ };
375
+ }
376
+ function wholeProgramArgs(params) {
377
+ const { tsconfig, mode } = params;
378
+ const output = mode === "check" ? ["--noEmit"] : ["--emitDeclarationOnly", "--outDir", ".bench-dts"];
379
+ return ["-p", tsconfig, ...output, "--skipLibCheck", "--extendedDiagnostics"];
380
+ }
361
381
  function parseTscMetrics(output) {
362
382
  const m = {};
363
383
  for (const metric of METRICS) {
@@ -411,20 +431,7 @@ async function run2(argv) {
411
431
  const measure = (args) => aggregateRuns(Array.from({ length: RUNS }, () => runTsc(args)));
412
432
  const isolated = (file) => {
413
433
  const name = `.bench-${file.replace(/[/.]/g, "_")}.tsconfig.json`;
414
- writeFileSync2(
415
- join4(ROOT, name),
416
- JSON.stringify({
417
- extends: `./${tsconfig}`,
418
- compilerOptions: {
419
- noEmit: true,
420
- rootDir: ".",
421
- declaration: false,
422
- declarationMap: false,
423
- emitDeclarationOnly: false
424
- },
425
- include: [file]
426
- })
427
- );
434
+ writeFileSync2(join4(ROOT, name), JSON.stringify(isolatedTsconfig({ tsconfig, file })));
428
435
  return name;
429
436
  };
430
437
  const measureFile = (file) => {
@@ -436,15 +443,8 @@ async function run2(argv) {
436
443
  const col = (s, w) => String(s).padEnd(w);
437
444
  const num = (n) => n == null ? "\u2014" : Math.round(n).toLocaleString("en-US");
438
445
  console.log(`bench \u2014 ${RUNS} runs (min) \u2014 whole program \u2026`);
439
- const wholeCheck = measure(["-p", tsconfig, "--noEmit", "--extendedDiagnostics"]);
440
- const wholeEmit = measure([
441
- "-p",
442
- tsconfig,
443
- "--emitDeclarationOnly",
444
- "--outDir",
445
- ".bench-dts",
446
- "--extendedDiagnostics"
447
- ]);
446
+ const wholeCheck = measure(wholeProgramArgs({ tsconfig, mode: "check" }));
447
+ const wholeEmit = measure(wholeProgramArgs({ tsconfig, mode: "emit" }));
448
448
  rmSync2(join4(ROOT, ".bench-dts"), { recursive: true, force: true });
449
449
  let failed = false;
450
450
  for (const t of targets) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dialecte/cli",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Dialecte CLI",
5
5
  "license": "MIT",
6
6
  "repository": {