Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default new Api({
config,
prefix: "tacoscript-transpose",
loader: {
pluginProp: "transpose",
generatorPluginProp: "tacotruck", // TODO: should be moved to read the generator's name
rcFileName: ".tacorc",
ignoreFileName: ".tacoignore",
packageKey: "tacoscript",
pluginModulePrefix: "tacoscript",
presetModulePrefix: "tacoscript"
},
parser: {
name: babylonpkg.name,
version: babylonpkg.version,
parse: babylon.parse
},
parserOpts: function(opts) {
return {
sourceType: opts.sourceType,
filename: opts.filename,
features: {}
};
},
// TODO: allow multiple generators, with a default
generator: tacotruck,
generatorOpts: function(opts) {
return {
...opts.generate,
filename: opts.filename,
plugins: opts.generatorPlugins
'Babylon'() {
const { parse } = req('babylon');
return {
version: isWorker ? '' : require('babylon/package.json').version,
parse
};
},
};
settings: settings => settings.plugins || defaultOptions.plugins,
values: plugins => defaultOptions.plugins.reduce(
(obj, name) => ((obj[name] = plugins.indexOf(name) > -1), obj),
{}
),
},
],
};
export default {
...defaultParserInterface,
...base,
id: ID,
displayName: ID,
version: pkg.version,
homepage: pkg.homepage,
locationProps: new Set(['loc', 'start', 'end']),
load() {
return Promise.resolve({parse});
},
parse(babylon, code, options) {
return babylon.parse(code, {...defaultOptions, ...options});
},
getNodeName(node) {
switch (typeof node.type) {
case 'string':
return node.type;
case 'object':
}
plugins = {...plugins};
delete plugins[name];
return plugins;
},
},
],
};
export default {
...defaultParserInterface,
...base,
id: ID,
displayName: ID,
version: pkg.version,
homepage: pkg.homepage,
locationProps: new Set(['loc', 'start', 'end']),
load() {
return Promise.resolve({parse});
},
parse(babylon, code, parserSettings) {
return babylon.parse(
code,
{...defaultOptions, ...parserSettings}
);
},
getNodeName(node) {
switch (typeof node.type) {