@vizejs/rspack-plugin 0.731.0 → 0.732.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.
|
@@ -2,6 +2,7 @@ import { ModuleShapeNapi } from "@vizejs/native";
|
|
|
2
2
|
|
|
3
3
|
//#region src/types/native.d.ts
|
|
4
4
|
/** Native compiler API types used by the Rspack adapter. */
|
|
5
|
+
/** Native SFC compiler options surfaced through the Rspack adapter. */
|
|
5
6
|
interface SfcCompileOptionsNapi {
|
|
6
7
|
filename?: string;
|
|
7
8
|
sourceMap?: boolean;
|
|
@@ -19,6 +20,7 @@ interface SfcCompileOptionsNapi {
|
|
|
19
20
|
/** Scope ID for scoped CSS (e.g., "data-v-abc123") */
|
|
20
21
|
scopeId?: string;
|
|
21
22
|
}
|
|
23
|
+
/** Style-block metadata returned by the native SFC compiler. */
|
|
22
24
|
interface StyleBlockNapi {
|
|
23
25
|
content: string;
|
|
24
26
|
src?: string;
|
|
@@ -28,10 +30,12 @@ interface StyleBlockNapi {
|
|
|
28
30
|
moduleName?: string;
|
|
29
31
|
index: number;
|
|
30
32
|
}
|
|
33
|
+
/** Attribute attached to a native custom-block record. */
|
|
31
34
|
interface SfcBlockAttributeNapi {
|
|
32
35
|
name: string;
|
|
33
36
|
value?: string;
|
|
34
37
|
}
|
|
38
|
+
/** Custom-block metadata returned by the native SFC compiler. */
|
|
35
39
|
interface CustomBlockNapi {
|
|
36
40
|
blockType: string;
|
|
37
41
|
content: string;
|
|
@@ -39,6 +43,7 @@ interface CustomBlockNapi {
|
|
|
39
43
|
attrs: SfcBlockAttributeNapi[];
|
|
40
44
|
index: number;
|
|
41
45
|
}
|
|
46
|
+
/** Compile-time macro artifact extracted from an SFC. */
|
|
42
47
|
interface MacroArtifact {
|
|
43
48
|
kind: string;
|
|
44
49
|
name: string;
|
|
@@ -48,6 +53,7 @@ interface MacroArtifact {
|
|
|
48
53
|
start: number;
|
|
49
54
|
end: number;
|
|
50
55
|
}
|
|
56
|
+
/** Native SFC compiler result consumed by the Rspack adapter. */
|
|
51
57
|
interface SfcCompileResultNapi {
|
|
52
58
|
code: string;
|
|
53
59
|
css?: string;
|
|
@@ -112,6 +118,7 @@ interface JsxCompileResultNapi {
|
|
|
112
118
|
}
|
|
113
119
|
//#endregion
|
|
114
120
|
//#region src/types/index.d.ts
|
|
121
|
+
/** Style-block metadata exposed to the Rspack compilation pipeline. */
|
|
115
122
|
interface StyleBlockInfo {
|
|
116
123
|
/** Raw style content */
|
|
117
124
|
content: string;
|
|
@@ -126,6 +133,7 @@ interface StyleBlockInfo {
|
|
|
126
133
|
/** Block index in the SFC */
|
|
127
134
|
index: number;
|
|
128
135
|
}
|
|
136
|
+
/** Custom-block metadata exposed to the Rspack compilation pipeline. */
|
|
129
137
|
interface CustomBlockInfo {
|
|
130
138
|
/** Tag name (e.g., "i18n", "docs") */
|
|
131
139
|
type: string;
|
|
@@ -138,6 +146,7 @@ interface CustomBlockInfo {
|
|
|
138
146
|
/** Block index in the SFC */
|
|
139
147
|
index: number;
|
|
140
148
|
}
|
|
149
|
+
/** External script and template sources referenced by an SFC. */
|
|
141
150
|
interface SfcSrcInfo {
|
|
142
151
|
/** <script src> path, or null */
|
|
143
152
|
scriptSrc?: string | null;
|
|
@@ -151,6 +160,7 @@ interface TemplateAssetUrl {
|
|
|
151
160
|
/** JS identifier for the import (e.g., "_imports_0") */
|
|
152
161
|
varName: string;
|
|
153
162
|
}
|
|
163
|
+
/** Normalized SFC compilation result consumed by Rspack output assembly. */
|
|
154
164
|
interface CompiledModule {
|
|
155
165
|
code: string;
|
|
156
166
|
/** Per-source metadata for browser-local HMR comparisons. */
|
|
@@ -189,19 +199,19 @@ type VizeSfcCompilerOptions = Omit<SfcCompileOptionsNapi, "ssr" | "vapor" | "sou
|
|
|
189
199
|
};
|
|
190
200
|
/** Compatibility type; prefer VizeSfcLoaderOptions or VizeJsxLoaderOptions. */
|
|
191
201
|
interface VizeLoaderOptions {
|
|
192
|
-
/** Override production output; otherwise follows loader mode / NODE_ENV. */
|
|
202
|
+
/** Override production output; otherwise follows loader mode / NODE_ENV. @default Rspack mode or NODE_ENV */
|
|
193
203
|
isProduction?: boolean;
|
|
194
|
-
/** Source maps; falls back to compilerOptions, then Rspack's loader context. */
|
|
204
|
+
/** Source maps; falls back to compilerOptions, then Rspack's loader context. @default enabled outside production */
|
|
195
205
|
sourceMap?: boolean;
|
|
196
206
|
/** SSR mode @default false */
|
|
197
207
|
ssr?: boolean;
|
|
198
|
-
/** Project root */
|
|
208
|
+
/** Project root. @default Rspack rootContext */
|
|
199
209
|
root?: string;
|
|
200
|
-
/** @deprecated Use module.rules[].include. Retained as a loader passthrough filter. */
|
|
210
|
+
/** @deprecated Use module.rules[].include. Retained as a loader passthrough filter. @default all files */
|
|
201
211
|
include?: string | RegExp | (string | RegExp)[];
|
|
202
|
-
/** @deprecated Use module.rules[].exclude. Retained as a loader passthrough filter. */
|
|
212
|
+
/** @deprecated Use module.rules[].exclude. Retained as a loader passthrough filter. @default no files */
|
|
203
213
|
exclude?: string | RegExp | (string | RegExp)[];
|
|
204
|
-
/** Low-level compiler options for @vizejs/native compileSfc */
|
|
214
|
+
/** Low-level compiler options for @vizejs/native compileSfc. @default {} */
|
|
205
215
|
compilerOptions?: VizeSfcCompilerOptions;
|
|
206
216
|
/** Custom element mode. true=all, RegExp=matched. @default /\.ce\.vue$/ */
|
|
207
217
|
customElement?: boolean | RegExp;
|
|
@@ -209,11 +219,11 @@ interface VizeLoaderOptions {
|
|
|
209
219
|
vapor?: boolean;
|
|
210
220
|
/** Default JSX output mode for `.jsx`/`.tsx` without a `"use vue:*"` directive. @default "vdom" */
|
|
211
221
|
jsxMode?: "vdom" | "vapor";
|
|
212
|
-
/** JSX semantics; `"babel"` opts into @vue/babel-plugin-jsx compatibility. */
|
|
222
|
+
/** JSX semantics; `"babel"` opts into @vue/babel-plugin-jsx compatibility. @default "native" */
|
|
213
223
|
jsxCompat?: "native" | "babel";
|
|
214
224
|
/** HMR. false to disable in dev. @default true (dev), false (prod/SSR) */
|
|
215
225
|
hotReload?: boolean;
|
|
216
|
-
/** CSS handling config */
|
|
226
|
+
/** CSS handling config. @default auto-detected from the Rspack configuration */
|
|
217
227
|
css?: {
|
|
218
228
|
/** With autoRules: false, override the plugin default for this SFC chain.
|
|
219
229
|
* With automatic rules, must match the plugin's resolved CSS mode. */
|
|
@@ -229,36 +239,38 @@ interface VizeLoaderOptions {
|
|
|
229
239
|
type VizeSfcLoaderOptions = Omit<VizeLoaderOptions, "jsxMode" | "jsxCompat">;
|
|
230
240
|
/** Options accepted by the JSX/TSX loader. */
|
|
231
241
|
type VizeJsxLoaderOptions = Pick<VizeLoaderOptions, "sourceMap" | "vapor" | "jsxMode" | "jsxCompat" | "include" | "exclude">;
|
|
242
|
+
/** Options accepted by the style-block extraction loader. */
|
|
232
243
|
interface VizeStyleLoaderOptions {
|
|
233
244
|
/** Rspack native CSS mode @default false */
|
|
234
245
|
native?: boolean;
|
|
235
246
|
}
|
|
247
|
+
/** Options for the Vize Rspack plugin's rule and feature-flag integration. */
|
|
236
248
|
interface VizeRspackPluginOptions {
|
|
237
|
-
/** @deprecated Use rule.include. This legacy field only filters plugin watch logs. */
|
|
249
|
+
/** @deprecated Use rule.include. This legacy field only filters plugin watch logs. @default all files */
|
|
238
250
|
include?: string | RegExp | (string | RegExp)[];
|
|
239
|
-
/** @deprecated Use rule.exclude. This legacy field only filters plugin watch logs. */
|
|
251
|
+
/** @deprecated Use rule.exclude. This legacy field only filters plugin watch logs. @default no files */
|
|
240
252
|
exclude?: string | RegExp | (string | RegExp)[];
|
|
241
|
-
/** @deprecated Use Rspack mode. Retained for plugin flags/logging only. */
|
|
253
|
+
/** @deprecated Use Rspack mode. Retained for plugin flags/logging only. @default Rspack mode */
|
|
242
254
|
isProduction?: boolean;
|
|
243
|
-
/** @deprecated Use SFC loader ssr. This plugin field is not forwarded. */
|
|
255
|
+
/** @deprecated Use SFC loader ssr. This plugin field is not forwarded. @default undefined */
|
|
244
256
|
ssr?: boolean;
|
|
245
|
-
/** @deprecated Use loader sourceMap. This plugin field is not forwarded. */
|
|
257
|
+
/** @deprecated Use loader sourceMap. This plugin field is not forwarded. @default undefined */
|
|
246
258
|
sourceMap?: boolean;
|
|
247
|
-
/** @deprecated Use loader vapor. This plugin field only affects the legacy debug message. */
|
|
259
|
+
/** @deprecated Use loader vapor. This plugin field only affects the legacy debug message. @default undefined */
|
|
248
260
|
vapor?: boolean;
|
|
249
|
-
/** @deprecated Use JSX loader jsxMode. This plugin field is not forwarded. */
|
|
261
|
+
/** @deprecated Use JSX loader jsxMode. This plugin field is not forwarded. @default undefined */
|
|
250
262
|
jsxMode?: "vdom" | "vapor";
|
|
251
|
-
/** @deprecated Use JSX loader jsxCompat. This plugin field is not forwarded. */
|
|
263
|
+
/** @deprecated Use JSX loader jsxCompat. This plugin field is not forwarded. @default undefined */
|
|
252
264
|
jsxCompat?: "native" | "babel";
|
|
253
|
-
/** @deprecated Use loader root or Rspack context. This plugin field is not forwarded. */
|
|
265
|
+
/** @deprecated Use loader root or Rspack context. This plugin field is not forwarded. @default undefined */
|
|
254
266
|
root?: string;
|
|
255
|
-
/** CSS config */
|
|
267
|
+
/** CSS config. @default auto-detected from Rspack version and experiments.css */
|
|
256
268
|
css?: {
|
|
257
269
|
/** Automatic CSS mode, or default for manual SFC rules. Auto-detected from
|
|
258
270
|
* the Rspack version and experiments.css when omitted. */
|
|
259
271
|
native?: boolean;
|
|
260
272
|
};
|
|
261
|
-
/** @deprecated Use SFC loader compilerOptions. This plugin field is not forwarded. */
|
|
273
|
+
/** @deprecated Use SFC loader compilerOptions. This plugin field is not forwarded. @default undefined */
|
|
262
274
|
compilerOptions?: SfcCompileOptionsNapi;
|
|
263
275
|
/** Debug logging @default false */
|
|
264
276
|
debug?: boolean;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as StyleBlockInfo, c as VizeRspackPluginOptions, d as VizeStyleLoaderOptions, f as JsxCompileOptionsNapi, g as SfcCompileResultNapi, h as SfcCompileOptionsNapi, i as SfcSrcInfo, l as VizeSfcCompilerOptions, m as MacroArtifact, n as CustomBlockInfo, o as VizeJsxLoaderOptions, p as JsxCompileResultNapi, r as LoaderEntry, s as VizeLoaderOptions, t as CompiledModule, u as VizeSfcLoaderOptions } from "./index-
|
|
1
|
+
import { a as StyleBlockInfo, c as VizeRspackPluginOptions, d as VizeStyleLoaderOptions, f as JsxCompileOptionsNapi, g as SfcCompileResultNapi, h as SfcCompileOptionsNapi, i as SfcSrcInfo, l as VizeSfcCompilerOptions, m as MacroArtifact, n as CustomBlockInfo, o as VizeJsxLoaderOptions, p as JsxCompileResultNapi, r as LoaderEntry, s as VizeLoaderOptions, t as CompiledModule, u as VizeSfcLoaderOptions } from "./index-BlAPiNid.mjs";
|
|
2
2
|
import vizeLoader from "./loader/index.mjs";
|
|
3
3
|
import vizeJsxLoader from "./loader/jsx-loader.mjs";
|
|
4
4
|
import vizeStyleLoader from "./loader/style-loader.mjs";
|
|
@@ -7,6 +7,7 @@ import sources from "webpack-sources";
|
|
|
7
7
|
import { Compiler, RuleSetRule } from "@rspack/core";
|
|
8
8
|
|
|
9
9
|
//#region src/plugin/index.d.ts
|
|
10
|
+
/** Configure Vue feature flags and the Rspack rules used by the Vize loaders. */
|
|
10
11
|
declare class VizePlugin {
|
|
11
12
|
static readonly name = "VizePlugin";
|
|
12
13
|
private options;
|
|
@@ -16,6 +17,7 @@ declare class VizePlugin {
|
|
|
16
17
|
}
|
|
17
18
|
//#endregion
|
|
18
19
|
//#region src/plugin/ruleCloning.d.ts
|
|
20
|
+
/** Result of adapting the configured CSS rules for Vue style sub-requests. */
|
|
19
21
|
interface RuleCloningResult {
|
|
20
22
|
/** Whether rule cloning was performed */
|
|
21
23
|
applied: boolean;
|
|
@@ -68,17 +70,18 @@ interface HmrMetadata {
|
|
|
68
70
|
declare function genHotReloadCode(id: string, metadata?: HmrMetadata, imports?: string, hot?: string, component?: string): string;
|
|
69
71
|
//#endregion
|
|
70
72
|
//#region src/shared/output.d.ts
|
|
73
|
+
/** Inputs used to assemble the JavaScript module emitted for a compiled SFC. */
|
|
71
74
|
interface GenerateOutputOptions {
|
|
72
75
|
requestPath: string;
|
|
73
|
-
/** Inject HMR boilerplate using `module.hot` (Rspack/webpack CJS API) */
|
|
76
|
+
/** Inject HMR boilerplate using `module.hot` (Rspack/webpack CJS API). @default false */
|
|
74
77
|
hmr?: boolean;
|
|
75
|
-
/** Original file path (for __file exposure in dev mode) */
|
|
78
|
+
/** Original file path (for __file exposure in dev mode). @default undefined */
|
|
76
79
|
filePath?: string;
|
|
77
|
-
/** Whether this is a production build */
|
|
80
|
+
/** Whether this is a production build. @default false */
|
|
78
81
|
isProduction?: boolean;
|
|
79
|
-
/** Project root context (for computing relative __file path) */
|
|
82
|
+
/** Project root context (for computing relative __file path). @default undefined */
|
|
80
83
|
rootContext?: string;
|
|
81
|
-
/** Whether Rspack native CSS is handling CSS module exports */
|
|
84
|
+
/** Whether Rspack native CSS is handling CSS module exports. @default false */
|
|
82
85
|
nativeCss?: boolean;
|
|
83
86
|
}
|
|
84
87
|
/** Generate JS output with style/custom-block imports and optional HMR code. */
|
package/dist/loader/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { u as VizeSfcLoaderOptions } from "../index-
|
|
1
|
+
import { u as VizeSfcLoaderOptions } from "../index-BlAPiNid.mjs";
|
|
2
2
|
import { LoaderContext } from "@rspack/core";
|
|
3
3
|
|
|
4
4
|
//#region src/loader/index.d.ts
|
|
5
|
+
/** Compile a Vue SFC and return the assembled JavaScript module to Rspack. */
|
|
5
6
|
declare function vizeLoader(this: LoaderContext<VizeSfcLoaderOptions>, source: string): void;
|
|
6
7
|
//#endregion
|
|
7
8
|
export { vizeLoader as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { o as VizeJsxLoaderOptions } from "../index-
|
|
1
|
+
import { o as VizeJsxLoaderOptions } from "../index-BlAPiNid.mjs";
|
|
2
2
|
import { LoaderContext } from "@rspack/core";
|
|
3
3
|
|
|
4
4
|
//#region src/loader/jsx-loader.d.ts
|
|
5
|
+
/** Compile a Vue JSX or TSX module through the native JSX compiler. */
|
|
5
6
|
declare function vizeJsxLoader(this: LoaderContext<VizeJsxLoaderOptions>, source: string): void;
|
|
6
7
|
//#endregion
|
|
7
8
|
export { vizeJsxLoader as default };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { LoaderContext } from "@rspack/core";
|
|
2
2
|
|
|
3
3
|
//#region src/loader/scope-loader.d.ts
|
|
4
|
+
/** Options for the scoped-CSS loader; scope metadata comes from the request query. */
|
|
4
5
|
interface VizeScopeLoaderOptions {}
|
|
6
|
+
/** Apply the native scoped-CSS transform to a scoped style sub-request. */
|
|
5
7
|
declare function vizeScopeLoader(this: LoaderContext<VizeScopeLoaderOptions>, source: string): void;
|
|
6
8
|
//#endregion
|
|
7
9
|
export { VizeScopeLoaderOptions, vizeScopeLoader as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { d as VizeStyleLoaderOptions } from "../index-
|
|
1
|
+
import { d as VizeStyleLoaderOptions } from "../index-BlAPiNid.mjs";
|
|
2
2
|
import { LoaderContext } from "@rspack/core";
|
|
3
3
|
|
|
4
4
|
//#region src/loader/style-loader.d.ts
|
|
5
|
+
/** Extract the requested style block from its owning Vue SFC. */
|
|
5
6
|
declare function vizeStyleLoader(this: LoaderContext<VizeStyleLoaderOptions>, source: string): void;
|
|
6
7
|
//#endregion
|
|
7
8
|
export { vizeStyleLoader as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/rspack-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.732.0",
|
|
4
4
|
"description": "High-performance Rspack plugin for Vue SFC compilation powered by Vize",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@vizejs/native": "0.
|
|
62
|
+
"@vizejs/native": "0.732.0",
|
|
63
63
|
"diff": "9.0.0",
|
|
64
64
|
"oxc-parser": "0.157.0",
|
|
65
65
|
"oxc-transform": "0.157.0",
|