@runtime-type-inspector/transpiler 2.0.10 → 2.0.11
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/index.cjs +14 -0
- package/index.mjs +14 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -2355,6 +2355,19 @@
|
|
|
2355
2355
|
return out;
|
|
2356
2356
|
}
|
|
2357
2357
|
|
|
2358
|
+
function compareAST(left, right) {
|
|
2359
|
+
var l = parser.parse(left, {
|
|
2360
|
+
sourceType: 'module'
|
|
2361
|
+
});
|
|
2362
|
+
var r = parser.parse(right, {
|
|
2363
|
+
sourceType: 'module'
|
|
2364
|
+
});
|
|
2365
|
+
var ljson = ast2jsonForComparison(l);
|
|
2366
|
+
var rjson = ast2jsonForComparison(r);
|
|
2367
|
+
var test = ljson === rjson;
|
|
2368
|
+
return test;
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2358
2371
|
function expandType(type) {
|
|
2359
2372
|
var ast = parseType(type);
|
|
2360
2373
|
return toSourceTS(ast);
|
|
@@ -2700,6 +2713,7 @@
|
|
|
2700
2713
|
exports.ast2json = ast2json;
|
|
2701
2714
|
exports.ast2jsonForComparison = ast2jsonForComparison;
|
|
2702
2715
|
exports.code2ast2code = code2ast2code;
|
|
2716
|
+
exports.compareAST = compareAST;
|
|
2703
2717
|
exports.expandType = expandType;
|
|
2704
2718
|
exports.expandTypeBabelTS = expandTypeBabelTS;
|
|
2705
2719
|
exports.expandTypeDepFree = expandTypeDepFree;
|
package/index.mjs
CHANGED
|
@@ -1983,6 +1983,19 @@ function code2ast2code(code) {
|
|
|
1983
1983
|
return out;
|
|
1984
1984
|
}
|
|
1985
1985
|
|
|
1986
|
+
function compareAST(left, right) {
|
|
1987
|
+
const l = parse(left, {
|
|
1988
|
+
sourceType: 'module'
|
|
1989
|
+
});
|
|
1990
|
+
const r = parse(right, {
|
|
1991
|
+
sourceType: 'module'
|
|
1992
|
+
});
|
|
1993
|
+
const ljson = ast2jsonForComparison(l);
|
|
1994
|
+
const rjson = ast2jsonForComparison(r);
|
|
1995
|
+
const test = ljson === rjson;
|
|
1996
|
+
return test;
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1986
1999
|
function expandType(type) {
|
|
1987
2000
|
const ast = parseType(type);
|
|
1988
2001
|
return toSourceTS(ast);
|
|
@@ -2325,4 +2338,4 @@ function toSourceBabelTS(node) {
|
|
|
2325
2338
|
}
|
|
2326
2339
|
}
|
|
2327
2340
|
|
|
2328
|
-
export { Asserter, Stringifier, addTypeChecks, ast2json, ast2jsonForComparison, code2ast2code, expandType, expandTypeBabelTS, expandTypeDepFree, extractCurlyContent, extractNameAndOptionality, nodeIsFunction, parseJSDoc, parseJSDocSetter, parseJSDocTypedef, parseType, parseTypeBabelTS, simplifyType, toSourceBabelTS, toSourceTS, trimEndSpaces };
|
|
2341
|
+
export { Asserter, Stringifier, addTypeChecks, ast2json, ast2jsonForComparison, code2ast2code, compareAST, expandType, expandTypeBabelTS, expandTypeDepFree, extractCurlyContent, extractNameAndOptionality, nodeIsFunction, parseJSDoc, parseJSDocSetter, parseJSDocTypedef, parseType, parseTypeBabelTS, simplifyType, toSourceBabelTS, toSourceTS, trimEndSpaces };
|
package/package.json
CHANGED