Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const preinstalledDependencies =
sandpackConfig.preInstalledDependencies == null
? PREINSTALLED_DEPENDENCIES
: sandpackConfig.preInstalledDependencies;
if (templateDefinition.name === 'reason') {
returnedDependencies = {
...returnedDependencies,
'@jaredly/bs-core': '3.0.0-alpha.2',
'@jaredly/reason-react': '0.3.4',
};
}
// Always include this, because most sandboxes need this with babel6 and the
// packager will only include the package.json for it.
if (isBabel7(d, devDependencies)) {
returnedDependencies['@babel/runtime'] =
returnedDependencies['@babel/runtime'] || '7.3.1';
} else {
returnedDependencies['babel-runtime'] =
returnedDependencies['babel-runtime'] || '6.26.0';
}
// This is used for cache busting
returnedDependencies.csbbust = '1.0.0';
preinstalledDependencies.forEach(dep => {
if (returnedDependencies[dep]) {
delete returnedDependencies[dep];
}
});
const preinstalledDependencies =
sandpackConfig.preInstalledDependencies == null
? PREINSTALLED_DEPENDENCIES
: sandpackConfig.preInstalledDependencies;
if (templateDefinition.name === 'reason') {
returnedDependencies = {
...returnedDependencies,
'@jaredly/bs-core': '3.0.0-alpha.2',
'@jaredly/reason-react': '0.3.4',
};
}
// Always include this, because most sandboxes need this with babel6 and the
// packager will only include the package.json for it.
if (isBabel7(d, devDependencies)) {
returnedDependencies['@babel/runtime'] =
returnedDependencies['@babel/runtime'] || '7.3.1';
} else {
returnedDependencies['babel-runtime'] =
returnedDependencies['babel-runtime'] || '6.26.0';
}
// This is used for cache busting
returnedDependencies.csbbust = '1.0.0';
preinstalledDependencies.forEach(dep => {
if (returnedDependencies[dep]) {
delete returnedDependencies[dep];
}
});
const loaderOptions = loaderContext.options || {};
const dependencies =
(configs.package &&
configs.package.parsed &&
configs.package.parsed.dependencies) ||
{};
const devDependencies =
(configs.package &&
configs.package.parsed &&
configs.package.parsed.devDependencies) ||
{};
const isV7 =
loaderContext.options.isV7 || isBabel7(dependencies, devDependencies);
const hasMacros = Object.keys(dependencies).some(d =>
d.includes('macro')
);
const babelConfig = getBabelConfig(
foundConfig || (loaderOptions as any).config,
loaderOptions,
path,
isV7
);
this.queueTask(
{
code,
config: babelConfig,
setup: manager => {
const { configurations } = manager;
if (
isBabel7(
configurations &&
configurations.package &&
configurations.package.parsed &&
configurations.package.parsed.dependencies,
configurations &&
configurations.package &&
configurations.package.parsed &&
configurations.package.parsed.devDependencies
) &&
!v2Initialized
) {
const babelOptions = {
isV7: true,
compileNodeModulesWithEnv: true,
config: {
const loaderOptions = loaderContext.options || {};
const dependencies =
(configs.package &&
configs.package.parsed &&
configs.package.parsed.dependencies) ||
{};
const devDependencies =
(configs.package &&
configs.package.parsed &&
configs.package.parsed.devDependencies) ||
{};
const isV7 =
loaderContext.options.isV7 || isBabel7(dependencies, devDependencies);
const hasMacros = Object.keys(dependencies).some(
d => d.indexOf('macro') > -1
);
const babelConfig = getBabelConfig(
foundConfig || (loaderOptions as any).config,
loaderOptions,
path,
isV7
);
this.queueTask(
{
code,
config: babelConfig,