Skip to content

Commit 3236acd

Browse files
authored
Merge pull request #6481 from alibaba/release/next
Release 3.3.0
2 parents dd81060 + 48e3d8b commit 3236acd

File tree

127 files changed

+4063
-1312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+4063
-1312
lines changed

examples/app-config/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
"@types/react": "^18.0.0",
2525
"@types/react-dom": "^18.0.2",
2626
"speed-measure-webpack-plugin": "^1.5.0",
27-
"webpack": "^5.86.0"
27+
"webpack": "^5.88.0"
2828
}
2929
}

examples/basic-project/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
"@types/react": "^18.0.0",
2424
"@types/react-dom": "^18.0.2",
2525
"speed-measure-webpack-plugin": "^1.5.0",
26-
"webpack": "^5.86.0"
26+
"webpack": "^5.88.0"
2727
}
2828
}

examples/cavans-project/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
"devDependencies": {
2121
"@types/react": "^18.0.0",
2222
"@types/react-dom": "^18.0.0",
23-
"webpack": "^5.86.0"
23+
"webpack": "^5.88.0"
2424
}
2525
}

examples/csr-project/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"@types/react": "^18.0.0",
2222
"@types/react-dom": "^18.0.0",
2323
"speed-measure-webpack-plugin": "^1.5.0",
24-
"webpack": "^5.86.0"
24+
"webpack": "^5.88.0"
2525
}
2626
}

examples/disable-data-loader/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
"@types/react": "^18.0.0",
2525
"@types/react-dom": "^18.0.2",
2626
"speed-measure-webpack-plugin": "^1.5.0",
27-
"webpack": "^5.86.0"
27+
"webpack": "^5.88.0"
2828
}
2929
}

examples/miniapp-project/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
"@types/react-dom": "^18.0.2",
2929
"browserslist": "^4.19.3",
3030
"speed-measure-webpack-plugin": "^1.5.0",
31-
"webpack": "^5.86.0"
31+
"webpack": "^5.88.0"
3232
}
3333
}

examples/rax-inline-style/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
"devDependencies": {
2525
"@types/react": "^18.0.0",
2626
"@types/react-dom": "^18.0.2",
27-
"webpack": "^5.86.0"
27+
"webpack": "^5.88.0"
2828
}
2929
}

examples/rax-project/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
"devDependencies": {
2727
"@types/react": "^18.0.0",
2828
"@types/react-dom": "^18.0.2",
29-
"webpack": "^5.86.0"
29+
"webpack": "^5.88.0"
3030
}
3131
}

examples/with-entry-type/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
"fs-extra": "^10.0.0",
2020
"@types/react": "^18.0.0",
2121
"@types/react-dom": "^18.0.2",
22-
"webpack": "^5.86.0"
22+
"webpack": "^5.88.0"
2323
}
2424
}

examples/with-nested-routes/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
"@types/react": "^18.0.0",
2020
"@types/react-dom": "^18.0.0",
2121
"speed-measure-webpack-plugin": "^1.5.0",
22-
"webpack": "^5.86.0"
22+
"webpack": "^5.88.0"
2323
}
2424
}

examples/with-pha/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
"devDependencies": {
2020
"@types/react": "^18.0.0",
2121
"@types/react-dom": "^18.0.2",
22-
"webpack": "^5.86.0"
22+
"webpack": "^5.88.0"
2323
}
2424
}

examples/with-suspense-ssr/src/components/Comments.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ async function getData(ctx) {
3333
});
3434

3535
return fakeData;
36-
}
36+
}

packages/bundles/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 0.1.14
4+
5+
### Patch Changes
6+
7+
- 1dbcfa51: fix: bump @swc/core, webpack, swc plugins, core-js version
8+
39
## 0.1.13
410

511
### Patch Changes

