diff --git a/packages/ice/CHANGELOG.md b/packages/ice/CHANGELOG.md index 5e4b20ab03..83c2a6e4e1 100644 --- a/packages/ice/CHANGELOG.md +++ b/packages/ice/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 3.5.1 + +### Patch Changes + +- Updated dependencies [4130611d] +- Updated dependencies [2e274966] + - @ice/rspack-config@1.2.1 + - @ice/runtime@1.5.1 + ## 3.5.0 ### Minor Changes diff --git a/packages/ice/package.json b/packages/ice/package.json index 536c8614cc..baf4d45dfb 100644 --- a/packages/ice/package.json +++ b/packages/ice/package.json @@ -1,6 +1,6 @@ { "name": "@ice/app", - "version": "3.5.0", + "version": "3.5.1", "description": "provide scripts and configuration used by web framework ice", "type": "module", "main": "./esm/index.js", diff --git a/packages/jsx-runtime/CHANGELOG.md b/packages/jsx-runtime/CHANGELOG.md index 0f0c51b3d7..0ec7171d03 100644 --- a/packages/jsx-runtime/CHANGELOG.md +++ b/packages/jsx-runtime/CHANGELOG.md @@ -1,5 +1,11 @@ # @ice/jsx-runtime +## 0.3.1 + +### Patch Changes + +- 2e274966: fix: export createElement for backward compatibility + ## 0.3.0 ### Minor Changes diff --git a/packages/jsx-runtime/package.json b/packages/jsx-runtime/package.json index 45cd547e3b..73b9a80f07 100644 --- a/packages/jsx-runtime/package.json +++ b/packages/jsx-runtime/package.json @@ -1,6 +1,6 @@ { "name": "@ice/jsx-runtime", - "version": "0.3.0", + "version": "0.3.1", "description": "JSX runtime for ice.", "files": [ "esm", @@ -34,7 +34,8 @@ "jsx-runtime" ], "dependencies": { - "style-unit": "^3.0.4" + "style-unit": "^3.0.4", + "@swc/helpers": "^0.5.13" }, "devDependencies": { "@ice/pkg": "^1.5.0", diff --git a/packages/jsx-runtime/src/createElement.ts b/packages/jsx-runtime/src/createElement.ts new file mode 100644 index 0000000000..c3c36a56c9 --- /dev/null +++ b/packages/jsx-runtime/src/createElement.ts @@ -0,0 +1,5 @@ +import { createElement as reactCreateElement } from 'react'; +import { hijackElementProps } from './style.js'; +export function createElement(type: any, props: any, ...children: any[]) { + return reactCreateElement(type, hijackElementProps(props), ...children); +} diff --git a/packages/jsx-runtime/src/index.ts b/packages/jsx-runtime/src/index.ts index ef3801e929..7f3a8be528 100644 --- a/packages/jsx-runtime/src/index.ts +++ b/packages/jsx-runtime/src/index.ts @@ -1 +1,2 @@ export * from './prod.js'; +export { createElement } from './createElement.js'; diff --git a/packages/miniapp-react-dom/CHANGELOG.md b/packages/miniapp-react-dom/CHANGELOG.md index 436b7e9563..258c4168e9 100644 --- a/packages/miniapp-react-dom/CHANGELOG.md +++ b/packages/miniapp-react-dom/CHANGELOG.md @@ -1,5 +1,11 @@ # @ice/miniapp-react-dom +## 1.1.1 + +### Patch Changes + +- @ice/miniapp-runtime@1.2.1 + ## 1.1.0 ### Minor Changes diff --git a/packages/miniapp-react-dom/package.json b/packages/miniapp-react-dom/package.json index 25079f32ae..9b33cb679f 100644 --- a/packages/miniapp-react-dom/package.json +++ b/packages/miniapp-react-dom/package.json @@ -1,6 +1,6 @@ { "name": "@ice/miniapp-react-dom", - "version": "1.1.0", + "version": "1.1.1", "description": "like react-dom, but for miniapps.", "type": "module", "types": "./esm/index.d.ts", diff --git a/packages/miniapp-runtime/CHANGELOG.md b/packages/miniapp-runtime/CHANGELOG.md index e3048f9ee6..a6b450be7a 100644 --- a/packages/miniapp-runtime/CHANGELOG.md +++ b/packages/miniapp-runtime/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 1.2.1 + +### Patch Changes + +- Updated dependencies [2e274966] + - @ice/runtime@1.5.1 + ## 1.2.0 ### Minor Changes diff --git a/packages/miniapp-runtime/package.json b/packages/miniapp-runtime/package.json index dbbeb7a9dc..25e3c12971 100644 --- a/packages/miniapp-runtime/package.json +++ b/packages/miniapp-runtime/package.json @@ -1,6 +1,6 @@ { "name": "@ice/miniapp-runtime", - "version": "1.2.0", + "version": "1.2.1", "description": "ice runtime for miniapps.", "type": "module", "types": "./esm/index.d.ts", diff --git a/packages/plugin-i18n/package.json b/packages/plugin-i18n/package.json index 7614624159..12b8474fb6 100644 --- a/packages/plugin-i18n/package.json +++ b/packages/plugin-i18n/package.json @@ -39,7 +39,7 @@ "plugin" ], "dependencies": { - "@ice/jsx-runtime": "^0.3.0", + "@ice/jsx-runtime": "^0.3.1", "@swc/helpers": "^0.5.1", "accept-language-parser": "^1.5.0", "universal-cookie": "^4.0.4", @@ -56,8 +56,8 @@ "webpack-dev-server": "4.15.0" }, "peerDependencies": { - "@ice/app": "^3.5.0", - "@ice/runtime": "^1.5.0" + "@ice/app": "^3.5.1", + "@ice/runtime": "^1.5.1" }, "publishConfig": { "access": "public" diff --git a/packages/plugin-miniapp/CHANGELOG.md b/packages/plugin-miniapp/CHANGELOG.md index c1d7e8159c..cfad4a460a 100644 --- a/packages/plugin-miniapp/CHANGELOG.md +++ b/packages/plugin-miniapp/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.2.1 + +### Patch Changes + +- cce46e9b: fix: should check skeleton file existed before read + - @ice/miniapp-runtime@1.2.1 + - @ice/miniapp-react-dom@1.1.1 + ## 1.2.0 ### Minor Changes diff --git a/packages/plugin-miniapp/package.json b/packages/plugin-miniapp/package.json index 141fc129e5..72385208c2 100644 --- a/packages/plugin-miniapp/package.json +++ b/packages/plugin-miniapp/package.json @@ -1,6 +1,6 @@ { "name": "@ice/plugin-miniapp", - "version": "1.2.0", + "version": "1.2.1", "description": "ice.js plugin for miniapp.", "license": "MIT", "type": "module", @@ -50,8 +50,8 @@ "sax": "^1.2.4" }, "devDependencies": { - "@ice/app": "^3.5.0", - "@ice/runtime": "^1.5.0", + "@ice/app": "^3.5.1", + "@ice/runtime": "^1.5.1", "webpack": "^5.88.0" }, "repository": { diff --git a/packages/plugin-miniapp/src/miniapp/webpack/plugins/MiniPlugin.ts b/packages/plugin-miniapp/src/miniapp/webpack/plugins/MiniPlugin.ts index 4690f41855..c8638d62d2 100644 --- a/packages/plugin-miniapp/src/miniapp/webpack/plugins/MiniPlugin.ts +++ b/packages/plugin-miniapp/src/miniapp/webpack/plugins/MiniPlugin.ts @@ -588,6 +588,7 @@ export default class MiniPlugin { path: pagePath, isNative, stylePath: isNative ? this.getStylePath(pagePath) : undefined, + templatePath: isNative ? this.getTemplatePath(pagePath) : undefined, skeletonPath: isNative ? this.getSkeletonExtraPath(pagePath) : undefined, }; }), @@ -690,10 +691,10 @@ export default class MiniPlugin { } this.addEntry(path.resolve(__dirname, '..', 'template/custom-wrapper'), 'custom-wrapper', META_TYPE.STATIC); - const resolveComponentStyleEntry = (name: string, stylePaths: string[]) => { + const resolveComponentStyleEntry = (name: string, stylePaths: string[], ext = this.options.fileType.style) => { for (const stylePath of stylePaths) { if (fs.existsSync(stylePath)) { - this.addEntry(stylePath, this.getTargetFilePath(name, this.options.fileType.style), META_TYPE.NORMAL); + this.addEntry(stylePath, this.getTargetFilePath(name, ext), META_TYPE.NORMAL); break; } } @@ -709,12 +710,10 @@ export default class MiniPlugin { this.addEntry(item.templatePath, this.getTemplatePath(item.name), META_TYPE.NORMAL); } - if (item.skeletonPath) { - if (item.skeletonPath.template) { - this.addEntry(item.skeletonPath.template, this.getTargetFilePath(item.name, `${this.options.fileType.skeletonMidExt}${this.options.fileType.templ}`), META_TYPE.NORMAL); - } + if (item.skeletonPath && item.skeletonPath.template && fs.existsSync(item.skeletonPath.template)) { + this.addEntry(item.skeletonPath.template, this.getTargetFilePath(item.name, `${this.options.fileType.skeletonMidExt}${this.options.fileType.templ}`), META_TYPE.NORMAL); if (item.skeletonPath.style) { - resolveComponentStyleEntry(this.getTargetFilePath(item.name, this.options.fileType.skeletonMidExt), item.skeletonPath.style); + resolveComponentStyleEntry(item.name, item.skeletonPath.style, `${this.options.fileType.skeletonMidExt}${this.options.fileType.style}`); } } } else { diff --git a/packages/rspack-config/CHANGELOG.md b/packages/rspack-config/CHANGELOG.md index b93dac4cdd..851d046f47 100644 --- a/packages/rspack-config/CHANGELOG.md +++ b/packages/rspack-config/CHANGELOG.md @@ -1,5 +1,11 @@ # @ice/rspack-config +## 1.2.1 + +### Patch Changes + +- 4130611d: fix: update splitChunk config + ## 1.2.0 ### Minor Changes diff --git a/packages/rspack-config/package.json b/packages/rspack-config/package.json index 3cc4c88413..7068973f7c 100644 --- a/packages/rspack-config/package.json +++ b/packages/rspack-config/package.json @@ -1,6 +1,6 @@ { "name": "@ice/rspack-config", - "version": "1.2.0", + "version": "1.2.1", "repository": "alibaba/ice", "bugs": "https://github.com/alibaba/ice/issues", "homepage": "https://v3.ice.work", diff --git a/packages/rspack-config/src/splitChunks.ts b/packages/rspack-config/src/splitChunks.ts index b186bfb769..9d2787ee95 100644 --- a/packages/rspack-config/src/splitChunks.ts +++ b/packages/rspack-config/src/splitChunks.ts @@ -87,8 +87,9 @@ export const getVendorStrategy = (options: Configuration['splitChunks']) => { const getSplitChunks = (_: string, strategy: string | boolean) => { if (strategy === false) { - // Empty splitChunks configuration if strategy is false. - return {}; + // Set minChunks to a large number to disable the splitChunks feature. + // the value of Infinity is not work properly for this version of rspack. + return { minChunks: 100000, cacheGroups: { default: false } }; } else if (typeof strategy === 'string' && ['page-vendors', 'vendors'].includes(strategy)) { const splitChunksOptions = strategy === 'page-vendors' ? { chunks: 'all' } : {}; return getVendorStrategy(splitChunksOptions); diff --git a/packages/runtime/CHANGELOG.md b/packages/runtime/CHANGELOG.md index d46be14337..3f77edc906 100644 --- a/packages/runtime/CHANGELOG.md +++ b/packages/runtime/CHANGELOG.md @@ -1,5 +1,13 @@ # @ice/runtime +## 1.5.1 + +### Patch Changes + +- 2e274966: feat: support hook of onBeforeHydrate +- Updated dependencies [2e274966] + - @ice/jsx-runtime@0.3.1 + ## 1.5.0 ### Minor Changes diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 6ad53b6a39..8a18717a50 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@ice/runtime", - "version": "1.5.0", + "version": "1.5.1", "description": "Runtime module for ice.js", "type": "module", "types": "./esm/index.d.ts", @@ -54,7 +54,7 @@ "./esm/polyfills/abortcontroller.js" ], "dependencies": { - "@ice/jsx-runtime": "^0.3.0", + "@ice/jsx-runtime": "^0.3.1", "@ice/shared": "^1.1.0", "@remix-run/router": "1.14.2", "abortcontroller-polyfill": "1.7.5", diff --git a/packages/runtime/src/runClientApp.tsx b/packages/runtime/src/runClientApp.tsx index d354be4210..f268cb0d2e 100644 --- a/packages/runtime/src/runClientApp.tsx +++ b/packages/runtime/src/runClientApp.tsx @@ -120,6 +120,9 @@ export default async function runClientApp(options: RunClientAppOptions) { reportRecoverableError(error, errorInfo, { ignoreRuntimeWarning: revalidate }); }), }; + if (appConfig?.app?.onBeforeHydrate) { + appConfig?.app?.onBeforeHydrate(); + } return ReactDOM.hydrateRoot(container, element, hydrateOptions); }); } diff --git a/packages/runtime/src/types.ts b/packages/runtime/src/types.ts index 08e659e063..80f2adeeee 100644 --- a/packages/runtime/src/types.ts +++ b/packages/runtime/src/types.ts @@ -17,6 +17,7 @@ type App = Partial<{ strict: boolean; errorBoundary: boolean; onRecoverableError: (error: unknown, errorInfo: ErrorStack) => void; + onBeforeHydrate: () => void; } & Record>; export interface ErrorStack { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c144ba9985..de3814851c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1813,6 +1813,9 @@ importers: packages/jsx-runtime: dependencies: + '@swc/helpers': + specifier: ^0.5.13 + version: 0.5.13 style-unit: specifier: ^3.0.4 version: 3.0.5 @@ -1987,7 +1990,7 @@ importers: packages/plugin-i18n: dependencies: '@ice/jsx-runtime': - specifier: ^0.3.0 + specifier: ^0.3.1 version: link:../jsx-runtime '@swc/helpers': specifier: ^0.5.1 @@ -2154,10 +2157,10 @@ importers: version: 1.2.4 devDependencies: '@ice/app': - specifier: ^3.5.0 + specifier: ^3.5.1 version: link:../ice '@ice/runtime': - specifier: ^1.5.0 + specifier: ^1.5.1 version: link:../runtime webpack: specifier: ^5.88.0 @@ -2398,7 +2401,7 @@ importers: packages/runtime: dependencies: '@ice/jsx-runtime': - specifier: ^0.3.0 + specifier: ^0.3.1 version: link:../jsx-runtime '@ice/shared': specifier: ^1.1.0 @@ -8575,6 +8578,12 @@ packages: dependencies: tslib: 2.5.0 + /@swc/helpers@0.5.13: + resolution: {integrity: sha512-UoKGxQ3r5kYI9dALKJapMmuK+1zWM/H17Z1+iwnNmzcJRnfFuevZs375TA5rW31pu4BS4NoSy1fRsexDXfWn5w==} + dependencies: + tslib: 2.5.0 + dev: false + /@swc/types@0.1.4: resolution: {integrity: sha512-z/G02d+59gyyUb7KYhKi9jOhicek6QD2oMaotUyG+lUkybpXoV49dY9bj7Ah5Q+y7knK2jU67UTX9FyfGzaxQg==}