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

Error in array-set when producing source maps. #76

Closed
thlorenz opened this issue Aug 25, 2013 · 9 comments
Closed

Error in array-set when producing source maps. #76

thlorenz opened this issue Aug 25, 2013 · 9 comments

Comments

@thlorenz
Copy link

I created a repo to reproduce the issue here, but here is the stack trace, it basically breaks in ./lib/array-set.js.

/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/node_modules/source-map/lib/source-map/array-set.js:83
    throw new Error('No element indexed by ' + aIdx);
          ^
Error: No element indexed by 1
    at ArraySet_at [as at] (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/node_modules/source-map/lib/source-map/array-set.js:83:11)
    at SourceMapConsumer_parseMappings [as _parseMappings] (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/node_modules/source-map/lib/source-map/source-map-consumer.js:158:44)
    at new SourceMapConsumer (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/node_modules/source-map/lib/source-map/source-map-consumer.js:100:10)
    at module.exports (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/lib/mappings-from-map.js:10:18)
    at Combiner._addExistingMap (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/index.js:28:18)
    at Combiner.addFile (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/node_modules/combine-source-map/index.js:58:12)
    at Stream.write (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/browser-pack/index.js:42:23)
    at Stream.stream.write (/Users/thlorenz/dev/js/projects/es6ify/tmp/node_modules/browserify/node_modules/through/index.js:26:11)
    at Stream.ondata (stream.js:51:26)
    at Stream.EventEmitter.emit (events.js:95:17)
@fitzgen
Copy link
Contributor

fitzgen commented Aug 25, 2013

The source map we are trying to parse only has one source listed, but there is a mapping that refers to a second source (at index 1, presumably supposed to be bar.js). This is a bad source map. Looking into which library generates the bad source map (using this lib perhaps?).

{ version: 3,
  file: '/Users/fitzgen/src/repro-sourcemap-issue/foo.js.es6',
  sources: [ '/Users/fitzgen/src/repro-sourcemap-issue/foo.js' ],
  names: [],
  mappings: 'uBAAA,SAAA,CAAS,MAAA,CAAQ;AACL,KAAA,YAAA,EAAc,EAAA,CAAA,CAAI,KAAA,CAAM,MAAA,EAAQ,OAAA,CAAA,mBAA0B,CAAC,MAAA,CAAA;AAC/D,KAAA,EAAS,GAAA,EAAA,EAAI,EAAA,CAAG,EAAA,EAAI,MAAA,CAAA,MAAA,CAAc,EAAA,EAAA,CAAK;AACjC,OAAA,KAAA,EAAO,MAAA,CAAM,CAAA,CAAA;AACjB,eAAA,CAAY,IAAA,CAAA,EAAQ,OAAA,CAAA,wBAA+B,CAAC,MAAA,CAAQ,KAAA,CAAA;AAAA;AAE9D,QAAO,YAAA;AAAA,CAAA,2BCNf,SAAA,CAAS,MAAA,CAAQ,aAAA,CAAc;AACrB,KAAA,KAAA,EAAO,OAAA,CAAA,WAAA;AACX,QAAA,CAAA,cAAqB,CAAC,MAAA,CAAQ,cAAA,CAAe,EAAC,UAAA,CAAY,MAAA,CAAA,CAAA;AAC1D,MAAA,CAAA,SAAA,EAAiB,OAAA;AACjB,QAAA,CAAA,gBAAuB,CAAC,IAAA,CAAM,kBAAiB,CAAC,YAAA,CAAA,CAAA;AAChD,QAAO,KAAA;AAAA,CAAA;GCLP,MAAA,ECAN,SAAA,CAAS;AACH,cAAA;AACI,cAAoB,0BAAmB;AAFjD,eAAA,CAAa,SAAA,CAAS,CAAE,EAAA,CAAA;UDCpB,SAAA,CAAM,CAAE;AACJ,YAAO,KAAA;AAAA;AAAA,GAAA;ACET;CACD,CAAA,CAAA;ADAL,MAAA,CAAA,OAAA,EAAiB,MAAA',
  sourcesContent: [ 'class Hello {\n    greet() {\n        return "me";\n    }\n}\nmodule.exports = Hello;\n' ] }

@thlorenz
Copy link
Author

Oh so maybe the combined-source-map module is using source-map generator incorrectly. This may be related to the latest change to that module.

@ben-ng do you have an idea what could be going wrong here?

@fitzgen
Copy link
Contributor

fitzgen commented Aug 25, 2013

Aside: the combine-source-map module can get a lot smaller and dumber once we make progress with issue(s) 16/69

@thlorenz
Copy link
Author

@fitzgen Yeah those pieces in the works look interesting. combine-source-map will most likely just have to be a rather simple wrapper at that point.

I rolled back the change that caused the problem for now and am waiting for feedback from the author of that PR to see how to proceed. How long do you think until those mentioned changes land? Possibly we should wait with the combine-source-map migration to use this module until then?

@fitzgen
Copy link
Contributor

fitzgen commented Aug 27, 2013

@thlorenz It is fairly low priority on my TODO list; I'm spending 99% of my hack time on new features for firefox's debugger. If you want to take a crack at it, I will provide speedy review of pull requests :) We did end up deciding on an API in issue 16.

I am flying back to SF from Paris on Saturday, maybe I can take a crack at it then.

@thlorenz
Copy link
Author

Somewhat swamped myself here, but for me personally this is not such high priority either. As far as I understand the original change was attempted to fix problems with source-maps of minified code that @ben-ng ran into.
If this is more important for his module I'll leave this up to him ;)

@ben-ng
Copy link

ben-ng commented Aug 27, 2013

I've been on a road trip through the midwest, finally got back on the internet today.

Yes, this change is very important for my module so i'll fix this one. Thanks for helping with the repro case @thlorenz.

@thlorenz
Copy link
Author

@ben-ng nice!

@ben-ng
Copy link

ben-ng commented Sep 17, 2013

Okay, this issue is definitely in es6ify. I'll take care of it and send a PR now. Thank you for the repro case!

MohammadYounes referenced this issue in am11/WebEssentials2013 Sep 23, 2014
The problem is, when both rtlcss and autoprefixer
are enabled, it works fine with SCSS, but throws
with LESS.

When the code is too complicated,
the `result` object seems to have problem with
returning `result.css` member. When the code is
comparatively straight-forward, it throws a
slightly lenient error.

/cc @MohammadYounes
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

3 participants