Rich-Harris / sorcery

Resolve a chain of sourcemaps back to the original source, like magic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No intermediate files

opened this issue · comments

I am using rollup to generate iifes for several sub directories, and then using source-map-concat to stitch them all together. This works great, and I'd like to use sorcery on top of this process, however, currently my whole process uses strings, from rollup on, the final one being injected into a script tag in an electron page, and no intermediate files are generated.

Is there any way to use sorcery with this workflow or will I be forced to generate intermediate files?

Not currently, no. Agree that it probably makes sense though!

Big +1 on this. :)

sorcery([
  minifiedCode, // with inline source map
  {content: transformedCode, sourcemap: babelSourceMap},
  sourceCode,
])

Would the source filename be required for this?

As long as the last sourcemap in the chain has correct sources, there shouldn't be a need to pass the original filename (or its source code) into sorcery.

let map = sorcery([
  minifiedCode, // inlined source map
  {content: transformedCode, map: babelSourceMap},
])

You will need to set map.file before calling toString, though.

My fork of sorcery is now a major refactor of this repo.

I stripped out the CLI and anything filesystem-related.

It caters more to build tools, which work with in-memory files most often. So while intermediate files are supported, they are not the default.