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

add: import decoded sourcemaps from SourceMapGenerator #5732

Merged
merged 6 commits into from
Nov 30, 2020

Conversation

milahu
Copy link
Contributor

@milahu milahu commented Nov 29, 2020

fix #5722 in a performant way

@milahu milahu force-pushed the add-import-SourceMapGenerator branch from f9b87f6 to 9788885 Compare November 29, 2020 15:50
@benmccann
Copy link
Member

this looks pretty good to me. thanks for the fix!

@milahu
Copy link
Contributor Author

milahu commented Nov 30, 2020

avoided commit-squash to reduce diffs .. i assume maintainers can sqash commits?

@Conduitry
Copy link
Member

How much of this code is taken from another project? Can we update this to follow Svelte's snake case naming conventions? Do we think there are likely to be upstream changes we want to manually pull in, and would using different variables make that more difficult?

@milahu
Copy link
Contributor Author

milahu commented Nov 30, 2020

Can we update this to follow Svelte's snake case naming conventions?

sure. only thing we must keep are the property names, like originalLine, originalColumn

which one is less horrible?
decodedSourcemap_from_SourceMapGenerator
decoded_sourcemap_from_source_map_generator
dsmap_from_smgen

DecodedSourcemap and SourceMapGenerator are types

upstream changes

very unlikely, last release 3 years ago = abandoned

@benmccann
Copy link
Member

decodedSourcemap_from_SourceMapGenerator

let's not mix cases 😄 (though I understand the reason it was proposed)

decoded_sourcemap_from_source_map_generator

this is the best of the proposed options in my opinion. though strange that it has both sourcemap and source_map in the name

dsmap_from_smgen

I would have no idea how to read this

Can I propose a new option of decoded_from_generator? I think that it's clear we're working with sourcemaps here, so could drop that from the name for brevity. If there were any doubt we could add a jsdoc to say something like "Decodes a source map from source map generator"

@milahu
Copy link
Contributor Author

milahu commented Nov 30, 2020

dsmap_from_smgen

I would have no idea how to read this

dee-ess-mapp-from-ess-emm-genn .... easy ; )

I think that it's clear we're working with sourcemaps here

sourcemaps and strings ..

what about decoded_sourcemap_from_generator?

@benmccann
Copy link
Member

decoded_sourcemap_from_generator sounds good to me

}
function convertMappings() {
// use global variable: generator
let previousGeneratedLine = 1;
Copy link
Member

Choose a reason for hiding this comment

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

I think Conduitry was also asking if we could rename all the other variables and functions to use snake_case rather than camelCase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I'm not quite sure how to interpret. I guess you are going to bed. Will you rename the variables later?

Copy link
Member

Choose a reason for hiding this comment

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

I've pushed a commit to rename these and to also do some other tidying up and inlining of functions that are just called once. I'm aiming to merge this today and take a look for anything else screaming to be merged and then cut a release. Although this is technically a new feature, I'm thinking of still releasing this as a patch release.

Copy link
Member

@benmccann benmccann left a comment

Choose a reason for hiding this comment

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

lgtm. thanks for the quick fix! really excited about this new feature!

@Conduitry Conduitry merged commit 3d68cea into sveltejs:master Nov 30, 2020
taylorzane pushed a commit to taylorzane/svelte that referenced this pull request Dec 17, 2020
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.

Error in preprocessor sourcemapping: "Cannot read property 'length' of undefined"
4 participants