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

feat: in-memory mode #170

Closed
wants to merge 2 commits into from
Closed

Conversation

aleclarson
Copy link

@aleclarson aleclarson commented May 13, 2018

This commit makes the default export of sorcery a function. You must pass an array whose items must be a string or an object. String items must be the source code of a file with an inline source map. Object items must have a content string property, and an optional map object property.

The sorcery function returns a SourceMap object. Its file property must be set before calling toJSON if its associated file will be saved somewhere on disk.

You can pass an options object as the second argument, which takes the
same options as Chain.prototype.apply.

Other changes made in this commit:

  • add sourceRoot property to SourceMap
  • add decode method to Node
  • use process.cwd() when node.file is null
  • check for node.map in the getMap function

Closes #166

This commit makes the default export of `sorcery` a function. You must pass an array whose items must be a string or an object. String items must be the source code of a file with an inline source map. Object items must have a `content` string property, and an optional `map` object property.

The `sorcery` function returns a SourceMap object. Its `file` property must be set before calling `toJSON` if its associated file will be saved somewhere on disk.

You can pass an options object as the second argument, which takes the
same options as `Chain.prototype.apply`.

Other changes made in this commit:
- add `sourceRoot` property to SourceMap
- add `decode` method to Node
- use process.cwd() when `node.file` is null
- check for `node.map` in the getMap function
This property is already set by getMap.
@aleclarson
Copy link
Author

aleclarson commented May 14, 2018

I should add options.resolve for resolving a source path (from the sources array of a sourcemap) into a content string or {content, map} object.

That would be useful if you do some transformations on individual files before concatenating them.

sorcery([
  // bundle sourcemaps go here
], {
  resolve(file) {
    // return {content, map} or a string here (supports async?)
  }
})

@aleclarson
Copy link
Author

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.

@aleclarson
Copy link
Author

I'm closing this, as I have no need for it to be merged anymore. 😄

@aleclarson aleclarson closed this May 25, 2018
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.

1 participant