vite-plugin-nudo 0.2.0 → 0.2.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/CHANGELOG.md +6 -0
- package/README.md +38 -0
- package/dist/index.js +1 -1
- package/package.json +13 -2
- package/src/index.ts +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# vite-plugin-nudo
|
|
2
|
+
|
|
3
|
+
Vite plugin for build-time JavaScript type inference with [Nudo](https://github.com/nudojs/nudo).
|
|
4
|
+
|
|
5
|
+
## What is Nudo?
|
|
6
|
+
|
|
7
|
+
Nudo is a type inference engine for JavaScript. Instead of a separate type system, it runs your code with symbolic type values via abstract interpretation — no TypeScript, no build step.
|
|
8
|
+
|
|
9
|
+
## This package
|
|
10
|
+
|
|
11
|
+
`vite-plugin-nudo` runs Nudo analysis during your Vite build, reporting type diagnostics as build warnings or errors.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -D vite-plugin-nudo
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
// vite.config.js
|
|
23
|
+
import nudo from 'vite-plugin-nudo'
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
plugins: [
|
|
27
|
+
nudo({
|
|
28
|
+
include: '**/*.js', // default
|
|
29
|
+
exclude: '**/node_modules/**', // default
|
|
30
|
+
failOnError: false, // default
|
|
31
|
+
}),
|
|
32
|
+
],
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
[MIT](https://github.com/nudojs/nudo/blob/main/LICENSE)
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ function nudoPlugin(options = {}) {
|
|
|
27
27
|
},
|
|
28
28
|
transform(code, id) {
|
|
29
29
|
if (!matchesPatterns(id, include, exclude)) return null;
|
|
30
|
-
if (!/@nudo:(case|mock|pure|skip|sample|returns)\b/.test(code)) return null;
|
|
30
|
+
if (!/@nudo:(case|mock|pure|skip|sample|returns|env|mock-module|as|replace)\b/.test(code)) return null;
|
|
31
31
|
try {
|
|
32
32
|
const result = analyzeFile(id, code);
|
|
33
33
|
analysisCache.set(id, result);
|
package/package.json
CHANGED
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-nudo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Vite plugin for build-time JavaScript type inference with Nudo",
|
|
4
5
|
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"nudo",
|
|
9
|
+
"type-inference",
|
|
10
|
+
"javascript",
|
|
11
|
+
"vite",
|
|
12
|
+
"vite-plugin"
|
|
13
|
+
],
|
|
5
14
|
"main": "src/index.ts",
|
|
6
15
|
"repository": {
|
|
7
16
|
"type": "git",
|
|
8
17
|
"url": "git+https://github.com/nudojs/nudo.git",
|
|
9
18
|
"directory": "packages/vite-plugin"
|
|
10
19
|
},
|
|
20
|
+
"homepage": "https://github.com/nudojs/nudo/tree/main/packages/vite-plugin",
|
|
21
|
+
"bugs": "https://github.com/nudojs/nudo/issues",
|
|
11
22
|
"publishConfig": {
|
|
12
23
|
"access": "public",
|
|
13
24
|
"provenance": true,
|
|
14
25
|
"registry": "https://registry.npmjs.org"
|
|
15
26
|
},
|
|
16
27
|
"dependencies": {
|
|
17
|
-
"@nudojs/service": "0.2.
|
|
28
|
+
"@nudojs/service": "0.2.1"
|
|
18
29
|
},
|
|
19
30
|
"peerDependencies": {
|
|
20
31
|
"vite": ">=5.0.0"
|
package/src/index.ts
CHANGED
|
@@ -40,7 +40,7 @@ export default function nudoPlugin(options: NudoPluginOptions = {}): any {
|
|
|
40
40
|
|
|
41
41
|
transform(code: string, id: string) {
|
|
42
42
|
if (!matchesPatterns(id, include, exclude)) return null;
|
|
43
|
-
if (!/@nudo:(case|mock|pure|skip|sample|returns)\b/.test(code)) return null;
|
|
43
|
+
if (!/@nudo:(case|mock|pure|skip|sample|returns|env|mock-module|as|replace)\b/.test(code)) return null;
|
|
44
44
|
|
|
45
45
|
try {
|
|
46
46
|
const result = analyzeFile(id, code);
|