Support for `import(blobUrls)`
未关闭
还没有人认领这个 Issue。
feature request
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 2 小时
- 30 天内合并 PR
- 283
描述
What is the problem this feature will solve?
The same thing that vm.SourceTextModule(yourCodeString, { identifier, context }) does, but in a way compatible with other JS runtimes.
Useful for implementing extensions, for example.
What is the feature you are proposing to solve the problem?
Compatibilty with other JS runtimes when it comes to import() and blob URLs.
Example code:
code = 'console.log("hi")'
blob = new Blob([code], { type: 'text/javascript' })
url = URL.createObjectURL(blob)
import(url)
References:
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import
- https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static
- https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/blob
What alternatives have you considered?
vm.SourceTextModule(yourCodeString, { identifier, context })
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从提议的 import(url) 示例开始,并将其与 vm.SourceTextModule(yourCodeString, { identifier, context }) 进行比较。检查所引用的 import()、URL.createObjectURL() 和 blob URL 行为,以定义兼容性目标。当示例在 Node.js 中使用由 Blob 创建的 JavaScript URL 正常工作,并且与相关运行时行为一致时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, node.js
- 领域
- backend
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100