Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
Release 1.1.5
Browse files Browse the repository at this point in the history
* fix: pass history params to icestark router  (#224)

* fix: transform core-js path added by preset-env (#225)
  • Loading branch information
chenbin92 authored Apr 8, 2020
2 parents 91ef16c + df81054 commit 605ba87
Show file tree
Hide file tree
Showing 31 changed files with 72 additions and 45 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ Finally, To start developing your application run `npm run start`. The applicati

- [hello-world](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/hello-world)
- [basic-spa](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-spa)
- [basic-store](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-store)
- [basic-ssr](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-ssr)
- [basic-mpa](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-mpa)
- [basic-store](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-store)
- [basic-request](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-request)
- [icestark-child](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/icestark-child)
- [icestark-layout](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/icestark-layout)
Expand Down
3 changes: 2 additions & 1 deletion README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ createApp(appConfig)

- [hello-world](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/hello-world)
- [basic-spa](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-spa)
- [basic-store](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-store)
- [basic-ssr](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-ssr)
- [basic-mpa](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-mpa)
- [basic-store](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-store)
- [basic-request](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/basic-request)
- [icestark-child](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/icestark-child)
- [icestark-layout](https://codesandbox.io/s/github/ice-lab/icejs/tree/master/examples/icestark-layout)
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-mpa/public/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
<meta name="viewport" content="width=device-width" />
<title>mpa-dashboard</title>
<title>icejs · mpa example</title>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-mpa/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
<meta name="viewport" content="width=device-width" />
<title>mpa-index</title>
<title>icejs · mpa example</title>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-request/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
<meta name="viewport" content="width=device-width" />
<title>icejs simple app</title>
<title>icejs · request example</title>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-spa/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
<meta name="viewport" content="width=device-width" />
<title>Lite</title>
<title>icejs · spa example</title>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
<meta name="viewport" content="width=device-width" />
<title>icejs simple app</title>
<title>icejs · hello world example</title>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/icestark-child/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
<meta name="viewport" content="width=device-width" />
<title>Lite</title>
<title>icejs · icestark child example</title>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/icestark-layout/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
<meta name="viewport" content="width=device-width" />
<title>Lite</title>
<title>icejs · icestark layout example</title>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/with-fusion-design/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
<meta name="viewport" content="width=device-width" />
<title>Scaffold Lite</title>
<title>icejs · with fusion design example</title>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/with-rematch/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
<meta name="viewport" content="width=device-width" />
<title>Lite</title>
<title>icejs · with rematch example</title>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.4",
"version": "1.1.5",
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [
Expand Down
2 changes: 1 addition & 1 deletion packages/create-ice/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-ice",
"version": "1.1.4",
"version": "1.1.5",
"description": "npm init ice",
"author": "[email protected]",
"homepage": "",
Expand Down
22 changes: 11 additions & 11 deletions packages/icejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ice.js",
"version": "1.1.4",
"version": "1.1.5",
"description": "command line interface and builtin plugin for icejs",
"author": "[email protected]",
"homepage": "",
Expand All @@ -21,16 +21,16 @@
},
"dependencies": {
"@alib/build-scripts": "^0.1.13",
"build-plugin-ice-config": "1.1.4",
"build-plugin-ice-core": "1.1.4",
"build-plugin-ice-helpers": "1.1.4",
"build-plugin-ice-logger": "1.1.4",
"build-plugin-ice-mpa": "1.1.4",
"build-plugin-ice-request": "1.1.4",
"build-plugin-ice-router": "1.1.4",
"build-plugin-ice-ssr": "1.1.4",
"build-plugin-ice-store": "1.1.4",
"build-plugin-react-app": "1.1.4",
"build-plugin-ice-config": "1.1.5",
"build-plugin-ice-core": "1.1.5",
"build-plugin-ice-helpers": "1.1.5",
"build-plugin-ice-logger": "1.1.5",
"build-plugin-ice-mpa": "1.1.5",
"build-plugin-ice-request": "1.1.5",
"build-plugin-ice-router": "1.1.5",
"build-plugin-ice-ssr": "1.1.5",
"build-plugin-ice-store": "1.1.5",
"build-plugin-react-app": "1.1.5",
"inquirer": "^7.1.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-config",
"version": "1.1.4",
"version": "1.1.5",
"description": "Define application config in icejs",
"author": "[email protected]",
"homepage": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-core",
"version": "1.1.4",
"version": "1.1.5",
"description": "the core plugin for icejs.",
"author": "[email protected]",
"homepage": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-helpers",
"version": "1.1.4",
"version": "1.1.5",
"description": "builtin helpers in icejs",
"author": "[email protected]",
"homepage": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-icestark/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-icestark",
"version": "1.1.4",
"version": "1.1.5",
"description": "Easy use `icestark` in icejs.",
"author": "[email protected]",
"homepage": "",
Expand Down
27 changes: 22 additions & 5 deletions packages/plugin-icestark/src/module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
registerAppLeave,
getBasename,
} from '@ice/stark-app';
import { Router } from '$ice/Router';
import { IceRouter } from '$ice/Router';
import { createHashHistory, createBrowserHistory } from '$ice/history';
import DefaultLayout from '$ice/Layout';
import removeRootLayout from './runtime/removeLayout';
import { IIceStark } from './types';
Expand All @@ -19,10 +20,13 @@ const module = ({ appConfig, addDOMRender, setRenderRouter, modifyRoutes }) => {
const { icestark, router } = appConfig;
const { type: appType } = (icestark || {}) as IIceStark;
const { type, basename, modifyRoutes: runtimeModifyRoutes } = router;

if (runtimeModifyRoutes) {
modifyRoutes(runtimeModifyRoutes);
}
if (appType === 'child') {
const history = createHistory(type, getBasename());

addDOMRender(({ App, appMountNode }) => {
return new Promise(resolve => {
if (isInIcestark()) {
Expand All @@ -42,13 +46,15 @@ const module = ({ appConfig, addDOMRender, setRenderRouter, modifyRoutes }) => {
setRenderRouter((routes) => () => {
const routerProps = {
type,
basename: getBasename(),
routes,
basename: getBasename(),
history
};
return <Router {...routerProps} />;
return <IceRouter {...routerProps} />;
});
} else if (appType === 'framework') {
const { getApps, appRouter, Layout, AppRoute: CustomAppRoute, removeRoutesLayout } = (icestark || {}) as IIceStark;
const history = createHistory(type, basename);
if (removeRoutesLayout) {
modifyRoutes(removeRootLayout);
}
Expand All @@ -60,8 +66,9 @@ const module = ({ appConfig, addDOMRender, setRenderRouter, modifyRoutes }) => {
const [apps, setApps] = useState(null);
const routerProps = {
type,
basename,
routes,
basename,
history
};
const BasicLayout = Layout || DefaultLayout;
const RenderAppRoute = CustomAppRoute || AppRoute;
Expand Down Expand Up @@ -113,7 +120,9 @@ const module = ({ appConfig, addDOMRender, setRenderRouter, modifyRoutes }) => {
{routes && routes.length && (
<RenderAppRoute
path="/"
component={<Router {...routerProps} />}
render={() => {
return <IceRouter {...routerProps} />;
}}
/>
)}
</AppRouter>
Expand All @@ -125,4 +134,12 @@ const module = ({ appConfig, addDOMRender, setRenderRouter, modifyRoutes }) => {
}
};

function createHistory(type: string, basename: string) {
const histories = {
hash: createHashHistory,
browser: createBrowserHistory,
};
return histories[type]({basename});
}

export default module;
4 changes: 2 additions & 2 deletions packages/plugin-icestark/src/runtime/_Router.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';

// eslint-disable-next-line
const Router = ({ type, routes, basename }) => {
const IceRouter = ({ type, routes, basename, history }) => {
return (<div />);
};

export { Router };
export { IceRouter };
6 changes: 6 additions & 0 deletions packages/plugin-icestark/src/runtime/_history.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export {
createBrowserHistory,
createHashHistory,
createMemoryHistory,
History
} from 'history';
3 changes: 2 additions & 1 deletion packages/plugin-icestark/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"outDir": "lib",
"paths": {
"$ice/Router": ["./src/runtime/_Router"],
"$ice/history": ["./src/runtime/_history"],
"$ice/Layout": ["./src/runtime/Layout"]
}
}
}
}
2 changes: 1 addition & 1 deletion packages/plugin-logger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-logger",
"version": "1.1.4",
"version": "1.1.5",
"description": "builtin logger in icejs",
"author": "[email protected]",
"homepage": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-mpa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-mpa",
"version": "1.1.4",
"version": "1.1.5",
"description": "enable mpa project for icejs framework",
"author": "[email protected]",
"homepage": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-react-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-react-app",
"version": "1.1.4",
"version": "1.1.5",
"description": "The basic webpack configuration for ice project",
"author": "[email protected]",
"main": "src/index.js",
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-react-app/src/utils/babelPluginCorejsLock.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ module.exports = ({ types }, { fileList }) => {
});
if (entryFile) {
const { node } = nodePath;
if (node.source.value.startsWith('core-js/')) {
// only replace core-js/modules/xxx added by @babel/preset-env
if (node.source.value.startsWith('core-js/modules')) {
node.source.value = node.source.value.replace('core-js/', `${coreJSPath}/`);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-rematch/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-rematch",
"version": "1.1.4",
"version": "1.1.5",
"description": "Easy use `rematch` in icejs",
"author": "[email protected]",
"homepage": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-request/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-request",
"version": "1.1.4",
"version": "1.1.5",
"description": "request for build-plugin-ice-request",
"author": "[email protected]",
"homepage": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-router",
"version": "1.1.4",
"version": "1.1.5",
"description": "build-plugin-ice-router",
"author": "[email protected]",
"homepage": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ssr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-ssr",
"version": "1.1.4",
"version": "1.1.5",
"description": "ssr plugin",
"author": "[email protected]",
"homepage": "",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-store/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-store",
"version": "1.1.4",
"version": "1.1.5",
"description": "builtin `icestore` in icejs",
"author": "[email protected]",
"homepage": "",
Expand Down

0 comments on commit 605ba87

Please sign in to comment.