Rocky_Mountain_Vending/.pnpm-store/v10/files/54/74c2f0da163c37e60629caf524094d1537bcf5c464c262e3dc1e3131e462342cfe1ce518d71f365ad7520034ab345f7b10585fbd711257fba98158f131a192
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

52 lines
No EOL
2 KiB
Text

import { promises as fs } from 'fs';
import loaderUtils from 'next/dist/compiled/loader-utils3';
import { sources, webpack } from 'next/dist/compiled/webpack/webpack';
const PLUGIN_NAME = 'CopyFilePlugin';
export class CopyFilePlugin {
constructor({ filePath, cacheKey, name, info }){
this.filePath = filePath;
this.cacheKey = cacheKey;
this.name = name;
this.info = info;
}
apply(compiler) {
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation)=>{
const cache = compilation.getCache('CopyFilePlugin');
const hook = compilation.hooks.processAssets;
hook.tapPromise({
name: PLUGIN_NAME,
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
}, async ()=>{
if (cache) {
const cachedResult = await cache.getPromise(this.filePath, this.cacheKey);
if (cachedResult) {
const { file, source } = cachedResult;
compilation.emitAsset(file, source, {
...this.info
});
return;
}
}
const content = await fs.readFile(this.filePath, 'utf8');
const file = loaderUtils.interpolateName({
resourcePath: this.filePath
}, this.name, {
content,
context: compiler.context
});
const source = new sources.RawSource(content);
if (cache) {
await cache.storePromise(this.filePath, this.cacheKey, {
file,
source
});
}
compilation.emitAsset(file, source, {
...this.info
});
});
});
}
}
//# sourceMappingURL=copy-file-plugin.js.map