Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
throw new Error(
'Conflicting babel versions found in .babelrc. Make sure all of your plugins and presets depend on the same major version of babel.',
);
}
version = range;
break;
}
}
}
// Find the maximum major version allowed in the range and use that.
// e.g. if ^6 || ^7 were specified, use 7.
version = getMaxMajor(version);
if (!version) {
logger.warn(
`Could not infer babel version. Defaulting to babel 7. Please add either babel-core or @babel/core as a dependency.`,
);
version = 7;
}
return version;
}
};
let filename, args, res;
try {
[filename, ...args] = path
.get('arguments')
.map(arg => evaluate(arg, vars));
filename = Path.resolve(filename);
res = fs.readFileSync(filename, ...args);
} catch (err) {
if (err instanceof NodeNotEvaluatedError) {
// Warn using a code frame
err.fileName = asset.name;
asset.generateErrorMessage(err);
logger.warn(err);
return;
}
// Add location info so we log a code frame with the error
err.loc =
path.node.arguments.length > 0
? path.node.arguments[0].loc.start
: path.node.loc.start;
throw err;
}
let replacementNode;
if (Buffer.isBuffer(res)) {
replacementNode = bufferTemplate({
CONTENT: t.stringLiteral(res.toString('base64')),
ENC: t.stringLiteral('base64'),
.on('data', (message: YarnStdErrMessage) => {
switch (message.type) {
case 'warning':
logger.warn({
origin: '@parcel/package-manager',
message: prefix(message.data),
});
return;
case 'error':
logger.error({
origin: '@parcel/package-manager',
message: prefix(message.data),
});
return;
default:
// ignore
}
});
throw new Error(
'Conflicting babel versions found in .babelrc. Make sure all of your plugins and presets depend on the same major version of babel.'
);
}
version = range;
break;
}
}
}
// Find the maximum major version allowed in the range and use that.
// e.g. if ^6 || ^7 were specified, use 7.
version = getMaxMajor(version);
if (!version) {
logger.warn(
`Could not infer babel version. Defaulting to babel 7. Please add either babel-core or @babel/core as a dependency.`
);
version = 7;
}
return version;
}
);
if (!pkg) {
return;
}
try {
let deps = Object.assign({}, pkg.dependencies, pkg.devDependencies);
for (let dep in deps) {
const pattern = /^(@.*\/)?parcel-plugin-.+/;
if (pattern.test(dep)) {
let plugin = await localRequire(dep, relative);
await plugin(this);
}
}
} catch (err) {
logger.warn(err);
}
};
bus.on('logEvent', (e: LogEvent) => {
switch (e.level) {
case 'info':
invariant(typeof e.message === 'string');
Logger.info(e.message);
break;
case 'progress':
invariant(typeof e.message === 'string');
Logger.progress(e.message);
break;
case 'verbose':
invariant(typeof e.message === 'string');
Logger.verbose(e.message);
break;
case 'warn':
Logger.warn(e.message);
break;
case 'error':
Logger.error(e.message);
break;
default:
throw new Error('Unknown log level');
}
});
}
collectDependencies() {
if (!this.options.publicURL.startsWith('http')) {
logger.warn(
"Please specify a publicURL using --public-url, otherwise schema assets won't be collected",
);
return;
}
for (let schemaKey in this.ast) {
if (SCHEMA_ATTRS.includes(schemaKey)) {
this.collectFromKey(this.ast, schemaKey);
this.isAstDirty = true;
}
}
}
bundler.on('buildEnd', () => logger.warn('Manifest creation disabled'));
return;