@vizejs/vite-plugin 0.433.0 → 0.434.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
@@ -328,3 +328,8 @@ Use `vite-plugin-vize` when you need:
328
328
  ## License
329
329
 
330
330
  MIT
331
+
332
+ Framework integrations can pass an inherited whitespace default as the second
333
+ argument to `vize(options, { whitespace: "preserve" })`. Project compiler settings
334
+ and matching `entries[].compiler` override that default; explicit plugin and
335
+ nested template compiler options retain their existing precedence.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as VizeInspectorLintPlanProvider, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, i as VizeVueFeatures, l as VizeVueVersion, m as UserConfigExport, n as CompiledModule, o as VizeInspectorLintPlanRequest, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv, y as VizeConfig } from "./types-D7IFtAEo.mjs";
1
+ import { a as VizeInspectorLintPlanProvider, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, i as VizeVueFeatures, l as VizeVueVersion, m as UserConfigExport, n as CompiledModule, o as VizeInspectorLintPlanRequest, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv, y as VizeConfig } from "./types-CW8YdI0Y.mjs";
2
2
  import { Plugin } from "vite";
3
3
 
4
4
  //#region src/virtual.d.ts
@@ -18,7 +18,8 @@ interface DynamicImportAliasRule {
18
18
  declare function rewriteStaticAssetUrls(code: string, aliasRules: DynamicImportAliasRule[]): string;
19
19
  //#endregion
20
20
  //#region src/plugin/index.d.ts
21
- declare function vize(options?: VizeOptions): Plugin[];
21
+ /** Framework-derived defaults yield to project, entry, and explicit plugin options. */
22
+ declare function vize(options?: VizeOptions, compilerDefaults?: Pick<VizeOptions, "whitespace">): Plugin[];
22
23
  //#endregion
23
24
  //#region src/config.d.ts
24
25
  declare function defineConfig(config: UserConfigExport): UserConfigExport;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as rewriteStaticAssetUrls, t as vize } from "./plugin-CbLeHx5e.mjs";
1
+ import { n as rewriteStaticAssetUrls, t as vize } from "./plugin-BFLLSOo5.mjs";
2
2
  import { a as vizeConfigStore, i as resolveConfigExport, n as defineConfig, r as loadConfig, t as VIZE_CONFIG_FILE_ENV } from "./config-PP6EAmWc.mjs";
3
3
  //#region src/index.ts
4
4
  const __internal = { rewriteStaticAssetUrls };
@@ -1,4 +1,4 @@
1
- import { f as ResolvedVizeConfig } from "../types-D7IFtAEo.mjs";
1
+ import { f as ResolvedVizeConfig } from "../types-CW8YdI0Y.mjs";
2
2
  import { ResolvedConfig } from "vite";
3
3
 
4
4
  //#region src/internal/config-bridge.d.ts
@@ -2071,6 +2071,10 @@ async function resolveRelativeVueSfcImport(ctx, state, id, cleanImporter, isSsrR
2071
2071
  const resolvedPath = resolvedRequest.normalizedFsId ?? resolvedRequest.normalizedVuePath;
2072
2072
  if (!resolvedPath || !resolvedPath.endsWith(".vue")) return resolved;
2073
2073
  const effectiveQuery = resolvedRequest.querySuffix || querySuffix;
2074
+ if (effectiveQuery) {
2075
+ const params = new URLSearchParams(effectiveQuery.slice(1));
2076
+ if (params.has("raw") || params.has("url") || params.has("worker") || params.has("sharedworker")) return resolved;
2077
+ }
2074
2078
  return isDependencyScan ? resolvedPath : toPluginVisibleVirtualId(resolvedPath, isSsrRequest, effectiveQuery);
2075
2079
  }
2076
2080
  //#endregion
@@ -3003,7 +3007,7 @@ function findMacroArtifactModule(state, realPath, ssr, kind) {
3003
3007
  }, realPath, compiled);
3004
3008
  return compiled?.macroArtifacts?.find((artifact) => artifact.kind === kind)?.moduleCode ?? null;
3005
3009
  }
