unplugin-atscript 0.1.37 → 0.1.39

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 CHANGED
@@ -1,116 +1,57 @@
1
- # Atscript Unplugin
1
+ <p align="center">
2
+ <img src="https://atscript.moost.org/logo.svg" alt="Atscript" width="120" />
3
+ </p>
2
4
 
3
- An Unplugin for processing `.as` files using [Atscript](https://github.com/moostjs/atscript). This plugin enables seamless integration of Atscript into modern build tools like Vite and Rollup. Thanks to Unplugin, it also supports Webpack and other bundlers.
5
+ <h1 align="center">unplugin-atscript</h1>
4
6
 
5
- ## Features
6
-
7
- - Supports `.as` file resolution and transformation
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
- ## Installation
11
+ <p align="center">
12
+ <a href="https://atscript.moost.org">Documentation</a> · <a href="https://atscript.moost.org/packages/typescript/build-setup">Build Setup Guide</a>
13
+ </p>
14
14
 
15
- ```sh
16
- npm install -D unplugin-atscript @atscript/typescript
17
- ```
15
+ ---
18
16
 
19
- or
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
- ```sh
22
- yarn add --dev unplugin-atscript @atscript/typescript
23
- ```
24
-
25
- or
19
+ ## Installation
26
20
 
27
- ```sh
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
- ## Usage
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
- ### Rspack / Farm
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
- ## How It Works
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
- The plugin automatically loads the Atscript configuration from your project. You can define additional options in your Atscript configuration file (`atscript.config.{js,mjs,cjs,ts,mts,cts}`).
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
- ### Plugin Options
50
+ ## Documentation
109
51
 
110
- | Option | Type | Default | Description |
111
- | -------- | --------- | ------- | ------------------------------------------------------------------ |
112
- | `strict` | `boolean` | `true` | When `true`, throws an error if any `.as` document has diagnostics |
52
+ - [Build Setup Guide](https://atscript.moost.org/packages/typescript/build-setup)
53
+ - [Full Documentation](https://atscript.moost.org)
113
54
 
114
55
  ## License
115
56
 
116
- ISC
57
+ MIT
package/dist/esbuild.cjs CHANGED
@@ -74,7 +74,7 @@ const unpluginFactory = (opts) => {
74
74
  };
75
75
 
76
76
  //#endregion
77
- //#region packages/unplugin/src/esbuild.ts
77
+ //#region packages/unplugin/src/adapters/esbuild.ts
78
78
  var esbuild_default = (0, unplugin.createEsbuildPlugin)(unpluginFactory);
79
79
 
80
80
  //#endregion
package/dist/esbuild.mjs CHANGED
@@ -50,7 +50,7 @@ const unpluginFactory = (opts) => {
50
50
  };
51
51
 
52
52
  //#endregion
53
- //#region packages/unplugin/src/esbuild.ts
53
+ //#region packages/unplugin/src/adapters/esbuild.ts
54
54
  var esbuild_default = createEsbuildPlugin(unpluginFactory);
55
55
 
56
56
  //#endregion
package/dist/farm.cjs CHANGED
@@ -74,7 +74,7 @@ const unpluginFactory = (opts) => {
74
74
  };
75
75
 
76
76
  //#endregion
77
- //#region packages/unplugin/src/farm.ts
77
+ //#region packages/unplugin/src/adapters/farm.ts
78
78
  var farm_default = (0, unplugin.createFarmPlugin)(unpluginFactory);
79
79
 
80
80
  //#endregion
package/dist/farm.mjs CHANGED
@@ -50,7 +50,7 @@ const unpluginFactory = (opts) => {
50
50
  };
51
51
 
52
52
  //#endregion
53
- //#region packages/unplugin/src/farm.ts
53
+ //#region packages/unplugin/src/adapters/farm.ts
54
54
  var farm_default = createFarmPlugin(unpluginFactory);
55
55
 
56
56
  //#endregion
package/dist/rolldown.cjs CHANGED
@@ -74,7 +74,7 @@ const unpluginFactory = (opts) => {
74
74
  };
75
75
 
76
76
  //#endregion
77
- //#region packages/unplugin/src/rolldown.ts
77
+ //#region packages/unplugin/src/adapters/rolldown.ts
78
78
  var rolldown_default = (0, unplugin.createRolldownPlugin)(unpluginFactory);
79
79
 
80
80
  //#endregion
package/dist/rolldown.mjs CHANGED
@@ -50,7 +50,7 @@ const unpluginFactory = (opts) => {
50
50
  };
51
51
 
52
52
  //#endregion
53
- //#region packages/unplugin/src/rolldown.ts
53
+ //#region packages/unplugin/src/adapters/rolldown.ts
54
54
  var rolldown_default = createRolldownPlugin(unpluginFactory);
55
55
 
56
56
  //#endregion
package/dist/rollup.cjs CHANGED
@@ -74,7 +74,7 @@ const unpluginFactory = (opts) => {
74
74
  };
75
75
 
76
76
  //#endregion
77
- //#region packages/unplugin/src/rollup.ts
77
+ //#region packages/unplugin/src/adapters/rollup.ts
78
78
  var rollup_default = (0, unplugin.createRollupPlugin)(unpluginFactory);
79
79
 
80
80
  //#endregion
package/dist/rollup.mjs CHANGED
@@ -50,7 +50,7 @@ const unpluginFactory = (opts) => {
50
50
  };
51
51
 
52
52
  //#endregion
53
- //#region packages/unplugin/src/rollup.ts
53
+ //#region packages/unplugin/src/adapters/rollup.ts
54
54
  var rollup_default = createRollupPlugin(unpluginFactory);
55
55
 
56
56
  //#endregion
package/dist/rspack.cjs CHANGED
@@ -74,7 +74,7 @@ const unpluginFactory = (opts) => {
74
74
  };
75
75
 
76
76
  //#endregion
77
- //#region packages/unplugin/src/rspack.ts
77
+ //#region packages/unplugin/src/adapters/rspack.ts
78
78
  var rspack_default = (0, unplugin.createRspackPlugin)(unpluginFactory);
79
79
 
80
80
  //#endregion
package/dist/rspack.mjs CHANGED
@@ -50,7 +50,7 @@ const unpluginFactory = (opts) => {
50
50
  };
51
51
 
52
52
  //#endregion
53
- //#region packages/unplugin/src/rspack.ts
53
+ //#region packages/unplugin/src/adapters/rspack.ts
54
54
  var rspack_default = createRspackPlugin(unpluginFactory);
55
55
 
56
56
  //#endregion
package/dist/vite.cjs CHANGED
@@ -74,7 +74,7 @@ const unpluginFactory = (opts) => {
74
74
  };
75
75
 
76
76
  //#endregion
77
- //#region packages/unplugin/src/vite.ts
77
+ //#region packages/unplugin/src/adapters/vite.ts
78
78
  var vite_default = (0, unplugin.createVitePlugin)(unpluginFactory);
79
79
 
80
80
  //#endregion
package/dist/vite.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as _unplugin from 'unplugin';
1
+ import * as vite from 'vite';
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) => _unplugin.VitePlugin<any> | _unplugin.VitePlugin<any>[];
11
+ declare const _default: (options?: atscriptPluginOptions | undefined) => vite.Plugin<any> | vite.Plugin<any>[];
12
12
 
13
13
  export { _default as default };
package/dist/vite.mjs CHANGED
@@ -50,7 +50,7 @@ const unpluginFactory = (opts) => {
50
50
  };
51
51
 
52
52
  //#endregion
53
- //#region packages/unplugin/src/vite.ts
53
+ //#region packages/unplugin/src/adapters/vite.ts
54
54
  var vite_default = createVitePlugin(unpluginFactory);
55
55
 
56
56
  //#endregion
package/dist/webpack.cjs CHANGED
@@ -74,7 +74,7 @@ const unpluginFactory = (opts) => {
74
74
  };
75
75
 
76
76
  //#endregion
77
- //#region packages/unplugin/src/webpack.ts
77
+ //#region packages/unplugin/src/adapters/webpack.ts
78
78
  var webpack_default = (0, unplugin.createWebpackPlugin)(unpluginFactory);
79
79
 
80
80
  //#endregion
package/dist/webpack.mjs CHANGED
@@ -50,7 +50,7 @@ const unpluginFactory = (opts) => {
50
50
  };
51
51
 
52
52
  //#endregion
53
- //#region packages/unplugin/src/webpack.ts
53
+ //#region packages/unplugin/src/adapters/webpack.ts
54
54
  var webpack_default = createWebpackPlugin(unpluginFactory);
55
55
 
56
56
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-atscript",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "Atscript: Configuration and build plugins.",
5
5
  "keywords": [
6
6
  "annotations",
@@ -80,44 +80,44 @@
80
80
  "vitest": "3.2.4"
81
81
  },
82
82
  "peerDependencies": {
83
- "@atscript/core": "^0.1.37",
84
- "@atscript/typescript": "^0.1.37"
83
+ "@atscript/core": "^0.1.39",
84
+ "@atscript/typescript": "^0.1.39"
85
85
  },
86
86
  "build": [
87
87
  {},
88
88
  {
89
89
  "entries": [
90
- "src/vite.ts"
90
+ "src/adapters/vite.ts"
91
91
  ]
92
92
  },
93
93
  {
94
94
  "entries": [
95
- "src/rollup.ts"
95
+ "src/adapters/rollup.ts"
96
96
  ]
97
97
  },
98
98
  {
99
99
  "entries": [
100
- "src/rolldown.ts"
100
+ "src/adapters/rolldown.ts"
101
101
  ]
102
102
  },
103
103
  {
104
104
  "entries": [
105
- "src/webpack.ts"
105
+ "src/adapters/webpack.ts"
106
106
  ]
107
107
  },
108
108
  {
109
109
  "entries": [
110
- "src/esbuild.ts"
110
+ "src/adapters/esbuild.ts"
111
111
  ]
112
112
  },
113
113
  {
114
114
  "entries": [
115
- "src/rspack.ts"
115
+ "src/adapters/rspack.ts"
116
116
  ]
117
117
  },
118
118
  {
119
119
  "entries": [
120
- "src/farm.ts"
120
+ "src/adapters/farm.ts"
121
121
  ]
122
122
  }
123
123
  ],