@vizejs/unplugin 0.115.0 → 0.117.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 CHANGED
@@ -9,8 +9,10 @@ Experimental unplugin-based Vue SFC integration powered by [Vize](https://github
9
9
  `@vizejs/unplugin` provides experimental support for:
10
10
 
11
11
  - `rollup`
12
+ - `rolldown`
12
13
  - `webpack`
13
14
  - `esbuild`
15
+ - `babel`
14
16
 
15
17
  Rspack intentionally uses the dedicated `@vizejs/rspack-plugin` path instead of an `unplugin` export because its loader chain, `experiments.css`, and HMR behavior need Rspack-specific handling.
16
18
 
@@ -44,6 +46,16 @@ export default {
44
46
  };
45
47
  ```
46
48
 
49
+ ### rolldown
50
+
51
+ ```javascript
52
+ import vize from "@vizejs/unplugin/rolldown";
53
+
54
+ export default {
55
+ plugins: [vize()],
56
+ };
57
+ ```
58
+
47
59
  ### esbuild
48
60
 
49
61
  ```javascript
@@ -57,6 +69,19 @@ await build({
57
69
  });
58
70
  ```
59
71
 
72
+ ### babel
73
+
74
+ ```javascript
75
+ import vize from "@vizejs/unplugin/babel";
76
+
77
+ export default {
78
+ plugins: [vize()],
79
+ };
80
+ ```
81
+
82
+ The Babel adapter compiles `.vue` files before Babel parses them. Keep your usual Babel
83
+ TypeScript/JSX transforms in the pipeline if your SFC scripts use those syntaxes.
84
+
60
85
  ## Caveats
61
86
 
62
87
  - Vite is still the recommended integration if you need the most complete behavior today.
@@ -0,0 +1,18 @@
1
+ import { n as VizeUnpluginOptions } from "./types-CMS9JlXQ.mjs";
2
+
3
+ //#region src/babel.d.ts
4
+ type BabelParserOptions = Record<string, unknown> & {
5
+ filename?: string;
6
+ sourceFilename?: string;
7
+ sourceFileName?: string;
8
+ plugins?: unknown[];
9
+ sourceType?: string;
10
+ };
11
+ type BabelParse = (code: string, options?: BabelParserOptions) => unknown;
12
+ declare function vizeBabelPlugin(_api: unknown, rawOptions?: VizeUnpluginOptions): {
13
+ name: string;
14
+ manipulateOptions: (_options: unknown, parserOptions: BabelParserOptions) => void;
15
+ parserOverride: (source: string, parserOptions: BabelParserOptions, parse: BabelParse) => unknown;
16
+ };
17
+ //#endregion
18
+ export { vizeBabelPlugin as default };
package/dist/babel.mjs ADDED
@@ -0,0 +1,44 @@
1
+ import { a as createFilter, i as generateOutput, r as compileVueModule, t as normalizeOptions } from "./unplugin-DL5Z78uY.mjs";
2
+ //#region src/babel.ts
3
+ function vizeBabelPlugin(_api, rawOptions = {}) {
4
+ const options = normalizeOptions(rawOptions);
5
+ const filter = createFilter(options.include, options.exclude);
6
+ const cache = /* @__PURE__ */ new Map();
7
+ return {
8
+ name: "babel-plugin-vize",
9
+ manipulateOptions(_options, parserOptions) {
10
+ ensureParserPlugin(parserOptions, "typescript");
11
+ ensureParserPlugin(parserOptions, "jsx");
12
+ },
13
+ parserOverride(source, parserOptions, parse) {
14
+ const filename = getFilename(parserOptions);
15
+ if (!filename || !filename.endsWith(".vue") || !filter(filename)) return;
16
+ const { compiled, warnings } = compileVueModule(filename, source, options, cache);
17
+ for (const warning of warnings) process.emitWarning(`[vize] ${warning}`, { type: "VizeWarning" });
18
+ return parse(generateOutput(compiled, {
19
+ isProduction: options.isProduction,
20
+ isDev: false,
21
+ filePath: filename
22
+ }), {
23
+ ...parserOptions,
24
+ filename,
25
+ sourceType: "module"
26
+ });
27
+ }
28
+ };
29
+ }
30
+ function getFilename(parserOptions) {
31
+ return String(parserOptions.filename ?? parserOptions.sourceFilename ?? parserOptions.sourceFileName ?? "");
32
+ }
33
+ function ensureParserPlugin(parserOptions, pluginName) {
34
+ const plugins = parserOptions.plugins ?? [];
35
+ if (!plugins.some((plugin) => parserPluginName(plugin) === pluginName)) plugins.push(pluginName);
36
+ parserOptions.plugins = plugins;
37
+ }
38
+ function parserPluginName(plugin) {
39
+ if (typeof plugin === "string") return plugin;
40
+ if (Array.isArray(plugin) && typeof plugin[0] === "string") return plugin[0];
41
+ return null;
42
+ }
43
+ //#endregion
44
+ export { vizeBabelPlugin as default };
package/dist/esbuild.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as vizeUnplugin } from "./unplugin-DdUoejrP.mjs";
1
+ import { n as vizeUnplugin } from "./unplugin-DL5Z78uY.mjs";
2
2
  //#region src/esbuild.ts
3
3
  var esbuild_default = vizeUnplugin.esbuild;
4
4
  //#endregion
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as vizeUnplugin } from "./unplugin-DdUoejrP.mjs";
1
+ import { n as vizeUnplugin } from "./unplugin-DL5Z78uY.mjs";
2
2
  export { vizeUnplugin as default, vizeUnplugin };
@@ -0,0 +1,7 @@
1
+ import { n as VizeUnpluginOptions } from "./types-CMS9JlXQ.mjs";
2
+ import * as _$unplugin from "unplugin";
3
+
4
+ //#region src/rolldown.d.ts
5
+ declare const _default: (options?: VizeUnpluginOptions | undefined) => _$unplugin.RollupPlugin<any> | _$unplugin.RollupPlugin<any>[];
6
+ //#endregion
7
+ export { _default as default };
@@ -0,0 +1,5 @@
1
+ import { n as vizeUnplugin } from "./unplugin-DL5Z78uY.mjs";
2
+ //#region src/rolldown.ts
3
+ var rolldown_default = vizeUnplugin.rollup;
4
+ //#endregion
5
+ export { rolldown_default as default };
package/dist/rollup.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as vizeUnplugin } from "./unplugin-DdUoejrP.mjs";
1
+ import { n as vizeUnplugin } from "./unplugin-DL5Z78uY.mjs";
2
2
  //#region src/rollup.ts
3
3
  var rollup_default = vizeUnplugin.rollup;
4
4
  //#endregion
@@ -359,4 +359,4 @@ const vizeUnplugin = createUnplugin((rawOptions = {}) => {
359
359
  };
360
360
  });
361
361
  //#endregion
362
- export { vizeUnplugin as t };
362
+ export { createFilter as a, generateOutput as i, vizeUnplugin as n, compileVueModule as r, normalizeOptions as t };
package/dist/webpack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as vizeUnplugin } from "./unplugin-DdUoejrP.mjs";
1
+ import { n as vizeUnplugin } from "./unplugin-DL5Z78uY.mjs";
2
2
  //#region src/webpack.ts
3
3
  var webpack_default = vizeUnplugin.webpack;
4
4
  //#endregion
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@vizejs/unplugin",
3
- "version": "0.115.0",
4
- "description": "Experimental unplugin-based Vue SFC integration for rollup, webpack, and esbuild powered by Vize",
3
+ "version": "0.117.0",
4
+ "description": "Experimental Vue SFC integrations for Rollup, Rolldown, Webpack, esbuild, and Babel powered by Vize",
5
5
  "keywords": [
6
+ "babel",
6
7
  "compiler",
7
8
  "esbuild",
8
9
  "fast",
9
10
  "native",
10
11
  "plugin",
12
+ "rolldown",
11
13
  "rollup",
12
14
  "unplugin",
13
15
  "vue",
@@ -45,17 +47,27 @@
45
47
  "import": "./dist/rollup.mjs",
46
48
  "default": "./dist/rollup.mjs"
47
49
  },
50
+ "./rolldown": {
51
+ "types": "./dist/rolldown.d.mts",
52
+ "import": "./dist/rolldown.mjs",
53
+ "default": "./dist/rolldown.mjs"
54
+ },
48
55
  "./webpack": {
49
56
  "types": "./dist/webpack.d.mts",
50
57
  "import": "./dist/webpack.mjs",
51
58
  "default": "./dist/webpack.mjs"
59
+ },
60
+ "./babel": {
61
+ "types": "./dist/babel.d.mts",
62
+ "import": "./dist/babel.mjs",
63
+ "default": "./dist/babel.mjs"
52
64
  }
53
65
  },
54
66
  "publishConfig": {
55
67
  "access": "public"
56
68
  },
57
69
  "dependencies": {
58
- "@vizejs/native": "0.115.0",
70
+ "@vizejs/native": "0.117.0",
59
71
  "oxc-transform": "0.130.0",
60
72
  "unplugin": "3.0.0"
61
73
  },