lnuxe
lnuxe
### Skill Name **Kuikly / KuiklyUI** ### Why should we add the skill(s) to the project? KuiklyUI is Tencent's company-level open-source cross-platform UI framework built on Kotlin Multiplatform — one...
`getSyncUrl`(`packages/wujie-core/src/utils.ts`)还原短路径时无条件替换占位符,**prefix 里没有对应 key 时会把 `undefined` 当字符串拼进路径**。 ## 复现 ```ts // 主应用 url: ?app={unknown}/hello getSyncUrl('app', { prod: '/example/prod' }) // 实际: 'undefined/hello' // 期望: '' ``` 根因: ```ts if (prefix &&...
子应用销毁或失活后,`syncUrlToWindow` 会把自己的参数从主应用 url 上摘掉;**当参数表被清空时,url 末尾会多出一个孤立的 `?`**,并且被 `history.replaceState` 写进历史。 ## 复现 ```js // 主应用 url: /page?app=/sub syncUrlToWindow(iframeWindow) // iframeWindow.__WUJIE.sync = false // 实际: /page? // 期望: /page ``` 根因: ```ts const...
`processTpl` 解析模板时,第一个相对地址的 `` / `` 会走 `getEntirePath`: ```ts function getEntirePath(path, baseURI) { return new URL(path, baseURI).toString(); } ``` `new URL` 在 **baseURI 不是合法绝对地址**时会抛 `TypeError`,异常一路冒到 `entry.ts` 的 `loadApp` 里 —— 整份模板解析失败,子应用加载不出来。...
`getExternalScripts`(`packages/wujie-core/src/entry.ts`)按分支顺序决定脚本内容怎么来,**`ignore` 排在 `async`/`defer` 之后**,于是带 `async` 的 ignored 脚本仍然会被 wujie 拉取并执行,`jsIgnores` 对这类脚本完全不生效。 ## 复现 ```ts const fetch = jest.fn(() => Promise.resolve({ status: 200, text: async () => "code" })); const [res]...
默认插件里的 `cssRelativePathResolve`(`packages/wujie-core/src/plugin.ts`)会把子应用 css 里每个 `url()` 补成绝对地址,只跳过 `data:` 前缀,**`url(#id)` 这种文档内引用也被改写**,导致 SVG 渐变 / 滤镜 / 遮罩引用失效。 ## 复现 ```js const loader = getCssLoader({ plugins: [defaultPlugin], replace: (c) => c }); loader(".a{fill:url(#grad)}",...
`packages/wujie-core/src/utils.ts` 里有一组函数处在**每次代理访问的热路径**上,但 `__test__/unit/` 下没有任何用例覆盖它们。 ## 现状 把 `src/*.ts` 的 `export function` 逐个和 `__test__/unit/*.test.ts` 做引用比对后,`utils.ts` 中零覆盖的有: ```text toArray isFunction isHijackingTag isBoundedFunction isConstructable checkProxyFunction getTargetValue setAttrsToElement appRouteParse anchorElementGenerator getAnchorElementQueryMap getCurUrl getAbsolutePath compose...
`packages/wujie-core/src/shadow.ts` 里负责 **loading 挂载/还原** 和 **`:root` 规则迁移** 的三个函数没有测试,而它们都会改写用户的 DOM 与样式。 ## 无覆盖的函数 ```text addLoading(el, loading) 给容器加 loading,同时临时改容器的 position / overflow removeLoading(el) 还原上面改掉的两个样式 getPatchStyleElements(sheets) 把子应用样式表里的 :root 收集出来改写成 :host ``` `addLoading` 有三个分支,行为各不相同:...
`packages/wujie-core/src/sync.ts` 的 `processAppForHrefJump` 对**已经从查询串读出来的** href 又做了一次 `decodeURIComponent`,是双重解码。路径里带 `%` 时直接在 `popstate` 处理器里抛 `URIError`,子应用的前进/后退失效。 ## 复现 ```js // 子应用地址:http://x.com/sale/50%off // 主应用 url 参数里存的是编码后的值: window.history.replaceState(null, '', '/page?app=http%3A%2F%2Fx.com%2Fsale%2F50%25off') window.dispatchEvent(new PopStateEvent('popstate')) // 实际: Uncaught URIError:...
`packages/wujie-core/src/sync.ts` 的 `syncUrlToIframe` 没有任何测试,而它是**路由同步的读取侧** —— 主应用 url 参数 → 子应用路由的那一半。 ## 为什么这条线特别需要测试 `syncUrlToWindow` / `pushUrlToWindow` 写、`getSyncUrl` + `syncUrlToIframe` 读,共用同一份 `queryMap`,约定是「**读出来是 decoded,写回去才 encode**」。这个约定最近三个 PR 全都在它上面踩过: | 位置 | 曾经的问题 | |...