Skip to content

Commit

Permalink
Merge branch 'NervJS:main' into fix/tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
anyesu authored Jul 5, 2024
2 parents b1272f7 + 473d5ef commit e3c0441
Show file tree
Hide file tree
Showing 1,164 changed files with 50,570 additions and 9,141 deletions.
8 changes: 5 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ module.exports = {
'import',
'jest',
'react',
'simple-import-sort',
'prettier'
'simple-import-sort'
],
extends: [
'eslint:recommended',
'standard',
'plugin:@typescript-eslint/recommended',
'plugin:react/jsx-runtime',
'plugin:react/recommended',
'prettier'
],
rules: {
'@typescript-eslint/ban-ts-comment': 0,
Expand All @@ -31,6 +29,10 @@ module.exports = {
'@typescript-eslint/no-use-before-define': [1, { functions: false, classes: false }],
'@typescript-eslint/no-var-requires': 0,
camelcase: 0,
'eol-last': 0,
'comma-dangle': 0,
'no-mixed-operators': 0,
'no-multiple-empty-lines': 0,
'import/first': 2,
'import/newline-after-import': 2,
'import/no-duplicates': 2,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-rust-binding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
uses: pnpm/action-setup@v3.0.0
with:
version: 7
- name: Setup Node.js ${{ matrix.node-version }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
uses: pnpm/action-setup@v3.0.0
with:
version: 7
- name: Setup Node.js ${{ matrix.node-version }}
Expand Down Expand Up @@ -102,39 +102,39 @@ jobs:

# 以下 coverage 流程通过 artifact 拆分文件作为单独 job 上传时间损耗过长,因此在在 node test 后直接继续执行
- name: Upload [taro-cli] coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
with:
move_coverage_to_trash: true
flags: taro-cli
files: ./packages/taro-cli/coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload runner coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
with:
move_coverage_to_trash: true
flags: taro-runner
files: ./packages/taro-webpack5-runner/coverage/clover.xml,./packages/taro-webpack-runner/coverage/clover.xml,./packages/taro-mini-runner/coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload [taro-runtime] coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
with:
move_coverage_to_trash: true
flags: taro-runtime
files: ./packages/taro-runtime/coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload [taro-web] coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
with:
move_coverage_to_trash: true
flags: taro-web
files: ./packages/taro-components/coverage/clover.xml,./packages/taro-h5/coverage/clover.xml,./packages/taro-router/coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload rest coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2.4.0
uses: pnpm/action-setup@v3.0.0
with:
version: 7
- name: Setup Node 16
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-components-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
${{ runner.os }}-
- name: install
uses: pnpm/action-setup@v2.4.0
uses: pnpm/action-setup@v3.0.0
with:
version: 7
run_install: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ common/autoinstallers/*/.npmrc

target/
debug/
!packages/taro-platform-harmony-hybrid/src/api/apis/base/debug

# Binding artifacts
artifacts
Expand All @@ -84,4 +85,4 @@ artifacts
*.node

# harmony-hybrid extend-h5-apis file
packages/taro-platform-harmony-hybrid/src/api/apis/extend-h5-apis.ts
packages/taro-platform-harmony-hybrid/src/api/apis/extend-h5-apis.ts
12 changes: 0 additions & 12 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
}
],
"search.exclude": {
"**/.git": true,
"**/node_modules": true,
Expand Down
2 changes: 1 addition & 1 deletion crates/native_binding/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/binding",
"version": "3.6.25",
"version": "3.6.32-alpha.2",
"description": "Node binding for taro",
"main": "binding.js",
"typings": "binding.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_plugin_compile_mode/src/tests/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test!(
<View class={myClass}>
<View style={myStyle} customProp={myCustomProp}></View>
<View hoverStayTime={myTime}>
<View hoverClass={myHoverClass}></View>
<View hoverClass={myHoverClass} id={myId}></View>
</View>
</View>
</View>
Expand Down
4 changes: 3 additions & 1 deletion crates/swc_plugin_compile_mode/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ impl TransformVisitor {
}

// 小程序组件标准属性 -> 取 @tarojs/shared 传递过来的属性值;非标准属性 -> 取属性名
let value: &str = attrs_map.get(&miniapp_attr_name).unwrap_or(&jsx_attr_name);
let value: &str = attrs_map.get(&miniapp_attr_name)
.map(|res| res.as_str())
.unwrap_or(if miniapp_attr_name == "id" { "uid" } else { &jsx_attr_name });
// 按当前节点在节点树中的位置换算路径
node_path.push('.');
let value = if value.contains(TMPL_DATA_ROOT) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const TARO_TEMPLATES_f0t0 = '<template name="tmpl_0_f0t0"><view><view bindtap="eh" data-sid="{{i.cn[0].sid}}" id="{{i.cn[0].sid}}"></view><view bindanimationstart="eh" data-sid="{{i.cn[1].sid}}" id="{{i.cn[1].id}}"></view><image bindload="eh" data-sid="{{i.cn[2].sid}}" id="myImg"></image></view></template>';
const TARO_TEMPLATES_f0t0 = '<template name="tmpl_0_f0t0"><view><view bindtap="eh" data-sid="{{i.cn[0].sid}}" id="{{i.cn[0].sid}}"></view><view bindanimationstart="eh" data-sid="{{i.cn[1].sid}}" id="{{i.cn[1].uid}}"></view><image bindload="eh" data-sid="{{i.cn[2].sid}}" id="myImg"></image></view></template>';
function Index() {
return <View compileMode="f0t0">
<View onClick={handleViewClick}></View>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const TARO_TEMPLATES_f0t0 = '<template name="tmpl_0_f0t0"><view><view class="{{i.cn[0].cl}}"><view custom-prop="{{i.cn[0].cn[0].customProp}}" style="{{i.cn[0].cn[0].st}}"></view><view hover-stay-time="{{xs.b(i.cn[0].cn[1].p3,400)}}"><view hover-class="{{xs.b(i.cn[0].cn[1].cn[0].p1,\'none\')}}"></view></view></view></view></template>';
const TARO_TEMPLATES_f0t0 = '<template name="tmpl_0_f0t0"><view><view class="{{i.cn[0].cl}}"><view custom-prop="{{i.cn[0].cn[0].customProp}}" style="{{i.cn[0].cn[0].st}}"></view><view hover-stay-time="{{xs.b(i.cn[0].cn[1].p3,400)}}"><view hover-class="{{xs.b(i.cn[0].cn[1].cn[0].p1,\'none\')}}" id="{{i.cn[0].cn[1].cn[0].uid}}"></view></view></view></view></template>';
function Index() {
return <View compileMode="f0t0">
<View class={myClass}>
<View style={myStyle} customProp={myCustomProp}></View>
<View hoverStayTime={myTime}>
<View hoverClass={myHoverClass}></View>
<View hoverClass={myHoverClass} id={myId}></View>
</View>
</View>
</View>;
Expand Down
2 changes: 1 addition & 1 deletion examples/blended-taro-component-vue3/h5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"style-loader": "1.3.0",
"stylelint": "^14.4.0",
"typescript": "^4.1.0",
"vue-loader": "^17.0.0",
"vue-loader": "^17.1.0",
"webpack": "5.78.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"ts-node": "^10.9.1",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "^5.1.0",
"vue-loader": "^17.0.0",
"vue-loader": "^17.1.0",
"webpack": "5.78.0"
}
}
12 changes: 12 additions & 0 deletions examples/mini-program-example/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
13 changes: 13 additions & 0 deletions examples/mini-program-example/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": ["taro/react"],
"rules": {
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/no-unused-expressions": "off",
"import/first": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-shadow": "off",
"react/forbid-elements": "off"
}
}
7 changes: 7 additions & 0 deletions examples/mini-program-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist/
deploy_versions/
.temp/
.rn_temp/
node_modules/
.DS_Store
.swc
14 changes: 14 additions & 0 deletions examples/mini-program-example/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"printWidth": 120,
"singleQuote": true,
"useTabs": false,
"tabWidth": 2,
"semi": false,
"quoteProps": "as-needed",
"trailingComma": "es5",
"bracketSpacing": true,
"jsxSingleQuote": true,
"jsxBracketSameLine": false,
"arrowParens": "always",
"endOfLine": "auto"
}
10 changes: 10 additions & 0 deletions examples/mini-program-example/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// babel-preset-taro 更多选项和默认值:
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
module.exports = {
presets: [
['taro', {
framework: 'react',
ts: true
}]
]
}
9 changes: 9 additions & 0 deletions examples/mini-program-example/config/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
env: {
NODE_ENV: '"development"'
},
defineConstants: {
},
mini: {},
h5: {}
}
96 changes: 96 additions & 0 deletions examples/mini-program-example/config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
const path = require('path')

