Rich-Harris / sorcery

Resolve a chain of sourcemaps back to the original source, like magic
314 stars 36 forks source link

Synchronous apis don't work correctly #172

Open aandis opened 6 years ago

aandis commented 6 years ago

Async version

sorcery.load('app.min.js').then( function ( chain ) {
  chain.write( '/tmp/out.js', {
    includeContent: true
  });
});

Source Map:

  "sourcesContent":["\"use strict\";\n\n/..."]

Sync version

var chain = sorcery.loadSync('app.min.js');
var map = chain.apply();
chain.writeSync('/tmp/out.js', { includeContent: true });

Source map

"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]
aandis commented 6 years ago

Also, when using either apis, the sources generated are absolute paths.

"sources":["../../home/user/projects/app/assets/source.js"]

Any ideas why that is?

aleclarson commented 6 years ago

FWIW, my fork does not have these issues, but it also has an entirely new API. :)

aandis commented 6 years ago

@aleclarson thanks for the pointer. Does the fork retain synchrounous api functionalities from this?

aleclarson commented 6 years ago

@aandis Yeah. In fact, the async API has been discarded, since sorcery is typically used in development only (and it makes things a little easier for me to maintain).

aandis commented 6 years ago

Thank you. I'll check that out. I think this repo is mostly unmaintained now.

aleclarson commented 6 years ago

@aandis I think @Rich-Harris is just a really busy dude these days. :)