-
Notifications
You must be signed in to change notification settings - Fork 29
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
Allow setting compiler options in node/index.js. #95
Conversation
node/caching-compiler.js
Outdated
@@ -48,7 +48,7 @@ const fallbackPkgInfo = { | |||
cache: Object.create(null) | |||
}; | |||
|
|||
function readWithCache(info, content) { | |||
function readWithCache(info, content, options) { | |||
const json = info && info.json; | |||
const reify = json && json.reify; | |||
const cacheFilename = getCacheFilename(content, reify); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new options should probably be included in the hash computed by getCacheFilename
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don' think getCacheFilename
is using any options at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the options might affect the compiler output, and we want getCacheFilename
to return different names for different versions of the compiled code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, I see what you're saying. Do you want to include that in a patch to simplify the hash bit or do it here?
Rebased. |
node/compile-hook.js
Outdated
@@ -5,14 +5,20 @@ const compiler = require("./caching-compiler.js"); | |||
const Module = require("./runtime.js").Module; | |||
const Mp = Module.prototype; | |||
|
|||
let overrideCompileOptions = {}; | |||
|
|||
module.exports = (options) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also update the exports
variable in this assignment, just in case we ever accidentally use that in this module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you're asking. Can you give an example. Added it!
This PR is a take at allowing the node/index.js to accept compiler option overrides.
It allows:
The interface could be different though, this is just an initial take on it.
Related to #91.