Skip to content

Commit

Permalink
fix(driver-universal): web module import effect (#2141)
Browse files Browse the repository at this point in the history
* fix: web module import effect

* chore: optimize code

* chore: optimize code

* chore: optimize repo

* chore: cache babel config

* chore: add changelog

* chore: revert rax

* chore: remove useless file
  • Loading branch information
SoloJiang authored Jun 29, 2021
1 parent 5254ba5 commit d440fb6
Show file tree
Hide file tree
Showing 40 changed files with 77 additions and 1,350 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@babel/plugin-proposal-decorators": "^7.2.0",
"@babel/plugin-proposal-export-default-from": "^7.2.0",
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.14.5",
"@babel/preset-env": "^7.2.0",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
Expand All @@ -21,9 +21,9 @@
"@rollup/plugin-virtual": "^2.0.3",
"@typescript-eslint/eslint-plugin": "^4.8.2",
"@typescript-eslint/parser": "^4.8.2",
"babel-jest": "^26.6.3",
"axios": "^0.21.0",
"babel-eslint": "^10.0.3",
"babel-jest": "^26.6.3",
"babel-loader": "^8.0.4",
"babel-merge": "^3.0.0",
"babel-plugin-transform-jsx-stylesheet": "0.6.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/driver-dom/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Changelog

### v2.2.1
### v2.2.2

- Fix hydrate style with webkit prefix in iOS 10

Expand Down
6 changes: 6 additions & 0 deletions packages/driver-universal/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Changelog

## v3.3.1

- Chore: remove `Object.assign`
- Chore: add @babel/helpers for project size
- Fix: require weex module is `undefined`

## v3.3.0

- Chore: reduce size by exports fields
Expand Down
2 changes: 1 addition & 1 deletion packages/driver-universal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "driver-universal",
"version": "3.3.0",
"version": "3.3.1",
"description": "Driver for Universal App.",
"license": "BSD-3-Clause",
"main": "lib/index.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { createElement, render } from 'rax';
import createDOMDriver from '../dom';

const driver = createDOMDriver();
import Driver from '../web';

describe('Transform rpx', () => {
const CLIENT_WIDTH = 750;
Expand All @@ -15,7 +13,7 @@ describe('Transform rpx', () => {
margin: '75rpx 100vh'
}} />
), container, {
driver,
driver: Driver,
});

expect(container.childNodes[0].style.margin).toEqual('10vw 100vh');
Expand All @@ -28,7 +26,7 @@ describe('Transform rpx', () => {
margin: 75
}} />
), container, {
driver,
driver: Driver,
});

expect(container.childNodes[0].style.margin).toEqual('10vw');
Expand Down
12 changes: 0 additions & 12 deletions packages/driver-universal/src/dom.js

This file was deleted.

12 changes: 4 additions & 8 deletions packages/driver-universal/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@ import {
isBaiduSmartProgram,
isKuaiShouMiniProgram
} from 'universal-env';
import WebDriver from './web';
import MiniAppDriver from './miniapp';
import * as WeexDriver from './weex';
import * as KrakenDriver from './kraken';

let currentDriver;
if (isWeex) {
currentDriver = WeexDriver;
currentDriver = require('./weex').default;
} else if (isWeb) {
currentDriver = WebDriver;
currentDriver = require('./web').default;
} else if (isKraken) {
currentDriver = KrakenDriver;
currentDriver = require('./kraken').default;
} else if (isMiniApp || isWeChatMiniProgram || isByteDanceMicroApp || isBaiduSmartProgram || isKuaiShouMiniProgram) {
currentDriver = MiniAppDriver;
currentDriver = require('./miniapp').default;
}

export default currentDriver;
12 changes: 10 additions & 2 deletions packages/driver-universal/src/web.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import createDOMDriver from './dom';
import * as DriverDOM from 'driver-dom';

export default createDOMDriver();
export default {
...DriverDOM,
createElement(type, props, component) {
return DriverDOM.createElement(type, props, component, true);
},
setStyle(node, style) {
return DriverDOM.setStyle(node, style, true);
}
};
5 changes: 5 additions & 0 deletions packages/driver-worker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## v0.7.11

- Chore: add `@babel/runtime` as dependency
5 changes: 3 additions & 2 deletions packages/driver-worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "driver-worker",
"version": "0.7.10",
"version": "0.7.11",
"description": "Worker driver for Rax",
"license": "BSD-3-Clause",
"main": "dist/driver-worker.min.js",
Expand All @@ -13,7 +13,8 @@
},
"homepage": "https://github.com/alibaba/rax#readme",
"dependencies": {
"style-unit": "^3.0.0"
"style-unit": "^3.0.0",
"@babel/runtime": "^7.14.6"
},
"devDependencies": {
"rax": "^0.6.7"
Expand Down
5 changes: 5 additions & 0 deletions packages/mobx-rax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## v1.0.1

- Chore: add `@babel/runtime` as dependency
5 changes: 3 additions & 2 deletions packages/mobx-rax/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobx-rax",
"version": "1.0.0",
"version": "1.0.1",
"description": "Official Rax bindings for mobx.",
"license": "BSD-3-Clause",
"main": "lib/index.js",
Expand All @@ -20,7 +20,8 @@
"rax": "^1.0.0",
"rax-children": "^1.0.0",
"rax-find-dom-node": "^1.0.0",
"react-lifecycles-compat": "^3.0.4"
"react-lifecycles-compat": "^3.0.4",
"@babel/runtime": "^7.14.6"
},
"peerDependencies": {
"mobx": "^4.0.0 || ^5.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/rax-pwa/README.md

This file was deleted.

34 changes: 0 additions & 34 deletions packages/rax-pwa/package.json

This file was deleted.

29 changes: 0 additions & 29 deletions packages/rax-pwa/src/Document.js

This file was deleted.

20 changes: 0 additions & 20 deletions packages/rax-pwa/src/Error.js

This file was deleted.

126 changes: 0 additions & 126 deletions packages/rax-pwa/src/Navigation/index.js

This file was deleted.

Loading

0 comments on commit d440fb6

Please sign in to comment.