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
|
# 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
|
## 3.6.3
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ice/app",
|
"name": "@ice/app",
|
||||||
"version": "3.6.3",
|
"version": "3.6.4",
|
||||||
"description": "provide scripts and configuration used by web framework ice",
|
"description": "provide scripts and configuration used by web framework ice",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./esm/index.js",
|
"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 isBaiduSmartProgram = isClient && import.meta.target === 'baidu-smartprogram';
|
||||||
export const isKuaiShouMiniProgram = isClient && import.meta.target === 'kuaishou-miniprogram';
|
export const isKuaiShouMiniProgram = isClient && import.meta.target === 'kuaishou-miniprogram';
|
||||||
export const isWeChatMiniProgram = isClient && import.meta.target === 'wechat-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 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.
|
// Following variables are runtime executed envs.
|
||||||
// See also @uni/env.
|
// See also @uni/env.
|
||||||
export const isPHA = isWeb && typeof pha === 'object';
|
|
||||||
const ua = typeof navigator === 'object' ? navigator.userAgent || navigator.swuserAgent : '';
|
const ua = typeof navigator === 'object' ? navigator.userAgent || navigator.swuserAgent : '';
|
||||||
const wvRegExp = /.+AliApp\((\w+)\/((?:\d+\.)+\d+)\).* .*(WindVane)(?:\/((?:\d+\.)+\d+))?.*/;
|
export const isThemis = /Themis/.test(ua);
|
||||||
export const isWindVane = wvRegExp.test(ua) && isWeb && typeof WindVane !== 'undefined' && typeof WindVane.call !== 'undefined';
|
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
|
// WindVane.call is a function while page importing lib-windvane
|
||||||
export const isFRM = isMiniApp && isWeb && typeof my !== 'undefined' && typeof my.isFRM !== 'undefined';
|
export const isFRM = isMiniApp && isWeb && typeof my !== 'undefined' && typeof my.isFRM !== 'undefined';
|
||||||
|
|
||||||
|
|
@ -27,14 +25,13 @@ export default {
|
||||||
isWeb,
|
isWeb,
|
||||||
isNode,
|
isNode,
|
||||||
isWeex,
|
isWeex,
|
||||||
isKraken,
|
isThemis,
|
||||||
isMiniApp,
|
isMiniApp,
|
||||||
isByteDanceMicroApp,
|
isByteDanceMicroApp,
|
||||||
isBaiduSmartProgram,
|
isBaiduSmartProgram,
|
||||||
isKuaiShouMiniProgram,
|
isKuaiShouMiniProgram,
|
||||||
isWeChatMiniProgram,
|
isWeChatMiniProgram,
|
||||||
isQuickApp,
|
isQuickApp,
|
||||||
isPHA,
|
|
||||||
isWindVane,
|
isWindVane,
|
||||||
isFRM,
|
isFRM,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,17 @@
|
||||||
# @ice/miniapp-react-dom
|
# @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
|
## 1.1.4
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ice/miniapp-react-dom",
|
"name": "@ice/miniapp-react-dom",
|
||||||
"version": "1.1.4",
|
"version": "1.1.6",
|
||||||
"description": "like react-dom, but for miniapps.",
|
"description": "like react-dom, but for miniapps.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./esm/index.d.ts",
|
"types": "./esm/index.d.ts",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,19 @@
|
||||||
# Changelog
|
# 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
|
## 1.2.4
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ice/miniapp-runtime",
|
"name": "@ice/miniapp-runtime",
|
||||||
"version": "1.2.4",
|
"version": "1.2.6",
|
||||||
"description": "ice runtime for miniapps.",
|
"description": "ice runtime for miniapps.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./esm/index.d.ts",
|
"types": "./esm/index.d.ts",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
# @ice/plugin-externals
|
# @ice/plugin-externals
|
||||||
|
|
||||||
|
## 1.0.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 4569200ca: fix: support externals field in assets-manifest
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
- Initial release
|
- Initial release
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ice/plugin-externals",
|
"name": "@ice/plugin-externals",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "plugin to make externals much easier in ice.js",
|
"description": "plugin to make externals much easier in ice.js",
|
||||||
"files": [
|
"files": [
|
||||||
"esm",
|
"esm",
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,8 @@
|
||||||
"webpack-dev-server": "4.15.0"
|
"webpack-dev-server": "4.15.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ice/app": "^3.6.3",
|
"@ice/app": "^3.6.4",
|
||||||
"@ice/runtime": "^1.5.3"
|
"@ice/runtime": "^1.5.6"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,19 @@
|
||||||
# Changelog
|
# 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
|
## 1.2.5
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ice/plugin-miniapp",
|
"name": "@ice/plugin-miniapp",
|
||||||
"version": "1.2.5",
|
"version": "1.2.7",
|
||||||
"description": "ice.js plugin for miniapp.",
|
"description": "ice.js plugin for miniapp.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
@ -50,8 +50,8 @@
|
||||||
"sax": "^1.2.4"
|
"sax": "^1.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ice/app": "^3.6.3",
|
"@ice/app": "^3.6.4",
|
||||||
"@ice/runtime": "^1.5.3",
|
"@ice/runtime": "^1.5.6",
|
||||||
"webpack": "^5.88.0"
|
"webpack": "^5.88.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
# @ice/plugin-stream-error
|
# @ice/plugin-stream-error
|
||||||
|
|
||||||
|
## 1.0.3
|
||||||
|
|
||||||
|
- feat: empty root element when stream error
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
### Major Changes
|
### Major Changes
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ice/plugin-stream-error",
|
"name": "@ice/plugin-stream-error",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,16 @@ import type { Plugin } from '@ice/app/types';
|
||||||
|
|
||||||
interface PluginOptions {
|
interface PluginOptions {
|
||||||
activeInDev?: boolean;
|
activeInDev?: boolean;
|
||||||
|
rootId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PLUGIN_NAME = '@ice/plugin-stream-error';
|
const PLUGIN_NAME = '@ice/plugin-stream-error';
|
||||||
const plugin: Plugin<PluginOptions> = (options = {}) => ({
|
const plugin: Plugin<PluginOptions> = (options = {
|
||||||
|
rootId: 'root',
|
||||||
|
}) => ({
|
||||||
name: PLUGIN_NAME,
|
name: PLUGIN_NAME,
|
||||||
setup: ({ generator, context }) => {
|
setup: ({ generator, context }) => {
|
||||||
const { activeInDev } = options;
|
const { activeInDev, rootId } = options;
|
||||||
const { userConfig } = context;
|
const { userConfig } = context;
|
||||||
if (userConfig.ssr) {
|
if (userConfig.ssr) {
|
||||||
generator.addEntryCode((originalCode) => {
|
generator.addEntryCode((originalCode) => {
|
||||||
|
|
@ -18,6 +21,11 @@ if (import.meta.renderer === 'client') {
|
||||||
// _$ServerTimePoints will returned at the end of last stream,
|
// _$ServerTimePoints will returned at the end of last stream,
|
||||||
// if the value is undefined, try to re-render app with CSR.
|
// 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') {
|
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 });
|
render({ hydrate: false });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,23 @@
|
||||||
# @ice/runtime
|
# @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
|
## 1.5.3
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@ice/runtime",
|
"name": "@ice/runtime",
|
||||||
"version": "1.5.3",
|
"version": "1.5.6",
|
||||||
"description": "Runtime module for ice.js",
|
"description": "Runtime module for ice.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./esm/index.d.ts",
|
"types": "./esm/index.d.ts",
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,11 @@ interface SuspenseProps {
|
||||||
[key: string]: any;
|
[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) {
|
export function withSuspense(Component) {
|
||||||
return (props: SuspenseProps) => {
|
return (props: SuspenseProps) => {
|
||||||
const { fallback, id, ...componentProps } = props;
|
const { fallback, id, ...componentProps } = props;
|
||||||
|
|
@ -153,15 +158,22 @@ export function withSuspense(Component) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Suspense fallback={fallback || null}>
|
<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}>
|
<SuspenseContext.Provider value={suspenseState}>
|
||||||
<Component {...componentProps} />
|
<Component {...componentProps} />
|
||||||
<Data id={id} />
|
<InlineScript
|
||||||
<script
|
id={`suspense-parse-data-${id}`}
|
||||||
dangerouslySetInnerHTML={{
|
script={`(${DISPATCH_SUSPENSE_EVENT_STRING})('ice-suspense-parse-data','${id}');`}
|
||||||
__html: `window.dispatchEvent(new CustomEvent('ice-suspense', { detail: { id: ${id ? `'${id}'` : undefined} } }));`,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
|
<Data id={id} />
|
||||||
</SuspenseContext.Provider>
|
</SuspenseContext.Provider>
|
||||||
|
<InlineScript
|
||||||
|
id={`suspense-parse-end-${id}`}
|
||||||
|
script={`(${DISPATCH_SUSPENSE_EVENT_STRING})('ice-suspense-parse-end','${id}');`}
|
||||||
|
/>
|
||||||
</React.Suspense>
|
</React.Suspense>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
@ -174,8 +186,25 @@ function Data(props) {
|
||||||
<script
|
<script
|
||||||
id={props.id && `suspense-script-${props.id}`}
|
id={props.id && `suspense-script-${props.id}`}
|
||||||
dangerouslySetInnerHTML={{
|
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
|
version: 1.2.4
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@ice/app':
|
'@ice/app':
|
||||||
specifier: ^3.6.3
|
specifier: ^3.6.4
|
||||||
version: link:../ice
|
version: link:../ice
|
||||||
'@ice/runtime':
|
'@ice/runtime':
|
||||||
specifier: ^1.5.3
|
specifier: ^1.5.6
|
||||||
version: link:../runtime
|
version: link:../runtime
|
||||||
webpack:
|
webpack:
|
||||||
specifier: ^5.88.0
|
specifier: ^5.88.0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue