michangarrito/apps/backend/node_modules/webpack/lib/schemes/DataUriPlugin.js
rckrdmrd 48dea7a5d0 feat: Initial commit - michangarrito
Marketplace móvil para negocios locales mexicanos.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React Web)
- apps/mobile (Expo/React Native)
- apps/mcp-server (Claude MCP Server)
- apps/whatsapp-service (WhatsApp Business API)
- database/ (PostgreSQL DDL)
- docs/ (Documentación)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:41:02 -06:00

48 lines
1.2 KiB
JavaScript

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const NormalModule = require("../NormalModule");
const { URIRegEx, decodeDataURI } = require("../util/dataURL");
/** @typedef {import("../Compiler")} Compiler */
const PLUGIN_NAME = "DataUriPlugin";
class DataUriPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
normalModuleFactory.hooks.resolveForScheme
.for("data")
.tap(PLUGIN_NAME, (resourceData) => {
const match = URIRegEx.exec(resourceData.resource);
if (match) {
resourceData.data.mimetype = match[1] || "";
resourceData.data.parameters = match[2] || "";
resourceData.data.encoding = /** @type {"base64" | false} */ (
match[3] || false
);
resourceData.data.encodedContent = match[4] || "";
}
});
NormalModule.getCompilationHooks(compilation)
.readResourceForScheme.for("data")
.tap(PLUGIN_NAME, (resource) => decodeDataURI(resource));
}
);
}
}
module.exports = DataUriPlugin;