const config = {
projectName: 'mini-program-example',
date: '2023-6-15',
designWidth: 750,
deviceRatio: {
640: 2.34 / 2,
750: 1,
828: 1.81 / 2
},
sourceRoot: 'src',
outputRoot: `dist/spa/main`,
plugins: [],
alias: {
'@/util': path.resolve(__dirname, '..', 'src/util'),
'@/styles': path.resolve(__dirname, '..', 'src/styles'),
'@/assets': path.resolve(__dirname, '..', 'src/assets'),
'@/components': path.resolve(__dirname, '..', 'src/components'),
},
defineConstants: {
},
copy: {
patterns: [
],
options: {
}
},
framework: 'react',
compiler: 'webpack5',
cache: {
enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
},
mini: {
postcss: {
pxtransform: {
enable: true,
config: {

}
},
url: {
enable: true,
config: {
limit: 1024 // 设定转换尺寸上限
}
},
cssModules: {
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
},
imageUrlLoaderOption:{
limit:8192
}
},
h5: {
publicPath: '/spa/main/',
staticDirectory: 'static',
postcss: {
autoprefixer: {
enable: true,
config: {
}
},
cssModules: {
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
},
imageUrlLoaderOption:{
limit:8192
}
},
rn: {
appName: 'taroDemo',
postcss: {
cssModules: {
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
}
}
}
}

module.exports = function (merge) {
if (process.env.NODE_ENV === 'development') {
return merge({}, config, require('./dev'))
}
return merge({}, config, require('./prod'))
}
Loading

0 comments on commit e3c0441

Please sign in to comment.