@wevu/compiler 7.5.0 → 7.6.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.
@@ -0,0 +1 @@
1
+ import*as t from"@weapp-vite/ast/babelTypes";import vueJsxPlugin from"@vue/babel-plugin-jsx";import{transformSync}from"@weapp-vite/ast/babelCore";const DEFAULT_VUE_JSX_TRANSFORM_OPTIONS={enableObjectSlots:true,mergeProps:true,optimize:true,resolveType:false,transformOn:true};function readDirectiveExpression(attribute){if(!attribute.value)return t.booleanLiteral(true);if(!t.isJSXExpressionContainer(attribute.value)||t.isJSXEmptyExpression(attribute.value.expression))return;return t.isExpression(attribute.value.expression)?attribute.value.expression:void 0}function createWevuJsxDirectiveCompatibilityPlugin(){return{name:`wevu-jsx-directive-compatibility`,visitor:{JSXElement(path){const attributes=path.node.openingElement.attributes;let ifExpression;let textExpression;path.node.openingElement.attributes=attributes.filter(attribute=>{if(!t.isJSXAttribute(attribute))return true;const name=t.isJSXIdentifier(attribute.name)?attribute.name.name:t.isJSXNamespacedName(attribute.name)?attribute.name.namespace.name:void 0;if(name===`v-if`){ifExpression=readDirectiveExpression(attribute);return false}if(name===`v-text`){textExpression=readDirectiveExpression(attribute);return false}if(name?.startsWith(`v-`)&&![`v-html`,`v-model`,`v-models`,`v-show`,`v-slots`].includes(name))return false;return true});if(textExpression)path.node.children=[t.jsxExpressionContainer(textExpression)];if(ifExpression)path.replaceWith(t.conditionalExpression(ifExpression,path.node,t.nullLiteral()))}}}}function transformVueJsxScript(source,filename,sourceMaps=true,options){const result=transformSync(source,{filename,sourceType:`module`,sourceMaps,plugins:[createWevuJsxDirectiveCompatibilityPlugin,[vueJsxPlugin,{...DEFAULT_VUE_JSX_TRANSFORM_OPTIONS,...options}]],parserOpts:{plugins:[`typescript`,`jsx`]},generatorOpts:{retainLines:!sourceMaps}});return{code:result?.code??source,map:result?.map?{...result.map,file:result.map.file??void 0}:null}}export{transformVueJsxScript};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wevu/compiler",
3
3
  "type": "module",
4
- "version": "7.5.0",
4
+ "version": "7.6.0",
5
5
  "description": "wevu 编译器基础包,面向小程序模板的编译与转换",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -60,23 +60,24 @@
60
60
  "node": "^22.18.0 || ^24.11.0 || >=26.0.0"
61
61
  },
62
62
  "dependencies": {
63
+ "@babel/core": "^8.0.7",
63
64
  "@jridgewell/remapping": "^2.3.5",
64
65
  "@jridgewell/trace-mapping": "^0.3.31",
65
66
  "@vue/babel-plugin-jsx": "3.0.0",
66
- "@vue/compiler-core": "^3.5.43",
67
- "@vue/compiler-dom": "^3.5.43",
68
- "@weapp-core/constants": "0.3.1",
69
- "@weapp-core/shared": "3.2.8",
70
- "@weapp-vite/ast": "7.5.0",
67
+ "@vue/compiler-core": "^3.5.44",
68
+ "@vue/compiler-dom": "^3.5.44",
69
+ "@weapp-core/constants": "0.4.0",
70
+ "@weapp-core/shared": "3.3.0",
71
+ "@weapp-vite/ast": "7.6.0",
71
72
  "comment-json": "^5.0.0",
72
73
  "lru-cache": "^11.5.3",
73
74
  "magic-string": "^1.4.3",
74
75
  "merge": "^2.1.1",
75
76
  "pathe": "^2.0.3",
76
- "postcss": "^8.5.29",
77
+ "postcss": "^8.5.30",
77
78
  "postcss-selector-parser": "^7.1.6",
78
- "rolldown-require": "2.0.35",
79
- "vue": "^3.5.43"
79
+ "rolldown-require": "2.0.36",
80
+ "vue": "^3.5.44"
80
81
  },
81
82
  "tsd": {
82
83
  "compilerOptions": {