@vitarx/plugin-vite 1.0.0-beta.1 → 1.0.0-beta.2

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 (34) hide show
  1. package/dist/constants/index.d.ts +1 -0
  2. package/dist/constants/index.js +1 -0
  3. package/dist/hmr-client/update.js +21 -4
  4. package/dist/hmr-client/utils.js +11 -3
  5. package/dist/index.js +9 -10
  6. package/dist/passes/components/ifBlock.d.ts +3 -0
  7. package/dist/passes/components/ifBlock.js +24 -8
  8. package/dist/passes/components/switch.js +49 -21
  9. package/dist/passes/directives/processDirectives.d.ts +3 -1
  10. package/dist/passes/directives/processDirectives.js +36 -9
  11. package/dist/passes/directives/vIf.d.ts +7 -2
  12. package/dist/passes/directives/vIf.js +43 -30
  13. package/dist/passes/hmr/inject-state.js +64 -7
  14. package/dist/passes/hmr/inject.js +4 -3
  15. package/dist/passes/imports/collectImports.d.ts +1 -4
  16. package/dist/passes/imports/collectImports.js +4 -5
  17. package/dist/passes/imports/collectRefVariables.js +22 -3
  18. package/dist/passes/jsx/processChildren.js +30 -1
  19. package/dist/passes/jsx/processJSXElement.js +27 -25
  20. package/dist/passes/jsx/processJSXFragment.d.ts +1 -1
  21. package/dist/passes/jsx/processJSXFragment.js +3 -2
  22. package/dist/passes/props/attribute.d.ts +3 -1
  23. package/dist/passes/props/attribute.js +27 -5
  24. package/dist/transform.js +1 -1
  25. package/dist/utils/ast-builders.js +2 -11
  26. package/dist/utils/branch-factory.js +1 -1
  27. package/dist/utils/collect-names.js +29 -0
  28. package/dist/utils/index.d.ts +1 -1
  29. package/dist/utils/index.js +1 -1
  30. package/dist/utils/jsx-helpers.d.ts +6 -0
  31. package/dist/utils/jsx-helpers.js +28 -3
  32. package/dist/utils/vif-helpers.d.ts +1 -3
  33. package/dist/utils/vif-helpers.js +2 -2
  34. package/package.json +1 -1
@@ -8,11 +8,9 @@ import * as t from '@babel/types';
8
8
  * v-if 链信息
9
9
  */
10
10
  export interface VIfChainInfo {
11
- /** 链中的元素节点 */
12
11
  nodes: t.JSXElement[];
13
- /** 条件表达式数组 */
14
12
  conditions: t.Expression[];
15
- /** 结束索引 */
13
+ startIndex: number;
16
14
  endIndex: number;
17
15
  }
18
16
  /**
@@ -55,7 +55,7 @@ export function collectVIfChainInfo(nodes) {
55
55
  }
56
56
  throw createError('E008', node, 'Element missing v-if/v-else-if/v-else directive');
57
57
  }
58
- return { nodes, conditions, endIndex: nodes.length - 1 };
58
+ return { nodes, conditions, startIndex: 0, endIndex: nodes.length - 1 };
59
59
  }
60
60
  /**
61
61
  * 收集 Fragment 中的 v-if 链
@@ -123,5 +123,5 @@ function collectSingleChainFromFragment(children, startIndex) {
123
123
  break;
124
124
  }
125
125
  }
126
- return { nodes, conditions, endIndex: j - 1 };
126
+ return { nodes, conditions, startIndex, endIndex: j - 1 };
127
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitarx/plugin-vite",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "The official plugin for Vitarx support in Vite.",
5
5
  "author": "ZhuChongLin <8210856@qq.com>",
6
6
  "license": "MIT",