Skip to content

Commit 18c7e3e

Browse files
authored
Merge pull request #6890 from alibaba/release/next
Release 3.4.9
2 parents 4865124 + 8ebd64e commit 18c7e3e

37 files changed

+228
-102
lines changed

packages/ice/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 3.4.9
4+
5+
### Patch Changes
6+
7+
- 4c9456fc: feat: export useAsyncData for component Await
8+
- b808156b: feat: support open specified route and list all routes
9+
- Updated dependencies [4c9456fc]
10+
- @ice/runtime@1.4.8
11+
312
## 3.4.8
413

514
### Patch Changes

packages/ice/bin/ice-cli.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
6565
.option('--https [https]', 'enable https', false)
6666
.option('--force', 'force remove cache directory', false)
6767
.option('--speedup', 'speed up build time based on Rust tools', false)
68+
.option('--open <open>', 'open browser on startup with specific route', true)
69+
.option('--list', 'list all available pages', false)
6870
.action(async ({ rootDir, ...commandArgs }, ctx) => {
6971
renamePlatformToTarget(commandArgs);
7072
process.env.NODE_ENV = 'development';

packages/ice/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ice/app",
3-
"version": "3.4.8",
3+
"version": "3.4.9",
44
"description": "provide scripts and configuration used by web framework ice",
55
"type": "module",
66
"main": "./esm/index.js",
@@ -49,7 +49,7 @@
4949
"dependencies": {
5050
"@ice/bundles": "0.2.6",
5151
"@ice/route-manifest": "1.2.2",
52-
"@ice/runtime": "^1.4.7",
52+
"@ice/runtime": "^1.4.8",
5353
"@ice/shared-config": "1.2.7",
5454
"@ice/webpack-config": "1.1.14",
5555
"@ice/rspack-config": "1.1.7",

packages/ice/src/bundler/config/getUrls.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,11 @@ const getUrls = ({
3232
return urls;
3333
};
3434

35+
export const getUrlInfo = (routePaths: string[]) => {
36+
return {
37+
devPath: (routePaths[0] || '').replace(/^[/\\]/, ''),
38+
routePaths: routePaths.map((routePath) => (routePath || '').replace(/^[/\\]/, '')),
39+
};
40+
};
41+
3542
export default getUrls;

packages/ice/src/bundler/rspack/start.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Configuration as DevServerConfiguration } from '@rspack/dev-server
33
import getDefaultServerConfig from '../config/defaultServerConfig.js';
44
import getMiddlewares from '../config/middlewares.js';
55
import { logger } from '../../utils/logger.js';
6-
import getUrls from '../config/getUrls.js';
6+
import getUrls, { getUrlInfo } from '../config/getUrls.js';
77
import { WEB } from '../../constant.js';
88
import type { BuildOptions } from '../types.js';
99
import formatStats from './formatStats.js';
@@ -80,9 +80,7 @@ const start = async ({
8080
isSuccessful,
8181
isFirstCompile,
8282
urls,
83-
devUrlInfo: {
84-
devPath: (routePaths[0] || '').replace(/^[/\\]/, ''),
85-
},
83+
devUrlInfo: getUrlInfo(routePaths),
8684
messages: message,
8785
taskConfigs,
8886
...hooksAPI,

packages/ice/src/bundler/webpack/start.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { logger } from '../../utils/logger.js';
99
import { WEB } from '../../constant.js';
1010
import getMiddlewares from '../config/middlewares.js';
1111
import getDefaultServerConfig from '../config/defaultServerConfig.js';
12-
import getUrls from '../config/getUrls.js';
12+
import getUrls, { getUrlInfo } from '../config/getUrls.js';
1313
import type { BundlerOptions, Context } from '../types.js';
1414

1515
const { merge } = lodash;
@@ -88,9 +88,7 @@ export async function startDevServer(
8888
isSuccessful,
8989
isFirstCompile,
9090
urls,
91-
devUrlInfo: {
92-
devPath: (routePaths[0] || '').replace(/^[/\\]/, ''),
93-
},
91+
devUrlInfo: getUrlInfo(routePaths),
9492
messages,
9593
taskConfigs,
9694
...hooksAPI,

packages/ice/src/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,10 @@ const cliOption = [
522522
name: 'open',
523523
commands: ['start'],
524524
},
525+
{
526+
name: 'list',
527+
commands: ['start'],
528+
},
525529
{
526530
name: 'speedup',
527531
commands: ['start', 'build'],

packages/ice/src/constant.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export const RUNTIME_EXPORTS = [
5151
'useNavigate',
5252
'useNavigation',
5353
'useRevalidator',
54+
'useAsyncValue',
5455
],
5556
source: '@ice/runtime/router',
5657
},

packages/ice/src/plugins/web/index.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,28 @@ const plugin: Plugin = () => ({
2323
});
2424

2525
onHook('after.start.compile', async ({ isSuccessful, isFirstCompile, urls, devUrlInfo }) => {
26-
const { port, open } = commandArgs;
27-
const { devPath } = devUrlInfo;
26+
const { port, open, list } = commandArgs;
27+
const { devPath, routePaths } = devUrlInfo;
2828
if (isSuccessful && isFirstCompile) {
2929
let logoutMessage = '\n';
3030
logoutMessage += chalk.green(' Starting the development server at:');
31-
if (process.env.CLOUDIDE_ENV) {
32-
logoutMessage += `\n - IDE server: https://${process.env.WORKSPACE_UUID}-${port}.${process.env.WORKSPACE_HOST}${devPath}`;
31+
if (list) {
32+
routePaths.forEach((routePath) => {
33+
logoutMessage += `\n - Route(${routePath || 'index'}) : ${chalk.underline.white(`${urls.lanUrlForTerminal}${routePath}`)}`;
34+
});
3335
} else {
34-
logoutMessage += `\n
36+
if (process.env.CLOUDIDE_ENV) {
37+
logoutMessage += `\n - IDE server: https://${process.env.WORKSPACE_UUID}-${port}.${process.env.WORKSPACE_HOST}${devPath}`;
38+
} else {
39+
logoutMessage += `\n
3540
- Local : ${chalk.underline.white(`${urls.localUrlForBrowser}${devPath}`)}
3641
- Network: ${chalk.underline.white(`${urls.lanUrlForTerminal}${devPath}`)}`;
42+
}
3743
}
3844
logger.log(`${logoutMessage}\n`);
3945

4046
if (open) {
41-
openBrowser(`${urls.localUrlForBrowser}${devPath}`);
47+
openBrowser(`${urls.localUrlForBrowser}${typeof open === 'string' ? open.replace(/^[/\\]/, '') : devPath}`);
4248
}
4349
}
4450
});

packages/ice/src/types/plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ interface AfterCommandCompileOptions {
112112

113113
interface DevServerInfo {
114114
devPath: string;
115+
routePaths: string[];
115116
}
116117

117118
export interface HookLifecycle {

packages/jsx-runtime/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @ice/jsx-runtime
22

3+
## 0.3.0
4+
5+
### Minor Changes
6+
7+
- bccc7db1: fix: use jsx-dev-runtime when development
8+
39
## 0.2.2
410

511
### Patch Changes

packages/jsx-runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ice/jsx-runtime",
3-
"version": "0.2.2",
3+
"version": "0.3.0",
44
"description": "JSX runtime for ice.",
55
"files": [
66
"esm",

packages/jsx-runtime/src/dev.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
import { jsx, Fragment, jsxs } from './index.js';
1+
// @ts-ignore
2+
import { jsxDEV as _jsxDEV, Fragment } from 'react/jsx-dev-runtime';
3+
import { hijackElementProps } from './style.js';
24

3-
export { Fragment };
4-
export function jsxDEV(
5+
/**
6+
* @param {*} type
7+
* @param {object} props
8+
* @param {string} key
9+
* @param {boolean} isStaticChildren
10+
* @param {object} source
11+
* @param {any} self
12+
*/
13+
function jsxDEV(
514
type: any,
615
props: object,
716
key: string,
817
isStaticChildren: boolean,
918
source: object,
1019
self: any,
1120
) {
12-
return isStaticChildren ? jsxs(type, props, key, source, self) : jsx(type, props, key, source, self);
21+
return _jsxDEV(type, hijackElementProps(props), key, isStaticChildren, source, self);
1322
}
23+
24+
export { jsxDEV, Fragment };

packages/jsx-runtime/src/index.ts

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1 @@
1-
// @ts-ignore
2-
import { jsx as _jsx, jsxs as _jsxs, Fragment } from 'react/jsx-runtime';
3-
// @ts-ignore
4-
import { convertUnit } from 'style-unit';
5-
6-
const STYLE = 'style';
7-
8-
/**
9-
* https://github.com/reactjs/rfcs/pull/107
10-
* @param {*} type
11-
* @param {object} props
12-
* @param {string} maybeKey
13-
* @param {object} source
14-
* @param {any} self
15-
*/
16-
export function jsx(type: any, props: object, maybeKey: string, source: object, self: any) {
17-
return _jsx(type, hijackElementProps(props), maybeKey, source, self);
18-
}
19-
20-
// Same as jsx method, special case jsxs internally to take advantage of static children.
21-
// // for now we can ship identical prod functions.
22-
export function jsxs(type: any, props: object, maybeKey: string, source: object, self: any) {
23-
return _jsxs(type, hijackElementProps(props), maybeKey, source, self);
24-
}
25-
26-
function isObject(obj: any): obj is object {
27-
return typeof obj === 'object';
28-
}
29-
30-
// Support rpx unit.
31-
export function hijackElementProps(props: { style?: object } | object): object {
32-
if (props && STYLE in props) {
33-
const { style } = props;
34-
if (isObject(style)) {
35-
const result = Object.assign({}, props);
36-
const convertedStyle = {};
37-
for (const prop in style) {
38-
// @ts-ignore
39-
convertedStyle[prop] = typeof style[prop] === 'string' ? convertUnit(style[prop]) : style[prop];
40-
}
41-
result['style'] = convertedStyle;
42-
return result;
43-
}
44-
}
45-
return props;
46-
}
47-
48-
export {
49-
Fragment,
50-
};
1+
export * from './prod.js';

packages/jsx-runtime/src/prod.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
1-
export { jsx, jsxs, Fragment } from './index.js';
1+
// @ts-ignore
2+
import { jsx as _jsx, jsxs as _jsxs, Fragment } from 'react/jsx-runtime';
3+
import { hijackElementProps } from './style.js';
4+
5+
/**
6+
* https://github.com/reactjs/rfcs/pull/107
7+
* @param {*} type
8+
* @param {object} props
9+
* @param {string} maybeKey
10+
* @param {object} source
11+
* @param {any} self
12+
*/
13+
function jsx(type: any, props: object, maybeKey: string, source: object, self: any) {
14+
return _jsx(type, hijackElementProps(props), maybeKey, source, self);
15+
}
16+
17+
// Same as jsx method, special case jsxs internally to take advantage of static children.
18+
// // for now we can ship identical prod functions.
19+
function jsxs(type: any, props: object, maybeKey: string, source: object, self: any) {
20+
return _jsxs(type, hijackElementProps(props), maybeKey, source, self);
21+
}
22+
23+
export {
24+
Fragment,
25+
jsx,
26+
jsxs,
27+
};

packages/jsx-runtime/src/style.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// @ts-ignore
2+
import { convertUnit } from 'style-unit';
3+
4+
const STYLE = 'style';
5+
6+
function isObject(obj: any): obj is object {
7+
return typeof obj === 'object';
8+
}
9+
10+
// Support rpx unit.
11+
export function hijackElementProps(props: { style?: object } | object): object {
12+
if (props && STYLE in props) {
13+
const { style } = props;
14+
if (isObject(style)) {
15+
const result = Object.assign({}, props);
16+
const convertedStyle = {};
17+
for (const prop in style) {
18+
// @ts-ignore
19+
convertedStyle[prop] = typeof style[prop] === 'string' ? convertUnit(style[prop]) : style[prop];
20+
}
21+
result['style'] = convertedStyle;
22+
return result;
23+
}
24+
}
25+
return props;
26+
}

packages/jsx-runtime/tests/hijackElememt.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, it, describe } from 'vitest';
2-
import { hijackElementProps } from '../src/';
2+
import { hijackElementProps } from '../src/style';
33

44
describe('hijack element', () => {
55
it('hijackElementProps basic', () => {
@@ -19,4 +19,4 @@ describe('hijack element', () => {
1919
},
2020
});
2121
});
22-
});
22+
});

packages/plugin-i18n/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# @ice/plugin-i18n
22

3+
## 5.0.1
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [bccc7db1]
8+
- Updated dependencies [4c9456fc]
9+
- Updated dependencies [b808156b]
10+
- @ice/jsx-runtime@0.3.0
11+
- @ice/runtime@1.4.8
12+
- @ice/app@3.4.9
13+
314
## 5.0.0
415

516
### Patch Changes

packages/plugin-i18n/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ice/plugin-i18n",
3-
"version": "5.0.0",
3+
"version": "5.0.1",
44
"description": "I18n plugin for ice.js 3.",
55
"files": [
66
"es2017",
@@ -39,7 +39,7 @@
3939
"plugin"
4040
],
4141
"dependencies": {
42-
"@ice/jsx-runtime": "^0.2.2",
42+
"@ice/jsx-runtime": "^0.3.0",
4343
"@swc/helpers": "^0.5.1",
4444
"accept-language-parser": "^1.5.0",
4545
"universal-cookie": "^4.0.4",
@@ -56,8 +56,8 @@
5656
"webpack-dev-server": "4.15.0"
5757
},
5858
"peerDependencies": {
59-
"@ice/app": "^3.4.8",
60-
"@ice/runtime": "^1.4.7"
59+
"@ice/app": "^3.4.9",
60+
"@ice/runtime": "^1.4.8"
6161
},
6262
"publishConfig": {
6363
"access": "public"

packages/plugin-intl/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @ice/plugin-intl
22

3+
## 1.0.1
4+
5+
### Patch Changes
6+
7+
- d06826ef: feat: support get locale messages for global
8+
39
## 1.0.0
410

511
- Initial release

0 commit comments

Comments
 (0)