@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.43 → 4.0.0-alpha.45
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/apis/base/weapp/life-cycle.ts +1 -1
- package/dist/apis/device/clipboard.ts +9 -2
- package/dist/apis/framework/index.ts +1 -1
- package/dist/apis/media/image/index.ts +124 -135
- package/dist/apis/route/index.ts +1 -2
- package/dist/apis/ui/background.ts +1 -1
- package/dist/apis/ui/interaction/index.ts +20 -4
- package/dist/apis/ui/navigation-bar/index.ts +1 -1
- package/dist/apis/ui/scroll/index.ts +1 -1
- package/dist/apis/ui/tab-bar.ts +1 -2
- package/dist/components-harmony-ets/button.ets +1 -1
- package/dist/components-harmony-ets/checkbox.ets +1 -2
- package/dist/components-harmony-ets/form.ets +0 -1
- package/dist/components-harmony-ets/index.ets +37 -90
- package/dist/components-harmony-ets/input.ets +11 -7
- package/dist/components-harmony-ets/label.ets +1 -2
- package/dist/components-harmony-ets/listView.ets +3 -2
- package/dist/components-harmony-ets/movableArea.ets +3 -3
- package/dist/components-harmony-ets/navigationBar.ets +1 -1
- package/dist/components-harmony-ets/pageMeta.ets +1 -1
- package/dist/components-harmony-ets/pseudo.ets +1 -1
- package/dist/components-harmony-ets/radio.ets +2 -3
- package/dist/components-harmony-ets/scrollList.ets +7 -2
- package/dist/components-harmony-ets/scrollView.ets +6 -1
- package/dist/components-harmony-ets/slider.ets +1 -1
- package/dist/components-harmony-ets/stickySection.ets +2 -2
- package/dist/components-harmony-ets/style.ets +7 -6
- package/dist/components-harmony-ets/swiper.ets +1 -1
- package/dist/components-harmony-ets/switch.ets +1 -1
- package/dist/components-harmony-ets/text.ets +2 -2
- package/dist/components-harmony-ets/utils/helper.ets +2 -2
- package/dist/components-harmony-ets/utils/styles.ets +5 -6
- package/dist/components-harmony-ets/video.ets +1 -1
- package/dist/components-harmony-ets/view.ets +1 -2
- package/dist/components-harmony-ets/webView.ets +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/URL.ts +2 -0
- package/dist/runtime-ets/bom/document.ts +1 -2
- package/dist/runtime-ets/bom/getComputedStyle.ts +1 -2
- package/dist/runtime-ets/bom/history.ts +1 -0
- package/dist/runtime-ets/bom/location.ts +1 -0
- package/dist/runtime-ets/bom/navigator.ts +1 -21
- package/dist/runtime-ets/bom/raf.ts +1 -37
- package/dist/runtime-ets/bom/window.ts +4 -5
- package/dist/runtime-ets/constant.ts +17 -10
- package/dist/runtime-ets/current.ts +0 -1
- package/dist/runtime-ets/dom/document.ts +1 -1
- package/dist/runtime-ets/dom/element/canvas.ts +3 -2
- package/dist/runtime-ets/dom/element/element.ts +6 -5
- package/dist/runtime-ets/dom/element/form.ts +6 -0
- package/dist/runtime-ets/dom/element/movableView.ts +12 -8
- package/dist/runtime-ets/dom/event-source.ts +1 -0
- package/dist/runtime-ets/dom/eventTarget.ts +1 -1
- package/dist/runtime-ets/dom/node.ts +3 -4
- package/dist/runtime-ets/emitter/emitter.ts +1 -0
- package/dist/runtime-ets/env.ts +1 -0
- package/dist/runtime-ets/index.ts +22 -7
- package/dist/runtime-ets/interface/index.ts +6 -0
- package/dist/runtime-ets/utils/index.ts +4 -6
- package/dist/runtime-ets/utils/router.ts +9 -0
- package/dist/runtime-framework/react/app.ts +1 -2
- package/dist/runtime-framework/react/hooks.ts +1 -1
- package/dist/runtime-framework/react/native-page.ts +44 -15
- package/dist/runtime-framework/react/page.ts +1 -2
- package/dist/runtime-framework/solid/app.ts +1 -2
- package/dist/runtime-framework/solid/hooks.ts +1 -1
- package/dist/runtime-framework/solid/page.ts +1 -2
- package/dist/runtime-framework/solid/reconciler/props.ts +9 -10
- package/dist/runtime-utils.js +160 -173
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +160 -173
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import commonStyleModify from './style'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { TaroAny, TaroViewElement } from '@tarojs/runtime'
|
|
4
4
|
|
|
5
5
|
@Reusable
|
|
6
6
|
@Component
|
|
@@ -22,10 +22,11 @@ export default struct TaroListView {
|
|
|
22
22
|
|
|
23
23
|
build() {
|
|
24
24
|
ListItem() {
|
|
25
|
-
|
|
25
|
+
Column() {
|
|
26
26
|
this.createLazyChildren(this.node, 0)
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
30
|
+
.zIndex(0)
|
|
30
31
|
}
|
|
31
32
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { TaroAny, TaroMovableAreaElement, TaroMovableViewElement } from '@tarojs/runtime'
|
|
2
1
|
import { isTaroMovableViewElement } from '@tarojs/runtime'
|
|
3
2
|
import commonStyleModify, { rowModify, columnModify } from './style'
|
|
4
3
|
|
|
5
4
|
import { FlexManager } from './utils/flexManager'
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
import type { TaroAny, TaroMovableAreaElement } from '@tarojs/runtime'
|
|
7
7
|
|
|
8
8
|
@Component
|
|
9
9
|
export default struct TaroMovableArea {
|
|
@@ -123,4 +123,4 @@ function sizeChangeHandle(node: TaroMovableAreaElement, newValue: Area | SizeOpt
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
})
|
|
126
|
-
}
|
|
126
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getFontAttributes } from './utils/helper'
|
|
2
2
|
import { pseudoModify } from './style'
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type { TaroAny, TaroStyleType, TaroTextStyleType, TaroViewElement } from '@tarojs/runtime'
|
|
5
5
|
|
|
6
6
|
@Extend(Flex)
|
|
7
7
|
function flexAttrs (style: TaroStyleType) {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { eventHandler, getComponentEventCallback,
|
|
1
|
+
import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBLE_CHANGE_EVENT_NAME, createTaroEvent } from '@tarojs/runtime'
|
|
2
2
|
|
|
3
3
|
import commonStyleModify, { rowModify, columnModify } from './style'
|
|
4
4
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
5
5
|
import { FlexManager } from './utils/flexManager'
|
|
6
6
|
import { shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { isUndefined } from '@tarojs/shared'
|
|
8
|
+
import type { HarmonyType, TaroAny, TaroEvent, TaroRadioElement, TaroRadioGroupElement } from '@tarojs/runtime'
|
|
10
9
|
|
|
11
10
|
interface RadioAttrs {
|
|
12
11
|
radioStyle?: HarmonyType.RadioStyle
|
|
@@ -4,7 +4,7 @@ import commonStyleModify from './style'
|
|
|
4
4
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
5
5
|
import { getNodeThresholds, shouldBindEvent } from './utils/helper'
|
|
6
6
|
|
|
7
|
-
import type {
|
|
7
|
+
import type { TaroAny, TaroEvent, TaroScrollViewElement } from '@tarojs/runtime'
|
|
8
8
|
|
|
9
9
|
interface ScrollViewAttrs {
|
|
10
10
|
scrollBar: BarState
|
|
@@ -33,7 +33,12 @@ function getAttributes (node: TaroScrollViewElement): ScrollViewAttrs {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function handleScrollEvent (node: TaroScrollViewElement, eventName = 'scroll', scrollOffset?: number) {
|
|
36
|
+
if (!node || !node.scroller) return
|
|
37
|
+
|
|
36
38
|
const currentOffset = node.scroller.currentOffset() as ScrollViewCurrentOffset
|
|
39
|
+
|
|
40
|
+
if (!currentOffset) return
|
|
41
|
+
|
|
37
42
|
const currentXOffset = currentOffset?.xOffset || 0
|
|
38
43
|
const currentYOffset = currentOffset?.yOffset || 0
|
|
39
44
|
const value: ScrollViewEvent = {
|
|
@@ -62,7 +67,7 @@ export default struct TaroScrollList {
|
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
|
|
65
|
-
handleScroll = (scrollOffset: number) => {
|
|
70
|
+
handleScroll = (scrollOffset: number) => {
|
|
66
71
|
handleScrollEvent(this.node, 'scroll', scrollOffset)
|
|
67
72
|
}
|
|
68
73
|
|
|
@@ -6,7 +6,7 @@ import { FlexManager } from './utils/flexManager'
|
|
|
6
6
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
7
7
|
import { getNodeThresholds, getStyleAttr, shouldBindEvent } from './utils/helper'
|
|
8
8
|
|
|
9
|
-
import type { TaroAny,
|
|
9
|
+
import type { TaroAny, TaroEvent, TaroScrollViewElement } from '@tarojs/runtime'
|
|
10
10
|
|
|
11
11
|
interface ScrollViewAttrs {
|
|
12
12
|
scrollBar: BarState
|
|
@@ -41,7 +41,12 @@ function getScrollable (node: TaroScrollViewElement) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function handleScrollEvent (node: TaroScrollViewElement, eventName = 'scroll', xOffset?: number, yOffset?: number) {
|
|
44
|
+
if (!node || !node.scroller) return
|
|
45
|
+
|
|
44
46
|
const currentOffset = node.scroller.currentOffset() as ScrollViewCurrentOffset
|
|
47
|
+
|
|
48
|
+
if (!currentOffset) return
|
|
49
|
+
|
|
45
50
|
const currentXOffset = currentOffset.xOffset
|
|
46
51
|
const currentYOffset = currentOffset.yOffset
|
|
47
52
|
const value: ScrollViewEvent = {
|
|
@@ -3,7 +3,7 @@ import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBL
|
|
|
3
3
|
import commonStyleModify from './style'
|
|
4
4
|
import { getNodeThresholds, shouldBindEvent } from './utils/helper'
|
|
5
5
|
|
|
6
|
-
import type { TaroAny,
|
|
6
|
+
import type { TaroAny, TaroEvent, TaroSliderElement } from '@tarojs/runtime'
|
|
7
7
|
|
|
8
8
|
interface SliderAttrs {
|
|
9
9
|
selectedColor?: ResourceColor
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import commonStyleModify from './style'
|
|
2
|
+
import TaroListView from './listView'
|
|
2
3
|
|
|
3
4
|
import type { TaroViewElement, TaroElement, TaroAny } from '@tarojs/runtime'
|
|
4
5
|
|
|
@@ -32,10 +33,9 @@ export default struct TaroStickySection {
|
|
|
32
33
|
}) {
|
|
33
34
|
ForEach(this.node.children, (item: TaroElement) => {
|
|
34
35
|
if (item.tagName === 'LIST-VIEW') {
|
|
35
|
-
|
|
36
|
+
TaroListView({ node: item as TaroAny, createLazyChildren: this.createLazyChildren }).reuseId(item._nid.toString())
|
|
36
37
|
}
|
|
37
38
|
}, (item: TaroElement) => `${item._nid}-${item._nodeInfo?.layer || 0}`)
|
|
38
|
-
|
|
39
39
|
}
|
|
40
40
|
.attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
|
|
41
41
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { TaroAny, HarmonyStyle, TaroElement, TaroStyleType, TaroTextElement } from '@tarojs/runtime'
|
|
2
1
|
import { ObjectAssign } from '@tarojs/runtime'
|
|
3
2
|
import { isUndefined } from '@tarojs/shared'
|
|
4
3
|
import { computeBackgroundPosition, convertVp2Px } from './utils'
|
|
@@ -6,6 +5,8 @@ import { getNormalAttributes } from './utils/helper'
|
|
|
6
5
|
import { isMaxWidthView } from './utils/styles'
|
|
7
6
|
import { FlexManager } from './utils/flexManager'
|
|
8
7
|
|
|
8
|
+
import type { HarmonyStyle, TaroAny, TaroElement, TaroStyleType, TaroTextElement } from '@tarojs/runtime'
|
|
9
|
+
|
|
9
10
|
class TextStyleModify implements AttributeModifier<TextAttribute> {
|
|
10
11
|
initStyle?: TaroStyleType
|
|
11
12
|
node: TaroTextElement | null = null
|
|
@@ -81,7 +82,7 @@ class CommonStyleModify implements AttributeModifier<CommonAttribute> {
|
|
|
81
82
|
}
|
|
82
83
|
return this
|
|
83
84
|
}
|
|
84
|
-
|
|
85
|
+
|
|
85
86
|
setAnimationStyle (overwriteStyle: Record<string, TaroAny>) {
|
|
86
87
|
this.overwriteStyle = overwriteStyle
|
|
87
88
|
if (this.style && this.overwriteStyle && Object.keys(this.overwriteStyle).length) {
|
|
@@ -248,9 +249,9 @@ export function setNormalAttributeIntoInstance(instance: CommonAttribute, style:
|
|
|
248
249
|
instance.key(style.id)
|
|
249
250
|
}
|
|
250
251
|
if (!isUndefined(style.display) || !isUndefined(style.visibility)) {
|
|
251
|
-
instance.visibility(style.display === 'none'
|
|
252
|
-
? Visibility.None :
|
|
253
|
-
!isUndefined(style.visibility)
|
|
252
|
+
instance.visibility(style.display === 'none'
|
|
253
|
+
? Visibility.None :
|
|
254
|
+
!isUndefined(style.visibility)
|
|
254
255
|
? (style.visibility === 'hidden' ? Visibility.Hidden : Visibility.Visible)
|
|
255
256
|
: Visibility.Visible
|
|
256
257
|
)
|
|
@@ -407,4 +408,4 @@ export const rowModify = new RowStyleModify()
|
|
|
407
408
|
export const columnModify = new ColumnStyleModify()
|
|
408
409
|
export const textModify = new TextStyleModify()
|
|
409
410
|
|
|
410
|
-
export default new CommonStyleModify()
|
|
411
|
+
export default new CommonStyleModify()
|
|
@@ -3,7 +3,7 @@ import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBL
|
|
|
3
3
|
import commonStyleModify from './style'
|
|
4
4
|
import { getNodeThresholds, shouldBindEvent } from './utils/helper'
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { TaroAny, TaroEvent, TaroSwiperElement } from '@tarojs/runtime'
|
|
7
7
|
|
|
8
8
|
interface SwiperAttrs {
|
|
9
9
|
index?: number
|
|
@@ -3,7 +3,7 @@ import { eventHandler, getComponentEventCallback, AREA_CHANGE_EVENT_NAME, VISIBL
|
|
|
3
3
|
import commonStyleModify from './style'
|
|
4
4
|
import { getNodeThresholds, shouldBindEvent } from './utils/helper'
|
|
5
5
|
|
|
6
|
-
import type { TaroAny,
|
|
6
|
+
import type { TaroAny, TaroEvent, TaroSwitchElement } from '@tarojs/runtime'
|
|
7
7
|
|
|
8
8
|
interface SwitchAttrs {
|
|
9
9
|
selectedColor?: ResourceColor
|
|
@@ -7,7 +7,7 @@ import { getImageMode } from './image'
|
|
|
7
7
|
import { BUTTON_THEME_COLOR } from './utils/constant/style'
|
|
8
8
|
import { getNodeThresholds, getStyleAttr, shouldBindEvent, getNormalAttributes } from './utils/helper'
|
|
9
9
|
|
|
10
|
-
import type {
|
|
10
|
+
import type { HarmonyStyle, TaroAny, TaroButtonElement, TaroElement, TaroTextElement } from '@tarojs/runtime'
|
|
11
11
|
|
|
12
12
|
function getButtonFontSize (node: TaroButtonElement): string | number {
|
|
13
13
|
const isMini = node._attrs.size === 'mini'
|
|
@@ -125,4 +125,4 @@ class SpanStyleModify implements AttributeModifier<SpanAttribute> {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
const spanModify = new SpanStyleModify()
|
|
128
|
+
const spanModify = new SpanStyleModify()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { VIEW } from '@tarojs/runtime
|
|
1
|
+
import { VIEW } from '@tarojs/runtime'
|
|
2
2
|
|
|
3
3
|
import { getNormalAttributes, getFontAttributes, getStyleAttr } from './styles'
|
|
4
4
|
|
|
5
|
-
import type { TaroElement, TaroNode
|
|
5
|
+
import type { TaroAny, TaroElement, TaroNode } from '@tarojs/runtime'
|
|
6
6
|
|
|
7
7
|
export const parseStyles = (styles = ''): Record<string, string> => {
|
|
8
8
|
const styleObj: Record<string, string> = {}
|
|
@@ -4,7 +4,7 @@ import { ObjectAssign } from '@tarojs/runtime'
|
|
|
4
4
|
import { FlexManager } from './flexManager'
|
|
5
5
|
|
|
6
6
|
import type { StandardProps, TextProps } from '@tarojs/components/types'
|
|
7
|
-
import type { TaroAny, TaroElement,
|
|
7
|
+
import type { TaroAny, TaroElement, TaroTextStyleType, HarmonyStyle } from '@tarojs/runtime'
|
|
8
8
|
|
|
9
9
|
export function getFontAttributes (node: TaroElement): TaroTextStyleType {
|
|
10
10
|
let hmStyle = getNormalAttributes(node)
|
|
@@ -20,7 +20,7 @@ export function getFontAttributes (node: TaroElement): TaroTextStyleType {
|
|
|
20
20
|
let WebkitLineClamp = attrs.maxLines || hmStyle.WebkitLineClamp || Infinity
|
|
21
21
|
if (hmStyle.textOverflow && !isUndefined(hmStyle.textOverflow.overflow)) {
|
|
22
22
|
switch (hmStyle.textOverflow.overflow) {
|
|
23
|
-
case TextOverflow.Clip:
|
|
23
|
+
case TextOverflow.Clip:
|
|
24
24
|
case TextOverflow.Ellipsis:
|
|
25
25
|
case TextOverflow.None: WebkitLineClamp = WebkitLineClamp || 1; break
|
|
26
26
|
default: break
|
|
@@ -90,9 +90,8 @@ export function isMaxWidthView (node: TaroElement) {
|
|
|
90
90
|
|
|
91
91
|
export function getNormalAttributes (node: TaroElement, initStyle?: HarmonyStyle): HarmonyStyle {
|
|
92
92
|
if (!node) return {}
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
const hmStyle = node.hmStyle
|
|
95
|
-
|
|
96
95
|
if (!hmStyle) return {}
|
|
97
96
|
|
|
98
97
|
const _nid = node._nid
|
|
@@ -182,7 +181,7 @@ function getPseudoClass (node: TaroElement): HarmonyStyle | null {
|
|
|
182
181
|
function parseNthChild(selector: string): [number, number] | null {
|
|
183
182
|
const regex = /nth-child\((?:(-?\d*)n\s*)?([+-]?\s*\d+)?\)/;
|
|
184
183
|
const match = selector.match(regex);
|
|
185
|
-
|
|
184
|
+
|
|
186
185
|
if (match) {
|
|
187
186
|
const a = match[1] ? parseInt(match[1]) : 0;
|
|
188
187
|
const b = match[2] ? parseInt(match[2]) : 0;
|
|
@@ -202,4 +201,4 @@ export function getStyleAttr(node: TaroElement | null, key: string): TaroAny {
|
|
|
202
201
|
return isMaxWidthView(node) && isUndefined(hmStyle.width) ? '100%' : hmStyle.width
|
|
203
202
|
}
|
|
204
203
|
return hmStyle[key]
|
|
205
|
-
}
|
|
204
|
+
}
|
|
@@ -4,7 +4,7 @@ import commonStyleModify from './style'
|
|
|
4
4
|
import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
5
5
|
import { shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
6
6
|
|
|
7
|
-
import type { TaroAny,
|
|
7
|
+
import type { TaroAny, TaroEvent, TaroVideoElement } from '@tarojs/runtime'
|
|
8
8
|
|
|
9
9
|
export interface VideoOptions {
|
|
10
10
|
src?: string | Resource
|
|
@@ -6,8 +6,7 @@ import { TOUCH_EVENT_MAP } from './utils/constant/event'
|
|
|
6
6
|
import { FlexManager } from './utils/flexManager'
|
|
7
7
|
import { getNodeThresholds, shouldBindEvent } from './utils/helper'
|
|
8
8
|
|
|
9
|
-
import type {
|
|
10
|
-
import { isUndefined } from '@tarojs/shared'
|
|
9
|
+
import type { TaroAny, TaroViewElement } from '@tarojs/runtime'
|
|
11
10
|
|
|
12
11
|
@Component
|
|
13
12
|
export default struct TaroView {
|
|
@@ -3,7 +3,7 @@ import { AREA_CHANGE_EVENT_NAME, eventHandler, getComponentEventCallback, VISIBL
|
|
|
3
3
|
import commonStyleModify from './style'
|
|
4
4
|
import { shouldBindEvent, getNodeThresholds } from './utils/helper'
|
|
5
5
|
|
|
6
|
-
import type { TaroAny,
|
|
6
|
+
import type { TaroAny, TaroEvent, TaroWebViewElement } from '@tarojs/runtime'
|
|
7
7
|
|
|
8
8
|
interface IPageLoad {
|
|
9
9
|
url: string
|
package/dist/index.d.ts
CHANGED
|
@@ -51,14 +51,14 @@ declare class Harmony extends TaroPlatformHarmony {
|
|
|
51
51
|
taroComponentsPath: string;
|
|
52
52
|
apiEntryList: RegExp[];
|
|
53
53
|
constructor(ctx: IPluginContext, config: TConfig);
|
|
54
|
-
get framework(): "solid" | "vue3" | "react" | "preact"
|
|
54
|
+
get framework(): "solid" | "vue3" | "react" | "preact";
|
|
55
55
|
get aliasFramework(): string;
|
|
56
56
|
get apiLibrary(): string;
|
|
57
57
|
get apiEntry(): RegExp[];
|
|
58
58
|
get componentLibrary(): string;
|
|
59
59
|
get runtimeLibrary(): string;
|
|
60
60
|
get runtimeFrameworkLibrary(): string;
|
|
61
|
-
get defineConstants(): Record<string, string
|
|
61
|
+
get defineConstants(): Record<string, string>;
|
|
62
62
|
extensions: string[];
|
|
63
63
|
excludeLibraries: (string | RegExp)[];
|
|
64
64
|
externalDeps: [
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var path = require('node:path');
|
|
6
5
|
var helper = require('@tarojs/helper');
|
|
6
|
+
var path = require('node:path');
|
|
7
7
|
var service = require('@tarojs/service');
|
|
8
8
|
var _package = require('@tarojs/service/dist/utils/package');
|
|
9
9
|
var shared = require('@tarojs/shared');
|
|
@@ -364,6 +364,7 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
|
|
|
364
364
|
env.forEach(([key, value]) => {
|
|
365
365
|
__classPrivateFieldGet(this, _Harmony_defineConstants, "f")[`process.env.${key}`] = JSON.stringify(value);
|
|
366
366
|
});
|
|
367
|
+
return __classPrivateFieldGet(this, _Harmony_defineConstants, "f");
|
|
367
368
|
}
|
|
368
369
|
indexOfLibraries(lib) {
|
|
369
370
|
return this.externalDeps.findIndex(([_, rgx]) => rgx.test(lib));
|
|
@@ -486,6 +487,8 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
|
|
|
486
487
|
code = apiLoader(code);
|
|
487
488
|
}
|
|
488
489
|
if (this.extensions.includes(path__namespace.extname(lib))) {
|
|
490
|
+
// Note: 移除 onpm 不能装载的类型,新版本会导致 ets-loader 抛出 resolvedFileName 异常
|
|
491
|
+
code = code.replace(/\/{3}\s*<reference\s+types=['"]([^'"\s]+)['"]\s*\/>\n*/g, '');
|
|
489
492
|
// Note: 查询 externals 内的依赖,并将它们添加到 externalDeps 中
|
|
490
493
|
code = code.replace(/(?:import\s|from\s|require\()['"]([^\\/.][^'"\s]+)['"]\)?/g, (src, p1 = '') => {
|
|
491
494
|
if (p1.startsWith('node:') || p1.endsWith('.so'))
|