Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await promiseFromProcess(installProcess);
let results: NPMResults = JSON.parse(stdout);
let addedCount = results.added.length;
if (addedCount > 0) {
logger.log({
origin: '@parcel/package-manager',
message: `Added ${addedCount} packages via npm`,
});
}
// Since we succeeded, stderr might have useful information not included
// in the json written to stdout. It's also not necessary to log these as
// errors as they often aren't.
for (let message of stderr) {
logger.log({
origin: '@parcel/package-manager',
message,
});
}
} catch (e) {
throw new Error('npm failed to install modules');
}
}
}
getPreprocessor(name, fallback) {
if (fs.existsSync(name)) {
// ensure forward slashes (windows)
return path.relative(this.name, name).substr(1).replace(/\\/g, '/');
}
try {
if (require.resolve(fallback)) {
return fallback;
}
} catch (e) {
logger.log(`${fallback} cannot be found, using default pipeline`);
}
return DEFAULT_PIPELINE;
}
'└── ' +
logger.chalk.dim(
`+ ${assets.length - largestAssets.length} more assets`,
),
]);
}
// If this isn't the last bundle, add an empty row before the next one
if (bundle !== bundles[bundles.length - 1]) {
rows.push([]);
}
}
}
// Render table
logger.log('');
logger.table(COLUMNS, rows);
}
globPatterns: [
'**/*.{js,css,html,png,jpg,jpeg,gif,tiff}'
],
importWorkboxFrom: 'disabled',
importScripts: [],
swDest: destination
}
const cfg = Object.assign(defaultConfig, config);
cfg.importScripts = cfg.importScripts.concat(this.importScripts);
logger.progress('Creating service worker...');
await workbox.generateSW(cfg);
logger.log('Service worker generated at: ' + cfg.swDest);
} catch (error) {
throw error;
}
}
this.server.once('listening', () => {
let addon =
this.server.address().port !== this.options.port
? `- configured port ${this.options.port.toString()} could not be used.`
: '';
logger.log(
`Server running at ${this.options.https ? 'https' : 'http'}://${this
.options.host || 'localhost'}:${
this.server.address().port
} ${addon}`
);
resolve(this.server);
});
});
globPatterns: [
'**/*.{js,css,html,png,jpg,jpeg,gif,tiff}'
],
swSrc: destination + ".tmp",
swDest: destination
}
const cfg = Object.assign(defaultConfig, config);
logger.progress('Injecting service worker manifest...');
fs.copySync(cfg.swDest, cfg.swDest + ".tmp");
let { count, size } = await workbox.injectManifest(cfg);
fs.unlinkSync(cfg.swDest + ".tmp");
logger.log('Service worker manifest injected at: ' + cfg.swDest);
logger.log(`Will precache ${count} files, totaling ${size} bytes.`);
} catch (error) {
throw error;
}
}
'**/*.{js,css,html,png,jpg,jpeg,gif,tiff}'
],
swSrc: destination + ".tmp",
swDest: destination
}
const cfg = Object.assign(defaultConfig, config);
logger.progress('Injecting service worker manifest...');
fs.copySync(cfg.swDest, cfg.swDest + ".tmp");
let { count, size } = await workbox.injectManifest(cfg);
fs.unlinkSync(cfg.swDest + ".tmp");
logger.log('Service worker manifest injected at: ' + cfg.swDest);
logger.log(`Will precache ${count} files, totaling ${size} bytes.`);
} catch (error) {
throw error;
}
}