Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Causes observable changes with prepareStackTrace

未关闭
#8 9 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript
领域
tooling

调研方向

Start with the issue's Error.captureStackTrace and Error.prepareStackTrace example, then inspect the linked source-map-support implementation at source-map-support.js around line 397. Compare the observable ordering and evaluation-cost concerns described here; the work is complete when the proposal has a decided behavior and its compatibility implications are documented.

由索引模型根据 Issue 内容生成。

描述

When requiring the stack properties value to be eagerly evaluated in captureStackTrace there is a problematic interaction with the existing accompanying prepareStackTrace. That one allows arbitrarily formatting of the stack trace attached to the error object. This makes it observable when the string content of the stack property is computed.

The proposal here would require eager evaluation of the stack formatting code at captureStackTrace time. Whereas the current implementation does it lazily.

Error.prepareStackTrace = (error, stack) => {console.log("2. prepare")};
let err = {}; 
Error.captureStackTrace(err);
console.log("1. capture");
err.stack;

Here we would essentially have to swap the order of effect 1 and 2.

I think this is not just a theoretical issue. Next to an observable change in behavior it would also make the prepareStackTrace API prohibitively expensive to use.

There is evidence of effectfull and expensive prepareStackTrace handlers, see e.g., source-map-support for node.

主要语言
没有语言数据
星标
15
派生
5
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

tc39/proposal-error-capturestacktrace 的其他 Issue

查看 tc39/proposal-error-capturestacktrace 的全部 Issue

相似的 Issue

更多 DevTools Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。