@wevu/compiler 6.15.5 → 6.15.6

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.mjs +29 -29
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -4274,23 +4274,6 @@ function getSfcCheckMtime(config) {
4274
4274
  const CSS_RULE_RE = /([^{]+)(\{[^}]*\})/g;
4275
4275
  const CSS_CLASS_RE = /\.([a-z_][\w-]*)(?:\[[^\]]+\])?\s*\{/gi;
4276
4276
  /**
4277
- * 将 Vue SFC 的 style 块转换为 WXSS
4278
- */
4279
- function compileVueStyleToWxss(styleBlock, options) {
4280
- const { id, scoped, modules } = options;
4281
- let code = styleBlock.content;
4282
- if (scoped || styleBlock.scoped) code = transformScopedCss(code, id);
4283
- if (modules || styleBlock.module) {
4284
- const moduleName = typeof styleBlock.module === "string" ? styleBlock.module : "$style";
4285
- const moduleResult = transformCssModules(code, id);
4286
- return {
4287
- code: moduleResult.code,
4288
- modules: { [moduleName]: moduleResult.classes }
4289
- };
4290
- }
4291
- return { code };
4292
- }
4293
- /**
4294
4277
  * 转换 scoped CSS
4295
4278
  * 为每个选择器添加特定的 scoped 属性
4296
4279
  */
@@ -4307,6 +4290,22 @@ function transformScopedCss(source, id) {
4307
4290
  });
4308
4291
  }
4309
4292
  /**
4293
+ * 样式转换:CSS → WXSS
4294
+ * 处理小程序不支持的 CSS 特性
4295
+ */
4296
+ /**
4297
+ * 生成简单的 hash
4298
+ */
4299
+ function generateHash(str) {
4300
+ let hash = 0;
4301
+ for (let i = 0; i < str.length; i++) {
4302
+ const char = str.charCodeAt(i);
4303
+ hash = (hash << 5) - hash + char;
4304
+ hash = hash & hash;
4305
+ }
4306
+ return Math.abs(hash).toString(36) + str.length.toString(36);
4307
+ }
4308
+ /**
4310
4309
  * 转换 CSS Modules
4311
4310
  */
4312
4311
  function transformCssModules(source, id) {
@@ -4331,20 +4330,21 @@ function transformCssModules(source, id) {
4331
4330
  };
4332
4331
  }
4333
4332
  /**
4334
- * 样式转换:CSS WXSS
4335
- * 处理小程序不支持的 CSS 特性
4336
- */
4337
- /**
4338
- * 生成简单的 hash
4333
+ * Vue SFC 的 style 块转换为 WXSS
4339
4334
  */
4340
- function generateHash(str) {
4341
- let hash = 0;
4342
- for (let i = 0; i < str.length; i++) {
4343
- const char = str.charCodeAt(i);
4344
- hash = (hash << 5) - hash + char;
4345
- hash = hash & hash;
4335
+ function compileVueStyleToWxss(styleBlock, options) {
4336
+ const { id, scoped, modules } = options;
4337
+ let code = styleBlock.content;
4338
+ if (scoped || styleBlock.scoped) code = transformScopedCss(code, id);
4339
+ if (modules || styleBlock.module) {
4340
+ const moduleName = typeof styleBlock.module === "string" ? styleBlock.module : "$style";
4341
+ const moduleResult = transformCssModules(code, id);
4342
+ return {
4343
+ code: moduleResult.code,
4344
+ modules: { [moduleName]: moduleResult.classes }
4345
+ };
4346
4346
  }
4347
- return Math.abs(hash).toString(36) + str.length.toString(36);
4347
+ return { code };
4348
4348
  }
4349
4349
  //#endregion
4350
4350
  //#region src/plugins/vue/compiler/template/classStyleRuntime.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wevu/compiler",
3
3
  "type": "module",
4
- "version": "6.15.5",
4
+ "version": "6.15.6",
5
5
  "description": "wevu 编译器基础包,面向小程序模板的编译与转换",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -51,8 +51,8 @@
51
51
  "vue": "^3.5.32",
52
52
  "@weapp-core/constants": "^0.1.1",
53
53
  "@weapp-core/shared": "3.0.3",
54
- "@weapp-vite/ast": "6.15.5",
55
- "rolldown-require": "2.0.13"
54
+ "rolldown-require": "2.0.13",
55
+ "@weapp-vite/ast": "6.15.6"
56
56
  },
57
57
  "publishConfig": {
58
58
  "access": "public",