Compare commits

...

11 Commits

Author SHA1 Message Date
ClarkXia 0f7bb5b770 chore: update versions
CI / build (16.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (16.x, windows-latest) (push) Has been cancelled Details
CI / build (18.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (18.x, windows-latest) (push) Has been cancelled Details
2025-07-22 08:55:15 +00:00
ZeroLing 0dd4aab050
重构内置 env.ts 实现 (#7124)
Publish canary / Publish Canary (18) (push) Blocked by required conditions Details
Publish canary / Check Changeset exists (push) Has been cancelled Details
CI / build (16.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (16.x, windows-latest) (push) Has been cancelled Details
CI / build (18.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (18.x, windows-latest) (push) Has been cancelled Details
Version / Version (16) (push) Has been cancelled Details
* refactor: add env for themis, delete PHA/Kraken, simplize WindVane

* chore: add changeset
2025-07-22 15:53:14 +08:00
Mixiu d55e34bc56
feat(runtime): add suspense event dispatch in Suspense component (#7122)
* feat(runtime): add suspense event dispatch in Suspense component

* chore(runtime): add changeset

* fix(runtime): Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(runtime): optimize Suspense component script rendering

* fix(runtime): move dispatchSuspenseEvent function outside of withSuspense in Suspense.tsx

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-22 15:47:58 +08:00
ClarkXia b2d93c6ffe Merge branch 'master' into release/next 2025-07-14 10:37:03 +08:00
ClarkXia bb60ab5a04
feat: support option rootId to empty root (#7031)
CI / build (16.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (16.x, windows-latest) (push) Has been cancelled Details
CI / build (18.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (18.x, windows-latest) (push) Has been cancelled Details
Coverage / coverage (16.x) (push) Has been cancelled Details
Release / Release (16) (push) Has been cancelled Details
2025-07-09 10:59:28 +08:00
ClarkXia 412faf03d1
Feat: support externals field in assets-manifest (#7116) (#7117)
* feat: support externals field in assets-manifest (#7116)

* chore: version

* chore: update version
2025-07-09 10:59:06 +08:00
ClarkXia 72bfa88d17 chore: update version
Publish canary / Check Changeset exists (push) Has been cancelled Details
CI / build (16.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (16.x, windows-latest) (push) Has been cancelled Details
CI / build (18.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (18.x, windows-latest) (push) Has been cancelled Details
Version / Version (16) (push) Has been cancelled Details
Publish canary / Publish Canary (18) (push) Has been cancelled Details
2025-07-08 19:24:32 +08:00
ClarkXia 9b95b4c031 Merge branch 'master' into release/next 2025-07-08 19:19:02 +08:00
ClarkXia 22d1b49c9c chore: version 2025-07-08 19:15:34 +08:00
ClarkXia 1a08895dc5
chore: update versions (#7115)
CI / build (16.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (16.x, windows-latest) (push) Has been cancelled Details
CI / build (18.x, ubuntu-latest) (push) Has been cancelled Details
CI / build (18.x, windows-latest) (push) Has been cancelled Details
Coverage / coverage (16.x) (push) Has been cancelled Details
Release / Release (16) (push) Has been cancelled Details
* chore: update versions

* Update package.json

* Update CHANGELOG.md
2025-07-02 16:35:46 +08:00
Mixiu 1a0a2c1f61
feat(runtime): add custom event for suspense data updates (#7112)
* feat(runtime): add custom event for suspense data updates

* feat(runtime): remove ice-suspense custom event

* chore(runtime): add changeset
2025-07-02 15:46:57 +08:00
20 changed files with 138 additions and 34 deletions

View File

@ -1,6 +0,0 @@
---
'@ice/plugin-externals': patch
'@ice/runtime': patch
---
fix: support externals field in assets-manifest

View File

@ -1,5 +1,13 @@
# Changelog
## 3.6.4
### Patch Changes
- 0dd4aab0: refactor: add env for themis, delete PHA/Kraken, simplize WindVane
- Updated dependencies [d55e34bc]
- @ice/runtime@1.5.6
## 3.6.3
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/app",
"version": "3.6.3",
"version": "3.6.4",
"description": "provide scripts and configuration used by web framework ice",
"type": "module",
"main": "./esm/index.js",

View File

@ -9,16 +9,14 @@ export const isByteDanceMicroApp = isClient && import.meta.target === 'bytedance
export const isBaiduSmartProgram = isClient && import.meta.target === 'baidu-smartprogram';
export const isKuaiShouMiniProgram = isClient && import.meta.target === 'kuaishou-miniprogram';
export const isWeChatMiniProgram = isClient && import.meta.target === 'wechat-miniprogram';
export const isKraken = isClient && import.meta.target === 'kraken';
export const isQuickApp = false; // Now ice.js will not implement quick app target.
export const isMiniApp = isAliMiniApp;// in universal-env, isMiniApp is equals to isAliMiniApp
export const isMiniApp = isAliMiniApp; // in universal-env, isMiniApp is equals to isAliMiniApp
// Following variables are runtime executed envs.
// See also @uni/env.
export const isPHA = isWeb && typeof pha === 'object';
const ua = typeof navigator === 'object' ? navigator.userAgent || navigator.swuserAgent : '';
const wvRegExp = /.+AliApp\((\w+)\/((?:\d+\.)+\d+)\).* .*(WindVane)(?:\/((?:\d+\.)+\d+))?.*/;
export const isWindVane = wvRegExp.test(ua) && isWeb && typeof WindVane !== 'undefined' && typeof WindVane.call !== 'undefined';
export const isThemis = /Themis/.test(ua);
export const isWindVane = /WindVane/i.test(ua) && isWeb && typeof WindVane !== 'undefined' && typeof WindVane.call !== 'undefined';
// WindVane.call is a function while page importing lib-windvane
export const isFRM = isMiniApp && isWeb && typeof my !== 'undefined' && typeof my.isFRM !== 'undefined';
@ -27,14 +25,13 @@ export default {
isWeb,
isNode,
isWeex,
isKraken,
isThemis,
isMiniApp,
isByteDanceMicroApp,
isBaiduSmartProgram,
isKuaiShouMiniProgram,
isWeChatMiniProgram,
isQuickApp,
isPHA,
isWindVane,
isFRM,
};

View File

@ -1,5 +1,17 @@
# @ice/miniapp-react-dom
## 1.1.6
### Patch Changes
- @ice/miniapp-runtime@1.2.6
## 1.1.5
### Patch Changes
- @ice/miniapp-runtime@1.2.5
## 1.1.4
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/miniapp-react-dom",
"version": "1.1.4",
"version": "1.1.6",
"description": "like react-dom, but for miniapps.",
"type": "module",
"types": "./esm/index.d.ts",

View File

@ -1,5 +1,19 @@
# Changelog
## 1.2.6
### Patch Changes
- Updated dependencies [d55e34bc]
- @ice/runtime@1.5.6
## 1.2.5
### Patch Changes
- Updated dependencies [1a0a2c1f]
- @ice/runtime@1.5.4
## 1.2.4
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/miniapp-runtime",
"version": "1.2.4",
"version": "1.2.6",
"description": "ice runtime for miniapps.",
"type": "module",
"types": "./esm/index.d.ts",

View File

@ -1,5 +1,11 @@
# @ice/plugin-externals
## 1.0.1
### Patch Changes
- 4569200ca: fix: support externals field in assets-manifest
## 1.0.0
- Initial release

View File

@ -1,6 +1,6 @@
{
"name": "@ice/plugin-externals",
"version": "1.0.0",
"version": "1.0.1",
"description": "plugin to make externals much easier in ice.js",
"files": [
"esm",

View File

@ -56,8 +56,8 @@
"webpack-dev-server": "4.15.0"
},
"peerDependencies": {
"@ice/app": "^3.6.3",
"@ice/runtime": "^1.5.3"
"@ice/app": "^3.6.4",
"@ice/runtime": "^1.5.6"
},
"publishConfig": {
"access": "public"

View File

@ -1,5 +1,19 @@
# Changelog
## 1.2.7
### Patch Changes
- @ice/miniapp-runtime@1.2.6
- @ice/miniapp-react-dom@1.1.6
## 1.2.6
### Patch Changes
- @ice/miniapp-runtime@1.2.5
- @ice/miniapp-react-dom@1.1.5
## 1.2.5
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/plugin-miniapp",
"version": "1.2.5",
"version": "1.2.7",
"description": "ice.js plugin for miniapp.",
"license": "MIT",
"type": "module",
@ -50,8 +50,8 @@
"sax": "^1.2.4"
},
"devDependencies": {
"@ice/app": "^3.6.3",
"@ice/runtime": "^1.5.3",
"@ice/app": "^3.6.4",
"@ice/runtime": "^1.5.6",
"webpack": "^5.88.0"
},
"repository": {

View File

@ -1,5 +1,9 @@
# @ice/plugin-stream-error
## 1.0.3
- feat: empty root element when stream error
## 1.0.0
### Major Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/plugin-stream-error",
"version": "1.0.2",
"version": "1.0.3",
"description": "",
"license": "MIT",
"type": "module",

View File

@ -2,13 +2,16 @@ import type { Plugin } from '@ice/app/types';
interface PluginOptions {
activeInDev?: boolean;
rootId?: string;
}
const PLUGIN_NAME = '@ice/plugin-stream-error';
const plugin: Plugin<PluginOptions> = (options = {}) => ({
const plugin: Plugin<PluginOptions> = (options = {
rootId: 'root',
}) => ({
name: PLUGIN_NAME,
setup: ({ generator, context }) => {
const { activeInDev } = options;
const { activeInDev, rootId } = options;
const { userConfig } = context;
if (userConfig.ssr) {
generator.addEntryCode((originalCode) => {
@ -18,6 +21,11 @@ if (import.meta.renderer === 'client') {
// _$ServerTimePoints will returned at the end of last stream,
// if the value is undefined, try to re-render app with CSR.
if (${activeInDev ? '' : 'process.env.NODE_ENV === \'production\' && '}!window._$ServerTimePoints && window.__ICE_APP_CONTEXT__.renderMode === 'SSR') {
const root = document.getElementById('${rootId}');
if (root) {
root.innerHTML = '';
}
window.__ICE_APP_CONTEXT__.renderMode = 'CSR';
render({ hydrate: false });
}
});

View File

@ -1,5 +1,23 @@
# @ice/runtime
## 1.5.6
### Patch Changes
- d55e34bc: feat: add suspense event dispatch in Suspense component
## 1.5.5
### Patch Changes
- 4569200ca: fix: support externals field in assets-manifest
## 1.5.4
### Patch Changes
- 1a0a2c1f: feat: Add custom event for suspense data updates, and remove ice-suspense custom event.
## 1.5.3
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/runtime",
"version": "1.5.3",
"version": "1.5.6",
"description": "Runtime module for ice.js",
"type": "module",
"types": "./esm/index.d.ts",

View File

@ -126,6 +126,11 @@ interface SuspenseProps {
[key: string]: any;
}
function dispatchSuspenseEvent(event: string, id: string) {
window.dispatchEvent(new CustomEvent(event, { detail: { id } }));
}
const DISPATCH_SUSPENSE_EVENT_STRING = dispatchSuspenseEvent.toString();
export function withSuspense(Component) {
return (props: SuspenseProps) => {
const { fallback, id, ...componentProps } = props;
@ -153,15 +158,22 @@ export function withSuspense(Component) {
return (
<React.Suspense fallback={fallback || null}>
<InlineScript
id={`suspense-parse-start-${id}`}
script={`(${DISPATCH_SUSPENSE_EVENT_STRING})('ice-suspense-parse-start','${id}');`}
/>
<SuspenseContext.Provider value={suspenseState}>
<Component {...componentProps} />
<Data id={id} />
<script
dangerouslySetInnerHTML={{
__html: `window.dispatchEvent(new CustomEvent('ice-suspense', { detail: { id: ${id ? `'${id}'` : undefined} } }));`,
}}
<InlineScript
id={`suspense-parse-data-${id}`}
script={`(${DISPATCH_SUSPENSE_EVENT_STRING})('ice-suspense-parse-data','${id}');`}
/>
<Data id={id} />
</SuspenseContext.Provider>
<InlineScript
id={`suspense-parse-end-${id}`}
script={`(${DISPATCH_SUSPENSE_EVENT_STRING})('ice-suspense-parse-end','${id}');`}
/>
</React.Suspense>
);
};
@ -174,8 +186,25 @@ function Data(props) {
<script
id={props.id && `suspense-script-${props.id}`}
dangerouslySetInnerHTML={{
__html: `!function(){window['${LOADER}'] = window['${LOADER}'] || {};window['${LOADER}']['${props.id}'] = ${JSON.stringify(data)}}();`,
__html: `!function(){window['${LOADER}'] = window['${LOADER}'] || {};window['${LOADER}']['${props.id}'] = ${JSON.stringify(data)}}();window.dispatchEvent(new CustomEvent('ice-suspense-data', { detail: { id: ${props.id ? `'${props.id}'` : undefined} } }));`,
}}
/>
);
}
interface InlineScriptProps {
id: string;
script: string;
}
function InlineScript(props: InlineScriptProps) {
return (
<script
id={props.id}
dangerouslySetInnerHTML={{
__html: props.script,
}}
suppressHydrationWarning
/>
);
}

View File

@ -2157,10 +2157,10 @@ importers:
version: 1.2.4
devDependencies:
'@ice/app':
specifier: ^3.6.3
specifier: ^3.6.4
version: link:../ice
'@ice/runtime':
specifier: ^1.5.3
specifier: ^1.5.6
version: link:../runtime
webpack:
specifier: ^5.88.0