@mpxjs/webpack-plugin 2.9.71 → 2.9.73

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/lib/config.js CHANGED
@@ -138,7 +138,9 @@ module.exports = {
138
138
  }
139
139
  },
140
140
  getEvent (eventName, prefix = 'on') {
141
- return dash2hump(prefix + '-' + eventName)
141
+ return prefix + dash2hump(eventName.replace(/^./, (matched) => {
142
+ return matched.toUpperCase()
143
+ }))
142
144
  },
143
145
  defaultModelProp: 'value',
144
146
  defaultModelEvent: 'input',
@@ -302,7 +302,9 @@ module.exports = function getSpec ({ warn, error }) {
302
302
  const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'ali' })
303
303
  const rEventName = runRules(eventRules, eventName, { mode: 'ali' })
304
304
  return {
305
- name: dash2hump(rPrefix + '-' + rEventName) + modifierStr,
305
+ name: rPrefix + dash2hump(rEventName.replace(/^./, (matched) => {
306
+ return matched.toUpperCase()
307
+ })) + modifierStr,
306
308
  value
307
309
  }
308
310
  },
@@ -9,6 +9,7 @@ module.exports = function (script, {
9
9
  moduleId,
10
10
  isProduction,
11
11
  jsonConfig,
12
+ outputPath,
12
13
  builtInComponentsMap,
13
14
  localComponentsMap,
14
15
  localPagesMap
@@ -64,7 +65,7 @@ global.__navigationHelper = {
64
65
  jsonConfig
65
66
  })
66
67
 
67
- output += buildGlobalParams({ moduleId, scriptSrcMode, loaderContext, isProduction, ctorType, jsonConfig, componentsMap })
68
+ output += buildGlobalParams({ moduleId, scriptSrcMode, loaderContext, isProduction, ctorType, jsonConfig, componentsMap, outputPath })
68
69
  output += getRequireScript({ ctorType, script, loaderContext })
69
70
  output += `export default global.__mpxOptionsMap[${JSON.stringify(moduleId)}]\n`
70
71
  }
@@ -88,7 +88,8 @@ function buildGlobalParams ({
88
88
  jsonConfig,
89
89
  componentsMap,
90
90
  pagesMap,
91
- firstPage
91
+ firstPage,
92
+ outputPath
92
93
  }) {
93
94
  let content = ''
94
95
  if (ctorType === 'app') {
@@ -117,6 +118,9 @@ global.currentInject.firstPage = ${JSON.stringify(firstPage)}\n`
117
118
  content += `global.currentInject.getComponents = function () {
118
119
  return ${shallowStringify(componentsMap)}
119
120
  }\n`
121
+ if (ctorType === 'component') {
122
+ content += `global.currentInject.componentPath = '/' + ${JSON.stringify(outputPath)}\n`
123
+ }
120
124
  }
121
125
  content += `global.currentModuleId = ${JSON.stringify(moduleId)}\n`
122
126
  content += `global.currentSrcMode = ${JSON.stringify(scriptSrcMode)}\n`
@@ -720,7 +720,14 @@ function parse (template, options) {
720
720
  currentParent.children.push(element)
721
721
  element.parent = currentParent
722
722
  processElement(element, root, options, meta)
723
+
723
724
  tagNames.add(element.tag)
725
+ // 统计通过抽象节点方式使用的组件
726
+ element.attrsList.forEach((attr) => {
727
+ if (genericRE.test(attr.name)) {
728
+ tagNames.add(attr.value)
729
+ }
730
+ })
724
731
 
725
732
  if (!unary) {
726
733
  currentParent = element
@@ -808,7 +815,7 @@ function parse (template, options) {
808
815
  Array.isArray(val.errorArray) && val.errorArray.forEach(item => error$1(item))
809
816
  })
810
817
 
811
- if (!tagNames.has('component') && options.checkUsingComponents) {
818
+ if (!tagNames.has('component') && !tagNames.has('template') && options.checkUsingComponents) {
812
819
  const arr = []
813
820
  usingComponents.forEach((item) => {
814
821
  if (!tagNames.has(item) && !options.globalComponents.includes(item) && !options.componentPlaceholder.includes(item)) {
@@ -2464,7 +2471,7 @@ function processShow (el, options, root) {
2464
2471
  error$1(`Attrs ${config[mode].directive.show} should have a value `)
2465
2472
  return
2466
2473
  }
2467
- if (ctorType === 'component' && el.parent === root && isRealNode(el)) {
2474
+ if (ctorType === 'component' && el.parent === root && isRealNode(el) && hasVirtualHost) {
2468
2475
  show = has ? `{{${parseMustacheWithContext(show).result}&&mpxShow}}` : '{{mpxShow}}'
2469
2476
  }
2470
2477
  if (show === undefined) return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.9.71",
3
+ "version": "2.9.73",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"
@@ -28,7 +28,7 @@
28
28
  "@better-scroll/wheel": "^2.5.1",
29
29
  "@better-scroll/zoom": "^2.5.1",
30
30
  "@mpxjs/template-engine": "^2.8.7",
31
- "@mpxjs/utils": "^2.9.70",
31
+ "@mpxjs/utils": "^2.9.73",
32
32
  "acorn": "^8.11.3",
33
33
  "acorn-walk": "^7.2.0",
34
34
  "async": "^2.6.0",
@@ -83,7 +83,7 @@
83
83
  "devDependencies": {
84
84
  "@ant-design/react-native": "^5.2.2",
85
85
  "@d11/react-native-fast-image": "^8.6.12",
86
- "@mpxjs/api-proxy": "^2.9.71",
86
+ "@mpxjs/api-proxy": "^2.9.73",
87
87
  "@types/babel-traverse": "^6.25.4",
88
88
  "@types/babel-types": "^7.0.4",
89
89
  "@types/react": "^18.2.79",
@@ -99,5 +99,5 @@
99
99
  "engines": {
100
100
  "node": ">=14.14.0"
101
101
  },
102
- "gitHead": "38446f301a17e78dbe3ca7dacd771c79eb7a8ede"
102
+ "gitHead": "296482bcb03ab01081a96dcb41ce37df393c3281"
103
103
  }