3006
- function loadCompiledSfcModule(state, realPath, isSsr, currentBase, loadOptions) {
3010
+ function loadCompiledSfcModule(state, realPath, isSsr, currentBase, needsGlobBaseRewrite, loadOptions) {
3007
3011
  const placeholderCode = getBoundaryPlaceholderCode(realPath, !!loadOptions?.ssr);
3008
3012
  if (placeholderCode) {
3009
3013
  state.logger.log(`load: using boundary placeholder for ${realPath}`);
@@ -3044,7 +3048,7 @@ function loadCompiledSfcModule(state, realPath, isSsr, currentBase, loadOptions)
3044
3048
  const rewritten = new MappedModule(isSsr ? normalizeVueServerRendererImport(emitted.code) : emitted.code, emitted.map);
3045
3049
  rewritten.edit(rewriteDynamicTemplateImports(rewritten.code, state.dynamicImportAliasRules));
3046
3050
  rewritten.edit(rewriteStaticAssetUrls(rewritten.code, state.dynamicImportAliasRules));
3047
- rewritten.edit(rewriteImportMetaGlobBase(rewritten.code, realPath, state.root));
3051
+ if (needsGlobBaseRewrite) rewritten.edit(rewriteImportMetaGlobBase(rewritten.code, realPath, state.root));
3048
3052
  rewritten.edit(registerSfcModule(state, rewritten.code, realPath, isSsr));
3049
3053
  return loadedSfcModule(rewritten.code, rewritten.map, state.isProduction, isSsr, compiled);
3050
3054
  }
@@ -3117,11 +3121,11 @@ function loadHook(state, id, loadOptions) {
3117
3121
  return null;
3118
3122
  }
3119
3123
  if (!shouldLoadCompiledVueSfcPath(state, realPath)) return null;
3120
- return loadCompiledSfcModule(state, realPath, isSsr, currentBase, loadOptions);
3124
+ return loadCompiledSfcModule(state, realPath, isSsr, currentBase, id.startsWith("\0"), loadOptions);
3121
3125
  }
3122
3126
  if (loadableVueSfcPath) {
3123
3127
  if (!shouldLoadCompiledVueSfcPath(state, loadableVueSfcPath, !!request.querySuffix && new URLSearchParams(request.querySuffix.slice(1)).has("nuxt_component"))) return null;
3124
- return loadCompiledSfcModule(state, loadableVueSfcPath, !!loadOptions?.ssr, currentBase, loadOptions);
3128
+ return loadCompiledSfcModule(state, loadableVueSfcPath, !!loadOptions?.ssr, currentBase, false, loadOptions);
3125
3129
  }
3126
3130
  if (id.startsWith("\0")) {
3127
3131
  const afterPrefix = id.startsWith("\0vize:") ? id.slice(6) : id.slice(1);
@@ -3973,7 +3977,7 @@ function resolveHookSsr(context, options) {
3973
3977
  }
3974
3978
  //#endregion
3975
3979
  //#region src/plugin/compiler-config.ts
3976
- function mergeCompilerOptions(options, sharedConfig) {
3980
+ function mergeCompilerOptions(options, sharedConfig, defaults = {}) {
3977
3981
  const viteConfig = sharedConfig?.vite ?? {};
3978
3982
  const compilerConfig = sharedConfig?.compiler ?? {};
3979
3983
  const compatibility = resolveCompatibilityOptions(options, compilerConfig);
@@ -3988,7 +3992,7 @@ function mergeCompilerOptions(options, sharedConfig) {
3988
3992
  customRenderer: options.customRenderer ?? compilerConfig.customRenderer ?? false,
3989
3993
  customElements: options.customElements ?? compilerConfig.customElements,
3990
3994
  templateSyntax,
3991
- whitespace: options.whitespace ?? compilerConfig.whitespace,
3995
+ whitespace: options.whitespace ?? compilerConfig.whitespace ?? defaults.whitespace,
3992
3996
  template: {
3993
3997
  ...options.template,
3994
3998
  compilerOptions: {
@@ -4082,14 +4086,14 @@ function resolveScopes(config, scopes, file) {
4082
4086
  }
4083
4087
  return compiler;
4084
4088
  }
4085
- function createFileCompilerOptions(config, root, explicit) {
4089
+ function createFileCompilerOptions(config, root, explicit, defaults = {}) {
4086
4090
  if (!config) return void 0;
4087
4091
  const scopes = compileScopes(config, root);
4088
4092
  if (scopes.length === 0) return void 0;
4089
4093
  return (file) => mergeCompilerOptions(explicit, {
4090
4094
  ...config,
4091
4095
  compiler: resolveScopes(config, scopes, file)
4092
- });
4096
+ }, defaults);
4093
4097
  }
4094
4098
  //#endregion
4095
4099
  //#region src/plugin/config-lifecycle.ts
@@ -4180,7 +4184,8 @@ function resolveVueFeatureDefines(features, define) {
4180
4184
  }
4181
4185
  //#endregion
4182
4186
  //#region src/plugin/index.ts
4183
- function vize(options = {}) {
4187
+ /** Framework-derived defaults yield to project, entry, and explicit plugin options. */
4188
+ function vize(options = {}, compilerDefaults = {}) {
4184
4189
  if (isLegacyVueCompatibilityMode(options)) return [createLegacyVueCompatibilityPlugin(options)];
4185
4190
  const state = {
4186
4191
  cache: new CompiledModuleCache(),
@@ -4199,7 +4204,10 @@ function vize(options = {}) {
4199
4204
  scanPatterns: null,
4200
4205
  precompileBatchSize: 128,
4201
4206
  ignorePatterns: [],
4202
- mergedOptions: options,
4207
+ mergedOptions: compilerDefaults.whitespace === void 0 ? options : {
4208
+ ...options,
4209
+ whitespace: options.whitespace ?? compilerDefaults.whitespace
4210
+ },
4203
4211
  initialized: false,
4204
4212
  dynamicImportAliasRules: [],
4205
4213
  cssAliasRules: [],
@@ -4247,8 +4255,8 @@ function vize(options = {}) {
4247
4255
  };
4248
4256
  const sharedConfigPromise = resolveSharedConfig(options, state.root, configEnv, state.logger);
4249
4257
  const sharedConfig = await register(resolvedConfig, state.root, sharedConfigPromise);
4250
- state.mergedOptions = mergeCompilerOptions(options, sharedConfig);
4251
- state.fileCompilerOptions = createFileCompilerOptions(sharedConfig, state.root, options);
4258
+ state.mergedOptions = mergeCompilerOptions(options, sharedConfig, compilerDefaults);
4259
+ state.fileCompilerOptions = createFileCompilerOptions(sharedConfig, state.root, options, compilerDefaults);
4252
4260
  state.compilerScopeIdentity = sharedConfig?.entries;
4253
4261
  state.dynamicImportAliasRules = [];
4254
4262
  for (const alias of resolvedConfig.resolve.alias) {
@@ -0,0 +1,2 @@
1
+ import { t as vize } from "./plugin-BFLLSOo5.mjs";
2
+ export { vize };
@@ -225,6 +225,9 @@ interface LinterConfig {
225
225
  };
226
226
  }
227
227
  interface LintRuleOptions {
228
+ "html/no-empty-palpable-content"?: {
229
+ contentDirectives?: string[];
230
+ };
228
231
  "type/strict-boolean-expressions"?: {
229
232
  allowString?: boolean;
230
233
  allowNumber?: boolean;
@@ -1,4 +1,4 @@
1
- import { _ as LinterConfig, g as FormatterConfig, h as CompilerConfig, m as UserConfigExport, p as UserConfig$1, t as VizeOptions, v as TypeCheckerConfig } from "./types-D7IFtAEo.mjs";
1
+ import { _ as LinterConfig, g as FormatterConfig, h as CompilerConfig, m as UserConfigExport, p as UserConfig$1, t as VizeOptions, v as TypeCheckerConfig } from "./types-CW8YdI0Y.mjs";
2
2
  import { ConfigEnv, UserConfig, defineConfig as defineConfig$1 } from "vite-plus";
3
3
 
4
4
  //#region src/vite-plus/types.d.ts
@@ -326,7 +326,7 @@ function defineConfig(config = {}, integration = {}) {
326
326
  const { options } = metadata;
327
327
  const plugins = compiler === false ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
328
328
  if (compiler !== false) {
329
- const { vize } = await import("./plugin-_ejkFWKG.mjs");
329
+ const { vize } = await import("./plugin-C8JA-lhE.mjs");
330
330
  plugins.push(vize({
331
331
  ...compiler,
332
332
  configMode: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.433.0",
3
+ "version": "0.434.0",
4
4
  "description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
5
5
  "keywords": [
6
6
  "compiler",
@@ -51,13 +51,13 @@
51
51
  "access": "public"
52
52
  },
53
53
  "dependencies": {
54
- "@vizejs/native": "0.433.0",
55
- "@vizejs/unplugin": "0.433.0",
54
+ "@vizejs/native": "0.434.0",
55
+ "@vizejs/unplugin": "0.434.0",
56
56
  "jsonc-parser": "^3.3.1",
57
57
  "oxc-parser": "0.144.0",
58
58
  "picomatch": "4.0.5",
59
59
  "tinyglobby": "0.2.17",
60
- "vize": "0.433.0"
60
+ "vize": "0.434.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "25.9.2",
@@ -1,2 +0,0 @@
1
- import { t as vize } from "./plugin-CbLeHx5e.mjs";
2
- export { vize };