vite-plugin-nudo 0.4.1 → 0.4.3-beta.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/README.md +1 -1
- package/dist/index.js +8 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Vite plugin for build-time JavaScript type inference with [Nudo](https://github.
|
|
|
4
4
|
|
|
5
5
|
## What is Nudo?
|
|
6
6
|
|
|
7
|
-
Nudo is a type inference engine for JavaScript.
|
|
7
|
+
Nudo is a type inference engine for JavaScript. The type system is Abs (`shape × term × pred × conf`); analysis runs Abs-native via abstract interpretation — no TypeScript, no build step.
|
|
8
8
|
|
|
9
9
|
## This package
|
|
10
10
|
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
shouldAnalyzeFile,
|
|
8
8
|
filterDiagnosticsByLevel,
|
|
9
9
|
findProjectConfig,
|
|
10
|
+
collectSkipReturns,
|
|
10
11
|
interfaceConfig
|
|
11
12
|
} from "@nudojs/service";
|
|
12
13
|
import { dirname } from "path";
|
|
@@ -17,7 +18,8 @@ function checkIssuesToDiagnostics(id, code) {
|
|
|
17
18
|
const report = checkSource(id, code, pTrue, {
|
|
18
19
|
loadModule,
|
|
19
20
|
fromFile: id,
|
|
20
|
-
...autoBind === false ? { autoBind: false } : {}
|
|
21
|
+
...autoBind === false ? { autoBind: false } : {},
|
|
22
|
+
skips: collectSkipReturns(code)
|
|
21
23
|
});
|
|
22
24
|
return report.issues.filter((i) => i.severity === "error" || i.severity === "warning").map((i) => {
|
|
23
25
|
const line = i.line ?? 1;
|
|
@@ -52,6 +54,9 @@ function viteDiagnosticsLevel(id) {
|
|
|
52
54
|
}
|
|
53
55
|
var DEFAULT_INCLUDE = ["**/*.js", "**/*.mjs", "**/*.ts"];
|
|
54
56
|
var DEFAULT_EXCLUDE = ["**/node_modules/**", "**/*.d.ts"];
|
|
57
|
+
function logAnalysisSummary(errorCount, warnCount) {
|
|
58
|
+
console.log(`[nudo] Analysis complete: ${errorCount} error(s), ${warnCount} warning(s)`);
|
|
59
|
+
}
|
|
55
60
|
var REGEX_SPECIALS = /[\\^$.|?*+(){}\[\]]/;
|
|
56
61
|
function escapeRegExpChar(ch) {
|
|
57
62
|
return REGEX_SPECIALS.test(ch) ? `\\${ch}` : ch;
|
|
@@ -115,7 +120,7 @@ function nudoPlugin(options = {}) {
|
|
|
115
120
|
if (!includeMatch(id)) return null;
|
|
116
121
|
if (!shouldAnalyzeFile(id, code)) return null;
|
|
117
122
|
try {
|
|
118
|
-
const result = await analyzeFileAsync(id, code);
|
|
123
|
+
const result = await analyzeFileAsync(id, code, void 0, void 0, void 0, "none");
|
|
119
124
|
const checkDiags = checkIssuesToDiagnostics(id, code);
|
|
120
125
|
const level = viteDiagnosticsLevel(id);
|
|
121
126
|
const merged = {
|
|
@@ -149,7 +154,7 @@ function nudoPlugin(options = {}) {
|
|
|
149
154
|
if (totalDiags > 0) {
|
|
150
155
|
const errorCount = Array.from(analysisCache.values()).reduce((sum, r) => sum + r.diagnostics.filter((d) => d.severity === "error").length, 0);
|
|
151
156
|
const warnCount = totalDiags - errorCount;
|
|
152
|
-
|
|
157
|
+
logAnalysisSummary(errorCount, warnCount);
|
|
153
158
|
}
|
|
154
159
|
}
|
|
155
160
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-nudo",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3-beta.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20"
|
|
6
6
|
},
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"registry": "https://registry.npmjs.org"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@nudojs/core": "
|
|
42
|
-
"@nudojs/service": "
|
|
41
|
+
"@nudojs/core": "3.0.0-beta.0",
|
|
42
|
+
"@nudojs/service": "5.0.0-beta.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"vite": ">=5.0.0"
|