mirror of https://github.com/alibaba/ice.git
Compare commits
11 Commits
e50cf46419
...
0f7bb5b770
Author | SHA1 | Date |
---|---|---|
|
0f7bb5b770 | |
|
0dd4aab050 | |
|
d55e34bc56 | |
|
b2d93c6ffe | |
|
bb60ab5a04 | |
|
412faf03d1 | |
|
72bfa88d17 | |
|
9b95b4c031 | |
|
22d1b49c9c | |
|
1a08895dc5 | |
|
1a0a2c1f61 |
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
'@ice/plugin-externals': patch
|
||||
'@ice/runtime': patch
|
||||
---
|
||||
|
||||
fix: support externals field in assets-manifest
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# @ice/plugin-stream-error
|
||||
|
||||
## 1.0.3
|
||||
|
||||
- feat: empty root element when stream error
|
||||
|
||||
## 1.0.0
|
||||
|
||||
### Major Changes
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@ice/plugin-stream-error",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
/>
|
||||
);
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue