@mpxjs/webpack-plugin 2.10.15-3 → 2.10.15-4

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.
@@ -100,15 +100,6 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
100
100
  layoutRef
101
101
  }, propsRef.current));
102
102
  }, []);
103
- // 节流版本的 change 事件触发
104
- const handleTriggerChangeThrottled = useCallback(({ x, y, type }) => {
105
- 'worklet';
106
- const now = Date.now();
107
- if (now - lastChangeTime.value >= changeThrottleTime) {
108
- lastChangeTime.value = now;
109
- runOnJS(runOnJSCallback)('handleTriggerChange', { x, y, type });
110
- }
111
- }, [changeThrottleTime]);
112
103
  useEffect(() => {
113
104
  runOnUI(() => {
114
105
  if (offsetX.value !== x || offsetY.value !== y) {
@@ -302,6 +293,15 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
302
293
  triggerEndOnJS
303
294
  });
304
295
  const runOnJSCallback = useRunOnJSCallback(runOnJSCallbackRef);
296
+ // 节流版本的 change 事件触发
297
+ const handleTriggerChangeThrottled = useCallback(({ x, y, type }) => {
298
+ 'worklet';
299
+ const now = Date.now();
300
+ if (now - lastChangeTime.value >= changeThrottleTime) {
301
+ lastChangeTime.value = now;
302
+ runOnJS(runOnJSCallback)('handleTriggerChange', { x, y, type });
303
+ }
304
+ }, [changeThrottleTime]);
305
305
  const gesture = useMemo(() => {
306
306
  const handleTriggerMove = (e) => {
307
307
  'worklet';
@@ -200,16 +200,6 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
200
200
  )
201
201
  }, [])
202
202
 
203
- // 节流版本的 change 事件触发
204
- const handleTriggerChangeThrottled = useCallback(({ x, y, type }: { x: number; y: number; type?: string }) => {
205
- 'worklet'
206
- const now = Date.now()
207
- if (now - lastChangeTime.value >= changeThrottleTime) {
208
- lastChangeTime.value = now
209
- runOnJS(runOnJSCallback)('handleTriggerChange', { x, y, type })
210
- }
211
- }, [changeThrottleTime])
212
-
213
203
  useEffect(() => {
214
204
  runOnUI(() => {
215
205
  if (offsetX.value !== x || offsetY.value !== y) {
@@ -414,6 +404,16 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
414
404
  })
415
405
  const runOnJSCallback = useRunOnJSCallback(runOnJSCallbackRef)
416
406
 
407
+ // 节流版本的 change 事件触发
408
+ const handleTriggerChangeThrottled = useCallback(({ x, y, type }: { x: number; y: number; type?: string }) => {
409
+ 'worklet'
410
+ const now = Date.now()
411
+ if (now - lastChangeTime.value >= changeThrottleTime) {
412
+ lastChangeTime.value = now
413
+ runOnJS(runOnJSCallback)('handleTriggerChange', { x, y, type })
414
+ }
415
+ }, [changeThrottleTime])
416
+
417
417
  const gesture = useMemo(() => {
418
418
  const handleTriggerMove = (e: GestureTouchEvent) => {
419
419
  'worklet'
@@ -88,7 +88,16 @@ function parseHTML (html, options) {
88
88
  match.end = index
89
89
  handleStartTag(match)
90
90
  }
91
+ continue
92
+ }
93
+
94
+ // If we reach here, the `<` at position 0 does not start a valid tag/comment/end tag
95
+ // Treat it as plain text to avoid infinite loop on stray '<'
96
+ if (options.chars) {
97
+ options.chars('<')
91
98
  }
99
+ advance(1)
100
+ continue
92
101
  }
93
102
  let text, rest, next
94
103
  if (textEnd >= 0) {
@@ -14,7 +14,8 @@ export function processComponentOption (
14
14
  componentGenerics,
15
15
  genericsInfo,
16
16
  wxsMixin,
17
- hasApp
17
+ hasApp,
18
+ disablePageTransition
18
19
  }
19
20
  ) {
20
21
  // 局部注册页面和组件中依赖的组件
@@ -79,7 +80,7 @@ registered in parent context!`)
79
80
  transitionName: ''
80
81
  }
81
82
  }
82
- if (!global.__mpx.config.webConfig.disablePageTransition) {
83
+ if (!disablePageTransition) {
83
84
  option.watch = {
84
85
  $route: {
85
86
  handler () {
@@ -1936,7 +1936,18 @@ function processAttrs (el, options) {
1936
1936
  el.attrsList.forEach((attr) => {
1937
1937
  const isTemplateData = el.tag === 'template' && attr.name === 'data'
1938
1938
  const needWrap = isTemplateData && mode !== 'swan'
1939
- const value = needWrap ? `{${attr.value}}` : attr.value
1939
+ let value = needWrap ? `{${attr.value}}` : attr.value
1940
+
1941
+ // 修复React Native环境下属性值中插值表达式带空格的问题
1942
+ if (isReact(mode) && typeof value === 'string') {
1943
+ // 检查是否为带空格的插值表达式
1944
+ const trimmedValue = value.trim()
1945
+ if (trimmedValue.startsWith('{{') && trimmedValue.endsWith('}}')) {
1946
+ // 如果是纯插值表达式但带有前后空格,则使用去除空格后的值进行解析
1947
+ value = trimmedValue
1948
+ }
1949
+ }
1950
+
1940
1951
  const parsed = parseMustacheWithContext(value)
1941
1952
  if (parsed.hasBinding) {
1942
1953
  // 该属性判断用于提供给运行时对于计算属性作为props传递时提出警告
@@ -27,6 +27,8 @@ module.exports = function (script, {
27
27
  }, callback) {
28
28
  const { projectRoot, appInfo, webConfig, i18n } = loaderContext.getMpx()
29
29
 
30
+ const { disablePageTransition = true } = webConfig
31
+
30
32
  let output = '/* script */\n'
31
33
 
32
34
  let scriptSrcMode = srcMode
@@ -86,7 +88,8 @@ module.exports = function (script, {
86
88
  componentGenerics: ${JSON.stringify(componentGenerics)},
87
89
  genericsInfo: ${JSON.stringify(genericsInfo)},
88
90
  wxsMixin: getWxsMixin(wxsModules),
89
- hasApp: ${hasApp}
91
+ hasApp: ${hasApp},
92
+ disablePageTransition: ${JSON.stringify(disablePageTransition)},
90
93
  })\n`
91
94
  return content
92
95
  }
@@ -35,11 +35,13 @@ module.exports = function (template, {
35
35
  let output = '/* template */\n'
36
36
 
37
37
  if (ctorType === 'app') {
38
- const { el } = webConfig
38
+ const { el, disablePageTransition = true } = webConfig
39
39
  const idName = (el && el.match(/#(.*)/) && el.match(/#(.*)/)[1]) || 'app'
40
40
  template = {
41
41
  tag: 'template',
42
- content: `<div id="${idName}"><transition :name="transitionName"><mpx-keep-alive><router-view></router-view></mpx-keep-alive></transition></div>`
42
+ content: disablePageTransition
43
+ ? `<div id="${idName}"><mpx-keep-alive><router-view></router-view></mpx-keep-alive></div>`
44
+ : `<div id="${idName}"><transition :name="transitionName"><mpx-keep-alive><router-view></router-view></mpx-keep-alive></transition></div>`
43
45
  }
44
46
  builtInComponentsMap['mpx-keep-alive'] = {
45
47
  resource: addQuery('@mpxjs/webpack-plugin/lib/runtime/components/web/mpx-keep-alive.vue', { isComponent: true })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.10.15-3",
3
+ "version": "2.10.15-4",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"