Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: provides source map support for stack traces #19

Merged
merged 3 commits into from
Apr 3, 2018
Merged

feat: provides source map support for stack traces #19

merged 3 commits into from
Apr 3, 2018

Conversation

atian25
Copy link
Member

@atian25 atian25 commented Apr 1, 2018

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

@codecov
Copy link

codecov bot commented Apr 1, 2018

Codecov Report

Merging #19 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #19   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           6      6           
  Lines         169    187   +18     
=====================================
+ Hits          169    187   +18
Impacted Files Coverage Δ
lib/command.js 100% <100%> (ø) ⬆️
lib/cmd/start.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0016e28...3571d58. Read the comment docs.

@atian25 atian25 force-pushed the ts branch 3 times, most recently from fe1b61e to df712bc Compare April 1, 2018 10:16
execArgvObj.require.push(require.resolve('source-map-support/register'));
}

argv.sourcemap = argv.typescript = argv.ts = undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面改造一下,需要哪些参数直接赋值,不然这种代码太多了。

Copy link
Member Author

@atian25 atian25 Apr 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 这里其实一句 argv.sourcemap = undefined 也够了。 上面有个 https://github.com/eggjs/egg-scripts/blob/ts/lib/command.js#L16 会自动删除别名。
  • 之前的想法是,上层业务框架可能会自定义一些入参,这里更倾向于黑名单机制,也就是明确在工具层用的入参,在这里删掉。否则白名单机制的话,上层业务框架就要定制 egg-scripts 。

// execArgv
if (argv.sourcemap) {
execArgvObj.require = execArgvObj.require || [];
execArgvObj.require.push(require.resolve('source-map-support/register'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts 不支持 sourcemap?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts 支持生成 sourcemap,这里是用来根据 sourcemap 还原堆栈的。可以看看 https://zhuanlan.zhihu.com/p/26267678

之前这个 require 都是放到 config 或 app.js agent.js ,或者放框架。
现在这个 PR 是直接在工具层引入了。

@atian25
Copy link
Member Author

atian25 commented Apr 3, 2018

ping @popomore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants