From 2c6900e4a93093c29c9c7b16426b98ccafa2930a Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 16 Jan 2025 19:51:39 +0800 Subject: [PATCH 01/10] feat: refactor ice runtime --- package.json | 5 +- packages/ice/src/createService.ts | 2 +- packages/ice/src/plugins/task.ts | 1 + .../ice/templates/core/entry.client.tsx.ejs | 52 +- packages/runtime-kit/package.json | 37 + packages/runtime-kit/src/appConfig.ts | 29 + packages/runtime-kit/src/dataLoader.ts | 237 ++++++ packages/runtime-kit/src/index.ts | 4 + packages/runtime-kit/src/requestContext.ts | 54 ++ packages/runtime-kit/src/types.ts | 266 ++++++ packages/runtime-kit/tsconfig.json | 10 + packages/runtime-kit/tsup.config.ts | 10 + packages/runtime/package.json | 3 +- packages/shared-config/src/types.ts | 2 + pnpm-lock.yaml | 758 +++++++++++++++++- 15 files changed, 1430 insertions(+), 40 deletions(-) create mode 100644 packages/runtime-kit/package.json create mode 100644 packages/runtime-kit/src/appConfig.ts create mode 100644 packages/runtime-kit/src/dataLoader.ts create mode 100644 packages/runtime-kit/src/index.ts create mode 100644 packages/runtime-kit/src/requestContext.ts create mode 100644 packages/runtime-kit/src/types.ts create mode 100644 packages/runtime-kit/tsconfig.json create mode 100644 packages/runtime-kit/tsup.config.ts diff --git a/package.json b/package.json index d66ef5646c..b6e85a9c0d 100644 --- a/package.json +++ b/package.json @@ -74,5 +74,8 @@ "@rspack/core@0.5.7": "patches/@rspack__core@0.5.7.patch", "unplugin@1.6.0": "patches/unplugin@1.6.0.patch" } - } + }, + "workspaces": [ + "packages/runtime-kit" + ] } diff --git a/packages/ice/src/createService.ts b/packages/ice/src/createService.ts index 4a97092a1d..818770e0c5 100644 --- a/packages/ice/src/createService.ts +++ b/packages/ice/src/createService.ts @@ -246,7 +246,7 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt // Get first task config as default platform config. const platformTaskConfig = taskConfigs[0]; - const iceRuntimePath = '@ice/runtime'; + const iceRuntimePath = platformTaskConfig.config.runtimeSource || '@ice/runtime'; // Only when code splitting use the default strategy or set to `router`, the router will be lazy loaded. const lazy = [true, 'chunks', 'page', 'page-vendors'].includes(userConfig.codeSplitting); const { routeImports, routeDefinition } = getRoutesDefinition({ diff --git a/packages/ice/src/plugins/task.ts b/packages/ice/src/plugins/task.ts index 3dd7e80e5a..892d146a90 100644 --- a/packages/ice/src/plugins/task.ts +++ b/packages/ice/src/plugins/task.ts @@ -33,6 +33,7 @@ const getDefaultTaskConfig = ({ rootDir, command }): Config => { logging: process.env.WEBPACK_LOGGING || defaultLogging, minify: command === 'build', useDevServer: true, + runtimeSource: '@ice/runtime', }; }; diff --git a/packages/ice/templates/core/entry.client.tsx.ejs b/packages/ice/templates/core/entry.client.tsx.ejs index 0e52e5a325..ee9f31bbd4 100644 --- a/packages/ice/templates/core/entry.client.tsx.ejs +++ b/packages/ice/templates/core/entry.client.tsx.ejs @@ -1,6 +1,5 @@ <% if (importCoreJs) { -%>import 'core-js';<% } %> <%- entry.imports %> -import { createElement, Fragment } from 'react'; import { runClientApp, getAppConfig } from '<%- iceRuntimePath %>'; import { commons, statics } from './runtime-modules'; import * as app from '@/app'; @@ -15,19 +14,6 @@ const getRouterBasename = () => { const appConfig = getAppConfig(app); return appConfig?.router?.basename ?? <%- basename %> ?? ''; } -// Add react fragment for split chunks of app. -// Otherwise chunk of route component will pack @ice/jsx-runtime and depend on framework bundle. -const App = <>; - -<% if (!dataLoaderImport.imports && hasDataLoader) {-%> -let dataLoaderFetcher = (options) => { - return window.fetch(options.url, options); -} - -let dataLoaderDecorator = (dataLoader) => { - return dataLoader; -} -<% } -%> const renderOptions: RunClientAppOptions = { app, @@ -39,7 +25,7 @@ const renderOptions: RunClientAppOptions = { basename: getRouterBasename(), hydrate: <%- hydrate %>, memoryRouter: <%- memoryRouter || false %>, -<% if (hasDataLoader) { -%> +<% if (dataLoaderImport.imports && hasDataLoader) { -%> dataLoaderFetcher, dataLoaderDecorator,<% } -%> runtimeOptions: { @@ -50,27 +36,23 @@ const renderOptions: RunClientAppOptions = { }, }; -const defaultRender = (customOptions: Partial = {}) => { - return runClientApp({ - ...renderOptions, - ...customOptions, - runtimeOptions: { - ...(renderOptions.runtimeOptions || {}), - ...customOptions.runtimeOptions, - }, - }); -}; - -const renderApp = (appExport: any, customOptions: Partial) => { - if (appExport.runApp) { - return appExport.runApp(defaultRender, renderOptions); - } else { - return defaultRender(customOptions); - } -}; +const mergeOptions = (customOptions: Partial = {}): RunClientAppOptions => ({ + ...renderOptions, + ...customOptions, + runtimeOptions: { + ...renderOptions.runtimeOptions, + ...customOptions.runtimeOptions, + }, +}); -const render = (customOptions: Partial = {}) => { - return renderApp(app, customOptions); +const render = () => { + return app.runApp?.( + (customOptions: Partial = {}) => { + const options = mergeOptions(customOptions); + return runClientApp(options); + }, + renderOptions + ) ?? runClientApp(renderOptions); }; <%- entryCode %> diff --git a/packages/runtime-kit/package.json b/packages/runtime-kit/package.json new file mode 100644 index 0000000000..f549e5a21d --- /dev/null +++ b/packages/runtime-kit/package.json @@ -0,0 +1,37 @@ +{ + "name": "@ice/runtime-kit", + "version": "0.1.0", + "description": "Runtime utilities and tools for ICE framework", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "sideEffects": false, + "scripts": { + "build": "tsup", + "watch": "tsup --watch" + }, + "dependencies": {}, + "devDependencies": { + "tsup": "^8.0.0", + "typescript": "^5.0.0", + "@types/react": "^18.0.8", + "@types/react-dom": "^18.0.3", + "react": "^18.0.0", + "react-dom": "^18.0.0" + }, + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/alibaba/ice.git" + }, + "bugs": { + "url": "https://github.com/alibaba/ice/issues" + }, + "homepage": "https://ice.work", + "license": "MIT" +} diff --git a/packages/runtime-kit/src/appConfig.ts b/packages/runtime-kit/src/appConfig.ts new file mode 100644 index 0000000000..88dc6fd743 --- /dev/null +++ b/packages/runtime-kit/src/appConfig.ts @@ -0,0 +1,29 @@ +import type { AppConfig, AppExport } from './types.js'; + +const defaultAppConfig: AppConfig = { + app: { + strict: false, + rootId: 'ice-container', + }, + router: { + type: 'browser', + }, +} as const; + +export default function getAppConfig(appExport: AppExport): AppConfig { + const { default: appConfig = {} } = appExport || {}; + const { app, router, ...others } = appConfig; + + return { + app: { ...defaultAppConfig.app, ...app }, + router: { ...defaultAppConfig.router, ...router }, + ...others, + }; +} + +export const defineAppConfig = ( + appConfigOrDefineAppConfig: AppConfig | (() => AppConfig), +): AppConfig => + (typeof appConfigOrDefineAppConfig === 'function' + ? appConfigOrDefineAppConfig() + : appConfigOrDefineAppConfig); diff --git a/packages/runtime-kit/src/dataLoader.ts b/packages/runtime-kit/src/dataLoader.ts new file mode 100644 index 0000000000..2e5da6cb35 --- /dev/null +++ b/packages/runtime-kit/src/dataLoader.ts @@ -0,0 +1,237 @@ +import getRequestContext from './requestContext.js'; +import type { + RequestContext, RenderMode, AppExport, + RuntimeModules, StaticRuntimePlugin, CommonJsRuntime, + Loader, DataLoaderResult, StaticDataLoader, DataLoaderConfig, DataLoaderOptions, +} from './types.js'; + +interface Loaders { + [routeId: string]: DataLoaderConfig; +} + +interface CachedResult { + value: any; +} + +interface Options { + fetcher: (config: StaticDataLoader) => Promise; + decorator: (dataLoader: Function, id?: number) => Function; + runtimeModules: RuntimeModules['statics']; + appExport: AppExport; +} + +export interface LoadRoutesDataOptions { + renderMode: RenderMode; + requestContext?: RequestContext; +} + +export function defineDataLoader(dataLoader: Loader, options?: DataLoaderOptions): DataLoaderConfig { + return { + loader: dataLoader, + options, + }; +} + +export function defineServerDataLoader(dataLoader: Loader, options?: DataLoaderOptions): DataLoaderConfig { + return { + loader: dataLoader, + options, + }; +} + +export function defineStaticDataLoader(dataLoader: Loader): DataLoaderConfig { + return { + loader: dataLoader, + }; +} + +/** + * Custom fetcher for load static data loader config. + * Set globally to avoid passing this fetcher too deep. + */ +let dataLoaderFetcher: (config: StaticDataLoader) => Promise; +export function setFetcher(customFetcher: (config: StaticDataLoader) => Promise): void { + dataLoaderFetcher = customFetcher; +} + +/** + * Custom decorator for deal with data loader. + */ +let dataLoaderDecorator = (dataLoader: Function, id?: number): Function => { + return dataLoader; +}; +export function setDecorator(customDecorator: (dataLoader: Function, id?: number) => Function): void { + dataLoaderDecorator = customDecorator; +} + +/** + * Parse template for static dataLoader. + */ +export function parseTemplate(config: StaticDataLoader): StaticDataLoader { + const queryParams: Record = {}; + const getQueryParams = (): Record => { + if (Object.keys(queryParams).length === 0 && location.search.includes('?')) { + location.search.substring(1).split('&').forEach(query => { + const [key, value] = query.split('='); + if (key && value) { + queryParams[key] = value; + } + }); + } + return queryParams; + }; + + const cookie: Record = {}; + const getCookie = (): Record => { + if (Object.keys(cookie).length === 0) { + document.cookie.split(';').forEach(c => { + const [key, value] = c.split('='); + if (key && value) { + cookie[key.trim()] = value.trim(); + } + }); + } + return cookie; + }; + + let strConfig = JSON.stringify(config) || ''; + const regexp = /\$\{(queryParams|cookie|storage)(\.(\w|-)+)?}/g; + const matches = Array.from(strConfig.matchAll(regexp)); + + matches.forEach(([origin, key, value]) => { + if (origin && key && value?.startsWith('.')) { + const param = value.substring(1); + if (key === 'queryParams') { + strConfig = strConfig.replace(origin, getQueryParams()[param] || ''); + } else if (key === 'cookie') { + strConfig = strConfig.replace(origin, getCookie()[param] || ''); + } else if (key === 'storage') { + strConfig = strConfig.replace(origin, localStorage.getItem(param) || ''); + } + } + }); + + strConfig = strConfig.replace('${url}', location.href); + + return JSON.parse(strConfig); +} + +export function loadDataByCustomFetcher(config: StaticDataLoader): Promise { + let parsedConfig = config; + try { + if (import.meta.renderer === 'client') { + parsedConfig = parseTemplate(config); + } + } catch (error) { + console.error('parse template error: ', error); + } + return dataLoaderFetcher(parsedConfig); +} + +/** + * Handle for different dataLoader. + */ +export function callDataLoader(dataLoader: Loader, requestContext: RequestContext): DataLoaderResult { + if (Array.isArray(dataLoader)) { + return dataLoader.map((loader, index) => + (typeof loader === 'object' ? loadDataByCustomFetcher(loader) : dataLoaderDecorator(loader, index)(requestContext)), + ); + } + + if (typeof dataLoader === 'object') { + return loadDataByCustomFetcher(dataLoader); + } + + return dataLoaderDecorator(dataLoader)(requestContext); +} + +const cache = new Map(); + +/** + * Start getData once data-loader.js is ready in client, and set to cache. + */ +function loadInitialDataInClient(loaders: Loaders): void { + const context = (window as any).__ICE_APP_CONTEXT__ || {}; + const matchedIds = context.matchedIds || []; + const loaderData = context.loaderData || {}; + const { renderMode } = context; + + const ids = ['__app', ...matchedIds]; + ids.forEach(id => { + const dataFromSSR = loaderData[id]?.data; + if (dataFromSSR) { + cache.set(renderMode === 'SSG' ? `${id}_ssg` : id, { + value: dataFromSSR, + }); + + if (renderMode === 'SSR') { + return; + } + } + + const dataLoaderConfig = loaders[id]; + if (dataLoaderConfig) { + const requestContext = getRequestContext(window.location); + const { loader } = dataLoaderConfig; + const promise = callDataLoader(loader, requestContext); + + cache.set(id, { + value: promise, + }); + } + }); +} + +/** + * Init data loader in client side. + */ +async function init(loaders: Loaders, options: Options): Promise { + const { fetcher, decorator, runtimeModules, appExport } = options; + + const runtimeApi = { + appContext: { appExport }, + }; + + if (runtimeModules) { + await Promise.all( + runtimeModules + .map(module => { + const runtimeModule = ((module as CommonJsRuntime).default || module) as StaticRuntimePlugin; + return runtimeModule(runtimeApi); + }) + .filter(Boolean), + ); + } + + if (fetcher) setFetcher(fetcher); + if (decorator) setDecorator(decorator); + + try { + loadInitialDataInClient(loaders); + } catch (error) { + console.error('Load initial data error: ', error); + } + + (window as any).__ICE_DATA_LOADER__ = { + getLoader: (id: string): DataLoaderConfig => loaders[id], + getData: (id: string, options: LoadRoutesDataOptions): DataLoaderResult => { + const cacheKey = `${id}${options?.renderMode === 'SSG' ? '_ssg' : ''}`; + const result = cache.get(cacheKey); + cache.delete(cacheKey); + + if (result) return result.value; + + const dataLoaderConfig = loaders[id]; + if (!dataLoaderConfig) return null; + + const { loader } = dataLoaderConfig; + return callDataLoader(loader, options?.requestContext || getRequestContext(window.location)); + }, + }; +} + +export const dataLoader = { + init, +}; + +export default dataLoader; diff --git a/packages/runtime-kit/src/index.ts b/packages/runtime-kit/src/index.ts new file mode 100644 index 0000000000..b001336370 --- /dev/null +++ b/packages/runtime-kit/src/index.ts @@ -0,0 +1,4 @@ +export * from './appConfig.js'; +export * from './dataLoader.js'; +export * from './requestContext.js'; +export * from './types.js'; diff --git a/packages/runtime-kit/src/requestContext.ts b/packages/runtime-kit/src/requestContext.ts new file mode 100644 index 0000000000..04eef93116 --- /dev/null +++ b/packages/runtime-kit/src/requestContext.ts @@ -0,0 +1,54 @@ +import type { ServerContext, RequestContext } from './types.js'; + +interface Location { + pathname: string; + search: string; +} + +/** + * context for getData both in server and client side. + */ +export default function getRequestContext(location: Location, serverContext: ServerContext = {}): RequestContext { + const { pathname, search } = location; + // Use query form server context first to avoid unnecessary parsing. + // @ts-ignore + const query = serverContext?.req?.query || parseSearch(search); + + const requestContext: RequestContext = { + ...(serverContext || {}), + pathname, + query, + }; + + return requestContext; +} + +/** + * Search string to object + * URLSearchParams is not compatible with iOS9 and IE. + */ +export function parseSearch(search: string) { + // remove first '?' + if (search.indexOf('?') === 0) { + search = search.slice(1); + } + + const result = {}; + + let pairs = search.split('&'); + + for (let j = 0; j < pairs.length; j++) { + const value = pairs[j]; + const index = value.indexOf('='); + + if (index > -1) { + const k = value.slice(0, index); + const v = value.slice(index + 1); + result[k] = v; + } else if (value) { + result[value] = ''; + } + } + + return result; +} diff --git a/packages/runtime-kit/src/types.ts b/packages/runtime-kit/src/types.ts new file mode 100644 index 0000000000..eb08e7cc46 --- /dev/null +++ b/packages/runtime-kit/src/types.ts @@ -0,0 +1,266 @@ +import type { IncomingMessage, ServerResponse } from 'http'; +import type { ComponentType, PropsWithChildren } from 'react'; +import type { HydrationOptions, Root } from 'react-dom/client'; + +// Basic Types +export type RouteData = any; +export type RenderMode = 'SSR' | 'SSG' | 'CSR'; + +// Core Interfaces +export interface Path { + pathname: string; + search: string; + hash: string; +} + +export interface Location extends Path { + state: State; + key: string; +} + +export interface ErrorStack { + componentStack?: string; + digest?: string; +} + +export interface ServerContext { + req?: IncomingMessage; + res?: ServerResponse; +} + +export interface RequestContext extends ServerContext { + pathname: string; + query: Record; +} + +// App Configuration Types +export type App = Partial<{ + rootId: string; + strict: boolean; + errorBoundary: boolean; + onRecoverableError: (error: unknown, errorInfo: ErrorStack) => void; + onBeforeHydrate: () => void; +}>; + +export interface AppConfig { + app?: App; + router?: { + type?: 'hash' | 'browser' | 'memory'; + basename?: string; + initialEntries?: InitialEntry[]; + }; +} + +export interface AppExport { + default?: AppConfig; + dataLoader?: DataLoaderConfig; + [key: string]: any; +} + +// Route & Component Types +export type ComponentWithChildren

= ComponentType>; +export type AppProvider = ComponentWithChildren; +export type RouteWrapper = ComponentType; + +export type InitialEntry = string | Partial; +export type Params = { + readonly [key in Key]: string | undefined; +}; + +// Data Loading Types +export interface DataLoaderOptions { + defer?: boolean; +} + +export interface StaticDataLoader { + key?: string; + prefetch_type?: string; + api: string; + v: string; + data: any; + ext_headers: Object; +} + +export type DataLoaderResult = (Promise | RouteData) | RouteData; +export type DataLoader = (ctx: RequestContext) => DataLoaderResult; +export type Loader = DataLoader | StaticDataLoader | Array; + +export interface DataLoaderConfig { + loader: Loader; + options?: DataLoaderOptions; +} + +// Route Configuration Types +export type RouteConfig = T & { + title?: string; + meta?: React.MetaHTMLAttributes[]; + links?: React.LinkHTMLAttributes[]; + scripts?: React.ScriptHTMLAttributes[]; +}; + +export type PageConfig = (args: { data?: RouteData }) => RouteConfig; + +export interface LoaderData { + data?: RouteData; + pageConfig?: RouteConfig; +} + +export interface LoadersData { + [routeId: string]: LoaderData; +} + +// Component & Module Types +export type ComponentModule = { + default?: ComponentType; + Component?: ComponentType; + staticDataLoader?: DataLoaderConfig; + serverDataLoader?: DataLoaderConfig; + dataLoader?: DataLoaderConfig; + pageConfig?: PageConfig; + [key: string]: any; +}; + +export interface RouteModules { + [routeId: string]: ComponentModule; +} + +export interface RouteWrapperConfig { + Wrapper: RouteWrapper; + layout?: boolean; +} + +// Runtime Types +export interface AppContext { + appConfig: AppConfig; + appData: any; + documentData?: any; + serverData?: any; + assetsManifest?: AssetsManifest; + loaderData?: LoadersData; + routeModules?: RouteModules; + RouteWrappers?: RouteWrapperConfig[]; + routePath?: string; + matches?: { + params: Params; + pathname: string; + pathnameBase: string; + route: T; + }[]; + routes?: T[]; + documentOnly?: boolean; + matchedIds?: string[]; + appExport?: AppExport; + basename?: string; + downgrade?: boolean; + renderMode?: RenderMode; + requestContext?: RequestContext; + revalidate?: boolean; +} + +// Runtime API Types +export type Renderer = ( + container: Element | Document, + initialChildren: React.ReactNode, + options?: HydrationOptions, +) => Root; + +export type ResponseHandler = ( + req: IncomingMessage, + res: ServerResponse, +) => any | Promise; + +export type SetAppRouter = (AppRouter: ComponentType) => void; +export type GetAppRouter = () => AppProvider; +export type AddProvider = (Provider: AppProvider) => void; +export type SetRender = (render: Renderer) => void; +export type AddWrapper = (wrapper: RouteWrapper, forLayout?: boolean) => void; +export type AddResponseHandler = (handler: ResponseHandler) => void; +export type GetResponseHandlers = () => ResponseHandler[]; + +type UseConfig = () => RouteConfig>; +type UseData = () => RouteData; +type UseAppContext = () => AppContext; + +export interface RuntimeAPI { + setAppRouter?: SetAppRouter; + getAppRouter: GetAppRouter; + addProvider: AddProvider; + addResponseHandler: AddResponseHandler; + getResponseHandlers: GetResponseHandlers; + setRender: SetRender; + addWrapper: AddWrapper; + appContext: AppContext; + useData: UseData; + useConfig: UseConfig; + useAppContext: UseAppContext; + history: History; +} + +// Plugin Types +export interface RuntimePlugin> { + (apis: RuntimeAPI, runtimeOptions?: T): Promise | void; +} + +export interface StaticRuntimeAPI { + appContext: { + appExport: AppExport; + }; +} + +export interface StaticRuntimePlugin> { + (apis: StaticRuntimeAPI, runtimeOptions?: T): Promise | void; +} + +export interface CommonJsRuntime { + default: RuntimePlugin | StaticRuntimePlugin; +} + +// Assets & Runtime Modules +export interface AssetsManifest { + dataLoader?: string; + publicPath: string; + entries: { + [assetPath: string]: string[]; + }; + pages: { + [assetPath: string]: string[]; + }; + assets?: { + [assetPath: string]: string; + }; +} + +export interface RuntimeModules { + statics?: (StaticRuntimePlugin | CommonJsRuntime)[]; + commons?: (RuntimePlugin | CommonJsRuntime)[]; +} + +// Loader & Routes Types +export interface RouteLoaderOptions { + routeId: string; + requestContext?: RequestContext; + module: ComponentModule; + renderMode: RenderMode; +} + +export type CreateRoutes = (options: Pick) => T[]; + +export interface RunClientAppOptions { + app: AppExport; + runtimeModules: RuntimeModules; + createRoutes?: CreateRoutes; + hydrate?: boolean; + basename?: string; + memoryRouter?: boolean; + runtimeOptions?: Record; + dataLoaderFetcher?: (config: StaticDataLoader) => void; + dataLoaderDecorator?: (loader: Loader, index?: number) => (requestContext: RequestContext) => DataLoaderResult; +} + +declare global { + interface ImportMeta { + target: string; + renderer: 'client' | 'server'; + env: Record; + } +} diff --git a/packages/runtime-kit/tsconfig.json b/packages/runtime-kit/tsconfig.json new file mode 100644 index 0000000000..f9a30162b7 --- /dev/null +++ b/packages/runtime-kit/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "baseUrl": "." + }, + "include": ["src"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/runtime-kit/tsup.config.ts b/packages/runtime-kit/tsup.config.ts new file mode 100644 index 0000000000..f424baac66 --- /dev/null +++ b/packages/runtime-kit/tsup.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + entry: ['src/index.ts'], + format: ['cjs', 'esm'], + dts: true, + splitting: false, + sourcemap: true, + clean: true, +}); diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 8a18717a50..998eb47608 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -60,7 +60,8 @@ "abortcontroller-polyfill": "1.7.5", "history": "^5.3.0", "react-router-dom": "6.21.3", - "semver": "^7.4.0" + "semver": "^7.4.0", + "@ice/runtime-kit": "^0.1.0" }, "peerDependencies": { "react": "^18.1.0", diff --git a/packages/shared-config/src/types.ts b/packages/shared-config/src/types.ts index 26d469c334..158c7de1e4 100644 --- a/packages/shared-config/src/types.ts +++ b/packages/shared-config/src/types.ts @@ -233,4 +233,6 @@ export interface Config { useDataLoader?: boolean; optimizePackageImports?: string[]; + + runtimeSource?: string; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index de3814851c..18d4760f87 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2403,6 +2403,9 @@ importers: '@ice/jsx-runtime': specifier: ^0.3.1 version: link:../jsx-runtime + '@ice/runtime-kit': + specifier: ^0.1.0 + version: link:../runtime-kit '@ice/shared': specifier: ^1.1.0 version: link:../shared @@ -2441,6 +2444,27 @@ importers: specifier: ^0.13.9 version: 0.13.11 + packages/runtime-kit: + devDependencies: + '@types/react': + specifier: ^18.0.8 + version: 18.0.34 + '@types/react-dom': + specifier: ^18.0.3 + version: 18.0.11 + react: + specifier: ^18.0.0 + version: 18.2.0 + react-dom: + specifier: ^18.0.0 + version: 18.2.0(react@18.2.0) + tsup: + specifier: ^8.0.0 + version: 8.3.5(postcss@8.4.31)(tsx@3.12.3)(typescript@5.7.3) + typescript: + specifier: ^5.0.0 + version: 5.7.3 + packages/shared: devDependencies: typescript: @@ -3096,7 +3120,7 @@ packages: '@babel/traverse': 7.23.9 '@babel/types': 7.23.9 convert-source-map: 2.0.0 - debug: 4.3.4 + debug: 4.4.0 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -4520,7 +4544,7 @@ packages: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.23.9 '@babel/types': 7.23.9 - debug: 4.3.4 + debug: 4.4.0 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -6032,6 +6056,15 @@ packages: get-tsconfig: 4.4.0 dev: true + /@esbuild/aix-ppc64@0.24.2: + resolution: {integrity: sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm64@0.16.17: resolution: {integrity: sha512-MIGl6p5sc3RDTLLkYL1MyL8BMRN4tLMRCn+yRJJmEDvYZ2M7tmAf80hx1kbNEUX2KJ50RRtxZ4JHLvCfuB6kBg==} engines: {node: '>=12'} @@ -6049,6 +6082,15 @@ packages: requiresBuild: true optional: true + /@esbuild/android-arm64@0.24.2: + resolution: {integrity: sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm@0.16.17: resolution: {integrity: sha512-N9x1CMXVhtWEAMS7pNNONyA14f71VPQN9Cnavj1XQh6T7bskqiLLrSca4O0Vr8Wdcga943eThxnVp3JLnBMYtw==} engines: {node: '>=12'} @@ -6066,6 +6108,15 @@ packages: requiresBuild: true optional: true + /@esbuild/android-arm@0.24.2: + resolution: {integrity: sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-x64@0.16.17: resolution: {integrity: sha512-a3kTv3m0Ghh4z1DaFEuEDfz3OLONKuFvI4Xqczqx4BqLyuFaFkuaG4j2MtA6fuWEFeC5x9IvqnX7drmRq/fyAQ==} engines: {node: '>=12'} @@ -6083,6 +6134,15 @@ packages: requiresBuild: true optional: true + /@esbuild/android-x64@0.24.2: + resolution: {integrity: sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-arm64@0.16.17: resolution: {integrity: sha512-/2agbUEfmxWHi9ARTX6OQ/KgXnOWfsNlTeLcoV7HSuSTv63E4DqtAc+2XqGw1KHxKMHGZgbVCZge7HXWX9Vn+w==} engines: {node: '>=12'} @@ -6100,6 +6160,15 @@ packages: requiresBuild: true optional: true + /@esbuild/darwin-arm64@0.24.2: + resolution: {integrity: sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-x64@0.16.17: resolution: {integrity: sha512-2By45OBHulkd9Svy5IOCZt376Aa2oOkiE9QWUK9fe6Tb+WDr8hXL3dpqi+DeLiMed8tVXspzsTAvd0jUl96wmg==} engines: {node: '>=12'} @@ -6117,6 +6186,15 @@ packages: requiresBuild: true optional: true + /@esbuild/darwin-x64@0.24.2: + resolution: {integrity: sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-arm64@0.16.17: resolution: {integrity: sha512-mt+cxZe1tVx489VTb4mBAOo2aKSnJ33L9fr25JXpqQqzbUIw/yzIzi+NHwAXK2qYV1lEFp4OoVeThGjUbmWmdw==} engines: {node: '>=12'} @@ -6134,6 +6212,15 @@ packages: requiresBuild: true optional: true + /@esbuild/freebsd-arm64@0.24.2: + resolution: {integrity: sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-x64@0.16.17: resolution: {integrity: sha512-8ScTdNJl5idAKjH8zGAsN7RuWcyHG3BAvMNpKOBaqqR7EbUhhVHOqXRdL7oZvz8WNHL2pr5+eIT5c65kA6NHug==} engines: {node: '>=12'} @@ -6151,6 +6238,15 @@ packages: requiresBuild: true optional: true + /@esbuild/freebsd-x64@0.24.2: + resolution: {integrity: sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm64@0.16.17: resolution: {integrity: sha512-7S8gJnSlqKGVJunnMCrXHU9Q8Q/tQIxk/xL8BqAP64wchPCTzuM6W3Ra8cIa1HIflAvDnNOt2jaL17vaW+1V0g==} engines: {node: '>=12'} @@ -6168,6 +6264,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-arm64@0.24.2: + resolution: {integrity: sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm@0.16.17: resolution: {integrity: sha512-iihzrWbD4gIT7j3caMzKb/RsFFHCwqqbrbH9SqUSRrdXkXaygSZCZg1FybsZz57Ju7N/SHEgPyaR0LZ8Zbe9gQ==} engines: {node: '>=12'} @@ -6185,6 +6290,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-arm@0.24.2: + resolution: {integrity: sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ia32@0.16.17: resolution: {integrity: sha512-kiX69+wcPAdgl3Lonh1VI7MBr16nktEvOfViszBSxygRQqSpzv7BffMKRPMFwzeJGPxcio0pdD3kYQGpqQ2SSg==} engines: {node: '>=12'} @@ -6202,6 +6316,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-ia32@0.24.2: + resolution: {integrity: sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-loong64@0.14.54: resolution: {integrity: sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==} engines: {node: '>=12'} @@ -6228,6 +6351,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-loong64@0.24.2: + resolution: {integrity: sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-mips64el@0.16.17: resolution: {integrity: sha512-ezbDkp2nDl0PfIUn0CsQ30kxfcLTlcx4Foz2kYv8qdC6ia2oX5Q3E/8m6lq84Dj/6b0FrkgD582fJMIfHhJfSw==} engines: {node: '>=12'} @@ -6245,6 +6377,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-mips64el@0.24.2: + resolution: {integrity: sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ppc64@0.16.17: resolution: {integrity: sha512-dzS678gYD1lJsW73zrFhDApLVdM3cUF2MvAa1D8K8KtcSKdLBPP4zZSLy6LFZ0jYqQdQ29bjAHJDgz0rVbLB3g==} engines: {node: '>=12'} @@ -6262,6 +6403,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-ppc64@0.24.2: + resolution: {integrity: sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-riscv64@0.16.17: resolution: {integrity: sha512-ylNlVsxuFjZK8DQtNUwiMskh6nT0vI7kYl/4fZgV1llP5d6+HIeL/vmmm3jpuoo8+NuXjQVZxmKuhDApK0/cKw==} engines: {node: '>=12'} @@ -6279,6 +6429,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-riscv64@0.24.2: + resolution: {integrity: sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-s390x@0.16.17: resolution: {integrity: sha512-gzy7nUTO4UA4oZ2wAMXPNBGTzZFP7mss3aKR2hH+/4UUkCOyqmjXiKpzGrY2TlEUhbbejzXVKKGazYcQTZWA/w==} engines: {node: '>=12'} @@ -6296,6 +6455,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-s390x@0.24.2: + resolution: {integrity: sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-x64@0.16.17: resolution: {integrity: sha512-mdPjPxfnmoqhgpiEArqi4egmBAMYvaObgn4poorpUaqmvzzbvqbowRllQ+ZgzGVMGKaPkqUmPDOOFQRUFDmeUw==} engines: {node: '>=12'} @@ -6313,6 +6481,24 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-x64@0.24.2: + resolution: {integrity: sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-arm64@0.24.2: + resolution: {integrity: sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/netbsd-x64@0.16.17: resolution: {integrity: sha512-/PzmzD/zyAeTUsduZa32bn0ORug+Jd1EGGAUJvqfeixoEISYpGnAezN6lnJoskauoai0Jrs+XSyvDhppCPoKOA==} engines: {node: '>=12'} @@ -6330,6 +6516,24 @@ packages: requiresBuild: true optional: true + /@esbuild/netbsd-x64@0.24.2: + resolution: {integrity: sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-arm64@0.24.2: + resolution: {integrity: sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/openbsd-x64@0.16.17: resolution: {integrity: sha512-2yaWJhvxGEz2RiftSk0UObqJa/b+rIAjnODJgv2GbGGpRwAfpgzyrg1WLK8rqA24mfZa9GvpjLcBBg8JHkoodg==} engines: {node: '>=12'} @@ -6347,6 +6551,15 @@ packages: requiresBuild: true optional: true + /@esbuild/openbsd-x64@0.24.2: + resolution: {integrity: sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/sunos-x64@0.16.17: resolution: {integrity: sha512-xtVUiev38tN0R3g8VhRfN7Zl42YCJvyBhRKw1RJjwE1d2emWTVToPLNEQj/5Qxc6lVFATDiy6LjVHYhIPrLxzw==} engines: {node: '>=12'} @@ -6364,6 +6577,15 @@ packages: requiresBuild: true optional: true + /@esbuild/sunos-x64@0.24.2: + resolution: {integrity: sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-arm64@0.16.17: resolution: {integrity: sha512-ga8+JqBDHY4b6fQAmOgtJJue36scANy4l/rL97W+0wYmijhxKetzZdKOJI7olaBaMhWt8Pac2McJdZLxXWUEQw==} engines: {node: '>=12'} @@ -6381,6 +6603,15 @@ packages: requiresBuild: true optional: true + /@esbuild/win32-arm64@0.24.2: + resolution: {integrity: sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-ia32@0.16.17: resolution: {integrity: sha512-WnsKaf46uSSF/sZhwnqE4L/F89AYNMiD4YtEcYekBt9Q7nj0DiId2XH2Ng2PHM54qi5oPrQ8luuzGszqi/veig==} engines: {node: '>=12'} @@ -6398,6 +6629,15 @@ packages: requiresBuild: true optional: true + /@esbuild/win32-ia32@0.24.2: + resolution: {integrity: sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-x64@0.16.17: resolution: {integrity: sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q==} engines: {node: '>=12'} @@ -6415,6 +6655,15 @@ packages: requiresBuild: true optional: true + /@esbuild/win32-x64@0.24.2: + resolution: {integrity: sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@eslint/eslintrc@2.0.0: resolution: {integrity: sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -6858,6 +7107,18 @@ packages: - debug dev: false + /@isaacs/cliui@8.0.2: + resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} + engines: {node: '>=12'} + dependencies: + string-width: 5.1.2 + string-width-cjs: /string-width@4.2.3 + strip-ansi: 7.0.1 + strip-ansi-cjs: /strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: /wrap-ansi@7.0.0 + dev: true + /@istanbuljs/load-nyc-config@1.1.0: resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} engines: {node: '>=8'} @@ -7598,6 +7859,13 @@ packages: semver: 7.4.0 dev: true + /@pkgjs/parseargs@0.11.0: + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + requiresBuild: true + dev: true + optional: true + /@pmmmwh/react-refresh-webpack-plugin@0.5.10(react-refresh@0.14.0)(webpack-dev-server@4.15.0)(webpack@5.88.2): resolution: {integrity: sha512-j0Ya0hCFZPd4x40qLzbhGsh9TMtdb+CJQiso+WxLOPNasohq9cc5SNUcwsZaRH6++Xh91Xkm/xHCkuIiIu0LUA==} engines: {node: '>= 10.13'} @@ -7914,6 +8182,158 @@ packages: rollup: 2.79.1 dev: true + /@rollup/rollup-android-arm-eabi@4.30.1: + resolution: {integrity: sha512-pSWY+EVt3rJ9fQ3IqlrEUtXh3cGqGtPDH1FQlNZehO2yYxCHEX1SPsz1M//NXwYfbTlcKr9WObLnJX9FsS9K1Q==} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-android-arm64@4.30.1: + resolution: {integrity: sha512-/NA2qXxE3D/BRjOJM8wQblmArQq1YoBVJjrjoTSBS09jgUisq7bqxNHJ8kjCHeV21W/9WDGwJEWSN0KQ2mtD/w==} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-arm64@4.30.1: + resolution: {integrity: sha512-r7FQIXD7gB0WJ5mokTUgUWPl0eYIH0wnxqeSAhuIwvnnpjdVB8cRRClyKLQr7lgzjctkbp5KmswWszlwYln03Q==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-x64@4.30.1: + resolution: {integrity: sha512-x78BavIwSH6sqfP2xeI1hd1GpHL8J4W2BXcVM/5KYKoAD3nNsfitQhvWSw+TFtQTLZ9OmlF+FEInEHyubut2OA==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-freebsd-arm64@4.30.1: + resolution: {integrity: sha512-HYTlUAjbO1z8ywxsDFWADfTRfTIIy/oUlfIDmlHYmjUP2QRDTzBuWXc9O4CXM+bo9qfiCclmHk1x4ogBjOUpUQ==} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-freebsd-x64@4.30.1: + resolution: {integrity: sha512-1MEdGqogQLccphhX5myCJqeGNYTNcmTyaic9S7CG3JhwuIByJ7J05vGbZxsizQthP1xpVx7kd3o31eOogfEirw==} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm-gnueabihf@4.30.1: + resolution: {integrity: sha512-PaMRNBSqCx7K3Wc9QZkFx5+CX27WFpAMxJNiYGAXfmMIKC7jstlr32UhTgK6T07OtqR+wYlWm9IxzennjnvdJg==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm-musleabihf@4.30.1: + resolution: {integrity: sha512-B8Rcyj9AV7ZlEFqvB5BubG5iO6ANDsRKlhIxySXcF1axXYUyqwBok+XZPgIYGBgs7LDXfWfifxhw0Ik57T0Yug==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-gnu@4.30.1: + resolution: {integrity: sha512-hqVyueGxAj3cBKrAI4aFHLV+h0Lv5VgWZs9CUGqr1z0fZtlADVV1YPOij6AhcK5An33EXaxnDLmJdQikcn5NEw==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-musl@4.30.1: + resolution: {integrity: sha512-i4Ab2vnvS1AE1PyOIGp2kXni69gU2DAUVt6FSXeIqUCPIR3ZlheMW3oP2JkukDfu3PsexYRbOiJrY+yVNSk9oA==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-loongarch64-gnu@4.30.1: + resolution: {integrity: sha512-fARcF5g296snX0oLGkVxPmysetwUk2zmHcca+e9ObOovBR++9ZPOhqFUM61UUZ2EYpXVPN1redgqVoBB34nTpQ==} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-powerpc64le-gnu@4.30.1: + resolution: {integrity: sha512-GLrZraoO3wVT4uFXh67ElpwQY0DIygxdv0BNW9Hkm3X34wu+BkqrDrkcsIapAY+N2ATEbvak0XQ9gxZtCIA5Rw==} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-riscv64-gnu@4.30.1: + resolution: {integrity: sha512-0WKLaAUUHKBtll0wvOmh6yh3S0wSU9+yas923JIChfxOaaBarmb/lBKPF0w/+jTVozFnOXJeRGZ8NvOxvk/jcw==} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-s390x-gnu@4.30.1: + resolution: {integrity: sha512-GWFs97Ruxo5Bt+cvVTQkOJ6TIx0xJDD/bMAOXWJg8TCSTEK8RnFeOeiFTxKniTc4vMIaWvCplMAFBt9miGxgkA==} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-gnu@4.30.1: + resolution: {integrity: sha512-UtgGb7QGgXDIO+tqqJ5oZRGHsDLO8SlpE4MhqpY9Llpzi5rJMvrK6ZGhsRCST2abZdBqIBeXW6WPD5fGK5SDwg==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-musl@4.30.1: + resolution: {integrity: sha512-V9U8Ey2UqmQsBT+xTOeMzPzwDzyXmnAoO4edZhL7INkwQcaW1Ckv3WJX3qrrp/VHaDkEWIBWhRwP47r8cdrOow==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-arm64-msvc@4.30.1: + resolution: {integrity: sha512-WabtHWiPaFF47W3PkHnjbmWawnX/aE57K47ZDT1BXTS5GgrBUEpvOzq0FI0V/UYzQJgdb8XlhVNH8/fwV8xDjw==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-ia32-msvc@4.30.1: + resolution: {integrity: sha512-pxHAU+Zv39hLUTdQQHUVHf4P+0C47y/ZloorHpzs2SXMRqeAWmGghzAhfOlzFHHwjvgokdFAhC4V+6kC1lRRfw==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-x64-msvc@4.30.1: + resolution: {integrity: sha512-D6qjsXGcvhTjv0kI4fU8tUuBDF/Ueee4SVX79VfNDXZa64TfCW1Slkb6Z7O1p7vflqZjcmOVdZlqf8gvJxc6og==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@rspack/binding-darwin-arm64@0.5.7: resolution: {integrity: sha512-zYTMILRyrON25MW7ifEhkZ6jL33mz8bAHTOhgR8yMpYVJjrKu60+s1qPa+t+GkaH7nNnVmzkTVGECCvaA75hJQ==} cpu: [arm64] @@ -8787,6 +9207,10 @@ packages: /@types/estree@1.0.0: resolution: {integrity: sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==} + /@types/estree@1.0.6: + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + dev: true + /@types/express-serve-static-core@4.17.33: resolution: {integrity: sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==} dependencies: @@ -10093,6 +10517,10 @@ packages: - moment dev: false + /any-promise@1.3.0: + resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + dev: true + /anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} @@ -10820,6 +11248,16 @@ packages: engines: {node: '>=6'} dev: true + /bundle-require@5.1.0(esbuild@0.24.2): + resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.18' + dependencies: + esbuild: 0.24.2 + load-tsconfig: 0.2.5 + dev: true + /bytes@3.0.0: resolution: {integrity: sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==} engines: {node: '>= 0.8'} @@ -11092,6 +11530,13 @@ packages: optionalDependencies: fsevents: 2.3.2 + /chokidar@4.0.3: + resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} + engines: {node: '>= 14.16.0'} + dependencies: + readdirp: 4.1.1 + dev: true + /chownr@1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} dev: true @@ -11324,6 +11769,11 @@ packages: /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + /commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + dev: true + /commander@5.1.0: resolution: {integrity: sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==} engines: {node: '>= 6'} @@ -11407,6 +11857,11 @@ packages: /consola@2.15.3: resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==} + /consola@3.4.0: + resolution: {integrity: sha512-EiPU8G6dQG0GFHNR8ljnZFki/8a+cQwEQ+7wpxdChl02Q8HXlwEZWD5lqAF8vC2sEC3Tehr8hy7vErz88LHyUA==} + engines: {node: ^14.18.0 || >=16.10.0} + dev: true + /console-control-strings@1.1.0: resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} @@ -12077,6 +12532,18 @@ packages: dependencies: ms: 2.1.2 + /debug@4.4.0: + resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.3 + dev: true + /decamelize-keys@1.1.1: resolution: {integrity: sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==} engines: {node: '>=0.10.0'} @@ -12999,6 +13466,39 @@ packages: '@esbuild/win32-ia32': 0.17.16 '@esbuild/win32-x64': 0.17.16 + /esbuild@0.24.2: + resolution: {integrity: sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==} + engines: {node: '>=18'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.24.2 + '@esbuild/android-arm': 0.24.2 + '@esbuild/android-arm64': 0.24.2 + '@esbuild/android-x64': 0.24.2 + '@esbuild/darwin-arm64': 0.24.2 + '@esbuild/darwin-x64': 0.24.2 + '@esbuild/freebsd-arm64': 0.24.2 + '@esbuild/freebsd-x64': 0.24.2 + '@esbuild/linux-arm': 0.24.2 + '@esbuild/linux-arm64': 0.24.2 + '@esbuild/linux-ia32': 0.24.2 + '@esbuild/linux-loong64': 0.24.2 + '@esbuild/linux-mips64el': 0.24.2 + '@esbuild/linux-ppc64': 0.24.2 + '@esbuild/linux-riscv64': 0.24.2 + '@esbuild/linux-s390x': 0.24.2 + '@esbuild/linux-x64': 0.24.2 + '@esbuild/netbsd-arm64': 0.24.2 + '@esbuild/netbsd-x64': 0.24.2 + '@esbuild/openbsd-arm64': 0.24.2 + '@esbuild/openbsd-x64': 0.24.2 + '@esbuild/sunos-x64': 0.24.2 + '@esbuild/win32-arm64': 0.24.2 + '@esbuild/win32-ia32': 0.24.2 + '@esbuild/win32-x64': 0.24.2 + dev: true + /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -13669,6 +14169,17 @@ packages: pend: 1.2.0 dev: true + /fdir@6.4.2(picomatch@4.0.2): + resolution: {integrity: sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + dependencies: + picomatch: 4.0.2 + dev: true + /feed@4.2.2: resolution: {integrity: sha512-u5/sxGfiMfZNtJ3OvQpXcvotFpYkL0n9u9mM2vkui2nGo8b4wvDkJ8gAkYqbA8QpGyFCv3RK0Z+Iv+9veCS9bQ==} engines: {node: '>=0.4.0'} @@ -13832,6 +14343,14 @@ packages: signal-exit: 3.0.7 dev: true + /foreground-child@3.3.0: + resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} + engines: {node: '>=14'} + dependencies: + cross-spawn: 7.0.3 + signal-exit: 4.0.2 + dev: true + /forever-agent@0.6.1: resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==} dev: false @@ -14118,6 +14637,18 @@ packages: /glob-to-regexp@0.4.1: resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} + /glob@10.4.5: + resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} + hasBin: true + dependencies: + foreground-child: 3.3.0 + jackspeak: 3.4.3 + minimatch: 9.0.5 + minipass: 7.1.2 + package-json-from-dist: 1.0.1 + path-scurry: 1.11.1 + dev: true + /glob@6.0.4: resolution: {integrity: sha512-MKZeRNyYZAVVVG1oZeLaWie1uweH40m9AZwIwxyPbTSX4hHrVYSzLg0Ro5Z5R7XKkIX+Cc6oD1rqeDJnwsB8/A==} dependencies: @@ -15357,6 +15888,14 @@ packages: istanbul-lib-report: 3.0.0 dev: true + /jackspeak@3.4.3: + resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + dev: true + /jake@10.8.5: resolution: {integrity: sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==} engines: {node: '>=10'} @@ -16226,6 +16765,11 @@ packages: '@sideway/formula': 3.0.1 '@sideway/pinpoint': 2.0.0 + /joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + dev: true + /js-base64@3.7.5: resolution: {integrity: sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==} @@ -16517,6 +17061,11 @@ packages: resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} engines: {node: '>=10'} + /lilconfig@3.1.3: + resolution: {integrity: sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==} + engines: {node: '>=14'} + dev: true + /lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} @@ -16562,6 +17111,11 @@ packages: wrap-ansi: 7.0.0 dev: true + /load-tsconfig@0.2.5: + resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + /load-yaml-file@0.2.0: resolution: {integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==} engines: {node: '>=6'} @@ -16741,6 +17295,10 @@ packages: resolution: {integrity: sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==} engines: {node: '>=8'} + /lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + dev: true + /lru-cache@4.1.5: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} dependencies: @@ -17056,6 +17614,13 @@ packages: dependencies: brace-expansion: 2.0.1 + /minimatch@9.0.5: + resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimist-options@4.1.0: resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==} engines: {node: '>= 6'} @@ -17103,6 +17668,11 @@ packages: resolution: {integrity: sha512-lwycX3cBMTvcejsHITUgYj6Gy6A7Nh4Q6h9NP4sTHY1ccJlC7yKzDmiShEHsJ16Jf1nKGDEaiHxiltsJEvk0nQ==} engines: {node: '>=8'} + /minipass@7.1.2: + resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} + engines: {node: '>=16 || 14 >=14.17'} + dev: true + /minizlib@2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -17215,6 +17785,14 @@ packages: engines: {node: '>=12.0.0'} dev: true + /mz@2.7.0: + resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + dependencies: + any-promise: 1.3.0 + object-assign: 4.1.1 + thenify-all: 1.6.0 + dev: true + /nanoid@3.1.20: resolution: {integrity: sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -17656,6 +18234,10 @@ packages: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} + /package-json-from-dist@1.0.1: + resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} + dev: true + /package-json@6.5.0: resolution: {integrity: sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==} engines: {node: '>=8'} @@ -17760,6 +18342,14 @@ packages: /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + /path-scurry@1.11.1: + resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} + engines: {node: '>=16 || 14 >=14.18'} + dependencies: + lru-cache: 10.4.3 + minipass: 7.1.2 + dev: true + /path-to-regexp@0.1.7: resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} @@ -17806,10 +18396,19 @@ packages: /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + /picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + dev: true + /picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + /picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + dev: true + /pidtree@0.6.0: resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==} engines: {node: '>=0.10'} @@ -18172,6 +18771,29 @@ packages: yaml: 1.10.2 dev: true + /postcss-load-config@6.0.1(postcss@8.4.31)(tsx@3.12.3): + resolution: {integrity: sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==} + engines: {node: '>= 18'} + peerDependencies: + jiti: '>=1.21.0' + postcss: '>=8.0.9' + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + jiti: + optional: true + postcss: + optional: true + tsx: + optional: true + yaml: + optional: true + dependencies: + lilconfig: 3.1.3 + postcss: 8.4.31 + tsx: 3.12.3 + dev: true + /postcss-loader@6.2.1(postcss@8.4.31)(webpack@5.88.2): resolution: {integrity: sha512-WbbYpmAaKcux/P66bZ40bpWsBucjx/TTgVVzRZ9yUO8yQfVBlameJ0ZGVaPfH64hNSBh63a+ICP5nqOpBA0w+Q==} engines: {node: '>= 12.13.0'} @@ -20385,6 +21007,11 @@ packages: dependencies: picomatch: 2.3.1 + /readdirp@4.1.1: + resolution: {integrity: sha512-h80JrZu/MHUZCyHu5ciuoI0+WxsCxzxJTILn6Fs8rxSnFPh+UVHYfeIxK1nVGugMqkfC4vJcBOYbkfkwYK0+gw==} + engines: {node: '>= 14.18.0'} + dev: true + /reading-time@1.5.0: resolution: {integrity: sha512-onYyVhBNr4CmAxFsKS7bz+uTLRakypIe4R+5A824vBSkQy/hB3fZepoVEf8OVAxzLvK+H/jm9TzpI3ETSm64Kg==} @@ -20808,6 +21435,35 @@ packages: fsevents: 2.3.2 dev: true + /rollup@4.30.1: + resolution: {integrity: sha512-mlJ4glW020fPuLi7DkM/lN97mYEZGWeqBnrljzN0gs7GLctqX3lNWxKQ7Gl712UAX+6fog/L3jh4gb7R6aVi3w==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + dependencies: + '@types/estree': 1.0.6 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.30.1 + '@rollup/rollup-android-arm64': 4.30.1 + '@rollup/rollup-darwin-arm64': 4.30.1 + '@rollup/rollup-darwin-x64': 4.30.1 + '@rollup/rollup-freebsd-arm64': 4.30.1 + '@rollup/rollup-freebsd-x64': 4.30.1 + '@rollup/rollup-linux-arm-gnueabihf': 4.30.1 + '@rollup/rollup-linux-arm-musleabihf': 4.30.1 + '@rollup/rollup-linux-arm64-gnu': 4.30.1 + '@rollup/rollup-linux-arm64-musl': 4.30.1 + '@rollup/rollup-linux-loongarch64-gnu': 4.30.1 + '@rollup/rollup-linux-powerpc64le-gnu': 4.30.1 + '@rollup/rollup-linux-riscv64-gnu': 4.30.1 + '@rollup/rollup-linux-s390x-gnu': 4.30.1 + '@rollup/rollup-linux-x64-gnu': 4.30.1 + '@rollup/rollup-linux-x64-musl': 4.30.1 + '@rollup/rollup-win32-arm64-msvc': 4.30.1 + '@rollup/rollup-win32-ia32-msvc': 4.30.1 + '@rollup/rollup-win32-x64-msvc': 4.30.1 + fsevents: 2.3.2 + dev: true + /rs-module-lexer@2.3.0: resolution: {integrity: sha512-Ap6ez0EupuGKoohMq1yClBcGRjivQnemFeR0aIYWjyYT1n8HOywYYi0WUz3bzLVSwAKE4OhFHPDr6LiqHGwwvQ==} engines: {node: '>=14'} @@ -21786,6 +22442,20 @@ packages: resolution: {integrity: sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA==} dev: false + /sucrase@3.35.0: + resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==} + engines: {node: '>=16 || 14 >=14.17'} + hasBin: true + dependencies: + '@jridgewell/gen-mapping': 0.3.2 + commander: 4.1.1 + glob: 10.4.5 + lines-and-columns: 1.2.4 + mz: 2.7.0 + pirates: 4.0.5 + ts-interface-checker: 0.1.13 + dev: true + /supports-color@2.0.0: resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} engines: {node: '>=0.8.0'} @@ -22170,6 +22840,19 @@ packages: /text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + /thenify-all@1.6.0: + resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} + engines: {node: '>=0.8'} + dependencies: + thenify: 3.3.1 + dev: true + + /thenify@3.3.1: + resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + dependencies: + any-promise: 1.3.0 + dev: true + /throttle-debounce@5.0.0: resolution: {integrity: sha512-2iQTSgkkc1Zyk0MeVrt/3BvuOXYPl/R8Z0U2xxo9rjwNciaHDG3R+Lm6dh4EeUci49DanvBnuqI6jshoQQRGEg==} engines: {node: '>=12.22'} @@ -22197,6 +22880,18 @@ packages: resolution: {integrity: sha512-iyziEiyFxX4kyxSp+MtY1oCH/lvjH3PxFN8PGCDeqcZWAJ/i+9y+nL85w99PxVzrIvew/GSkSbDYtiGVa85Afg==} dev: true + /tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + dev: true + + /tinyglobby@0.2.10: + resolution: {integrity: sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==} + engines: {node: '>=12.0.0'} + dependencies: + fdir: 6.4.2(picomatch@4.0.2) + picomatch: 4.0.2 + dev: true + /tinypool@0.1.3: resolution: {integrity: sha512-2IfcQh7CP46XGWGGbdyO4pjcKqsmVqFAPcXfPxcPXmOWt9cYkTP9HcDmGgsfijYoAEc4z9qcpM/BaBz46Y9/CQ==} engines: {node: '>=14.0.0'} @@ -22287,6 +22982,11 @@ packages: punycode: 2.3.0 dev: true + /tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + dev: true + /trim-newlines@3.0.1: resolution: {integrity: sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==} engines: {node: '>=8'} @@ -22326,6 +23026,10 @@ packages: - supports-color dev: true + /ts-interface-checker@0.1.13: + resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + dev: true + /ts-jest@28.0.8(@babel/core@7.23.9)(jest@28.1.3)(typescript@4.9.5): resolution: {integrity: sha512-5FaG0lXmRPzApix8oFG8RKjAz4ehtm8yMKOTy5HX3fY6W8kmvOrmcY0hKDElW52FJov+clhUbrKAqofnj4mXTg==} engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0} @@ -22419,6 +23123,50 @@ packages: /tslib@2.5.0: resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} + /tsup@8.3.5(postcss@8.4.31)(tsx@3.12.3)(typescript@5.7.3): + resolution: {integrity: sha512-Tunf6r6m6tnZsG9GYWndg0z8dEV7fD733VBFzFJ5Vcm1FtlXB8xBD/rtrBi2a3YKEV7hHtxiZtW5EAVADoe1pA==} + engines: {node: '>=18'} + hasBin: true + peerDependencies: + '@microsoft/api-extractor': ^7.36.0 + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.5.0' + peerDependenciesMeta: + '@microsoft/api-extractor': + optional: true + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + dependencies: + bundle-require: 5.1.0(esbuild@0.24.2) + cac: 6.7.14 + chokidar: 4.0.3 + consola: 3.4.0 + debug: 4.4.0 + esbuild: 0.24.2 + joycon: 3.1.1 + picocolors: 1.1.1 + postcss: 8.4.31 + postcss-load-config: 6.0.1(postcss@8.4.31)(tsx@3.12.3) + resolve-from: 5.0.0 + rollup: 4.30.1 + source-map: 0.8.0-beta.0 + sucrase: 3.35.0 + tinyexec: 0.3.2 + tinyglobby: 0.2.10 + tree-kill: 1.2.2 + typescript: 5.7.3 + transitivePeerDependencies: + - jiti + - supports-color + - tsx + - yaml + dev: true + /tsutils@3.21.0(typescript@4.9.5): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} @@ -22548,6 +23296,12 @@ packages: engines: {node: '>=4.2.0'} hasBin: true + /typescript@5.7.3: + resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + /ua-parser-js@0.7.34: resolution: {integrity: sha512-cJMeh/eOILyGu0ejgTKB95yKT3zOenSe9UGE3vj6WfiOwgGYnmATUsnDixMFvdU+rNMvWih83hrUP8VwhF9yXQ==} dev: false From 1555e960a26230ff9c356368314759c1fd1e92ad Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 16 Jan 2025 19:59:15 +0800 Subject: [PATCH 02/10] fix: update scripts --- packages/runtime-kit/package.json | 13 +- packages/runtime-kit/tsconfig.json | 5 +- packages/runtime-kit/tsup.config.ts | 10 - pnpm-lock.yaml | 715 ---------------------------- 4 files changed, 9 insertions(+), 734 deletions(-) delete mode 100644 packages/runtime-kit/tsup.config.ts diff --git a/packages/runtime-kit/package.json b/packages/runtime-kit/package.json index f549e5a21d..9888215cba 100644 --- a/packages/runtime-kit/package.json +++ b/packages/runtime-kit/package.json @@ -2,20 +2,19 @@ "name": "@ice/runtime-kit", "version": "0.1.0", "description": "Runtime utilities and tools for ICE framework", - "main": "./dist/index.js", - "module": "./dist/index.mjs", - "types": "./dist/index.d.ts", + "main": "./esm/index.js", + "module": "./esm/index.mjs", + "types": "./esm/index.d.ts", "files": [ - "dist" + "esm" ], "sideEffects": false, "scripts": { - "build": "tsup", - "watch": "tsup --watch" + "watch": "tsc -w --sourceMap", + "build": "tsc" }, "dependencies": {}, "devDependencies": { - "tsup": "^8.0.0", "typescript": "^5.0.0", "@types/react": "^18.0.8", "@types/react-dom": "^18.0.3", diff --git a/packages/runtime-kit/tsconfig.json b/packages/runtime-kit/tsconfig.json index f9a30162b7..d4290f3d1f 100644 --- a/packages/runtime-kit/tsconfig.json +++ b/packages/runtime-kit/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "baseUrl": "./", "rootDir": "src", - "outDir": "dist", - "baseUrl": "." + "outDir": "esm", + "module": "ES2020" }, "include": ["src"], "exclude": ["node_modules", "dist"] diff --git a/packages/runtime-kit/tsup.config.ts b/packages/runtime-kit/tsup.config.ts deleted file mode 100644 index f424baac66..0000000000 --- a/packages/runtime-kit/tsup.config.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { defineConfig } from 'tsup'; - -export default defineConfig({ - entry: ['src/index.ts'], - format: ['cjs', 'esm'], - dts: true, - splitting: false, - sourcemap: true, - clean: true, -}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 18d4760f87..7af99bfe51 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2458,9 +2458,6 @@ importers: react-dom: specifier: ^18.0.0 version: 18.2.0(react@18.2.0) - tsup: - specifier: ^8.0.0 - version: 8.3.5(postcss@8.4.31)(tsx@3.12.3)(typescript@5.7.3) typescript: specifier: ^5.0.0 version: 5.7.3 @@ -6056,15 +6053,6 @@ packages: get-tsconfig: 4.4.0 dev: true - /@esbuild/aix-ppc64@0.24.2: - resolution: {integrity: sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [aix] - requiresBuild: true - dev: true - optional: true - /@esbuild/android-arm64@0.16.17: resolution: {integrity: sha512-MIGl6p5sc3RDTLLkYL1MyL8BMRN4tLMRCn+yRJJmEDvYZ2M7tmAf80hx1kbNEUX2KJ50RRtxZ4JHLvCfuB6kBg==} engines: {node: '>=12'} @@ -6082,15 +6070,6 @@ packages: requiresBuild: true optional: true - /@esbuild/android-arm64@0.24.2: - resolution: {integrity: sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - /@esbuild/android-arm@0.16.17: resolution: {integrity: sha512-N9x1CMXVhtWEAMS7pNNONyA14f71VPQN9Cnavj1XQh6T7bskqiLLrSca4O0Vr8Wdcga943eThxnVp3JLnBMYtw==} engines: {node: '>=12'} @@ -6108,15 +6087,6 @@ packages: requiresBuild: true optional: true - /@esbuild/android-arm@0.24.2: - resolution: {integrity: sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==} - engines: {node: '>=18'} - cpu: [arm] - os: [android] - requiresBuild: true - dev: true - optional: true - /@esbuild/android-x64@0.16.17: resolution: {integrity: sha512-a3kTv3m0Ghh4z1DaFEuEDfz3OLONKuFvI4Xqczqx4BqLyuFaFkuaG4j2MtA6fuWEFeC5x9IvqnX7drmRq/fyAQ==} engines: {node: '>=12'} @@ -6134,15 +6104,6 @@ packages: requiresBuild: true optional: true - /@esbuild/android-x64@0.24.2: - resolution: {integrity: sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==} - engines: {node: '>=18'} - cpu: [x64] - os: [android] - requiresBuild: true - dev: true - optional: true - /@esbuild/darwin-arm64@0.16.17: resolution: {integrity: sha512-/2agbUEfmxWHi9ARTX6OQ/KgXnOWfsNlTeLcoV7HSuSTv63E4DqtAc+2XqGw1KHxKMHGZgbVCZge7HXWX9Vn+w==} engines: {node: '>=12'} @@ -6160,15 +6121,6 @@ packages: requiresBuild: true optional: true - /@esbuild/darwin-arm64@0.24.2: - resolution: {integrity: sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==} - engines: {node: '>=18'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - /@esbuild/darwin-x64@0.16.17: resolution: {integrity: sha512-2By45OBHulkd9Svy5IOCZt376Aa2oOkiE9QWUK9fe6Tb+WDr8hXL3dpqi+DeLiMed8tVXspzsTAvd0jUl96wmg==} engines: {node: '>=12'} @@ -6186,15 +6138,6 @@ packages: requiresBuild: true optional: true - /@esbuild/darwin-x64@0.24.2: - resolution: {integrity: sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==} - engines: {node: '>=18'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - /@esbuild/freebsd-arm64@0.16.17: resolution: {integrity: sha512-mt+cxZe1tVx489VTb4mBAOo2aKSnJ33L9fr25JXpqQqzbUIw/yzIzi+NHwAXK2qYV1lEFp4OoVeThGjUbmWmdw==} engines: {node: '>=12'} @@ -6212,15 +6155,6 @@ packages: requiresBuild: true optional: true - /@esbuild/freebsd-arm64@0.24.2: - resolution: {integrity: sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/freebsd-x64@0.16.17: resolution: {integrity: sha512-8ScTdNJl5idAKjH8zGAsN7RuWcyHG3BAvMNpKOBaqqR7EbUhhVHOqXRdL7oZvz8WNHL2pr5+eIT5c65kA6NHug==} engines: {node: '>=12'} @@ -6238,15 +6172,6 @@ packages: requiresBuild: true optional: true - /@esbuild/freebsd-x64@0.24.2: - resolution: {integrity: sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==} - engines: {node: '>=18'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-arm64@0.16.17: resolution: {integrity: sha512-7S8gJnSlqKGVJunnMCrXHU9Q8Q/tQIxk/xL8BqAP64wchPCTzuM6W3Ra8cIa1HIflAvDnNOt2jaL17vaW+1V0g==} engines: {node: '>=12'} @@ -6264,15 +6189,6 @@ packages: requiresBuild: true optional: true - /@esbuild/linux-arm64@0.24.2: - resolution: {integrity: sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-arm@0.16.17: resolution: {integrity: sha512-iihzrWbD4gIT7j3caMzKb/RsFFHCwqqbrbH9SqUSRrdXkXaygSZCZg1FybsZz57Ju7N/SHEgPyaR0LZ8Zbe9gQ==} engines: {node: '>=12'} @@ -6290,15 +6206,6 @@ packages: requiresBuild: true optional: true - /@esbuild/linux-arm@0.24.2: - resolution: {integrity: sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==} - engines: {node: '>=18'} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-ia32@0.16.17: resolution: {integrity: sha512-kiX69+wcPAdgl3Lonh1VI7MBr16nktEvOfViszBSxygRQqSpzv7BffMKRPMFwzeJGPxcio0pdD3kYQGpqQ2SSg==} engines: {node: '>=12'} @@ -6316,15 +6223,6 @@ packages: requiresBuild: true optional: true - /@esbuild/linux-ia32@0.24.2: - resolution: {integrity: sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==} - engines: {node: '>=18'} - cpu: [ia32] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-loong64@0.14.54: resolution: {integrity: sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==} engines: {node: '>=12'} @@ -6351,15 +6249,6 @@ packages: requiresBuild: true optional: true - /@esbuild/linux-loong64@0.24.2: - resolution: {integrity: sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==} - engines: {node: '>=18'} - cpu: [loong64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-mips64el@0.16.17: resolution: {integrity: sha512-ezbDkp2nDl0PfIUn0CsQ30kxfcLTlcx4Foz2kYv8qdC6ia2oX5Q3E/8m6lq84Dj/6b0FrkgD582fJMIfHhJfSw==} engines: {node: '>=12'} @@ -6377,15 +6266,6 @@ packages: requiresBuild: true optional: true - /@esbuild/linux-mips64el@0.24.2: - resolution: {integrity: sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==} - engines: {node: '>=18'} - cpu: [mips64el] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-ppc64@0.16.17: resolution: {integrity: sha512-dzS678gYD1lJsW73zrFhDApLVdM3cUF2MvAa1D8K8KtcSKdLBPP4zZSLy6LFZ0jYqQdQ29bjAHJDgz0rVbLB3g==} engines: {node: '>=12'} @@ -6403,15 +6283,6 @@ packages: requiresBuild: true optional: true - /@esbuild/linux-ppc64@0.24.2: - resolution: {integrity: sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-riscv64@0.16.17: resolution: {integrity: sha512-ylNlVsxuFjZK8DQtNUwiMskh6nT0vI7kYl/4fZgV1llP5d6+HIeL/vmmm3jpuoo8+NuXjQVZxmKuhDApK0/cKw==} engines: {node: '>=12'} @@ -6429,15 +6300,6 @@ packages: requiresBuild: true optional: true - /@esbuild/linux-riscv64@0.24.2: - resolution: {integrity: sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==} - engines: {node: '>=18'} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-s390x@0.16.17: resolution: {integrity: sha512-gzy7nUTO4UA4oZ2wAMXPNBGTzZFP7mss3aKR2hH+/4UUkCOyqmjXiKpzGrY2TlEUhbbejzXVKKGazYcQTZWA/w==} engines: {node: '>=12'} @@ -6455,15 +6317,6 @@ packages: requiresBuild: true optional: true - /@esbuild/linux-s390x@0.24.2: - resolution: {integrity: sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==} - engines: {node: '>=18'} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@esbuild/linux-x64@0.16.17: resolution: {integrity: sha512-mdPjPxfnmoqhgpiEArqi4egmBAMYvaObgn4poorpUaqmvzzbvqbowRllQ+ZgzGVMGKaPkqUmPDOOFQRUFDmeUw==} engines: {node: '>=12'} @@ -6481,24 +6334,6 @@ packages: requiresBuild: true optional: true - /@esbuild/linux-x64@0.24.2: - resolution: {integrity: sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==} - engines: {node: '>=18'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@esbuild/netbsd-arm64@0.24.2: - resolution: {integrity: sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==} - engines: {node: '>=18'} - cpu: [arm64] - os: [netbsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/netbsd-x64@0.16.17: resolution: {integrity: sha512-/PzmzD/zyAeTUsduZa32bn0ORug+Jd1EGGAUJvqfeixoEISYpGnAezN6lnJoskauoai0Jrs+XSyvDhppCPoKOA==} engines: {node: '>=12'} @@ -6516,24 +6351,6 @@ packages: requiresBuild: true optional: true - /@esbuild/netbsd-x64@0.24.2: - resolution: {integrity: sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==} - engines: {node: '>=18'} - cpu: [x64] - os: [netbsd] - requiresBuild: true - dev: true - optional: true - - /@esbuild/openbsd-arm64@0.24.2: - resolution: {integrity: sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==} - engines: {node: '>=18'} - cpu: [arm64] - os: [openbsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/openbsd-x64@0.16.17: resolution: {integrity: sha512-2yaWJhvxGEz2RiftSk0UObqJa/b+rIAjnODJgv2GbGGpRwAfpgzyrg1WLK8rqA24mfZa9GvpjLcBBg8JHkoodg==} engines: {node: '>=12'} @@ -6551,15 +6368,6 @@ packages: requiresBuild: true optional: true - /@esbuild/openbsd-x64@0.24.2: - resolution: {integrity: sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==} - engines: {node: '>=18'} - cpu: [x64] - os: [openbsd] - requiresBuild: true - dev: true - optional: true - /@esbuild/sunos-x64@0.16.17: resolution: {integrity: sha512-xtVUiev38tN0R3g8VhRfN7Zl42YCJvyBhRKw1RJjwE1d2emWTVToPLNEQj/5Qxc6lVFATDiy6LjVHYhIPrLxzw==} engines: {node: '>=12'} @@ -6577,15 +6385,6 @@ packages: requiresBuild: true optional: true - /@esbuild/sunos-x64@0.24.2: - resolution: {integrity: sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==} - engines: {node: '>=18'} - cpu: [x64] - os: [sunos] - requiresBuild: true - dev: true - optional: true - /@esbuild/win32-arm64@0.16.17: resolution: {integrity: sha512-ga8+JqBDHY4b6fQAmOgtJJue36scANy4l/rL97W+0wYmijhxKetzZdKOJI7olaBaMhWt8Pac2McJdZLxXWUEQw==} engines: {node: '>=12'} @@ -6603,15 +6402,6 @@ packages: requiresBuild: true optional: true - /@esbuild/win32-arm64@0.24.2: - resolution: {integrity: sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==} - engines: {node: '>=18'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@esbuild/win32-ia32@0.16.17: resolution: {integrity: sha512-WnsKaf46uSSF/sZhwnqE4L/F89AYNMiD4YtEcYekBt9Q7nj0DiId2XH2Ng2PHM54qi5oPrQ8luuzGszqi/veig==} engines: {node: '>=12'} @@ -6629,15 +6419,6 @@ packages: requiresBuild: true optional: true - /@esbuild/win32-ia32@0.24.2: - resolution: {integrity: sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==} - engines: {node: '>=18'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@esbuild/win32-x64@0.16.17: resolution: {integrity: sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q==} engines: {node: '>=12'} @@ -6655,15 +6436,6 @@ packages: requiresBuild: true optional: true - /@esbuild/win32-x64@0.24.2: - resolution: {integrity: sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==} - engines: {node: '>=18'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@eslint/eslintrc@2.0.0: resolution: {integrity: sha512-fluIaaV+GyV24CCu/ggiHdV+j4RNh85yQnAYS/G2mZODZgGmmlrgCydjUcV3YvxCm9x8nMAfThsqTni4KiXT4A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -7107,18 +6879,6 @@ packages: - debug dev: false - /@isaacs/cliui@8.0.2: - resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} - engines: {node: '>=12'} - dependencies: - string-width: 5.1.2 - string-width-cjs: /string-width@4.2.3 - strip-ansi: 7.0.1 - strip-ansi-cjs: /strip-ansi@6.0.1 - wrap-ansi: 8.1.0 - wrap-ansi-cjs: /wrap-ansi@7.0.0 - dev: true - /@istanbuljs/load-nyc-config@1.1.0: resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} engines: {node: '>=8'} @@ -7859,13 +7619,6 @@ packages: semver: 7.4.0 dev: true - /@pkgjs/parseargs@0.11.0: - resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} - engines: {node: '>=14'} - requiresBuild: true - dev: true - optional: true - /@pmmmwh/react-refresh-webpack-plugin@0.5.10(react-refresh@0.14.0)(webpack-dev-server@4.15.0)(webpack@5.88.2): resolution: {integrity: sha512-j0Ya0hCFZPd4x40qLzbhGsh9TMtdb+CJQiso+WxLOPNasohq9cc5SNUcwsZaRH6++Xh91Xkm/xHCkuIiIu0LUA==} engines: {node: '>= 10.13'} @@ -8182,158 +7935,6 @@ packages: rollup: 2.79.1 dev: true - /@rollup/rollup-android-arm-eabi@4.30.1: - resolution: {integrity: sha512-pSWY+EVt3rJ9fQ3IqlrEUtXh3cGqGtPDH1FQlNZehO2yYxCHEX1SPsz1M//NXwYfbTlcKr9WObLnJX9FsS9K1Q==} - cpu: [arm] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-android-arm64@4.30.1: - resolution: {integrity: sha512-/NA2qXxE3D/BRjOJM8wQblmArQq1YoBVJjrjoTSBS09jgUisq7bqxNHJ8kjCHeV21W/9WDGwJEWSN0KQ2mtD/w==} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-darwin-arm64@4.30.1: - resolution: {integrity: sha512-r7FQIXD7gB0WJ5mokTUgUWPl0eYIH0wnxqeSAhuIwvnnpjdVB8cRRClyKLQr7lgzjctkbp5KmswWszlwYln03Q==} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-darwin-x64@4.30.1: - resolution: {integrity: sha512-x78BavIwSH6sqfP2xeI1hd1GpHL8J4W2BXcVM/5KYKoAD3nNsfitQhvWSw+TFtQTLZ9OmlF+FEInEHyubut2OA==} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-freebsd-arm64@4.30.1: - resolution: {integrity: sha512-HYTlUAjbO1z8ywxsDFWADfTRfTIIy/oUlfIDmlHYmjUP2QRDTzBuWXc9O4CXM+bo9qfiCclmHk1x4ogBjOUpUQ==} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-freebsd-x64@4.30.1: - resolution: {integrity: sha512-1MEdGqogQLccphhX5myCJqeGNYTNcmTyaic9S7CG3JhwuIByJ7J05vGbZxsizQthP1xpVx7kd3o31eOogfEirw==} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-linux-arm-gnueabihf@4.30.1: - resolution: {integrity: sha512-PaMRNBSqCx7K3Wc9QZkFx5+CX27WFpAMxJNiYGAXfmMIKC7jstlr32UhTgK6T07OtqR+wYlWm9IxzennjnvdJg==} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-linux-arm-musleabihf@4.30.1: - resolution: {integrity: sha512-B8Rcyj9AV7ZlEFqvB5BubG5iO6ANDsRKlhIxySXcF1axXYUyqwBok+XZPgIYGBgs7LDXfWfifxhw0Ik57T0Yug==} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-linux-arm64-gnu@4.30.1: - resolution: {integrity: sha512-hqVyueGxAj3cBKrAI4aFHLV+h0Lv5VgWZs9CUGqr1z0fZtlADVV1YPOij6AhcK5An33EXaxnDLmJdQikcn5NEw==} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-linux-arm64-musl@4.30.1: - resolution: {integrity: sha512-i4Ab2vnvS1AE1PyOIGp2kXni69gU2DAUVt6FSXeIqUCPIR3ZlheMW3oP2JkukDfu3PsexYRbOiJrY+yVNSk9oA==} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-linux-loongarch64-gnu@4.30.1: - resolution: {integrity: sha512-fARcF5g296snX0oLGkVxPmysetwUk2zmHcca+e9ObOovBR++9ZPOhqFUM61UUZ2EYpXVPN1redgqVoBB34nTpQ==} - cpu: [loong64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-linux-powerpc64le-gnu@4.30.1: - resolution: {integrity: sha512-GLrZraoO3wVT4uFXh67ElpwQY0DIygxdv0BNW9Hkm3X34wu+BkqrDrkcsIapAY+N2ATEbvak0XQ9gxZtCIA5Rw==} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-linux-riscv64-gnu@4.30.1: - resolution: {integrity: sha512-0WKLaAUUHKBtll0wvOmh6yh3S0wSU9+yas923JIChfxOaaBarmb/lBKPF0w/+jTVozFnOXJeRGZ8NvOxvk/jcw==} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-linux-s390x-gnu@4.30.1: - resolution: {integrity: sha512-GWFs97Ruxo5Bt+cvVTQkOJ6TIx0xJDD/bMAOXWJg8TCSTEK8RnFeOeiFTxKniTc4vMIaWvCplMAFBt9miGxgkA==} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-linux-x64-gnu@4.30.1: - resolution: {integrity: sha512-UtgGb7QGgXDIO+tqqJ5oZRGHsDLO8SlpE4MhqpY9Llpzi5rJMvrK6ZGhsRCST2abZdBqIBeXW6WPD5fGK5SDwg==} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-linux-x64-musl@4.30.1: - resolution: {integrity: sha512-V9U8Ey2UqmQsBT+xTOeMzPzwDzyXmnAoO4edZhL7INkwQcaW1Ckv3WJX3qrrp/VHaDkEWIBWhRwP47r8cdrOow==} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-win32-arm64-msvc@4.30.1: - resolution: {integrity: sha512-WabtHWiPaFF47W3PkHnjbmWawnX/aE57K47ZDT1BXTS5GgrBUEpvOzq0FI0V/UYzQJgdb8XlhVNH8/fwV8xDjw==} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-win32-ia32-msvc@4.30.1: - resolution: {integrity: sha512-pxHAU+Zv39hLUTdQQHUVHf4P+0C47y/ZloorHpzs2SXMRqeAWmGghzAhfOlzFHHwjvgokdFAhC4V+6kC1lRRfw==} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@rollup/rollup-win32-x64-msvc@4.30.1: - resolution: {integrity: sha512-D6qjsXGcvhTjv0kI4fU8tUuBDF/Ueee4SVX79VfNDXZa64TfCW1Slkb6Z7O1p7vflqZjcmOVdZlqf8gvJxc6og==} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@rspack/binding-darwin-arm64@0.5.7: resolution: {integrity: sha512-zYTMILRyrON25MW7ifEhkZ6jL33mz8bAHTOhgR8yMpYVJjrKu60+s1qPa+t+GkaH7nNnVmzkTVGECCvaA75hJQ==} cpu: [arm64] @@ -9207,10 +8808,6 @@ packages: /@types/estree@1.0.0: resolution: {integrity: sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==} - /@types/estree@1.0.6: - resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} - dev: true - /@types/express-serve-static-core@4.17.33: resolution: {integrity: sha512-TPBqmR/HRYI3eC2E5hmiivIzv+bidAfXofM+sbonAGvyDhySGw9/PQZFt2BLOrjUUR++4eJVpx6KnLQK1Fk9tA==} dependencies: @@ -10517,10 +10114,6 @@ packages: - moment dev: false - /any-promise@1.3.0: - resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} - dev: true - /anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} @@ -11248,16 +10841,6 @@ packages: engines: {node: '>=6'} dev: true - /bundle-require@5.1.0(esbuild@0.24.2): - resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - peerDependencies: - esbuild: '>=0.18' - dependencies: - esbuild: 0.24.2 - load-tsconfig: 0.2.5 - dev: true - /bytes@3.0.0: resolution: {integrity: sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==} engines: {node: '>= 0.8'} @@ -11530,13 +11113,6 @@ packages: optionalDependencies: fsevents: 2.3.2 - /chokidar@4.0.3: - resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} - engines: {node: '>= 14.16.0'} - dependencies: - readdirp: 4.1.1 - dev: true - /chownr@1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} dev: true @@ -11769,11 +11345,6 @@ packages: /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} - /commander@4.1.1: - resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} - engines: {node: '>= 6'} - dev: true - /commander@5.1.0: resolution: {integrity: sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==} engines: {node: '>= 6'} @@ -11857,11 +11428,6 @@ packages: /consola@2.15.3: resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==} - /consola@3.4.0: - resolution: {integrity: sha512-EiPU8G6dQG0GFHNR8ljnZFki/8a+cQwEQ+7wpxdChl02Q8HXlwEZWD5lqAF8vC2sEC3Tehr8hy7vErz88LHyUA==} - engines: {node: ^14.18.0 || >=16.10.0} - dev: true - /console-control-strings@1.1.0: resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} @@ -13466,39 +13032,6 @@ packages: '@esbuild/win32-ia32': 0.17.16 '@esbuild/win32-x64': 0.17.16 - /esbuild@0.24.2: - resolution: {integrity: sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==} - engines: {node: '>=18'} - hasBin: true - requiresBuild: true - optionalDependencies: - '@esbuild/aix-ppc64': 0.24.2 - '@esbuild/android-arm': 0.24.2 - '@esbuild/android-arm64': 0.24.2 - '@esbuild/android-x64': 0.24.2 - '@esbuild/darwin-arm64': 0.24.2 - '@esbuild/darwin-x64': 0.24.2 - '@esbuild/freebsd-arm64': 0.24.2 - '@esbuild/freebsd-x64': 0.24.2 - '@esbuild/linux-arm': 0.24.2 - '@esbuild/linux-arm64': 0.24.2 - '@esbuild/linux-ia32': 0.24.2 - '@esbuild/linux-loong64': 0.24.2 - '@esbuild/linux-mips64el': 0.24.2 - '@esbuild/linux-ppc64': 0.24.2 - '@esbuild/linux-riscv64': 0.24.2 - '@esbuild/linux-s390x': 0.24.2 - '@esbuild/linux-x64': 0.24.2 - '@esbuild/netbsd-arm64': 0.24.2 - '@esbuild/netbsd-x64': 0.24.2 - '@esbuild/openbsd-arm64': 0.24.2 - '@esbuild/openbsd-x64': 0.24.2 - '@esbuild/sunos-x64': 0.24.2 - '@esbuild/win32-arm64': 0.24.2 - '@esbuild/win32-ia32': 0.24.2 - '@esbuild/win32-x64': 0.24.2 - dev: true - /escalade@3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -14169,17 +13702,6 @@ packages: pend: 1.2.0 dev: true - /fdir@6.4.2(picomatch@4.0.2): - resolution: {integrity: sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==} - peerDependencies: - picomatch: ^3 || ^4 - peerDependenciesMeta: - picomatch: - optional: true - dependencies: - picomatch: 4.0.2 - dev: true - /feed@4.2.2: resolution: {integrity: sha512-u5/sxGfiMfZNtJ3OvQpXcvotFpYkL0n9u9mM2vkui2nGo8b4wvDkJ8gAkYqbA8QpGyFCv3RK0Z+Iv+9veCS9bQ==} engines: {node: '>=0.4.0'} @@ -14343,14 +13865,6 @@ packages: signal-exit: 3.0.7 dev: true - /foreground-child@3.3.0: - resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} - engines: {node: '>=14'} - dependencies: - cross-spawn: 7.0.3 - signal-exit: 4.0.2 - dev: true - /forever-agent@0.6.1: resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==} dev: false @@ -14637,18 +14151,6 @@ packages: /glob-to-regexp@0.4.1: resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} - /glob@10.4.5: - resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} - hasBin: true - dependencies: - foreground-child: 3.3.0 - jackspeak: 3.4.3 - minimatch: 9.0.5 - minipass: 7.1.2 - package-json-from-dist: 1.0.1 - path-scurry: 1.11.1 - dev: true - /glob@6.0.4: resolution: {integrity: sha512-MKZeRNyYZAVVVG1oZeLaWie1uweH40m9AZwIwxyPbTSX4hHrVYSzLg0Ro5Z5R7XKkIX+Cc6oD1rqeDJnwsB8/A==} dependencies: @@ -15888,14 +15390,6 @@ packages: istanbul-lib-report: 3.0.0 dev: true - /jackspeak@3.4.3: - resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} - dependencies: - '@isaacs/cliui': 8.0.2 - optionalDependencies: - '@pkgjs/parseargs': 0.11.0 - dev: true - /jake@10.8.5: resolution: {integrity: sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==} engines: {node: '>=10'} @@ -16765,11 +16259,6 @@ packages: '@sideway/formula': 3.0.1 '@sideway/pinpoint': 2.0.0 - /joycon@3.1.1: - resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} - engines: {node: '>=10'} - dev: true - /js-base64@3.7.5: resolution: {integrity: sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==} @@ -17061,11 +16550,6 @@ packages: resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} engines: {node: '>=10'} - /lilconfig@3.1.3: - resolution: {integrity: sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==} - engines: {node: '>=14'} - dev: true - /lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} @@ -17111,11 +16595,6 @@ packages: wrap-ansi: 7.0.0 dev: true - /load-tsconfig@0.2.5: - resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: true - /load-yaml-file@0.2.0: resolution: {integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==} engines: {node: '>=6'} @@ -17295,10 +16774,6 @@ packages: resolution: {integrity: sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==} engines: {node: '>=8'} - /lru-cache@10.4.3: - resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} - dev: true - /lru-cache@4.1.5: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} dependencies: @@ -17614,13 +17089,6 @@ packages: dependencies: brace-expansion: 2.0.1 - /minimatch@9.0.5: - resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} - engines: {node: '>=16 || 14 >=14.17'} - dependencies: - brace-expansion: 2.0.1 - dev: true - /minimist-options@4.1.0: resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==} engines: {node: '>= 6'} @@ -17668,11 +17136,6 @@ packages: resolution: {integrity: sha512-lwycX3cBMTvcejsHITUgYj6Gy6A7Nh4Q6h9NP4sTHY1ccJlC7yKzDmiShEHsJ16Jf1nKGDEaiHxiltsJEvk0nQ==} engines: {node: '>=8'} - /minipass@7.1.2: - resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} - engines: {node: '>=16 || 14 >=14.17'} - dev: true - /minizlib@2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -17785,14 +17248,6 @@ packages: engines: {node: '>=12.0.0'} dev: true - /mz@2.7.0: - resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} - dependencies: - any-promise: 1.3.0 - object-assign: 4.1.1 - thenify-all: 1.6.0 - dev: true - /nanoid@3.1.20: resolution: {integrity: sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -18234,10 +17689,6 @@ packages: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} - /package-json-from-dist@1.0.1: - resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} - dev: true - /package-json@6.5.0: resolution: {integrity: sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==} engines: {node: '>=8'} @@ -18342,14 +17793,6 @@ packages: /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - /path-scurry@1.11.1: - resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} - engines: {node: '>=16 || 14 >=14.18'} - dependencies: - lru-cache: 10.4.3 - minipass: 7.1.2 - dev: true - /path-to-regexp@0.1.7: resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} @@ -18396,19 +17839,10 @@ packages: /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} - /picocolors@1.1.1: - resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} - dev: true - /picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} - /picomatch@4.0.2: - resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} - engines: {node: '>=12'} - dev: true - /pidtree@0.6.0: resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==} engines: {node: '>=0.10'} @@ -18771,29 +18205,6 @@ packages: yaml: 1.10.2 dev: true - /postcss-load-config@6.0.1(postcss@8.4.31)(tsx@3.12.3): - resolution: {integrity: sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==} - engines: {node: '>= 18'} - peerDependencies: - jiti: '>=1.21.0' - postcss: '>=8.0.9' - tsx: ^4.8.1 - yaml: ^2.4.2 - peerDependenciesMeta: - jiti: - optional: true - postcss: - optional: true - tsx: - optional: true - yaml: - optional: true - dependencies: - lilconfig: 3.1.3 - postcss: 8.4.31 - tsx: 3.12.3 - dev: true - /postcss-loader@6.2.1(postcss@8.4.31)(webpack@5.88.2): resolution: {integrity: sha512-WbbYpmAaKcux/P66bZ40bpWsBucjx/TTgVVzRZ9yUO8yQfVBlameJ0ZGVaPfH64hNSBh63a+ICP5nqOpBA0w+Q==} engines: {node: '>= 12.13.0'} @@ -21007,11 +20418,6 @@ packages: dependencies: picomatch: 2.3.1 - /readdirp@4.1.1: - resolution: {integrity: sha512-h80JrZu/MHUZCyHu5ciuoI0+WxsCxzxJTILn6Fs8rxSnFPh+UVHYfeIxK1nVGugMqkfC4vJcBOYbkfkwYK0+gw==} - engines: {node: '>= 14.18.0'} - dev: true - /reading-time@1.5.0: resolution: {integrity: sha512-onYyVhBNr4CmAxFsKS7bz+uTLRakypIe4R+5A824vBSkQy/hB3fZepoVEf8OVAxzLvK+H/jm9TzpI3ETSm64Kg==} @@ -21435,35 +20841,6 @@ packages: fsevents: 2.3.2 dev: true - /rollup@4.30.1: - resolution: {integrity: sha512-mlJ4glW020fPuLi7DkM/lN97mYEZGWeqBnrljzN0gs7GLctqX3lNWxKQ7Gl712UAX+6fog/L3jh4gb7R6aVi3w==} - engines: {node: '>=18.0.0', npm: '>=8.0.0'} - hasBin: true - dependencies: - '@types/estree': 1.0.6 - optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.30.1 - '@rollup/rollup-android-arm64': 4.30.1 - '@rollup/rollup-darwin-arm64': 4.30.1 - '@rollup/rollup-darwin-x64': 4.30.1 - '@rollup/rollup-freebsd-arm64': 4.30.1 - '@rollup/rollup-freebsd-x64': 4.30.1 - '@rollup/rollup-linux-arm-gnueabihf': 4.30.1 - '@rollup/rollup-linux-arm-musleabihf': 4.30.1 - '@rollup/rollup-linux-arm64-gnu': 4.30.1 - '@rollup/rollup-linux-arm64-musl': 4.30.1 - '@rollup/rollup-linux-loongarch64-gnu': 4.30.1 - '@rollup/rollup-linux-powerpc64le-gnu': 4.30.1 - '@rollup/rollup-linux-riscv64-gnu': 4.30.1 - '@rollup/rollup-linux-s390x-gnu': 4.30.1 - '@rollup/rollup-linux-x64-gnu': 4.30.1 - '@rollup/rollup-linux-x64-musl': 4.30.1 - '@rollup/rollup-win32-arm64-msvc': 4.30.1 - '@rollup/rollup-win32-ia32-msvc': 4.30.1 - '@rollup/rollup-win32-x64-msvc': 4.30.1 - fsevents: 2.3.2 - dev: true - /rs-module-lexer@2.3.0: resolution: {integrity: sha512-Ap6ez0EupuGKoohMq1yClBcGRjivQnemFeR0aIYWjyYT1n8HOywYYi0WUz3bzLVSwAKE4OhFHPDr6LiqHGwwvQ==} engines: {node: '>=14'} @@ -22442,20 +21819,6 @@ packages: resolution: {integrity: sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA==} dev: false - /sucrase@3.35.0: - resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==} - engines: {node: '>=16 || 14 >=14.17'} - hasBin: true - dependencies: - '@jridgewell/gen-mapping': 0.3.2 - commander: 4.1.1 - glob: 10.4.5 - lines-and-columns: 1.2.4 - mz: 2.7.0 - pirates: 4.0.5 - ts-interface-checker: 0.1.13 - dev: true - /supports-color@2.0.0: resolution: {integrity: sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==} engines: {node: '>=0.8.0'} @@ -22840,19 +22203,6 @@ packages: /text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - /thenify-all@1.6.0: - resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} - engines: {node: '>=0.8'} - dependencies: - thenify: 3.3.1 - dev: true - - /thenify@3.3.1: - resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} - dependencies: - any-promise: 1.3.0 - dev: true - /throttle-debounce@5.0.0: resolution: {integrity: sha512-2iQTSgkkc1Zyk0MeVrt/3BvuOXYPl/R8Z0U2xxo9rjwNciaHDG3R+Lm6dh4EeUci49DanvBnuqI6jshoQQRGEg==} engines: {node: '>=12.22'} @@ -22880,18 +22230,6 @@ packages: resolution: {integrity: sha512-iyziEiyFxX4kyxSp+MtY1oCH/lvjH3PxFN8PGCDeqcZWAJ/i+9y+nL85w99PxVzrIvew/GSkSbDYtiGVa85Afg==} dev: true - /tinyexec@0.3.2: - resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} - dev: true - - /tinyglobby@0.2.10: - resolution: {integrity: sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==} - engines: {node: '>=12.0.0'} - dependencies: - fdir: 6.4.2(picomatch@4.0.2) - picomatch: 4.0.2 - dev: true - /tinypool@0.1.3: resolution: {integrity: sha512-2IfcQh7CP46XGWGGbdyO4pjcKqsmVqFAPcXfPxcPXmOWt9cYkTP9HcDmGgsfijYoAEc4z9qcpM/BaBz46Y9/CQ==} engines: {node: '>=14.0.0'} @@ -22982,11 +22320,6 @@ packages: punycode: 2.3.0 dev: true - /tree-kill@1.2.2: - resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} - hasBin: true - dev: true - /trim-newlines@3.0.1: resolution: {integrity: sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==} engines: {node: '>=8'} @@ -23026,10 +22359,6 @@ packages: - supports-color dev: true - /ts-interface-checker@0.1.13: - resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} - dev: true - /ts-jest@28.0.8(@babel/core@7.23.9)(jest@28.1.3)(typescript@4.9.5): resolution: {integrity: sha512-5FaG0lXmRPzApix8oFG8RKjAz4ehtm8yMKOTy5HX3fY6W8kmvOrmcY0hKDElW52FJov+clhUbrKAqofnj4mXTg==} engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0} @@ -23123,50 +22452,6 @@ packages: /tslib@2.5.0: resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==} - /tsup@8.3.5(postcss@8.4.31)(tsx@3.12.3)(typescript@5.7.3): - resolution: {integrity: sha512-Tunf6r6m6tnZsG9GYWndg0z8dEV7fD733VBFzFJ5Vcm1FtlXB8xBD/rtrBi2a3YKEV7hHtxiZtW5EAVADoe1pA==} - engines: {node: '>=18'} - hasBin: true - peerDependencies: - '@microsoft/api-extractor': ^7.36.0 - '@swc/core': ^1 - postcss: ^8.4.12 - typescript: '>=4.5.0' - peerDependenciesMeta: - '@microsoft/api-extractor': - optional: true - '@swc/core': - optional: true - postcss: - optional: true - typescript: - optional: true - dependencies: - bundle-require: 5.1.0(esbuild@0.24.2) - cac: 6.7.14 - chokidar: 4.0.3 - consola: 3.4.0 - debug: 4.4.0 - esbuild: 0.24.2 - joycon: 3.1.1 - picocolors: 1.1.1 - postcss: 8.4.31 - postcss-load-config: 6.0.1(postcss@8.4.31)(tsx@3.12.3) - resolve-from: 5.0.0 - rollup: 4.30.1 - source-map: 0.8.0-beta.0 - sucrase: 3.35.0 - tinyexec: 0.3.2 - tinyglobby: 0.2.10 - tree-kill: 1.2.2 - typescript: 5.7.3 - transitivePeerDependencies: - - jiti - - supports-color - - tsx - - yaml - dev: true - /tsutils@3.21.0(typescript@4.9.5): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} From 2388efb83fe3220670bf9cf7654c7fd0c4d80fb6 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Thu, 16 Jan 2025 21:09:30 +0800 Subject: [PATCH 03/10] fix: unique typescript version --- packages/runtime-kit/package.json | 1 - pnpm-lock.yaml | 9 --------- 2 files changed, 10 deletions(-) diff --git a/packages/runtime-kit/package.json b/packages/runtime-kit/package.json index 9888215cba..4c55e8576d 100644 --- a/packages/runtime-kit/package.json +++ b/packages/runtime-kit/package.json @@ -15,7 +15,6 @@ }, "dependencies": {}, "devDependencies": { - "typescript": "^5.0.0", "@types/react": "^18.0.8", "@types/react-dom": "^18.0.3", "react": "^18.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7af99bfe51..128c676300 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2458,9 +2458,6 @@ importers: react-dom: specifier: ^18.0.0 version: 18.2.0(react@18.2.0) - typescript: - specifier: ^5.0.0 - version: 5.7.3 packages/shared: devDependencies: @@ -22581,12 +22578,6 @@ packages: engines: {node: '>=4.2.0'} hasBin: true - /typescript@5.7.3: - resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} - engines: {node: '>=14.17'} - hasBin: true - dev: true - /ua-parser-js@0.7.34: resolution: {integrity: sha512-cJMeh/eOILyGu0ejgTKB95yKT3zOenSe9UGE3vj6WfiOwgGYnmATUsnDixMFvdU+rNMvWih83hrUP8VwhF9yXQ==} dev: false From 4939b88062cbcbc76c8ea5f7eeeb166f83d523ee Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Fri, 17 Jan 2025 10:11:09 +0800 Subject: [PATCH 04/10] fix: lauch pupeteer with no-sandbox --- tests/utils/browser.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/utils/browser.ts b/tests/utils/browser.ts index 5591e9921d..be37c830ce 100644 --- a/tests/utils/browser.ts +++ b/tests/utils/browser.ts @@ -84,7 +84,11 @@ export default class Browser { } async start() { - this.browser = await puppeteer.launch(); + this.browser = await puppeteer.launch( + { + args: ['--no-sandbox', '--disable-setuid-sandbox'], + }, + ); } async close() { From cd41e38071e4bff182736d61d61580bcc2427594 Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Mon, 20 Jan 2025 18:15:45 +0800 Subject: [PATCH 05/10] feat: support custom runtime --- examples/custom-runtime/.browserslistrc | 1 + examples/custom-runtime/ice.config.mts | 31 +++ examples/custom-runtime/package.json | 23 +++ examples/custom-runtime/runtime.tsx | 15 ++ examples/custom-runtime/runtimeServer.tsx | 0 examples/custom-runtime/src/app.tsx | 5 + examples/custom-runtime/src/document.tsx | 22 ++ examples/custom-runtime/src/pages/home.tsx | 3 + examples/custom-runtime/src/pages/index.tsx | 3 + examples/custom-runtime/src/typings.d.ts | 1 + examples/custom-runtime/tsconfig.json | 32 +++ packages/ice/src/createService.ts | 189 ++++++------------ packages/ice/src/getWatchEvents.ts | 25 ++- packages/ice/src/plugins/task.ts | 14 +- packages/ice/src/service/generatorAPI.ts | 73 +++++++ packages/ice/src/service/renderTemplate.ts | 100 +++++++++ packages/ice/src/utils/multipleEntry.ts | 10 +- .../ice/src/utils/renderExportsTemplate.ts | 5 +- .../ice/templates/core/entry.client.tsx.ejs | 6 +- .../ice/templates/core/entry.server.ts.ejs | 8 +- packages/plugin-miniapp/src/index.ts | 2 +- packages/runtime-kit/package.json | 2 +- packages/runtime-kit/src/appConfig.ts | 2 +- packages/runtime/src/runClientApp.tsx | 1 - packages/shared-config/package.json | 3 +- packages/shared-config/src/types.ts | 27 ++- pnpm-lock.yaml | 28 +++ 27 files changed, 467 insertions(+), 164 deletions(-) create mode 100644 examples/custom-runtime/.browserslistrc create mode 100644 examples/custom-runtime/ice.config.mts create mode 100644 examples/custom-runtime/package.json create mode 100644 examples/custom-runtime/runtime.tsx create mode 100644 examples/custom-runtime/runtimeServer.tsx create mode 100644 examples/custom-runtime/src/app.tsx create mode 100644 examples/custom-runtime/src/document.tsx create mode 100644 examples/custom-runtime/src/pages/home.tsx create mode 100644 examples/custom-runtime/src/pages/index.tsx create mode 100644 examples/custom-runtime/src/typings.d.ts create mode 100644 examples/custom-runtime/tsconfig.json create mode 100644 packages/ice/src/service/generatorAPI.ts create mode 100644 packages/ice/src/service/renderTemplate.ts diff --git a/examples/custom-runtime/.browserslistrc b/examples/custom-runtime/.browserslistrc new file mode 100644 index 0000000000..7637baddc3 --- /dev/null +++ b/examples/custom-runtime/.browserslistrc @@ -0,0 +1 @@ +chrome 55 \ No newline at end of file diff --git a/examples/custom-runtime/ice.config.mts b/examples/custom-runtime/ice.config.mts new file mode 100644 index 0000000000..26d2dd805b --- /dev/null +++ b/examples/custom-runtime/ice.config.mts @@ -0,0 +1,31 @@ +import { defineConfig } from '@ice/app'; + +export default defineConfig(() => ({ + ssg: false, + plugins: [ + { + name: 'custom-runtime', + setup: (api) => { + // Customize the runtime + api.onGetConfig((config) => { + // Override the runtime config + config.runtime = { + exports: [ + { + specifier: ['Meta', 'Title', 'Links', 'Main', 'Scripts'], + source: '@ice/runtime', + }, + { + specifier: ['defineAppConfig'], + source: '@ice/runtime-kit', + }, + ], + source: '../runtime', + server: '@ice/runtime/server', + }; + }) + }, + }, + ], +})); + diff --git a/examples/custom-runtime/package.json b/examples/custom-runtime/package.json new file mode 100644 index 0000000000..5f3de1f9b0 --- /dev/null +++ b/examples/custom-runtime/package.json @@ -0,0 +1,23 @@ +{ + "name": "@examples/custom-runtime", + "version": "1.0.0", + "private": true, + "scripts": { + "start": "ice start", + "build": "ice build" + }, + "description": "", + "author": "", + "license": "MIT", + "dependencies": { + "@ice/app": "workspace:*", + "@ice/runtime": "workspace:*", + "@ice/runtime-kit": "workspace:*", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/react": "^18.0.0", + "@types/react-dom": "^18.0.2" + } +} diff --git a/examples/custom-runtime/runtime.tsx b/examples/custom-runtime/runtime.tsx new file mode 100644 index 0000000000..49f495de95 --- /dev/null +++ b/examples/custom-runtime/runtime.tsx @@ -0,0 +1,15 @@ +import React from 'react'; +import type { RunClientAppOptions } from '@ice/runtime-kit'; +import { getAppConfig } from '@ice/runtime-kit'; + +import ReactDOM from 'react-dom'; + +const runClientApp = (options: RunClientAppOptions) => { + console.log('runClientApp', options); + ReactDOM.render(

