Skip to content

Commit 14f8511

Browse files
authored
Merge pull request #302 from raxjs/feat/bytedace-support
Feat/bytedace support
2 parents 41848db + 0528a02 commit 14f8511

File tree

7 files changed

+20
-4
lines changed

7 files changed

+20
-4
lines changed

packages/jsx-compiler/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Changelog
2+
## [0.4.37]
3+
4+
- Fix(bytedance-microapp): componentTag don't support the name start with '_'. Remove the `_` in bytedance.
5+
26

37
## [0.4.36]
48

packages/jsx-compiler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsx-compiler",
3-
"version": "0.4.36",
3+
"version": "0.4.37",
44
"license": "BSD-3-Clause",
55
"description": "Parser for Rax JSX Statements.",
66
"files": [

packages/jsx-compiler/src/adapter.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ const parserAdapters = {
112112
// Handle rax-slider and rax-swiper
113113
insertSwiperSlot: true,
114114
needRegisterProps: true,
115+
// ComponentTag don't support that start with '_'.
116+
compTagHeadNoUnderline: true
115117
},
116118
componentCommonProps
117119
};

packages/jsx-compiler/src/modules/components.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,14 @@ function transformIdentifierComponentName(path, alias, dynamicValue, parsed, opt
3131
renderFunctionPath,
3232
componentDependentProps,
3333
} = parsed;
34+
3435
// Miniapp template tag name does not support special characters.
35-
const aliasName = alias.name.replace(/@|\//g, '_');
36+
let aliasName = alias.name.replace(/@|\//g, '_');
37+
// ByteDance MicroApp's componentTag don't support the name start with '_'.
38+
if (aliasName.indexOf('_') === 0 && options.adapter.compTagHeadNoUnderline) {
39+
aliasName = aliasName.replace('_', '');
40+
}
41+
3642
const componentTag = alias.default ? aliasName : `${aliasName}-${alias.local.toLowerCase()}`;
3743
replaceComponentTagName(path, t.jsxIdentifier(componentTag));
3844
node.isCustomEl = alias.isCustomEl;

packages/miniapp-compile-config/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [0.3.3] - 2022-09-15
4+
5+
- Fix: native routes in `pages/` build error: `needCopyList[i].to error in setEntry()`
6+
37
## [0.3.2] - 2022-01-06
48

59
- Fix: generate duplicate package.json in dev mode

packages/miniapp-compile-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "miniapp-compile-config",
3-
"version": "0.3.2",
3+
"version": "0.3.3",
44
"description": "miniapp compile project config",
55
"author": "Rax Team",
66
"homepage": "https://github.com/raxjs/miniapp#readme",

packages/miniapp-compile-config/src/setEntry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function setEntry(config, routes, options) {
4646
nativeRoutes.forEach(({ source }) => {
4747
needCopyList.push({
4848
from: dirname(join('src', source)),
49-
to: dirname(join('src', source)),
49+
to: dirname(source),
5050
});
5151
});
5252
configEntry(config, normalRoutes, options);

0 commit comments

Comments
 (0)