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

Unsable to merge 2 very simple source maps #6

Open
otakustay opened this issue May 5, 2018 · 1 comment
Open

Unsable to merge 2 very simple source maps #6

otakustay opened this issue May 5, 2018 · 1 comment

Comments

@otakustay
Copy link

I have 2 source maps generated from magic-string:

{
  version: 3,
  file: null,
  sources: [ 'test' ],
  sourcesContent: [ 'hello' ],
  names: [],
  mappings: 'AAAA' 
}

{
  version: 3,
  file: null,
  sources: [ 'test' ],
  sourcesContent: [ 'hellosome tail string' ],
  names: [],
  mappings: 'AAAA'
}

The transform steps are hello -> hellosome tail string -> hellosome tail stringsome tail string, each step appends some tail string to original input

When I try to merge them, I get the result:

{
  version: 3,
  sources: [ 'test' ],
  names: [],
  mappings: 'AAAA',
  sourcesContent: [ 'hellosome tail string' ] 
}

This is actually the second source map, and with this map I'm unable to recover the original string hello

I'm wondering whether it is the expected behaiovr?

@otakustay
Copy link
Author

I tried to revert the array of line 50 from [oldMapConsumer, newMapConsumer] to [newMapConsumer, oldMapConsumer] and this issue is fixed, the test coverage remains at 100% and all tests pass

If there is no other consideration with the order of this array, I'd like to add some test cases and create a PR for this

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

No branches or pull requests

1 participant