@dcloudio/uni-cli-shared 3.0.0-alpha-3030820220114003 → 3.0.0-alpha-3030820220114004

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.
package/dist/mp/event.js CHANGED
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatMiniProgramEvent = void 0;
4
+ const uni_shared_1 = require("@dcloudio/uni-shared");
4
5
  function formatMiniProgramEvent(eventName, { isCatch, isCapture, isComponent, }) {
6
+ if (isComponent) {
7
+ // 自定义组件的自定义事件需要格式化,因为 triggerEvent 时也会格式化
8
+ eventName = (0, uni_shared_1.customizeEvent)(eventName);
9
+ }
5
10
  if (!isComponent && eventName === 'click') {
6
11
  eventName = 'tap';
7
12
  }
@@ -130,8 +130,22 @@ function findBindingComponent(tag, bindingComponents) {
130
130
  return tag === componentTag || tag === camelName || tag === PascalName;
131
131
  });
132
132
  }
133
+ function normalizeComponentId(id) {
134
+ // _unref(test) => test
135
+ if (id.includes('_unref(')) {
136
+ return id.replace('_unref(', '').replace(')', '');
137
+ }
138
+ // $setup["test"] => test
139
+ if (id.includes('$setup[')) {
140
+ return id.replace('$setup["', '').replace('"', '');
141
+ }
142
+ return id;
143
+ }
133
144
  function parseBindingComponents(templateBindingComponents, scriptBindingComponents) {
134
- const bindingComponents = { ...templateBindingComponents };
145
+ const bindingComponents = {};
146
+ Object.keys(templateBindingComponents).forEach((id) => {
147
+ bindingComponents[normalizeComponentId(id)] = templateBindingComponents[id];
148
+ });
135
149
  Object.keys(scriptBindingComponents).forEach((id) => {
136
150
  const { tag } = scriptBindingComponents[id];
137
151
  const name = findBindingComponent(tag, templateBindingComponents);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3030820220114003",
3
+ "version": "3.0.0-alpha-3030820220114004",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,8 +21,8 @@
21
21
  "@babel/core": "^7.16.5",
22
22
  "@babel/parser": "^7.16.4",
23
23
  "@babel/types": "^7.16.0",
24
- "@dcloudio/uni-i18n": "3.0.0-alpha-3030820220114003",
25
- "@dcloudio/uni-shared": "3.0.0-alpha-3030820220114003",
24
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3030820220114004",
25
+ "@dcloudio/uni-shared": "3.0.0-alpha-3030820220114004",
26
26
  "@rollup/pluginutils": "^4.1.2",
27
27
  "@vue/compiler-core": "3.2.27",
28
28
  "@vue/compiler-dom": "3.2.27",