Skip to content

feat: provides source map support for stack traces - #19

Merged
popomore merged 3 commits into
masterfrom
ts
Apr 3, 2018
Merged

feat: provides source map support for stack traces#19
popomore merged 3 commits into
masterfrom
ts

Conversation

@atian25

Copy link
Copy Markdown
Member
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

codecovBot commented Apr 1, 2018

Copy link
Copy Markdown

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 FilesCoverage Δ
lib/command.js100% <100%> (ø)⬆️
lib/cmd/start.js100% <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
atian25force-pushed the ts branch 3 times, most recently from fe1b61e to df712bcCompareApril 1, 2018 10:16
Comment threadlib/command.js
execArgvObj.require.push(require.resolve('source-map-support/register'));
}

argv.sourcemap = argv.typescript = argv.ts = undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@atian25atian25Apr 2, 2018

Copy link
Copy Markdown
MemberAuthor

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 。

Comment threadlib/command.js
// execArgv
if (argv.sourcemap) {
execArgvObj.require = execArgvObj.require || [];
execArgvObj.require.push(require.resolve('source-map-support/register'));

Copy link
Copy Markdown
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
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

ping @popomore

Sign up for freeto 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

@atian25@popomore