diff --git a/packages/ice/CHANGELOG.md b/packages/ice/CHANGELOG.md index c96a5200af..10c5cd07ea 100644 --- a/packages/ice/CHANGELOG.md +++ b/packages/ice/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 3.4.9 + +### Patch Changes + +- 4c9456fc: feat: export useAsyncData for component Await +- b808156b: feat: support open specified route and list all routes +- Updated dependencies [4c9456fc] + - @ice/runtime@1.4.8 + ## 3.4.8 ### Patch Changes diff --git a/packages/ice/bin/ice-cli.mjs b/packages/ice/bin/ice-cli.mjs index 0763b4a98a..1d16bf697d 100755 --- a/packages/ice/bin/ice-cli.mjs +++ b/packages/ice/bin/ice-cli.mjs @@ -65,6 +65,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); .option('--https [https]', 'enable https', false) .option('--force', 'force remove cache directory', false) .option('--speedup', 'speed up build time based on Rust tools', false) + .option('--open ', 'open browser on startup with specific route', true) + .option('--list', 'list all available pages', false) .action(async ({ rootDir, ...commandArgs }, ctx) => { renamePlatformToTarget(commandArgs); process.env.NODE_ENV = 'development'; diff --git a/packages/ice/package.json b/packages/ice/package.json index d76fd776e5..211368f6ce 100644 --- a/packages/ice/package.json +++ b/packages/ice/package.json @@ -1,6 +1,6 @@ { "name": "@ice/app", - "version": "3.4.8", + "version": "3.4.9", "description": "provide scripts and configuration used by web framework ice", "type": "module", "main": "./esm/index.js", @@ -49,7 +49,7 @@ "dependencies": { "@ice/bundles": "0.2.6", "@ice/route-manifest": "1.2.2", - "@ice/runtime": "^1.4.7", + "@ice/runtime": "^1.4.8", "@ice/shared-config": "1.2.7", "@ice/webpack-config": "1.1.14", "@ice/rspack-config": "1.1.7", diff --git a/packages/ice/src/bundler/config/getUrls.ts b/packages/ice/src/bundler/config/getUrls.ts index f4af2fcfb6..5faa89342c 100644 --- a/packages/ice/src/bundler/config/getUrls.ts +++ b/packages/ice/src/bundler/config/getUrls.ts @@ -32,4 +32,11 @@ const getUrls = ({ return urls; }; +export const getUrlInfo = (routePaths: string[]) => { + return { + devPath: (routePaths[0] || '').replace(/^[/\\]/, ''), + routePaths: routePaths.map((routePath) => (routePath || '').replace(/^[/\\]/, '')), + }; +}; + export default getUrls; diff --git a/packages/ice/src/bundler/rspack/start.ts b/packages/ice/src/bundler/rspack/start.ts index d03153d1c8..42da902812 100644 --- a/packages/ice/src/bundler/rspack/start.ts +++ b/packages/ice/src/bundler/rspack/start.ts @@ -3,7 +3,7 @@ import type { Configuration as DevServerConfiguration } from '@rspack/dev-server import getDefaultServerConfig from '../config/defaultServerConfig.js'; import getMiddlewares from '../config/middlewares.js'; import { logger } from '../../utils/logger.js'; -import getUrls from '../config/getUrls.js'; +import getUrls, { getUrlInfo } from '../config/getUrls.js'; import { WEB } from '../../constant.js'; import type { BuildOptions } from '../types.js'; import formatStats from './formatStats.js'; @@ -80,9 +80,7 @@ const start = async ({ isSuccessful, isFirstCompile, urls, - devUrlInfo: { - devPath: (routePaths[0] || '').replace(/^[/\\]/, ''), - }, + devUrlInfo: getUrlInfo(routePaths), messages: message, taskConfigs, ...hooksAPI, diff --git a/packages/ice/src/bundler/webpack/start.ts b/packages/ice/src/bundler/webpack/start.ts index ce19580660..70d1635ac1 100644 --- a/packages/ice/src/bundler/webpack/start.ts +++ b/packages/ice/src/bundler/webpack/start.ts @@ -9,7 +9,7 @@ import { logger } from '../../utils/logger.js'; import { WEB } from '../../constant.js'; import getMiddlewares from '../config/middlewares.js'; import getDefaultServerConfig from '../config/defaultServerConfig.js'; -import getUrls from '../config/getUrls.js'; +import getUrls, { getUrlInfo } from '../config/getUrls.js'; import type { BundlerOptions, Context } from '../types.js'; const { merge } = lodash; @@ -88,9 +88,7 @@ export async function startDevServer( isSuccessful, isFirstCompile, urls, - devUrlInfo: { - devPath: (routePaths[0] || '').replace(/^[/\\]/, ''), - }, + devUrlInfo: getUrlInfo(routePaths), messages, taskConfigs, ...hooksAPI, diff --git a/packages/ice/src/config.ts b/packages/ice/src/config.ts index 3f3ed12517..0dd14ca72b 100644 --- a/packages/ice/src/config.ts +++ b/packages/ice/src/config.ts @@ -522,6 +522,10 @@ const cliOption = [ name: 'open', commands: ['start'], }, + { + name: 'list', + commands: ['start'], + }, { name: 'speedup', commands: ['start', 'build'], diff --git a/packages/ice/src/constant.ts b/packages/ice/src/constant.ts index 29af00da67..16a8f279b0 100644 --- a/packages/ice/src/constant.ts +++ b/packages/ice/src/constant.ts @@ -51,6 +51,7 @@ export const RUNTIME_EXPORTS = [ 'useNavigate', 'useNavigation', 'useRevalidator', + 'useAsyncValue', ], source: '@ice/runtime/router', }, diff --git a/packages/ice/src/plugins/web/index.ts b/packages/ice/src/plugins/web/index.ts index 92bd6d1b35..aeecb0c7bf 100644 --- a/packages/ice/src/plugins/web/index.ts +++ b/packages/ice/src/plugins/web/index.ts @@ -23,22 +23,28 @@ const plugin: Plugin = () => ({ }); onHook('after.start.compile', async ({ isSuccessful, isFirstCompile, urls, devUrlInfo }) => { - const { port, open } = commandArgs; - const { devPath } = devUrlInfo; + const { port, open, list } = commandArgs; + const { devPath, routePaths } = devUrlInfo; if (isSuccessful && isFirstCompile) { let logoutMessage = '\n'; logoutMessage += chalk.green(' Starting the development server at:'); - if (process.env.CLOUDIDE_ENV) { - logoutMessage += `\n - IDE server: https://${process.env.WORKSPACE_UUID}-${port}.${process.env.WORKSPACE_HOST}${devPath}`; + if (list) { + routePaths.forEach((routePath) => { + logoutMessage += `\n - Route(${routePath || 'index'}) : ${chalk.underline.white(`${urls.lanUrlForTerminal}${routePath}`)}`; + }); } else { - logoutMessage += `\n + if (process.env.CLOUDIDE_ENV) { + logoutMessage += `\n - IDE server: https://${process.env.WORKSPACE_UUID}-${port}.${process.env.WORKSPACE_HOST}${devPath}`; + } else { + logoutMessage += `\n - Local : ${chalk.underline.white(`${urls.localUrlForBrowser}${devPath}`)} - Network: ${chalk.underline.white(`${urls.lanUrlForTerminal}${devPath}`)}`; + } } logger.log(`${logoutMessage}\n`); if (open) { - openBrowser(`${urls.localUrlForBrowser}${devPath}`); + openBrowser(`${urls.localUrlForBrowser}${typeof open === 'string' ? open.replace(/^[/\\]/, '') : devPath}`); } } }); diff --git a/packages/ice/src/types/plugin.ts b/packages/ice/src/types/plugin.ts index 7043b36ad2..174e1cbc86 100644 --- a/packages/ice/src/types/plugin.ts +++ b/packages/ice/src/types/plugin.ts @@ -112,6 +112,7 @@ interface AfterCommandCompileOptions { interface DevServerInfo { devPath: string; + routePaths: string[]; } export interface HookLifecycle { diff --git a/packages/jsx-runtime/CHANGELOG.md b/packages/jsx-runtime/CHANGELOG.md index 0b6a8656dc..0f0c51b3d7 100644 --- a/packages/jsx-runtime/CHANGELOG.md +++ b/packages/jsx-runtime/CHANGELOG.md @@ -1,5 +1,11 @@ # @ice/jsx-runtime +## 0.3.0 + +### Minor Changes + +- bccc7db1: fix: use jsx-dev-runtime when development + ## 0.2.2 ### Patch Changes diff --git a/packages/jsx-runtime/package.json b/packages/jsx-runtime/package.json index 957a8ae19f..45cd547e3b 100644 --- a/packages/jsx-runtime/package.json +++ b/packages/jsx-runtime/package.json @@ -1,6 +1,6 @@ { "name": "@ice/jsx-runtime", - "version": "0.2.2", + "version": "0.3.0", "description": "JSX runtime for ice.", "files": [ "esm", diff --git a/packages/jsx-runtime/src/dev.ts b/packages/jsx-runtime/src/dev.ts index 833a599a54..890af0a9e6 100644 --- a/packages/jsx-runtime/src/dev.ts +++ b/packages/jsx-runtime/src/dev.ts @@ -1,7 +1,16 @@ -import { jsx, Fragment, jsxs } from './index.js'; +// @ts-ignore +import { jsxDEV as _jsxDEV, Fragment } from 'react/jsx-dev-runtime'; +import { hijackElementProps } from './style.js'; -export { Fragment }; -export function jsxDEV( +/** + * @param {*} type + * @param {object} props + * @param {string} key + * @param {boolean} isStaticChildren + * @param {object} source + * @param {any} self + */ +function jsxDEV( type: any, props: object, key: string, @@ -9,5 +18,7 @@ export function jsxDEV( source: object, self: any, ) { - return isStaticChildren ? jsxs(type, props, key, source, self) : jsx(type, props, key, source, self); + return _jsxDEV(type, hijackElementProps(props), key, isStaticChildren, source, self); } + +export { jsxDEV, Fragment }; diff --git a/packages/jsx-runtime/src/index.ts b/packages/jsx-runtime/src/index.ts index d75eac8ec8..ef3801e929 100644 --- a/packages/jsx-runtime/src/index.ts +++ b/packages/jsx-runtime/src/index.ts @@ -1,50 +1 @@ -// @ts-ignore -import { jsx as _jsx, jsxs as _jsxs, Fragment } from 'react/jsx-runtime'; -// @ts-ignore -import { convertUnit } from 'style-unit'; - -const STYLE = 'style'; - -/** - * https://github.com/reactjs/rfcs/pull/107 - * @param {*} type - * @param {object} props - * @param {string} maybeKey - * @param {object} source - * @param {any} self - */ -export function jsx(type: any, props: object, maybeKey: string, source: object, self: any) { - return _jsx(type, hijackElementProps(props), maybeKey, source, self); -} - -// Same as jsx method, special case jsxs internally to take advantage of static children. -// // for now we can ship identical prod functions. -export function jsxs(type: any, props: object, maybeKey: string, source: object, self: any) { - return _jsxs(type, hijackElementProps(props), maybeKey, source, self); -} - -function isObject(obj: any): obj is object { - return typeof obj === 'object'; -} - -// Support rpx unit. -export function hijackElementProps(props: { style?: object } | object): object { - if (props && STYLE in props) { - const { style } = props; - if (isObject(style)) { - const result = Object.assign({}, props); - const convertedStyle = {}; - for (const prop in style) { - // @ts-ignore - convertedStyle[prop] = typeof style[prop] === 'string' ? convertUnit(style[prop]) : style[prop]; - } - result['style'] = convertedStyle; - return result; - } - } - return props; -} - -export { - Fragment, -}; +export * from './prod.js'; diff --git a/packages/jsx-runtime/src/prod.ts b/packages/jsx-runtime/src/prod.ts index 3ed9a9ecc5..fd420ef6ab 100644 --- a/packages/jsx-runtime/src/prod.ts +++ b/packages/jsx-runtime/src/prod.ts @@ -1 +1,27 @@ -export { jsx, jsxs, Fragment } from './index.js'; +// @ts-ignore +import { jsx as _jsx, jsxs as _jsxs, Fragment } from 'react/jsx-runtime'; +import { hijackElementProps } from './style.js'; + +/** + * https://github.com/reactjs/rfcs/pull/107 + * @param {*} type + * @param {object} props + * @param {string} maybeKey + * @param {object} source + * @param {any} self + */ +function jsx(type: any, props: object, maybeKey: string, source: object, self: any) { + return _jsx(type, hijackElementProps(props), maybeKey, source, self); +} + +// Same as jsx method, special case jsxs internally to take advantage of static children. +// // for now we can ship identical prod functions. +function jsxs(type: any, props: object, maybeKey: string, source: object, self: any) { + return _jsxs(type, hijackElementProps(props), maybeKey, source, self); +} + +export { + Fragment, + jsx, + jsxs, +}; diff --git a/packages/jsx-runtime/src/style.ts b/packages/jsx-runtime/src/style.ts new file mode 100644 index 0000000000..eac2603fab --- /dev/null +++ b/packages/jsx-runtime/src/style.ts @@ -0,0 +1,26 @@ +// @ts-ignore +import { convertUnit } from 'style-unit'; + +const STYLE = 'style'; + +function isObject(obj: any): obj is object { + return typeof obj === 'object'; +} + +// Support rpx unit. +export function hijackElementProps(props: { style?: object } | object): object { + if (props && STYLE in props) { + const { style } = props; + if (isObject(style)) { + const result = Object.assign({}, props); + const convertedStyle = {}; + for (const prop in style) { + // @ts-ignore + convertedStyle[prop] = typeof style[prop] === 'string' ? convertUnit(style[prop]) : style[prop]; + } + result['style'] = convertedStyle; + return result; + } + } + return props; +} diff --git a/packages/jsx-runtime/tests/hijackElememt.test.ts b/packages/jsx-runtime/tests/hijackElememt.test.ts index 7fdeff8e43..c675f43865 100644 --- a/packages/jsx-runtime/tests/hijackElememt.test.ts +++ b/packages/jsx-runtime/tests/hijackElememt.test.ts @@ -1,5 +1,5 @@ import { expect, it, describe } from 'vitest'; -import { hijackElementProps } from '../src/'; +import { hijackElementProps } from '../src/style'; describe('hijack element', () => { it('hijackElementProps basic', () => { @@ -19,4 +19,4 @@ describe('hijack element', () => { }, }); }); -}); \ No newline at end of file +}); diff --git a/packages/plugin-i18n/CHANGELOG.md b/packages/plugin-i18n/CHANGELOG.md index b15fdba8bc..9a8542dc36 100644 --- a/packages/plugin-i18n/CHANGELOG.md +++ b/packages/plugin-i18n/CHANGELOG.md @@ -1,5 +1,16 @@ # @ice/plugin-i18n +## 5.0.1 + +### Patch Changes + +- Updated dependencies [bccc7db1] +- Updated dependencies [4c9456fc] +- Updated dependencies [b808156b] + - @ice/jsx-runtime@0.3.0 + - @ice/runtime@1.4.8 + - @ice/app@3.4.9 + ## 5.0.0 ### Patch Changes diff --git a/packages/plugin-i18n/package.json b/packages/plugin-i18n/package.json index d75adf7de2..b9a5a7c0f4 100644 --- a/packages/plugin-i18n/package.json +++ b/packages/plugin-i18n/package.json @@ -1,6 +1,6 @@ { "name": "@ice/plugin-i18n", - "version": "5.0.0", + "version": "5.0.1", "description": "I18n plugin for ice.js 3.", "files": [ "es2017", @@ -39,7 +39,7 @@ "plugin" ], "dependencies": { - "@ice/jsx-runtime": "^0.2.2", + "@ice/jsx-runtime": "^0.3.0", "@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.4.8", - "@ice/runtime": "^1.4.7" + "@ice/app": "^3.4.9", + "@ice/runtime": "^1.4.8" }, "publishConfig": { "access": "public" diff --git a/packages/plugin-intl/CHANGELOG.md b/packages/plugin-intl/CHANGELOG.md index 7e9ae42333..1ade93256c 100644 --- a/packages/plugin-intl/CHANGELOG.md +++ b/packages/plugin-intl/CHANGELOG.md @@ -1,5 +1,11 @@ # @ice/plugin-intl +## 1.0.1 + +### Patch Changes + +- d06826ef: feat: support get locale messages for global + ## 1.0.0 - Initial release diff --git a/packages/plugin-intl/package.json b/packages/plugin-intl/package.json index f1747c4af1..67f897422b 100644 --- a/packages/plugin-intl/package.json +++ b/packages/plugin-intl/package.json @@ -1,6 +1,6 @@ { "name": "@ice/plugin-intl", - "version": "1.0.0", + "version": "1.0.1", "description": "react intl plugin for ice.js 3.", "files": [ "esm", @@ -27,8 +27,8 @@ "fast-glob": "^3.3.2" }, "devDependencies": { - "@ice/app": "^3.3.2", - "@ice/runtime": "^1.2.9", + "@ice/app": "^3.4.9", + "@ice/runtime": "^1.4.8", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0" }, diff --git a/packages/plugin-intl/src/index.ts b/packages/plugin-intl/src/index.ts index 5a18d5a28f..88871009e3 100644 --- a/packages/plugin-intl/src/index.ts +++ b/packages/plugin-intl/src/index.ts @@ -5,7 +5,18 @@ import type { Plugin } from '@ice/app/types'; const _dirname = path.dirname(fileURLToPath(import.meta.url)); -const plugin: Plugin = () => ({ +interface PluginOptions { + // The key of locale content read from the window object. + localeMessagesKey?: string; + defaultLocaleKey?: string; + useCDN?: boolean; +} + +const plugin: Plugin = ({ + localeMessagesKey = '__LOCALE_MESSAGES__', + defaultLocaleKey = '__DEFAULT_LOCALE__', + useCDN = false, +} = {}) => ({ name: 'plugin-intl', setup: ({ generator, context, createLogger, watch }) => { const { rootDir } = context; @@ -26,6 +37,8 @@ const plugin: Plugin = () => ({ path.join(_dirname, '../templates/locales.ts.ejs'), 'locales.ts', { + localeMessagesKey, + defaultLocaleKey, localeImport: locales.join('\n'), localeExport: localeExport.join('\n '), }, @@ -34,7 +47,7 @@ const plugin: Plugin = () => ({ const globRule = 'src/locales/*.{ts,js,json}'; // Glob all locale files, and generate runtime options. const localeFiles = fg.sync(globRule, { cwd: rootDir }); - if (localeFiles.length > 0) { + if (localeFiles.length > 0 && !useCDN) { // Filter the entry of locale files. const mainEntry = localeFiles.find((file) => file.match(/index\.(ts|js|json)$/)); let runtimeSource = ''; @@ -59,7 +72,14 @@ const plugin: Plugin = () => ({ }, 'both'); } } else { - logger.warn('No locale files found, please check the `src/locales` folder.'); + renderLocaleEntry([]); + generator.addEntryImportAhead({ + source: './locales', + // @ts-ignore + }, 'both'); + if (!useCDN) { + logger.warn('No locale files found, please check the `src/locales` folder.'); + } } // Add intl export from ice. diff --git a/packages/plugin-intl/src/runtime.tsx b/packages/plugin-intl/src/runtime.tsx index 60d91400e9..5d4139a736 100644 --- a/packages/plugin-intl/src/runtime.tsx +++ b/packages/plugin-intl/src/runtime.tsx @@ -8,7 +8,10 @@ const EXPORT_NAME = 'locale'; const cache = createIntlCache(); const getDefaultLocale = () => { - return (typeof navigator !== 'undefined' && navigator.language) || 'zh-CN'; + // @ts-ignore + return (typeof window !== 'undefined' && window.__ICE_DEFAULT_LOCALE__) || + (typeof navigator !== 'undefined' && navigator.language) || + 'zh-CN'; }; const getLocaleMessages = () => { diff --git a/packages/plugin-intl/templates/locales.ts.ejs b/packages/plugin-intl/templates/locales.ts.ejs index d75f402aa6..501187ba37 100644 --- a/packages/plugin-intl/templates/locales.ts.ejs +++ b/packages/plugin-intl/templates/locales.ts.ejs @@ -3,11 +3,13 @@ const localeMessages = { <%- localeExport %> }; -const LOCALE_KEY = '__ICE_LOCALE_MESSAGES__'; +const LOCALE_MESSAGES_KEY = '__ICE_LOCALE_MESSAGES__'; +const DEFAULT_LOCALE_KEY = '__ICE_DEFAULT_LOCALE__'; if (typeof window !== 'undefined') { - window[LOCALE_KEY] = localeMessages; + window[LOCALE_MESSAGES_KEY] = window['<%- localeMessagesKey %>'] || localeMessages; + window[DEFAULT_LOCALE_KEY] = window['<%- defaultLocaleKey %>']; } else { - global[LOCALE_KEY]= localeMessages; + global[LOCALE_MESSAGES_KEY]= localeMessages; } export default localeMessages; diff --git a/packages/plugin-request/CHANGELOG.md b/packages/plugin-request/CHANGELOG.md index 9293c8e6d7..8917339495 100644 --- a/packages/plugin-request/CHANGELOG.md +++ b/packages/plugin-request/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## 1.0.3 + +### Patch Changes + +- 570205a8: chore: fix the default type of TParams + ## 1.0.2 ### Patch Changes diff --git a/packages/plugin-request/package.json b/packages/plugin-request/package.json index 3f29e9e1b5..067ce807e4 100644 --- a/packages/plugin-request/package.json +++ b/packages/plugin-request/package.json @@ -1,6 +1,6 @@ { "name": "@ice/plugin-request", - "version": "1.0.2", + "version": "1.0.3", "description": "Request plugin for ice.", "license": "MIT", "type": "module", @@ -53,8 +53,8 @@ "axios": "^0.27.2" }, "devDependencies": { - "@ice/app": "^3.3.2", - "@ice/runtime": "^1.2.9", + "@ice/app": "^3.4.9", + "@ice/runtime": "^1.4.8", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", "regenerator-runtime": "^0.13.9" diff --git a/packages/rax-compat/CHANGELOG.md b/packages/rax-compat/CHANGELOG.md index 1bd588dbc1..eeed96e36d 100644 --- a/packages/rax-compat/CHANGELOG.md +++ b/packages/rax-compat/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.2.12 + +### Patch Changes + +- 60ed0e11: lowercase props compat + ## 0.2.11 ### Patch Changes diff --git a/packages/rax-compat/package.json b/packages/rax-compat/package.json index 8578ededa8..9c1ae0d9f1 100644 --- a/packages/rax-compat/package.json +++ b/packages/rax-compat/package.json @@ -1,6 +1,6 @@ { "name": "rax-compat", - "version": "0.2.11", + "version": "0.2.12", "description": "Rax compatible mode, running rax project on the react runtime.", "files": [ "esm", diff --git a/packages/rax-compat/src/possible-standard-names.ts b/packages/rax-compat/src/possible-standard-names.ts index cd53406924..d32e4bcadd 100644 --- a/packages/rax-compat/src/possible-standard-names.ts +++ b/packages/rax-compat/src/possible-standard-names.ts @@ -23,6 +23,7 @@ const possibleStandardNames = [ 'marginHeight', // meta 'charSet', + 'dangerouslySetInnerHTML', ].reduce((records: Record, iter: string) => { records[iter.toLowerCase()] = iter; return records; diff --git a/packages/rax-compat/src/props.ts b/packages/rax-compat/src/props.ts index 4e68887e3e..9b13b22ee0 100644 --- a/packages/rax-compat/src/props.ts +++ b/packages/rax-compat/src/props.ts @@ -30,6 +30,9 @@ function transformProps(props: ComponentProps>): Reco } else if (possibleStandardNames.hasOwnProperty(lowerCasedPropKey)) { // Transform attribute names that make it works properly in React. key = possibleStandardNames[lowerCasedPropKey]; + } else { + // Handles component props from rax-components like resizeMode, this causes React to throw a warning. + key = lowerCasedPropKey; } transformedProps[key] = val; diff --git a/packages/rax-compat/tests/props.test.tsx b/packages/rax-compat/tests/props.test.tsx index 7e86c3db4d..ce5cba697d 100644 --- a/packages/rax-compat/tests/props.test.tsx +++ b/packages/rax-compat/tests/props.test.tsx @@ -41,4 +41,14 @@ describe('props', () => { inputmode: 'numeric', }).inputMode).toBe('numeric'); }); + + it('should work with dangerouslySetInnerHTML', () => { + expect( + transformProps({ + dangerouslySetInnerHTML: { __html: 'xxx' }, + }).dangerouslySetInnerHTML, + ).toEqual({ + __html: 'xxx', + }); + }); }); diff --git a/packages/runtime/CHANGELOG.md b/packages/runtime/CHANGELOG.md index 8e2bb7eefb..650534cc32 100644 --- a/packages/runtime/CHANGELOG.md +++ b/packages/runtime/CHANGELOG.md @@ -1,5 +1,13 @@ # @ice/runtime +## 1.4.8 + +### Patch Changes + +- 4c9456fc: feat: export useAsyncData for component Await +- Updated dependencies [bccc7db1] + - @ice/jsx-runtime@0.3.0 + ## 1.4.7 ### Patch Changes diff --git a/packages/runtime/package.json b/packages/runtime/package.json index cc3630f5a2..eb4070c4ef 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@ice/runtime", - "version": "1.4.7", + "version": "1.4.8", "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.2.2", + "@ice/jsx-runtime": "^0.3.0", "@ice/shared": "^1.0.2", "@remix-run/router": "1.14.2", "abortcontroller-polyfill": "1.7.5", diff --git a/packages/runtime/src/index.ts b/packages/runtime/src/index.ts index 44f7fafbf7..7371d5cefa 100644 --- a/packages/runtime/src/index.ts +++ b/packages/runtime/src/index.ts @@ -146,6 +146,7 @@ export { useNavigate, useNavigation, useRevalidator, + useAsyncValue, } from 'react-router-dom'; export type { diff --git a/packages/runtime/src/router.ts b/packages/runtime/src/router.ts index c118c62b1b..beaf72c5e5 100644 --- a/packages/runtime/src/router.ts +++ b/packages/runtime/src/router.ts @@ -8,6 +8,7 @@ export { useNavigate, useNavigation, useRevalidator, + useAsyncValue, } from 'react-router-dom'; export { useData, useConfig } from './RouteContext.js'; diff --git a/packages/runtime/src/routes.tsx b/packages/runtime/src/routes.tsx index 542cedf4cb..be0189c77a 100644 --- a/packages/runtime/src/routes.tsx +++ b/packages/runtime/src/routes.tsx @@ -1,5 +1,6 @@ import React, { Suspense } from 'react'; import { useRouteError, defer, Await as ReactRouterAwait } from 'react-router-dom'; +import type { AwaitProps } from 'react-router-dom'; // eslint-disable-next-line camelcase import type { UNSAFE_DeferredData, LoaderFunctionArgs } from '@remix-run/router'; import type { @@ -105,7 +106,7 @@ export function RouteErrorComponent() { return process.env.ICE_CORE_ROUTER === 'true' ? : <>; } -export function Await(props) { +export function Await(props: AwaitProps & { fallback: React.ReactNode }) { return process.env.ICE_CORE_ROUTER === 'true' ? (