parse.nodeToString incorrectly calculates range #476

Closed
jrburke opened this Issue Jul 8, 2013 · 3 comments

Projects

None yet

2 participants

@jrburke
Member
jrburke commented Jul 8, 2013

In particular, if there is no comment or content above the requirejs.config call, it calculates the start value off by one as the preamble incorrectly includes as \n for zero line requirejs.config calls.

Found by @robdodson, in yeoman/grunt-bower-requirejs#36

@jrburke jrburke referenced this issue in yeoman/bower-requirejs Jul 8, 2013
Closed

RequireJS 2.1.7 breaks grunt-bower-requirejs #36

@jrburke jrburke closed this in 71b1c42 Jul 8, 2013
@jrburke
Member
jrburke commented Jul 8, 2013

Fixed in master, can be tested via the master link: https://raw.github.com/jrburke/r.js/master/dist/r.js

@also
also commented Jul 12, 2013

This still doesn't work well.

Given

requirejs({});

parse.nodeToString returns

{});

requirejs({}

Given

requirejs(
{});

parse.nodeToString returns

{});

{}

and finally, given

requirejs(
{}
);

parse.nodeToString returns

{}

{}

which is the only variation that works.

I was trying to use mainConfigFile with a file generated from JSON, so it had no line breaks.

@jrburke
Member
jrburke commented Jul 22, 2013

Putting it 2.1.9 bucket for evaluation.

@jrburke jrburke reopened this Jul 22, 2013
@jrburke jrburke closed this in efc79ed Oct 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment