From 5266fedc7b6950d0ae784c7f4db47ef6f5ad07be Mon Sep 17 00:00:00 2001 From: ClarkXia Date: Wed, 17 May 2023 15:06:17 +0800 Subject: [PATCH 1/8] fix: import store source before swc compiler (#6248) --- .changeset/dull-hounds-hunt.md | 5 +++++ packages/plugin-store/src/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/dull-hounds-hunt.md diff --git a/.changeset/dull-hounds-hunt.md b/.changeset/dull-hounds-hunt.md new file mode 100644 index 0000000000..6384a55f82 --- /dev/null +++ b/.changeset/dull-hounds-hunt.md @@ -0,0 +1,5 @@ +--- +'@ice/plugin-store': patch +--- + +fix: import store source before swc compiler diff --git a/packages/plugin-store/src/index.ts b/packages/plugin-store/src/index.ts index 67d899c505..9a3d20783d 100644 --- a/packages/plugin-store/src/index.ts +++ b/packages/plugin-store/src/index.ts @@ -70,7 +70,7 @@ const formatId = (id: string) => id.split(path.sep).join('/'); function exportStoreProviderPlugin({ pageDir, resetPageState }: { pageDir: string; resetPageState: boolean }): Config['transformPlugins'][0] { return { name: 'export-store-provider', - enforce: 'post', + enforce: 'pre', transformInclude: (id) => { return ( /\.[jt]sx?$/i.test(id) && From f24b045de95f3d77bcb070a3d47a5576f2a89906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=93=E9=99=8C=E5=90=8C=E5=AD=A6?= Date: Thu, 18 May 2023 11:01:34 +0800 Subject: [PATCH 2/8] Feat/support sourcemap (#6158) * feat: add generateSourceMap * feat: generate souce map * chore: add changeset * feat: add data-sourcemap * feat: add with-entry-type example * feat: add sourcemap info * fix: modify toJson to toString * chore: rename generate sourcemap * feat: modify line of child map * feat: add base line * chore: modify BASE_COLUMN * chore: modify pnpm lock * feat: data-sourcemap should be delete * chore: update lock * chore: add changeset * chore: modify lock * chore: remove app worker and data loader * chore: if sourceMapFileList is empty, return empty string * feat: support sourcemap meta * feat: dealwith style * feat: add prependCode * chore: modify package * chore: modify if --- .changeset/perfect-bags-double.md | 5 ++ .changeset/strong-pumpkins-brake.md | 6 ++ examples/with-entry-type/.browserslistrc | 1 + examples/with-entry-type/ice.config.mts | 18 ++++++ examples/with-entry-type/package.json | 24 +++++++ examples/with-entry-type/public/favicon.ico | Bin 0 -> 2719 bytes examples/with-entry-type/src/app.tsx | 3 + examples/with-entry-type/src/document.tsx | 42 ++++++++++++ .../src/pages/Custom/index.tsx | 19 ++++++ examples/with-entry-type/src/pages/about.tsx | 30 +++++++++ examples/with-entry-type/src/pages/blog.tsx | 21 ++++++ examples/with-entry-type/src/pages/home.tsx | 20 ++++++ .../src/pages/index.module.css | 25 ++++++++ examples/with-entry-type/src/pages/layout.tsx | 22 +++++++ examples/with-entry-type/src/typings.d.ts | 1 + examples/with-entry-type/tsconfig.json | 32 ++++++++++ packages/ice/src/commands/build.ts | 2 + packages/ice/src/types/userConfig.ts | 1 + packages/ice/src/utils/generateEntry.ts | 24 +++++-- .../ice/templates/core/entry.server.ts.ejs | 3 +- packages/runtime/package.json | 3 +- packages/runtime/src/renderHTMLToJS.tsx | 25 +++++++- packages/runtime/src/runServerApp.tsx | 10 ++- packages/runtime/src/sourcemap.ts | 60 ++++++++++++++++++ packages/runtime/templates/js-entry.js.ejs | 4 +- pnpm-lock.yaml | 34 +++++++--- 26 files changed, 415 insertions(+), 20 deletions(-) create mode 100644 .changeset/perfect-bags-double.md create mode 100644 .changeset/strong-pumpkins-brake.md create mode 100644 examples/with-entry-type/.browserslistrc create mode 100644 examples/with-entry-type/ice.config.mts create mode 100644 examples/with-entry-type/package.json create mode 100644 examples/with-entry-type/public/favicon.ico create mode 100644 examples/with-entry-type/src/app.tsx create mode 100644 examples/with-entry-type/src/document.tsx create mode 100644 examples/with-entry-type/src/pages/Custom/index.tsx create mode 100644 examples/with-entry-type/src/pages/about.tsx create mode 100644 examples/with-entry-type/src/pages/blog.tsx create mode 100644 examples/with-entry-type/src/pages/home.tsx create mode 100644 examples/with-entry-type/src/pages/index.module.css create mode 100644 examples/with-entry-type/src/pages/layout.tsx create mode 100644 examples/with-entry-type/src/typings.d.ts create mode 100644 examples/with-entry-type/tsconfig.json create mode 100644 packages/runtime/src/sourcemap.ts diff --git a/.changeset/perfect-bags-double.md b/.changeset/perfect-bags-double.md new file mode 100644 index 0000000000..c51bfe3bef --- /dev/null +++ b/.changeset/perfect-bags-double.md @@ -0,0 +1,5 @@ +--- +'@ice/runtime': patch +--- + +feat: supprot sourmap for distType diff --git a/.changeset/strong-pumpkins-brake.md b/.changeset/strong-pumpkins-brake.md new file mode 100644 index 0000000000..69edee4b40 --- /dev/null +++ b/.changeset/strong-pumpkins-brake.md @@ -0,0 +1,6 @@ +--- +'@ice/runtime': patch +'@ice/app': patch +--- + +feat: supprot sourmap for distType diff --git a/examples/with-entry-type/.browserslistrc b/examples/with-entry-type/.browserslistrc new file mode 100644 index 0000000000..7637baddc3 --- /dev/null +++ b/examples/with-entry-type/.browserslistrc @@ -0,0 +1 @@ +chrome 55 \ No newline at end of file diff --git a/examples/with-entry-type/ice.config.mts b/examples/with-entry-type/ice.config.mts new file mode 100644 index 0000000000..080e40e660 --- /dev/null +++ b/examples/with-entry-type/ice.config.mts @@ -0,0 +1,18 @@ +import { defineConfig } from '@ice/app'; + +export default defineConfig({ + plugins: [], + server: { + onDemand: true, + format: 'esm', + }, + output: { + distType: 'javascript' + }, + sourceMap: true, + routes: { + defineRoutes: (route) => { + route('/custom', 'Custom/index.tsx'); + }, + }, +}); diff --git a/examples/with-entry-type/package.json b/examples/with-entry-type/package.json new file mode 100644 index 0000000000..808fe5503a --- /dev/null +++ b/examples/with-entry-type/package.json @@ -0,0 +1,24 @@ +{ + "name": "@examples/with-entry-type", + "private": true, + "version": "1.0.0", + "scripts": { + "start": "ice start", + "build": "ice build" + }, + "description": "", + "author": "", + "license": "MIT", + "dependencies": { + "@ice/app": "workspace:*", + "@ice/runtime": "workspace:*", + "react": "^18.0.0", + "react-dom": "^18.0.0" + }, + "devDependencies": { + "fs-extra": "^10.0.0", + "@types/react": "^18.0.0", + "@types/react-dom": "^18.0.2", + "webpack": "^5.73.0" + } +} diff --git a/examples/with-entry-type/public/favicon.ico b/examples/with-entry-type/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..a2605c57e9d85aabd689ff5c565286dee148ab6d GIT binary patch literal 2719 zcmbVO`8yMiA9svQv58DRxk@YN91}_`b4{U4xk7!C`zZN1)+bw`g+vn_YM5h6q=V&5 zY&mjF?i^!|S(r95*X&b&!uR`np7;CpJg?XDeqPV>{^^x+*4bW0T3K2|L_`MVVB`9m z^Z$&LFJVfVn*0@o`Uz6v;qRJkbcT zDz0Q12lTZ%`ghogFZaE+CzC-?b?9FC>?D|Pkd}eIbR7dOXL}DpS5J}aua3Bq7}H>3 z8Og;>eXE)t$2j*0A8+@``?d@C5+r!O_l|zaGtfJqEVzm*-TcP@xe{qr(<>BvWYfnOA_I+w&Y*YLR6D?M(%fv^^ylDNyqy>P1;<>wK^T+^*ewX1F*_vqxLT{VuTwPl_xOnH+!=f&y+_wjGs5N)( zIwZ0G zVGDjn#KgnB&u8q{TCQ(JV{CoGszvgBKP2U=F>)r@Dd4e=_(ruDP;4@M8F1kb3KIcNh8el;^6SjxPb7UgHpr7VfQ{=QKLXR9T}an41j9LX(*&x z-s#Okyn>i7`hll*yEa0SH(77uC0SJod(1wZCZLG$IX8 zgg3YePH-pHznZz=(oROkAeRf08LlBU$+*P0OW%>UC7k&8KMHpwmfDk`%76o_!Ai5Q zv)lzh<8xj&BbK%Y*OQ66ME|)KPtGM~9a&2KcW&o<8==OD`^n_3dOjy-R&Dl$5-+l* zJk2a{$R7I*qYCI3d|S*C82Dj`%fgc&G38RV+WC_$Yb{Uz={03hE-uD{=}iJUvPZc@ zt@}G;<>y$*@SltoJE~focFsZ_%Vbscb&wTfMg7u*ewX*sdAFmh*0k%&US4YBUcE7I zS*M!n8G80JPMI?e(Kh;8I!0u|uubOc~y^z<%yrpt0`9F!ItogT=I31$ZGr>Mw-+qHLv=|9sm zqSffY$EJ3d$F3s{wZ^iI$ORCwgCovV*z7IJR_1c20|(Pu``hy5BR9x; zj`h)HANSU`uiHrH1al^C++E+4k-F#40F8fOzDsC(0Xs_TfF_ULf!|_ydeL)|a1Jro z`}oH|*+3cJgt{U(L5hV1`U2z}RHY)-m_|6j3|=SDC%ammwfd@xib@hygHkVx9b`lO z?$3^18)@?D*+AOx0ZjHT`-U6{Gw5FzvfmkN3 z>iM1+Vy@*`o~eUlNbT~YRw;AfVZk*Rzhw{rfS>9?r{1t{Jz0+mb{haKPbYZv5|eNn z{VNt9&hCNNqdZGqsVPQ278pp2rceA9wQu#Hu@5G@9)y1mxhlAJgx^x41b|O)>(hC6 zxd+|P4EGtQlBdYei{4G+%Yjm*!k3gG4k^VNrm%6MB+4qxbr8fSZ)yPg8T}_ZJT+IP zPp>P*QW*+sNU72cez@>5*Y{~{N`ykK-2%RGGE`#c5`~cR(bxhgHm7@CaT!_8+Mjy; zHnG=2&MHd)7E?Cz8+Avg7#vT&{UEqr*A$6pnRzmfOtWn~ryvDmrNp@=;|j;Q`*Pf~ z0wA-DHO_2Rx{kE?x=eA}-pcZLRF1s-8H3LN$F?iILXGiax~+Tq(*AT!Z$j3GqT~QM zDJ`F4Bhc|j5w71Oqzj^ZTcN0e;k$t-6jDX82_cvM&yKe5hu z{TF*|*%zp_PJCQ=e=%NMFhSpL9&+)wS_~GOdp1WOv0%r%V44FAam3hgp7A%Eqw9j7 zIXBU3EgbRndo#+!1Zz8t$)d)OHLuyV&l1PAn?smen<&|-$OZu2@8QTn+MFr)m3y5- zfPE&Ulh$|uf)x((@(gCxmst)n0lNsHVHV1vQ#pvcm1a`CF zS@fp^M4vE;eKx|G*CXdsmp&Wt1mx%QJo>M(<&}@+-#Hn(j8=1Slj$Qe+2o-f9!SL> zEHKc%kW6BqCu-JR%k3tZRt?x>Bi-k>>pFEKlwy7na65EDm3*q_CZ5vQlsF&RSHHAk zHG23^LvvqA)%5Kw(48PmI=s$K?gnb-%=m$(j$Z$1A5lTUkx;d$vpI=C9~KSm?z_~c z#SXvKTSJ~$>E(6?fHXpHU_&wdoa3=(dgo@B&oO~(nr*w#-l#{yhr6ZiG zDK@Pu;rBB-zUnG5K`1`LFFgGPx93J zo=uIxw8w{%Ah89CE zG%Z{%x-c=Q%W~)VcuxU+8@pZ@!$84eF)sG~iycG%+E-hae$E0JnM{rKv6SObgAvd= zaAXfwR)*@t?uUq zrv8D1TZTqxkCAXZq(WAY7Ogs8eUtXYJ4IS4%)&D|9^+Qd3!h**T4=;BlDsFb@~YaS zs8Ks~*8$jS{|`e^1EWtdZ4QHH1}etRcJfqc7dId05z9J`2!%ttHP;`wI>YxHjW8Z1 ztxy7L7%x$L(!+>)q|FupVfw;o&5+IA4Oi_6Kadib+iKTi>Ozfzo9y&%QVVV literal 0 HcmV?d00001 diff --git a/examples/with-entry-type/src/app.tsx b/examples/with-entry-type/src/app.tsx new file mode 100644 index 0000000000..b84dfd61c1 --- /dev/null +++ b/examples/with-entry-type/src/app.tsx @@ -0,0 +1,3 @@ +import { defineAppConfig } from 'ice'; + +export default defineAppConfig(() => ({})); diff --git a/examples/with-entry-type/src/document.tsx b/examples/with-entry-type/src/document.tsx new file mode 100644 index 0000000000..fd149f08a5 --- /dev/null +++ b/examples/with-entry-type/src/document.tsx @@ -0,0 +1,42 @@ +import path from 'path'; +import { fileURLToPath } from 'url'; +import { Meta, Title, Links, Main, Scripts } from 'ice'; +import fse from 'fs-extra'; + +let dirname; +if (typeof __dirname === 'string') { + dirname = __dirname; +} else { + dirname = path.dirname(fileURLToPath(import.meta.url)); +} + +function Document() { + return ( + + + + + + + + <Links /> + </head> + <body> + <Main /> + <Scripts ScriptElement={(props) => { + if (props.src && !props.src.startsWith('http')) { + const filePath = path.join(dirname, `..${props.src}`); + const sourceMapFilePath = path.join(dirname, `..${props.src}.map`); + const res = fse.readFileSync(filePath, 'utf-8'); + return <script data-sourcemap={sourceMapFilePath} dangerouslySetInnerHTML={{ __html: res }} {...props} />; + } else { + return <script {...props} />; + } + }} + /> + </body> + </html> + ); +} + +export default Document; diff --git a/examples/with-entry-type/src/pages/Custom/index.tsx b/examples/with-entry-type/src/pages/Custom/index.tsx new file mode 100644 index 0000000000..164e24ed00 --- /dev/null +++ b/examples/with-entry-type/src/pages/Custom/index.tsx @@ -0,0 +1,19 @@ +import { Link, useData } from 'ice'; + +export default function Custom() { + const data = useData(); + + return ( + <> + <h2>Custom Page</h2> + <Link to="/home">home</Link> + {data} + </> + ); +} + +export function pageConfig() { + return { + title: 'Custom', + }; +} diff --git a/examples/with-entry-type/src/pages/about.tsx b/examples/with-entry-type/src/pages/about.tsx new file mode 100644 index 0000000000..b44b31a76d --- /dev/null +++ b/examples/with-entry-type/src/pages/about.tsx @@ -0,0 +1,30 @@ +import { Link } from 'ice'; + +export default function About() { + return ( + <> + <h2>About Page</h2> + <Link to="/">home</Link> + <span className="mark">new</span> + </> + ); +} + +export function pageConfig() { + return { + title: 'About', + meta: [ + { + name: 'theme-color', + content: '#eee', + }, + ], + links: [{ + href: 'https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css', + rel: 'stylesheet', + }], + scripts: [{ + src: 'https://cdn.jsdelivr.net/npm/lodash@2.4.1/dist/lodash.min.js', + }], + }; +} diff --git a/examples/with-entry-type/src/pages/blog.tsx b/examples/with-entry-type/src/pages/blog.tsx new file mode 100644 index 0000000000..4113cb37d1 --- /dev/null +++ b/examples/with-entry-type/src/pages/blog.tsx @@ -0,0 +1,21 @@ +import { Link, useData, useConfig } from 'ice'; + +export default function Blog() { + const data = useData(); + const config = useConfig(); + + console.log('render Blog', 'data', data, 'config', config); + + return ( + <> + <h2>Blog Page</h2> + <Link to="/home">home</Link> + </> + ); +} + +export function pageConfig() { + return { + title: 'Blog', + }; +} \ No newline at end of file diff --git a/examples/with-entry-type/src/pages/home.tsx b/examples/with-entry-type/src/pages/home.tsx new file mode 100644 index 0000000000..f5aaf1b72b --- /dev/null +++ b/examples/with-entry-type/src/pages/home.tsx @@ -0,0 +1,20 @@ +import { definePageConfig } from 'ice'; + +export default function Home() { + return ( + <> + <h2>Home Page</h2> + </> + ); +} + +export const pageConfig = definePageConfig(() => { + return { + queryParamsPassKeys: [ + 'questionId', + 'source', + 'disableNav', + ], + title: 'Home', + }; +}); diff --git a/examples/with-entry-type/src/pages/index.module.css b/examples/with-entry-type/src/pages/index.module.css new file mode 100644 index 0000000000..679273d44d --- /dev/null +++ b/examples/with-entry-type/src/pages/index.module.css @@ -0,0 +1,25 @@ +.title { + color: red; + margin-left: 10rpx; +} + +.data { + margin-top: 10px; +} + +.homeContainer { + align-items: center; + margin-top: 200rpx; +} + +.homeTitle { + font-size: 45rpx; + font-weight: bold; + margin: 20rpx 0; +} + +.homeInfo { + font-size: 36rpx; + margin: 8rpx 0; + color: #555; +} diff --git a/examples/with-entry-type/src/pages/layout.tsx b/examples/with-entry-type/src/pages/layout.tsx new file mode 100644 index 0000000000..24a21a39b6 --- /dev/null +++ b/examples/with-entry-type/src/pages/layout.tsx @@ -0,0 +1,22 @@ +import { Outlet } from 'ice'; + +export default () => { + return ( + <div> + <h1>ICE 3.0 Layout</h1> + <Outlet /> + </div> + ); +}; + +export function pageConfig() { + return { + title: 'Layout', + meta: [ + { + name: 'layout-color', + content: '#f00', + }, + ], + }; +} diff --git a/examples/with-entry-type/src/typings.d.ts b/examples/with-entry-type/src/typings.d.ts new file mode 100644 index 0000000000..1f6ba4ffa6 --- /dev/null +++ b/examples/with-entry-type/src/typings.d.ts @@ -0,0 +1 @@ +/// <reference types="@ice/app/types" /> diff --git a/examples/with-entry-type/tsconfig.json b/examples/with-entry-type/tsconfig.json new file mode 100644 index 0000000000..26fd9ec799 --- /dev/null +++ b/examples/with-entry-type/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/commands/build.ts b/packages/ice/src/commands/build.ts index 3ff313d4c0..e961b2892e 100644 --- a/packages/ice/src/commands/build.ts +++ b/packages/ice/src/commands/build.ts @@ -138,6 +138,7 @@ const build = async ( ssg, output: { distType, + prependCode, }, } = userConfig; let renderMode: RenderMode; @@ -159,6 +160,7 @@ const build = async ( renderMode, routeType: appConfig?.router?.type, distType, + prependCode, routeManifest, }); // This depends on orders. diff --git a/packages/ice/src/types/userConfig.ts b/packages/ice/src/types/userConfig.ts index 448d23f03d..0d566ee15b 100644 --- a/packages/ice/src/types/userConfig.ts +++ b/packages/ice/src/types/userConfig.ts @@ -35,6 +35,7 @@ interface Fetcher { export interface UserConfig { output?: { distType: Array<DistType> | DistType; + prependCode?: string; }; alias?: Record<string, string | false>; define?: Record<string, string | boolean>; diff --git a/packages/ice/src/utils/generateEntry.ts b/packages/ice/src/utils/generateEntry.ts index b1d347c01e..c009c0ffa7 100644 --- a/packages/ice/src/utils/generateEntry.ts +++ b/packages/ice/src/utils/generateEntry.ts @@ -14,6 +14,7 @@ interface Options { routeType: AppConfig['router']['type']; renderMode?: RenderMode; distType: UserConfig['output']['distType']; + prependCode: string; routeManifest: RouteManifest; } @@ -29,6 +30,7 @@ export default async function generateEntry(options: Options): Promise<EntryResu documentOnly, renderMode, routeType, + prependCode = '', routeManifest, } = options; @@ -50,7 +52,8 @@ export default async function generateEntry(options: Options): Promise<EntryResu const { htmlOutput, jsOutput, - } = await renderEntry({ routePath, serverEntry, documentOnly, renderMode, distType }); + sourceMap, + } = await renderEntry({ routePath, serverEntry, documentOnly, renderMode, distType, prependCode }); const generateOptions = { rootDir, routePath, outputDir }; if (htmlOutput) { const path = await generateFilePath({ ...generateOptions, type: 'html' }); @@ -61,6 +64,15 @@ export default async function generateEntry(options: Options): Promise<EntryResu outputPaths.push(path); } + if (sourceMap) { + const path = await generateFilePath({ ...generateOptions, type: 'js.map' }); + await writeFile( + path, + sourceMap, + ); + outputPaths.push(path); + } + if (jsOutput) { const path = await generateFilePath({ ...generateOptions, type: 'js' }); await writeFile( @@ -81,7 +93,7 @@ const writeFile = async (file: string, content: string) => { await fse.writeFile(file, content); }; -function formatFilePath(routePath: string, type: 'js' | 'html'): string { +function formatFilePath(routePath: string, type: 'js' | 'html' | 'js.map'): string { // Win32 do not support file name start with ':' and '*'. return routePath === '/' ? `index.${type}` : `${routePath.replace(/\/(:|\*)/g, '/$')}.${type}`; } @@ -96,7 +108,7 @@ async function generateFilePath( rootDir: string; routePath: string; outputDir: string; - type: 'js' | 'html'; + type: 'js' | 'html' | 'js.map' ; }, ) { const fileName = formatFilePath(routePath, type); @@ -113,6 +125,7 @@ async function renderEntry( serverEntry, documentOnly, distType = ['html'], + prependCode = '', renderMode, }: { routePath: string; @@ -120,6 +133,7 @@ async function renderEntry( documentOnly: boolean; distType?: DistType; renderMode?: RenderMode; + prependCode?: string; }, ) { const serverContext: ServerContext = { @@ -130,20 +144,22 @@ async function renderEntry( // renderToEntry exported when disType includes javascript . const render = distType.includes('javascript') ? serverEntry.renderToEntry : serverEntry.renderToHTML; - const { value, jsOutput, + sourceMap, } = await render(serverContext, { renderMode, documentOnly, routePath, serverOnlyBasename: '/', distType, + prependCode, }); return { htmlOutput: value, jsOutput, + sourceMap, }; } diff --git a/packages/ice/templates/core/entry.server.ts.ejs b/packages/ice/templates/core/entry.server.ts.ejs index 24d0ac86f5..746a85fe28 100644 --- a/packages/ice/templates/core/entry.server.ts.ejs +++ b/packages/ice/templates/core/entry.server.ts.ejs @@ -71,7 +71,7 @@ export async function renderToEntry(requestContext, options: RenderOptions = {}) <% } -%> function mergeOptions(options) { - const { documentOnly, renderMode = 'SSR', basename, serverOnlyBasename, routePath, disableFallback, distType, serverData, publicPath } = options; + const { documentOnly, renderMode = 'SSR', basename, serverOnlyBasename, routePath, disableFallback, distType, prependCode, serverData, publicPath } = options; if (publicPath) { assetsManifest.publicPath = publicPath; @@ -91,6 +91,7 @@ function mergeOptions(options) { disableFallback, routesConfig, distType, + prependCode, serverData, runtimeOptions: { <% if (runtimeOptions.exports) { -%> diff --git a/packages/runtime/package.json b/packages/runtime/package.json index c78b3dc298..caa6d86360 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -51,7 +51,8 @@ "history": "^5.3.0", "htmlparser2": "^8.0.1", "react-router-dom": "6.11.1", - "semver": "^7.4.0" + "semver": "^7.4.0", + "source-map": "^0.7.4" }, "peerDependencies": { "react": "^18.1.0", diff --git a/packages/runtime/src/renderHTMLToJS.tsx b/packages/runtime/src/renderHTMLToJS.tsx index 43932fec9d..8e35e18260 100644 --- a/packages/runtime/src/renderHTMLToJS.tsx +++ b/packages/runtime/src/renderHTMLToJS.tsx @@ -4,6 +4,7 @@ import * as htmlparser2 from 'htmlparser2'; import ejs from 'ejs'; import fse from 'fs-extra'; import __createElement from './domRender.js'; +import { generateSourceMap } from './sourcemap.js'; let dirname; if (typeof __dirname === 'string') { @@ -12,9 +13,16 @@ if (typeof __dirname === 'string') { dirname = path.dirname(fileURLToPath(import.meta.url)); } -export function renderHTMLToJS(html) { +export async function renderHTMLToJS(html, { + prependCode = '', +}) { let jsOutput = ''; const dom = htmlparser2.parseDocument(html); + const sourceMapInfo = { + sourceMapFileList: [], + extraLine: prependCode.split('\n').length, + extraColumn: 0, + }; let headElement; let bodyElement; @@ -47,6 +55,12 @@ export function renderHTMLToJS(html) { if (children) { if (name === 'script' && children[0] && children[0].data) { extraScript.push(`(function(){${children[0].data}})();`); + // The path of sourcemap file. + if (attribs['data-sourcemap']) { + sourceMapInfo.sourceMapFileList.push(attribs['data-sourcemap']); + } + + delete attribs['data-sourcemap']; } else { resChildren = node.children.map(parse); } @@ -69,7 +83,14 @@ export function renderHTMLToJS(html) { head, body, extraScript, + prependCode, }); - return jsOutput; + // Generate sourcemap for entry js. + const sourceMap = await generateSourceMap(sourceMapInfo); + + return { + jsOutput, + sourceMap, + }; } \ No newline at end of file diff --git a/packages/runtime/src/runServerApp.tsx b/packages/runtime/src/runServerApp.tsx index a82342b1f7..810e3eae67 100644 --- a/packages/runtime/src/runServerApp.tsx +++ b/packages/runtime/src/runServerApp.tsx @@ -49,6 +49,7 @@ interface RenderOptions { }; runtimeOptions?: Record<string, any>; distType?: Array<'html' | 'javascript'>; + prependCode?: string; serverData?: any; } @@ -74,11 +75,17 @@ export async function renderToEntry( const { value } = result; let jsOutput; + let sourceMap; const { distType = ['html'], + prependCode = '', } = renderOptions; if (value && distType.includes('javascript')) { - jsOutput = await renderHTMLToJS(value); + const res = await renderHTMLToJS(value, { + prependCode, + }); + jsOutput = res.jsOutput; + sourceMap = res.sourceMap; } let htmlOutput; @@ -89,6 +96,7 @@ export async function renderToEntry( return { ...htmlOutput, jsOutput, + sourceMap, }; } diff --git a/packages/runtime/src/sourcemap.ts b/packages/runtime/src/sourcemap.ts new file mode 100644 index 0000000000..7e830e1ff8 --- /dev/null +++ b/packages/runtime/src/sourcemap.ts @@ -0,0 +1,60 @@ +import fse from 'fs-extra'; +import { SourceMapConsumer, SourceMapGenerator } from 'source-map'; + +// Starting with extra script, it's a fixed line. +const BASE_LINE = 28; +// Starting with end of '(function(){', it's a fixed column. +const BASE_COLUMN = 12; + +export async function generateSourceMap({ + sourceMapFileList = [], + extraLine = 0, + extraColumn = 0, +}) { + if (!sourceMapFileList.length) { + return ''; + } + + const generator = new SourceMapGenerator({ + file: '', + sourceRoot: '', + }); + + await Promise.all(sourceMapFileList.map((sourceMapFile, fileIndex) => { + return new Promise((resolve) => { + if (!fse.existsSync(sourceMapFile)) { + resolve(true); + } + + const content = fse.readFileSync(sourceMapFile, 'utf-8'); + SourceMapConsumer.with(content, null, consumer => { + // Set content by source. + consumer.sources.forEach((source) => { + generator.setSourceContent(source, consumer.sourceContentFor(source)); + }); + + // Get each map from script,and set it to new map. + consumer.eachMapping((mapping) => { + if (!mapping.name) return; + + generator.addMapping({ + generated: { + line: mapping.generatedLine + BASE_LINE + extraLine + fileIndex * 2, + column: mapping.generatedColumn + BASE_COLUMN + extraColumn, + }, + original: { + line: mapping.originalLine, + column: mapping.originalColumn, + }, + source: mapping.source, + name: mapping.name, + }); + }); + + resolve(true); + }); + }); + })); + + return generator.toString(); +} \ No newline at end of file diff --git a/packages/runtime/templates/js-entry.js.ejs b/packages/runtime/templates/js-entry.js.ejs index c6cd25f9e2..6accc3208a 100644 --- a/packages/runtime/templates/js-entry.js.ejs +++ b/packages/runtime/templates/js-entry.js.ejs @@ -1,19 +1,17 @@ +<%- prependCode %> (function () { <%- createElement %> - <% if (head && head.children) {-%> <%- JSON.stringify(head.children) %>.forEach(ele => { __ICE__CREATE_ELEMENT(ele, document.head); }); <% } -%> - <% if (body && body.children) {-%> <%- JSON.stringify(body.children) %>.forEach(ele => { __ICE__CREATE_ELEMENT(ele, document.body); }); <% } -%> })(); - <% if (extraScript) {-%> <% extraScript.forEach((script, index) => { -%> <%- script %> diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6aa413bb43..81fa36dd13 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -551,6 +551,27 @@ importers: '@types/react': 18.0.28 '@types/react-dom': 18.0.11 + examples/with-entry-type: + specifiers: + '@ice/app': workspace:* + '@ice/runtime': workspace:* + '@types/react': ^18.0.0 + '@types/react-dom': ^18.0.2 + fs-extra: ^10.0.0 + react: ^18.0.0 + react-dom: ^18.0.0 + webpack: ^5.73.0 + dependencies: + '@ice/app': link:../../packages/ice + '@ice/runtime': link:../../packages/runtime + react: 18.2.0 + react-dom: 18.2.0_react@18.2.0 + devDependencies: + '@types/react': 18.0.34 + '@types/react-dom': 18.0.11 + fs-extra: 10.1.0 + webpack: 5.80.0 + examples/with-fusion: specifiers: '@alifd/next': ^1.25.49 @@ -1498,6 +1519,7 @@ importers: react-router-dom: 6.11.1 regenerator-runtime: ^0.13.9 semver: ^7.4.0 + source-map: ^0.7.4 dependencies: '@ice/jsx-runtime': link:../jsx-runtime '@remix-run/router': 1.6.1 @@ -1507,6 +1529,7 @@ importers: htmlparser2: 8.0.1 react-router-dom: 6.11.1_biqbaboplfbrettd7655fr4n2y semver: 7.4.0 + source-map: 0.7.4 devDependencies: '@remix-run/web-fetch': 4.3.3 '@types/react': 18.0.28 @@ -9627,8 +9650,8 @@ packages: engines: {node: '>=10'} hasBin: true dependencies: - JSONStream: 1.3.5 is-text-path: 1.0.1 + JSONStream: 1.3.5 lodash: 4.17.21 meow: 8.1.2 split2: 3.2.2 @@ -18629,12 +18652,6 @@ packages: /react-dev-utils/12.0.1_lj5zgxrzaejsnoobor62tojvse: resolution: {integrity: sha512-84Ivxmr17KjUupyqzFode6xKhjwuEJDROWKJy/BthkL7Wn6NJ8h4WE6k/exAv6ImS+0oZLRRW5j/aINMHyeGeQ==} engines: {node: '>=14'} - peerDependencies: - typescript: '>=2.7' - webpack: '>=4' - peerDependenciesMeta: - typescript: - optional: true dependencies: '@babel/code-frame': 7.18.6 address: 1.2.2 @@ -18665,7 +18682,9 @@ packages: transitivePeerDependencies: - eslint - supports-color + - typescript - vue-template-compiler + - webpack /react-dom/17.0.2_react@17.0.2: resolution: {integrity: sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==} @@ -19923,7 +19942,6 @@ packages: /source-map/0.7.4: resolution: {integrity: sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==} engines: {node: '>= 8'} - dev: true /source-map/0.8.0-beta.0: resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} From ab139accf0cf8ce4b9c4e0861049f1a789242452 Mon Sep 17 00:00:00 2001 From: ClarkXia <xiawenwu41@gmail.com> Date: Thu, 18 May 2023 15:06:08 +0800 Subject: [PATCH 3/8] fix: use api history to navigate (#6251) * fix: use api history to navigate * fix: params --- .changeset/sharp-pumas-poke.md | 5 +++++ packages/runtime/src/runClientApp.tsx | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/sharp-pumas-poke.md diff --git a/.changeset/sharp-pumas-poke.md b/.changeset/sharp-pumas-poke.md new file mode 100644 index 0000000000..a4320a88a7 --- /dev/null +++ b/.changeset/sharp-pumas-poke.md @@ -0,0 +1,5 @@ +--- +'@ice/runtime': patch +--- + +fix: add v5Compat for use history to navigate diff --git a/packages/runtime/src/runClientApp.tsx b/packages/runtime/src/runClientApp.tsx index 87e3eb8299..30f4c73ace 100644 --- a/packages/runtime/src/runClientApp.tsx +++ b/packages/runtime/src/runClientApp.tsx @@ -215,10 +215,10 @@ function createHistory( const createHistory = process.env.ICE_CORE_ROUTER === 'true' ? createRouterHistory(appConfig?.router?.type, memoryRouter) : createHistorySingle; - let createHistoryOptions: Parameters<typeof createHistory>[0] = { window }; + let createHistoryOptions: Parameters<typeof createHistory>[0] = { window, v5Compat: true }; if (routerType === 'memory') { - const memoryOptions: Parameters<typeof createMemoryHistory>[0] = {}; + const memoryOptions: Parameters<typeof createMemoryHistory>[0] = { v5Compat: true }; memoryOptions.initialEntries = appConfig?.router?.initialEntries || getRoutesPath(routes); if (initialEntry) { const initialIndex = memoryOptions.initialEntries.findIndex((entry) => From a6633a6a7c64ff707d6c730119c1006c5c84805a Mon Sep 17 00:00:00 2001 From: ClarkXia <xiawenwu41@gmail.com> Date: Thu, 18 May 2023 17:45:19 +0800 Subject: [PATCH 4/8] feat: support api of addEntryImportAhead (#6256) * feat: support api of addEntryImportAhead * fix: ts type --- packages/ice/src/createService.ts | 6 ++++ packages/ice/src/service/runtimeGenerator.ts | 28 +++++++++++-------- packages/ice/src/types/generator.ts | 2 +- packages/ice/src/types/plugin.ts | 2 ++ .../ice/templates/core/entry.client.tsx.ejs | 1 + packages/webpack-config/src/types.ts | 2 +- .../src/unPlugins/redirectImport.ts | 2 +- pnpm-lock.yaml | 2 +- 8 files changed, 29 insertions(+), 16 deletions(-) diff --git a/packages/ice/src/createService.ts b/packages/ice/src/createService.ts index 79e78aefe3..5fa2210709 100644 --- a/packages/ice/src/createService.ts +++ b/packages/ice/src/createService.ts @@ -108,6 +108,12 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt addEntryCode: (callback: (originalCode: string) => string) => { entryCode = callback(entryCode); }, + addEntryImportAhead: (declarationData: Pick<DeclarationData, 'source'>) => { + generator.addDeclaration('entry', { + ...declarationData, + declarationType: DeclarationType.NORMAL, + }); + }, modifyRenderData: generator.modifyRenderData, addDataLoaderImport: (declarationData: DeclarationData) => { generator.addDeclaration('dataLoaderImport', { diff --git a/packages/ice/src/service/runtimeGenerator.ts b/packages/ice/src/service/runtimeGenerator.ts index a8af3ace67..837a892204 100644 --- a/packages/ice/src/service/runtimeGenerator.ts +++ b/packages/ice/src/service/runtimeGenerator.ts @@ -85,17 +85,21 @@ export function generateDeclaration(exportList: Array<TargetDeclarationData | De const specifiers = isDefaultImport ? [specifier] : specifier; const symbol = type ? ';' : ','; - importDeclarations.push(`import ${type ? 'type ' : ''}${isDefaultImport ? specifier : `{ ${specifiers.map(specifierStr => ((alias && alias[specifierStr]) ? `${specifierStr} as ${alias[specifierStr]}` : specifierStr)).join(', ')} }`} from '${source}';`); - - specifiers.forEach((specifierStr) => { - if (alias && alias[specifierStr]) { - exportDeclarations.push(`${alias[specifierStr]}: ${specifierStr}${symbol}`); - exportNames.push(alias[specifierStr]); - } else { - exportDeclarations.push(`${specifierStr}${symbol}`); - exportNames.push(specifierStr); - } - }); + if (specifier) { + importDeclarations.push(`import ${type ? 'type ' : ''}${isDefaultImport ? specifier : `{ ${specifiers.map(specifierStr => ((alias && alias[specifierStr]) ? `${specifierStr} as ${alias[specifierStr]}` : specifierStr)).join(', ')} }`} from '${source}';`); + + specifiers.forEach((specifierStr) => { + if (alias && alias[specifierStr]) { + exportDeclarations.push(`${alias[specifierStr]}: ${specifierStr}${symbol}`); + exportNames.push(alias[specifierStr]); + } else { + exportDeclarations.push(`${specifierStr}${symbol}`); + exportNames.push(specifierStr); + } + }); + } else { + importDeclarations.push(`import '${source}';`); + } } }); @@ -187,7 +191,7 @@ export default class Generator { this.rerender = false; this.renderTemplates = []; this.renderDataRegistration = []; - this.contentTypes = ['framework', 'frameworkTypes', 'routeConfigTypes', 'dataLoaderImport', 'runtimeOptions']; + this.contentTypes = ['framework', 'frameworkTypes', 'routeConfigTypes', 'dataLoaderImport', 'runtimeOptions', 'entry']; // empty .ice before render fse.emptyDirSync(path.join(rootDir, targetDir)); // add initial templates diff --git a/packages/ice/src/types/generator.ts b/packages/ice/src/types/generator.ts index b1df8877d5..41ae88d903 100644 --- a/packages/ice/src/types/generator.ts +++ b/packages/ice/src/types/generator.ts @@ -4,7 +4,7 @@ export enum DeclarationType { } export interface DeclarationData { - specifier: string | string[]; + specifier?: string | string[]; source: string; type?: boolean; alias?: Record<string, string>; diff --git a/packages/ice/src/types/plugin.ts b/packages/ice/src/types/plugin.ts index 249bdd18d8..082e5f1634 100644 --- a/packages/ice/src/types/plugin.ts +++ b/packages/ice/src/types/plugin.ts @@ -14,6 +14,7 @@ export type { CreateLoggerReturnType } from '../utils/logger.js'; type AddExport = (exportData: DeclarationData) => void; type AddTargetExport = (exportData: TargetDeclarationData) => void; type AddEntryCode = (callback: (code: string) => string) => void; +type AddEntryImportAhead = (exportData: Pick<DeclarationData, 'source'>) => void; type RemoveExport = (removeSource: string | string[]) => void; type EventName = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'; type GetExportList = (key: string, target?: string) => (DeclarationData | TargetDeclarationData)[]; @@ -146,6 +147,7 @@ export interface ExtendsPluginAPI { render: Render; addDataLoaderImport: AddDataLoaderImport; addEntryCode: AddEntryCode; + addEntryImportAhead: AddEntryImportAhead; getExportList: GetExportList; }; watch: { diff --git a/packages/ice/templates/core/entry.client.tsx.ejs b/packages/ice/templates/core/entry.client.tsx.ejs index 18cd0ff59f..430b860238 100644 --- a/packages/ice/templates/core/entry.client.tsx.ejs +++ b/packages/ice/templates/core/entry.client.tsx.ejs @@ -1,4 +1,5 @@ <% if (importCoreJs) { -%>import 'core-js';<% } %> +<%- entry.imports %> import { createElement, Fragment } from 'react'; import { runClientApp, getAppConfig } from '<%- iceRuntimePath %>'; import { commons, statics } from './runtimeModules'; diff --git a/packages/webpack-config/src/types.ts b/packages/webpack-config/src/types.ts index 8acf2369f2..3b04dfa776 100644 --- a/packages/webpack-config/src/types.ts +++ b/packages/webpack-config/src/types.ts @@ -44,7 +44,7 @@ interface SwcOptions { } interface ImportDeclaration { - specifier: string | string[]; + specifier?: string | string[]; source: string; type?: boolean; alias?: Record<string, string>; diff --git a/packages/webpack-config/src/unPlugins/redirectImport.ts b/packages/webpack-config/src/unPlugins/redirectImport.ts index ad54a07017..c353051ad5 100644 --- a/packages/webpack-config/src/unPlugins/redirectImport.ts +++ b/packages/webpack-config/src/unPlugins/redirectImport.ts @@ -7,7 +7,7 @@ import { createFilter } from '@rollup/pluginutils'; import type { Config } from '../types.js'; interface DeclarationData { - specifier: string | string[]; + specifier?: string | string[]; source: string; type?: boolean; alias?: Record<string, string>; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 81fa36dd13..1fe6a7f570 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9650,8 +9650,8 @@ packages: engines: {node: '>=10'} hasBin: true dependencies: - is-text-path: 1.0.1 JSONStream: 1.3.5 + is-text-path: 1.0.1 lodash: 4.17.21 meow: 8.1.2 split2: 3.2.2 From 45cb1c779dbe88805a3bcc7dcce538108b0cc328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B0=B4=E6=BE=9C?= <shuilan.cj@taobao.com> Date: Thu, 18 May 2023 17:59:16 +0800 Subject: [PATCH 5/8] fix: jsx comment (#6239) * fix: jsx comment * chore: add changelog * fix: set source with jsx comment to classic mode * fix: jsx pragma --- .changeset/plenty-rings-hammer.md | 5 +++++ examples/rax-inline-style/src/document.tsx | 1 - packages/plugin-rax-compat/src/index.ts | 25 +++++++++++----------- 3 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 .changeset/plenty-rings-hammer.md diff --git a/.changeset/plenty-rings-hammer.md b/.changeset/plenty-rings-hammer.md new file mode 100644 index 0000000000..8d97f6e17f --- /dev/null +++ b/.changeset/plenty-rings-hammer.md @@ -0,0 +1,5 @@ +--- +'@ice/plugin-rax-compat': patch +--- + +fix: auto add jsx comment diff --git a/examples/rax-inline-style/src/document.tsx b/examples/rax-inline-style/src/document.tsx index e00dde40f2..ca56e07604 100644 --- a/examples/rax-inline-style/src/document.tsx +++ b/examples/rax-inline-style/src/document.tsx @@ -1,4 +1,3 @@ -/* @jsx createElement */ import { Meta, Title, Links, Main, Scripts } from 'ice'; function Document() { diff --git a/packages/plugin-rax-compat/src/index.ts b/packages/plugin-rax-compat/src/index.ts index bff5dd60bd..c17748f443 100644 --- a/packages/plugin-rax-compat/src/index.ts +++ b/packages/plugin-rax-compat/src/index.ts @@ -69,20 +69,21 @@ const plugin: Plugin<CompatRaxOptions> = (options = {}) => ({ // Reset jsc.transform.react.runtime to classic. config.swcOptions = merge(config.swcOptions || {}, { compilationConfig: (source: string) => { - const isRaxComponent = /from\s['"]rax['"]/.test(source); - if (isRaxComponent) { - const hasJSXComment = source.indexOf('@jsx createElement') !== -1; - if (hasJSXComment) { - return { - jsc: { - transform: { - react: { - runtime: 'classic', - }, + const hasJSXComment = source.indexOf('@jsx createElement') !== -1; + if (hasJSXComment) { + return { + jsc: { + transform: { + react: { + runtime: 'classic', }, }, - }; - } + }, + }; + } + + const isRaxComponent = /(from|require\()\s*['"]rax['"]/.test(source); + if (isRaxComponent) { return { jsc: { transform: { From 989e25010495c117d0bfb815aae626e8369d3933 Mon Sep 17 00:00:00 2001 From: ClarkXia <xiawenwu41@gmail.com> Date: Fri, 19 May 2023 10:02:10 +0800 Subject: [PATCH 6/8] fix: compatible with hmr when data get undefined (#6259) --- .changeset/giant-badgers-divide.md | 5 +++++ packages/runtime/src/RouteContext.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/giant-badgers-divide.md diff --git a/.changeset/giant-badgers-divide.md b/.changeset/giant-badgers-divide.md new file mode 100644 index 0000000000..ce083cdecd --- /dev/null +++ b/.changeset/giant-badgers-divide.md @@ -0,0 +1,5 @@ +--- +'@ice/runtime': patch +--- + +fix: compatible with hmr when data get undefined diff --git a/packages/runtime/src/RouteContext.ts b/packages/runtime/src/RouteContext.ts index 9ddd8948f3..2e422c6b7e 100644 --- a/packages/runtime/src/RouteContext.ts +++ b/packages/runtime/src/RouteContext.ts @@ -3,12 +3,12 @@ import type { RouteConfig } from './types.js'; function useData<T = any>(): T { const data = useLoaderData(); - return (data as any).data; + return (data as any)?.data; } function useConfig<T = {}>(): RouteConfig<T> { const data = useLoaderData(); - return (data as any).pageConfig; + return (data as any)?.pageConfig; } export { From 6e639dfe0c38211693f95e41ed8871fd0468e738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B0=B4=E6=BE=9C?= <shuilan.cj@taobao.com> Date: Fri, 19 May 2023 11:08:25 +0800 Subject: [PATCH 7/8] fix: use data (#6254) * fix: use data * fix: test * chore: changeset * fix: test * chore: update lock --- .changeset/sour-windows-draw.md | 5 +++++ packages/runtime/src/dataLoader.ts | 3 +++ packages/runtime/src/routes.tsx | 7 ++++--- packages/runtime/tests/routes.test.tsx | 5 +++++ pnpm-lock.yaml | 19 ++++++++++++++++++- 5 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 .changeset/sour-windows-draw.md diff --git a/.changeset/sour-windows-draw.md b/.changeset/sour-windows-draw.md new file mode 100644 index 0000000000..e3659b65ab --- /dev/null +++ b/.changeset/sour-windows-draw.md @@ -0,0 +1,5 @@ +--- +'@ice/runtime': patch +--- + +fix: get data loader with code remove diff --git a/packages/runtime/src/dataLoader.ts b/packages/runtime/src/dataLoader.ts index 8d797cebc1..6981173e3c 100644 --- a/packages/runtime/src/dataLoader.ts +++ b/packages/runtime/src/dataLoader.ts @@ -240,6 +240,9 @@ async function init(loaders: Loaders, options: Options) { } (window as any).__ICE_DATA_LOADER__ = { + getLoader: (id) => { + return loaders[id]; + }, getData: (id, options: LoadRoutesDataOptions) => { let result; diff --git a/packages/runtime/src/routes.tsx b/packages/runtime/src/routes.tsx index 5369c67d8c..94b93f7a50 100644 --- a/packages/runtime/src/routes.tsx +++ b/packages/runtime/src/routes.tsx @@ -125,9 +125,12 @@ type LoaderFunction = () => LoaderData | UNSAFE_DeferredData | Promise<LoaderDat export function createRouteLoader(options: RouteLoaderOptions): LoaderFunction { const { dataLoader, pageConfig, staticDataLoader, serverDataLoader } = options.module; const { requestContext, renderMode, routeId } = options; + const globalLoader = (typeof window !== 'undefined' && (window as any).__ICE_DATA_LOADER__) ? (window as any).__ICE_DATA_LOADER__ : null; let dataLoaderConfig: DataLoaderConfig; - if (renderMode === 'SSG') { + if (globalLoader) { + dataLoaderConfig = globalLoader.getLoader(routeId); + } else if (renderMode === 'SSG') { dataLoaderConfig = staticDataLoader; } else if (renderMode === 'SSR') { dataLoaderConfig = serverDataLoader || dataLoader; @@ -155,8 +158,6 @@ export function createRouteLoader(options: RouteLoaderOptions): LoaderFunction { } const getData = () => { - const hasGlobalLoader = typeof window !== 'undefined' && (window as any).__ICE_DATA_LOADER__; - const globalLoader = hasGlobalLoader ? (window as any).__ICE_DATA_LOADER__ : null; let routeData: any; if (globalLoader) { routeData = globalLoader.getData(routeId, { renderMode }); diff --git a/packages/runtime/tests/routes.test.tsx b/packages/runtime/tests/routes.test.tsx index abcde3b6d6..e048d5a5ce 100644 --- a/packages/runtime/tests/routes.test.tsx +++ b/packages/runtime/tests/routes.test.tsx @@ -219,6 +219,11 @@ describe('routes', () => { windowSpy.mockImplementation(() => ({ __ICE_DATA_LOADER__: { getData: async (id) => ({ id: `${id}_data` }), + getLoader: () => { + return { + loader: () => {}, + }; + }, }, })); const routesDataCSR = await createRouteLoader({ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1fe6a7f570..c80793a5ea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7485,6 +7485,7 @@ packages: '@types/prop-types': 15.7.5 '@types/scheduler': 0.16.2 csstype: 3.1.1 + dev: true /@types/react/18.0.28: resolution: {integrity: sha512-RD0ivG1kEztNBdoAK7lekI9M+azSnitIn85h4iOiaLjaTrMjzslhaqCGaI4IyCJ1RljWiLCEu4jyrLLgqxBTew==} @@ -9650,8 +9651,8 @@ packages: engines: {node: '>=10'} hasBin: true dependencies: - JSONStream: 1.3.5 is-text-path: 1.0.1 + JSONStream: 1.3.5 lodash: 4.17.21 meow: 8.1.2 split2: 3.2.2 @@ -9681,6 +9682,7 @@ packages: resolution: {integrity: sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==} dependencies: is-what: 3.14.1 + dev: false /copy-text-to-clipboard/3.0.1: resolution: {integrity: sha512-rvVsHrpFcL4F2P8ihsoLdFHmd404+CMg71S756oRSeQgqk51U3kicGdnvfkrxva0xXH92SjGS62B0XIJsbh+9Q==} @@ -10780,6 +10782,7 @@ packages: requiresBuild: true dependencies: prr: 1.0.1 + dev: false optional: true /error-ex/1.3.2: @@ -13093,6 +13096,7 @@ packages: engines: {node: '>=0.10.0'} hasBin: true requiresBuild: true + dev: false optional: true /image-size/1.0.2: @@ -13617,6 +13621,7 @@ packages: /is-what/3.14.1: resolution: {integrity: sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==} + dev: false /is-whitespace-character/1.0.4: resolution: {integrity: sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==} @@ -14898,6 +14903,7 @@ packages: source-map: 0.6.1 transitivePeerDependencies: - supports-color + dev: false /leven/3.1.0: resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} @@ -15196,6 +15202,7 @@ packages: dependencies: pify: 4.0.1 semver: 5.7.1 + dev: false optional: true /make-dir/3.1.0: @@ -15582,6 +15589,7 @@ packages: sax: 1.2.4 transitivePeerDependencies: - supports-color + dev: false optional: true /negotiator/0.6.3: @@ -16034,6 +16042,7 @@ packages: /parse-node-version/1.0.1: resolution: {integrity: sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==} engines: {node: '>= 0.10'} + dev: false /parse-numeric-range/1.3.0: resolution: {integrity: sha512-twN+njEipszzlMJd4ONUYgSfZPDxgHhT9Ahed5uTigpQn90FggW4SA/AIPq/6a149fTbE9qBEcSwE3FAEp6wQQ==} @@ -17365,6 +17374,7 @@ packages: nanoid: 3.3.4 picocolors: 1.0.0 source-map-js: 1.0.2 + dev: false /postcss/8.4.21: resolution: {integrity: sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==} @@ -17518,6 +17528,7 @@ packages: /prr/1.0.1: resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==} + dev: false optional: true /pseudomap/1.0.2: @@ -18695,6 +18706,7 @@ packages: object-assign: 4.1.1 react: 17.0.2 scheduler: 0.20.2 + dev: false /react-dom/18.2.0_react@18.2.0: resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} @@ -18830,6 +18842,7 @@ packages: /react-refresh/0.14.0: resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==} engines: {node: '>=0.10.0'} + dev: false /react-router-config/5.1.1_2dl5roaqnyqqppnjni7uetnb3a: resolution: {integrity: sha512-DuanZjaD8mQp1ppHjgnnUnyOlqYXZVjnov/JzFhjLEwd3Z4dYjMSnqrEzzGThH47vpCOqPPwJM2FtthLeJ8Pbg==} @@ -18927,6 +18940,7 @@ packages: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 + dev: false /react/18.2.0: resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} @@ -19558,6 +19572,7 @@ packages: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 + dev: false /scheduler/0.21.0: resolution: {integrity: sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ==} @@ -20643,6 +20658,7 @@ packages: serialize-javascript: 6.0.1 terser: 5.16.5 webpack: 5.80.0_w34or7orauknzckzea4nxxqrru + dev: true /terser-webpack-plugin/5.3.7_qo4emlfatbstozv5cog53p7ftu: resolution: {integrity: sha512-AfKwIktyP7Cu50xNjXF/6Qb5lBNzYaWpU6YfoX3uZicTx0zTy0stDDCsvjDapKsSDvOeWo5MEq4TmdBy2cNoHw==} @@ -22209,6 +22225,7 @@ packages: - '@swc/core' - esbuild - uglify-js + dev: true /webpackbar/5.0.2_webpack@5.80.0: resolution: {integrity: sha512-BmFJo7veBDgQzfWXl/wwYXr/VFus0614qZ8i9znqcl9fnEdiVkdbi0TedLQ6xAK92HZHDJ0QmyQ0fmuZPAgCYQ==} From 542d86c75abacb39ca14e931427b4e757f205312 Mon Sep 17 00:00:00 2001 From: ClarkXia <xiawenwu41@gmail.com> Date: Tue, 23 May 2023 16:04:53 +0800 Subject: [PATCH 8/8] chore: update versions (#6250) * chore: update versions * Update CHANGELOG.md --- .changeset/dull-hounds-hunt.md | 5 ---- .changeset/giant-badgers-divide.md | 5 ---- .changeset/perfect-bags-double.md | 5 ---- .changeset/plenty-rings-hammer.md | 5 ---- .changeset/sharp-pumas-poke.md | 5 ---- .changeset/sour-windows-draw.md | 5 ---- .changeset/strong-pumpkins-brake.md | 6 ----- packages/ice/CHANGELOG.md | 9 +++++++ packages/ice/package.json | 4 ++-- packages/plugin-i18n/package.json | 4 ++-- packages/plugin-rax-compat/CHANGELOG.md | 6 +++++ packages/plugin-rax-compat/package.json | 4 ++-- packages/plugin-store/CHANGELOG.md | 6 +++++ packages/plugin-store/package.json | 2 +- packages/runtime/CHANGELOG.md | 10 ++++++++ packages/runtime/package.json | 2 +- pnpm-lock.yaml | 31 +++++++------------------ 17 files changed, 48 insertions(+), 66 deletions(-) delete mode 100644 .changeset/dull-hounds-hunt.md delete mode 100644 .changeset/giant-badgers-divide.md delete mode 100644 .changeset/perfect-bags-double.md delete mode 100644 .changeset/plenty-rings-hammer.md delete mode 100644 .changeset/sharp-pumas-poke.md delete mode 100644 .changeset/sour-windows-draw.md delete mode 100644 .changeset/strong-pumpkins-brake.md diff --git a/.changeset/dull-hounds-hunt.md b/.changeset/dull-hounds-hunt.md deleted file mode 100644 index 6384a55f82..0000000000 --- a/.changeset/dull-hounds-hunt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@ice/plugin-store': patch ---- - -fix: import store source before swc compiler diff --git a/.changeset/giant-badgers-divide.md b/.changeset/giant-badgers-divide.md deleted file mode 100644 index ce083cdecd..0000000000 --- a/.changeset/giant-badgers-divide.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@ice/runtime': patch ---- - -fix: compatible with hmr when data get undefined diff --git a/.changeset/perfect-bags-double.md b/.changeset/perfect-bags-double.md deleted file mode 100644 index c51bfe3bef..0000000000 --- a/.changeset/perfect-bags-double.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@ice/runtime': patch ---- - -feat: supprot sourmap for distType diff --git a/.changeset/plenty-rings-hammer.md b/.changeset/plenty-rings-hammer.md deleted file mode 100644 index 8d97f6e17f..0000000000 --- a/.changeset/plenty-rings-hammer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@ice/plugin-rax-compat': patch ---- - -fix: auto add jsx comment diff --git a/.changeset/sharp-pumas-poke.md b/.changeset/sharp-pumas-poke.md deleted file mode 100644 index a4320a88a7..0000000000 --- a/.changeset/sharp-pumas-poke.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@ice/runtime': patch ---- - -fix: add v5Compat for use history to navigate diff --git a/.changeset/sour-windows-draw.md b/.changeset/sour-windows-draw.md deleted file mode 100644 index e3659b65ab..0000000000 --- a/.changeset/sour-windows-draw.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@ice/runtime': patch ---- - -fix: get data loader with code remove diff --git a/.changeset/strong-pumpkins-brake.md b/.changeset/strong-pumpkins-brake.md deleted file mode 100644 index 69edee4b40..0000000000 --- a/.changeset/strong-pumpkins-brake.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@ice/runtime': patch -'@ice/app': patch ---- - -feat: supprot sourmap for distType diff --git a/packages/ice/CHANGELOG.md b/packages/ice/CHANGELOG.md index 719775a225..b3aa259c43 100644 --- a/packages/ice/CHANGELOG.md +++ b/packages/ice/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 3.2.1 + +### Patch Changes + +- f24b045d: feat: supprot sourmap for distType +- 8b1b237: feat: support api of addEntryImportAhead +- Updated dependencies [f24b045d] + - @ice/runtime@1.2.1 + ## 3.2.0 ### Minor Changes diff --git a/packages/ice/package.json b/packages/ice/package.json index 7b18b6e788..ca3b0cf61d 100644 --- a/packages/ice/package.json +++ b/packages/ice/package.json @@ -1,6 +1,6 @@ { "name": "@ice/app", - "version": "3.2.0", + "version": "3.2.1", "description": "provide scripts and configuration used by web framework ice", "type": "module", "main": "./esm/index.js", @@ -38,7 +38,7 @@ "dependencies": { "@ice/bundles": "0.1.10", "@ice/route-manifest": "1.2.0", - "@ice/runtime": "^1.2.0", + "@ice/runtime": "^1.2.1", "@ice/webpack-config": "1.0.14", "@swc/helpers": "0.5.1", "@types/express": "^4.17.14", diff --git a/packages/plugin-i18n/package.json b/packages/plugin-i18n/package.json index 33514a3197..7ca03a7c18 100644 --- a/packages/plugin-i18n/package.json +++ b/packages/plugin-i18n/package.json @@ -55,8 +55,8 @@ "webpack-dev-server": "^4.13.2" }, "peerDependencies": { - "@ice/app": "^3.2.0", - "@ice/runtime": "^1.2.0" + "@ice/app": "^3.2.1", + "@ice/runtime": "^1.2.1" }, "publishConfig": { "access": "public" diff --git a/packages/plugin-rax-compat/CHANGELOG.md b/packages/plugin-rax-compat/CHANGELOG.md index 5ca02613e7..097ff46136 100644 --- a/packages/plugin-rax-compat/CHANGELOG.md +++ b/packages/plugin-rax-compat/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.2.2 + +### Patch Changes + +- 45cb1c77: fix: auto add jsx comment + ## 0.2.1 ### Patch Changes diff --git a/packages/plugin-rax-compat/package.json b/packages/plugin-rax-compat/package.json index e9264b0f17..9729aa836a 100644 --- a/packages/plugin-rax-compat/package.json +++ b/packages/plugin-rax-compat/package.json @@ -1,6 +1,6 @@ { "name": "@ice/plugin-rax-compat", - "version": "0.2.1", + "version": "0.2.2", "description": "Provide rax compat support for ice.js", "license": "MIT", "type": "module", @@ -30,7 +30,7 @@ "stylesheet-loader": "^0.9.1" }, "devDependencies": { - "@ice/app": "^3.2.0", + "@ice/app": "^3.2.1", "webpack": "^5.80.0" }, "repository": { diff --git a/packages/plugin-store/CHANGELOG.md b/packages/plugin-store/CHANGELOG.md index a4d42d9951..f36692bc4d 100644 --- a/packages/plugin-store/CHANGELOG.md +++ b/packages/plugin-store/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## 1.1.1 + +### Patch Changes + +- 5266fedc: fix: import store source before swc compiler + ## 1.1.0 ### Minor Changes diff --git a/packages/plugin-store/package.json b/packages/plugin-store/package.json index c2d284ba41..4203fbbb66 100644 --- a/packages/plugin-store/package.json +++ b/packages/plugin-store/package.json @@ -1,6 +1,6 @@ { "name": "@ice/plugin-store", - "version": "1.1.0", + "version": "1.1.1", "description": "", "license": "MIT", "type": "module", diff --git a/packages/runtime/CHANGELOG.md b/packages/runtime/CHANGELOG.md index 0c0df2fcb3..f1fd1580b2 100644 --- a/packages/runtime/CHANGELOG.md +++ b/packages/runtime/CHANGELOG.md @@ -1,5 +1,15 @@ # @ice/runtime +## 1.2.1 + +### Patch Changes + +- 989e2501: fix: compatible with hmr when data get undefined +- f24b045d: feat: supprot sourmap for distType +- ab139acc: fix: add v5Compat for use history to navigate +- 6e639dfe: fix: get data loader with code remove +- f24b045d: feat: supprot sourmap for distType + ## 1.2.0 ### Minor Changes diff --git a/packages/runtime/package.json b/packages/runtime/package.json index caa6d86360..35ebcc3215 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@ice/runtime", - "version": "1.2.0", + "version": "1.2.1", "description": "Runtime module for ice.js", "type": "module", "types": "./esm/index.d.ts", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c80793a5ea..54bfb7e1d5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1057,7 +1057,7 @@ importers: specifiers: '@ice/bundles': 0.1.10 '@ice/route-manifest': 1.2.0 - '@ice/runtime': ^1.2.0 + '@ice/runtime': ^1.2.1 '@ice/webpack-config': 1.0.14 '@swc/helpers': 0.5.1 '@types/babel__generator': ^7.6.4 @@ -1401,7 +1401,7 @@ importers: specifiers: '@babel/core': ^7.0.0 '@babel/plugin-proposal-export-default-from': ^7.18.9 - '@ice/app': ^3.2.0 + '@ice/app': ^3.2.1 '@ice/bundles': ^0.1.10 babel-plugin-transform-jsx-stylesheet: 1.0.6 consola: ^2.15.3 @@ -7485,7 +7485,6 @@ packages: '@types/prop-types': 15.7.5 '@types/scheduler': 0.16.2 csstype: 3.1.1 - dev: true /@types/react/18.0.28: resolution: {integrity: sha512-RD0ivG1kEztNBdoAK7lekI9M+azSnitIn85h4iOiaLjaTrMjzslhaqCGaI4IyCJ1RljWiLCEu4jyrLLgqxBTew==} @@ -9651,8 +9650,8 @@ packages: engines: {node: '>=10'} hasBin: true dependencies: - is-text-path: 1.0.1 JSONStream: 1.3.5 + is-text-path: 1.0.1 lodash: 4.17.21 meow: 8.1.2 split2: 3.2.2 @@ -9682,7 +9681,6 @@ packages: resolution: {integrity: sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==} dependencies: is-what: 3.14.1 - dev: false /copy-text-to-clipboard/3.0.1: resolution: {integrity: sha512-rvVsHrpFcL4F2P8ihsoLdFHmd404+CMg71S756oRSeQgqk51U3kicGdnvfkrxva0xXH92SjGS62B0XIJsbh+9Q==} @@ -10782,7 +10780,6 @@ packages: requiresBuild: true dependencies: prr: 1.0.1 - dev: false optional: true /error-ex/1.3.2: @@ -13096,7 +13093,6 @@ packages: engines: {node: '>=0.10.0'} hasBin: true requiresBuild: true - dev: false optional: true /image-size/1.0.2: @@ -13621,7 +13617,6 @@ packages: /is-what/3.14.1: resolution: {integrity: sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==} - dev: false /is-whitespace-character/1.0.4: resolution: {integrity: sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==} @@ -14903,7 +14898,6 @@ packages: source-map: 0.6.1 transitivePeerDependencies: - supports-color - dev: false /leven/3.1.0: resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} @@ -15202,7 +15196,6 @@ packages: dependencies: pify: 4.0.1 semver: 5.7.1 - dev: false optional: true /make-dir/3.1.0: @@ -15589,7 +15582,6 @@ packages: sax: 1.2.4 transitivePeerDependencies: - supports-color - dev: false optional: true /negotiator/0.6.3: @@ -16042,7 +16034,6 @@ packages: /parse-node-version/1.0.1: resolution: {integrity: sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==} engines: {node: '>= 0.10'} - dev: false /parse-numeric-range/1.3.0: resolution: {integrity: sha512-twN+njEipszzlMJd4ONUYgSfZPDxgHhT9Ahed5uTigpQn90FggW4SA/AIPq/6a149fTbE9qBEcSwE3FAEp6wQQ==} @@ -17374,7 +17365,6 @@ packages: nanoid: 3.3.4 picocolors: 1.0.0 source-map-js: 1.0.2 - dev: false /postcss/8.4.21: resolution: {integrity: sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==} @@ -17528,7 +17518,6 @@ packages: /prr/1.0.1: resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==} - dev: false optional: true /pseudomap/1.0.2: @@ -18663,6 +18652,12 @@ packages: /react-dev-utils/12.0.1_lj5zgxrzaejsnoobor62tojvse: resolution: {integrity: sha512-84Ivxmr17KjUupyqzFode6xKhjwuEJDROWKJy/BthkL7Wn6NJ8h4WE6k/exAv6ImS+0oZLRRW5j/aINMHyeGeQ==} engines: {node: '>=14'} + peerDependencies: + typescript: '>=2.7' + webpack: '>=4' + peerDependenciesMeta: + typescript: + optional: true dependencies: '@babel/code-frame': 7.18.6 address: 1.2.2 @@ -18693,9 +18688,7 @@ packages: transitivePeerDependencies: - eslint - supports-color - - typescript - vue-template-compiler - - webpack /react-dom/17.0.2_react@17.0.2: resolution: {integrity: sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==} @@ -18706,7 +18699,6 @@ packages: object-assign: 4.1.1 react: 17.0.2 scheduler: 0.20.2 - dev: false /react-dom/18.2.0_react@18.2.0: resolution: {integrity: sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==} @@ -18842,7 +18834,6 @@ packages: /react-refresh/0.14.0: resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==} engines: {node: '>=0.10.0'} - dev: false /react-router-config/5.1.1_2dl5roaqnyqqppnjni7uetnb3a: resolution: {integrity: sha512-DuanZjaD8mQp1ppHjgnnUnyOlqYXZVjnov/JzFhjLEwd3Z4dYjMSnqrEzzGThH47vpCOqPPwJM2FtthLeJ8Pbg==} @@ -18940,7 +18931,6 @@ packages: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - dev: false /react/18.2.0: resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==} @@ -19572,7 +19562,6 @@ packages: dependencies: loose-envify: 1.4.0 object-assign: 4.1.1 - dev: false /scheduler/0.21.0: resolution: {integrity: sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ==} @@ -20658,7 +20647,6 @@ packages: serialize-javascript: 6.0.1 terser: 5.16.5 webpack: 5.80.0_w34or7orauknzckzea4nxxqrru - dev: true /terser-webpack-plugin/5.3.7_qo4emlfatbstozv5cog53p7ftu: resolution: {integrity: sha512-AfKwIktyP7Cu50xNjXF/6Qb5lBNzYaWpU6YfoX3uZicTx0zTy0stDDCsvjDapKsSDvOeWo5MEq4TmdBy2cNoHw==} @@ -22225,7 +22213,6 @@ packages: - '@swc/core' - esbuild - uglify-js - dev: true /webpackbar/5.0.2_webpack@5.80.0: resolution: {integrity: sha512-BmFJo7veBDgQzfWXl/wwYXr/VFus0614qZ8i9znqcl9fnEdiVkdbi0TedLQ6xAK92HZHDJ0QmyQ0fmuZPAgCYQ==}