@vizejs/vite-plugin 0.15.0 → 0.17.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.
Files changed (2) hide show
  1. package/dist/index.js +13 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1039,7 +1039,19 @@ function vize(options = {}) {
1039
1039
  const mainPlugin = {
1040
1040
  name: "vite-plugin-vize",
1041
1041
  enforce: "pre",
1042
- config(_, env) {
1042
+ config(userConfig, env) {
1043
+ const cssModules = userConfig.css?.modules;
1044
+ if (cssModules && typeof cssModules.generateScopedName === "function") {
1045
+ const origFn = cssModules.generateScopedName;
1046
+ cssModules.generateScopedName = function(name, filename, css) {
1047
+ let clean = filename;
1048
+ const nulIdx = clean.indexOf("\0");
1049
+ if (nulIdx >= 0) clean = clean.slice(nulIdx + 1);
1050
+ clean = clean.replace(/\.module\.\w+$/, "").replace(/\.\w+$/, "");
1051
+ if (clean.includes("?")) clean = clean.split("?")[0];
1052
+ return origFn.call(this, name, clean, css);
1053
+ };
1054
+ }
1043
1055
  return {
1044
1056
  define: {
1045
1057
  __VUE_OPTIONS_API__: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/vite-plugin",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "tinyglobby": "^0.2.0",
46
- "@vizejs/native": "0.15.0"
46
+ "@vizejs/native": "0.17.0"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsdown",