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

Conversation

Projects
None yet
2 participants
@atian25
Copy link
Member

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

@atian25 atian25 requested review from popomore , shepherdwind and whxaxes Apr 1, 2018

@atian25 atian25 referenced this pull request Apr 1, 2018

Closed

[RFC] TypeScript tool support #2272

24 of 28 tasks complete
@codecov

This comment has been minimized.

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 Apr 1, 2018

atian25 added some commits Apr 1, 2018

f
f
execArgvObj.require.push(require.resolve('source-map-support/register'));
}

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

This comment has been minimized.

@popomore

popomore Apr 2, 2018

Member

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

This comment has been minimized.

@atian25

atian25 Apr 2, 2018

Author Member
  • 这里其实一句 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'));

This comment has been minimized.

@popomore

popomore Apr 2, 2018

Member

ts 不支持 sourcemap?

This comment has been minimized.

@atian25

atian25 Apr 2, 2018

Author Member

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

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

@atian25

This comment has been minimized.

Copy link
Member Author

atian25 commented Apr 3, 2018

ping @popomore

@popomore popomore merged commit 6e3fef5 into master Apr 3, 2018

6 checks passed

WIP ready for review
Details
codecov/patch 100% of diff hit (target 100%)
Details
codecov/project 100% (+0%) compared to 0016e28
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
security/snyk No new issues
Details

@popomore popomore deleted the ts branch Apr 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment