@ark/attest 0.17.0 → 0.18.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.
- package/out/config.js +1 -1
- package/out/tsVersioning.d.ts +3 -4
- package/out/tsVersioning.js +26 -17
- package/package.json +5 -5
package/out/config.js
CHANGED
|
@@ -10,7 +10,7 @@ export const getDefaultAttestConfig = () => ({
|
|
|
10
10
|
updateSnapshots: false,
|
|
11
11
|
skipTypes: false,
|
|
12
12
|
skipInlineInstantiations: false,
|
|
13
|
-
tsVersions: "
|
|
13
|
+
tsVersions: "default",
|
|
14
14
|
benchPercentThreshold: 20,
|
|
15
15
|
benchErrorOnThresholdExceeded: true,
|
|
16
16
|
filter: undefined,
|
package/out/tsVersioning.d.ts
CHANGED
|
@@ -21,8 +21,7 @@ export type TsVersionData = {
|
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
23
|
* Find and return the paths of all installed TypeScript versions, including the
|
|
24
|
-
*
|
|
25
|
-
* "typescript-".
|
|
24
|
+
* all dependencies beginning with "typescript" or "@ark/attest-ts-".
|
|
26
25
|
*
|
|
27
26
|
* Starts checking from the current directory and looks for node_modules in parent
|
|
28
27
|
* directories up to the file system root.
|
|
@@ -30,10 +29,10 @@ export type TsVersionData = {
|
|
|
30
29
|
* Alternate versions can be installed using a package.json dependency like:
|
|
31
30
|
*
|
|
32
31
|
* ```json
|
|
33
|
-
* "
|
|
32
|
+
* "@ark/attest-ts-min": "npm:typescript@5.1.6"
|
|
34
33
|
* ```
|
|
35
34
|
* @returns {TsVersionData[]} Each version mapped to data, e.g.:
|
|
36
|
-
* {alias: "
|
|
35
|
+
* {alias: "@ark/attest-ts-min", version: "5.1.6", path: "/home/ssalb/arktype/node_modules/@ark/attest-ts-min" } *
|
|
37
36
|
*
|
|
38
37
|
* @throws {Error} If a TypeScript version specified in package.json is not
|
|
39
38
|
* installed at the expected location in node_modules.
|
package/out/tsVersioning.js
CHANGED
|
@@ -28,10 +28,6 @@ export const forTypeScriptVersions = (versions, fn) => {
|
|
|
28
28
|
try {
|
|
29
29
|
for (const version of versions) {
|
|
30
30
|
const targetPath = version.path === tsPrimaryPath ? tsTemporaryPath : version.path;
|
|
31
|
-
const tsPackageJson = readJson(join(targetPath, "package.json"));
|
|
32
|
-
if (tsPackageJson.name !== "typescript") {
|
|
33
|
-
throw new Error(`Expected to find a TypeScript version ${version.version} at ${version.path}`);
|
|
34
|
-
}
|
|
35
31
|
console.log(`⛵ Switching to TypeScript version ${version.alias} (${version.version})...`);
|
|
36
32
|
try {
|
|
37
33
|
if (existsSync(tsPrimaryPath))
|
|
@@ -61,10 +57,20 @@ export const forTypeScriptVersions = (versions, fn) => {
|
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
59
|
};
|
|
60
|
+
const possibleTsVersionPrefix = "typescript-";
|
|
61
|
+
const strictTsVersionPrefix = "@ark/attest-ts-";
|
|
62
|
+
const parseInstalledTsAlias = (installedAlias) => {
|
|
63
|
+
if (installedAlias === "typescript")
|
|
64
|
+
return "default";
|
|
65
|
+
if (installedAlias.startsWith(possibleTsVersionPrefix))
|
|
66
|
+
return installedAlias.slice(possibleTsVersionPrefix.length);
|
|
67
|
+
if (installedAlias.startsWith(strictTsVersionPrefix))
|
|
68
|
+
return installedAlias.slice(strictTsVersionPrefix.length);
|
|
69
|
+
return null;
|
|
70
|
+
};
|
|
64
71
|
/**
|
|
65
72
|
* Find and return the paths of all installed TypeScript versions, including the
|
|
66
|
-
*
|
|
67
|
-
* "typescript-".
|
|
73
|
+
* all dependencies beginning with "typescript" or "@ark/attest-ts-".
|
|
68
74
|
*
|
|
69
75
|
* Starts checking from the current directory and looks for node_modules in parent
|
|
70
76
|
* directories up to the file system root.
|
|
@@ -72,10 +78,10 @@ export const forTypeScriptVersions = (versions, fn) => {
|
|
|
72
78
|
* Alternate versions can be installed using a package.json dependency like:
|
|
73
79
|
*
|
|
74
80
|
* ```json
|
|
75
|
-
* "
|
|
81
|
+
* "@ark/attest-ts-min": "npm:typescript@5.1.6"
|
|
76
82
|
* ```
|
|
77
83
|
* @returns {TsVersionData[]} Each version mapped to data, e.g.:
|
|
78
|
-
* {alias: "
|
|
84
|
+
* {alias: "@ark/attest-ts-min", version: "5.1.6", path: "/home/ssalb/arktype/node_modules/@ark/attest-ts-min" } *
|
|
79
85
|
*
|
|
80
86
|
* @throws {Error} If a TypeScript version specified in package.json is not
|
|
81
87
|
* installed at the expected location in node_modules.
|
|
@@ -95,20 +101,23 @@ export const findAttestTypeScriptVersions = () => {
|
|
|
95
101
|
...packageJson.dependencies,
|
|
96
102
|
...packageJson.devDependencies
|
|
97
103
|
};
|
|
98
|
-
for (const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (alias.includes("eslint", 10))
|
|
104
|
+
for (const installedAlias in dependencies) {
|
|
105
|
+
const alias = parseInstalledTsAlias(installedAlias);
|
|
106
|
+
if (alias === null)
|
|
102
107
|
continue;
|
|
103
|
-
const path = join(nodeModulesPath,
|
|
108
|
+
const path = join(nodeModulesPath, installedAlias);
|
|
104
109
|
if (!existsSync(path)) {
|
|
105
|
-
throw Error(`TypeScript version ${
|
|
110
|
+
throw Error(`TypeScript version ${installedAlias} specified in ${packageJsonPath} must be installed at ${path} `);
|
|
111
|
+
}
|
|
112
|
+
const typescriptJson = readJson(join(path, "package.json"));
|
|
113
|
+
if (typescriptJson.name !== "typescript") {
|
|
114
|
+
if (installedAlias.startsWith(strictTsVersionPrefix))
|
|
115
|
+
throw new Error(`Package at ${path} should be named "typescript"`);
|
|
116
|
+
continue;
|
|
106
117
|
}
|
|
107
|
-
const version = readJson(join(path, "package.json"))
|
|
108
|
-
.version;
|
|
109
118
|
versions.push({
|
|
110
119
|
alias,
|
|
111
|
-
version,
|
|
120
|
+
version: typescriptJson.version,
|
|
112
121
|
path
|
|
113
122
|
});
|
|
114
123
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark/attest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "David Blass",
|
|
6
6
|
"email": "david@arktype.io",
|
|
@@ -35,12 +35,12 @@
|
|
|
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.
|
|
39
|
-
"@ark/
|
|
40
|
-
"@ark/
|
|
38
|
+
"arktype": "2.0.0-rc.7",
|
|
39
|
+
"@ark/util": "0.9.0",
|
|
40
|
+
"@ark/fs": "0.9.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"typescript": "5.6.
|
|
43
|
+
"typescript": "5.6.2"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"typescript": "*"
|