tstyche 3.0.0-rc.0 → 3.0.0-rc.1
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/build/index.d.cts +1 -1
- package/build/index.d.ts +1 -1
- package/build/tstyche.js +29 -10
- package/package.json +3 -3
package/build/index.d.cts
CHANGED
|
@@ -149,7 +149,7 @@ interface Matchers {
|
|
|
149
149
|
/**
|
|
150
150
|
* Checks if the source type raises an error.
|
|
151
151
|
*/
|
|
152
|
-
toRaiseError: (...target: Array<string | number>) => void;
|
|
152
|
+
toRaiseError: (...target: Array<string | number | RegExp>) => void;
|
|
153
153
|
}
|
|
154
154
|
interface Matchers {
|
|
155
155
|
/**
|
package/build/index.d.ts
CHANGED
|
@@ -149,7 +149,7 @@ interface Matchers {
|
|
|
149
149
|
/**
|
|
150
150
|
* Checks if the source type raises an error.
|
|
151
151
|
*/
|
|
152
|
-
toRaiseError: (...target: Array<string | number>) => void;
|
|
152
|
+
toRaiseError: (...target: Array<string | number | RegExp>) => void;
|
|
153
153
|
}
|
|
154
154
|
interface Matchers {
|
|
155
155
|
/**
|
package/build/tstyche.js
CHANGED
|
@@ -961,19 +961,29 @@ class Options {
|
|
|
961
961
|
}
|
|
962
962
|
return definitionMap;
|
|
963
963
|
}
|
|
964
|
+
static #getCanonicalOptionName(optionName) {
|
|
965
|
+
return optionName.startsWith("--") ? optionName.slice(2) : optionName;
|
|
966
|
+
}
|
|
967
|
+
static #isBuiltinReporter(optionValue) {
|
|
968
|
+
return ["list", "summary"].includes(optionValue);
|
|
969
|
+
}
|
|
970
|
+
static #isLookupStrategy(optionValue) {
|
|
971
|
+
return ["findup", "ignore"].includes(optionValue);
|
|
972
|
+
}
|
|
964
973
|
static resolve(optionName, optionValue, rootPath = ".") {
|
|
965
|
-
|
|
974
|
+
const canonicalOptionName = Options.#getCanonicalOptionName(optionName);
|
|
975
|
+
switch (canonicalOptionName) {
|
|
966
976
|
case "config":
|
|
967
977
|
case "rootPath":
|
|
968
978
|
case "tsconfig":
|
|
969
|
-
if (
|
|
979
|
+
if (canonicalOptionName === "tsconfig" && Options.#isLookupStrategy(optionValue)) {
|
|
970
980
|
break;
|
|
971
981
|
}
|
|
972
982
|
optionValue = Path.resolve(rootPath, optionValue);
|
|
973
983
|
break;
|
|
974
984
|
case "plugins":
|
|
975
985
|
case "reporters":
|
|
976
|
-
if (
|
|
986
|
+
if (canonicalOptionName === "reporters" && Options.#isBuiltinReporter(optionValue)) {
|
|
977
987
|
break;
|
|
978
988
|
}
|
|
979
989
|
try {
|
|
@@ -991,11 +1001,12 @@ class Options {
|
|
|
991
1001
|
return optionValue;
|
|
992
1002
|
}
|
|
993
1003
|
static async validate(optionName, optionValue, optionBrand, onDiagnostics, origin) {
|
|
994
|
-
|
|
1004
|
+
const canonicalOptionName = Options.#getCanonicalOptionName(optionName);
|
|
1005
|
+
switch (canonicalOptionName) {
|
|
995
1006
|
case "config":
|
|
996
1007
|
case "rootPath":
|
|
997
1008
|
case "tsconfig":
|
|
998
|
-
if (
|
|
1009
|
+
if (canonicalOptionName === "tsconfig" && Options.#isLookupStrategy(optionValue)) {
|
|
999
1010
|
break;
|
|
1000
1011
|
}
|
|
1001
1012
|
if (existsSync(optionValue)) {
|
|
@@ -1005,7 +1016,7 @@ class Options {
|
|
|
1005
1016
|
break;
|
|
1006
1017
|
case "plugins":
|
|
1007
1018
|
case "reporters":
|
|
1008
|
-
if (
|
|
1019
|
+
if (canonicalOptionName === "reporters" && Options.#isBuiltinReporter(optionValue)) {
|
|
1009
1020
|
break;
|
|
1010
1021
|
}
|
|
1011
1022
|
if (optionValue.startsWith("file:") && existsSync(new URL(optionValue))) {
|
|
@@ -3281,7 +3292,9 @@ class MatchWorker {
|
|
|
3281
3292
|
}
|
|
3282
3293
|
checkIsIdenticalTo(sourceNode, targetNode) {
|
|
3283
3294
|
const relation = this.#typeChecker.relation.identity;
|
|
3284
|
-
return this.#checkIsRelatedTo(sourceNode, targetNode, relation)
|
|
3295
|
+
return (this.#checkIsRelatedTo(sourceNode, targetNode, relation) &&
|
|
3296
|
+
this.checkIsAssignableTo(sourceNode, targetNode) &&
|
|
3297
|
+
this.checkIsAssignableWith(sourceNode, targetNode));
|
|
3285
3298
|
}
|
|
3286
3299
|
checkIsSubtype(sourceNode, targetNode) {
|
|
3287
3300
|
const relation = this.#typeChecker.relation.subtype;
|
|
@@ -3722,8 +3735,10 @@ class ToRaiseError {
|
|
|
3722
3735
|
match(matchWorker, sourceNode, targetNodes, onDiagnostics) {
|
|
3723
3736
|
const diagnostics = [];
|
|
3724
3737
|
for (const targetNode of targetNodes) {
|
|
3725
|
-
if (!(this.#compiler.isStringLiteralLike(targetNode) ||
|
|
3726
|
-
|
|
3738
|
+
if (!(this.#compiler.isStringLiteralLike(targetNode) ||
|
|
3739
|
+
this.#compiler.isNumericLiteral(targetNode) ||
|
|
3740
|
+
this.#compiler.isRegularExpressionLiteral(targetNode))) {
|
|
3741
|
+
const expectedText = "a string, number or regular expression literal";
|
|
3727
3742
|
const text = ExpectDiagnosticText.argumentMustBe("target", expectedText);
|
|
3728
3743
|
const origin = DiagnosticOrigin.fromNode(targetNode);
|
|
3729
3744
|
diagnostics.push(Diagnostic.error(text, origin));
|
|
@@ -3748,6 +3763,10 @@ class ToRaiseError {
|
|
|
3748
3763
|
};
|
|
3749
3764
|
}
|
|
3750
3765
|
#matchExpectedError(diagnostic, targetNode) {
|
|
3766
|
+
if (this.#compiler.isRegularExpressionLiteral(targetNode)) {
|
|
3767
|
+
const targetRegex = new RegExp(...targetNode.text.slice(1).split("/"));
|
|
3768
|
+
return targetRegex.test(this.#compiler.flattenDiagnosticMessageText(diagnostic.messageText, " ", 0));
|
|
3769
|
+
}
|
|
3751
3770
|
if (this.#compiler.isStringLiteralLike(targetNode)) {
|
|
3752
3771
|
return this.#compiler.flattenDiagnosticMessageText(diagnostic.messageText, " ", 0).includes(targetNode.text);
|
|
3753
3772
|
}
|
|
@@ -4096,7 +4115,7 @@ class TaskRunner {
|
|
|
4096
4115
|
class Runner {
|
|
4097
4116
|
#eventEmitter = new EventEmitter();
|
|
4098
4117
|
#resolvedConfig;
|
|
4099
|
-
static version = "3.0.0-rc.
|
|
4118
|
+
static version = "3.0.0-rc.1";
|
|
4100
4119
|
constructor(resolvedConfig) {
|
|
4101
4120
|
this.#resolvedConfig = resolvedConfig;
|
|
4102
4121
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tstyche",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.1",
|
|
4
4
|
"description": "The Essential Type Testing Tool.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@biomejs/biome": "1.9.4",
|
|
65
65
|
"@rollup/plugin-typescript": "12.1.1",
|
|
66
|
-
"@types/node": "22.8.
|
|
66
|
+
"@types/node": "22.8.5",
|
|
67
67
|
"@types/react": "18.3.12",
|
|
68
68
|
"ajv": "8.17.1",
|
|
69
|
-
"cspell": "8.15.
|
|
69
|
+
"cspell": "8.15.5",
|
|
70
70
|
"magic-string": "0.30.12",
|
|
71
71
|
"monocart-coverage-reports": "2.11.1",
|
|
72
72
|
"pretty-ansi": "2.0.0",
|