repl icon indicating copy to clipboard operation
repl copied to clipboard

Feat: all cdn resources can be replaced

Open wangcch opened this issue 9 months ago • 4 comments

  • refactor(deps): @volar/jsdelivr -> local
  • feat(monaco): allow resources to be requested on demand without relying on jsdelivr-flat
  • feat(store): resourceLinks to custom cdn
const store = useStore({
  resourceLinks: ref({
      esModuleShims: 'https://registry.npmmirror.com/es-module-shims/1.5.18/files/dist/es-module-shims.wasm.js',
      pkgLatestVersionUrl: (pkgName: string) => `https://registry.npmmirror.com/${pkgName}/latest/files/package.json`,
      pkgDirUrl: (pkgName: string, pkgVersion: string, pkgPath: string) => `https://registry.npmmirror.com/${pkgName}/${pkgVersion}/files/${pkgPath}/?meta`,
      pkgFileTextUrl: (pkgName: string, pkgVersion: string | undefined, pkgPath: string) => `https://registry.npmmirror.com/${pkgName}/${pkgVersion || 'latest'}/files/${pkgPath}`,
      typescriptLib: (version) => `https://registry.npmmirror.com/typescript/${version}/files/lib/typescript.js`,
  }),
})
export type ResourceLinkConfigs = {
  esModuleShims?: string
  vueCompilerUrl?: (version: string) => string
  typescriptLib?: (version: string) => string

  // for monaco
  pkgLatestVersionUrl?: (pkgName: string) => string
  pkgDirUrl?: (pkgName: string, pkgVersion: string, pkgPath: string) => string
  pkgFileTextUrl?: (pkgName: string, pkgVersion: string | undefined, pkgPath: string) => string
}

close https://github.com/vuejs/repl/issues/280 https://github.com/vuejs/repl/issues/159

wangcch avatar Mar 04 '25 15:03 wangcch

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
repl Ready Ready Preview Comment Nov 25, 2025 1:55am

vercel[bot] avatar Mar 04 '25 15:03 vercel[bot]

Open in StackBlitz

npm i https://pkg.pr.new/@vue/repl@325

commit: 409347e

pkg-pr-new[bot] avatar Mar 04 '25 15:03 pkg-pr-new[bot]

LGTM. I feel we need add some docs for this feature.

edison1105 avatar Mar 10 '25 01:03 edison1105

Hi 👋 @edison1105 . Added some cases (unpkg, npmmirror) https://github.com/vuejs/repl/blob/feat-switch-npm-registry/README.md

wangcch avatar Mar 10 '25 13:03 wangcch

@wangcch Could you please resolve those conflicts?

edison1105 avatar Sep 04 '25 12:09 edison1105

@wangcch Could you please resolve those conflicts?

ok sorry, my progress is a bit behind schedule. 🙈

wangcch avatar Sep 09 '25 03:09 wangcch

@wangcch No worries, let's merge it in the next release.

edison1105 avatar Sep 09 '25 08:09 edison1105