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

support multistage sourcemap #2

Merged
merged 14 commits into from
Aug 28, 2014
Merged

Conversation

vvakame
Copy link
Member

@vvakame vvakame commented Aug 25, 2014

Trying to support multistage sourcemap
plan

  • replace espower-source to espower
  • implements initial multi stage sourcemap support
  • think about options. sourceRoot, mapRoot, and any others
  • improve tests. base64 format, external file format & 1:N file SourceMap
  • refactor
  • owner's review

@twada
Copy link
Member

twada commented Aug 25, 2014

@vvakame Great contribution! I'm looking forward to see this PR works well.

@vvakame
Copy link
Member Author

vvakame commented Aug 25, 2014

$ grunt demo
(omit)
Testing coffee_power_assert_demo_test.jsFFF
>> coffee - demo1
>> Message: MESSAGE # coffee_power_assert_demo_test.coffee:19
>>
>> test.ok(three === five, 'MESSAGE')
>>         |     |   |
>>         |     |   5
>>         3     false
>>
>> [number] five
>> => 5
>> [number] three
>> => 3
>>
>> Error: false == true
>>
>> test.ok(three === five, 'MESSAGE')
>>         |     |   |
>>         |     |   5
>>         3     false
>>
>> [number] five
>> => 5
>> [number] three
>> => 3
>>
>> at Decorator.concreteAssert (node_modules/empower/lib/decorator.js:60:21)
>> at Object.ok (node_modules/empower/lib/decorate.js:44:26)
>> at Object.exports.coffee.demo1 (../../src/tests/coffee_power_assert_demo_test.coffee:19:14)
>> at Object.exports.coffee.setUp (../../src/tests/coffee_power_assert_demo_test.coffee:10:9)
>> at Object.oncomplete (fs.js:107:15)

@twada I'll try add a typescript demo.
I have a question. power-assert-formatter are planned support for sourcemap?

@twada
Copy link
Member

twada commented Aug 25, 2014

@twada I'll try add a typescript demo.

Great!! 👍

I have a question. power-assert-formatter are planned support for sourcemap?

If we need to.

Currently, espower module appends extra information into the output, like this.

assert(assert._expr(assert._capt(falsy, 'arguments/0'), {
    content: 'assert(falsy)',
    filepath: 'test/fixtures/example.js',
    line: 4
}));

If upstream SourceMap is passed to espower as options.sourceMap,

  • line property is adjusted to originalPosition
  • filepath property is adjusted to corresponding source for mapping

When the information is not enough to display power-assert output later, we should plan to embed sourcemap itself into code or find another way.

@vvakame
Copy link
Member Author

vvakame commented Aug 26, 2014

grunt-espower works fine with TypeScript 😸

@twada
Copy link
Member

twada commented Aug 26, 2014

grunt-espower works fine with TypeScript 😸

Sounds great!!!

@vvakame
Copy link
Member Author

vvakame commented Aug 26, 2014

well done!

@twada
Copy link
Member

twada commented Aug 26, 2014

@vvakame Great Job!! I'll review this PR tomorrow.

@twada
Copy link
Member

twada commented Aug 27, 2014

LGTM

@twada
Copy link
Member

twada commented Aug 27, 2014

@vvakame functional testing has begun and unfortunately, something is wrong.
(Maybe sourcesContents is missing?)

So, please check output with debugger as below.

  1. (git clone https://github.com/twada/battlefield-sourcemaps.git)
  2. (cd battlefield-sourcemaps)
  3. npm link grunt-espower
  4. npm install
  5. (bower install)
  6. grunt grunt_espower
  7. gulp serve
  8. visit http://localhost:9001/build/grunt/grunt_espower/test.html with debugger

Thanks!

@vvakame
Copy link
Member Author

vvakame commented Aug 27, 2014

@twada fixed!

@twada
Copy link
Member

twada commented Aug 27, 2014

@vvakame Great! 👍

@twada
Copy link
Member

twada commented Aug 28, 2014

@twada twada changed the title [WIP] support multistage sourcemap support multistage sourcemap Aug 28, 2014
twada added a commit that referenced this pull request Aug 28, 2014
@twada twada merged commit 188cd40 into master Aug 28, 2014
twada added a commit that referenced this pull request Aug 28, 2014
@twada twada deleted the wip-support-multistage-sourcemap branch August 28, 2014 07:41
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.

None yet

2 participants