hatch-surf/node_modules/next/dist/esm/build/webpack/loaders/next-flight-css-loader.js
Riley Zhang df378d33ef
Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Merge GitHub main into Gitea repo (allow unrelated histories)
Resolved conflicts by taking GitHub versions for:
- .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml

Kept deploy.sh updated to:
- Pull from GitHub (primary source)
- Push to Gitea (push-mirror)
- Build from site/ directory (GitHub structure)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-25 05:20:46 +02:00

41 lines
1.7 KiB
JavaScript

/**
* For server-side CSS imports, we need to ignore the actual module content but
* still trigger the hot-reloading diff mechanism. So here we put the content
* inside a comment.
*/ import crypto from 'crypto';
const NextServerCSSLoader = function(content) {
this.cacheable && this.cacheable();
const options = this.getOptions();
let isCSSModule = options.cssModules;
// Only add the checksum during development.
if (process.env.NODE_ENV !== 'production') {
// This check is only for backwards compatibility.
// TODO: Remove this in the next major version (next 14)
if (isCSSModule === undefined) {
this.emitWarning(Object.defineProperty(new Error("No 'cssModules' option was found for the next-flight-css-loader plugin."), "__NEXT_ERROR_CODE", {
value: "E8",
enumerable: false,
configurable: true
}));
isCSSModule = this.resourcePath.match(/\.module\.(css|sass|scss)$/) !== null;
}
const checksum = crypto.createHash('sha1').update(typeof content === 'string' ? Buffer.from(content) : content).digest().toString('hex').substring(0, 12);
if (isCSSModule) {
return `\
${content}
module.exports.__checksum = ${JSON.stringify(checksum)}
`;
}
// Server CSS imports are always available for HMR, so we attach
// `module.hot.accept()` to the generated module.
const hmrCode = 'if (module.hot) { module.hot.accept() }';
return `\
export default ${JSON.stringify(checksum)}
${hmrCode}
`;
}
return content;
};
export default NextServerCSSLoader;
//# sourceMappingURL=next-flight-css-loader.js.map