Compare commits

...

23 Commits

Author SHA1 Message Date
ClarkXia e50cf46419
Update package.json
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-08 19:09:56 +08:00
ClarkXia 763a1e6602
Update CHANGELOG.md 2025-07-08 19:09:41 +08:00
ClarkXia 3d762f58b9
Update package.json 2025-07-08 19:09:18 +08:00
ClarkXia a257d585af
Update CHANGELOG.md 2025-07-08 19:09:01 +08:00
ClarkXia 096fa4ee7c
Update package.json 2025-07-08 19:07:32 +08:00
ClarkXia 29f0a171ca
Update package.json 2025-07-08 19:07:02 +08:00
ClarkXia d9a2e91f5c
Update package.json 2025-07-08 19:06:22 +08:00
ClarkXia f177d1b22e
Update package.json 2025-07-08 19:05:42 +08:00
ClarkXia 49c7c19974
Update CHANGELOG.md 2025-07-08 19:05:29 +08:00
ClarkXia e82fa0f7b9 chore: update versions 2025-07-08 11:04:30 +00:00
ClarkXia 4569200caf
feat: support externals field in assets-manifest (#7116)
Publish canary / Check Changeset exists (push) Waiting to run Details
Publish canary / Publish Canary (18) (push) Blocked by required conditions Details
CI / build (16.x, ubuntu-latest) (push) Waiting to run Details
CI / build (16.x, windows-latest) (push) Waiting to run Details
CI / build (18.x, ubuntu-latest) (push) Waiting to run Details
CI / build (18.x, windows-latest) (push) Waiting to run Details
Version / Version (16) (push) Waiting to run Details
2025-07-08 16:40:00 +08:00
ClarkXia 22b10c0d1c
chore: update versions (#7113)
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-01 09:53:00 +08:00
ClarkXia cc0792b0fd
feat: support custom props when render document (#7099)
CI / build (16.x, ubuntu-latest) (push) Waiting to run Details
CI / build (16.x, windows-latest) (push) Waiting to run Details
CI / build (18.x, ubuntu-latest) (push) Waiting to run Details
CI / build (18.x, windows-latest) (push) Waiting to run Details
Coverage / coverage (16.x) (push) Waiting to run Details
Release / Release (16) (push) Waiting to run Details
* feat: support custom props when render document

* Update packages/runtime/src/types.ts

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

* Update packages/runtime/src/renderDocument.tsx

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

* fix: test case

* Update runServerApp.tsx

* fix: optimize props

* chore: optimize code

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-30 11:17:22 +08:00
ClarkXia 80250ffe6e
chore: update versions (#7094)
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
Build Website / build-and-deploy (push) Has been cancelled Details
2025-06-24 10:49:09 +08:00
ClarkXia 3a02e7be8e
Release@3.6.2 (#7109)
* fix: jsxplugs transform (#7076)

* fix: jsxplugs transform

* chore: change set

* Feat: add support for custom loaders in rspack configuration (#7078)

* feat: add support for custom loaders in rspack configuration

* chore: changeset

* fix: miniapp using absolute path to match route manifest (#7095)

* fix(miniapp-runtime): enter same page twice then exit should not throw error (#7104)

* fix: rename dropLog to dropLogLevel  in config.md (#7103)

* chore: update @swc/helpers to 0.5.17 (#7106)

* Fix/provide (#7097)

* feat: parse inject file

* feat: compileIncludes

* chore: change set

* feat: getexportsvariable

* chore: update versions (#7077)

---------

Co-authored-by: Homyee King <HomyeeKing@gmail.com>
Co-authored-by: XGHeaven <xgheaven@gmail.com>
Co-authored-by: Frank <405267330@qq.com>
2025-06-24 10:42:01 +08:00
ClarkXia ebf15cd8c5
chore: update versions (#7077)
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-06-24 10:10:55 +08:00
Homyee King 795c1986f3
Fix/provide (#7097)
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
* feat: parse inject file

* feat: compileIncludes

* chore: change set

* feat: getexportsvariable
2025-06-12 15:54:50 +08:00
Psiphonc 4334c40409
Merge pull request #7092 from alibaba/fix/weex-appear-cb
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
fix: fix appear event handler callback refs in WeexAppear component
2025-05-13 15:09:57 +08:00
yangchang fb013fd43f chore: move handler callback defs inside effect 2025-05-13 14:40:23 +08:00
yangchang 451839c5c7 chore: add changeset 2025-05-12 17:05:23 +08:00
yangchang 76ed8ffbc5 fix: fix appear event handler callback refs in WeexAppear component 2025-05-12 16:50:46 +08:00
Phanendra Guptha Katta b719564cd9
Update development.md (#7071)
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
Release / Release (16) (push) Has been cancelled Details
Build Website / build-and-deploy (push) Has been cancelled Details
2025-04-16 13:40:35 +08:00
ClarkXia 3a99b620cf
chore: update plugin option type of plugin-icestark (#7079)
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-04-14 20:07:42 +08:00
46 changed files with 265 additions and 75 deletions

View File

@ -1,8 +0,0 @@
---
'@ice/jsx-runtime': patch
'@ice/plugin-i18n': patch
'rax-compat': patch
'@ice/app': patch
---
chore: update @swc/helpers to 0.5.17

View File

@ -1,5 +0,0 @@
---
'@ice/rspack-config': patch
---
feat: add support for custom loaders in rspack configuration

View File

@ -1,5 +0,0 @@
---
'@ice/plugin-miniapp': patch
---
fix: miniapp using absolute path to match route manifest

View File

@ -1,5 +0,0 @@
---
'@ice/miniapp-runtime': patch
---
fix: enter same page twice then exit should not throw error

View File

@ -1,5 +0,0 @@
---
'@ice/app': patch
---
fix: missing jsx-plus transform when server bundler is webpack

View File

@ -1,5 +1,11 @@
# @ice/appear
## 0.2.2
### Patch Changes
- 451839c5: fix appear event handler callback refs in WeexAppear component
## 0.2.1
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/appear",
"version": "0.2.1",
"version": "0.2.2",
"description": "",
"main": "./esm/index.js",
"types": "./esm/index.d.ts",

View File

@ -12,21 +12,28 @@ const WeexAppear = forwardRef<any, AppearProps>((props, ref) => {
// Use copy of childrenRef to avoid ref value changed in cleanup phase.
const nodeRef = typeof childrenRef === 'object' ? childrenRef.current : null;
const appearHandler = (e: CustomEvent) => {
onAppear?.(e);
};
// Return early if onAppear callback not specified.
onAppear && nodeRef?.addEventListener('appear', (e: CustomEvent) => onAppear(e));
onAppear && nodeRef?.addEventListener('appear', appearHandler);
return () => {
onAppear && nodeRef?.removeEventListener('appear', (e: CustomEvent) => onAppear(e));
onAppear && nodeRef?.removeEventListener('appear', appearHandler);
};
}, [childrenRef, onAppear]);
useEffect(() => {
const nodeRef = typeof childrenRef === 'object' ? childrenRef.current : null;
onDisappear && nodeRef?.addEventListener('disappear', (e: CustomEvent) => onDisappear(e));
const disappearHandler = (e: CustomEvent) => {
onDisappear?.(e);
};
onDisappear && nodeRef?.addEventListener('disappear', disappearHandler);
return () => {
onDisappear && nodeRef?.removeEventListener('disappear', (e: CustomEvent) => onDisappear(e));
onDisappear && nodeRef?.removeEventListener('disappear', disappearHandler);
};
}, [childrenRef, onDisappear]);

View File

@ -1,5 +1,25 @@
# Changelog
## 3.6.3
### Patch Changes
- cc0792b0: fix: minify server bundle when build in prod
- Updated dependencies [cc0792b0]
- @ice/runtime@1.5.3
## 3.6.2
### Patch Changes
- 41951673: chore: update @swc/helpers to 0.5.17
- 795c1986: fix: compat esbuild config
- use AST to get file exports instead of using import()
- respect compileDependencies in webpack mode
- 59414ba4: fix: missing jsx-plus transform when server bundler is webpack
- Updated dependencies [182929ca]
- @ice/rspack-config@1.2.4
## 3.6.1
### Patch Changes

View File

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

View File

@ -184,6 +184,7 @@ export function createServerCompiler(options: Options) {
// while it is not recommended
loader: { '.js': 'jsx' },
jsx: 'automatic',
minify: !dev,
sourcemap: typeof sourceMap === 'boolean'
// Transform sourceMap for esbuild.
? sourceMap : (sourceMap.includes('inline') ? 'inline' : !!sourceMap),

View File

@ -6,6 +6,7 @@ import type { UserConfig } from '../../types/userConfig.js';
import { logger } from '../../utils/logger.js';
import { getExpandedEnvs } from '../../utils/runtimeEnv.js';
import { RUNTIME_TMP_DIR } from '../../constant.js';
import { getExportsVariables } from '../../utils/getExportsVariables.js';
const _dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url));
@ -17,11 +18,12 @@ export class WebpackServerCompiler {
}
private async createWebpackConfig(options: {
compileIncludes: Array<RegExp>;
userServerConfig: UserConfig['server'];
rootDir: string;
[key: string]: any;
}) {
const { userServerConfig } = options;
const { userServerConfig, compileIncludes } = options;
const { webpackConfig = {} } = userServerConfig;
const definitions = await this.getEsbuildInject();
return getWebpackConfig({
@ -63,7 +65,7 @@ export class WebpackServerCompiler {
define: options.define,
optimization: { ...webpackConfig.optimization } as any,
minify: options.minify,
compileIncludes: webpackConfig.transformInclude,
compileIncludes,
swcOptions: {
compilationConfig: {
jsc: {
@ -90,9 +92,9 @@ export class WebpackServerCompiler {
private async getEsbuildInject(): Promise<Record<string, string | string[]>> {
const provideRecord = {};
const allInjects = await Promise.all(this.options.inject.map((inj) => import(inj)));
const allInjects = await Promise.all(this.options.inject.map((inj) => getExportsVariables(inj)));
allInjects.forEach((injs, index) => {
Object.keys(injs).forEach((key) => {
injs.forEach((key) => {
provideRecord[key] = [this.options.inject[index], key];
});
});

View File

@ -251,14 +251,7 @@ export interface UserConfig {
/**
* webpack config, only works when bundler is webpack
*/
webpackConfig?: Pick<WebpackConfiguration, 'plugins' | 'optimization' | 'output' | 'module'> & {
/**
* we exclude the node_modules/* by default
*
* use this if you need to transform some packages inside of node_modues
*/
transformInclude?: Array<RegExp | string>;
};
webpackConfig?: Pick<WebpackConfiguration, 'plugins' | 'optimization' | 'output' | 'module'>;
};
/**
* Optimization options for build.

View File

@ -0,0 +1,59 @@
import fs from 'fs';
import { swc } from '@ice/bundles';
/**
* Parses a JavaScript file and extracts all named exports.
*
* @param {string} filePath The path to the JavaScript file.
* @returns {Promise<string[]>} A promise that resolves to an array of collected export names.
*/
export async function getExportsVariables(filePath: string) {
const fileContent = await fs.promises.readFile(filePath, 'utf-8');
const ast = await swc.parse(fileContent, {
syntax: 'ecmascript', // or 'typescript' if you might have TypeScript files
jsx: true, // Set to true if you might have JSX
});
const exportNames = new Set();
for (const node of ast.body) {
if (node.type === 'ExportDeclaration') {
// Handles: export const a = 1; export class MyClass {}
if (node.declaration) {
if (node.declaration.type === 'VariableDeclaration') {
for (const declarator of node.declaration.declarations) {
if (declarator.id.type === 'Identifier') {
exportNames.add(declarator.id.value);
} else if (declarator.id.type === 'ObjectPattern') {
// Handles object destructuring in export: export const { a, b } = {};
for (const prop of declarator.id.properties) {
if (prop.type === 'Property' && prop.key.type === 'Identifier') {
exportNames.add(prop.key.value);
}
}
}
}
} else if (node.declaration.type === 'FunctionDeclaration' || node.declaration.type === 'ClassDeclaration') {
if (node.declaration.identifier) {
exportNames.add(node.declaration.identifier.value);
}
}
}
} else if (node.type === 'ExportNamedDeclaration') {
// Handles: export { foo } from './foo'; export { foo as foo1 };
// export * as aaa from './aaa'
for (const specifier of node.specifiers) {
if (specifier.type === 'ExportSpecifier') {
exportNames.add((specifier.exported || specifier.orig).value);
} else if (specifier.type === 'ExportNamespaceSpecifier') {
exportNames.add(specifier.name.value);
}
}
} else if (node.type === 'ExportDefaultExpression') {
// Handles: export default ...
exportNames.add('default');
}
}
return Array.from(exportNames);
}

View File

@ -59,6 +59,7 @@ interface RenderOptions {
publicPath?: string;
serverData?: any;
streamOptions?: RenderToPipeableStreamOptions;
documentProps?: Record<string, unknown>;
}
export async function renderToHTML(requestContext, options: RenderOptions = {}) {

11
packages/ice/tests/fixtures/exports.ts vendored Normal file
View File

@ -0,0 +1,11 @@
// @ts-nocheck
export const a = 1;
export function myFunc() {}
export class MyClass {}
const b = 2;
export { b as c, myFunc as anotherFunc };
export { foo } from './foo';
export { default as bar } from './bar';
export default 'hello';
export { baz as qux } from './baz';
export * as aaa from './aaa'

View File

@ -0,0 +1,11 @@
import path from 'path';
import { fileURLToPath } from 'url';
import { expect, test } from 'vitest';
import { getExportsVariables } from '../src/utils/getExportsVariables';
const __dirname = fileURLToPath(path.dirname(import.meta.url));
test('getExportsVariables', async () => {
const exports = await getExportsVariables(path.resolve(__dirname, './fixtures/exports.ts'));
expect(exports).toStrictEqual(['a', 'myFunc', 'MyClass', 'c', 'anotherFunc', 'foo', 'bar', 'default', 'qux', 'aaa']);
});

View File

@ -1,5 +1,11 @@
# @ice/jsx-runtime
## 0.3.2
### Patch Changes
- 41951673: chore: update @swc/helpers to 0.5.17
## 0.3.1
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/jsx-runtime",
"version": "0.3.1",
"version": "0.3.2",
"description": "JSX runtime for ice.",
"files": [
"esm",

View File

@ -1,5 +1,18 @@
# @ice/miniapp-react-dom
## 1.1.4
### Patch Changes
- @ice/miniapp-runtime@1.2.4
## 1.1.3
### Patch Changes
- Updated dependencies [d27ad76c]
- @ice/miniapp-runtime@1.2.3
## 1.1.2
### Patch Changes

View File

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

View File

@ -1,5 +1,18 @@
# Changelog
## 1.2.4
### Patch Changes
- Updated dependencies [cc0792b0]
- @ice/runtime@1.5.3
## 1.2.3
### Patch Changes
- d27ad76c: fix: enter same page twice then exit should not throw error
## 1.2.2
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/miniapp-runtime",
"version": "1.2.2",
"version": "1.2.4",
"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
- 4569200c: 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",
@ -21,7 +21,7 @@
},
"devDependencies": {
"@ice/app": "^3.3.2",
"@ice/runtime": "^1.2.9",
"@ice/runtime": "^1.5.4",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"webpack": "^5.88.0"

View File

@ -26,7 +26,9 @@ export default class InjectExternalScriptsWebpackPlugin {
if (assetsManifest) {
const json = JSON.parse(assetsManifest.source().toString());
delete compilation.assets[ASSET_MANIFEST_JSON_NAME];
json.entries.main.unshift(...this.options.externals);
// Ensure externals array exists and add new externals at the beginning.
json.externals ||= [];
json.externals.unshift(...this.options.externals);
compilation.emitAsset(
ASSET_MANIFEST_JSON_NAME,
new webpack.sources.RawSource(JSON.stringify(json)),

View File

@ -1,5 +1,16 @@
# @ice/plugin-i18n
## 5.0.2
### Patch Changes
- 41951673: chore: update @swc/helpers to 0.5.17
- Updated dependencies [41951673]
- Updated dependencies [795c1986]
- Updated dependencies [59414ba4]
- @ice/jsx-runtime@0.3.2
- @ice/app@3.6.2
## 5.0.1
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/plugin-i18n",
"version": "5.0.1",
"version": "5.0.2",
"description": "I18n plugin for ice.js 3.",
"files": [
"es2017",
@ -39,7 +39,7 @@
"plugin"
],
"dependencies": {
"@ice/jsx-runtime": "^0.3.1",
"@ice/jsx-runtime": "^0.3.2",
"@swc/helpers": "^0.5.17",
"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.6.1",
"@ice/runtime": "^1.5.2"
"@ice/app": "^3.6.3",
"@ice/runtime": "^1.5.4"
},
"publishConfig": {
"access": "public"

View File

@ -1,5 +1,9 @@
# Changelog
## 1.2.1
- fix: plugin type definition of `library`
## 1.2.0
### Minor Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/plugin-icestark",
"version": "1.2.0",
"version": "1.2.1",
"description": "Easy use `icestark` in icejs.",
"author": "ice-admin@alibaba-inc.com",
"homepage": "",

View File

@ -2,7 +2,7 @@ import type { Plugin } from '@ice/app/types';
interface PluginOptions {
type: 'child' | 'framework';
library?: string;
library?: string | string[];
}
const PLUGIN_NAME = '@ice/plugin-icestark';

View File

@ -1,5 +1,28 @@
# Changelog
## 1.2.6
### Patch Changes
- @ice/miniapp-runtime@1.2.5
- @ice/miniapp-react-dom@1.1.5
## 1.2.5
### Patch Changes
- @ice/miniapp-runtime@1.2.4
- @ice/miniapp-react-dom@1.1.4
## 1.2.4
### Patch Changes
- 3670eadc: fix: miniapp using absolute path to match route manifest
- Updated dependencies [d27ad76c]
- @ice/miniapp-runtime@1.2.3
- @ice/miniapp-react-dom@1.1.3
## 1.2.3
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/plugin-miniapp",
"version": "1.2.3",
"version": "1.2.6",
"description": "ice.js plugin for miniapp.",
"license": "MIT",
"type": "module",
@ -50,8 +50,8 @@
"sax": "^1.2.4"
},
"devDependencies": {
"@ice/app": "^3.6.1",
"@ice/runtime": "^1.5.2",
"@ice/app": "^3.6.3",
"@ice/runtime": "^1.5.4",
"webpack": "^5.88.0"
},
"repository": {

View File

@ -1,5 +1,11 @@
# Changelog
## 0.4.1
### Patch Changes
- 41951673: chore: update @swc/helpers to 0.5.17
## 0.4.0
### Minor Changes

View File

@ -1,6 +1,6 @@
{
"name": "rax-compat",
"version": "0.4.0",
"version": "0.4.1",
"description": "Rax compatible mode, running rax project on the react runtime.",
"files": [
"esm",

View File

@ -1,5 +1,11 @@
# @ice/rspack-config
## 1.2.4
### Patch Changes
- 182929ca: feat: add support for custom loaders in rspack configuration
## 1.2.3
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@ice/rspack-config",
"version": "1.2.3",
"version": "1.2.4",
"repository": "alibaba/ice",
"bugs": "https://github.com/alibaba/ice/issues",
"homepage": "https://v3.ice.work",

View File

@ -1,5 +1,17 @@
# @ice/runtime
## 1.5.4
### Patch Changes
- 4569200c: fix: support externals field in assets-manifest
## 1.5.3
### Patch Changes
- cc0792b0: feat: support custom props when render document
## 1.5.2
### Patch Changes

View File

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

View File

@ -129,6 +129,9 @@ export const Scripts: ScriptsType = (props: ScriptsProps) => {
return (
<>
<Data ScriptElement={ScriptElement} />
{assetsManifest.externals?.map(external => (
<ScriptElement key={external} src={external} {...rest} data-external-script />
))}
{
routeScripts.map(routeScriptProps => {
return <ScriptElement key={routeScriptProps.src} {...rest} {...routeScriptProps} data-route-script />;

View File

@ -45,6 +45,7 @@ export function renderDocument(options: RenderDocumentOptions): Response {
basename,
routesConfig = {},
serverData,
documentProps,
} = renderOptions;
const appData = null;
@ -84,7 +85,7 @@ export function renderDocument(options: RenderDocumentOptions): Response {
<AppContextProvider value={appContext}>
<DocumentContextProvider value={documentContext}>
{
Document && <Document pagePath={routePath} />
Document && <Document pagePath={routePath} {...documentProps} />
}
</DocumentContextProvider>
</AppContextProvider>,

View File

@ -283,7 +283,7 @@ async function renderServerEntry(
renderOptions,
}: RenderServerEntry,
): Promise<Response> {
const { Document } = renderOptions;
const { Document, documentProps } = renderOptions;
const appContext = runtime.getAppContext();
const { routes, routePath, loaderData, basename } = appContext;
const AppRuntimeProvider = runtime.composeAppProvider() || React.Fragment;
@ -307,7 +307,7 @@ async function renderServerEntry(
<AppRuntimeProvider>
<DocumentContextProvider value={documentContext}>
{
Document && <Document pagePath={routePath} />
Document && <Document pagePath={routePath} {...documentProps} />
}
</DocumentContextProvider>
</AppRuntimeProvider>

View File

@ -205,6 +205,7 @@ export interface RouteModules {
}
export interface AssetsManifest {
externals?: string[];
dataLoader?: string;
publicPath: string;
entries: {
@ -338,6 +339,7 @@ export interface RenderOptions {
runtimeOptions?: Record<string, any>;
serverData?: any;
streamOptions?: RenderToPipeableStreamOptions;
documentProps?: Record<string, unknown>;
}
declare global {

View File

@ -1962,10 +1962,10 @@ importers:
packages/plugin-externals:
devDependencies:
'@ice/app':
specifier: ^3.3.2
specifier: ^3.6.4
version: link:../ice
'@ice/runtime':
specifier: ^1.2.9
specifier: ^1.5.4
version: link:../runtime
'@types/react':
specifier: ^18.0.0
@ -1990,7 +1990,7 @@ importers:
packages/plugin-i18n:
dependencies:
'@ice/jsx-runtime':
specifier: ^0.3.1
specifier: ^0.3.2
version: link:../jsx-runtime
'@swc/helpers':
specifier: ^0.5.17
@ -2157,10 +2157,10 @@ importers:
version: 1.2.4
devDependencies:
'@ice/app':
specifier: ^3.6.1
specifier: ^3.6.4
version: link:../ice
'@ice/runtime':
specifier: ^1.5.2
specifier: ^1.5.4
version: link:../runtime
webpack:
specifier: ^5.88.0

View File

@ -20,7 +20,7 @@ describe(`build ${example}`, () => {
sizeFallback = fs.statSync(fallbackPath).size;
expect(sizeFallback).toBeLessThan(sizeServer);
// The Stat size of fallback entry will reduce more than 50kb.
expect(sizeServer - sizeFallback).toBeGreaterThan(50 * 1024);
// The Stat size of fallback entry will reduce more than 50kb, minify size is 20kb.
expect(sizeServer - sizeFallback).toBeGreaterThan(20 * 1024);
});
});

View File

@ -56,7 +56,6 @@ nrm use taobao
- [Visual Studio Code](https://code.visualstudio.com/)(推荐)
- [WebStorm](https://www.jetbrains.com/webstorm/)(推荐)
- [Sublime Text](https://www.sublimetext.com/)
- [Atom](https://atom.io/)
## 小程序开发者工具