@vitarx/plugin-vite 1.0.2-alpha.0 → 1.0.3

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.
@@ -111,6 +111,16 @@ function processChildExpression(expr, ctx) {
111
111
  if (isLogicalExpression(expr) || isBinaryExpression(expr) || expr.type === 'CallExpression') {
112
112
  return wrapWithExpr(expr, ctx);
113
113
  }
114
+ // 包含插值表达式的模板字面量是动态的,需要用 expr 包装以启用响应式追踪
115
+ // 纯静态模板字符串转为 StringLiteral 直接返回
116
+ if (t.isTemplateLiteral(expr)) {
117
+ if (expr.expressions.length > 0) {
118
+ return wrapWithExpr(expr, ctx);
119
+ }
120
+ // 无插值的模板字面量等价于静态字符串
121
+ const raw = expr.quasis.map(q => q.value.cooked).join('');
122
+ return t.stringLiteral(raw);
123
+ }
114
124
  // 其他类型的表达式直接返回,无需特殊处理
115
125
  return expr;
116
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitarx/plugin-vite",
3
- "version": "1.0.2-alpha.0",
3
+ "version": "1.0.3",
4
4
  "description": "The official plugin for Vitarx support in Vite.",
5
5
  "author": "ZhuChongLin <8210856@qq.com>",
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "https://gitee.com/vitarx/plugin-vite.git"
13
+ "url": "git+https://github.com/vitarx-lib/plugin-vite.git"
14
14
  },
15
15
  "type": "module",
16
16
  "module": "dist/index.js",