packages/bundles/package.json

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ice/bundles",
3-
"version": "0.1.13",
3+
"version": "0.1.14",
44
"license": "MIT",
55
"author": "ICE",
66
"description": "Basic dependencies for ice.",
@@ -15,13 +15,13 @@
1515
"main": "./esm/index.js",
1616
"type": "module",
1717
"dependencies": {
18-
"@swc/core": "1.3.19",
19-
"@ice/swc-plugin-remove-export": "0.1.2",
20-
"@ice/swc-plugin-keep-export": "0.1.4-2",
21-
"@ice/swc-plugin-node-transform": "0.1.0-8",
18+
"@swc/core": "1.3.77",
19+
"@ice/swc-plugin-remove-export": "0.2.0",
20+
"@ice/swc-plugin-keep-export": "0.2.0",
21+
"@ice/swc-plugin-node-transform": "0.2.0",
2222
"ansi-html-community": "^0.0.8",
2323
"html-entities": "^2.3.2",
24-
"core-js": "3.29.1",
24+
"core-js": "3.32.0",
2525
"caniuse-lite": "^1.0.30001431",
2626
"chokidar": "3.5.3",
2727
"esbuild": "^0.17.16",
@@ -32,7 +32,10 @@
3232
"sass": "1.50.0",
3333
"react-refresh": "0.14.0",
3434
"core-js-pure": "^3.8.1",
35-
"error-stack-parser": "^2.0.6"
35+
"error-stack-parser": "^2.0.6",
36+
"@rspack/core": "0.2.12",
37+
"@rspack/dev-server": "0.2.12",
38+
"@ice/css-modules-hash": "0.0.6"
3639
},
3740
"devDependencies": {
3841
"@types/less": "^3.0.3",
@@ -65,7 +68,7 @@
6568
"terser-webpack-plugin": "5.3.5",
6669
"typescript": "^4.6.4",
6770
"trusted-cert": "1.1.3",
68-
"webpack": "5.86.0",
71+
"webpack": "5.88.2",
6972
"webpack-bundle-analyzer": "4.5.0",
7073
"webpack-dev-server": "4.15.0",
7174
"unplugin": "0.9.5",

packages/bundles/src/dev-server.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '@rspack/dev-server';

packages/bundles/src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import sass from 'sass';
66
import swc from '@swc/core';
77
import esbuild from 'esbuild';
88
import * as caniuseLite from 'caniuse-lite';
9+
import { getCssModulesLocalIdent } from '@ice/css-modules-hash';
910

1011
const require = createRequire(import.meta.url);
1112
const swcPluginRemoveExport = require.resolve('@ice/swc-plugin-remove-export');
@@ -26,6 +27,7 @@ export {
2627

2728
esbuild,
2829
caniuseLite,
30+
getCssModulesLocalIdent,
2931
};
3032

3133
export type { ProcessOptions } from 'postcss';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import runtime from 'react-refresh/runtime';
2+
3+
export default runtime;

packages/bundles/src/rspack.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '@rspack/core';

packages/ice/CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## 3.3.0
4+
5+
### Minor Changes
6+
7+
- f5d155b5: feat: support build by rust tools
8+
9+
### Patch Changes
10+
11+
- Updated dependencies [f5d155b5]
12+
- Updated dependencies [1dbcfa51]
13+
- @ice/webpack-config@1.1.0
14+
- @ice/bundles@0.1.14
15+
- @ice/rspack-config@1.0.1
16+
- @ice/shared-config@1.0.1
17+
318
## 3.2.10
419

520
### Patch Changes

packages/ice/bin/ice-cli.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
5757
.option('--analyzer', 'visualize size of output files', false)
5858
.option('--https [https]', 'enable https', false)
5959
.option('--force', 'force remove cache directory', false)
60+
.option('--speedup', 'speed up build time based on Rust tools', false)
6061
.action(async ({ rootDir, ...commandArgs }, ctx) => {
6162
renamePlatformToTarget(commandArgs);
6263
process.env.NODE_ENV = 'development';

packages/ice/package.json

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ice/app",
3-
"version": "3.2.10",
3+
"version": "3.3.0",
44
"description": "provide scripts and configuration used by web framework ice",
55
"type": "module",
66
"main": "./esm/index.js",
@@ -37,14 +37,16 @@
3737
"bugs": "https://github.com/alibaba/ice/issues",
3838
"homepage": "https://v3.ice.work",
3939
"dependencies": {
40-
"@ice/bundles": "0.1.13",
40+
"@ice/bundles": "0.1.14",
4141
"@ice/route-manifest": "1.2.1",
4242
"@ice/runtime": "^1.2.7",
43-
"@ice/webpack-config": "1.0.20",
43+
"@ice/shared-config": "1.0.1",
44+
"@ice/webpack-config": "1.1.0",
45+
"@ice/rspack-config": "1.0.1",
4446
"@swc/helpers": "0.5.1",
4547
"@types/express": "^4.17.14",
4648
"address": "^1.1.2",
47-
"build-scripts": "^2.1.1-0",
49+
"build-scripts": "^2.1.2-0",
4850
"chalk": "^4.0.0",
4951
"commander": "^9.0.0",
5052
"consola": "^2.15.3",
@@ -84,8 +86,10 @@
8486
"react-router": "6.14.2",
8587
"sass": "^1.50.0",
8688
"unplugin": "^0.9.0",
87-
"webpack": "^5.86.0",
88-
"webpack-dev-server": "^4.7.4"
89+
"webpack": "^5.88.0",
90+
"webpack-dev-server": "^4.7.4",
91+
"@rspack/core": "0.2.12",
92+
"@rspack/dev-server": "0.2.12"
8993
},
9094
"peerDependencies": {
9195
"react": ">=18.0.0",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import detectPort from 'detect-port';
2+
import type { CommandArgs } from 'build-scripts';
3+
import type { Configuration } from 'webpack-dev-server';
4+
import { DEFAULT_HOST, DEFAULT_PORT } from '../../constant.js';
5+
6+
async function getDefaultServerConfig(devServerConfig: Configuration, commandArgs: CommandArgs) {
7+
// Get the value of the host and port from the command line, environment variables, and webpack config.
8+
// Value priority: process.env.PORT > commandArgs > webpackConfig > DEFAULT.
9+
const host = process.env.HOST ||
10+
commandArgs.host ||
11+
devServerConfig?.host ||
12+
DEFAULT_HOST;
13+
const port = process.env.PORT ||
14+
commandArgs.port ||
15+
devServerConfig?.port ||
16+
await detectPort(DEFAULT_PORT);
17+
18+
return { host, port };
19+
}
20+
21+
export default getDefaultServerConfig;
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import type { TaskConfig } from 'build-scripts';
2+
import type { Config } from '@ice/shared-config/types';
3+
import type { AppConfig } from '@ice/runtime/types';
4+
import type { Configuration as DevServerConfiguration } from 'webpack-dev-server';
5+
import prepareURLs from '../../utils/prepareURLs.js';
6+
import getRouterBasename from '../../utils/getRouterBasename.js';
7+
8+
interface Options {
9+
taskConfig: TaskConfig<Config>;
10+
appConfig: AppConfig;
11+
devServerConfig: DevServerConfiguration;
12+
}
13+
14+
const getUrls = ({
15+
taskConfig,
16+
appConfig,
17+
devServerConfig,
18+
}: Options) => {
19+
const urlPathname = getRouterBasename(taskConfig, appConfig) || '/';
20+
const protocol = devServerConfig.https ? 'https' : 'http';
21+
const enabledHashRouter = appConfig.router?.type === 'hash';
22+
const urls = prepareURLs(
23+
protocol,
24+
devServerConfig.host,
25+
devServerConfig.port as number,
26+
urlPathname.endsWith('/') ? urlPathname : `${urlPathname}/`,
27+
enabledHashRouter,
28+
);
29+
30+
return urls;
31+
};
32+
33+
export default getUrls;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import type { Configuration as DevServerConfiguration } from 'webpack-dev-server';
2+
import type { TaskConfig } from 'build-scripts';
3+
import type { RenderMode } from '@ice/runtime';
4+
import type { Config } from '@ice/shared-config/types';
5+
import createMockMiddleware from '../../middlewares/mock/createMiddleware.js';
6+
import createRenderMiddleware from '../../middlewares/renderMiddleware.js';
7+
import type { UserConfig } from '../../types/userConfig.js';
8+
import type RouteManifest from '../../utils/routeManifest.js';
9+
import type { GetAppConfig } from '../../types/plugin.js';
10+
11+
interface SetupOptions {
12+
userConfig: UserConfig;
13+
taskConfig: TaskConfig<Config>;
14+
routeManifest: RouteManifest;
15+
getAppConfig: GetAppConfig;
16+
excuteServerEntry: () => Promise<any>;
17+
mock: boolean;
18+
rootDir: string;
19+
}
20+
21+
function setupMiddlewares(middlewares: Parameters<DevServerConfiguration['setupMiddlewares']>[0], {
22+
userConfig,
23+
taskConfig,
24+
routeManifest,
25+
getAppConfig,
26+
excuteServerEntry,
27+
mock,
28+
rootDir,
29+
}: SetupOptions) {
30+
const { ssr, ssg } = userConfig;
31+
let renderMode: RenderMode;
32+
// If ssr is set to true, use ssr for preview.
33+
if (ssr) {
34+
renderMode = 'SSR';
35+
} else if (ssg) {
36+
renderMode = 'SSG';
37+
}
38+
// Both ssr and ssg, should render the whole page in dev mode.
39+
const documentOnly = !ssr && !ssg;
40+
const serverRenderMiddleware = createRenderMiddleware({
41+
documentOnly,
42+
renderMode,
43+
getAppConfig,
44+
taskConfig,
45+
userConfig,
46+
routeManifest,
47+
excuteServerEntry,
48+
});
49+
// @ts-ignore property of name is exist.
50+
const insertIndex = middlewares.findIndex(({ name }) => name === 'serve-index');
51+
middlewares.splice(
52+
insertIndex, 0,
53+
serverRenderMiddleware,
54+
);
55+
56+
if (mock) {
57+
const mockMiddleware = createMockMiddleware({ rootDir, exclude: userConfig?.mock?.exclude });
58+
middlewares.splice(insertIndex, 0, mockMiddleware);
59+
}
60+
return middlewares;
61+
}
62+
63+
64+
export default setupMiddlewares;

0 commit comments

Comments
 (0)