@ark/attest 0.15.0 → 0.17.0

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.
@@ -1,5 +1,5 @@
1
1
  import { snapshot, type Constructor } from "@ark/util";
2
- import { type validateTypeRoot } from "arktype";
2
+ import { type } from "arktype";
3
3
  import type { Completions } from "../cache/writeAssertionCache.ts";
4
4
  import type { AssertionContext } from "./attest.ts";
5
5
  export type ChainableAssertionOptions = {
@@ -51,7 +51,7 @@ export type comparableValueAssertion<expected, kind extends AssertionKind> = {
51
51
  instanceOf: (constructor: Constructor) => nextAssertions<kind>;
52
52
  is: (value: expected) => nextAssertions<kind>;
53
53
  completions: (value?: Completions) => void;
54
- satisfies: <def>(def: validateTypeRoot<def>) => nextAssertions<kind>;
54
+ satisfies: <def>(def: type.validate<def>) => nextAssertions<kind>;
55
55
  unknown: Omit<comparableValueAssertion<unknown, kind>, "unknown">;
56
56
  };
57
57
  export type TypeAssertionsRoot = {
@@ -86,7 +86,14 @@ const getInstantiationsWithFile = (fileText, fileName) => {
86
86
  const env = getIsolatedEnv();
87
87
  const file = createOrUpdateFile(env, fileName, fileText);
88
88
  const program = getProgram(env);
89
+ // trigger type checking to generate instantiations
90
+ // (was previously program.emit(file), but that as of TS 5.6 that doesn't
91
+ // work, so this may need to change if instantiations is reported as 0 after
92
+ // a future TypeScript update)
89
93
  program.getSemanticDiagnostics(file);
94
+ // this may lead to additional type checking per Jake Bailey from the TS
95
+ // team, although it doesn't currently affect any of our internal benchmarks
96
+ program.getDeclarationDiagnostics(file);
90
97
  const count = program.getInstantiationCount();
91
98
  return count;
92
99
  };
package/out/fixtures.js CHANGED
@@ -1,4 +1,4 @@
1
- import { shell, writeJson } from "@ark/fs";
1
+ import { fileName, shell, writeJson } from "@ark/fs";
2
2
  import { rmSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import { writeSnapshotUpdatesOnExit } from "./cache/snapshots.js";
@@ -19,7 +19,15 @@ export const setup = (options) => {
19
19
  config.tsVersions[0].alias === "typescript")
20
20
  writeAssertionData(config.defaultAssertionCachePath);
21
21
  else {
22
- forTypeScriptVersions(config.tsVersions, version => shell(`npm exec -c "attest precache ${join(config.assertionCacheDir, version.alias + ".json")}"`));
22
+ forTypeScriptVersions(config.tsVersions, version => {
23
+ const precachePath = join(config.assertionCacheDir, version.alias + ".json");
24
+ // if we're in our own repo, we need to pnpm to use the root script to execute ts directly
25
+ if (fileName().endsWith("ts"))
26
+ shell(`pnpm attest precache ${precachePath}`);
27
+ // otherwise, just use npm to run the CLI command from build output
28
+ else
29
+ shell(`npm exec -c "attest precache ${precachePath}"`);
30
+ });
23
31
  }
24
32
  return teardown;
25
33
  };
@@ -98,6 +98,8 @@ export const findAttestTypeScriptVersions = () => {
98
98
  for (const alias in dependencies) {
99
99
  if (!alias.startsWith("typescript"))
100
100
  continue;
101
+ if (alias.includes("eslint", 10))
102
+ continue;
101
103
  const path = join(nodeModulesPath, alias);
102
104
  if (!existsSync(path)) {
103
105
  throw Error(`TypeScript version ${alias} specified in ${packageJsonPath} must be installed at ${path} `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ark/attest",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "author": {
5
5
  "name": "David Blass",
6
6
  "email": "david@arktype.io",
@@ -35,9 +35,9 @@
35
35
  "@typescript/analyze-trace": "0.10.1",
36
36
  "prettier": "3.3.3",
37
37
  "@prettier/sync": "0.5.2",
38
- "arktype": "2.0.0-rc.4",
39
- "@ark/util": "0.6.0",
40
- "@ark/fs": "0.6.0"
38
+ "arktype": "2.0.0-rc.6",
39
+ "@ark/fs": "0.8.0",
40
+ "@ark/util": "0.8.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "typescript": "5.6.1-rc"