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:
59
node_modules/webpack/lib/schemes/HttpUriPlugin.js
generated
vendored
59
node_modules/webpack/lib/schemes/HttpUriPlugin.js
generated
vendored
@@ -36,12 +36,20 @@ const getHttps = memoize(() => require("https"));
|
||||
|
||||
const MAX_REDIRECTS = 5;
|
||||
|
||||
/** @typedef {(url: URL, requestOptions: RequestOptions, callback: (incomingMessage: IncomingMessage) => void) => EventEmitter} Fetch */
|
||||
|
||||
/**
|
||||
* @typedef {object} EventsMap
|
||||
* @property {[Error]} error
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {typeof import("http") | typeof import("https")} request request
|
||||
* @param {string | URL | undefined} proxy proxy
|
||||
* @returns {(url: URL, requestOptions: RequestOptions, callback: (incomingMessage: IncomingMessage) => void) => EventEmitter} fn
|
||||
* @returns {Fetch} fn
|
||||
*/
|
||||
const proxyFetch = (request, proxy) => (url, options, callback) => {
|
||||
/** @type {EventEmitter<EventsMap>} */
|
||||
const eventEmitter = new EventEmitter();
|
||||
|
||||
/**
|
||||
@@ -104,9 +112,7 @@ const validate = createSchemaValidation(
|
||||
* @returns {string} safe path
|
||||
*/
|
||||
const toSafePath = (str) =>
|
||||
str
|
||||
.replace(/^[^a-zA-Z0-9]+|[^a-zA-Z0-9]+$/g, "")
|
||||
.replace(/[^a-zA-Z0-9._-]+/g, "_");
|
||||
str.replace(/^[^a-z0-9]+|[^a-z0-9]+$/gi, "").replace(/[^a-z0-9._-]+/gi, "_");
|
||||
|
||||
/**
|
||||
* @param {Buffer} content content
|
||||
@@ -220,6 +226,7 @@ const sanitizeUrlForError = (href) => {
|
||||
|
||||
class Lockfile {
|
||||
constructor() {
|
||||
/** @type {number} */
|
||||
this.version = 1;
|
||||
/** @type {Map<string, LockfileEntry | "ignore" | "no-cache">} */
|
||||
this.entries = new Map();
|
||||
@@ -430,6 +437,8 @@ const cachedWithKey = (fn, forceFn = fn) => {
|
||||
/** @typedef {FetchResultMeta & { entry: LockfileEntry, content: Buffer }} ContentFetchResult */
|
||||
/** @typedef {RedirectFetchResult | ContentFetchResult} FetchResult */
|
||||
|
||||
/** @typedef {(uri: string) => boolean} AllowedUriFn */
|
||||
|
||||
const PLUGIN_NAME = "HttpUriPlugin";
|
||||
|
||||
class HttpUriPlugin {
|
||||
@@ -438,12 +447,8 @@ class HttpUriPlugin {
|
||||
*/
|
||||
constructor(options) {
|
||||
validate(options);
|
||||
this._lockfileLocation = options.lockfileLocation;
|
||||
this._cacheLocation = options.cacheLocation;
|
||||
this._upgrade = options.upgrade;
|
||||
this._frozen = options.frozen;
|
||||
this._allowedUris = options.allowedUris;
|
||||
this._proxy = options.proxy;
|
||||
/** @type {HttpUriPluginOptions} */
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -453,7 +458,10 @@ class HttpUriPlugin {
|
||||
*/
|
||||
apply(compiler) {
|
||||
const proxy =
|
||||
this._proxy || process.env.http_proxy || process.env.HTTP_PROXY;
|
||||
this.options.proxy || process.env.http_proxy || process.env.HTTP_PROXY;
|
||||
/**
|
||||
* @type {{ scheme: "http" | "https", fetch: Fetch }[]}
|
||||
*/
|
||||
const schemes = [
|
||||
{
|
||||
scheme: "http",
|
||||
@@ -477,7 +485,7 @@ class HttpUriPlugin {
|
||||
const logger = compilation.getLogger(`webpack.${PLUGIN_NAME}`);
|
||||
/** @type {string} */
|
||||
const lockfileLocation =
|
||||
this._lockfileLocation ||
|
||||
this.options.lockfileLocation ||
|
||||
join(
|
||||
intermediateFs,
|
||||
compiler.context,
|
||||
@@ -487,15 +495,15 @@ class HttpUriPlugin {
|
||||
);
|
||||
/** @type {string | false} */
|
||||
const cacheLocation =
|
||||
this._cacheLocation !== undefined
|
||||
? this._cacheLocation
|
||||
this.options.cacheLocation !== undefined
|
||||
? this.options.cacheLocation
|
||||
: `${lockfileLocation}.data`;
|
||||
const upgrade = this._upgrade || false;
|
||||
const frozen = this._frozen || false;
|
||||
const upgrade = this.options.upgrade || false;
|
||||
const frozen = this.options.frozen || false;
|
||||
const hashFunction = "sha512";
|
||||
const hashDigest = "hex";
|
||||
const hashDigestLength = 20;
|
||||
const allowedUris = this._allowedUris;
|
||||
const allowedUris = this.options.allowedUris;
|
||||
|
||||
let warnedAboutEol = false;
|
||||
|
||||
@@ -660,6 +668,7 @@ class HttpUriPlugin {
|
||||
* @returns {string} absolute, validated redirect target
|
||||
*/
|
||||
const validateRedirectLocation = (location, base) => {
|
||||
/** @type {URL} */
|
||||
let nextUrl;
|
||||
try {
|
||||
nextUrl = new URL(location, base);
|
||||
@@ -707,6 +716,7 @@ class HttpUriPlugin {
|
||||
|
||||
if ("location" in result) {
|
||||
// Validate redirect target before following
|
||||
/** @type {string} */
|
||||
let absolute;
|
||||
try {
|
||||
absolute = validateRedirectLocation(result.location, url);
|
||||
@@ -845,6 +855,7 @@ class HttpUriPlugin {
|
||||
res.statusCode >= 301 &&
|
||||
res.statusCode <= 308
|
||||
) {
|
||||
/** @type {string} */
|
||||
let absolute;
|
||||
try {
|
||||
absolute = validateRedirectLocation(location, url);
|
||||
@@ -891,9 +902,15 @@ class HttpUriPlugin {
|
||||
stream = stream.pipe(createInflate());
|
||||
}
|
||||
|
||||
stream.on("data", (chunk) => {
|
||||
bufferArr.push(chunk);
|
||||
});
|
||||
stream.on(
|
||||
"data",
|
||||
/**
|
||||
* @param {Buffer} chunk chunk
|
||||
*/
|
||||
(chunk) => {
|
||||
bufferArr.push(chunk);
|
||||
}
|
||||
);
|
||||
|
||||
stream.on("end", () => {
|
||||
if (!res.complete) {
|
||||
@@ -953,6 +970,7 @@ class HttpUriPlugin {
|
||||
* @returns {boolean} true when allowed, otherwise false
|
||||
*/
|
||||
const isAllowed = (uri) => {
|
||||
/** @type {URL} */
|
||||
let parsedUri;
|
||||
try {
|
||||
// Parse the URI to prevent userinfo bypass attacks
|
||||
@@ -963,6 +981,7 @@ class HttpUriPlugin {
|
||||
}
|
||||
for (const allowed of allowedUris) {
|
||||
if (typeof allowed === "string") {
|
||||
/** @type {URL} */
|
||||
let parsedAllowed;
|
||||
try {
|
||||
parsedAllowed = new URL(allowed);
|
||||
|
||||
Reference in New Issue
Block a user