Rocky_Mountain_Vending/.pnpm-store/v10/files/1a/8d07a1177abf5a1da64533268e7229e7c5b2a6e438d10e8f9da84d28efed99954a2cc764f17a05c9bcbfa92adfdeca392f32e226f544d3a6e1678479951bc7
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

73 lines
No EOL
2.8 KiB
Text

import getWebpackBundler from '../shared/lib/get-webpack-bundler';
function generateStats(result, stat) {
const { errors, warnings } = stat.toJson({
preset: 'errors-warnings',
moduleTrace: true
});
if (errors && errors.length > 0) {
result.errors.push(...errors);
}
if (warnings && warnings.length > 0) {
result.warnings.push(...warnings);
}
return result;
}
// Webpack 5 requires the compiler to be closed (to save caches)
// Webpack 4 does not have this close method so in order to be backwards compatible we check if it exists
function closeCompiler(compiler) {
return new Promise((resolve, reject)=>{
// @ts-ignore Close only exists on the compiler in webpack 5
return compiler.close((err)=>err ? reject(err) : resolve());
});
}
export function runCompiler(config, { runWebpackSpan, inputFileSystem }) {
return new Promise((resolve, reject)=>{
const compiler = getWebpackBundler()(config);
// Ensure we use the previous inputFileSystem
if (inputFileSystem) {
compiler.inputFileSystem = inputFileSystem;
}
compiler.fsStartTime = Date.now();
compiler.run((err, stats)=>{
const webpackCloseSpan = runWebpackSpan.traceChild('webpack-close', {
name: config.name || 'unknown'
});
webpackCloseSpan.traceAsyncFn(()=>closeCompiler(compiler)).then(()=>{
if (err) {
const reason = err.stack ?? err.toString();
if (reason) {
return resolve([
{
errors: [
{
message: reason,
details: err.details
}
],
warnings: [],
stats
},
compiler.inputFileSystem
]);
}
return reject(err);
} else if (!stats) throw Object.defineProperty(new Error('No Stats from webpack'), "__NEXT_ERROR_CODE", {
value: "E370",
enumerable: false,
configurable: true
});
const result = webpackCloseSpan.traceChild('webpack-generate-error-stats').traceFn(()=>generateStats({
errors: [],
warnings: [],
stats
}, stats));
return resolve([
result,
compiler.inputFileSystem
]);
});
});
});
}
//# sourceMappingURL=compiler.js.map