Update npm packages (73 packages including @jqhtml 2.3.36)
Update npm registry domain from privatenpm.hanson.xyz to npm.internal.hanson.xyz 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
30
node_modules/webpack/lib/schemes/VirtualUrlPlugin.js
generated
vendored
30
node_modules/webpack/lib/schemes/VirtualUrlPlugin.js
generated
vendored
@@ -58,17 +58,19 @@ function normalizeModule(virtualConfig) {
|
||||
return virtualConfig;
|
||||
}
|
||||
|
||||
/** @typedef {{ [key: string]: VirtualModuleConfig }} NormalizedModules */
|
||||
|
||||
/**
|
||||
* Normalizes all virtual modules with the given scheme
|
||||
* @param {VirtualModules} virtualConfigs The virtual modules to normalize
|
||||
* @param {string} scheme The URL scheme to use
|
||||
* @returns {{ [key: string]: VirtualModuleConfig }} The normalized virtual modules
|
||||
* @returns {NormalizedModules} The normalized virtual modules
|
||||
*/
|
||||
function normalizeModules(virtualConfigs, scheme) {
|
||||
return Object.keys(virtualConfigs).reduce((pre, id) => {
|
||||
pre[toVid(id, scheme)] = normalizeModule(virtualConfigs[id]);
|
||||
return pre;
|
||||
}, /** @type {{ [key: string]: VirtualModuleConfig }} */ ({}));
|
||||
}, /** @type {NormalizedModules} */ ({}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +107,9 @@ class VirtualUrlPlugin {
|
||||
* @param {string=} scheme The URL scheme to use
|
||||
*/
|
||||
constructor(modules, scheme) {
|
||||
/** @type {string} */
|
||||
this.scheme = scheme || DEFAULT_SCHEME;
|
||||
/** @type {NormalizedModules} */
|
||||
this.modules = normalizeModules(modules, this.scheme);
|
||||
}
|
||||
|
||||
@@ -122,6 +126,27 @@ class VirtualUrlPlugin {
|
||||
compiler.hooks.compilation.tap(
|
||||
PLUGIN_NAME,
|
||||
(compilation, { normalModuleFactory }) => {
|
||||
compilation.hooks.assetPath.tap(
|
||||
{ name: PLUGIN_NAME, before: "TemplatedPathPlugin" },
|
||||
(path, data) => {
|
||||
if (data.filename && this.modules[data.filename]) {
|
||||
/**
|
||||
* @param {string} str path
|
||||
* @returns {string} safe path
|
||||
*/
|
||||
const toSafePath = (str) =>
|
||||
`__${str
|
||||
.replace(/:/g, "__")
|
||||
.replace(/^[^a-z0-9]+|[^a-z0-9]+$/gi, "")
|
||||
.replace(/[^a-z0-9._-]+/gi, "_")}`;
|
||||
|
||||
// filename: virtual:logo.svg -> __virtual__logo.svg
|
||||
data.filename = toSafePath(data.filename);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
);
|
||||
|
||||
normalModuleFactory.hooks.resolveForScheme
|
||||
.for(scheme)
|
||||
.tap(PLUGIN_NAME, (resourceData) => {
|
||||
@@ -135,6 +160,7 @@ class VirtualUrlPlugin {
|
||||
const type = virtualConfig.type;
|
||||
resourceData.path = path + type;
|
||||
resourceData.resource = path;
|
||||
resourceData.context = compiler.context;
|
||||
|
||||
if (virtualConfig.version) {
|
||||
const cacheKey = toCacheKey(resourceData.resource, scheme);
|
||||
|
||||
Reference in New Issue
Block a user