unplugin-atscript 0.1.17 → 0.1.19
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 +36 -4
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +25 -25
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ An Unplugin for processing `.as` files using [Atscript](https://github.com/moost
|
|
|
7
7
|
- Supports `.as` file resolution and transformation
|
|
8
8
|
- Loads and processes `.as` files with Atscript
|
|
9
9
|
- Generates JavaScript output
|
|
10
|
-
- Compatible with Vite, Rollup,
|
|
10
|
+
- Compatible with Vite, Rollup, Rolldown, Webpack, Rspack, esbuild, and Farm
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
@@ -57,17 +57,49 @@ export default {
|
|
|
57
57
|
}
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
### Webpack
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
// webpack.config.js
|
|
64
|
+
const atscript = require('unplugin-atscript')
|
|
65
|
+
|
|
66
|
+
module.exports = {
|
|
67
|
+
plugins: [atscript.webpack()],
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### esbuild
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
import atscript from 'unplugin-atscript'
|
|
75
|
+
import { build } from 'esbuild'
|
|
76
|
+
|
|
77
|
+
build({
|
|
78
|
+
plugins: [atscript.esbuild()],
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Rolldown / Rspack / Farm
|
|
83
|
+
|
|
84
|
+
Use `atscript.rolldown()`, `atscript.rspack()`, or `atscript.farm()` respectively — same pattern as above.
|
|
85
|
+
|
|
60
86
|
## How It Works
|
|
61
87
|
|
|
62
88
|
1. Resolves `.as` files in the project.
|
|
63
89
|
2. Loads the Atscript configuration.
|
|
64
|
-
3. Uses `@atscript/core` to parse and transform `.as` files into JavaScript.
|
|
90
|
+
3. Uses `@atscript/core` and `@atscript/typescript` to parse and transform `.as` files into JavaScript.
|
|
65
91
|
4. Outputs the generated JavaScript for further processing.
|
|
66
92
|
|
|
67
93
|
## Configuration
|
|
68
94
|
|
|
69
|
-
The plugin automatically loads the Atscript configuration from your project. You can define additional options in your Atscript configuration file (`atscript.config.js
|
|
95
|
+
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}`).
|
|
96
|
+
|
|
97
|
+
### Plugin Options
|
|
98
|
+
|
|
99
|
+
| Option | Type | Default | Description |
|
|
100
|
+
| -------- | --------- | ------- | ------------------------------------------------------------------ |
|
|
101
|
+
| `strict` | `boolean` | `true` | When `true`, throws an error if any `.as` document has diagnostics |
|
|
70
102
|
|
|
71
103
|
## License
|
|
72
104
|
|
|
73
|
-
|
|
105
|
+
ISC
|
package/dist/index.cjs
CHANGED
|
@@ -23,16 +23,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
}) : target, mod));
|
|
24
24
|
|
|
25
25
|
//#endregion
|
|
26
|
+
const fs_promises = __toESM(require("fs/promises"));
|
|
26
27
|
const path = __toESM(require("path"));
|
|
27
28
|
const __atscript_core = __toESM(require("@atscript/core"));
|
|
28
29
|
const __atscript_typescript = __toESM(require("@atscript/typescript"));
|
|
29
|
-
const fs_promises = __toESM(require("fs/promises"));
|
|
30
30
|
const unplugin = __toESM(require("unplugin"));
|
|
31
31
|
|
|
32
32
|
//#region packages/unplugin/src/index.ts
|
|
33
33
|
const atscriptPluginFactory = (opts) => {
|
|
34
34
|
const root = process.cwd();
|
|
35
|
-
|
|
35
|
+
const atscriptConfig = new Promise((resolve) => {
|
|
36
36
|
(0, __atscript_core.resolveConfigFile)(root).then((p) => {
|
|
37
37
|
(0, __atscript_core.loadConfig)(p).then(resolve);
|
|
38
38
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { readFile } from "fs/promises";
|
|
1
2
|
import path from "path";
|
|
2
3
|
import { AtscriptRepo, isAnnotate, loadConfig, resolveConfigFile } from "@atscript/core";
|
|
3
4
|
import ts from "@atscript/typescript";
|
|
4
|
-
import { readFile } from "fs/promises";
|
|
5
5
|
import { createUnplugin } from "unplugin";
|
|
6
6
|
|
|
7
7
|
//#region packages/unplugin/src/index.ts
|
|
8
8
|
const atscriptPluginFactory = (opts) => {
|
|
9
9
|
const root = process.cwd();
|
|
10
|
-
|
|
10
|
+
const atscriptConfig = new Promise((resolve) => {
|
|
11
11
|
resolveConfigFile(root).then((p) => {
|
|
12
12
|
loadConfig(p).then(resolve);
|
|
13
13
|
});
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-atscript",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "Atscript: Configuration and build plugins.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.mjs",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
14
|
-
"import": "./dist/index.mjs",
|
|
15
|
-
"require": "./dist/index.cjs"
|
|
16
|
-
},
|
|
17
|
-
"./package.json": "./package.json"
|
|
18
|
-
},
|
|
19
5
|
"keywords": [
|
|
20
|
-
"atscript",
|
|
21
6
|
"annotations",
|
|
22
|
-
"
|
|
23
|
-
"rolldown-plugin",
|
|
7
|
+
"atscript",
|
|
24
8
|
"config",
|
|
25
|
-
"
|
|
9
|
+
"rolldown-plugin",
|
|
10
|
+
"runtime",
|
|
11
|
+
"vite-plugin"
|
|
26
12
|
],
|
|
13
|
+
"homepage": "https://github.com/moostjs/atscript/tree/main/packages/unplugin#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/moostjs/atscript/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "ISC",
|
|
27
18
|
"author": "Artem Maltsev",
|
|
28
19
|
"repository": {
|
|
29
20
|
"type": "git",
|
|
30
21
|
"url": "git+https://github.com/moostjs/atscript.git",
|
|
31
22
|
"directory": "packages/unplugin"
|
|
32
23
|
},
|
|
33
|
-
"
|
|
34
|
-
"
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"main": "dist/index.mjs",
|
|
29
|
+
"types": "dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.mjs",
|
|
34
|
+
"require": "./dist/index.cjs"
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
35
37
|
},
|
|
36
|
-
"homepage": "https://github.com/moostjs/atscript/tree/main/packages/unplugin#readme",
|
|
37
|
-
"license": "ISC",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"unplugin": "^2.1.2"
|
|
40
40
|
},
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"vitest": "3.2.4"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@atscript/
|
|
46
|
-
"@atscript/
|
|
45
|
+
"@atscript/typescript": "^0.1.19",
|
|
46
|
+
"@atscript/core": "^0.1.19"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"pub": "pnpm publish --access public",
|