ankesu / dsh-client-url-shim

목록에 있음

Browser url shim for DeepSeek Harness client bundles: inlines a node:url polyfill (parse/resolve/format/URL) so dependencies like @pixi/utils build and run in the web module table. · DSH 客户端构建的 url 浏览器垫片

main도구 소스 보기

설치

npx -y @deepseek-ai/dsh plugin --profile web add github:ankesu/dsh-client-url-shim

이 설치 명령은 GitHub 저장소 주소에서 생성된 확인되지 않은 시작점입니다.

README

유지 관리자가 작성한 문서 스냅샷입니다.

GitHub에서 보기 ↗
커밋 27b5b12동기화 2026. 8. 18.

dsh-client-url-shim

Browser url shim for DeepSeek Harness client bundles — a tsdown plugin that inlines a node:url polyfill so dependencies like @pixi/utils build and run inside the DSH web module table.

DSH 客户端 bundle 的 url 浏览器垫片——把依赖里 node:url 的导入替换成浏览器安全实现, 解决 require("url") missed the module table 崩溃。

Problem / 问题

DSH client bundles are CJS artifacts executed by the harness's own module loader. The loader only answers requires from a frozen module table (platform seed modules). A dependency that imports Node builtins — e.g. @pixi/utils does import { parse } from 'url' — compiles to require("url"), which the table cannot answer:

client-modules: require("url") missed the module table — not a platform seed
word, not a shell-own module, and no registered factory

DSH 客户端 bundle 由 DSH 自己的模块加载器执行,只认冻结的模块表。依赖里 import node:url 会编译成 require("url"),模块表没有 url → 整个插件加载失败。

Solution / 方案

A small tsdown/Rolldown plugin intercepts url / node:url imports at build time and replaces them with a virtual browser-safe module:

  • parse — Node-style URL decomposition (falls back to new URL)
  • resolve — Node-style path resolution (absolute → URL, relative → join with .. handling)
  • format — best-effort href/pathname serialization
  • fileURLToPath / pathToFileURL — trivial browser equivalents
  • URL / URLSearchParams — the real browser globals

Usage / 用法

// tsdown.config.ts
import { defineConfig } from 'tsdown'
import { urlShim } from 'dsh-client-url-shim'

export default defineConfig({
  entry: { client: 'src/client/index.ts' },
  format: 'cjs',
  platform: 'browser',
  plugins: [urlShim()],
})

Or add the plugin object directly to an existing tsdown plugins array (see example/tsdown.config.ts for a full DSH plugin client build).

Verified with / 实测验证

  • DSH (DeepSeek Harness) web profile, tsdown 0.22.2 / rolldown 1.1.5
  • @pixi/utils 6.5.10 (import { parse } from 'url') — the exact dependency that blew up before the shim
  • pixi.js 6.5.10 + pixi-live2d-display 0.4.0 fully inlined client bundle, ~1.5 MB, boots and renders in the harness

How the shim was born / 来历

Built in an isolated test profile after a live1d table crash — the first of nine mines cleared while integrating Live2D into DSH. Full war story in the companion blog post (TBD).

License

MIT

프로젝트 파일 및 신호

표시된 항목은 디렉터리 스냅샷에서 감지된 공개 저장소 신호입니다.

예제감지됨

저장소 정보

언어
JavaScript
라이선스
MIT
마지막 업데이트
2026. 8. 16. 오후 4:31

신중하게 설치하기

소스 코드, 권한, 수명 주기 스크립트, 의존성 및 네트워크 접근을 검토하고 신뢰하지 않는 플러그인은 격리 환경에서 테스트하세요.