@vizejs/vite-plugin 0.332.0 → 0.334.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/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as VizeVueVersion, c as VizeInspectorLintPlanRequest, d as LoadConfigOptions, f as ResolvedVizeConfig, i as VizeOptions, l as VizeInspectorOptions, m as VizeConfig, n as MacroArtifact, o as VizeVueFeatures, p as UserConfigExport, r as VizeCompatibilityOptions, s as VizeInspectorLintPlanProvider, t as CompiledModule, u as ConfigEnv } from "./types-
|
|
1
|
+
import { a as VizeVueVersion, c as VizeInspectorLintPlanRequest, d as LoadConfigOptions, f as ResolvedVizeConfig, i as VizeOptions, l as VizeInspectorOptions, m as VizeConfig, n as MacroArtifact, o as VizeVueFeatures, p as UserConfigExport, r as VizeCompatibilityOptions, s as VizeInspectorLintPlanProvider, t as CompiledModule, u as ConfigEnv } from "./types-T_Fu8G5I.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
|
|
4
4
|
//#region src/virtual.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -341,9 +341,20 @@ function toNativeCssAliasRule(rule) {
|
|
|
341
341
|
}
|
|
342
342
|
//#endregion
|
|
343
343
|
//#region src/utils/filter.ts
|
|
344
|
+
/**
|
|
345
|
+
* Defaults the filter falls back to, and what the `vite:vue` shim reports
|
|
346
|
+
* through `api.include` / `api.exclude` when neither is configured (#3227).
|
|
347
|
+
*
|
|
348
|
+
* `DEFAULT_INCLUDE_PATTERN` is `@vitejs/plugin-vue`'s own default.
|
|
349
|
+
* `DEFAULT_EXCLUDE_PATTERN` has no upstream counterpart — plugin-vue leaves
|
|
350
|
+
* `exclude` undefined — so the shim reports the pattern Vize actually filters
|
|
351
|
+
* on rather than an upstream-shaped `undefined` it does not honor.
|
|
352
|
+
*/
|
|
353
|
+
const DEFAULT_INCLUDE_PATTERN = /\.vue$/;
|
|
354
|
+
const DEFAULT_EXCLUDE_PATTERN = /node_modules/;
|
|
344
355
|
function createFilter(include, exclude) {
|
|
345
|
-
const includePatterns = include ? Array.isArray(include) ? include : [include] : [
|
|
346
|
-
const excludePatterns = exclude ? Array.isArray(exclude) ? exclude : [exclude] : [
|
|
356
|
+
const includePatterns = include ? Array.isArray(include) ? include : [include] : [DEFAULT_INCLUDE_PATTERN];
|
|
357
|
+
const excludePatterns = exclude ? Array.isArray(exclude) ? exclude : [exclude] : [DEFAULT_EXCLUDE_PATTERN];
|
|
347
358
|
return (id) => {
|
|
348
359
|
const matchInclude = includePatterns.some((pattern) => matchesFilterPattern(pattern, id));
|
|
349
360
|
const matchExclude = excludePatterns.some((pattern) => matchesFilterPattern(pattern, id));
|
|
@@ -3044,7 +3055,16 @@ async function handleHotUpdateEnvironmentHook(state, environment, options) {
|
|
|
3044
3055
|
}
|
|
3045
3056
|
//#endregion
|
|
3046
3057
|
//#region src/plugin/compat.ts
|
|
3047
|
-
|
|
3058
|
+
/**
|
|
3059
|
+
* The `vite:vue` shim a host framework probes for a Vue plugin.
|
|
3060
|
+
*
|
|
3061
|
+
* `api.include` / `api.exclude` report the patterns behind `state.filter`, and
|
|
3062
|
+
* assigning them rewrites the plugin's own options — the only window where that
|
|
3063
|
+
* is meaningful is before `configResolved` builds the filter, so a later write
|
|
3064
|
+
* throws rather than silently doing nothing (#3227). Upstream guards the same
|
|
3065
|
+
* way, keyed on its `options` hook instead.
|
|
3066
|
+
*/
|
|
3067
|
+
function createVueCompatPlugin(state, options) {
|
|
3048
3068
|
let compilerSfc = null;
|
|
3049
3069
|
const loadCompilerSfc = () => {
|
|
3050
3070
|
if (!compilerSfc) try {
|
|
@@ -3057,16 +3077,36 @@ function createVueCompatPlugin(state) {
|
|
|
3057
3077
|
}
|
|
3058
3078
|
return compilerSfc;
|
|
3059
3079
|
};
|
|
3080
|
+
const configured = () => state.initialized ? state.mergedOptions : options;
|
|
3081
|
+
const assertUnresolved = (name) => {
|
|
3082
|
+
if (state.initialized) throw new Error(`${name} cannot be updated after the filter is resolved`);
|
|
3083
|
+
};
|
|
3060
3084
|
return {
|
|
3061
3085
|
name: "vite:vue",
|
|
3062
|
-
api: {
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3086
|
+
api: {
|
|
3087
|
+
get options() {
|
|
3088
|
+
return {
|
|
3089
|
+
compiler: loadCompilerSfc(),
|
|
3090
|
+
isProduction: state.isProduction ?? false,
|
|
3091
|
+
root: state.root ?? process.cwd(),
|
|
3092
|
+
template: {}
|
|
3093
|
+
};
|
|
3094
|
+
},
|
|
3095
|
+
get include() {
|
|
3096
|
+
return configured().include ?? DEFAULT_INCLUDE_PATTERN;
|
|
3097
|
+
},
|
|
3098
|
+
set include(value) {
|
|
3099
|
+
assertUnresolved("include");
|
|
3100
|
+
options.include = value;
|
|
3101
|
+
},
|
|
3102
|
+
get exclude() {
|
|
3103
|
+
return configured().exclude ?? DEFAULT_EXCLUDE_PATTERN;
|
|
3104
|
+
},
|
|
3105
|
+
set exclude(value) {
|
|
3106
|
+
assertUnresolved("exclude");
|
|
3107
|
+
options.exclude = value;
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3070
3110
|
};
|
|
3071
3111
|
}
|
|
3072
3112
|
function normalizeVirtualStyleId(id) {
|
|
@@ -3690,11 +3730,18 @@ function parseDefine(value) {
|
|
|
3690
3730
|
return value;
|
|
3691
3731
|
}
|
|
3692
3732
|
}
|
|
3693
|
-
/**
|
|
3694
|
-
|
|
3733
|
+
/**
|
|
3734
|
+
* Resolve Vue runtime defines with plugin-vue's precedence and defaults.
|
|
3735
|
+
*
|
|
3736
|
+
* `__VUE_PROD_DEVTOOLS__` used to be `command === "serve"`, which left no way to
|
|
3737
|
+
* enable devtools for a production build (#3227). It now follows plugin-vue's
|
|
3738
|
+
* OR semantics, and defaults to `false` in dev as upstream does: a development
|
|
3739
|
+
* build enables devtools through Vue's own `__DEV__`, not through this flag.
|
|
3740
|
+
*/
|
|
3741
|
+
function resolveVueFeatureDefines(features, define) {
|
|
3695
3742
|
return {
|
|
3696
3743
|
__VUE_OPTIONS_API__: features?.optionsAPI ?? parseDefine(define?.__VUE_OPTIONS_API__) ?? true,
|
|
3697
|
-
__VUE_PROD_DEVTOOLS__:
|
|
3744
|
+
__VUE_PROD_DEVTOOLS__: (features?.prodDevtools || parseDefine(define?.__VUE_PROD_DEVTOOLS__)) ?? false,
|
|
3698
3745
|
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: (features?.prodHydrationMismatchDetails || parseDefine(define?.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__)) ?? false
|
|
3699
3746
|
};
|
|
3700
3747
|
}
|
|
@@ -3749,14 +3796,14 @@ function vize(options = {}) {
|
|
|
3749
3796
|
logger: createLogger(options.debug ?? false)
|
|
3750
3797
|
};
|
|
3751
3798
|
return [
|
|
3752
|
-
createVueCompatPlugin(state),
|
|
3799
|
+
createVueCompatPlugin(state, options),
|
|
3753
3800
|
{
|
|
3754
3801
|
name: "vite-plugin-vize",
|
|
3755
3802
|
enforce: "pre",
|
|
3756
|
-
config(userConfig
|
|
3803
|
+
config(userConfig) {
|
|
3757
3804
|
patchCssModuleGenerateScopedName(userConfig);
|
|
3758
3805
|
return {
|
|
3759
|
-
define: resolveVueFeatureDefines(options.features, userConfig.define
|
|
3806
|
+
define: resolveVueFeatureDefines(options.features, userConfig.define),
|
|
3760
3807
|
optimizeDeps: { exclude: ["virtual:vize-styles"] }
|
|
3761
3808
|
};
|
|
3762
3809
|
},
|
|
@@ -730,6 +730,11 @@ interface VizeVueFeatures {
|
|
|
730
730
|
* @default true
|
|
731
731
|
*/
|
|
732
732
|
optionsAPI?: boolean;
|
|
733
|
+
/**
|
|
734
|
+
* Enable Vue devtools support in production bundles.
|
|
735
|
+
* @default false
|
|
736
|
+
*/
|
|
737
|
+
prodDevtools?: boolean;
|
|
733
738
|
/**
|
|
734
739
|
* Enable detailed hydration mismatch errors in production bundles.
|
|
735
740
|
* @default false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.334.0",
|
|
4
4
|
"description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@vizejs/native": "0.
|
|
48
|
+
"@vizejs/native": "0.334.0",
|
|
49
49
|
"oxc-parser": "0.133.0",
|
|
50
50
|
"tinyglobby": "0.2.16",
|
|
51
|
-
"vize": "0.
|
|
51
|
+
"vize": "0.334.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "25.9.2",
|