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
6 changes: 5 additions & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
name: Build Rust WASM
uses: ./.github/workflows/build-rust-wasm.yml

nodejs-testing:
nodejs-tesing:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

修复 Job 名称拼写错误

当前的 Job 名称 nodejs-tesing 缺少一个字母 't',应该是 nodejs-testing。这个拼写错误应该被更正,以保持命名一致性。

-  nodejs-tesing:
+  nodejs-testing:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
nodejs-tesing:
nodejs-testing:

name: Testing on Node.js ${{ matrix.node-version }} (${{ matrix.host }})
needs:
- build-rust-binding
Expand Down Expand Up @@ -118,27 +118,31 @@ jobs:
uses: codecov/codecov-action@v4
if: ${{ matrix.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@v4
if: ${{ matrix.host == 'ubuntu-latest' }}
with:
move_coverage_to_trash: true
flags: taro-runner
files: ./packages/taro-webpack5-runner/coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload [taro-runtime] coverage to Codecov
uses: codecov/codecov-action@v4
if: ${{ matrix.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@v4
if: ${{ matrix.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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ false;
false;

// 接口参数、回调或者返回值
true;
false;
false;
false;
false;
false;
false;
true;

// 组件的属性
true;
Expand Down Expand Up @@ -42,34 +42,34 @@ Taro.noop();"
`;

exports[`babel-plugin-transform-taroapi should not go wrong when using an api twice 1`] = `
"import Taro from '@tarojs/taro-h5';
const animation = Taro.createAnimation({
"import Taro, { createAnimation as _createAnimation } from '@tarojs/taro-h5';
const animation = _createAnimation({
duration: dura * 1000,
timingFunction: 'linear'
});
const resetAnimation = Taro.createAnimation({
const resetAnimation = _createAnimation({
duration: 0,
timingFunction: 'linear'
});"
`;

exports[`babel-plugin-transform-taroapi should not import taro duplicity 1`] = `
"import Taro from '@tarojs/taro-h5';
"import Taro, { createAnimation as _createAnimation, initPxTransform as _initPxTransform } from '@tarojs/taro-h5';
Taro.Component;
Taro.createAnimation();
Taro.initPxTransform();"
_createAnimation();
_initPxTransform();"
`;

exports[`babel-plugin-transform-taroapi should preserve assignments in left hands 1`] = `
"import Taro from '@tarojs/taro-h5';
"import Taro, { createAnimation as _createAnimation, request as _request } from '@tarojs/taro-h5';
let animation;
animation = Taro.createAnimation({
animation = _createAnimation({
transformOrigin: "50% 50%",
duration: 1000,
timingFunction: "ease",
delay: 0
});
Taro.request();
_request();
Taro.request = '';
Taro['request'] = '';"
`;
Expand All @@ -86,11 +86,11 @@ export class Connected extends Taro.Component {}"
`;

exports[`babel-plugin-transform-taroapi should work! 1`] = `
"import Taro from '@tarojs/taro-h5';
Taro.initPxTransform(Taro.param);
Taro.initPxTransform();
Taro.initPxTransform();
Taro['getStorage']();
Taro.setStorage();
"import Taro, { setStorage as _setStorage, initPxTransform as _initPxTransform, getStorage as _getStorage } from '@tarojs/taro-h5';
_initPxTransform(Taro.param);
_initPxTransform();
_initPxTransform();
_getStorage();
_setStorage();
export { Taro };"
`;
6 changes: 3 additions & 3 deletions packages/taro-h5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"prebuild": "rimraf ./dist",
"build": "pnpm run rollup --environment NODE_ENV:production",
"dev": "pnpm run rollup --environment NODE_ENV:development -w",
"rollup": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript --bundleConfigAsCjs",
"test": "jest",
"rollup": "rollup --config rollup.config.mts --configPlugin @rollup/plugin-typescript --bundleConfigAsCjs",
"test": "node_modules/jest/bin/jest.js",
"test:ci": "jest --ci -i --coverage --silent",
"test:dev": "jest --watch",
"test:coverage": "jest --coverage"
Expand Down Expand Up @@ -70,7 +70,7 @@
"react-test-renderer": "^18.2.0",
"rollup": "^3.29.4",
"rollup-plugin-node-externals": "^5.0.0",
"@rollup/plugin-typescript": "^12.1.2",
"rollup-plugin-ts": "^3.4.5",
"@rollup/plugin-node-resolve": "^15.2.3"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import commonjs from '@rollup/plugin-commonjs'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import ts from '@rollup/plugin-typescript'
import { mergeWith } from 'lodash'
import { defineConfig } from 'rollup'
import externals from 'rollup-plugin-node-externals'
import postcss from 'rollup-plugin-postcss'
import ts from 'rollup-plugin-ts'

import type { InputPluginOption, RollupOptions } from 'rollup'

Expand All @@ -24,7 +24,10 @@ const baseConfig: RollupOptions = {
mainFields: ['browser', 'module', 'jsnext:main', 'main'],
}) as InputPluginOption,
ts({
exclude: ['rollup.config.ts']
tsconfig: (e) => ({
...e,
sourceMap: true,
}),
}),
commonjs() as InputPluginOption,
postcss({
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-h5/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"declaration": true,
"outDir": "dist",
"module": "ESNext",
"sourceMap": true
"sourceMap": false
},
"include": ["./src", "./types", "rollup.config.ts"]
"include": ["./src", "./types", "rollup.config.mts"]
}
2 changes: 1 addition & 1 deletion packages/taro-platform-h5/build/definition-json/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function parseAnyOrVoid (str = '', obj: unknown = str) {
}

export function parseDefinitionJSON ({
apisPath = require.resolve('@tarojs/taro-h5/dist/index.d.ts'),
apisPath = require.resolve('@tarojs/taro-h5/dist/index.esm.d.ts'),
componentsPath = require.resolve('@tarojs/components/dist/types/components.d.ts'),
} = {},
config: ts.CompilerOptions = tsconfig,
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-platform-harmony-hybrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@rollup/plugin-typescript": "^11.1.0",
"@tarojs/taro": "workspace:*",
"@types/node": "^14.14.31",
"fast-glob": "^3.3.1",
"lodash": "^4.17.21",
"rollup": "^3.29.4",
"rollup-plugin-node-externals": "^5.0.0",
"rollup-plugin-ts": "^3.4.5",
"tsconfig-paths": "^3.14.1"
}
}
16 changes: 12 additions & 4 deletions packages/taro-platform-harmony-hybrid/rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import path from 'node:path'

import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import ts from '@rollup/plugin-typescript'
import { merge } from 'lodash'
import { defineConfig } from 'rollup'
import externals from 'rollup-plugin-node-externals'
import ts from 'rollup-plugin-ts'

import exportNameOnly from './build/rollup-plugin-export-name-only'

import type { InputPluginOption, RollupOptions } from 'rollup'

const cwd = __dirname

const baseConfig: RollupOptions = {
output: {
format: 'es',
Expand All @@ -31,7 +35,11 @@ function getPlugins<T = InputPluginOption> (pre: T[] = [], post: T[] = []) {
preferConst: true,
}),
ts({
exclude: ['rollup.config.ts']
tsconfig: e => ({
...e,
declaration: true,
sourceMap: true,
})
}),
commonjs(),
...post
Expand Down Expand Up @@ -69,7 +77,7 @@ const variesConfig: RollupOptions[] = [{
devDeps: false,
})])
}, {
input: 'src/runtime/apis/index.ts', // 供 babel-plugin-transform-taroapi 使用,为了能 tree-shaking
input: path.join(cwd, 'src/runtime/apis/index.ts'), // 供 babel-plugin-transform-taroapi 使用,为了能 tree-shaking
output: {
file: 'dist/taroApis.js',
format: 'cjs',
Expand All @@ -80,7 +88,7 @@ const variesConfig: RollupOptions[] = [{

if (process.env.NODE_ENV === 'production') {
variesConfig.push({
input: 'build/rollup-plugin-export-name-only.js',
input: path.join(cwd, 'build/rollup-plugin-export-name-only.js'),
output: {
file: 'dist/rollup-plugin-export-name-only.js',
format: 'cjs',
Expand Down
4 changes: 1 addition & 3 deletions packages/taro-platform-harmony-hybrid/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"esModuleInterop": true,
"module": "ESNext",
"preserveConstEnums": true,
"sourceMap": true,
"declaration": true,
"outDir": "dist"
"sourceMap": true
},
"include": ["./src", "./types", "./rollup.config.ts"],
"ts-node": {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-platform-harmony/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"rollup": "^3.29.4",
"rollup-plugin-copy": "workspace:*",
"rollup-plugin-node-externals": "^5.0.0",
"@rollup/plugin-typescript": "^12.1.2",
"rollup-plugin-ts": "^3.4.5",
"solid-js": "^1.8.16",
"tslib": "^2.4.0"
}
Expand Down
34 changes: 22 additions & 12 deletions packages/taro-platform-harmony/rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { join } from 'node:path'

import commonjs from '@rollup/plugin-commonjs'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import ts from '@rollup/plugin-typescript'
import { type InputPluginOption, type RollupOptions, defineConfig } from 'rollup'
import copy from 'rollup-plugin-copy'
import externals from 'rollup-plugin-node-externals'
import ts from 'rollup-plugin-ts'

const cwd = __dirname

const base: RollupOptions & { plugins: InputPluginOption[] } = {
external: d => {
Expand All @@ -17,7 +21,11 @@ const base: RollupOptions & { plugins: InputPluginOption[] } = {
preferBuiltins: false
}) as InputPluginOption,
ts({
exclude: ['rollup.config.ts']
tsconfig: e => ({
...e,
declaration: true,
sourceMap: true,
})
}),
commonjs() as InputPluginOption
]
Expand All @@ -26,9 +34,9 @@ const base: RollupOptions & { plugins: InputPluginOption[] } = {
// 供 CLI 编译时使用的 Taro 插件入口
const compileConfig: RollupOptions = {
...base,
input: 'src/index.ts',
input: join(cwd, 'src/index.ts'),
output: {
file: 'dist/index.js',
file: join(cwd, 'dist/index.js'),
format: 'cjs',
sourcemap: true,
exports: 'named'
Expand All @@ -51,9 +59,9 @@ const compileConfig: RollupOptions = {
// 供 Loader 使用的运行时入口
const runtimeConfig: RollupOptions = {
...base,
input: 'src/runtime.ts',
input: join(cwd, 'src/runtime.ts'),
output: {
file: 'dist/runtime.js',
file: join(cwd, 'dist/runtime.js'),
format: 'es',
sourcemap: true
}
Expand All @@ -62,9 +70,9 @@ const runtimeConfig: RollupOptions = {
// 供继承的包使用,为了能 tree-shaking
const runtimeUtilsConfig: RollupOptions = {
...base,
input: 'src/runtime-utils.ts',
input: join(cwd, 'src/runtime-utils.ts'),
output: {
file: 'dist/runtime-utils.js',
file: join(cwd, 'dist/runtime-utils.js'),
format: 'es',
sourcemap: true
}
Expand All @@ -73,16 +81,18 @@ const runtimeUtilsConfig: RollupOptions = {
// React 下 webpack 会 alias @tarojs/components 为此文件
const otherConfig: RollupOptions = {
...base,
input: 'src/components/components-react.ts',
input: join(cwd, 'src/components/components-react.ts'),
output: {
file: 'dist/components/components-react.js',
file: join(cwd, 'dist/components/components-react.js'),
format: 'es',
sourcemap: true
},
plugins: [
ts({
declaration: false,
exclude: ['rollup.config.ts']
tsconfig: e => ({
...e,
declaration: false,
})
})
]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"main:h5": "dist/index.esm.js",
"main": "dist/index.js",
"module": "dist/index.cjs.js",
"types": "dist/index.d.ts",
"typings": "dist/index.esm.d.ts",
"files": [
"dist",
"types",
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"build": "pnpm run rollup --environment NODE_ENV:production",
"clean": "rimraf ./dist",
"dev": "pnpm run rollup --environment NODE_ENV:development -w",
"rollup": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
"rollup": "rollup --config rollup.config.ts --configPlugin typescript",
"test": "jest",
"test:ci": "jest --ci -i --coverage --silent"
},
Expand All @@ -40,6 +40,6 @@
"lodash": "^4.17.21",
"react": "^18.2.0",
"rollup": "^4.37.0",
"@rollup/plugin-typescript": "^12.1.2"
"rollup-plugin-ts": "^3.4.5"
}
}
Loading
Loading