babel/packages/babylon/src/options.js
Daniel Lo Nigro 0076204f80 Fix Flow.
Removed `@flow` annotation from files that don't actually pass Flow check at the moment. These will be added back file by file once the files are properly converted to use Flow.

Closes #3064
2015-11-15 21:30:22 -08:00

30 lines
878 B
JavaScript
Executable File

// A second optional argument can be given to further configure
// the parser process. These options are recognized:
export const defaultOptions = {
// Source type ("script" or "module") for different semantics
sourceType: "script",
// When enabled, a return at the top level is not considered an
// error.
allowReturnOutsideFunction: false,
// When enabled, import/export statements are not constrained to
// appearing at the top of the program.
allowImportExportEverywhere: false,
// TODO
allowSuperOutsideMethod: false,
// An array of plugins to enable
plugins: [],
// TODO
strictMode: null,
};
// Interpret and default an options object
export function getOptions(opts?: Object): Object {
let options = {};
for (let key in defaultOptions) {
options[key] = opts && key in opts ? opts[key] : defaultOptions[key];
}
return options;
}