Skip to content

Commit e618f9f

Browse files
authored
Merge branch 'main' into fix-defaultTrue
2 parents 44e1750 + 786c0bb commit e618f9f

File tree

103 files changed

+200
-117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+200
-117
lines changed

.cargo/config.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ rustflags = ["-C", "target-feature=+crt-static"]
1818

1919
[alias]
2020
# Alias to build actual SWC plugin binary for the specified target.
21-
build-wasi = "build --target wasm32-wasi"
21+
build-wasi = "build --target wasm32-wasip1"
2222
build-wasm32 = "build --target wasm32-unknown-unknown"
2323
build-swc-plugins = "build-wasi --release -p swc_plugin_compile_mode -p swc_plugin_define_config -p swc_plugin_compile_mode_pre_process"
2424
test-swc-plugins = "test -p swc_plugin_compile_mode -p swc_plugin_define_config -p swc_plugin_compile_mode_pre_process"

.github/workflows/build-rust-wasm.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: dtolnay/rust-toolchain@stable
1717
with:
1818
toolchain: stable
19-
targets: wasm32-wasi
19+
targets: wasm32-wasip1
2020
- name: Cache cargo
2121
uses: actions/cache@v3
2222
with:
@@ -33,5 +33,5 @@ jobs:
3333
uses: actions/upload-artifact@v4
3434
with:
3535
name: wasm-wasi-swc_plugins
36-
path: target/wasm32-wasi/release/*.wasm
36+
path: target/wasm32-wasip1/release/*.wasm
3737
if-no-files-found: error

.github/workflows/nodejs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ jobs:
164164
uses: dtolnay/rust-toolchain@stable
165165
with:
166166
toolchain: stable
167-
targets: wasm32-wasi
167+
targets: wasm32-wasip1
168168
- name: Cache cargo
169169
uses: actions/cache@v3
170170
with:

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ $ pnpm --filter @tarojs/binding run test
185185

186186
#### SWC 插件
187187

188-
首先在项目根目录执行 `rustup target add wasm32-wasi` 命令安装 `wasm32-wasi``target`
188+
首先在项目根目录执行 `rustup target add wasm32-wasip1` 命令安装 `wasm32-wasip1``target`
189189

190190
开发过程中可以使用 SWC 测试套件进行单元测试:
191191

@@ -207,7 +207,7 @@ $ cargo build -p [package-name]
207207

208208
Cargo workspace 会把编译产物输出到根目录的 `target` 文件夹中。进行集成测试时,需要手动把 `.wasm` 产物软链到目标文件夹,而 Github CI 在正式发布时会自动拷贝产物到正确的文件夹中。
209209

210-
如对 `@taorjs/helper` 进行集成测试时,会把 `target/wasm32-wasi/release/swc_plugin_xxx.wasm` 文件的软链到 `packages/taro-helper/swc/swc_plugin_xxx.wasm`
210+
如对 `@taorjs/helper` 进行集成测试时,会把 `target/wasm32-wasip1/release/swc_plugin_xxx.wasm` 文件的软链到 `packages/taro-helper/swc/swc_plugin_xxx.wasm`
211211

212212
####
213213

crates/native_binding/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tarojs/binding",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "Node binding for taro",
55
"main": "binding.js",
66
"typings": "binding.d.ts",

npm/darwin-arm64/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@tarojs/binding-darwin-arm64",
33
"description": "Native binding for taro",
4-
"version": "4.0.9-beta.2",
4+
"version": "4.0.9",
55
"os": [
66
"darwin"
77
],

npm/darwin-x64/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@tarojs/binding-darwin-x64",
33
"description": "Native binding for taro",
4-
"version": "4.0.9-beta.2",
4+
"version": "4.0.9",
55
"os": [
66
"darwin"
77
],

npm/linux-x64-gnu/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@tarojs/binding-linux-x64-gnu",
33
"description": "Native binding for taro",
4-
"version": "4.0.9-beta.2",
4+
"version": "4.0.9",
55
"os": [
66
"linux"
77
],

npm/linux-x64-musl/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tarojs/binding-linux-x64-musl",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"os": [
55
"linux"
66
],

npm/win32-x64-msvc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@tarojs/binding-win32-x64-msvc",
33
"description": "Native binding for taro",
4-
"version": "4.0.9-beta.2",
4+
"version": "4.0.9",
55
"os": [
66
"win32"
77
],

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "taro",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "开放式跨端跨框架开发解决方案",
55
"homepage": "https://github.com/NervJS/taro#readme",
66
"author": "O2Team",

packages/babel-plugin-transform-react-jsx-to-rn-stylesheet/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "babel-plugin-transform-react-jsx-to-rn-stylesheet",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "Transform stylesheet selector to style in JSX Elements.",
55
"author": "O2Team",
66
"license": "MIT",

packages/babel-plugin-transform-solid-jsx/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "babel-plugin-transform-solid-jsx",
33
"description": "A JSX to DOM plugin that wraps expressions for fine grained change detection",
4-
"version": "4.0.9-beta.2",
4+
"version": "4.0.9",
55
"license": "MIT",
66
"repository": {
77
"type": "git",

packages/babel-plugin-transform-taroapi/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "babel-plugin-transform-taroapi",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"author": "O2Team",
55
"license": "MIT",
66
"main": "dist/index.js",

packages/babel-preset-taro/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "babel-preset-taro",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "Taro babel preset",
55
"author": "O2Team",
66
"license": "MIT",

packages/create-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tarojs/create-app",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "create taro app with one command",
55
"author": "O2Team",
66
"license": "MIT",

packages/css-to-react-native/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "taro-css-to-react-native",
33
"description": "Convert CSS text to a React Native stylesheet object",
4-
"version": "4.0.9-beta.2",
4+
"version": "4.0.9",
55
"author": "O2Team",
66
"license": "MIT",
77
"main": "dist/index.js",

packages/eslint-config-taro/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-taro",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "Taro specific linting rules for ESLint",
55
"author": "O2Team",
66
"license": "MIT",

packages/jest-helper/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jest-taro-helper",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "jest helper for taro",
55
"private": true,
66
"author": "O2Team",

packages/postcss-html-transform/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-html-transform",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "transform html tag name selector",
55
"author": "O2Team",
66
"license": "MIT",

packages/postcss-plugin-constparse/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-plugin-constparse",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "parse constants defined in config",
55
"author": "O2Team",
66
"license": "MIT",

packages/postcss-pxtransform/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-pxtransform",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "PostCSS plugin px 转小程序 rpx及h5 rem 单位",
55
"author": "O2Team",
66
"license": "MIT",

packages/postcss-unit-transform/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "postcss-taro-unit-transform",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "小程序单位转换",
55
"author": "O2Team",
66
"license": "MIT",

packages/rollup-plugin-copy/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rollup-plugin-copy",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "rollup-plugin-copy for taro",
55
"private": true,
66
"author": "O2Team",

packages/shared/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tarojs/shared",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "Taro utils internal use.",
55
"author": "O2Team",
66
"license": "MIT",

packages/stylelint-config-taro-rn/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stylelint-config-taro-rn",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "Shareable stylelint config for React Native CSS modules",
55
"author": "O2Team",
66
"license": "MIT",

packages/stylelint-taro-rn/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stylelint-taro-rn",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "A collection of React Native specific rules for stylelint",
55
"author": "O2Team",
66
"license": "MIT",
@@ -46,7 +46,7 @@
4646
},
4747
"devDependencies": {
4848
"lodash": "^4.17.21",
49-
"stylelint": "^16.4.0"
49+
"stylelint": ">=16.4.0 <=16.10.0"
5050
},
5151
"peerDependencies": {
5252
"stylelint": "^16"

packages/stylelint-taro/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stylelint-taro",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "Taro stylelint 规则集合",
55
"author": "O2Team",
66
"license": "MIT",

packages/taro-api/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tarojs/api",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "Taro common API",
55
"author": "O2Team",
66
"license": "MIT",

packages/taro-cli-convertor/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tarojs/cli-convertor",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "cli tool for taro-convert",
55
"author": "O2Team",
66
"license": "MIT",

packages/taro-cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tarojs/cli",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "cli tool for taro",
55
"author": "O2Team",
66
"license": "MIT",

packages/taro-cli/src/cli.ts

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ export default class CLI {
202202
projectName: _[1] || args.name,
203203
description: args.description,
204204
typescript: args.typescript,
205+
buildEs5: args['build-es5'],
205206
framework: args.framework,
206207
compiler: args.compiler,
207208
npm: args.npm,

packages/taro-cli/src/presets/commands/build.ts

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
validateConfig
44
} from '@tarojs/plugin-doctor'
55

6+
import { extractCompileEntry } from '../../util/appConfig'
67
import * as hooks from '../constant'
78

89
import type { IPluginContext } from '@tarojs/service'
@@ -14,6 +15,8 @@ export default (ctx: IPluginContext) => {
1415
'--type [typeName]': 'Build type, weapp/swan/alipay/tt/qq/jd/h5/rn',
1516
'--watch': 'Watch mode',
1617
'--env [env]': 'Value for process.env.NODE_ENV',
18+
'--pages': 'Specify the pages to be compiled, separate multiple by comma',
19+
'--components': 'Specify the components to be compiled, separate multiple by comma',
1720
'--mode [mode]': 'Value of dotenv extname',
1821
'-p, --port [port]': 'Specified port',
1922
'--no-build': 'Do not build project',
@@ -36,6 +39,7 @@ export default (ctx: IPluginContext) => {
3639
synopsisList: [
3740
'taro build --type weapp',
3841
'taro build --type weapp --watch',
42+
'taro build --type weapp --watch --pages pages/index/index',
3943
'taro build --type weapp --env production',
4044
'taro build --type weapp --blended',
4145
'taro build --type weapp --no-build',
@@ -50,6 +54,7 @@ export default (ctx: IPluginContext) => {
5054
const { platform, isWatch, blended, newBlended, withoutBuild, noInjectGlobalStyle, noCheck } = options
5155
const { fs, chalk, PROJECT_CONFIG } = ctx.helper
5256
const { outputPath, configPath } = ctx.paths
57+
const { args } = options
5358

5459
if (!configPath || !fs.existsSync(configPath)) {
5560
console.log(chalk.red(`找不到项目配置文件${PROJECT_CONFIG},请确定当前目录是 Taro 项目根目录!`))
@@ -120,6 +125,8 @@ export default (ctx: IPluginContext) => {
120125
newBlended,
121126
noInjectGlobalStyle,
122127
async modifyAppConfig (appConfig) {
128+
extractCompileEntry(appConfig, args, ctx)
129+
123130
await ctx.applyPlugins({
124131
name: hooks.MODIFY_APP_CONFIG,
125132
opts: {

packages/taro-cli/src/presets/commands/init.ts

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default (ctx: IPluginContext) => {
77
'--name [name]': '项目名称',
88
'--description [description]': '项目介绍',
99
'--typescript': '使用TypeScript',
10+
'--build-es5': '是否需要编译为es5',
1011
'--npm [npm]': '包管理工具',
1112
'--template-source [templateSource]': '项目模板源',
1213
'--clone [clone]': '拉取远程模板时使用git clone',
@@ -25,6 +26,7 @@ export default (ctx: IPluginContext) => {
2526
template,
2627
description,
2728
typescript,
29+
buildEs5,
2830
css,
2931
npm,
3032
framework,
@@ -45,6 +47,7 @@ export default (ctx: IPluginContext) => {
4547
template,
4648
description,
4749
typescript,
50+
buildEs5,
4851
framework,
4952
compiler,
5053
hideDefaultTemplate,
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { IPluginContext } from '@tarojs/service'
2+
import { isString } from '@tarojs/shared'
3+
import { AppConfig } from '@tarojs/taro'
4+
5+
/**
6+
* 按需编译功能,只编译指定的页面或组件
7+
* @param appConfig
8+
* @param args
9+
*/
10+
export function extractCompileEntry(
11+
appConfig: AppConfig,
12+
args: { _: string[], [key: string]: any },
13+
ctx: IPluginContext
14+
): void {
15+
const { chalk } = ctx.helper
16+
17+
const extractType = isString(args.pages) ? 'pages' : isString(args.components) ? 'components' : ''
18+
if (!extractType) return
19+
20+
const entries = args[extractType].split(',').map(item => item.trim()).filter(Boolean)
21+
if (!entries.length) {
22+
console.log(chalk.yellow(`按需编译开启失败,请指定要编译的${extractType}`))
23+
return
24+
}
25+
26+
appConfig[extractType] = entries
27+
appConfig.subPackages = []
28+
console.log(chalk.green(`已开启按需编译,仅编译以下${extractType}: ${appConfig[extractType]}`))
29+
}

packages/taro-components-advanced/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tarojs/components-advanced",
3-
"version": "4.0.9-beta.2",
3+
"version": "4.0.9",
44
"description": "",
55
"author": "O2Team",
66
"license": "MIT",

0 commit comments

Comments
 (0)