Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public-hoist-pattern[]=@types/*
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*jest*
public-hoist-pattern[]=*prettier*
registry="https://registry.yarnpkg.com/"
strict-peer-dependencies=false

{SCOPE}:registry=https://npm.pkg.github.com
2 changes: 1 addition & 1 deletion examples/swiper-effect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/plugin-proposal-class-properties": "7.14.5",
"@babel/plugin-transform-class-properties": "7.14.5",
"@babel/preset-react": "^7.24.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
"@tarojs/cli": "4.0.7",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@babel/core",
"@babel/helper-plugin-utils",
"@babel/parser",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-class-properties",
"@babel/plugin-proposal-decorators",
"@babel/plugin-proposal-do-expressions",
"@babel/plugin-proposal-object-rest-spread",
Expand Down
18 changes: 9 additions & 9 deletions packages/babel-preset-taro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {

- `@babel/plugin-transform-runtime`
- `@babel/plugin-proposal-decorators`
- `@babel/plugin-proposal-class-properties`
- `@babel/plugin-transform-class-properties`
- `babel-plugin-dynamic-import-node`(小程序环境)

#### 2. React
Expand Down Expand Up @@ -150,7 +150,7 @@ import "core-js/modules/es.string.pad-end";

**默认值**:`false`

同时是 `@babel/preset-env`、`@babel/plugin-proposal-class-properties` 的 `loose` 配置项。
同时是 `@babel/preset-env`、`@babel/plugin-transform-class-properties` 的 `loose` 配置项。

### debug

Expand All @@ -167,23 +167,23 @@ import "core-js/modules/es.string.pad-end";
### spec

`@babel/preset-env` 的 [spec](https://babeljs.io/docs/en/babel-preset-env#spec) 配置项。

### configPath

`@babel/preset-env` 的 [configPath](https://babeljs.io/docs/en/babel-preset-env#configpath) 配置项。

### include

`@babel/preset-env` 的 [include](https://babeljs.io/docs/en/babel-preset-env#include) 配置项。

### exclude

`@babel/preset-env` 的 [exclude](https://babeljs.io/docs/en/babel-preset-env#exclude) 配置项。

### shippedProposals

`@babel/preset-env` 的 [shippedProposals](https://babeljs.io/docs/en/babel-preset-env#shippedproposals) 配置项。

### forceAllTransforms

`@babel/preset-env` 的 [forceAllTransforms](https://babeljs.io/docs/en/babel-preset-env#forcealltransforms) 配置项。
Expand All @@ -203,14 +203,14 @@ import "core-js/modules/es.string.pad-end";

**默认值**:开发者根目录 `node_modules` 中的 `@babel/plugin-transform-runtime` 的路径。

**类型**:`string`
**类型**:`string`

`@babel/plugin-transform-runtime` 的 [absoluteRuntime](https://babeljs.io/docs/en/babel-plugin-transform-runtime#absoluteruntime) 配置项。

### version

**默认值**:开发者根目录 `node_modules` 中的 `@babel/plugin-transform-runtime` 的版本号。

**类型**:`string`
**类型**:`string`

`@babel/plugin-transform-runtime` 的 [version](https://babeljs.io/docs/en/babel-plugin-transform-runtime#version) 配置项。
2 changes: 1 addition & 1 deletion packages/babel-preset-taro/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ module.exports = (_, options = {}) => {
legacy: decoratorsLegacy !== false,
},
],
[require('@babel/plugin-proposal-class-properties'), { loose }]
[require('@babel/plugin-transform-class-properties'), { loose }]
)

plugins.push([
Expand Down
5 changes: 2 additions & 3 deletions packages/taro-cli/templates/default/package.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"devDependencies": {
"@babel/core": "^7.24.4",
"@tarojs/cli": "{{ version }}",
"@babel/plugin-proposal-class-properties": "7.14.5",
"@babel/plugin-transform-class-properties": "7.25.9",
"@types/webpack-env": "^1.13.6",{{#if (includes "React" "Preact" s=framework)}}
"@types/react": "^18.0.0",{{/if}}{{#if (eq compiler "Webpack5") }}
"webpack": "5.91.0",
Expand Down Expand Up @@ -111,7 +111,7 @@
}{{/if}}{{#if (eq compiler "Vite") }}
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/plugin-proposal-class-properties": "7.14.5",
"@babel/plugin-transform-class-properties": "7.25.9",
"@tarojs/cli": "{{ version }}",
"@tarojs/vite-runner": "{{ version }}",
"babel-preset-taro": "{{ version }}",
Expand Down Expand Up @@ -140,4 +140,3 @@
"postcss": "^8.4.38"
}{{/if}}
}

10 changes: 2 additions & 8 deletions packages/taro-components/babel.config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"presets": [
"@babel/preset-react",
"power-assert"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread"
],
"presets": ["@babel/preset-react", "power-assert"],
"plugins": ["@babel/plugin-transform-class-properties", "@babel/plugin-proposal-object-rest-spread"],
"babelrcRoots": ["./h5/*"]
}
4 changes: 2 additions & 2 deletions packages/taro-framework-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ function VitePresetPlugin (framework: Frameworks): PluginOption {
babel: {
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-transform-class-properties', { loose: true }],
],
},
})
: require('@vitejs/plugin-react').default({
babel: {
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-transform-class-properties', { loose: true }],
],
},
})
Expand Down
8 changes: 4 additions & 4 deletions packages/taro-helper/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ export function generateEnvList (env: Record<string, any>): Record<string, any>
/**
* 获取 npm 文件或者依赖的绝对路径
*
* @param {string} 参数1 - 组件路径
* @param {string} 参数2 - 文件扩展名
* @param {string} 参数 1 - 组件路径
* @param {string} 参数 2 - 文件扩展名
* @returns {string} npm 文件绝对路径
*/
export function getNpmPackageAbsolutePath (npmPath: string, defaultFile = 'index'): string | null {
Expand Down Expand Up @@ -603,9 +603,9 @@ function readSFCPageConfig(configPath: string) {
p.stop()
}
const configSource = matches[0]
const ast = babel.parse(configSource, { filename: '' }) as babel.ParseResult
const program = (babel.parse(configSource, { filename: '' }))?.program

babel.traverse(ast.program, { CallExpression: callExprHandler })
program && babel.traverse(program, { CallExpression: callExprHandler })
}

return result
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-rn/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// 由 getLibList.js 脚本生成, 不要进行手动修改, 请不要手动修改
export * from './ENV_TYPE'
export * from './arrayBufferToBase64'
export * from './authorize'
export * from './base64ToArrayBuffer'
Expand All @@ -16,6 +15,7 @@ export * from './createInnerAudioContext'
export * from './createSelectorQuery'
export * from './createVideoContext'
export * from './downloadFile'
export * from './ENV_TYPE'
export * from './getAppBaseInfo'
export * from './getClipboardData'
export * from './getEnv'
Expand Down
5 changes: 3 additions & 2 deletions packages/taro-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@
"node": ">= 18"
},
"dependencies": {
"tslib": "^2.6.2",
"@tarojs/shared": "workspace:*"
"@tarojs/shared": "workspace:*",
"tslib": "^2.6.2"
},
"devDependencies": {
"@types/react": "^18.2.79",
"@vue/runtime-core": "^3.4.23",
"lodash": "^4.17.21",
"react": "^18.2.0",
"rollup": "^4.37.0",
"rollup-plugin-ts": "^3.4.5"
}
}
Loading
Loading