@module-federation/treeshake-server 2.3.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/frontend/index.html +1 -1
- package/dist/frontend/static/js/465.8ad65aff.js +2 -0
- package/dist/frontend/static/js/async/538.91f59a63.js +12 -0
- package/dist/frontend/static/js/async/873.03a2ef6b.js +2 -0
- package/dist/frontend/static/js/async/{987.a50728e1.js → 987.b6f87e58.js} +2 -2
- package/dist/frontend/static/js/{index.b3dca30c.js → index.3acccf82.js} +2 -2
- package/dist/frontend/static/js/lib-router.79263654.js +4 -0
- package/dist/frontend/static/js/{lib-router.ec054261.js.LICENSE.txt → lib-router.79263654.js.LICENSE.txt} +1 -1
- package/package.json +2 -2
- package/dist/frontend/static/js/977.9948a4c1.js +0 -2
- package/dist/frontend/static/js/async/439.8c0b4d8f.js +0 -12
- package/dist/frontend/static/js/async/873.1ed39777.js +0 -2
- package/dist/frontend/static/js/lib-router.ec054261.js +0 -4
- /package/dist/frontend/static/js/{977.9948a4c1.js.LICENSE.txt → 465.8ad65aff.js.LICENSE.txt} +0 -0
- /package/dist/frontend/static/js/async/{439.8c0b4d8f.js.LICENSE.txt → 538.91f59a63.js.LICENSE.txt} +0 -0
- /package/dist/frontend/static/js/async/{987.a50728e1.js.LICENSE.txt → 987.b6f87e58.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! For license information please see 987.
|
|
2
|
-
"use strict";(self.webpackChunk_module_federation_treeshake_frontend=self.webpackChunk_module_federation_treeshake_frontend||[]).push([["987"],{2423(e,t,s){s.d(t,{A:()=>a});let a=(0,s(9122).A)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},4723(e,t,s){s.d(t,{E:()=>n});var a=s(5723);s(2155);var l=s(5445),r=s(8207);let i=(0,l.F)("inline-flex items-center rounded-md border border-zinc-200 px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-zinc-950 focus:ring-offset-2 dark:border-zinc-800 dark:focus:ring-zinc-300",{variants:{variant:{default:"border-transparent bg-zinc-900 text-zinc-50 shadow hover:bg-zinc-900/80 dark:bg-zinc-50 dark:text-zinc-900 dark:hover:bg-zinc-50/80",secondary:"border-transparent bg-zinc-100 text-zinc-900 hover:bg-zinc-100/80 dark:bg-zinc-800 dark:text-zinc-50 dark:hover:bg-zinc-800/80",destructive:"border-transparent bg-red-500 text-zinc-50 shadow hover:bg-red-500/80 dark:bg-red-900 dark:text-zinc-50 dark:hover:bg-red-900/80",outline:"text-zinc-950 dark:text-zinc-50"}},defaultVariants:{variant:"default"}});function n(e){let{className:t,variant:s,...l}=e;return(0,a.jsx)("div",{className:(0,r.cn)(i({variant:s}),t),...l})}},670(e,t,s){s.r(t),s.d(t,{default:()=>m});var a=s(5723),l=s(2155),r=s(
|
|
1
|
+
/*! For license information please see 987.b6f87e58.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.webpackChunk_module_federation_treeshake_frontend=self.webpackChunk_module_federation_treeshake_frontend||[]).push([["987"],{2423(e,t,s){s.d(t,{A:()=>a});let a=(0,s(9122).A)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},4723(e,t,s){s.d(t,{E:()=>n});var a=s(5723);s(2155);var l=s(5445),r=s(8207);let i=(0,l.F)("inline-flex items-center rounded-md border border-zinc-200 px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-zinc-950 focus:ring-offset-2 dark:border-zinc-800 dark:focus:ring-zinc-300",{variants:{variant:{default:"border-transparent bg-zinc-900 text-zinc-50 shadow hover:bg-zinc-900/80 dark:bg-zinc-50 dark:text-zinc-900 dark:hover:bg-zinc-50/80",secondary:"border-transparent bg-zinc-100 text-zinc-900 hover:bg-zinc-100/80 dark:bg-zinc-800 dark:text-zinc-50 dark:hover:bg-zinc-800/80",destructive:"border-transparent bg-red-500 text-zinc-50 shadow hover:bg-red-500/80 dark:bg-red-900 dark:text-zinc-50 dark:hover:bg-red-900/80",outline:"text-zinc-950 dark:text-zinc-50"}},defaultVariants:{variant:"default"}});function n(e){let{className:t,variant:s,...l}=e;return(0,a.jsx)("div",{className:(0,r.cn)(i({variant:s}),t),...l})}},670(e,t,s){s.r(t),s.d(t,{default:()=>m});var a=s(5723),l=s(2155),r=s(1781),i=s(4678),n=s(4723),d=s(3760),c=s(8207),o=s(2423);function x(){let e=(0,l.useRef)(null),[t,s]=(0,l.useState)(0),{t:x}=(0,r.Bd)(),m=(0,i.Zp)();(0,l.useEffect)(()=>{let e,t=null,a=l=>{null==t&&(t=l);let r=Math.min((l-t)/5e3,1);s(r),r<1&&(e=requestAnimationFrame(a))};return e=requestAnimationFrame(a),()=>cancelAnimationFrame(e)},[]);let h=(e,t,s)=>e<=t?0:e>=s?1:1-Math.pow(1-(e-t)/(s-t),3),u=h(t,.05,.55),f=h(t,.22,.82),p=h(t,.12,.7),g=h(t,.32,.9),b=h(t,.4,1),j=h(t,.2,.8),v=Math.round(120*u),y=Math.round(42*f),N=Math.max(v-y,0),k=Math.max(0,Math.round(65*b)),w=Math.round(950*p),z=Math.round(360*g),M=Math.round(40*j),A=Math.round(14*j),_=t>.2&&t<1;return(0,a.jsxs)("section",{ref:e,onMouseMove:t=>{let s=e.current;if(!s)return;let a=s.getBoundingClientRect(),l=(t.clientX-a.left)/a.width-.5,r=(t.clientY-a.top)/a.height-.5;s.style.setProperty("--hero-px",l.toFixed(3)),s.style.setProperty("--hero-py",r.toFixed(3))},onMouseLeave:()=>{let t=e.current;t&&(t.style.setProperty("--hero-px","0"),t.style.setProperty("--hero-py","0"))},className:"relative flex flex-1 flex-col justify-center py-10 md:py-16",children:[(0,a.jsxs)("div",{className:"relative z-10 grid gap-10 md:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)] md:items-center",children:[(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)(n.E,{className:"inline-flex items-center gap-1 rounded-full bg-slate-900/90 px-3 py-1 text-[11px] uppercase tracking-wide text-slate-50 shadow-lg shadow-sky-500/40 dark:bg-slate-100 dark:text-slate-900",children:[(0,a.jsx)(o.A,{className:"h-3 w-3"}),x("home.badge")]}),(0,a.jsxs)("h1",{className:"text-balance text-3xl font-semibold tracking-tight md:text-4xl",children:[x("home.titlePrefix"),(0,a.jsx)("span",{className:"mx-1 bg-gradient-to-r from-sky-400 via-fuchsia-500 to-emerald-400 bg-clip-text text-transparent",children:x("home.titleHighlight")}),x("home.titleSuffix")]}),(0,a.jsx)("p",{className:"max-w-xl text-sm leading-relaxed text-slate-600 dark:text-slate-300",children:x("home.subtitle")})]}),(0,a.jsx)("div",{className:"relative",children:(0,a.jsxs)("div",{className:"hero-glass-panel p-5 md:p-6",children:[(0,a.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:(0,c.cn)("hero-metric-pill relative flex items-center justify-between rounded-full bg-slate-900/95 px-3 py-2 text-xs text-slate-100 shadow-md",_&&"hero-metric-pill--active"),children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-rose-500/20 text-[11px] text-rose-200",children:"F"}),x("results.cardFullTitle")]}),(0,a.jsxs)("span",{className:"font-semibold",children:[v," KB \xb7 ~",w," ms"]})]}),(0,a.jsxs)("div",{className:(0,c.cn)("hero-metric-pill relative flex items-center justify-between rounded-full bg-emerald-500/10 px-3 py-2 text-xs text-emerald-700 dark:text-emerald-100 shadow-md shadow-emerald-500/30 backdrop-blur",_&&"hero-metric-pill--active"),children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-emerald-500/30 text-[11px] text-emerald-800 dark:text-emerald-50",children:"T"}),x("results.cardTreeshakeTitle")]}),(0,a.jsxs)("span",{className:"font-semibold text-emerald-700 dark:text-emerald-100",children:[y," KB \xb7 ~",z," ms"]})]})]}),(0,a.jsxs)("div",{className:"space-y-3 text-[11px] text-slate-300",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,a.jsx)("span",{className:"text-slate-200",children:x("home.savedSize")}),(0,a.jsxs)("span",{className:"text-sm font-semibold text-fuchsia-200",children:[N," KB"]})]}),(0,a.jsxs)("div",{className:"relative h-2 overflow-hidden rounded-full bg-slate-800/80",children:[(0,a.jsx)("div",{className:"h-full rounded-full bg-gradient-to-r from-fuchsia-500 via-sky-400 to-emerald-400",style:{width:`${Math.min(k,100)}%`,transition:"width 300ms cubic-bezier(0.22, 1, 0.36, 1)"}}),(0,a.jsx)("div",{className:(0,c.cn)("hero-bar-shimmer",_&&"hero-bar-shimmer--active")})]}),(0,a.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,a.jsx)("span",{className:"text-slate-400",children:x("home.savedPercent")}),(0,a.jsx)("span",{className:"text-sm font-semibold text-fuchsia-300",children:k>0?`${k}%`:"--"})]}),(0,a.jsxs)("div",{className:"mt-1 grid grid-cols-2 gap-2 text-[10px] text-slate-400",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-slate-900/60 px-2 py-1",children:[(0,a.jsx)("span",{children:x("home.moduleCount")}),(0,a.jsxs)("span",{className:"font-mono text-xs text-slate-100",children:[M," → ",A]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-lg bg-slate-900/60 px-2 py-1",children:[(0,a.jsx)("span",{children:x("home.simulatedLoad")}),(0,a.jsxs)("span",{className:"font-mono text-xs text-emerald-200",children:["~",950," ms → ~",360," ms"]})]})]})]})]}),(0,a.jsx)("p",{className:"mt-4 text-[10px] text-slate-400",children:x("home.demoNote")})]})})]}),(0,a.jsx)("div",{className:"relative z-10 mt-10 flex justify-center",children:(0,a.jsxs)(d.$,{type:"button",className:"inline-flex items-center gap-2 rounded-full bg-gradient-to-r from-sky-500 via-fuchsia-500 to-emerald-500 px-8 py-2.5 text-sm font-medium text-white shadow-xl shadow-sky-500/40 transition-transform hover:translate-y-0.5 hover:shadow-2xl",onClick:()=>m("/analyze"),children:[(0,a.jsx)(o.A,{className:"h-4 w-4"}),x("common.tryNow")]})})]})}function m(){return(0,a.jsx)("div",{className:"relative z-10 flex flex-1 flex-col",children:(0,a.jsx)(x,{})})}}}]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{"use strict";var e,t,r,a,s,o,l,n={3760(e,t,r){r.d(t,{$:()=>d});var a=r(5723),s=r(2155),o=r(
|
|
1
|
+
(()=>{"use strict";var e,t,r,a,s,o,l,n={3760(e,t,r){r.d(t,{$:()=>d});var a=r(5723),s=r(2155),o=r(3509),l=r(5445),n=r(8207);let i=(0,l.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-zinc-950 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 dark:focus-visible:ring-zinc-300",{variants:{variant:{default:"bg-zinc-900 text-zinc-50 shadow hover:bg-zinc-900/90 dark:bg-zinc-50 dark:text-zinc-900 dark:hover:bg-zinc-50/90",destructive:"bg-red-500 text-zinc-50 shadow-sm hover:bg-red-500/90 dark:bg-red-900 dark:text-zinc-50 dark:hover:bg-red-900/90",outline:"border border-zinc-200 bg-white shadow-sm hover:bg-zinc-100 hover:text-zinc-900 dark:border-zinc-800 dark:bg-zinc-950 dark:hover:bg-zinc-800 dark:hover:text-zinc-50",secondary:"bg-zinc-100 text-zinc-900 shadow-sm hover:bg-zinc-100/80 dark:bg-zinc-800 dark:text-zinc-50 dark:hover:bg-zinc-800/80",ghost:"hover:bg-zinc-100 hover:text-zinc-900 dark:hover:bg-zinc-800 dark:hover:text-zinc-50",link:"text-zinc-900 underline-offset-4 hover:underline dark:text-zinc-50"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),d=s.forwardRef((e,t)=>{let{className:r,variant:s,size:l,asChild:d=!1,...c}=e,u=d?o.DX:"button";return(0,a.jsx)(u,{className:(0,n.cn)(i({variant:s,size:l,className:r})),ref:t,...c})});d.displayName="Button"},9980(e,t,r){r.d(t,{dj:()=>u,oR:()=>c});var a=r(2155);let s=0,o=new Map,l=e=>{if(o.has(e))return;let t=setTimeout(()=>{o.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);o.set(e,t)},n=[],i={toasts:[]};function d(e){i=((e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?l(r):e.toasts.forEach(e=>{l(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}})(i,e),n.forEach(e=>{e(i)})}function c(e){let{...t}=e,r=(s=(s+1)%Number.MAX_SAFE_INTEGER).toString(),a=()=>d({type:"DISMISS_TOAST",toastId:r});return d({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:e=>{e||a()}}}),{id:r,dismiss:a,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:r}})}}function u(){let[e,t]=a.useState(i);return a.useEffect(()=>(n.push(t),()=>{let e=n.indexOf(t);e>-1&&n.splice(e,1)}),[e]),{...e,toast:c,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},836(e,t,r){r.d(t,{A:()=>n});var a=r(1984),s=r(1781),o=r(4537);let l={"zh-CN":{translation:{common:{appName:"Shared Bundle Treeshake Studio",appSubtitle:"让 Treeshake 变得可观察",mockModeLabel:"Mock Mode",mockModeLocal:"本地模拟数据",mockModeRemote:"真实服务",themeToggleAria:"切换主题",tryNow:"Try it now",reset:"重置",submitIdle:"立即分析",submitLoading:"正在分析 bundle...",formSubmitHint:"回车键 或 点击按钮发起分析。",copied:"已复制",copy:"复制",download:"下载",copySuccessTitle:"已复制到剪贴板",copySuccessDescFile:"文件名: {{file}}",copyErrorTitle:"复制失败",copyErrorDesc:"浏览器暂不支持自动复制,请手动选择代码。",downloadErrorTitle:"下载失败",downloadErrorDesc:"浏览器不支持自动下载,请手动复制内容。",bundleEmptyPlaceholder:"// 当前 bundle 暂无内容",showAllCode:"展开全部代码",yes:"是",no:"否",quickTry:"快速体验",fillDemo:"填入演示数据",importManifest:"导入清单配置"},home:{badge:"Treeshake-ready Shared Bundling",titlePrefix:"一眼看懂",titleHighlight:"Full vs Treeshake",titleSuffix:"带来的真实体感",subtitle:"Visual comparison of Full vs Treeshaken builds. Making tree-shaking tangible.",savedSize:"节省体积",savedPercent:"节省比例",moduleCount:"模块数",simulatedLoad:"模拟加载时间",demoNote:"动画数值仅为示意,不代表真实环境。接入你的打包服务后,分析页会基于真实 bundle 给出精确对比。"},analyze:{heroBadge:"Treeshake-ready Shared Bundling",heroTitlePrefix:"用一张页面,看懂",heroTitleHighlight:"按需打包",heroTitleSuffix:"为 shared 带来的真实收益",heroSubtitle:"输入 shared 名称、版本和要保留的导出,一键对比完整 bundle 和 Treeshaken bundle 的体积、模块数量,以及两份产物的代码差异。所有 JS 仅以文本形式展示,不会在页面中执行。",featureVisualizationTitle:"收益可视化",featureVisualizationDesc:"体积、百分比一目了然",featureConfigTitle:"高级构建配置",featureConfigDesc:"目标、格式、平台随时可调",featureSafeCodeTitle:"安全地展示代码",featureSafeCodeDesc:"只展示文本,绝不执行 bundle",formCardTitle:"快速体验 Treeshake 效果",formCardDesc:"填写信息后,回车或点击按钮即可开始分析。",fieldSharedLabel:"Shared Name",fieldSharedPlaceholder:"例如: @scope/shared-lib",fieldVersionLabel:"Version",fieldVersionPlaceholder:"例如: 6.1.0",fieldExportsLabel:"Exports to keep",fieldExportsPlaceholderEmpty:"例如: useQuery, Button, ThemeProvider",fieldExportsPlaceholderMore:"继续输入导出名,回车 / 空格确认",fieldExportsHelp:"支持使用回车、逗号或空格快速创建导出 chip,退格键可以删除最后一个导出。",formErrorSharedRequired:"请输入 shared 名称",formErrorVersionRequired:"请输入版本号",formErrorExportsRequired:"请至少保留一个导出符号",formErrorTitleIncomplete:"表单未填写完整",formErrorDescIncomplete:"请补全必填字段后再发起构建。",sharedVersionRequired:"Shared 依赖 {{name}} 必须指定版本号 (例如: react@18.2.0)",extraConfigErrorTitle:"额外构建配置格式错误",extraConfigErrorDesc:"请确保额外 JSON 配置是合法的 JSON 字符串。",apiBaseRequired:"请在高级配置中填写 API Base URL,或开启 Mock Mode。",headersJsonInvalid:"请求头配置不是合法的 JSON 对象。",responseRootInvalid:"响应格式不符合预期:根节点不是对象。",responseMissingJs:"响应中缺少 full/treeshake.js 字段。",analyzeSuccessTitle:"分析完成",analyzeSuccessDesc:"已生成完整 bundle 与 Treeshaken bundle 的对比结果。",analyzeErrorTitle:"分析失败",analyzeErrorDescFallback:"请求失败,请稍后重试。",errorDuplicateSharedCurrent:"Shared 模块名称重复: {{name}}。",errorDuplicateSharedDeps:"依赖中发现重复的 Shared 模块: {{names}}。",suggestionMoveToShared:"建议把此库添加到 shared 里,而不是 treeshake",btnMoveToShared:"移动到 shared"},advanced:{title:"高级构建配置",subtitle:"默认即可使用,如需精准对齐服务端配置可在此调整。",collapse:"收起",expand:"展开",apiBaseLabel:"Server API Base URL",apiBasePlaceholder:"例如: http://localhost:4000/build",apiBaseDesc:"留空时会回落到环境变量 VITE_API_BASE_URL。",targetLabel:"Target",targetPlaceholder:`web,
|
|
2
2
|
browserslist:> 0.01%,not dead,not op_mini all`,targetDesc:"Rspack 输出产物的目标环境和 Rspack runtime 代码的 ECMAScript 版本。",pluginsLabel:"Plugins",pluginsPlaceholder:"例如: @scope/my-plugin@6.1.0",pluginsDesc:"Rspack plugin,用于修改构建时的完整配置。支持指定版本。",sharedLabel:"Shared",sharedPlaceholder:"例如: react@18.2.0,react-dom@18.2.0",sharedDesc:"相关的 shared 依赖,例如 antd 依赖 react,则两者都应被设置为 shared。支持以逗号或空格分隔。"},results:{overviewTitle:"Full vs Treeshake 总览",overviewDoneBadge:"已完成一次分析",tableMetric:"指标",tableFull:"Full bundle",tableTreeshake:"Treeshake bundle",metricSize:"体积 (KB)",metricLoadTime:"加载时间 (ms)",metricModules:"模块数",metricSavedPercent:"节省比例",metricSavedPercentNA:"--",cardFullTitle:"Full Bundle",cardFullDesc:"完整 shared bundle 的总体积。",cardFullModules:"模块数量: {{count}}",cardTreeshakeTitle:"Treeshaken Bundle",cardTreeshakeDesc:"仅保留指定导出后的按需 bundle 体积。",cardTreeshakeModules:"模块数量: {{count}}",cardSavedTitle:"Size Saved",cardSavedDesc:"Treeshake 帮你摇掉的 JS 体积,越大越划算。",cardSavedPercentLabel:"节省比例",cardSavedPercentUnit:"%",cardKeptTitle:"模块保留情况",cardKeptExportsUnit:"个核心导出",cardKeptDesc:"Treeshake 后仍被保留的导出数量,通常与页面真实使用强相关。",cardKeptFullCount:"完整 bundle 模块数量: {{count}}",chartTitle:"体积对比",chartDesc:"越小的柱子 = 越少的 JS 需要被下载和解析",chartEmptyTitle:"等待一次构建结果",chartEmptyDesc:"填写表单并发起分析后,这里会展示完整 bundle 与 Treeshaken bundle 的体积对比动画。",modulesSectionTitle:"导出模块一览",modulesSectionDesc:"快速查看完整 bundle 与 Treeshaken bundle 分别包含哪些导出。",fullModulesLabel:"Full bundle",treeshakeModulesLabel:"Treeshaken bundle",moduleCountLabel:"{{count}} 个导出",moduleMoreLabel:"+{{count}} 个更多导出...",codeCompareTitle:"代码对比",codeCompareDesc:"下方仅展示返回的 JS 文本内容,不会在页面中执行。"},pseudocode:{sectionTitle:"如何加载产物(伪代码)",badge:"仅为示意,不会执行",cardTitle:"跨环境加载 shared 产物的伪代码流程",cardDesc:"下面的伪代码仅用于解释加载流程的设计思路,不会在浏览器中执行。",intro:"假设你的打包服务返回的 full / treeshake 产物都可以通过 URL 访问,或者可以在前端将字符串转成 Blob,再生成临时 URL。",tabBrowser:"浏览器环境",tabNode:"Node / SSR 环境",browserCode:`// 1. 从后端拿到 full JS 与 treeshaken JS 字符串
|
|
3
3
|
const fullJs = response.full.js
|
|
4
4
|
const treeshakeJs = response.treeshake.js
|
|
@@ -85,4 +85,4 @@ writeFileSync("./shared.treeshake.js", treeshakeJs)
|
|
|
85
85
|
// - Or hand them over to your bundler / runtime
|
|
86
86
|
|
|
87
87
|
// Note: to avoid executing untrusted code, do this only in
|
|
88
|
-
// trusted build environments or sandboxed runtimes.`},faq:{title:"FAQ",q1:"What does Mock Mode do?",a1:"When no real build service is wired, Mock Mode synthesizes a local response so you can experience the full UX and visualizations. Turn it off once a real backend is connected.",q2:"Where does API Base URL come from?",a2:"We first read the value from the Advanced Config panel (persisted in localStorage), then fall back to environment variable VITE_API_BASE_URL, and finally to http://localhost:4000/build.",q3:"Why might treeshake results differ slightly from real outputs?",a3:"The page only displays returned JS text plus export info inferred with simple heuristics, to make savings intuitive. It never executes JS. Your real production build behaviour is defined by your own build service."},footer:{jsSafety:"Frontend only renders text and never executes returned JS."},lang:{zh:"中文",en:"English"}}}};a.Ay.use(o.A).use(s.r9).init({resources:l,fallbackLng:"zh-CN",supportedLngs:["zh-CN","en"],lng:"zh-CN",interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator","htmlTag"],caches:["localStorage"]}});let n=a.Ay},8207(e,t,r){r.d(t,{cn:()=>o});var a=r(851),s=r(3455);function o(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,a.$)(t))}},9864(e,t,r){var a=r(5723),s=r(2155),o=r(8997);r(836);var l=r(6292),n=r(3453),i=r(3760),d=r(9087),c=r(8207);let u=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(d.bL,{className:(0,c.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-950 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-zinc-900 data-[state=unchecked]:bg-zinc-200 dark:focus-visible:ring-zinc-300 dark:focus-visible:ring-offset-zinc-950 dark:data-[state=checked]:bg-zinc-50 dark:data-[state=unchecked]:bg-zinc-800",r),...s,ref:t,children:(0,a.jsx)(d.zi,{className:(0,c.cn)("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:bg-zinc-950")})})});function h(e){let{className:t,...r}=e;return(0,a.jsx)("div",{className:(0,c.cn)("animate-pulse rounded-md bg-zinc-900/10 dark:bg-zinc-50/10",t),...r})}u.displayName=d.bL.displayName;var p=r(9980),m=r(6276),f=r(5445),b=r(1784);let g=m.Kq,v=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(m.LM,{ref:t,className:(0,c.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",r),...s})});v.displayName=m.LM.displayName;let k=(0,f.F)("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border border-zinc-200 p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full dark:border-zinc-800",{variants:{variant:{default:"border bg-white text-zinc-950 dark:bg-zinc-950 dark:text-zinc-50",destructive:"destructive group border-red-500 bg-red-500 text-zinc-50 dark:border-red-900 dark:bg-red-900 dark:text-zinc-50"}},defaultVariants:{variant:"default"}}),x=s.forwardRef((e,t)=>{let{className:r,variant:s,...o}=e;return(0,a.jsx)(m.bL,{ref:t,className:(0,c.cn)(k({variant:s}),r),...o})});x.displayName=m.bL.displayName,s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(m.rc,{ref:t,className:(0,c.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-zinc-200 bg-transparent px-3 text-sm font-medium transition-colors hover:bg-zinc-100 focus:outline-none focus:ring-1 focus:ring-zinc-950 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-zinc-100/40 group-[.destructive]:hover:border-red-500/30 group-[.destructive]:hover:bg-red-500 group-[.destructive]:hover:text-zinc-50 group-[.destructive]:focus:ring-red-500 dark:border-zinc-800 dark:hover:bg-zinc-800 dark:focus:ring-zinc-300 dark:group-[.destructive]:border-zinc-800/40 dark:group-[.destructive]:hover:border-red-900/30 dark:group-[.destructive]:hover:bg-red-900 dark:group-[.destructive]:hover:text-zinc-50 dark:group-[.destructive]:focus:ring-red-900",r),...s})}).displayName=m.rc.displayName;let y=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(m.bm,{ref:t,className:(0,c.cn)("absolute right-1 top-1 rounded-md p-1 text-zinc-950/50 opacity-0 transition-opacity hover:text-zinc-950 focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 dark:text-zinc-50/50 dark:hover:text-zinc-50",r),"toast-close":"",...s,children:(0,a.jsx)(b.A,{className:"h-4 w-4"})})});y.displayName=m.bm.displayName;let S=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(m.hE,{ref:t,className:(0,c.cn)("text-sm font-semibold [&+div]:text-xs",r),...s})});S.displayName=m.hE.displayName;let w=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(m.VY,{ref:t,className:(0,c.cn)("text-sm opacity-90",r),...s})});function T(){let{toasts:e}=(0,p.dj)();return(0,a.jsxs)(g,{children:[e.map(function(e){let{id:t,title:r,description:s,action:o,...l}=e;return(0,a.jsxs)(x,{...l,children:[(0,a.jsxs)("div",{className:"grid gap-1",children:[r&&(0,a.jsx)(S,{children:r}),s&&(0,a.jsx)(w,{children:s})]}),o,(0,a.jsx)(y,{})]},t)}),(0,a.jsx)(v,{})]})}w.displayName=m.VY.displayName;var z=r(6425),j=r(5539),E=r(9086);function N(){let{i18n:e,t}=(0,l.Bd)(),r=(e.language||"zh-CN").startsWith("en")?"en":"zh-CN",s=t=>a=>{if(a.preventDefault(),t!==r){e.changeLanguage(t);try{"u">typeof window&&window.localStorage.setItem("i18nextLng",t)}catch{}}};return(0,a.jsxs)("div",{className:"flex items-center gap-1 rounded-full bg-white/60 px-1 py-0.5 text-[11px] shadow-sm backdrop-blur-md dark:bg-slate-900/70",children:[(0,a.jsx)("button",{type:"button",onClick:s("zh-CN"),className:(0,c.cn)("rounded-full px-2 py-0.5 transition-colors","zh-CN"===r?"bg-slate-900 text-slate-50 dark:bg-slate-100 dark:text-slate-900":"text-slate-600 hover:bg-slate-200/70 dark:text-slate-300 dark:hover:bg-slate-800/70"),children:t("lang.zh")}),(0,a.jsx)("span",{className:"text-slate-400 dark:text-slate-500",children:"/"}),(0,a.jsx)("button",{type:"button",onClick:s("en"),className:(0,c.cn)("rounded-full px-2 py-0.5 transition-colors","en"===r?"bg-slate-900 text-slate-50 dark:bg-slate-100 dark:text-slate-900":"text-slate-600 hover:bg-slate-200/70 dark:text-slate-300 dark:hover:bg-slate-800/70"),children:t("lang.en")})]})}let L=(0,s.lazy)(()=>r.e("987").then(r.bind(r,670))),M=(0,s.lazy)(()=>Promise.all([r.e("439"),r.e("873")]).then(r.bind(r,4704))),R="tree-shaking-theme";(0,o.createRoot)(document.getElementById("root")).render((0,a.jsx)(s.StrictMode,{children:(0,a.jsx)(n.I9,{children:(0,a.jsx)(function(){let{t:e}=(0,l.Bd)(),[t,r]=(0,s.useState)(()=>(function(){if("u"<typeof window)return"light";let e=window.localStorage.getItem(R);return"light"===e||"dark"===e?e:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"})()),[o,d]=(0,s.useState)(!1),[p,m]=(0,s.useState)(!1),f=(0,n.zy)();return(0,s.useEffect)(()=>{"u">typeof window&&m(!!window.localStorage.getItem("treeshake_mock_mode"))},[]),(0,s.useEffect)(()=>{"u">typeof document&&(document.documentElement.classList.toggle("dark","dark"===t),window.localStorage.setItem(R,t))},[t]),(0,a.jsxs)("div",{className:(0,c.cn)("min-h-screen text-slate-900 transition-colors duration-500 dark:text-slate-50","/analyze"===f.pathname?"bg-gradient-to-b from-sky-50 via-slate-50 to-slate-100 dark:from-slate-950 dark:via-slate-950 dark:to-slate-900":"bg-white dark:bg-slate-950"),children:["/analyze"===f.pathname&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 -z-10 h-64 bg-gradient-to-br from-sky-400/25 via-fuchsia-500/15 to-emerald-400/25 blur-3xl opacity-80"}),(0,a.jsx)("div",{className:"pointer-events-none absolute inset-y-0 right-0 -z-10 w-1/3 bg-gradient-to-tl from-sky-500/10 via-transparent to-emerald-500/10 blur-3xl"})]}),(0,a.jsxs)("div",{className:"relative mx-auto flex min-h-screen max-w-6xl flex-col px-4 pb-8 pt-6 md:px-8 md:pb-12 md:pt-10",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-tr from-sky-500 to-fuchsia-500 text-white shadow-lg shadow-sky-500/40",children:(0,a.jsx)(z.A,{className:"h-4 w-4"})}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-sm font-semibold tracking-tight",children:e("common.appName")}),(0,a.jsx)("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:e("common.appSubtitle")})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)(N,{}),p&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-full bg-white/60 px-3 py-1 text-xs shadow-sm backdrop-blur-md dark:bg-slate-900/70",children:[(0,a.jsx)("span",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:e("common.mockModeLabel")}),(0,a.jsx)(u,{checked:o,onCheckedChange:e=>d(!!e)}),(0,a.jsx)("span",{className:"text-[11px] text-emerald-600 dark:text-emerald-400",children:e(o?"common.mockModeLocal":"common.mockModeRemote")})]}),(0,a.jsx)(i.$,{type:"button",variant:"ghost",size:"icon","aria-label":e("common.themeToggleAria"),className:"h-9 w-9 rounded-full border border-slate-200/70 bg-white/70 shadow-sm backdrop-blur-md dark:border-slate-700 dark:bg-slate-900",onClick:()=>r(e=>"light"===e?"dark":"light"),children:"light"===t?(0,a.jsx)(j.A,{className:"h-4 w-4 text-slate-700"}):(0,a.jsx)(E.A,{className:"h-4 w-4 text-amber-300"})})]})]}),(0,a.jsx)("main",{className:"mt-8 flex flex-1 flex-col gap-8 md:mt-10",children:"/analyze"===f.pathname?(0,a.jsx)(s.Suspense,{fallback:(0,a.jsx)(h,{className:"h-40 w-full"}),children:(0,a.jsx)(M,{mockMode:o})}):"/"===f.pathname?(0,a.jsx)(s.Suspense,{fallback:(0,a.jsx)(h,{className:"h-40 w-full"}),children:(0,a.jsx)(L,{})}):null}),(0,a.jsx)("footer",{className:"mt-8 border-t border-slate-200/80 pt-4 text-[11px] text-slate-500 dark:border-slate-800/80 dark:text-slate-400",children:(0,a.jsx)("div",{className:"flex justify-center text-center",children:(0,a.jsx)("span",{className:"text-slate-400",children:e("footer.jsSafety")})})})]}),(0,a.jsx)(T,{})]})},{})})}))}},i={};function d(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,d),r.exports}d.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(r,a){if(1&a&&(r=this(r)),8&a||"object"==typeof r&&r&&(4&a&&r.__esModule||16&a&&"function"==typeof r.then))return r;var s=Object.create(null);d.r(s);var o={};e=e||[null,t({}),t([]),t(t)];for(var l=2&a&&r;("object"==typeof l||"function"==typeof l)&&!~e.indexOf(l);l=t(l))Object.getOwnPropertyNames(l).forEach(e=>{o[e]=()=>r[e]});return o.default=()=>r,d.d(s,o),s},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce((t,r)=>(d.f[r](e,t),t),[])),d.u=e=>"static/js/async/"+e+"."+({439:"8c0b4d8f",873:"1ed39777",987:"a50728e1"})[e]+".js",d.miniCssF=e=>""+e+".css",d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},d.l=function(e,t,a,s){if(r[e])return void r[e].push(t);if(void 0!==a)for(var o,l,n=document.getElementsByTagName("script"),i=0;i<n.length;i++){var c=n[i];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@module-federation/treeshake-frontend:"+a){o=c;break}}o||(l=!0,(o=document.createElement("script")).timeout=120,d.nc&&o.setAttribute("nonce",d.nc),o.setAttribute("data-rspack","@module-federation/treeshake-frontend:"+a),o.src=e),r[e]=[t];var u=function(t,a){o.onerror=o.onload=null,clearTimeout(h);var s=r[e];if(delete r[e],o.parentNode&&o.parentNode.removeChild(o),s&&s.forEach(function(e){return e(a)}),t)return t(a)},h=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),l&&document.head.appendChild(o)},d.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.nc=void 0,a=[],d.O=(e,t,r,s)=>{if(t){s=s||0;for(var o=a.length;o>0&&a[o-1][2]>s;o--)a[o]=a[o-1];a[o]=[t,r,s];return}for(var l=1/0,o=0;o<a.length;o++){for(var[t,r,s]=a[o],n=!0,i=0;i<t.length;i++)(!1&s||l>=s)&&Object.keys(d.O).every(e=>d.O[e](t[i]))?t.splice(i--,1):(n=!1,s<l&&(l=s));if(n){a.splice(o--,1);var c=r();void 0!==c&&(e=c)}}return e},d.p="/tree-shaking/",s={410:0},d.f.j=function(e,t){var r=d.o(s,e)?s[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var a=new Promise((t,a)=>r=s[e]=[t,a]);t.push(r[2]=a);var o=d.p+d.u(e),l=Error();d.l(o,function(t){if(d.o(s,e)&&(0!==(r=s[e])&&(s[e]=void 0),r)){var a=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+a+": "+o+")",l.name="ChunkLoadError",l.type=a,l.request=o,r[1](l)}},"chunk-"+e,e)}},d.O.j=e=>0===s[e],o=(e,t)=>{var r,a,[o,l,n]=t,i=0;if(o.some(e=>0!==s[e])){for(r in l)d.o(l,r)&&(d.m[r]=l[r]);if(n)var c=n(d)}for(e&&e(t);i<o.length;i++)a=o[i],d.o(s,a)&&s[a]&&s[a][0](),s[a]=0;return d.O(c)},(l=self.webpackChunk_module_federation_treeshake_frontend=self.webpackChunk_module_federation_treeshake_frontend||[]).forEach(o.bind(null,0)),l.push=o.bind(null,l.push.bind(l));var c=d.O(void 0,["783","535","977"],()=>d(9864));c=d.O(c)})();
|
|
88
|
+
// trusted build environments or sandboxed runtimes.`},faq:{title:"FAQ",q1:"What does Mock Mode do?",a1:"When no real build service is wired, Mock Mode synthesizes a local response so you can experience the full UX and visualizations. Turn it off once a real backend is connected.",q2:"Where does API Base URL come from?",a2:"We first read the value from the Advanced Config panel (persisted in localStorage), then fall back to environment variable VITE_API_BASE_URL, and finally to http://localhost:4000/build.",q3:"Why might treeshake results differ slightly from real outputs?",a3:"The page only displays returned JS text plus export info inferred with simple heuristics, to make savings intuitive. It never executes JS. Your real production build behaviour is defined by your own build service."},footer:{jsSafety:"Frontend only renders text and never executes returned JS."},lang:{zh:"中文",en:"English"}}}};a.Ay.use(o.A).use(s.r9).init({resources:l,fallbackLng:"zh-CN",supportedLngs:["zh-CN","en"],lng:"zh-CN",interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator","htmlTag"],caches:["localStorage"]}});let n=a.Ay},8207(e,t,r){r.d(t,{cn:()=>o});var a=r(851),s=r(834);function o(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,a.$)(t))}},9864(e,t,r){var a=r(5723),s=r(2155),o=r(8997);r(836);var l=r(1781),n=r(4678),i=r(3760),d=r(8646),c=r(8207);let u=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(d.bL,{className:(0,c.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-950 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-zinc-900 data-[state=unchecked]:bg-zinc-200 dark:focus-visible:ring-zinc-300 dark:focus-visible:ring-offset-zinc-950 dark:data-[state=checked]:bg-zinc-50 dark:data-[state=unchecked]:bg-zinc-800",r),...s,ref:t,children:(0,a.jsx)(d.zi,{className:(0,c.cn)("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:bg-zinc-950")})})});function h(e){let{className:t,...r}=e;return(0,a.jsx)("div",{className:(0,c.cn)("animate-pulse rounded-md bg-zinc-900/10 dark:bg-zinc-50/10",t),...r})}u.displayName=d.bL.displayName;var p=r(9980),m=r(2770),f=r(5445),b=r(1784);let g=m.Kq,v=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(m.LM,{ref:t,className:(0,c.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",r),...s})});v.displayName=m.LM.displayName;let k=(0,f.F)("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border border-zinc-200 p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full dark:border-zinc-800",{variants:{variant:{default:"border bg-white text-zinc-950 dark:bg-zinc-950 dark:text-zinc-50",destructive:"destructive group border-red-500 bg-red-500 text-zinc-50 dark:border-red-900 dark:bg-red-900 dark:text-zinc-50"}},defaultVariants:{variant:"default"}}),x=s.forwardRef((e,t)=>{let{className:r,variant:s,...o}=e;return(0,a.jsx)(m.bL,{ref:t,className:(0,c.cn)(k({variant:s}),r),...o})});x.displayName=m.bL.displayName,s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(m.rc,{ref:t,className:(0,c.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-zinc-200 bg-transparent px-3 text-sm font-medium transition-colors hover:bg-zinc-100 focus:outline-none focus:ring-1 focus:ring-zinc-950 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-zinc-100/40 group-[.destructive]:hover:border-red-500/30 group-[.destructive]:hover:bg-red-500 group-[.destructive]:hover:text-zinc-50 group-[.destructive]:focus:ring-red-500 dark:border-zinc-800 dark:hover:bg-zinc-800 dark:focus:ring-zinc-300 dark:group-[.destructive]:border-zinc-800/40 dark:group-[.destructive]:hover:border-red-900/30 dark:group-[.destructive]:hover:bg-red-900 dark:group-[.destructive]:hover:text-zinc-50 dark:group-[.destructive]:focus:ring-red-900",r),...s})}).displayName=m.rc.displayName;let y=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(m.bm,{ref:t,className:(0,c.cn)("absolute right-1 top-1 rounded-md p-1 text-zinc-950/50 opacity-0 transition-opacity hover:text-zinc-950 focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 dark:text-zinc-50/50 dark:hover:text-zinc-50",r),"toast-close":"",...s,children:(0,a.jsx)(b.A,{className:"h-4 w-4"})})});y.displayName=m.bm.displayName;let S=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(m.hE,{ref:t,className:(0,c.cn)("text-sm font-semibold [&+div]:text-xs",r),...s})});S.displayName=m.hE.displayName;let w=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,a.jsx)(m.VY,{ref:t,className:(0,c.cn)("text-sm opacity-90",r),...s})});function T(){let{toasts:e}=(0,p.dj)();return(0,a.jsxs)(g,{children:[e.map(function(e){let{id:t,title:r,description:s,action:o,...l}=e;return(0,a.jsxs)(x,{...l,children:[(0,a.jsxs)("div",{className:"grid gap-1",children:[r&&(0,a.jsx)(S,{children:r}),s&&(0,a.jsx)(w,{children:s})]}),o,(0,a.jsx)(y,{})]},t)}),(0,a.jsx)(v,{})]})}w.displayName=m.VY.displayName;var z=r(6425),j=r(5539),E=r(9086);function N(){let{i18n:e,t}=(0,l.Bd)(),r=(e.language||"zh-CN").startsWith("en")?"en":"zh-CN",s=t=>a=>{if(a.preventDefault(),t!==r){e.changeLanguage(t);try{"u">typeof window&&window.localStorage.setItem("i18nextLng",t)}catch{}}};return(0,a.jsxs)("div",{className:"flex items-center gap-1 rounded-full bg-white/60 px-1 py-0.5 text-[11px] shadow-sm backdrop-blur-md dark:bg-slate-900/70",children:[(0,a.jsx)("button",{type:"button",onClick:s("zh-CN"),className:(0,c.cn)("rounded-full px-2 py-0.5 transition-colors","zh-CN"===r?"bg-slate-900 text-slate-50 dark:bg-slate-100 dark:text-slate-900":"text-slate-600 hover:bg-slate-200/70 dark:text-slate-300 dark:hover:bg-slate-800/70"),children:t("lang.zh")}),(0,a.jsx)("span",{className:"text-slate-400 dark:text-slate-500",children:"/"}),(0,a.jsx)("button",{type:"button",onClick:s("en"),className:(0,c.cn)("rounded-full px-2 py-0.5 transition-colors","en"===r?"bg-slate-900 text-slate-50 dark:bg-slate-100 dark:text-slate-900":"text-slate-600 hover:bg-slate-200/70 dark:text-slate-300 dark:hover:bg-slate-800/70"),children:t("lang.en")})]})}let L=(0,s.lazy)(()=>r.e("987").then(r.bind(r,670))),M=(0,s.lazy)(()=>Promise.all([r.e("538"),r.e("873")]).then(r.bind(r,4704))),R="tree-shaking-theme";(0,o.createRoot)(document.getElementById("root")).render((0,a.jsx)(s.StrictMode,{children:(0,a.jsx)(n.I9,{children:(0,a.jsx)(function(){let{t:e}=(0,l.Bd)(),[t,r]=(0,s.useState)(()=>(function(){if("u"<typeof window)return"light";let e=window.localStorage.getItem(R);return"light"===e||"dark"===e?e:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"})()),[o,d]=(0,s.useState)(!1),[p,m]=(0,s.useState)(!1),f=(0,n.zy)();return(0,s.useEffect)(()=>{"u">typeof window&&m(!!window.localStorage.getItem("treeshake_mock_mode"))},[]),(0,s.useEffect)(()=>{"u">typeof document&&(document.documentElement.classList.toggle("dark","dark"===t),window.localStorage.setItem(R,t))},[t]),(0,a.jsxs)("div",{className:(0,c.cn)("min-h-screen text-slate-900 transition-colors duration-500 dark:text-slate-50","/analyze"===f.pathname?"bg-gradient-to-b from-sky-50 via-slate-50 to-slate-100 dark:from-slate-950 dark:via-slate-950 dark:to-slate-900":"bg-white dark:bg-slate-950"),children:["/analyze"===f.pathname&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-0 -z-10 h-64 bg-gradient-to-br from-sky-400/25 via-fuchsia-500/15 to-emerald-400/25 blur-3xl opacity-80"}),(0,a.jsx)("div",{className:"pointer-events-none absolute inset-y-0 right-0 -z-10 w-1/3 bg-gradient-to-tl from-sky-500/10 via-transparent to-emerald-500/10 blur-3xl"})]}),(0,a.jsxs)("div",{className:"relative mx-auto flex min-h-screen max-w-6xl flex-col px-4 pb-8 pt-6 md:px-8 md:pb-12 md:pt-10",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-tr from-sky-500 to-fuchsia-500 text-white shadow-lg shadow-sky-500/40",children:(0,a.jsx)(z.A,{className:"h-4 w-4"})}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-sm font-semibold tracking-tight",children:e("common.appName")}),(0,a.jsx)("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:e("common.appSubtitle")})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)(N,{}),p&&(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-full bg-white/60 px-3 py-1 text-xs shadow-sm backdrop-blur-md dark:bg-slate-900/70",children:[(0,a.jsx)("span",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:e("common.mockModeLabel")}),(0,a.jsx)(u,{checked:o,onCheckedChange:e=>d(!!e)}),(0,a.jsx)("span",{className:"text-[11px] text-emerald-600 dark:text-emerald-400",children:e(o?"common.mockModeLocal":"common.mockModeRemote")})]}),(0,a.jsx)(i.$,{type:"button",variant:"ghost",size:"icon","aria-label":e("common.themeToggleAria"),className:"h-9 w-9 rounded-full border border-slate-200/70 bg-white/70 shadow-sm backdrop-blur-md dark:border-slate-700 dark:bg-slate-900",onClick:()=>r(e=>"light"===e?"dark":"light"),children:"light"===t?(0,a.jsx)(j.A,{className:"h-4 w-4 text-slate-700"}):(0,a.jsx)(E.A,{className:"h-4 w-4 text-amber-300"})})]})]}),(0,a.jsx)("main",{className:"mt-8 flex flex-1 flex-col gap-8 md:mt-10",children:"/analyze"===f.pathname?(0,a.jsx)(s.Suspense,{fallback:(0,a.jsx)(h,{className:"h-40 w-full"}),children:(0,a.jsx)(M,{mockMode:o})}):"/"===f.pathname?(0,a.jsx)(s.Suspense,{fallback:(0,a.jsx)(h,{className:"h-40 w-full"}),children:(0,a.jsx)(L,{})}):null}),(0,a.jsx)("footer",{className:"mt-8 border-t border-slate-200/80 pt-4 text-[11px] text-slate-500 dark:border-slate-800/80 dark:text-slate-400",children:(0,a.jsx)("div",{className:"flex justify-center text-center",children:(0,a.jsx)("span",{className:"text-slate-400",children:e("footer.jsSafety")})})})]}),(0,a.jsx)(T,{})]})},{})})}))}},i={};function d(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,d),r.exports}d.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(r,a){if(1&a&&(r=this(r)),8&a||"object"==typeof r&&r&&(4&a&&r.__esModule||16&a&&"function"==typeof r.then))return r;var s=Object.create(null);d.r(s);var o={};e=e||[null,t({}),t([]),t(t)];for(var l=2&a&&r;("object"==typeof l||"function"==typeof l)&&!~e.indexOf(l);l=t(l))Object.getOwnPropertyNames(l).forEach(e=>{o[e]=()=>r[e]});return o.default=()=>r,d.d(s,o),s},d.d=(e,t)=>{for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce((t,r)=>(d.f[r](e,t),t),[])),d.u=e=>"static/js/async/"+e+"."+({538:"91f59a63",873:"03a2ef6b",987:"b6f87e58"})[e]+".js",d.miniCssF=e=>""+e+".css",d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},d.l=function(e,t,a,s){if(r[e])return void r[e].push(t);if(void 0!==a)for(var o,l,n=document.getElementsByTagName("script"),i=0;i<n.length;i++){var c=n[i];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@module-federation/treeshake-frontend:"+a){o=c;break}}o||(l=!0,(o=document.createElement("script")).timeout=120,d.nc&&o.setAttribute("nonce",d.nc),o.setAttribute("data-rspack","@module-federation/treeshake-frontend:"+a),o.src=e),r[e]=[t];var u=function(t,a){o.onerror=o.onload=null,clearTimeout(h);var s=r[e];if(delete r[e],o.parentNode&&o.parentNode.removeChild(o),s&&s.forEach(function(e){return e(a)}),t)return t(a)},h=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),l&&document.head.appendChild(o)},d.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.nc=void 0,a=[],d.O=(e,t,r,s)=>{if(t){s=s||0;for(var o=a.length;o>0&&a[o-1][2]>s;o--)a[o]=a[o-1];a[o]=[t,r,s];return}for(var l=1/0,o=0;o<a.length;o++){for(var[t,r,s]=a[o],n=!0,i=0;i<t.length;i++)(!1&s||l>=s)&&Object.keys(d.O).every(e=>d.O[e](t[i]))?t.splice(i--,1):(n=!1,s<l&&(l=s));if(n){a.splice(o--,1);var c=r();void 0!==c&&(e=c)}}return e},d.p="/tree-shaking/",s={410:0},d.f.j=function(e,t){var r=d.o(s,e)?s[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var a=new Promise((t,a)=>r=s[e]=[t,a]);t.push(r[2]=a);var o=d.p+d.u(e),l=Error();d.l(o,function(t){if(d.o(s,e)&&(0!==(r=s[e])&&(s[e]=void 0),r)){var a=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+a+": "+o+")",l.name="ChunkLoadError",l.type=a,l.request=o,r[1](l)}},"chunk-"+e,e)}},d.O.j=e=>0===s[e],o=(e,t)=>{var r,a,[o,l,n]=t,i=0;if(o.some(e=>0!==s[e])){for(r in l)d.o(l,r)&&(d.m[r]=l[r]);if(n)var c=n(d)}for(e&&e(t);i<o.length;i++)a=o[i],d.o(s,a)&&s[a]&&s[a][0](),s[a]=0;return d.O(c)},(l=self.webpackChunk_module_federation_treeshake_frontend=self.webpackChunk_module_federation_treeshake_frontend||[]).forEach(o.bind(null,0)),l.push=o.bind(null,l.push.bind(l));var c=d.O(void 0,["783","535","465"],()=>d(9864));c=d.O(c)})();
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! For license information please see lib-router.79263654.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.webpackChunk_module_federation_treeshake_frontend=self.webpackChunk_module_federation_treeshake_frontend||[]).push([["535"],{4678(e,t,n){n.d(t,{I9:()=>em,Zp:()=>F,zy:()=>O});var r=n(2155),a="popstate";function o(e,t){if(!1===e||null==e)throw Error(t)}function i(e,t){if(!e){"u">typeof console&&console.warn(t);try{throw Error(t)}catch(e){}}}function l(e,t){return{usr:e.state,key:e.key,idx:t}}function u(e,t,n=null,r){return{pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?c(t):t,state:n,key:t&&t.key||r||Math.random().toString(36).substring(2,10)}}function s({pathname:e="/",search:t="",hash:n=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function c(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function h(e,t=!1){let n="http://localhost";"u">typeof window&&(n="null"!==window.location.origin?window.location.origin:window.location.href),o(n,"No window.location.(origin|href) available to create URL");let r="string"==typeof e?e:s(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function d(e,t,n="/"){return function(e,t,n,r){let a=g(("string"==typeof t?c(t):t).pathname||"/",n);if(null==a)return null;let l=function e(t,n=[],r=[],a=""){let i=(t,i,l)=>{var u,s;let c,h,d={relativePath:void 0===l?t.path||"":l,caseSensitive:!0===t.caseSensitive,childrenIndex:i,route:t};d.relativePath.startsWith("/")&&(o(d.relativePath.startsWith(a),`Absolute route path "${d.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(a.length));let f=b([a,d.relativePath]),g=r.concat(d);t.children&&t.children.length>0&&(o(!0!==t.index,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),e(t.children,n,g,f)),(null!=t.path||t.index)&&n.push({path:f,score:(u=f,s=t.index,h=(c=u.split("/")).length,c.some(m)&&(h+=-2),s&&(h+=2),c.filter(e=>!m(e)).reduce((e,t)=>e+(p.test(t)?3:""===t?1:10),h)),routesMeta:g})};return t.forEach((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let n of function e(t){let n=t.split("/");if(0===n.length)return[];let[r,...a]=n,o=r.endsWith("?"),i=r.replace(/\?$/,"");if(0===a.length)return o?[i,""]:[i];let l=e(a.join("/")),u=[];return u.push(...l.map(e=>""===e?i:[i,e].join("/"))),o&&u.push(...l),u.map(e=>t.startsWith("/")&&""===e?"/":e)}(e.path))i(e,t,n);else i(e,t)}),n}(e);l.sort((e,t)=>{var n,r;return e.score!==t.score?t.score-e.score:(n=e.routesMeta.map(e=>e.childrenIndex),r=t.routesMeta.map(e=>e.childrenIndex),n.length===r.length&&n.slice(0,-1).every((e,t)=>e===r[t])?n[n.length-1]-r[r.length-1]:0)});let u=null;for(let e=0;null==u&&e<l.length;++e){let t=function(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return i(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}(a);u=function(e,t,n=!1){let{routesMeta:r}=e,a={},o="/",i=[];for(let e=0;e<r.length;++e){let l=r[e],u=e===r.length-1,s="/"===o?t:t.slice(o.length)||"/",c=f({path:l.relativePath,caseSensitive:l.caseSensitive,end:u},s),h=l.route;if(!c&&u&&n&&!r[r.length-1].route.index&&(c=f({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},s)),!c)return null;Object.assign(a,c.params),i.push({params:a,pathname:b([o,c.pathname]),pathnameBase:x(b([o,c.pathnameBase])),route:h}),"/"!==c.pathnameBase&&(o=b([o,c.pathnameBase]))}return i}(l[e],t,r)}return u}(e,t,n,!1)}new WeakMap;var p=/^:[\w-]+$/,m=e=>"*"===e;function f(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=function(e,t=!1,n=!0){i("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),a+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":""!==e&&"/"!==e&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let o=a[0],l=o.replace(/(.)\/+$/,"$1"),u=a.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if("*"===t){let e=u[r]||"";l=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}let a=u[r];return n&&!a?e[t]=void 0:e[t]=(a||"").replace(/%2F/g,"/"),e},{}),pathname:o,pathnameBase:l,pattern:e}}function g(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function y(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function v(e){let t=e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function w(e,t,n,r=!1){let a,i;"string"==typeof e?a=c(e):(o(!(a={...e}).pathname||!a.pathname.includes("?"),y("?","pathname","search",a)),o(!a.pathname||!a.pathname.includes("#"),y("#","pathname","hash",a)),o(!a.search||!a.search.includes("#"),y("#","search","hash",a)));let l=""===e||""===a.pathname,u=l?"/":a.pathname;if(null==u)i=n;else{let e=t.length-1;if(!r&&u.startsWith("..")){let t=u.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}i=e>=0?t[e]:"/"}let s=function(e,t="/"){var n;let r,{pathname:a,search:o="",hash:i=""}="string"==typeof e?c(e):e;return{pathname:a?a.startsWith("/")?a:(n=a,r=t.replace(/\/+$/,"").split("/"),n.split("/").forEach(e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)}),r.length>1?r.join("/"):"/"):t,search:C(o),hash:E(i)}}(a,i),h=u&&"/"!==u&&u.endsWith("/"),d=(l||"."===u)&&n.endsWith("/");return!s.pathname.endsWith("/")&&(h||d)&&(s.pathname+="/"),s}var b=e=>e.join("/").replace(/\/\/+/g,"/"),x=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),C=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",E=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";function R(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}Symbol("ResetLoaderData");var $=r.createContext(null);$.displayName="DataRouter";var S=r.createContext(null);S.displayName="DataRouterState";var L=r.createContext({isTransitioning:!1});L.displayName="ViewTransition",r.createContext(new Map).displayName="Fetchers",r.createContext(null).displayName="Await";var k=r.createContext(null);k.displayName="Navigation";var P=r.createContext(null);P.displayName="Location";var N=r.createContext({outlet:null,matches:[],isDataRoute:!1});N.displayName="Route";var W=r.createContext(null);function A(){return null!=r.useContext(P)}function O(){return o(A(),"useLocation() may be used only in the context of a <Router> component."),r.useContext(P).location}W.displayName="RouteError";var M="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function T(e){r.useContext(k).static||r.useLayoutEffect(e)}function F(){let{isDataRoute:e}=r.useContext(N);return e?function(){let e,{router:t}=(o(e=r.useContext($),B("useNavigate")),e),n=H("useNavigate"),a=r.useRef(!1);return T(()=>{a.current=!0}),r.useCallback(async(e,r={})=>{i(a.current,M),a.current&&("number"==typeof e?t.navigate(e):await t.navigate(e,{fromRouteId:n,...r}))},[t,n])}():function(){o(A(),"useNavigate() may be used only in the context of a <Router> component.");let e=r.useContext($),{basename:t,navigator:n}=r.useContext(k),{matches:a}=r.useContext(N),{pathname:l}=O(),u=JSON.stringify(v(a)),s=r.useRef(!1);return T(()=>{s.current=!0}),r.useCallback((r,a={})=>{if(i(s.current,M),!s.current)return;if("number"==typeof r)return void n.go(r);let o=w(r,JSON.parse(u),l,"path"===a.relative);null==e&&"/"!==t&&(o.pathname="/"===o.pathname?t:b([t,o.pathname])),(a.replace?n.replace:n.push)(o,a.state,a)},[t,n,u,l,e])}()}function _(e,{relative:t}={}){let{matches:n}=r.useContext(N),{pathname:a}=O(),o=JSON.stringify(v(n));return r.useMemo(()=>w(e,JSON.parse(o),a,"path"===t),[e,o,a,t])}r.createContext(null);var U=r.createElement(function(){let e,t,n,a=(e=r.useContext(W),t=I("useRouteError"),n=H("useRouteError"),void 0!==e?e:t.errors?.[n]),o=R(a)?`${a.status} ${a.statusText}`:a instanceof Error?a.message:JSON.stringify(a),i=a instanceof Error?a.stack:null,l="rgba(200,200,200, 0.5)",u={padding:"2px 4px",backgroundColor:l},s=null;return console.error("Error handled by React Router default ErrorBoundary:",a),s=r.createElement(r.Fragment,null,r.createElement("p",null,"\uD83D\uDCBF Hey developer \uD83D\uDC4B"),r.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",r.createElement("code",{style:u},"ErrorBoundary")," or"," ",r.createElement("code",{style:u},"errorElement")," prop on your route.")),r.createElement(r.Fragment,null,r.createElement("h2",null,"Unexpected Application Error!"),r.createElement("h3",{style:{fontStyle:"italic"}},o),i?r.createElement("pre",{style:{padding:"0.5rem",backgroundColor:l}},i):null,s)},null),D=class extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?r.createElement(N.Provider,{value:this.props.routeContext},r.createElement(W.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function j({routeContext:e,match:t,children:n}){let a=r.useContext($);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),r.createElement(N.Provider,{value:e},n)}function B(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function I(e){let t=r.useContext(S);return o(t,B(e)),t}function H(e){let t,n=(o(t=r.useContext(N),B(e)),t),a=n.matches[n.matches.length-1];return o(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}var z={};function J(e,t,n){t||z[e]||(z[e]=!0,i(!1,n))}function Y({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:l,static:u=!1}){o(!A(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),h=r.useMemo(()=>({basename:s,navigator:l,static:u,future:{}}),[s,l,u]);"string"==typeof n&&(n=c(n));let{pathname:d="/",search:p="",hash:m="",state:f=null,key:y="default"}=n,v=r.useMemo(()=>{let e=g(d,s);return null==e?null:{location:{pathname:e,search:p,hash:m,state:f,key:y},navigationType:a}},[s,d,p,m,f,y,a]);return(i(null!=v,`<Router basename="${s}"> is not able to match the URL "${d}${p}${m}" because it does not start with the basename, so the <Router> won't render anything.`),null==v)?null:r.createElement(k.Provider,{value:h},r.createElement(P.Provider,{children:t,value:v}))}r.memo(function({routes:e,future:t,state:n}){return function(e,t,n,a){let l;o(A(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:u}=r.useContext(k),{matches:s}=r.useContext(N),h=s[s.length-1],p=h?h.params:{},m=h?h.pathname:"/",f=h?h.pathnameBase:"/",g=h&&h.route;{let e=g&&g.path||"";J(m,!g||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
3
|
+
|
|
4
|
+
Please change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}let y=O();if(t){let e="string"==typeof t?c(t):t;o("/"===f||e.pathname?.startsWith(f),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=y;let v=l.pathname||"/",w=v;if("/"!==f){let e=f.replace(/^\//,"").split("/");w="/"+v.replace(/^\//,"").split("/").slice(e.length).join("/")}let x=d(e,{pathname:w});i(g||null!=x,`No routes matched location "${l.pathname}${l.search}${l.hash}" `),i(null==x||void 0!==x[x.length-1].route.element||void 0!==x[x.length-1].route.Component||void 0!==x[x.length-1].route.lazy,`Matched leaf route at location "${l.pathname}${l.search}${l.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let C=function(e,t=[],n=null,a=null){if(null==e){if(!n)return null;if(n.errors)e=n.matches;else{if(0!==t.length||n.initialized||!(n.matches.length>0))return null;e=n.matches}}let i=e,l=n?.errors;if(null!=l){let e=i.findIndex(e=>e.route.id&&l?.[e.route.id]!==void 0);o(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),i=i.slice(0,Math.min(i.length,e+1))}let u=!1,s=-1;if(n)for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:r}=n,a=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||void 0===r[t.route.id]);if(t.route.lazy||a){u=!0,i=s>=0?i.slice(0,s+1):[i[0]];break}}}return i.reduceRight((e,a,o)=>{let c,h=!1,d=null,p=null;n&&(c=l&&a.route.id?l[a.route.id]:void 0,d=a.route.errorElement||U,u&&(s<0&&0===o?(J("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,p=null):s===o&&(h=!0,p=a.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,o+1)),f=()=>{let t;return t=c?d:h?p:a.route.Component?r.createElement(a.route.Component,null):a.route.element?a.route.element:e,r.createElement(j,{match:a,routeContext:{outlet:e,matches:m,isDataRoute:null!=n},children:t})};return n&&(a.route.ErrorBoundary||a.route.errorElement||0===o)?r.createElement(D,{location:n.location,revalidation:n.revalidation,component:d,error:c,children:f(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):f()},null)}(x&&x.map(e=>Object.assign({},e,{params:Object.assign({},p,e.params),pathname:b([f,u.encodeLocation?u.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?f:b([f,u.encodeLocation?u.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])})),s,n,a);return t&&C?r.createElement(P.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...l},navigationType:"POP"}},C):C}(e,void 0,n,t)}),r.Component;var K="get",V="application/x-www-form-urlencoded";function q(e){return null!=e&&"string"==typeof e.tagName}var X=null,Z=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function G(e){return null==e||Z.has(e)?e:(i(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${V}"`),null)}function Q(e,t){if(!1===e||null==e)throw Error(t)}async function ee(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function et(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"==typeof e.imageSrcSet&&"string"==typeof e.imageSizes:"string"==typeof e.rel&&"string"==typeof e.href)}async function en(e,t,n){var r;let a,o;return r=(await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await ee(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(et).filter(e=>"stylesheet"===e.rel||"preload"===e.rel).map(e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"}),a=new Set,o=new Set(void 0),r.reduce((e,t)=>{!1;let n=JSON.stringify(function(e){let t={};for(let n of Object.keys(e).sort())t[n]=e[n];return t}(t));return a.has(n)||(a.add(n),e.push({key:n,link:t})),e},[])}function er(e,t,n,r,a,o){let i=(e,t)=>!n[t]||e.route.id!==n[t].route.id,l=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith("*")&&n[t].params["*"]!==e.params["*"];return"assets"===o?t.filter((e,t)=>i(e,t)||l(e,t)):"data"===o?t.filter((t,o)=>{let u=r.routes[t.route.id];if(!u||!u.hasLoader)return!1;if(i(t,o)||l(t,o))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"==typeof r)return r}return!0}):[]}function ea(e,t,{includeHydrateFallback:n}={}){return[...new Set(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let a=[r.module];return r.clientActionModule&&(a=a.concat(r.clientActionModule)),r.clientLoaderModule&&(a=a.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(a=a.concat(r.hydrateFallbackModule)),r.imports&&(a=a.concat(r.imports)),a}).flat(1))]}Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),"u">typeof window&&window,Symbol("SingleFetchRedirect");var eo=new Set([100,101,204,205]);function ei(){let e=r.useContext($);return Q(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function el(){let e=r.useContext(S);return Q(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}r.Component;var eu=r.createContext(void 0);function es(){let e=r.useContext(eu);return Q(e,"You must render this element inside a <HydratedRouter> element"),e}function ec(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function eh({page:e,...t}){let{router:n}=ei(),a=r.useMemo(()=>d(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?r.createElement(ed,{page:e,matches:a,...t}):null}function ed({page:e,matches:t,...n}){let a=O(),{manifest:o,routeModules:i}=es(),{basename:l}=ei(),{loaderData:u,matches:s}=el(),c=r.useMemo(()=>er(e,t,s,o,a,"data"),[e,t,s,o,a]),h=r.useMemo(()=>er(e,t,s,o,a,"assets"),[e,t,s,o,a]),d=r.useMemo(()=>{let n;if(e===a.pathname+a.search+a.hash)return[];let r=new Set,s=!1;if(t.forEach(e=>{let t=o.routes[e.route.id];t&&t.hasLoader&&(!c.some(t=>t.route.id===e.route.id)&&e.route.id in u&&i[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:r.add(e.route.id))}),0===r.size)return[];let h=("/"===(n="string"==typeof e?new URL(e,"u"<typeof window?"server://singlefetch/":window.location.origin):e).pathname?n.pathname="_root.data":l&&"/"===g(n.pathname,l)?n.pathname=`${l.replace(/\/$/,"")}/_root.data`:n.pathname=`${n.pathname.replace(/\/$/,"")}.data`,n);return s&&r.size>0&&h.searchParams.set("_routes",t.filter(e=>r.has(e.route.id)).map(e=>e.route.id).join(",")),[h.pathname+h.search]},[l,u,a,o,c,t,e,i]),p=r.useMemo(()=>ea(h,o),[h,o]),m=function(e){let{manifest:t,routeModules:n}=es(),[a,o]=r.useState([]);return r.useEffect(()=>{let r=!1;return en(e,t,n).then(e=>{r||o(e)}),()=>{r=!0}},[e,t,n]),a}(h);return r.createElement(r.Fragment,null,d.map(e=>r.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...n})),p.map(e=>r.createElement("link",{key:e,rel:"modulepreload",href:e,...n})),m.map(({key:e,link:t})=>r.createElement("link",{key:e,...t})))}eu.displayName="FrameworkContext";var ep="u">typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{ep&&(window.__reactRouterVersion="7.6.1")}catch(e){}function em({basename:e,children:t,window:n}){let o=r.useRef();null==o.current&&(o.current=function(e={}){return function(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,c="POP",d=null,p=m();function m(){return(s.state||{idx:null}).idx}function f(){c="POP";let e=m(),t=null==e?null:e-p;p=e,d&&d({action:c,location:g.location,delta:t})}null==p&&(p=0,s.replaceState({...s.state,idx:p},""));let g={get action(){return c},get location(){return e(o,s)},listen(e){if(d)throw Error("A history only accepts one active listener");return o.addEventListener(a,f),d=e,()=>{o.removeEventListener(a,f),d=null}},createHref:e=>t(o,e),createURL:function(e){return h(e)},encodeLocation(e){let t=h(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){c="PUSH";let r=u(g.location,e,t);n&&n(r,e);let a=l(r,p=m()+1),h=g.createHref(r);try{s.pushState(a,"",h)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;o.location.assign(h)}i&&d&&d({action:c,location:g.location,delta:1})},replace:function(e,t){c="REPLACE";let r=u(g.location,e,t);n&&n(r,e);let a=l(r,p=m()),o=g.createHref(r);s.replaceState(a,"",o),i&&d&&d({action:c,location:g.location,delta:0})},go:e=>s.go(e)};return g}(function(e,t){let{pathname:n="/",search:r="",hash:a=""}=c(e.location.hash.substring(1));return n.startsWith("/")||n.startsWith(".")||(n="/"+n),u("",{pathname:n,search:r,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||"default")},function(e,t){let n=e.document.querySelector("base"),r="";if(n&&n.getAttribute("href")){let t=e.location.href,n=t.indexOf("#");r=-1===n?t:t.slice(0,n)}return r+"#"+("string"==typeof t?t:s(t))},function(e,t){i("/"===e.pathname.charAt(0),`relative pathnames are not supported in hash history.push(${JSON.stringify(t)})`)},e)}({window:n,v5Compat:!0}));let d=o.current,[p,m]=r.useState({action:d.action,location:d.location}),f=r.useCallback(e=>{r.startTransition(()=>m(e))},[m]);return r.useLayoutEffect(()=>d.listen(f),[d,f]),r.createElement(Y,{basename:e,children:t,location:p.location,navigationType:p.action,navigator:d})}var ef=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,eg=r.forwardRef(function({onClick:e,discover:t="render",prefetch:n="none",relative:a,reloadDocument:l,replace:u,state:c,target:h,to:d,preventScrollReset:p,viewTransition:m,...f},y){let v,{basename:w}=r.useContext(k),x="string"==typeof d&&ef.test(d),C=!1;if("string"==typeof d&&x&&(v=d,ep))try{let e=new URL(window.location.href),t=new URL(d.startsWith("//")?e.protocol+d:d),n=g(t.pathname,w);t.origin===e.origin&&null!=n?d=n+t.search+t.hash:C=!0}catch(e){i(!1,`<Link to="${d}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let E=function(e,{relative:t}={}){o(A(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=r.useContext(k),{hash:i,pathname:l,search:u}=_(e,{relative:t}),s=l;return"/"!==n&&(s="/"===l?n:b([n,l])),a.createHref({pathname:s,search:u,hash:i})}(d,{relative:a}),[R,$,S]=function(e,t){let n=r.useContext(eu),[a,o]=r.useState(!1),[i,l]=r.useState(!1),{onFocus:u,onBlur:s,onMouseEnter:c,onMouseLeave:h,onTouchStart:d}=t,p=r.useRef(null);r.useEffect(()=>{if("render"===e&&l(!0),"viewport"===e){let e=new IntersectionObserver(e=>{e.forEach(e=>{l(e.isIntersecting)})},{threshold:.5});return p.current&&e.observe(p.current),()=>{e.disconnect()}}},[e]),r.useEffect(()=>{if(a){let e=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(e)}}},[a]);let m=()=>{o(!0)},f=()=>{o(!1),l(!1)};return n?"intent"!==e?[i,p,{}]:[i,p,{onFocus:ec(u,m),onBlur:ec(s,f),onMouseEnter:ec(c,m),onMouseLeave:ec(h,f),onTouchStart:ec(d,m)}]:[!1,p,{}]}(n,f),L=function(e,{target:t,replace:n,state:a,preventScrollReset:o,relative:i,viewTransition:l}={}){let u=F(),c=O(),h=_(e,{relative:i});return r.useCallback(r=>{0!==r.button||t&&"_self"!==t||r.metaKey||r.altKey||r.ctrlKey||r.shiftKey||(r.preventDefault(),u(e,{replace:void 0!==n?n:s(c)===s(h),state:a,preventScrollReset:o,relative:i,viewTransition:l}))},[c,u,h,n,a,t,e,o,i,l])}(d,{replace:u,state:c,target:h,preventScrollReset:p,relative:a,viewTransition:m}),P=r.createElement("a",{...f,...S,href:v||E,onClick:C||l?e:function(t){e&&e(t),t.defaultPrevented||L(t)},ref:function(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}}(y,$),target:h,"data-discover":x||"render"!==t?void 0:"true"});return R&&!x?r.createElement(r.Fragment,null,P,r.createElement(eh,{page:E})):P});eg.displayName="Link",r.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:a=!1,style:i,to:l,viewTransition:u,children:s,...c},h){let d,p=_(l,{relative:c.relative}),m=O(),y=r.useContext(S),{navigator:v,basename:w}=r.useContext(k),b=null!=y&&function(e,t={}){let n=r.useContext(L);o(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=ey("useViewTransitionState"),i=_(e,{relative:t.relative});if(!n.isTransitioning)return!1;let l=g(n.currentLocation.pathname,a)||n.currentLocation.pathname,u=g(n.nextLocation.pathname,a)||n.nextLocation.pathname;return null!=f(i.pathname,u)||null!=f(i.pathname,l)}(p)&&!0===u,x=v.encodeLocation?v.encodeLocation(p).pathname:p.pathname,C=m.pathname,E=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;t||(C=C.toLowerCase(),E=E?E.toLowerCase():null,x=x.toLowerCase()),E&&w&&(E=g(E,w)||E);let R="/"!==x&&x.endsWith("/")?x.length-1:x.length,$=C===x||!a&&C.startsWith(x)&&"/"===C.charAt(R),P=null!=E&&(E===x||!a&&E.startsWith(x)&&"/"===E.charAt(x.length)),N={isActive:$,isPending:P,isTransitioning:b},W=$?e:void 0;d="function"==typeof n?n(N):[n,$?"active":null,P?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let A="function"==typeof i?i(N):i;return r.createElement(eg,{...c,"aria-current":W,className:d,ref:h,style:A,to:l,viewTransition:u},"function"==typeof s?s(N):s)}).displayName="NavLink",r.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:i,state:l,method:u=K,action:c,onSubmit:h,relative:d,preventScrollReset:p,viewTransition:m,...f},y)=>{let v=function(){let{router:e}=ey("useSubmit"),{basename:t}=r.useContext(k),n=H("useRouteId");return r.useCallback(async(r,a={})=>{let{action:o,method:i,encType:l,formData:u,body:s}=function(e,t){let n,r,a,o,i;if(q(e)&&"form"===e.tagName.toLowerCase()){let i=e.getAttribute("action");r=i?g(i,t):null,n=e.getAttribute("method")||K,a=G(e.getAttribute("enctype"))||V,o=new FormData(e)}else if(q(e)&&"button"===e.tagName.toLowerCase()||q(e)&&"input"===e.tagName.toLowerCase()&&("submit"===e.type||"image"===e.type)){let i=e.form;if(null==i)throw Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||i.getAttribute("action");if(r=l?g(l,t):null,n=e.getAttribute("formmethod")||i.getAttribute("method")||K,a=G(e.getAttribute("formenctype"))||G(i.getAttribute("enctype"))||V,o=new FormData(i,e),!function(){if(null===X)try{new FormData(document.createElement("form"),0),X=!1}catch(e){X=!0}return X}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";o.append(`${e}x`,"0"),o.append(`${e}y`,"0")}else t&&o.append(t,r)}}else if(q(e))throw Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');else n=K,r=null,a=V,i=e;return o&&"text/plain"===a&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}(r,t);if(!1===a.navigate){let t=a.fetcherKey||`__${String(++ev)}__`;await e.fetch(t,n,a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:s,formMethod:a.method||i,formEncType:a.encType||l,flushSync:a.flushSync})}else await e.navigate(a.action||o,{preventScrollReset:a.preventScrollReset,formData:u,body:s,formMethod:a.method||i,formEncType:a.encType||l,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[e,t,n])}(),w=function(e,{relative:t}={}){let{basename:n}=r.useContext(k),a=r.useContext(N);o(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),l={..._(e||".",{relative:t})},u=O();if(null==e){l.search=u.search;let e=new URLSearchParams(l.search),t=e.getAll("index");if(t.some(e=>""===e)){e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));let n=e.toString();l.search=n?`?${n}`:""}}return(!e||"."===e)&&i.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),"/"!==n&&(l.pathname="/"===l.pathname?n:b([n,l.pathname])),s(l)}(c,{relative:d}),x="get"===u.toLowerCase()?"get":"post",C="string"==typeof c&&ef.test(c);return r.createElement("form",{ref:y,method:x,action:w,onSubmit:a?h:e=>{if(h&&h(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,a=r?.getAttribute("formmethod")||u;v(r||e.currentTarget,{fetcherKey:t,method:a,navigate:n,replace:i,state:l,relative:d,preventScrollReset:p,viewTransition:m})},...f,"data-discover":C||"render"!==e?void 0:"true"})}).displayName="Form";function ey(e){var t;let n=r.useContext($);return o(n,(t=e,`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`)),n}var ev=0;[...eo]}}]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/treeshake-server",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "Build service powered by Hono that installs dependencies, builds with Rspack, and uploads artifacts.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"hono": "4.12.7",
|
|
31
31
|
"json-stable-stringify": "1.3.0",
|
|
32
32
|
"nanoid": "5.1.6",
|
|
33
|
-
"p-limit": "
|
|
33
|
+
"p-limit": "7.2.0",
|
|
34
34
|
"pino": "10.1.0",
|
|
35
35
|
"undici": "6.23.0",
|
|
36
36
|
"zod": "4.1.12"
|