unplugin-atscript 0.1.38 → 0.1.40
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 +29 -88
- package/dist/esbuild.cjs +4 -1
- package/dist/esbuild.mjs +4 -1
- package/dist/farm.cjs +4 -1
- package/dist/farm.mjs +4 -1
- package/dist/index.cjs +4 -1
- package/dist/index.mjs +4 -1
- package/dist/rolldown.cjs +4 -1
- package/dist/rolldown.mjs +4 -1
- package/dist/rollup.cjs +4 -1
- package/dist/rollup.mjs +4 -1
- package/dist/rspack.cjs +4 -1
- package/dist/rspack.mjs +4 -1
- package/dist/vite.cjs +4 -1
- package/dist/vite.d.ts +2 -2
- package/dist/vite.mjs +4 -1
- package/dist/webpack.cjs +4 -1
- package/dist/webpack.mjs +4 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,116 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://atscript.dev/logo.svg" alt="Atscript" width="120" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">unplugin-atscript</h1>
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- Loads and processes `.as` files with Atscript
|
|
9
|
-
- Generates JavaScript output
|
|
10
|
-
- Compatible with Vite, Rollup, Rolldown, Webpack, Rspack, esbuild, and Farm
|
|
11
|
-
- Separate entry point for each bundler — import only what you need
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Define your models once</strong> — get TypeScript types, runtime validation, and DB metadata from a single <code>.as</code> model.
|
|
9
|
+
</p>
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://atscript.dev">Documentation</a> · <a href="https://atscript.dev/packages/typescript/build-setup">Build Setup Guide</a>
|
|
13
|
+
</p>
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
npm install -D unplugin-atscript @atscript/typescript
|
|
17
|
-
```
|
|
15
|
+
---
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
Build tool plugin that compiles `.as` files during development. Works with Vite, Webpack, Rollup, Rolldown, esbuild, Rspack, and Farm via [Unplugin](https://unplugin.unjs.io/).
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
yarn add --dev unplugin-atscript @atscript/typescript
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
or
|
|
19
|
+
## Installation
|
|
26
20
|
|
|
27
|
-
```
|
|
28
|
-
pnpm add -D unplugin-atscript @atscript/typescript
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add -D unplugin-atscript @atscript/typescript @atscript/core
|
|
29
23
|
```
|
|
30
24
|
|
|
31
|
-
##
|
|
32
|
-
|
|
33
|
-
### Vite
|
|
25
|
+
## Quick Start
|
|
34
26
|
|
|
35
27
|
```ts
|
|
36
28
|
// vite.config.ts
|
|
37
|
-
import { defineConfig } from 'vite'
|
|
38
29
|
import atscript from 'unplugin-atscript/vite'
|
|
30
|
+
export default { plugins: [atscript()] }
|
|
39
31
|
|
|
40
|
-
export default defineConfig({
|
|
41
|
-
plugins: [atscript()],
|
|
42
|
-
})
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Rollup
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
32
|
// rollup.config.js
|
|
49
33
|
import atscript from 'unplugin-atscript/rollup'
|
|
34
|
+
export default { plugins: [atscript()] }
|
|
50
35
|
|
|
51
|
-
export default {
|
|
52
|
-
input: 'src/main.ts',
|
|
53
|
-
output: {
|
|
54
|
-
dir: 'dist',
|
|
55
|
-
format: 'esm',
|
|
56
|
-
},
|
|
57
|
-
plugins: [atscript()],
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### Webpack
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
36
|
// webpack.config.js
|
|
65
37
|
const atscript = require('unplugin-atscript/webpack')
|
|
66
|
-
|
|
67
|
-
module.exports = {
|
|
68
|
-
plugins: [atscript()],
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### esbuild
|
|
73
|
-
|
|
74
|
-
```js
|
|
75
|
-
import atscript from 'unplugin-atscript/esbuild'
|
|
76
|
-
import { build } from 'esbuild'
|
|
77
|
-
|
|
78
|
-
build({
|
|
79
|
-
plugins: [atscript()],
|
|
80
|
-
})
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Rolldown
|
|
84
|
-
|
|
85
|
-
```js
|
|
86
|
-
import atscript from 'unplugin-atscript/rolldown'
|
|
87
|
-
|
|
88
|
-
export default {
|
|
89
|
-
plugins: [atscript()],
|
|
90
|
-
}
|
|
38
|
+
module.exports = { plugins: [atscript()] }
|
|
91
39
|
```
|
|
92
40
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
Use `unplugin-atscript/rspack` or `unplugin-atscript/farm` respectively — same pattern as above.
|
|
41
|
+
Also available: `unplugin-atscript/esbuild`, `unplugin-atscript/rolldown`, `unplugin-atscript/rspack`, `unplugin-atscript/farm`.
|
|
96
42
|
|
|
97
|
-
##
|
|
98
|
-
|
|
99
|
-
1. Resolves `.as` files in the project.
|
|
100
|
-
2. Loads the Atscript configuration.
|
|
101
|
-
3. Uses `@atscript/core` and `@atscript/typescript` to parse and transform `.as` files into JavaScript.
|
|
102
|
-
4. Outputs the generated JavaScript for further processing.
|
|
103
|
-
|
|
104
|
-
## Configuration
|
|
43
|
+
## Features
|
|
105
44
|
|
|
106
|
-
|
|
45
|
+
- Universal bundler support via dedicated entry points
|
|
46
|
+
- Automatic `atscript.config.*` loading
|
|
47
|
+
- Strict validation — build fails on `.as` errors by default (`strict: false` to disable)
|
|
48
|
+
- Tree-shaking aware — marks non-mutating modules as side-effect-free
|
|
107
49
|
|
|
108
|
-
|
|
50
|
+
## Documentation
|
|
109
51
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
| `strict` | `boolean` | `true` | When `true`, throws an error if any `.as` document has diagnostics |
|
|
52
|
+
- [Build Setup Guide](https://atscript.dev/packages/typescript/build-setup)
|
|
53
|
+
- [Full Documentation](https://atscript.dev)
|
|
113
54
|
|
|
114
55
|
## License
|
|
115
56
|
|
|
116
|
-
|
|
57
|
+
MIT
|
package/dist/esbuild.cjs
CHANGED
|
@@ -41,7 +41,10 @@ const unpluginFactory = (opts) => {
|
|
|
41
41
|
return {
|
|
42
42
|
name: "unplugin-atscript",
|
|
43
43
|
resolveId(id, importer) {
|
|
44
|
-
if (importer && id.endsWith(".as"))
|
|
44
|
+
if (importer && id.endsWith(".as")) {
|
|
45
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
46
|
+
return path.default.join(path.default.dirname(importer), id);
|
|
47
|
+
}
|
|
45
48
|
},
|
|
46
49
|
async load(id) {
|
|
47
50
|
if (id.endsWith(".as")) {
|
package/dist/esbuild.mjs
CHANGED
|
@@ -17,7 +17,10 @@ const unpluginFactory = (opts) => {
|
|
|
17
17
|
return {
|
|
18
18
|
name: "unplugin-atscript",
|
|
19
19
|
resolveId(id, importer) {
|
|
20
|
-
if (importer && id.endsWith(".as"))
|
|
20
|
+
if (importer && id.endsWith(".as")) {
|
|
21
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
22
|
+
return path.join(path.dirname(importer), id);
|
|
23
|
+
}
|
|
21
24
|
},
|
|
22
25
|
async load(id) {
|
|
23
26
|
if (id.endsWith(".as")) {
|
package/dist/farm.cjs
CHANGED
|
@@ -41,7 +41,10 @@ const unpluginFactory = (opts) => {
|
|
|
41
41
|
return {
|
|
42
42
|
name: "unplugin-atscript",
|
|
43
43
|
resolveId(id, importer) {
|
|
44
|
-
if (importer && id.endsWith(".as"))
|
|
44
|
+
if (importer && id.endsWith(".as")) {
|
|
45
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
46
|
+
return path.default.join(path.default.dirname(importer), id);
|
|
47
|
+
}
|
|
45
48
|
},
|
|
46
49
|
async load(id) {
|
|
47
50
|
if (id.endsWith(".as")) {
|
package/dist/farm.mjs
CHANGED
|
@@ -17,7 +17,10 @@ const unpluginFactory = (opts) => {
|
|
|
17
17
|
return {
|
|
18
18
|
name: "unplugin-atscript",
|
|
19
19
|
resolveId(id, importer) {
|
|
20
|
-
if (importer && id.endsWith(".as"))
|
|
20
|
+
if (importer && id.endsWith(".as")) {
|
|
21
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
22
|
+
return path.join(path.dirname(importer), id);
|
|
23
|
+
}
|
|
21
24
|
},
|
|
22
25
|
async load(id) {
|
|
23
26
|
if (id.endsWith(".as")) {
|
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,10 @@ const unpluginFactory = (opts) => {
|
|
|
42
42
|
return {
|
|
43
43
|
name: "unplugin-atscript",
|
|
44
44
|
resolveId(id, importer) {
|
|
45
|
-
if (importer && id.endsWith(".as"))
|
|
45
|
+
if (importer && id.endsWith(".as")) {
|
|
46
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
47
|
+
return path.default.join(path.default.dirname(importer), id);
|
|
48
|
+
}
|
|
46
49
|
},
|
|
47
50
|
async load(id) {
|
|
48
51
|
if (id.endsWith(".as")) {
|
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,10 @@ const unpluginFactory = (opts) => {
|
|
|
17
17
|
return {
|
|
18
18
|
name: "unplugin-atscript",
|
|
19
19
|
resolveId(id, importer) {
|
|
20
|
-
if (importer && id.endsWith(".as"))
|
|
20
|
+
if (importer && id.endsWith(".as")) {
|
|
21
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
22
|
+
return path.join(path.dirname(importer), id);
|
|
23
|
+
}
|
|
21
24
|
},
|
|
22
25
|
async load(id) {
|
|
23
26
|
if (id.endsWith(".as")) {
|
package/dist/rolldown.cjs
CHANGED
|
@@ -41,7 +41,10 @@ const unpluginFactory = (opts) => {
|
|
|
41
41
|
return {
|
|
42
42
|
name: "unplugin-atscript",
|
|
43
43
|
resolveId(id, importer) {
|
|
44
|
-
if (importer && id.endsWith(".as"))
|
|
44
|
+
if (importer && id.endsWith(".as")) {
|
|
45
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
46
|
+
return path.default.join(path.default.dirname(importer), id);
|
|
47
|
+
}
|
|
45
48
|
},
|
|
46
49
|
async load(id) {
|
|
47
50
|
if (id.endsWith(".as")) {
|
package/dist/rolldown.mjs
CHANGED
|
@@ -17,7 +17,10 @@ const unpluginFactory = (opts) => {
|
|
|
17
17
|
return {
|
|
18
18
|
name: "unplugin-atscript",
|
|
19
19
|
resolveId(id, importer) {
|
|
20
|
-
if (importer && id.endsWith(".as"))
|
|
20
|
+
if (importer && id.endsWith(".as")) {
|
|
21
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
22
|
+
return path.join(path.dirname(importer), id);
|
|
23
|
+
}
|
|
21
24
|
},
|
|
22
25
|
async load(id) {
|
|
23
26
|
if (id.endsWith(".as")) {
|
package/dist/rollup.cjs
CHANGED
|
@@ -41,7 +41,10 @@ const unpluginFactory = (opts) => {
|
|
|
41
41
|
return {
|
|
42
42
|
name: "unplugin-atscript",
|
|
43
43
|
resolveId(id, importer) {
|
|
44
|
-
if (importer && id.endsWith(".as"))
|
|
44
|
+
if (importer && id.endsWith(".as")) {
|
|
45
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
46
|
+
return path.default.join(path.default.dirname(importer), id);
|
|
47
|
+
}
|
|
45
48
|
},
|
|
46
49
|
async load(id) {
|
|
47
50
|
if (id.endsWith(".as")) {
|
package/dist/rollup.mjs
CHANGED
|
@@ -17,7 +17,10 @@ const unpluginFactory = (opts) => {
|
|
|
17
17
|
return {
|
|
18
18
|
name: "unplugin-atscript",
|
|
19
19
|
resolveId(id, importer) {
|
|
20
|
-
if (importer && id.endsWith(".as"))
|
|
20
|
+
if (importer && id.endsWith(".as")) {
|
|
21
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
22
|
+
return path.join(path.dirname(importer), id);
|
|
23
|
+
}
|
|
21
24
|
},
|
|
22
25
|
async load(id) {
|
|
23
26
|
if (id.endsWith(".as")) {
|
package/dist/rspack.cjs
CHANGED
|
@@ -41,7 +41,10 @@ const unpluginFactory = (opts) => {
|
|
|
41
41
|
return {
|
|
42
42
|
name: "unplugin-atscript",
|
|
43
43
|
resolveId(id, importer) {
|
|
44
|
-
if (importer && id.endsWith(".as"))
|
|
44
|
+
if (importer && id.endsWith(".as")) {
|
|
45
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
46
|
+
return path.default.join(path.default.dirname(importer), id);
|
|
47
|
+
}
|
|
45
48
|
},
|
|
46
49
|
async load(id) {
|
|
47
50
|
if (id.endsWith(".as")) {
|
package/dist/rspack.mjs
CHANGED
|
@@ -17,7 +17,10 @@ const unpluginFactory = (opts) => {
|
|
|
17
17
|
return {
|
|
18
18
|
name: "unplugin-atscript",
|
|
19
19
|
resolveId(id, importer) {
|
|
20
|
-
if (importer && id.endsWith(".as"))
|
|
20
|
+
if (importer && id.endsWith(".as")) {
|
|
21
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
22
|
+
return path.join(path.dirname(importer), id);
|
|
23
|
+
}
|
|
21
24
|
},
|
|
22
25
|
async load(id) {
|
|
23
26
|
if (id.endsWith(".as")) {
|
package/dist/vite.cjs
CHANGED
|
@@ -41,7 +41,10 @@ const unpluginFactory = (opts) => {
|
|
|
41
41
|
return {
|
|
42
42
|
name: "unplugin-atscript",
|
|
43
43
|
resolveId(id, importer) {
|
|
44
|
-
if (importer && id.endsWith(".as"))
|
|
44
|
+
if (importer && id.endsWith(".as")) {
|
|
45
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
46
|
+
return path.default.join(path.default.dirname(importer), id);
|
|
47
|
+
}
|
|
45
48
|
},
|
|
46
49
|
async load(id) {
|
|
47
50
|
if (id.endsWith(".as")) {
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _unplugin from 'unplugin';
|
|
2
2
|
|
|
3
3
|
interface atscriptPluginOptions {
|
|
4
4
|
/**
|
|
@@ -8,6 +8,6 @@ interface atscriptPluginOptions {
|
|
|
8
8
|
strict?: boolean;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
declare const _default: (options?: atscriptPluginOptions | undefined) =>
|
|
11
|
+
declare const _default: (options?: atscriptPluginOptions | undefined) => _unplugin.VitePlugin<any> | _unplugin.VitePlugin<any>[];
|
|
12
12
|
|
|
13
13
|
export { _default as default };
|
package/dist/vite.mjs
CHANGED
|
@@ -17,7 +17,10 @@ const unpluginFactory = (opts) => {
|
|
|
17
17
|
return {
|
|
18
18
|
name: "unplugin-atscript",
|
|
19
19
|
resolveId(id, importer) {
|
|
20
|
-
if (importer && id.endsWith(".as"))
|
|
20
|
+
if (importer && id.endsWith(".as")) {
|
|
21
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
22
|
+
return path.join(path.dirname(importer), id);
|
|
23
|
+
}
|
|
21
24
|
},
|
|
22
25
|
async load(id) {
|
|
23
26
|
if (id.endsWith(".as")) {
|
package/dist/webpack.cjs
CHANGED
|
@@ -41,7 +41,10 @@ const unpluginFactory = (opts) => {
|
|
|
41
41
|
return {
|
|
42
42
|
name: "unplugin-atscript",
|
|
43
43
|
resolveId(id, importer) {
|
|
44
|
-
if (importer && id.endsWith(".as"))
|
|
44
|
+
if (importer && id.endsWith(".as")) {
|
|
45
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
46
|
+
return path.default.join(path.default.dirname(importer), id);
|
|
47
|
+
}
|
|
45
48
|
},
|
|
46
49
|
async load(id) {
|
|
47
50
|
if (id.endsWith(".as")) {
|
package/dist/webpack.mjs
CHANGED
|
@@ -17,7 +17,10 @@ const unpluginFactory = (opts) => {
|
|
|
17
17
|
return {
|
|
18
18
|
name: "unplugin-atscript",
|
|
19
19
|
resolveId(id, importer) {
|
|
20
|
-
if (importer && id.endsWith(".as"))
|
|
20
|
+
if (importer && id.endsWith(".as")) {
|
|
21
|
+
if (!id.startsWith(".") && !id.startsWith("/")) return null;
|
|
22
|
+
return path.join(path.dirname(importer), id);
|
|
23
|
+
}
|
|
21
24
|
},
|
|
22
25
|
async load(id) {
|
|
23
26
|
if (id.endsWith(".as")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-atscript",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.40",
|
|
4
4
|
"description": "Atscript: Configuration and build plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"annotations",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"vitest": "3.2.4"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
|
-
"@atscript/core": "^0.1.
|
|
84
|
-
"@atscript/typescript": "^0.1.
|
|
83
|
+
"@atscript/core": "^0.1.40",
|
|
84
|
+
"@atscript/typescript": "^0.1.40"
|
|
85
85
|
},
|
|
86
86
|
"build": [
|
|
87
87
|
{},
|