Hello World
, document.getElementById('ice-container')); +}; + +export { + getAppConfig, + runClientApp, +}; diff --git a/examples/custom-runtime/runtimeServer.tsx b/examples/custom-runtime/runtimeServer.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/examples/custom-runtime/src/app.tsx b/examples/custom-runtime/src/app.tsx new file mode 100644 index 0000000000..4e915ff399 --- /dev/null +++ b/examples/custom-runtime/src/app.tsx @@ -0,0 +1,5 @@ +import { defineAppConfig } from 'ice'; + +export default defineAppConfig(() => ({ + +})); diff --git a/examples/custom-runtime/src/document.tsx b/examples/custom-runtime/src/document.tsx new file mode 100644 index 0000000000..1e7b99c49d --- /dev/null +++ b/examples/custom-runtime/src/document.tsx @@ -0,0 +1,22 @@ +import { Meta, Title, Links, Main, Scripts } from 'ice'; + +function Document() { + return ( + + + + + + + + <Links /> + </head> + <body> + <Main /> + <Scripts /> + </body> + </html> + ); +} + +export default Document; diff --git a/examples/custom-runtime/src/pages/home.tsx b/examples/custom-runtime/src/pages/home.tsx new file mode 100644 index 0000000000..bb72815361 --- /dev/null +++ b/examples/custom-runtime/src/pages/home.tsx @@ -0,0 +1,3 @@ +export default function Home() { + return <h1>home</h1>; +} diff --git a/examples/custom-runtime/src/pages/index.tsx b/examples/custom-runtime/src/pages/index.tsx new file mode 100644 index 0000000000..5b3753e70e --- /dev/null +++ b/examples/custom-runtime/src/pages/index.tsx @@ -0,0 +1,3 @@ +export default function Index() { + return <h1>index</h1>; +} diff --git a/examples/custom-runtime/src/typings.d.ts b/examples/custom-runtime/src/typings.d.ts new file mode 100644 index 0000000000..1f6ba4ffa6 --- /dev/null +++ b/examples/custom-runtime/src/typings.d.ts @@ -0,0 +1 @@ +/// <reference types="@ice/app/types" /> diff --git a/examples/custom-runtime/tsconfig.json b/examples/custom-runtime/tsconfig.json new file mode 100644 index 0000000000..26fd9ec799 --- /dev/null +++ b/examples/custom-runtime/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compileOnSave": false, + "buildOnSave": false, + "compilerOptions": { + "baseUrl": ".", + "outDir": "build", + "module": "esnext", + "target": "es6", + "jsx": "react-jsx", + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "lib": ["es6", "dom"], + "sourceMap": true, + "allowJs": true, + "rootDir": "./", + "forceConsistentCasingInFileNames": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noImplicitAny": false, + "importHelpers": true, + "strictNullChecks": true, + "suppressImplicitAnyIndexErrors": true, + "noUnusedLocals": true, + "skipLibCheck": true, + "paths": { + "@/*": ["./src/*"], + "ice": [".ice"] + } + }, + "include": ["src", ".ice", "ice.config.*"], + "exclude": ["build", "public"] +} \ No newline at end of file diff --git a/packages/ice/src/createService.ts b/packages/ice/src/createService.ts index 818770e0c5..d42ad23127 100644 --- a/packages/ice/src/createService.ts +++ b/packages/ice/src/createService.ts @@ -1,45 +1,44 @@ // hijack webpack before import other modules import './requireHook.js'; +import { createRequire } from 'module'; import * as path from 'path'; import { fileURLToPath } from 'url'; -import { createRequire } from 'module'; +import webpack from '@ice/bundles/compiled/webpack/index.js'; import { Context } from 'build-scripts'; import type { CommandArgs, CommandName, TaskConfig } from 'build-scripts'; import type { Config } from '@ice/shared-config/types'; import type { AppConfig } from '@ice/runtime/types'; -import webpack from '@ice/bundles/compiled/webpack/index.js'; +import * as config from './config.js'; +import test from './commands/test.js'; +import webpackBundler from './bundler/webpack/index.js'; +import rspackBundler from './bundler/rspack/index.js'; +import { RUNTIME_TMP_DIR, WEB, RUNTIME_EXPORTS, SERVER_ENTRY } from './constant.js'; +import getWatchEvents from './getWatchEvents.js'; +import pluginWeb from './plugins/web/index.js'; +import getDefaultTaskConfig from './plugins/task.js'; +import { getFileExports } from './service/analyze.js'; +import { getAppExportConfig, getRouteExportConfig } from './service/config.js'; +import Generator from './service/runtimeGenerator.js'; +import ServerRunner from './service/ServerRunner.js'; +import { createServerCompiler } from './service/serverCompiler.js'; +import createWatch from './service/watchSource.js'; import type { - DeclarationData, PluginData, ExtendsPluginAPI, } from './types/index.js'; -import Generator from './service/runtimeGenerator.js'; -import { createServerCompiler } from './service/serverCompiler.js'; -import createWatch from './service/watchSource.js'; -import pluginWeb from './plugins/web/index.js'; -import test from './commands/test.js'; -import getWatchEvents from './getWatchEvents.js'; -import { setEnv, updateRuntimeEnv, getCoreEnvKeys } from './utils/runtimeEnv.js'; -import getRuntimeModules from './utils/getRuntimeModules.js'; -import { generateRoutesInfo, getRoutesDefinition } from './routes.js'; -import * as config from './config.js'; -import { RUNTIME_TMP_DIR, WEB, RUNTIME_EXPORTS, SERVER_ENTRY, FALLBACK_ENTRY } from './constant.js'; +import addPolyfills from './utils/runtimePolyfill.js'; import createSpinner from './utils/createSpinner.js'; -import ServerCompileTask from './utils/ServerCompileTask.js'; -import { getAppExportConfig, getRouteExportConfig } from './service/config.js'; -import renderExportsTemplate from './utils/renderExportsTemplate.js'; -import { getFileExports } from './service/analyze.js'; -import { logger, createLogger } from './utils/logger.js'; -import ServerRunner from './service/ServerRunner.js'; -import RouteManifest from './utils/routeManifest.js'; import dynamicImport from './utils/dynamicImport.js'; -import mergeTaskConfig, { mergeConfig } from './utils/mergeTaskConfig.js'; -import addPolyfills from './utils/runtimePolyfill.js'; -import webpackBundler from './bundler/webpack/index.js'; -import rspackBundler from './bundler/rspack/index.js'; -import getDefaultTaskConfig from './plugins/task.js'; -import { multipleServerEntry, renderMultiEntry } from './utils/multipleEntry.js'; +import getRuntimeModules from './utils/getRuntimeModules.js'; import hasDocument from './utils/hasDocument.js'; +import { logger, createLogger } from './utils/logger.js'; +import mergeTaskConfig, { mergeConfig } from './utils/mergeTaskConfig.js'; +import RouteManifest from './utils/routeManifest.js'; +import { setEnv, updateRuntimeEnv, getCoreEnvKeys } from './utils/runtimeEnv.js'; +import ServerCompileTask from './utils/ServerCompileTask.js'; +import { generateRoutesInfo } from './routes.js'; +import GeneratorAPI from './service/generatorAPI.js'; +import renderTemplate from './service/renderTemplate.js'; const require = createRequire(import.meta.url); const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -71,46 +70,7 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt command, }); - let entryCode = 'render();'; - - const generatorAPI = { - addExport: (declarationData: DeclarationData) => { - generator.addDeclaration('framework', declarationData); - }, - addExportTypes: (declarationData: DeclarationData) => { - generator.addDeclaration('frameworkTypes', declarationData); - }, - addRuntimeOptions: (declarationData: DeclarationData) => { - generator.addDeclaration('runtimeOptions', declarationData); - }, - removeRuntimeOptions: (removeSource: string | string[]) => { - generator.removeDeclaration('runtimeOptions', removeSource); - }, - addRouteTypes: (declarationData: DeclarationData) => { - generator.addDeclaration('routeConfigTypes', declarationData); - }, - addRenderFile: generator.addRenderFile, - addRenderTemplate: generator.addTemplateFiles, - addEntryCode: (callback: (originalCode: string) => string) => { - entryCode = callback(entryCode); - }, - addEntryImportAhead: (declarationData: Pick<DeclarationData, 'source'>, type = 'client') => { - if (type === 'both' || type === 'server') { - generator.addDeclaration('entryServer', declarationData); - } - if (type === 'both' || type === 'client') { - generator.addDeclaration('entry', declarationData); - } - }, - modifyRenderData: generator.modifyRenderData, - addDataLoaderImport: (declarationData: DeclarationData) => { - generator.addDeclaration('dataLoaderImport', declarationData); - }, - getExportList: (registerKey: string) => { - return generator.getExportList(registerKey); - }, - render: generator.render, - }; + const generatorAPI = new GeneratorAPI(generator); // Store server runner for plugins. let serverRunner: ServerRunner; const serverCompileTask = new ServerCompileTask(); @@ -152,10 +112,7 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt throw err; } } - // Register framework level API. - RUNTIME_EXPORTS.forEach(exports => { - generatorAPI.addExport(exports); - }); + const routeManifest = new RouteManifest(); const ctx = new Context<Config, ExtendsPluginAPI>({ rootDir, @@ -246,17 +203,25 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt // Get first task config as default platform config. const platformTaskConfig = taskConfigs[0]; - const iceRuntimePath = platformTaskConfig.config.runtimeSource || '@ice/runtime'; + const runtimeConfig = platformTaskConfig.config?.runtime; + const iceRuntimePath = runtimeConfig?.source || '@ice/runtime'; + const runtimeExports = runtimeConfig?.exports || RUNTIME_EXPORTS; // Only when code splitting use the default strategy or set to `router`, the router will be lazy loaded. const lazy = [true, 'chunks', 'page', 'page-vendors'].includes(userConfig.codeSplitting); - const { routeImports, routeDefinition } = getRoutesDefinition({ + const runtimeRouter = runtimeConfig?.router; + const { routeImports, routeDefinition } = runtimeRouter?.routesDefinition?.({ manifest: routesInfo.routes, lazy, - }); + }) || { + routeImports: [], + routeDefinition: '', + }; + + const routesFile = runtimeRouter?.source; + const loaderExports = hasExportAppData || Boolean(routesInfo.loaders); const hasDataLoader = Boolean(userConfig.dataLoader) && loaderExports; - // add render data - generator.setRenderData({ + const renderData = { ...routesInfo, target, iceRuntimePath, @@ -268,70 +233,31 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt memoryRouter: platformTaskConfig.config.memoryRouter, hydrate: !csr, importCoreJs: polyfill === 'entry', - // Enable react-router for web as default. - enableRoutes: true, - entryCode, + entryCode: generatorAPI.getEntryCode(), hasDocument: hasDocument(rootDir), dataLoader: userConfig.dataLoader, hasDataLoader, routeImports, routeDefinition, - routesFile: './routes', - }); + routesFile: routesFile?.replace(/\.[^.]+$/, ''), + lazy, + runtimeServer: runtimeConfig?.server, + }; dataCache.set('routes', JSON.stringify(routesInfo)); dataCache.set('hasExportAppData', hasExportAppData ? 'true' : ''); - // Render exports files if route component export dataLoader / pageConfig. - renderExportsTemplate( - { - ...routesInfo, - hasExportAppData, - }, - generator.addRenderFile, - { - rootDir, - runtimeDir: RUNTIME_TMP_DIR, - templateDir: path.join(templateDir, 'exports'), - dataLoader: Boolean(userConfig.dataLoader), - }, - ); - - if (platformTaskConfig.config.server?.fallbackEntry) { - // Add fallback entry for server side rendering. - generator.addRenderFile('core/entry.server.ts.ejs', FALLBACK_ENTRY, { hydrate: false }); - } - - if (typeof userConfig.dataLoader === 'object' && userConfig.dataLoader.fetcher) { - const { - packageName, - method, - } = userConfig.dataLoader.fetcher; - - generatorAPI.addDataLoaderImport(method ? { - source: packageName, - alias: { - [method]: 'dataLoaderFetcher', - }, - specifier: [method], - } : { - source: packageName, - specifier: '', - }); - } - - if (multipleServerEntry(userConfig, command)) { - renderMultiEntry({ - generator, - renderRoutes: routeManifest.getFlattenRoute(), - routesManifest: routesInfo.routes, - lazy, - }); - } + // Render template to runtime directory. + renderTemplate({ + ctx, + taskConfig: platformTaskConfig, + routeManifest, + generator, + generatorAPI, + renderData, + runtimeExports, + templateDir, + }); - // render template before webpack compile - const renderStart = new Date().getTime(); - generator.render(); - logger.debug('template render cost:', new Date().getTime() - renderStart); if (server.onDemand && command === 'start') { serverRunner = new ServerRunner({ speedup: commandArgs.speedup, @@ -373,6 +299,7 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt routeManifest, lazyRoutes: lazy, ctx, + router: runtimeRouter, }), ); diff --git a/packages/ice/src/getWatchEvents.ts b/packages/ice/src/getWatchEvents.ts index ec697bccfe..728cf5e250 100644 --- a/packages/ice/src/getWatchEvents.ts +++ b/packages/ice/src/getWatchEvents.ts @@ -2,7 +2,7 @@ import * as path from 'path'; import type { Context } from 'build-scripts'; import type { Config } from '@ice/shared-config/types'; import type { WatchEvent } from './types/plugin.js'; -import { generateRoutesInfo, getRoutesDefinition } from './routes.js'; +import { generateRoutesInfo } from './routes.js'; import type Generator from './service/runtimeGenerator'; import getGlobalStyleGlobPattern from './utils/getGlobalStyleGlobPattern.js'; import renderExportsTemplate from './utils/renderExportsTemplate.js'; @@ -20,31 +20,38 @@ interface Options { ctx: Context<Config>; routeManifest: RouteManifest; lazyRoutes: boolean; + router: { + source?: string; + template?: string; + routesDefinition?: Config['runtime']['router']['routesDefinition']; + }; } const getWatchEvents = (options: Options): WatchEvent[] => { - const { generator, targetDir, templateDir, cache, ctx, routeManifest, lazyRoutes } = options; + const { generator, targetDir, templateDir, cache, ctx, routeManifest, lazyRoutes, router } = options; const { userConfig: { routes: routesConfig, dataLoader }, configFile, rootDir } = ctx; const watchRoutes: WatchEvent = [ /src\/pages\/?[\w*-:.$]+$/, async (eventName: string) => { if (eventName === 'add' || eventName === 'unlink' || eventName === 'change') { const routesRenderData = await generateRoutesInfo(rootDir, routesConfig); - const { routeImports, routeDefinition } = getRoutesDefinition({ + const { routeImports, routeDefinition } = router?.routesDefinition?.({ manifest: routesRenderData.routes, lazy: lazyRoutes, - }); + }) || {}; const stringifiedData = JSON.stringify(routesRenderData); if (cache.get('routes') !== stringifiedData) { cache.set('routes', stringifiedData); logger.debug(`routes data regenerated: ${stringifiedData}`); if (eventName !== 'change') { // Specify the route files to re-render. - generator.renderFile( - path.join(templateDir, 'routes.tsx.ejs'), - path.join(rootDir, targetDir, 'routes.tsx'), - { routeImports, routeDefinition }, - ); + if (router.source && router.template) { + generator.renderFile( + router.template, + router.source, + { routeImports, routeDefinition }, + ); + } // Keep generate route manifest for avoid breaking change. generator.renderFile( path.join(templateDir, 'route-manifest.json.ejs'), diff --git a/packages/ice/src/plugins/task.ts b/packages/ice/src/plugins/task.ts index 892d146a90..c829d9744c 100644 --- a/packages/ice/src/plugins/task.ts +++ b/packages/ice/src/plugins/task.ts @@ -1,7 +1,8 @@ import * as path from 'path'; import { createRequire } from 'module'; import type { Config } from '@ice/shared-config/types'; -import { CACHE_DIR, RUNTIME_TMP_DIR } from '../constant.js'; +import { CACHE_DIR, RUNTIME_TMP_DIR, RUNTIME_EXPORTS } from '../constant.js'; +import { getRoutesDefinition } from '../routes.js'; const require = createRequire(import.meta.url); const getDefaultTaskConfig = ({ rootDir, command }): Config => { @@ -33,7 +34,16 @@ const getDefaultTaskConfig = ({ rootDir, command }): Config => { logging: process.env.WEBPACK_LOGGING || defaultLogging, minify: command === 'build', useDevServer: true, - runtimeSource: '@ice/runtime', + runtime: { + exports: RUNTIME_EXPORTS, + source: '@ice/runtime', + server: '@ice/runtime/server', + router: { + routesDefinition: getRoutesDefinition, + source: './routes.tsx', + template: 'core/routes.tsx.ejs', + }, + }, }; }; diff --git a/packages/ice/src/service/generatorAPI.ts b/packages/ice/src/service/generatorAPI.ts new file mode 100644 index 0000000000..761b7399eb --- /dev/null +++ b/packages/ice/src/service/generatorAPI.ts @@ -0,0 +1,73 @@ +import type { DeclarationData } from '../types/index.js'; +import type Generator from './runtimeGenerator.js'; + +class GeneratorAPI { + private readonly generator: Generator; + private entryCode: string; + constructor(generator: Generator) { + this.generator = generator; + this.entryCode = 'render();'; + } + addExport = (declarationData: DeclarationData): void => { + this.generator.addDeclaration('framework', declarationData); + }; + + addExportTypes = (declarationData: DeclarationData): void => { + this.generator.addDeclaration('frameworkTypes', declarationData); + }; + + addRuntimeOptions = (declarationData: DeclarationData): void => { + this.generator.addDeclaration('runtimeOptions', declarationData); + }; + + removeRuntimeOptions = (removeSource: string | string[]): void => { + this.generator.removeDeclaration('runtimeOptions', removeSource); + }; + + addRouteTypes = (declarationData: DeclarationData): void => { + this.generator.addDeclaration('routeConfigTypes', declarationData); + }; + + addEntryCode = (callback: (originalCode: string) => string): void => { + this.entryCode = callback(this.entryCode); + }; + + addEntryImportAhead = (declarationData: Pick<DeclarationData, 'source'>, type = 'client'): void => { + if (type === 'both' || type === 'server') { + this.generator.addDeclaration('entryServer', declarationData); + } + if (type === 'both' || type === 'client') { + this.generator.addDeclaration('entry', declarationData); + } + }; + + addRenderFile = (...args: Parameters<Generator['addRenderFile']>): ReturnType<Generator['addRenderFile']> => { + return this.generator.addRenderFile(...args); + }; + + addRenderTemplate = (...args: Parameters<Generator['addTemplateFiles']>): ReturnType<Generator['addTemplateFiles']> => { + return this.generator.addTemplateFiles(...args); + }; + + modifyRenderData = (...args: Parameters<Generator['modifyRenderData']>): ReturnType<Generator['modifyRenderData']> => { + return this.generator.modifyRenderData(...args); + }; + + addDataLoaderImport = (declarationData: DeclarationData): void => { + this.generator.addDeclaration('dataLoaderImport', declarationData); + }; + + getExportList = (registerKey: string) => { + return this.generator.getExportList(registerKey); + }; + + render = (): void => { + this.generator.render(); + }; + + getEntryCode = (): string => { + return this.entryCode; + }; +} + +export default GeneratorAPI; diff --git a/packages/ice/src/service/renderTemplate.ts b/packages/ice/src/service/renderTemplate.ts new file mode 100644 index 0000000000..5f35d9481a --- /dev/null +++ b/packages/ice/src/service/renderTemplate.ts @@ -0,0 +1,100 @@ +import path from 'path'; +import type { Context, TaskConfig } from 'build-scripts'; +import type { Config } from '@ice/shared-config/types'; +import { FALLBACK_ENTRY, RUNTIME_TMP_DIR } from '../constant.js'; +import type { RenderData } from '../types/generator.js'; +import type { ExtendsPluginAPI } from '../types/plugin.js'; +import renderExportsTemplate from '../utils/renderExportsTemplate.js'; +import { logger } from '../utils/logger.js'; +import { multipleServerEntry, renderMultiEntry } from '../utils/multipleEntry.js'; +import type RouteManifest from '../utils/routeManifest.js'; +import type GeneratorAPI from './generatorAPI.js'; +import type Generator from './runtimeGenerator.js'; + +interface RenderTemplateOptions { + ctx: Context<Config, ExtendsPluginAPI>; + taskConfig: TaskConfig<Config>; + routeManifest: RouteManifest; + generator: Generator; + generatorAPI: GeneratorAPI; + renderData: RenderData; + runtimeExports: Config['runtime']['exports']; + templateDir: string; +} + +function renderTemplate({ + ctx, + taskConfig, + routeManifest, + generator, + generatorAPI, + renderData, + runtimeExports, + templateDir, +}: RenderTemplateOptions): void { + // Record start time for performance tracking. + const renderStart = performance.now(); + + const { rootDir, userConfig, command } = ctx; + generator.setRenderData(renderData); + + // Register framework level exports. + runtimeExports.forEach(generatorAPI.addExport); + + // Render exports for routes with dataLoader/pageConfig. + renderExportsTemplate( + renderData, + generator.addRenderFile, + { + rootDir, + runtimeDir: RUNTIME_TMP_DIR, + templateDir: path.join(templateDir, 'exports'), + dataLoader: Boolean(userConfig.dataLoader), + }, + ); + + // Handle server-side fallback entry. + if (taskConfig.config.server?.fallbackEntry) { + generator.addRenderFile('core/entry.server.ts.ejs', FALLBACK_ENTRY, { hydrate: false }); + } + + // Handle custom router template. + const customRouter = taskConfig.config.runtime?.router; + + if (customRouter?.source && customRouter?.template) { + generator.addRenderFile(customRouter.template, customRouter.source); + } + + // Configure data loader if specified. + const dataLoaderFetcher = userConfig.dataLoader?.fetcher; + if (typeof userConfig.dataLoader === 'object' && dataLoaderFetcher) { + const { packageName, method } = dataLoaderFetcher; + + const importConfig = method ? { + source: packageName, + alias: { [method]: 'dataLoaderFetcher' }, + specifier: [method], + } : { + source: packageName, + specifier: '', + }; + + generatorAPI.addDataLoaderImport(importConfig); + } + + // Handle multiple server entries. + if (multipleServerEntry(userConfig, command)) { + renderMultiEntry({ + generator, + renderRoutes: routeManifest.getFlattenRoute(), + routesManifest: routeManifest.getNestedRoute(), + lazy: renderData.lazy, + }); + } + + generator.render(); + logger.debug('template render cost:', performance.now() - renderStart); +} + + +export default renderTemplate; diff --git a/packages/ice/src/utils/multipleEntry.ts b/packages/ice/src/utils/multipleEntry.ts index 31b7ce631d..8804bb3279 100644 --- a/packages/ice/src/utils/multipleEntry.ts +++ b/packages/ice/src/utils/multipleEntry.ts @@ -1,16 +1,16 @@ import matchRoutes from '@ice/runtime/matchRoutes'; import type { NestedRouteManifest } from '@ice/route-manifest'; import type { CommandName } from 'build-scripts'; -import { getRoutesDefinition } from '../routes.js'; +import type { Config } from '@ice/shared-config/types'; import type Generator from '../service/runtimeGenerator.js'; import type { UserConfig } from '../types/userConfig.js'; import { escapeRoutePath } from './generateEntry.js'; - interface Options { renderRoutes: string[]; routesManifest: NestedRouteManifest[]; generator: Generator; lazy: boolean; + routesDefinition?: Config['runtime']['router']['routesDefinition']; } export const multipleServerEntry = (userConfig: UserConfig, command: CommandName): boolean => { @@ -29,7 +29,7 @@ export const formatServerEntry = (route: string) => { }; export function renderMultiEntry(options: Options) { - const { renderRoutes, routesManifest, generator, lazy } = options; + const { renderRoutes, routesManifest, generator, lazy, routesDefinition } = options; renderRoutes.forEach((route) => { const routeId = formatRoutePath(route); generator.addRenderFile( @@ -41,13 +41,13 @@ export function renderMultiEntry(options: Options) { ); // Generate route file for each route. const matches = matchRoutes(routesManifest, route); - const { routeImports, routeDefinition } = getRoutesDefinition({ + const { routeImports, routeDefinition } = routesDefinition?.({ manifest: routesManifest, lazy, matchRoute: (routeItem) => { return matches.some((match) => match.route.id === routeItem.id); }, - }); + }) || {}; generator.addRenderFile('core/routes.tsx.ejs', `routes.${routeId}.tsx`, { routeImports, routeDefinition, diff --git a/packages/ice/src/utils/renderExportsTemplate.ts b/packages/ice/src/utils/renderExportsTemplate.ts index a02d20bb46..d4ed339d23 100644 --- a/packages/ice/src/utils/renderExportsTemplate.ts +++ b/packages/ice/src/utils/renderExportsTemplate.ts @@ -1,10 +1,7 @@ import * as path from 'path'; import fse from 'fs-extra'; import type Generator from '../service/runtimeGenerator.js'; - -type RenderData = { - loaders: string; -} & Record<string, any>; +import type { RenderData } from '../types/generator.js'; function renderExportsTemplate( renderData: RenderData, diff --git a/packages/ice/templates/core/entry.client.tsx.ejs b/packages/ice/templates/core/entry.client.tsx.ejs index ee9f31bbd4..de4074f294 100644 --- a/packages/ice/templates/core/entry.client.tsx.ejs +++ b/packages/ice/templates/core/entry.client.tsx.ejs @@ -3,8 +3,8 @@ import { runClientApp, getAppConfig } from '<%- iceRuntimePath %>'; import { commons, statics } from './runtime-modules'; import * as app from '@/app'; -<% if (enableRoutes) { -%> -import createRoutes from './routes'; +<% if (routesFile) { -%> +import createRoutes from '<%- routesFile %>'; <% } -%> <%- runtimeOptions.imports %> <% if (dataLoaderImport.imports && hasDataLoader) {-%><%-dataLoaderImport.imports%><% } -%> @@ -21,7 +21,7 @@ const renderOptions: RunClientAppOptions = { commons, statics, }, - <% if (enableRoutes) { %>createRoutes,<% } %> + <% if (routesFile) { %>createRoutes,<% } %> basename: getRouterBasename(), hydrate: <%- hydrate %>, memoryRouter: <%- memoryRouter || false %>, diff --git a/packages/ice/templates/core/entry.server.ts.ejs b/packages/ice/templates/core/entry.server.ts.ejs index 2fd517eac9..41a915639b 100644 --- a/packages/ice/templates/core/entry.server.ts.ejs +++ b/packages/ice/templates/core/entry.server.ts.ejs @@ -1,8 +1,8 @@ import './env.server'; <% if (hydrate) {-%> -import { getAppConfig, renderToHTML as renderAppToHTML, renderToResponse as renderAppToResponse } from '@ice/runtime/server'; +import { getAppConfig, renderToHTML as renderAppToHTML, renderToResponse as renderAppToResponse } from '<%- runtimeServer %>'; <% } else { -%> -import { getAppConfig, getDocumentResponse as renderAppToHTML, renderDocumentToResponse as renderAppToResponse } from '@ice/runtime/server'; +import { getAppConfig, getDocumentResponse as renderAppToHTML, renderDocumentToResponse as renderAppToResponse } from '<%- runtimeServer %>'; <% }-%> <%- entryServer.imports %> <% if (hydrate) {-%> @@ -18,7 +18,7 @@ import type { RenderMode } from '@ice/runtime'; import type { RenderToPipeableStreamOptions } from 'react-dom/server'; // @ts-ignore import assetsManifest from 'virtual:assets-manifest.json'; -<% if (hydrate) {-%> +<% if (hydrate && routesFile) {-%> import createRoutes from '<%- routesFile %>'; <% } else { -%> import routesManifest from './route-manifest.json'; @@ -26,7 +26,7 @@ import routesManifest from './route-manifest.json'; <% if (dataLoaderImport.imports) {-%><%-dataLoaderImport.imports%><% } -%> <% if (hydrate) {-%><%- runtimeOptions.imports %><% } -%> -<% if (!hydrate) {-%> +<% if (!hydrate || !routesFile) {-%> // Do not inject runtime modules when render mode is document only. const commons = []; const statics = []; diff --git a/packages/plugin-miniapp/src/index.ts b/packages/plugin-miniapp/src/index.ts index e4fa119e81..ae692bc836 100644 --- a/packages/plugin-miniapp/src/index.ts +++ b/packages/plugin-miniapp/src/index.ts @@ -44,7 +44,7 @@ const plugin: Plugin<MiniappOptions> = (miniappOptions = {}) => ({ ]; generator.addRenderFile('core/entry.client.tsx.ejs', 'entry.miniapp.tsx', { iceRuntimePath: miniappRuntime, - enableRoutes: false, + routesFile: '', }); generator.addRenderFile('core/index.ts.ejs', 'index.miniapp.ts', { diff --git a/packages/runtime-kit/package.json b/packages/runtime-kit/package.json index 4c55e8576d..bf26a7156c 100644 --- a/packages/runtime-kit/package.json +++ b/packages/runtime-kit/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "description": "Runtime utilities and tools for ICE framework", "main": "./esm/index.js", - "module": "./esm/index.mjs", + "module": "./esm/index.js", "types": "./esm/index.d.ts", "files": [ "esm" diff --git a/packages/runtime-kit/src/appConfig.ts b/packages/runtime-kit/src/appConfig.ts index 88dc6fd743..a260595543 100644 --- a/packages/runtime-kit/src/appConfig.ts +++ b/packages/runtime-kit/src/appConfig.ts @@ -10,7 +10,7 @@ const defaultAppConfig: AppConfig = { }, } as const; -export default function getAppConfig(appExport: AppExport): AppConfig { +export function getAppConfig(appExport: AppExport): AppConfig { const { default: appConfig = {} } = appExport || {}; const { app, router, ...others } = appConfig; diff --git a/packages/runtime/src/runClientApp.tsx b/packages/runtime/src/runClientApp.tsx index f268cb0d2e..d03ed992ea 100644 --- a/packages/runtime/src/runClientApp.tsx +++ b/packages/runtime/src/runClientApp.tsx @@ -36,7 +36,6 @@ export interface RunClientAppOptions { dataLoaderDecorator?: Function; } - export default async function runClientApp(options: RunClientAppOptions) { const { app, diff --git a/packages/shared-config/package.json b/packages/shared-config/package.json index 8556e56cce..eeaa677261 100644 --- a/packages/shared-config/package.json +++ b/packages/shared-config/package.json @@ -28,7 +28,8 @@ "esbuild": "^0.17.16", "postcss": "^8.4.31", "webpack": "^5.86.0", - "webpack-dev-server": "4.15.0" + "webpack-dev-server": "4.15.0", + "@ice/route-manifest": "workspace:*" }, "scripts": { "watch": "tsc -w --sourceMap", diff --git a/packages/shared-config/src/types.ts b/packages/shared-config/src/types.ts index 158c7de1e4..feba32c3ce 100644 --- a/packages/shared-config/src/types.ts +++ b/packages/shared-config/src/types.ts @@ -14,6 +14,7 @@ import type Server from 'webpack-dev-server'; import type { SwcCompilationConfig } from '@ice/bundles'; import type { BuildOptions } from 'esbuild'; import type { ProcessOptions } from 'postcss'; +import type { NestedRouteManifest } from '@ice/route-manifest'; export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020; @@ -90,6 +91,17 @@ export type { webpack }; type PluginFunction = (this: Compiler, compiler: Compiler) => void; +export interface RouteDefinitionOptions { + manifest: NestedRouteManifest[]; + lazy?: boolean; + depth?: number; + matchRoute?: (route: NestedRouteManifest) => boolean; +} +export interface RouteDefinition { + routeImports: string[]; + routeDefinition: string; +} + export interface Config { // The name of the task, used for the output log. name?: string; @@ -234,5 +246,18 @@ export interface Config { optimizePackageImports?: string[]; - runtimeSource?: string; + runtime?: { + source?: string; + server?: string; + exports?: { + specifier: string[]; + source: string; + alias?: Record<string, string>; + }[]; + router?: { + routesDefinition?: (options: RouteDefinitionOptions) => RouteDefinition; + source?: string; + template?: string; + }; + }; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 128c676300..115b1131e4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -252,6 +252,31 @@ importers: specifier: ^5.88.0 version: 5.88.2 + examples/custom-runtime: + dependencies: + '@ice/app': + specifier: workspace:* + version: link:../../packages/ice + '@ice/runtime': + specifier: workspace:* + version: link:../../packages/runtime + '@ice/runtime-kit': + specifier: workspace:* + version: link:../../packages/runtime-kit + react: + specifier: ^18.2.0 + version: 18.2.0 + react-dom: + specifier: ^18.2.0 + version: 18.2.0(react@18.2.0) + devDependencies: + '@types/react': + specifier: ^18.0.0 + version: 18.0.34 + '@types/react-dom': + specifier: ^18.0.2 + version: 18.0.11 + examples/disable-data-loader: dependencies: '@ice/app': @@ -2486,6 +2511,9 @@ importers: specifier: ^0.11.10 version: 0.11.10 devDependencies: + '@ice/route-manifest': + specifier: workspace:* + version: link:../route-manifest esbuild: specifier: ^0.17.16 version: 0.17.16 From def21302f394741f4384c570fc1bba3536f49357 Mon Sep 17 00:00:00 2001 From: ClarkXia <xiawenwu41@gmail.com> Date: Tue, 21 Jan 2025 17:32:14 +0800 Subject: [PATCH 06/10] feat: runtime kit --- examples/custom-runtime/ice.config.mts | 3 + examples/custom-runtime/runtime.tsx | 13 +- examples/custom-runtime/src/routes.tsx | 13 + examples/with-antd-mobile/src/store.tsx | 3 +- packages/ice/package.json | 1 + packages/ice/src/bundler/config/getUrls.ts | 2 +- packages/ice/src/bundler/types.ts | 2 +- packages/ice/src/createService.ts | 2 +- packages/ice/src/esbuild/assets.ts | 2 +- packages/ice/src/types/plugin.ts | 2 +- packages/ice/src/utils/injectInitialEntry.ts | 2 +- packages/ice/src/utils/runtimeEnv.ts | 2 +- packages/plugin-auth/src/runtime/index.tsx | 2 +- packages/plugin-auth/src/types.ts | 2 +- packages/plugin-i18n/src/runtime/index.tsx | 4 +- .../plugin-icestark/src/runtime/child.tsx | 2 +- .../plugin-icestark/src/runtime/framework.tsx | 2 +- packages/plugin-intl/src/runtime-simple.ts | 2 +- packages/plugin-intl/src/runtime.tsx | 2 +- packages/plugin-miniapp/src/runtime/index.ts | 2 +- packages/plugin-request/src/runtime.ts | 2 +- packages/plugin-store/src/runtime.tsx | 2 +- packages/runtime-kit/package.json | 1 + packages/runtime-kit/src/dataLoader.ts | 21 +- packages/runtime-kit/src/requestContext.ts | 2 +- packages/runtime-kit/src/types.ts | 11 +- packages/runtime-kit/tsconfig.json | 6 +- packages/runtime/src/AppContext.tsx | 2 +- packages/runtime/src/Document.tsx | 3 +- packages/runtime/src/RouteContext.ts | 2 +- packages/runtime/src/RouteWrapper.tsx | 2 +- packages/runtime/src/Suspense.tsx | 2 +- packages/runtime/src/appConfig.ts | 37 --- packages/runtime/src/appData.ts | 4 +- packages/runtime/src/dataLoader.ts | 281 ------------------ packages/runtime/src/index.ts | 24 +- packages/runtime/src/renderDocument.tsx | 7 +- .../runtime/src/reportRecoverableError.ts | 2 +- packages/runtime/src/requestContext.ts | 54 ---- packages/runtime/src/routes.tsx | 16 +- packages/runtime/src/routesConfig.ts | 3 +- packages/runtime/src/runClientApp.tsx | 46 ++- packages/runtime/src/runServerApp.tsx | 7 +- packages/runtime/src/runtime.tsx | 12 +- .../runtime/src/server/getDocumentData.ts | 3 +- packages/runtime/src/singleRouter.tsx | 3 +- packages/runtime/src/types.ts | 246 +-------------- pnpm-lock.yaml | 3 + 48 files changed, 153 insertions(+), 716 deletions(-) create mode 100644 examples/custom-runtime/src/routes.tsx delete mode 100644 packages/runtime/src/appConfig.ts delete mode 100644 packages/runtime/src/dataLoader.ts delete mode 100644 packages/runtime/src/requestContext.ts diff --git a/examples/custom-runtime/ice.config.mts b/examples/custom-runtime/ice.config.mts index 26d2dd805b..6a20c845ed 100644 --- a/examples/custom-runtime/ice.config.mts +++ b/examples/custom-runtime/ice.config.mts @@ -22,6 +22,9 @@ export default defineConfig(() => ({ ], source: '../runtime', server: '@ice/runtime/server', + router: { + source: '@/routes', + }, }; }) }, diff --git a/examples/custom-runtime/runtime.tsx b/examples/custom-runtime/runtime.tsx index 49f495de95..828cab673a 100644 --- a/examples/custom-runtime/runtime.tsx +++ b/examples/custom-runtime/runtime.tsx @@ -5,8 +5,17 @@ import { getAppConfig } from '@ice/runtime-kit'; import ReactDOM from 'react-dom'; const runClientApp = (options: RunClientAppOptions) => { - console.log('runClientApp', options); - ReactDOM.render(<div>Hello World</div>, document.getElementById('ice-container')); + const { basename = '', createRoutes } = options; + // Normalize pathname with leading slash + const pathname = `/${window.location.pathname.replace(basename, '').replace(/^\/+/, '')}`; + + const routes = createRoutes?.({ renderMode: 'CSR' }); + const Component = routes?.find(route => route.path === pathname)?.component; + + ReactDOM.render( + Component ? <Component /> : <div>404</div>, + document.getElementById('ice-container'), + ); }; export { diff --git a/examples/custom-runtime/src/routes.tsx b/examples/custom-runtime/src/routes.tsx new file mode 100644 index 0000000000..76c5344c0f --- /dev/null +++ b/examples/custom-runtime/src/routes.tsx @@ -0,0 +1,13 @@ +import Index from './pages/index'; +import Home from './pages/home'; + +export default () => [ + { + path: '/', + component: Index, + }, + { + path: '/home', + component: Home, + }, +]; diff --git a/examples/with-antd-mobile/src/store.tsx b/examples/with-antd-mobile/src/store.tsx index c2a334f6b7..983366b766 100644 --- a/examples/with-antd-mobile/src/store.tsx +++ b/examples/with-antd-mobile/src/store.tsx @@ -1,4 +1,3 @@ -import type { ComponentWithChildren } from '@ice/runtime/types'; import { useState } from 'react'; import constate from 'constate'; @@ -12,7 +11,7 @@ function useCounter() { const [CounterProvider, useCounterContext] = constate(useCounter); -export const StoreProvider: ComponentWithChildren = ({ children }) => { +export const StoreProvider = ({ children }) => { return <CounterProvider>{ children } </CounterProvider>; }; diff --git a/packages/ice/package.json b/packages/ice/package.json index baf4d45dfb..f4211d3ca9 100644 --- a/packages/ice/package.json +++ b/packages/ice/package.json @@ -50,6 +50,7 @@ "@ice/bundles": "workspace:*", "@ice/route-manifest": "workspace:*", "@ice/runtime": "workspace:^", + "@ice/runtime-kit": "workspace:^", "@ice/shared-config": "workspace:*", "@ice/webpack-config": "workspace:*", "@ice/rspack-config": "workspace:*", diff --git a/packages/ice/src/bundler/config/getUrls.ts b/packages/ice/src/bundler/config/getUrls.ts index 5faa89342c..1cf97a7df7 100644 --- a/packages/ice/src/bundler/config/getUrls.ts +++ b/packages/ice/src/bundler/config/getUrls.ts @@ -1,6 +1,6 @@ import type { TaskConfig } from 'build-scripts'; import type { Config } from '@ice/shared-config/types'; -import type { AppConfig } from '@ice/runtime/types'; +import type { AppConfig } from '@ice/runtime-kit'; import type { Configuration as DevServerConfiguration } from 'webpack-dev-server'; import type { Configuration as RSPackDevServerConfiguration } from '@rspack/dev-server'; diff --git a/packages/ice/src/bundler/types.ts b/packages/ice/src/bundler/types.ts index 0cf4f110ed..02fe5ce786 100644 --- a/packages/ice/src/bundler/types.ts +++ b/packages/ice/src/bundler/types.ts @@ -1,7 +1,7 @@ import type { Config } from '@ice/shared-config/types'; import type ora from '@ice/bundles/compiled/ora/index.js'; import type { Stats as WebpackStats } from '@ice/bundles/compiled/webpack/index.js'; -import type { AppConfig } from '@ice/runtime/types'; +import type { AppConfig } from '@ice/runtime'; import type { Configuration, MultiCompiler, MultiStats } from '@rspack/core'; import type { Context as DefaultContext, TaskConfig } from 'build-scripts'; import type { ServerCompiler, GetAppConfig, GetRoutesConfig, GetDataloaderConfig, ExtendsPluginAPI } from '../types/plugin.js'; diff --git a/packages/ice/src/createService.ts b/packages/ice/src/createService.ts index d42ad23127..e7d2bdc110 100644 --- a/packages/ice/src/createService.ts +++ b/packages/ice/src/createService.ts @@ -7,7 +7,7 @@ import webpack from '@ice/bundles/compiled/webpack/index.js'; import { Context } from 'build-scripts'; import type { CommandArgs, CommandName, TaskConfig } from 'build-scripts'; import type { Config } from '@ice/shared-config/types'; -import type { AppConfig } from '@ice/runtime/types'; +import type { AppConfig } from '@ice/runtime'; import * as config from './config.js'; import test from './commands/test.js'; import webpackBundler from './bundler/webpack/index.js'; diff --git a/packages/ice/src/esbuild/assets.ts b/packages/ice/src/esbuild/assets.ts index ea594ffd4e..aca0ac8059 100644 --- a/packages/ice/src/esbuild/assets.ts +++ b/packages/ice/src/esbuild/assets.ts @@ -2,7 +2,7 @@ import * as path from 'path'; import * as mrmime from 'mrmime'; import fs from 'fs-extra'; import type { PluginBuild } from 'esbuild'; -import type { AssetsManifest } from '@ice/runtime/types'; +import type { AssetsManifest } from '@ice/runtime-kit'; export const ASSET_TYPES = [ // images diff --git a/packages/ice/src/types/plugin.ts b/packages/ice/src/types/plugin.ts index 174e1cbc86..0fd4688152 100644 --- a/packages/ice/src/types/plugin.ts +++ b/packages/ice/src/types/plugin.ts @@ -4,7 +4,7 @@ import type { Configuration, Stats, WebpackOptionsNormalized } from '@ice/bundle import type { esbuild } from '@ice/bundles'; import type { DefineExtraRoutes, NestedRouteManifest } from '@ice/route-manifest'; import type { Config } from '@ice/shared-config/types'; -import type { AppConfig, AssetsManifest } from '@ice/runtime/types'; +import type { AppConfig, AssetsManifest } from '@ice/runtime-kit'; import type ServerCompileTask from '../utils/ServerCompileTask.js'; import type { CreateLogger } from '../utils/logger.js'; import type { DeclarationData, AddRenderFile, AddTemplateFiles, ModifyRenderData, AddDataLoaderImport, Render } from './generator.js'; diff --git a/packages/ice/src/utils/injectInitialEntry.ts b/packages/ice/src/utils/injectInitialEntry.ts index a8375983b0..175da9682d 100644 --- a/packages/ice/src/utils/injectInitialEntry.ts +++ b/packages/ice/src/utils/injectInitialEntry.ts @@ -1,6 +1,6 @@ import path from 'path'; import fse from 'fs-extra'; -import type { RouteItem } from '@ice/runtime/types'; +import type { RouteItem } from '@ice/runtime'; import matchRoutes from '@ice/runtime/matchRoutes'; import { logger } from './logger.js'; import type RouteManifest from './routeManifest.js'; diff --git a/packages/ice/src/utils/runtimeEnv.ts b/packages/ice/src/utils/runtimeEnv.ts index 08337167b6..78f9cdbbcb 100644 --- a/packages/ice/src/utils/runtimeEnv.ts +++ b/packages/ice/src/utils/runtimeEnv.ts @@ -3,7 +3,7 @@ import * as fs from 'fs'; import * as dotenv from 'dotenv'; import { expand as dotenvExpand } from 'dotenv-expand'; import type { CommandArgs } from 'build-scripts'; -import type { AppConfig } from '@ice/runtime/types'; +import type { AppConfig } from '@ice/runtime-kit'; export interface Envs { [key: string]: string; diff --git a/packages/plugin-auth/src/runtime/index.tsx b/packages/plugin-auth/src/runtime/index.tsx index cf0fda848d..5e44e6d6f7 100644 --- a/packages/plugin-auth/src/runtime/index.tsx +++ b/packages/plugin-auth/src/runtime/index.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import type { RuntimePlugin, AppProvider, RouteWrapper } from '@ice/runtime/types'; +import type { RuntimePlugin, AppProvider, RouteWrapper } from '@ice/runtime'; import type { AuthConfig, AuthType, Auth } from '../types.js'; import { AuthProvider, useAuth, withAuth } from './Auth.js'; import type { InjectProps } from './Auth.js'; diff --git a/packages/plugin-auth/src/types.ts b/packages/plugin-auth/src/types.ts index 318a0a670d..7fc292a80c 100644 --- a/packages/plugin-auth/src/types.ts +++ b/packages/plugin-auth/src/types.ts @@ -1,5 +1,5 @@ import type * as React from 'react'; -import type { RouteConfig } from '@ice/runtime/types'; +import type { RouteConfig } from '@ice/runtime'; export interface AuthConfig { initialAuth: { diff --git a/packages/plugin-i18n/src/runtime/index.tsx b/packages/plugin-i18n/src/runtime/index.tsx index dee5e6a12c..420759cf2f 100644 --- a/packages/plugin-i18n/src/runtime/index.tsx +++ b/packages/plugin-i18n/src/runtime/index.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import type { RuntimePlugin } from '@ice/runtime/types'; +import type { RuntimePlugin } from '@ice/runtime'; import detectLocale from '../utils/detectLocale.js'; import type { I18nAppConfig, I18nConfig } from '../types.js'; import getLocaleRedirectPath from '../utils/getLocaleRedirectPath.js'; @@ -86,4 +86,4 @@ const runtime: RuntimePlugin<{ i18nConfig: I18nConfig }> = async ( export default runtime; -export { useLocale, withLocale }; \ No newline at end of file +export { useLocale, withLocale }; diff --git a/packages/plugin-icestark/src/runtime/child.tsx b/packages/plugin-icestark/src/runtime/child.tsx index 11dc169362..ed62c64569 100644 --- a/packages/plugin-icestark/src/runtime/child.tsx +++ b/packages/plugin-icestark/src/runtime/child.tsx @@ -1,5 +1,5 @@ import * as ReactDOM from 'react-dom/client'; -import type { RuntimePlugin } from '@ice/runtime/types'; +import type { RuntimePlugin } from '@ice/runtime'; import type { LifecycleOptions } from '../types'; const runtime: RuntimePlugin<LifecycleOptions> = ({ setRender }, runtimeOptions) => { diff --git a/packages/plugin-icestark/src/runtime/framework.tsx b/packages/plugin-icestark/src/runtime/framework.tsx index e8743b9905..2be519208a 100644 --- a/packages/plugin-icestark/src/runtime/framework.tsx +++ b/packages/plugin-icestark/src/runtime/framework.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { AppRouter, AppRoute } from '@ice/stark'; -import type { RuntimePlugin, ClientAppRouterProps } from '@ice/runtime/types'; +import type { RuntimePlugin, ClientAppRouterProps } from '@ice/runtime'; import type { RouteInfo, AppConfig } from '../types'; const { useState, useEffect } = React; diff --git a/packages/plugin-intl/src/runtime-simple.ts b/packages/plugin-intl/src/runtime-simple.ts index 504e18cf09..0084423eac 100644 --- a/packages/plugin-intl/src/runtime-simple.ts +++ b/packages/plugin-intl/src/runtime-simple.ts @@ -1,4 +1,4 @@ -import type { RuntimePlugin } from '@ice/runtime/types'; +import type { RuntimePlugin } from '@ice/runtime'; import { getDefaultLocale, getLocaleMessages, EXPORT_NAME } from './intl-until.js'; let currentLocale = getDefaultLocale(); diff --git a/packages/plugin-intl/src/runtime.tsx b/packages/plugin-intl/src/runtime.tsx index d8c47f5f39..82a48a980f 100644 --- a/packages/plugin-intl/src/runtime.tsx +++ b/packages/plugin-intl/src/runtime.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { createIntl, createIntlCache, RawIntlProvider, useIntl } from 'react-intl'; import type { IntlShape } from 'react-intl'; -import type { RuntimePlugin } from '@ice/runtime/types'; +import type { RuntimePlugin } from '@ice/runtime'; import { getDefaultLocale, getLocaleMessages, EXPORT_NAME } from './intl-until.js'; import type { LocaleConfig } from './types.js'; diff --git a/packages/plugin-miniapp/src/runtime/index.ts b/packages/plugin-miniapp/src/runtime/index.ts index 90ec50aab2..8848958e31 100644 --- a/packages/plugin-miniapp/src/runtime/index.ts +++ b/packages/plugin-miniapp/src/runtime/index.ts @@ -1,4 +1,4 @@ -import type { RuntimePlugin } from '@ice/runtime/types'; +import type { RuntimePlugin } from '@ice/runtime'; import type { MiniappLifecycles } from '@ice/miniapp-runtime/esm/types'; export function defineMiniappConfig( diff --git a/packages/plugin-request/src/runtime.ts b/packages/plugin-request/src/runtime.ts index 5c4c8800f3..d47e6b8f03 100644 --- a/packages/plugin-request/src/runtime.ts +++ b/packages/plugin-request/src/runtime.ts @@ -1,4 +1,4 @@ -import type { StaticRuntimePlugin } from '@ice/runtime/types'; +import type { StaticRuntimePlugin } from '@ice/runtime'; import { createAxiosInstance, setAxiosInstance } from './request.js'; import type { RequestConfig } from './types'; diff --git a/packages/plugin-store/src/runtime.tsx b/packages/plugin-store/src/runtime.tsx index cfb6fc9b80..d75bfd4741 100644 --- a/packages/plugin-store/src/runtime.tsx +++ b/packages/plugin-store/src/runtime.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import type { RuntimePlugin, AppProvider, RouteWrapper } from '@ice/runtime/types'; +import type { RuntimePlugin, AppProvider, RouteWrapper } from '@ice/runtime'; import { PAGE_STORE_INITIAL_STATES, PAGE_STORE_PROVIDER } from './constants.js'; import type { StoreConfig } from './types.js'; diff --git a/packages/runtime-kit/package.json b/packages/runtime-kit/package.json index bf26a7156c..fa7387e86e 100644 --- a/packages/runtime-kit/package.json +++ b/packages/runtime-kit/package.json @@ -5,6 +5,7 @@ "main": "./esm/index.js", "module": "./esm/index.js", "types": "./esm/index.d.ts", + "type": "module", "files": [ "esm" ], diff --git a/packages/runtime-kit/src/dataLoader.ts b/packages/runtime-kit/src/dataLoader.ts index 2e5da6cb35..bd9c7014c4 100644 --- a/packages/runtime-kit/src/dataLoader.ts +++ b/packages/runtime-kit/src/dataLoader.ts @@ -1,8 +1,9 @@ -import getRequestContext from './requestContext.js'; +import { getRequestContext } from './requestContext.js'; import type { RequestContext, RenderMode, AppExport, RuntimeModules, StaticRuntimePlugin, CommonJsRuntime, Loader, DataLoaderResult, StaticDataLoader, DataLoaderConfig, DataLoaderOptions, + RunClientAppOptions, } from './types.js'; interface Loaders { @@ -14,8 +15,8 @@ interface CachedResult { } interface Options { - fetcher: (config: StaticDataLoader) => Promise<any>; - decorator: (dataLoader: Function, id?: number) => Function; + fetcher: RunClientAppOptions['dataLoaderFetcher']; + decorator: RunClientAppOptions['dataLoaderDecorator']; runtimeModules: RuntimeModules['statics']; appExport: AppExport; } @@ -49,18 +50,16 @@ export function defineStaticDataLoader(dataLoader: Loader): DataLoaderConfig { * Custom fetcher for load static data loader config. * Set globally to avoid passing this fetcher too deep. */ -let dataLoaderFetcher: (config: StaticDataLoader) => Promise<any>; -export function setFetcher(customFetcher: (config: StaticDataLoader) => Promise<any>): void { +let dataLoaderFetcher: RunClientAppOptions['dataLoaderFetcher']; +export function setFetcher(customFetcher: RunClientAppOptions['dataLoaderFetcher']): void { dataLoaderFetcher = customFetcher; } /** * Custom decorator for deal with data loader. */ -let dataLoaderDecorator = (dataLoader: Function, id?: number): Function => { - return dataLoader; -}; -export function setDecorator(customDecorator: (dataLoader: Function, id?: number) => Function): void { +let dataLoaderDecorator: RunClientAppOptions['dataLoaderDecorator']; +export function setDecorator(customDecorator: RunClientAppOptions['dataLoaderDecorator']): void { dataLoaderDecorator = customDecorator; } @@ -125,7 +124,7 @@ export function loadDataByCustomFetcher(config: StaticDataLoader): Promise<any> } catch (error) { console.error('parse template error: ', error); } - return dataLoaderFetcher(parsedConfig); + return dataLoaderFetcher?.(parsedConfig); } /** @@ -142,7 +141,7 @@ export function callDataLoader(dataLoader: Loader, requestContext: RequestContex return loadDataByCustomFetcher(dataLoader); } - return dataLoaderDecorator(dataLoader)(requestContext); + return dataLoaderDecorator?.(dataLoader)?.(requestContext); } const cache = new Map<string, CachedResult>(); diff --git a/packages/runtime-kit/src/requestContext.ts b/packages/runtime-kit/src/requestContext.ts index 04eef93116..72482f5455 100644 --- a/packages/runtime-kit/src/requestContext.ts +++ b/packages/runtime-kit/src/requestContext.ts @@ -8,7 +8,7 @@ interface Location { /** * context for getData both in server and client side. */ -export default function getRequestContext(location: Location, serverContext: ServerContext = {}): RequestContext { +export function getRequestContext(location: Location, serverContext: ServerContext = {}): RequestContext { const { pathname, search } = location; // Use query form server context first to avoid unnecessary parsing. // @ts-ignore diff --git a/packages/runtime-kit/src/types.ts b/packages/runtime-kit/src/types.ts index eb08e7cc46..4149fe76a2 100644 --- a/packages/runtime-kit/src/types.ts +++ b/packages/runtime-kit/src/types.ts @@ -3,6 +3,7 @@ import type { ComponentType, PropsWithChildren } from 'react'; import type { HydrationOptions, Root } from 'react-dom/client'; // Basic Types +export type AppData = any; export type RouteData = any; export type RenderMode = 'SSR' | 'SSG' | 'CSR'; @@ -181,7 +182,7 @@ type UseConfig = () => RouteConfig<Record<string, any>>; type UseData = () => RouteData; type UseAppContext = () => AppContext; -export interface RuntimeAPI { +export interface RuntimeAPI<T = History> { setAppRouter?: SetAppRouter; getAppRouter: GetAppRouter; addProvider: AddProvider; @@ -193,12 +194,12 @@ export interface RuntimeAPI { useData: UseData; useConfig: UseConfig; useAppContext: UseAppContext; - history: History; + history: T; } // Plugin Types -export interface RuntimePlugin<T = Record<string, any>> { - (apis: RuntimeAPI, runtimeOptions?: T): Promise<void> | void; +export interface RuntimePlugin<T = Record<string, any>, H = History> { + (apis: RuntimeAPI<H>, runtimeOptions?: T): Promise<void> | void; } export interface StaticRuntimeAPI { @@ -253,7 +254,7 @@ export interface RunClientAppOptions<T = any> { basename?: string; memoryRouter?: boolean; runtimeOptions?: Record<string, any>; - dataLoaderFetcher?: (config: StaticDataLoader) => void; + dataLoaderFetcher?: (config: StaticDataLoader) => any; dataLoaderDecorator?: (loader: Loader, index?: number) => (requestContext: RequestContext) => DataLoaderResult; } diff --git a/packages/runtime-kit/tsconfig.json b/packages/runtime-kit/tsconfig.json index d4290f3d1f..79cf8a2f2d 100644 --- a/packages/runtime-kit/tsconfig.json +++ b/packages/runtime-kit/tsconfig.json @@ -4,8 +4,8 @@ "baseUrl": "./", "rootDir": "src", "outDir": "esm", - "module": "ES2020" + "module": "ES2020", + "moduleResolution": "NodeNext", }, - "include": ["src"], - "exclude": ["node_modules", "dist"] + "include": ["src"] } diff --git a/packages/runtime/src/AppContext.tsx b/packages/runtime/src/AppContext.tsx index 4aff665a9c..79c16f2c0e 100644 --- a/packages/runtime/src/AppContext.tsx +++ b/packages/runtime/src/AppContext.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import type { AppContext } from './types.js'; +import type { AppContext } from '@ice/runtime-kit'; const Context = React.createContext<AppContext | undefined>(undefined); diff --git a/packages/runtime/src/Document.tsx b/packages/runtime/src/Document.tsx index 53827764d6..0dd06af6b5 100644 --- a/packages/runtime/src/Document.tsx +++ b/packages/runtime/src/Document.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; -import type { WindowContext, RouteMatch, AssetsManifest } from './types.js'; +import type { AssetsManifest } from '@ice/runtime-kit'; +import type { WindowContext, RouteMatch } from './types.js'; import { useAppContext, useAppData } from './AppContext.js'; import { getMeta, getTitle, getLinks, getScripts } from './routesConfig.js'; import getCurrentRoutePath from './utils/getCurrentRoutePath.js'; diff --git a/packages/runtime/src/RouteContext.ts b/packages/runtime/src/RouteContext.ts index 0165af32e5..1b424c5b0e 100644 --- a/packages/runtime/src/RouteContext.ts +++ b/packages/runtime/src/RouteContext.ts @@ -1,5 +1,5 @@ import { useLoaderData } from 'react-router-dom'; -import type { RouteConfig } from './types.js'; +import type { RouteConfig } from '@ice/runtime-kit'; function useData<T = any>(): T { return (useLoaderData() as any)?.data; diff --git a/packages/runtime/src/RouteWrapper.tsx b/packages/runtime/src/RouteWrapper.tsx index adacd13289..1e42ee3585 100644 --- a/packages/runtime/src/RouteWrapper.tsx +++ b/packages/runtime/src/RouteWrapper.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import type { RouteWrapperConfig, ComponentModule } from './types.js'; +import type { RouteWrapperConfig, ComponentModule } from '@ice/runtime-kit'; interface Props { id: string; diff --git a/packages/runtime/src/Suspense.tsx b/packages/runtime/src/Suspense.tsx index 5323436308..5865d93193 100644 --- a/packages/runtime/src/Suspense.tsx +++ b/packages/runtime/src/Suspense.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; import type { ReactNode } from 'react'; +import type { RequestContext } from '@ice/runtime-kit'; import { useAppContext } from './AppContext.js'; import proxyData from './proxyData.js'; -import type { RequestContext } from './types.js'; const LOADER = '__ICE_SUSPENSE_LOADER__'; const isClient = typeof window !== 'undefined' && 'onload' in window; diff --git a/packages/runtime/src/appConfig.ts b/packages/runtime/src/appConfig.ts deleted file mode 100644 index be66c3212c..0000000000 --- a/packages/runtime/src/appConfig.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { AppConfig, AppExport } from './types.js'; - -const defaultAppConfig: AppConfig = { - app: { - strict: false, - rootId: 'ice-container', - }, - router: { - type: 'browser', - }, -}; - -export default function getAppConfig(appExport: AppExport): AppConfig { - const appConfig = appExport?.default || {}; - - const { app, router, ...others } = appConfig; - - return { - app: { - ...defaultAppConfig.app, - ...(app || {}), - }, - router: { - ...defaultAppConfig.router, - ...(router || {}), - }, - ...others, - }; -} - -export function defineAppConfig(appConfigOrDefineAppConfig: AppConfig | (() => AppConfig)): AppConfig { - if (typeof appConfigOrDefineAppConfig === 'function') { - return appConfigOrDefineAppConfig(); - } else { - return appConfigOrDefineAppConfig; - } -} diff --git a/packages/runtime/src/appData.ts b/packages/runtime/src/appData.ts index de9a3cea37..25714742a7 100644 --- a/packages/runtime/src/appData.ts +++ b/packages/runtime/src/appData.ts @@ -1,5 +1,5 @@ -import type { AppExport, AppData, RequestContext, Loader } from './types.js'; -import { callDataLoader } from './dataLoader.js'; +import type { AppExport, AppData, RequestContext, Loader } from '@ice/runtime-kit'; +import { callDataLoader } from '@ice/runtime-kit'; /** * Call the getData of app config. diff --git a/packages/runtime/src/dataLoader.ts b/packages/runtime/src/dataLoader.ts deleted file mode 100644 index c37b3b178e..0000000000 --- a/packages/runtime/src/dataLoader.ts +++ /dev/null @@ -1,281 +0,0 @@ -import getRequestContext from './requestContext.js'; -import type { - RequestContext, RenderMode, AppExport, - RuntimeModules, StaticRuntimePlugin, CommonJsRuntime, - Loader, DataLoaderResult, StaticDataLoader, DataLoaderConfig, DataLoaderOptions, -} from './types.js'; -interface Loaders { - [routeId: string]: DataLoaderConfig; -} - -interface CachedResult { - value: any; -} - -interface Options { - fetcher: Function; - decorator: Function; - runtimeModules: RuntimeModules['statics']; - appExport: AppExport; -} - -export interface LoadRoutesDataOptions { - renderMode: RenderMode; - requestContext?: RequestContext; -} - -export function defineDataLoader(dataLoader: Loader, options?: DataLoaderOptions): DataLoaderConfig { - return { - loader: dataLoader, - options, - }; -} - -export function defineServerDataLoader(dataLoader: Loader, options?: DataLoaderOptions): DataLoaderConfig { - return { - loader: dataLoader, - options, - }; -} - -export function defineStaticDataLoader(dataLoader: Loader): DataLoaderConfig { - return { - loader: dataLoader, - }; -} - -/** - * Custom fetcher for load static data loader config. - * Set globally to avoid passing this fetcher too deep. - */ -let dataLoaderFetcher; -export function setFetcher(customFetcher) { - dataLoaderFetcher = customFetcher; -} - -/** - * Custom decorator for deal with data loader. - */ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -let dataLoaderDecorator = (dataLoader: Function, id?: number) => { - return dataLoader; -}; -export function setDecorator(customDecorator) { - dataLoaderDecorator = customDecorator; -} - -/** - * Parse template for static dataLoader. - */ -export function parseTemplate(config: StaticDataLoader) { - const queryParams = {}; - const getQueryParams = () => { - if (Object.keys(queryParams).length === 0) { - if (location.search.includes('?')) { - location.search.substring(1).split('&').forEach(query => { - const res = query.split('='); - // ?test=1&hello=world - if (res[0] !== undefined && res[1] !== undefined) { - queryParams[res[0]] = res[1]; - } - }); - } - } - - return queryParams; - }; - - const cookie = {}; - const getCookie = () => { - if (Object.keys(cookie).length === 0) { - document.cookie.split(';').forEach(c => { - const [key, value] = c.split('='); - if (key !== undefined && value !== undefined) { - cookie[key.trim()] = value.trim(); - } - }); - } - - return cookie; - }; - - // Match all template of query cookie and storage. - let strConfig = JSON.stringify(config) || ''; - const regexp = /\$\{(queryParams|cookie|storage)(\.(\w|-)+)?}/g; - let cap = []; - let matched = []; - while ((cap = regexp.exec(strConfig)) !== null) { - matched.push(cap); - } - - matched.forEach(item => { - const [origin, key, value] = item; - if (item && origin && key && value && value.startsWith('.')) { - if (key === 'queryParams') { - // Replace query params. - strConfig = strConfig.replace(origin, getQueryParams()[value.substring(1)] || ''); - } else if (key === 'cookie') { - // Replace cookie. - strConfig = strConfig.replace(origin, getCookie()[value.substring(1)] || ''); - } else if (key === 'storage') { - // Replace storage. - strConfig = strConfig.replace(origin, localStorage.getItem(value.substring(1)) || ''); - } - } - }); - - // Replace url. - strConfig = strConfig.replace('${url}', location.href); - - return JSON.parse(strConfig); -} - -export function loadDataByCustomFetcher(config: StaticDataLoader) { - let parsedConfig = config; - try { - // Not parse template in SSG/SSR. - if (import.meta.renderer === 'client') { - parsedConfig = parseTemplate(config); - } - } catch (error) { - console.error('parse template error: ', error); - } - return dataLoaderFetcher(parsedConfig); -} - -/** - * Handle for different dataLoader. - */ -export function callDataLoader(dataLoader: Loader, requestContext: RequestContext): DataLoaderResult { - if (Array.isArray(dataLoader)) { - const loaders = dataLoader.map((loader, index) => { - return typeof loader === 'object' ? loadDataByCustomFetcher(loader) : dataLoaderDecorator(loader, index)(requestContext); - }); - - return loaders; - } - - if (typeof dataLoader === 'object') { - return loadDataByCustomFetcher(dataLoader); - } - - return dataLoaderDecorator(dataLoader)(requestContext); -} - -const cache = new Map<string, CachedResult>(); - -/** - * Start getData once data-loader.js is ready in client, and set to cache. - */ -function loadInitialDataInClient(loaders: Loaders) { - const context = (window as any).__ICE_APP_CONTEXT__ || {}; - const matchedIds = context.matchedIds || []; - const loaderData = context.loaderData || {}; - const { renderMode } = context; - - const ids = ['__app'].concat(matchedIds); - ids.forEach(id => { - const dataFromSSR = loaderData[id]?.data; - if (dataFromSSR) { - cache.set(renderMode === 'SSG' ? `${id}_ssg` : id, { - value: dataFromSSR, - }); - - if (renderMode === 'SSR') { - return; - } - } - - const dataLoaderConfig = loaders[id]; - - if (dataLoaderConfig) { - const requestContext = getRequestContext(window.location); - const { loader } = dataLoaderConfig; - const promise = callDataLoader(loader, requestContext); - - cache.set(id, { - value: promise, - }); - } - }); -} - -/** - * Init data loader in client side. - * Load initial data and register global loader. - * In order to load data, JavaScript modules, CSS and other assets in parallel. - */ -async function init(loaders: Loaders, options: Options) { - const { - fetcher, - decorator, - runtimeModules, - appExport, - } = options; - - const runtimeApi = { - appContext: { - appExport, - }, - }; - - if (runtimeModules) { - await Promise.all(runtimeModules.map(module => { - const runtimeModule = ((module as CommonJsRuntime).default || module) as StaticRuntimePlugin; - return runtimeModule(runtimeApi); - }).filter(Boolean)); - } - - if (fetcher) { - setFetcher(fetcher); - } - - if (decorator) { - setDecorator(decorator); - } - - try { - loadInitialDataInClient(loaders); - } catch (error) { - console.error('Load initial data error: ', error); - } - - (window as any).__ICE_DATA_LOADER__ = { - getLoader: (id) => { - return loaders[id]; - }, - getData: (id, options: LoadRoutesDataOptions) => { - let result; - - // First render for ssg use data from build time, second render for ssg will use data from data loader. - const cacheKey = `${id}${options?.renderMode === 'SSG' ? '_ssg' : ''}`; - - // In CSR, all dataLoader is called by global data loader to avoid bundle dataLoader in page bundle duplicate. - result = cache.get(cacheKey); - // Always fetch new data after cache is been used. - cache.delete(cacheKey); - - // Already send data request. - if (result) { - return result.value; - } - - const dataLoaderConfig = loaders[id]; - - // No data loader. - if (!dataLoaderConfig) { - return null; - } - - // Call dataLoader. - const { loader } = dataLoaderConfig; - return callDataLoader(loader, options?.requestContext || getRequestContext(window.location)); - }, - }; -} - -export const dataLoader = { - init, -}; - -export default dataLoader; diff --git a/packages/runtime/src/index.ts b/packages/runtime/src/index.ts index 7371d5cefa..f59bf85084 100644 --- a/packages/runtime/src/index.ts +++ b/packages/runtime/src/index.ts @@ -1,20 +1,27 @@ import type { + RunClientAppOptions, + CreateRoutes, RuntimePlugin, AppContext, - PublicAppContext, AppConfig, RouteConfig, - RouteItem, - ServerContext, - AppProvider, + RouteWrapperConfig, RouteWrapper, RenderMode, Loader, - RouteWrapperConfig, + ServerContext, + AppProvider, + StaticRuntimePlugin, +} from '@ice/runtime-kit'; +import { dataLoader, defineDataLoader, defineServerDataLoader, defineStaticDataLoader, callDataLoader, getRequestContext } from '@ice/runtime-kit'; +import { getAppConfig, defineAppConfig } from '@ice/runtime-kit'; +import type { + PublicAppContext, + RouteItem, + ClientAppRouterProps, } from './types.js'; import Runtime from './runtime.js'; import runClientApp from './runClientApp.js'; -import type { RunClientAppOptions, CreateRoutes } from './runClientApp.js'; import { useAppContext as useInternalAppContext, useAppData, AppContextProvider } from './AppContext.js'; import { getAppData } from './appData.js'; import { useData, useConfig } from './RouteContext.js'; @@ -37,10 +44,7 @@ import type { DataType, MainType, } from './Document.js'; -import dataLoader, { defineDataLoader, defineServerDataLoader, defineStaticDataLoader, callDataLoader } from './dataLoader.js'; -import getRequestContext from './requestContext.js'; import AppErrorBoundary from './AppErrorBoundary.js'; -import getAppConfig, { defineAppConfig } from './appConfig.js'; import { routerHistory as history } from './history.js'; import KeepAliveOutlet from './KeepAliveOutlet.js'; import { useActive } from './Activity.js'; @@ -150,6 +154,7 @@ export { } from 'react-router-dom'; export type { + StaticRuntimePlugin, RuntimePlugin, AppContext, AppConfig, @@ -170,4 +175,5 @@ export type { DataType, MainType, CreateRoutes, + ClientAppRouterProps, }; diff --git a/packages/runtime/src/renderDocument.tsx b/packages/runtime/src/renderDocument.tsx index 87eb3f8bb8..fcb5ebe237 100644 --- a/packages/runtime/src/renderDocument.tsx +++ b/packages/runtime/src/renderDocument.tsx @@ -1,24 +1,23 @@ import * as React from 'react'; import * as ReactDOMServer from 'react-dom/server'; -import getAppConfig from './appConfig.js'; +import { getRequestContext, getAppConfig } from '@ice/runtime-kit'; +import type { ServerContext, AppContext } from '@ice/runtime-kit'; import { AppContextProvider } from './AppContext.js'; import { DocumentContextProvider } from './Document.js'; import addLeadingSlash from './utils/addLeadingSlash.js'; -import getRequestContext from './requestContext.js'; import matchRoutes from './matchRoutes.js'; import getDocumentData from './server/getDocumentData.js'; import getCurrentRoutePath from './utils/getCurrentRoutePath.js'; import { sendResponse, getLocation } from './server/response.js'; import type { - AppContext, RouteItem, RouteMatch, RenderOptions, Response, - ServerContext, } from './types.js'; + interface RenderDocumentOptions { matches: RouteMatch[]; renderOptions: RenderOptions; diff --git a/packages/runtime/src/reportRecoverableError.ts b/packages/runtime/src/reportRecoverableError.ts index 5bb9968fa0..9b18648db8 100644 --- a/packages/runtime/src/reportRecoverableError.ts +++ b/packages/runtime/src/reportRecoverableError.ts @@ -1,4 +1,4 @@ -import type { ErrorStack } from './types.js'; +import type { ErrorStack } from '@ice/runtime-kit'; interface ErrorOptions { ignoreRuntimeWarning?: boolean; diff --git a/packages/runtime/src/requestContext.ts b/packages/runtime/src/requestContext.ts deleted file mode 100644 index aff80f144d..0000000000 --- a/packages/runtime/src/requestContext.ts +++ /dev/null @@ -1,54 +0,0 @@ -import type { ServerContext, RequestContext } from './types.js'; - -export interface Location { - pathname: string; - search: string; -} - -/** - * context for getData both in server and client side. - */ -export default function getRequestContext(location: Location, serverContext: ServerContext = {}): RequestContext { - const { pathname, search } = location; - // Use query form server context first to avoid unnecessary parsing. - // @ts-ignore - const query = serverContext?.req?.query || parseSearch(search); - - const requestContext: RequestContext = { - ...(serverContext || {}), - pathname, - query, - }; - - return requestContext; -} - -/** - * Search string to object - * URLSearchParams is not compatible with iOS9 and IE. - */ -export function parseSearch(search: string) { - // remove first '?' - if (search.indexOf('?') === 0) { - search = search.slice(1); - } - - const result = {}; - - let pairs = search.split('&'); - - for (let j = 0; j < pairs.length; j++) { - const value = pairs[j]; - const index = value.indexOf('='); - - if (index > -1) { - const k = value.slice(0, index); - const v = value.slice(index + 1); - result[k] = v; - } else if (value) { - result[value] = ''; - } - } - - return result; -} diff --git a/packages/runtime/src/routes.tsx b/packages/runtime/src/routes.tsx index fe95deb476..f2855ce865 100644 --- a/packages/runtime/src/routes.tsx +++ b/packages/runtime/src/routes.tsx @@ -3,21 +3,13 @@ import { useRouteError, defer, Await as ReactRouterAwait } from 'react-router-do import type { AwaitProps } from 'react-router-dom'; // eslint-disable-next-line camelcase import type { UNSAFE_DeferredData, LoaderFunctionArgs } from '@remix-run/router'; -import type { - RouteItem, - RouteModules, - RenderMode, - RequestContext, - ComponentModule, - DataLoaderConfig, - DataLoaderOptions, - Loader, -} from './types.js'; +import type { RouteModules, RenderMode, RequestContext, ComponentModule, DataLoaderConfig, DataLoaderOptions, Loader } from '@ice/runtime-kit'; +import { callDataLoader } from '@ice/runtime-kit'; +import { parseSearch } from '@ice/runtime-kit'; +import type { RouteItem } from './types.js'; import RouteWrapper from './RouteWrapper.js'; import { useAppContext } from './AppContext.js'; -import { callDataLoader } from './dataLoader.js'; import { updateRoutesConfig } from './routesConfig.js'; -import { parseSearch } from './requestContext.js'; type RouteModule = Pick<RouteItem, 'id' | 'lazy'>; diff --git a/packages/runtime/src/routesConfig.ts b/packages/runtime/src/routesConfig.ts index ceba4f3aba..a2c8335d40 100644 --- a/packages/runtime/src/routesConfig.ts +++ b/packages/runtime/src/routesConfig.ts @@ -1,4 +1,5 @@ -import type { RouteMatch, LoadersData, LoaderData, RouteConfig } from './types.js'; +import type { RouteConfig, LoadersData, LoaderData } from '@ice/runtime-kit'; +import type { RouteMatch } from './types.js'; export function getMeta( matches: RouteMatch[], diff --git a/packages/runtime/src/runClientApp.tsx b/packages/runtime/src/runClientApp.tsx index d03ed992ea..18ee466837 100644 --- a/packages/runtime/src/runClientApp.tsx +++ b/packages/runtime/src/runClientApp.tsx @@ -1,42 +1,40 @@ import React from 'react'; import * as ReactDOM from 'react-dom/client'; -import { createHashHistory, createBrowserHistory, createMemoryHistory } from '@remix-run/router'; +import { + createHashHistory, + createBrowserHistory, + createMemoryHistory, +} from '@remix-run/router'; import type { History } from '@remix-run/router'; import type { - AppContext, WindowContext, AppExport, RouteItem, RuntimeModules, AppConfig, AssetsManifest, ClientAppRouterProps, + AppContext, + AppConfig, + AssetsManifest, + RunClientAppOptions, ErrorStack, +} from '@ice/runtime-kit'; +import { setFetcher, setDecorator, getRequestContext, getAppConfig } from '@ice/runtime-kit'; +import type { + WindowContext, + RouteItem, + ClientAppRouterProps, } from './types.js'; -import { createHistory as createHistorySingle, getSingleRoute } from './singleRouter.js'; -import { setHistory } from './history.js'; import Runtime from './runtime.js'; +import { + createHistory as createHistorySingle, + getSingleRoute, +} from './singleRouter.js'; +import { setHistory } from './history.js'; import { getAppData } from './appData.js'; import { getRoutesPath, loadRouteModule } from './routes.js'; -import type { RouteLoaderOptions } from './routes.js'; -import getRequestContext from './requestContext.js'; -import getAppConfig from './appConfig.js'; import matchRoutes from './matchRoutes.js'; -import { setFetcher, setDecorator } from './dataLoader.js'; import ClientRouter from './ClientRouter.js'; -import addLeadingSlash from './utils/addLeadingSlash.js'; import { AppContextProvider } from './AppContext.js'; +import addLeadingSlash from './utils/addLeadingSlash.js'; import { deprecatedHistory } from './utils/deprecatedHistory.js'; import reportRecoverableError from './reportRecoverableError.js'; -export type CreateRoutes = (options: Pick<RouteLoaderOptions, 'renderMode' | 'requestContext'>) => RouteItem[]; - -export interface RunClientAppOptions { - app: AppExport; - runtimeModules: RuntimeModules; - createRoutes?: CreateRoutes; - hydrate?: boolean; - basename?: string; - memoryRouter?: boolean; - runtimeOptions?: Record<string, any>; - dataLoaderFetcher?: Function; - dataLoaderDecorator?: Function; -} - -export default async function runClientApp(options: RunClientAppOptions) { +export default async function runClientApp(options: RunClientAppOptions<RouteItem>) { const { app, createRoutes, diff --git a/packages/runtime/src/runServerApp.tsx b/packages/runtime/src/runServerApp.tsx index 8205e20487..3515d4b876 100644 --- a/packages/runtime/src/runServerApp.tsx +++ b/packages/runtime/src/runServerApp.tsx @@ -1,11 +1,10 @@ import * as React from 'react'; import type { Location } from 'history'; +import type { AppContext, ServerContext, AppData } from '@ice/runtime-kit'; +import { getAppConfig, getRequestContext } from '@ice/runtime-kit'; import type { OnAllReadyParams, OnShellReadyParams } from './server/streamRender.js'; import type { - AppContext, - ServerContext, RouteMatch, - AppData, ServerAppRouterProps, RenderOptions, Response, @@ -13,11 +12,9 @@ import type { import Runtime from './runtime.js'; import { AppContextProvider } from './AppContext.js'; import { getAppData } from './appData.js'; -import getAppConfig from './appConfig.js'; import { DocumentContextProvider } from './Document.js'; import { loadRouteModules } from './routes.js'; import { pipeToString, renderToNodeStream } from './server/streamRender.js'; -import getRequestContext from './requestContext.js'; import matchRoutes from './matchRoutes.js'; import getCurrentRoutePath from './utils/getCurrentRoutePath.js'; import ServerRouter from './ServerRouter.js'; diff --git a/packages/runtime/src/runtime.tsx b/packages/runtime/src/runtime.tsx index 0c102aa610..c4a506bb92 100644 --- a/packages/runtime/src/runtime.tsx +++ b/packages/runtime/src/runtime.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import type { ComponentType } from 'react'; -import { routerHistory as history } from './history.js'; import type { Renderer, AppContext, @@ -14,14 +13,15 @@ import type { AddWrapper, RouteWrapperConfig, SetRender, - AppRouterProps, ComponentWithChildren, ResponseHandler, -} from './types.js'; +} from '@ice/runtime-kit'; +import type { History } from '@remix-run/router'; +import { routerHistory as history } from './history.js'; +import type { AppRouterProps } from './types.js'; import { useData, useConfig } from './RouteContext.js'; import { useData as useSingleRouterData, useConfig as useSingleRouterConfig } from './singleRouter.js'; import { useAppContext } from './AppContext.js'; - class Runtime { private appContext: AppContext; @@ -73,7 +73,7 @@ class Runtime { public getWrappers = () => this.RouteWrappers; public loadModule(module: RuntimePlugin | StaticRuntimePlugin | CommonJsRuntime) { - let runtimeAPI: RuntimeAPI = { + let runtimeAPI: RuntimeAPI<History> = { addProvider: this.addProvider, addResponseHandler: this.addResponseHandler, getResponseHandlers: this.getResponseHandlers, @@ -88,7 +88,7 @@ class Runtime { history, }; - const runtimeModule = ((module as CommonJsRuntime).default || module) as RuntimePlugin; + const runtimeModule = ((module as CommonJsRuntime).default || module) as RuntimePlugin<any, History>; if (module) { return runtimeModule(runtimeAPI, this.runtimeOptions); } diff --git a/packages/runtime/src/server/getDocumentData.ts b/packages/runtime/src/server/getDocumentData.ts index 875eceaf39..dfc691a45f 100644 --- a/packages/runtime/src/server/getDocumentData.ts +++ b/packages/runtime/src/server/getDocumentData.ts @@ -1,4 +1,5 @@ -import type { DocumentDataLoaderConfig, RequestContext } from '../types.js'; +import type { RequestContext } from '@ice/runtime-kit'; +import type { DocumentDataLoaderConfig } from '../types.js'; interface Options { loaderConfig: DocumentDataLoaderConfig; diff --git a/packages/runtime/src/singleRouter.tsx b/packages/runtime/src/singleRouter.tsx index 06d4b30783..1f6242f373 100644 --- a/packages/runtime/src/singleRouter.tsx +++ b/packages/runtime/src/singleRouter.tsx @@ -5,7 +5,8 @@ import * as React from 'react'; import type { History } from '@remix-run/router'; import type { RouteObject } from 'react-router-dom'; -import type { LoaderData, RouteItem } from './types.js'; +import type { LoaderData } from '@ice/runtime-kit'; +import type { RouteItem } from './types.js'; import { loadRouteModules } from './routes.js'; const Context = React.createContext<LoaderData>(undefined); diff --git a/packages/runtime/src/types.ts b/packages/runtime/src/types.ts index 80f2adeeee..38ebfe009f 100644 --- a/packages/runtime/src/types.ts +++ b/packages/runtime/src/types.ts @@ -1,93 +1,20 @@ -import type { IncomingMessage, ServerResponse } from 'http'; -import type { InitialEntry, AgnosticRouteObject, Location, History, RouterInit, StaticHandlerContext } from '@remix-run/router'; -import type { ComponentType, PropsWithChildren } from 'react'; -import type { HydrationOptions, Root } from 'react-dom/client'; +import type { ComponentType } from 'react'; +import type { AgnosticRouteObject, Location, RouterInit, StaticHandlerContext } from '@remix-run/router'; import type { Params, RouteObject } from 'react-router-dom'; +import type { + AppContext, + AppExport, + ComponentWithChildren, + DataLoaderResult, + LoaderData, + PageConfig, + RenderMode, + RequestContext, + RuntimeModules, + AssetsManifest, +} from '@ice/runtime-kit'; import type { RouteLoaderOptions } from './routes.js'; -import type { RenderToPipeableStreamOptions, NodeWritablePiper } from './server/streamRender.js'; - -type UseConfig = () => RouteConfig<Record<string, any>>; -type UseData = () => RouteData; -type UseAppContext = () => AppContext; - -type VoidFunction = () => void; -type AppLifecycle = 'onShow' | 'onHide' | 'onPageNotFound' | 'onShareAppMessage' | 'onUnhandledRejection' | 'onLaunch' | 'onError' | 'onTabItemClick'; -type App = Partial<{ - rootId: string; - strict: boolean; - errorBoundary: boolean; - onRecoverableError: (error: unknown, errorInfo: ErrorStack) => void; - onBeforeHydrate: () => void; -} & Record<AppLifecycle, VoidFunction>>; - -export interface ErrorStack { - componentStack?: string; - digest?: string; -} - -export type AppData = any; -export type RouteData = any; - -// route.pageConfig return value -export type RouteConfig<T = {}> = T & { - // Support for extends config. - title?: string; - meta?: React.MetaHTMLAttributes<HTMLMetaElement>[]; - links?: React.LinkHTMLAttributes<HTMLLinkElement>[]; - scripts?: React.ScriptHTMLAttributes<HTMLScriptElement>[]; -}; - -export interface AppExport { - default?: AppConfig; - [key: string]: any; - dataLoader?: DataLoaderConfig; -} - -export type DataLoaderResult = (Promise<RouteData> | RouteData) | RouteData; -export type DataLoader = (ctx: RequestContext) => DataLoaderResult; - -export interface StaticDataLoader { - key?: string; - prefetch_type?: string; - api: string; - v: string; - data: any; - ext_headers: Object; -} - -// route.defineDataLoader -// route.defineServerDataLoader -// route.defineStaticDataLoader -export type Loader = DataLoader | StaticDataLoader | Array<DataLoader | StaticDataLoader>; - -// route.pageConfig -export type PageConfig = (args: { data?: RouteData }) => RouteConfig; - -export interface AppConfig { - app?: App; - router?: { - type?: 'hash' | 'browser' | 'memory'; - basename?: string; - initialEntries?: InitialEntry[]; - }; -} - -export interface RoutesConfig { - [routeId: string]: RouteConfig; -} - -export interface RoutesData { - [routeId: string]: RouteData; -} - -export interface DataLoaderOptions { - defer?: boolean; -} - -export interface DataLoaderConfig { - loader: Loader; - options?: DataLoaderOptions; -} +import type { NodeWritablePiper, RenderToPipeableStreamOptions } from './server/streamRender.js'; interface DocumentLoaderOptions { documentOnly?: boolean; @@ -98,38 +25,6 @@ export interface DocumentDataLoaderConfig { loader: DocumentDataLoader; } -export interface LoadersData { - [routeId: string]: LoaderData; -} - -export interface LoaderData { - data?: RouteData; - pageConfig?: RouteConfig; -} - -// useAppContext -export interface AppContext { - appConfig: AppConfig; - appData: any; - documentData?: any; - serverData?: any; - assetsManifest?: AssetsManifest; - loaderData?: LoadersData; - routeModules?: RouteModules; - RouteWrappers?: RouteWrapperConfig[]; - routePath?: string; - matches?: RouteMatch[]; - routes?: RouteItem[]; - documentOnly?: boolean; - matchedIds?: string[]; - appExport?: AppExport; - basename?: string; - downgrade?: boolean; - renderMode?: RenderMode; - requestContext?: RequestContext; - revalidate?: boolean; -} - export type PublicAppContext = Pick< AppContext, 'appConfig' | 'routePath' | 'downgrade' | 'documentOnly' | 'renderMode' @@ -140,31 +35,6 @@ AppContext, 'appData' | 'loaderData' | 'routePath' | 'downgrade' | 'matchedIds' | 'documentOnly' | 'renderMode' | 'serverData' | 'revalidate' >; -export type Renderer = ( - container: Element | Document, - initialChildren: React.ReactNode, - options?: HydrationOptions, -) => Root; - -export interface ServerContext { - req?: IncomingMessage; - res?: ServerResponse; -} - -export interface RequestContext extends ServerContext { - pathname: string; - query: Record<string, any>; -} - -export type ComponentModule = { - default?: ComponentType<any>; - Component?: ComponentType<any>; - staticDataLoader?: DataLoaderConfig; - serverDataLoader?: DataLoaderConfig; - dataLoader?: DataLoaderConfig; - pageConfig?: PageConfig; - [key: string]: any; -}; export type RouteItem = AgnosticRouteObject & { componentName: string; @@ -174,94 +44,10 @@ export type RouteItem = AgnosticRouteObject & { children?: RouteItem[]; }; -export type ComponentWithChildren<P = {}> = ComponentType<PropsWithChildren<P>>; - export type DocumentComponent = ComponentWithChildren<{ pagePath: string; }>; -export interface RouteWrapperConfig { - Wrapper: RouteWrapper; - layout?: boolean; -} - -export type AppProvider = ComponentWithChildren<any>; -export type RouteWrapper = ComponentType<any>; -export type ResponseHandler = ( - req: IncomingMessage, - res: ServerResponse, -) => any | Promise<any>; - -export type SetAppRouter = <T>(AppRouter: ComponentType<T>) => void; -export type GetAppRouter = () => AppProvider; -export type AddProvider = (Provider: AppProvider) => void; -export type SetRender = (render: Renderer) => void; -export type AddWrapper = (wrapper: RouteWrapper, forLayout?: boolean) => void; -export type AddResponseHandler = (handler: ResponseHandler) => void; -export type GetResponseHandlers = () => ResponseHandler[]; - -export interface RouteModules { - [routeId: string]: ComponentModule; -} - -export interface AssetsManifest { - dataLoader?: string; - publicPath: string; - entries: { - [assetPath: string]: string[]; - }; - pages: { - [assetPath: string]: string[]; - }; - assets?: { - [assetPath: string]: string; - }; -} - -export interface RuntimeAPI { - setAppRouter?: SetAppRouter; - getAppRouter: GetAppRouter; - addProvider: AddProvider; - addResponseHandler: AddResponseHandler; - getResponseHandlers: GetResponseHandlers; - setRender: SetRender; - addWrapper: AddWrapper; - appContext: AppContext; - useData: UseData; - useConfig: UseConfig; - useAppContext: UseAppContext; - history: History; -} - -export interface StaticRuntimeAPI { - appContext: { - appExport: AppExport; - }; -} - -export interface RuntimePlugin<T = Record<string, any>> { - ( - apis: RuntimeAPI, - runtimeOptions?: T, - ): Promise<void> | void; -} - -export interface StaticRuntimePlugin<T = Record<string, any>> { - ( - apis: StaticRuntimeAPI, - runtimeOptions?: T, - ): Promise<void> | void; -} - -export interface CommonJsRuntime { - default: RuntimePlugin | StaticRuntimePlugin; -} - -export interface RuntimeModules { - statics?: (StaticRuntimePlugin | CommonJsRuntime)[]; - commons?: (RuntimePlugin | CommonJsRuntime)[]; -} - export interface AppRouterProps { routes?: RouteObject[]; location?: Location; @@ -301,8 +87,6 @@ export interface RouteMatch { route: RouteItem; } -export type RenderMode = 'SSR' | 'SSG' | 'CSR'; - interface Piper { pipe: NodeWritablePiper; fallback: Function; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 115b1131e4..4693ffc435 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1690,6 +1690,9 @@ importers: '@ice/runtime': specifier: workspace:^ version: link:../runtime + '@ice/runtime-kit': + specifier: workspace:^ + version: link:../runtime-kit '@ice/shared-config': specifier: workspace:* version: link:../shared-config From 279625be537fef8b3433ce59e9a8dc231484f061 Mon Sep 17 00:00:00 2001 From: ClarkXia <xiawenwu41@gmail.com> Date: Tue, 21 Jan 2025 17:43:58 +0800 Subject: [PATCH 07/10] fix: update api --- packages/runtime/src/data-loader.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/runtime/src/data-loader.ts diff --git a/packages/runtime/src/data-loader.ts b/packages/runtime/src/data-loader.ts new file mode 100644 index 0000000000..2d7ca42621 --- /dev/null +++ b/packages/runtime/src/data-loader.ts @@ -0,0 +1 @@ +export { defineDataLoader, defineServerDataLoader, defineStaticDataLoader } from '@ice/runtime-kit'; From e91db611cfe7f59f1eab5725cbdddf044188efdc Mon Sep 17 00:00:00 2001 From: ClarkXia <xiawenwu41@gmail.com> Date: Tue, 21 Jan 2025 17:52:32 +0800 Subject: [PATCH 08/10] fix: add file for export path --- packages/runtime/src/{data-loader.ts => dataLoader.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/runtime/src/{data-loader.ts => dataLoader.ts} (100%) diff --git a/packages/runtime/src/data-loader.ts b/packages/runtime/src/dataLoader.ts similarity index 100% rename from packages/runtime/src/data-loader.ts rename to packages/runtime/src/dataLoader.ts From 72c357408c8e7018edf9467a1114a8c9c0fda3e0 Mon Sep 17 00:00:00 2001 From: ClarkXia <xiawenwu41@gmail.com> Date: Tue, 21 Jan 2025 19:18:09 +0800 Subject: [PATCH 09/10] fix: test --- packages/runtime-kit/src/dataLoader.ts | 5 ++++- packages/runtime/tests/appConfig.test.ts | 2 +- packages/runtime/tests/routes.test.tsx | 1 + packages/runtime/tests/templateParse.test.ts | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/runtime-kit/src/dataLoader.ts b/packages/runtime-kit/src/dataLoader.ts index bd9c7014c4..84c5ac3a37 100644 --- a/packages/runtime-kit/src/dataLoader.ts +++ b/packages/runtime-kit/src/dataLoader.ts @@ -58,7 +58,10 @@ export function setFetcher(customFetcher: RunClientAppOptions['dataLoaderFetcher /** * Custom decorator for deal with data loader. */ -let dataLoaderDecorator: RunClientAppOptions['dataLoaderDecorator']; +// @ts-ignore +let dataLoaderDecorator: RunClientAppOptions['dataLoaderDecorator'] = (dataLoader) => { + return dataLoader; +}; export function setDecorator(customDecorator: RunClientAppOptions['dataLoaderDecorator']): void { dataLoaderDecorator = customDecorator; } diff --git a/packages/runtime/tests/appConfig.test.ts b/packages/runtime/tests/appConfig.test.ts index bc3c9daee3..3c664467f6 100644 --- a/packages/runtime/tests/appConfig.test.ts +++ b/packages/runtime/tests/appConfig.test.ts @@ -1,5 +1,5 @@ import { expect, it, describe } from 'vitest'; -import getAppConfig, { defineAppConfig } from '../src/appConfig.js'; +import { getAppConfig, defineAppConfig } from '@ice/runtime-kit'; describe('AppConfig', () => { it('getAppConfig', () => { diff --git a/packages/runtime/tests/routes.test.tsx b/packages/runtime/tests/routes.test.tsx index 066360c16a..9c9c02f17e 100644 --- a/packages/runtime/tests/routes.test.tsx +++ b/packages/runtime/tests/routes.test.tsx @@ -155,6 +155,7 @@ describe('routes', () => { }); it('load async route', async () => { + process.env.ICE_CORE_ROUTER = 'true'; const { data: deferredResult } = await createRouteLoader({ routeId: 'home', module: InfoItem, diff --git a/packages/runtime/tests/templateParse.test.ts b/packages/runtime/tests/templateParse.test.ts index 84a4847301..b1f4d9300c 100644 --- a/packages/runtime/tests/templateParse.test.ts +++ b/packages/runtime/tests/templateParse.test.ts @@ -3,7 +3,7 @@ */ import { expect, it, describe, beforeEach, afterEach, vi } from 'vitest'; -import { parseTemplate } from '../src/dataLoader'; +import { parseTemplate } from '@ice/runtime-kit'; describe('parseTemplate', () => { let locationSpy; @@ -128,4 +128,4 @@ describe('parseTemplate', () => { ext_headers: {}, }); }); -}); \ No newline at end of file +}); From e524168fe67b28826966370dcf2aeb9e8d191b1e Mon Sep 17 00:00:00 2001 From: ClarkXia <xiawenwu41@gmail.com> Date: Tue, 21 Jan 2025 19:29:33 +0800 Subject: [PATCH 10/10] fix: update type import source --- packages/ice/src/bundler/types.ts | 2 +- packages/ice/src/createService.ts | 2 +- packages/ice/src/utils/getRouterBasename.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ice/src/bundler/types.ts b/packages/ice/src/bundler/types.ts index 02fe5ce786..61459b67b2 100644 --- a/packages/ice/src/bundler/types.ts +++ b/packages/ice/src/bundler/types.ts @@ -1,7 +1,7 @@ import type { Config } from '@ice/shared-config/types'; import type ora from '@ice/bundles/compiled/ora/index.js'; import type { Stats as WebpackStats } from '@ice/bundles/compiled/webpack/index.js'; -import type { AppConfig } from '@ice/runtime'; +import type { AppConfig } from '@ice/runtime-kit'; import type { Configuration, MultiCompiler, MultiStats } from '@rspack/core'; import type { Context as DefaultContext, TaskConfig } from 'build-scripts'; import type { ServerCompiler, GetAppConfig, GetRoutesConfig, GetDataloaderConfig, ExtendsPluginAPI } from '../types/plugin.js'; diff --git a/packages/ice/src/createService.ts b/packages/ice/src/createService.ts index e7d2bdc110..ed839545df 100644 --- a/packages/ice/src/createService.ts +++ b/packages/ice/src/createService.ts @@ -7,7 +7,7 @@ import webpack from '@ice/bundles/compiled/webpack/index.js'; import { Context } from 'build-scripts'; import type { CommandArgs, CommandName, TaskConfig } from 'build-scripts'; import type { Config } from '@ice/shared-config/types'; -import type { AppConfig } from '@ice/runtime'; +import type { AppConfig } from '@ice/runtime-kit'; import * as config from './config.js'; import test from './commands/test.js'; import webpackBundler from './bundler/webpack/index.js'; diff --git a/packages/ice/src/utils/getRouterBasename.ts b/packages/ice/src/utils/getRouterBasename.ts index 4ad0e90ec5..482bf8591d 100644 --- a/packages/ice/src/utils/getRouterBasename.ts +++ b/packages/ice/src/utils/getRouterBasename.ts @@ -1,4 +1,4 @@ -import type { AppConfig } from '@ice/runtime'; +import type { AppConfig } from '@ice/runtime-kit'; import type { Config } from '@ice/shared-config/types'; import type { TaskConfig } from 'build-scripts';