Socket
Socket
Sign inDemoInstall

webpack

Package Overview
Dependencies
76
Maintainers
2
Versions
832
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.69.0 to 5.69.1

108

lib/cache/ResolverCachePlugin.js

@@ -131,7 +131,2 @@ /*

};
let yieldResult;
if (typeof newResolveContext.yield === "function") {
yieldResult = [];
newResolveContext.yield = obj => yieldResult.push(obj);
}
const propagate = key => {

@@ -164,15 +159,11 @@ if (resolveContext[key]) {

if (err) return callback(err);
const resolveResult = result || yieldResult;
if (!snapshot) {
if (resolveResult) return callback(null, resolveResult);
if (result) return callback(null, result);
return callback();
}
itemCache.store(
new CacheEntry(resolveResult, snapshot),
storeErr => {
if (storeErr) return callback(storeErr);
if (resolveResult) return callback(null, resolveResult);
callback();
}
);
itemCache.store(new CacheEntry(result, snapshot), storeErr => {
if (storeErr) return callback(storeErr);
if (result) return callback(null, result);
callback();
});
}

@@ -187,4 +178,2 @@ );

const activeRequests = new Map();
/** @type {Map<string, [function(Error=, Object=): void, function(Error=, Object=): void][]>} */
const activeRequestsWithYield = new Map();
hook.tap(

@@ -214,59 +203,25 @@ "ResolverCachePlugin",

}
const withYield = typeof resolveContext.yield === "function";
const identifier = `${type}${
withYield ? "|yield" : "|default"
}${optionsIdent}${objectToString(request, !cacheWithContext)}`;
if (withYield) {
const activeRequest = activeRequestsWithYield.get(identifier);
if (activeRequest) {
activeRequest[0].push(callback);
activeRequest[1].push(resolveContext.yield);
return;
}
} else {
const activeRequest = activeRequests.get(identifier);
if (activeRequest) {
activeRequest.push(callback);
return;
}
const identifier = `${type}${optionsIdent}${objectToString(
request,
!cacheWithContext
)}`;
const activeRequest = activeRequests.get(identifier);
if (activeRequest) {
activeRequest.push(callback);
return;
}
const itemCache = cache.getItemCache(identifier, null);
let callbacks, yields;
const done = withYield
? (err, result) => {
if (callbacks === undefined) {
if (err) {
callback(err);
} else {
if (result)
for (const r of result) resolveContext.yield(r);
callback(null, null);
}
yields = undefined;
callbacks = false;
} else {
for (let i = 0; i < callbacks.length; i++) {
const cb = callbacks[i];
const yield_ = yields[i];
if (result) for (const r of result) yield_(r);
cb(null, null);
}
activeRequestsWithYield.delete(identifier);
yields = undefined;
callbacks = false;
}
}
: (err, result) => {
if (callbacks === undefined) {
callback(err, result);
callbacks = false;
} else {
for (const callback of callbacks) {
callback(err, result);
}
activeRequests.delete(identifier);
callbacks = false;
}
};
let callbacks;
const done = (err, result) => {
if (callbacks === undefined) {
callback(err, result);
callbacks = false;
} else {
for (const callback of callbacks) {
callback(err, result);
}
activeRequests.delete(identifier);
callbacks = false;
}
};
/**

@@ -328,11 +283,4 @@ * @param {Error=} err error if any

itemCache.get(processCacheResult);
if (withYield && callbacks === undefined) {
if (callbacks === undefined) {
callbacks = [callback];
yields = [resolveContext.yield];
activeRequestsWithYield.set(
identifier,
/** @type {[any, any]} */ ([callbacks, yields])
);
} else if (callbacks === undefined) {
callbacks = [callback];
activeRequests.set(identifier, callbacks);

@@ -339,0 +287,0 @@ }

@@ -64,3 +64,3 @@ /*

* @typedef {Object} ContextModuleOptionsExtras
* @property {string|string[]} resource
* @property {string} resource
* @property {string=} resourceQuery

@@ -96,32 +96,19 @@ * @property {string=} resourceFragment

constructor(resolveDependencies, options) {
if (!options || typeof options.resource === "string") {
const parsed = parseResource(
options ? /** @type {string} */ (options.resource) : ""
);
const resource = parsed.path;
const resourceQuery = (options && options.resourceQuery) || parsed.query;
const resourceFragment =
(options && options.resourceFragment) || parsed.fragment;
const parsed = parseResource(options ? options.resource : "");
const resource = parsed.path;
const resourceQuery = (options && options.resourceQuery) || parsed.query;
const resourceFragment =
(options && options.resourceFragment) || parsed.fragment;
super("javascript/dynamic", resource);
/** @type {ContextModuleOptions} */
this.options = {
...options,
resource,
resourceQuery,
resourceFragment
};
} else {
super("javascript/dynamic");
/** @type {ContextModuleOptions} */
this.options = {
...options,
resource: options.resource,
resourceQuery: options.resourceQuery || "",
resourceFragment: options.resourceFragment || ""
};
}
super("javascript/dynamic", resource);
// Info from Factory
this.resolveDependencies = resolveDependencies;
/** @type {ContextModuleOptions} */
this.options = {
...options,
resource,
resourceQuery,
resourceFragment
};
if (options && options.resolveOptions !== undefined) {

@@ -173,7 +160,3 @@ this.resolveOptions = options.resolveOptions;

_createIdentifier() {
let identifier =
this.context ||
(typeof this.options.resource === "string"
? this.options.resource
: this.options.resource.join("|"));
let identifier = this.context;
if (this.options.resourceQuery) {

@@ -243,12 +226,3 @@ identifier += `|${this.options.resourceQuery}`;

readableIdentifier(requestShortener) {
let identifier;
if (this.context) {
identifier = requestShortener.shorten(this.context) + "/";
} else if (typeof this.options.resource === "string") {
identifier = requestShortener.shorten(this.options.resource) + "/";
} else {
identifier = this.options.resource
.map(r => requestShortener.shorten(r) + "/")
.join(" ");
}
let identifier = requestShortener.shorten(this.context) + "/";
if (this.options.resourceQuery) {

@@ -303,26 +277,7 @@ identifier += ` ${this.options.resourceQuery}`;

libIdent(options) {
let identifier;
if (this.context) {
identifier = contextify(
options.context,
this.context,
options.associatedObjectForCache
);
} else if (typeof this.options.resource === "string") {
identifier = contextify(
options.context,
this.options.resource,
options.associatedObjectForCache
);
} else {
const arr = [];
for (const res of this.options.resource) {
arr.push(
contextify(options.context, res, options.associatedObjectForCache)
);
}
identifier = arr.join(" ");
}
let identifier = contextify(
options.context,
this.context,
options.associatedObjectForCache
);
if (this.layer) identifier = `(${this.layer})/${identifier}`;

@@ -495,7 +450,3 @@ if (this.options.mode) {

null,
this.context
? [this.context]
: typeof this.options.resource === "string"
? [this.options.resource]
: this.options.resource,
[this.context],
null,

@@ -524,9 +475,3 @@ SNAPSHOT_OPTIONS,

) {
if (this.context) {
contextDependencies.add(this.context);
} else if (typeof this.options.resource === "string") {
contextDependencies.add(this.options.resource);
} else {
for (const res of this.options.resource) contextDependencies.add(res);
}
contextDependencies.add(this.context);
}

@@ -533,0 +478,0 @@

@@ -170,5 +170,2 @@ /*

callback => {
const results = [];
const yield_ = obj => results.push(obj);
contextResolver.resolve(

@@ -181,8 +178,7 @@ {},

missingDependencies,
contextDependencies,
yield: yield_
contextDependencies
},
err => {
(err, result) => {
if (err) return callback(err);
callback(null, results);
callback(null, result);
}

@@ -222,3 +218,3 @@ );

}
const [contextResult, loaderResult] = result;
this.hooks.afterResolve.callAsync(

@@ -228,11 +224,6 @@ {

loadersPrefix +
loaderResult.join("!") +
(loaderResult.length > 0 ? "!" : ""),
resource:
contextResult.length > 1
? contextResult.map(r => r.path)
: contextResult[0].path,
result[1].join("!") +
(result[1].length > 0 ? "!" : ""),
resource: result[0],
resolveDependencies: this.resolveDependencies.bind(this),
resourceQuery: contextResult[0].query,
resourceFragment: contextResult[0].fragment,
...beforeResolveResult

@@ -294,4 +285,3 @@ },

let severalContexts = false;
const addDirectoryChecked = (ctx, directory, visited, callback) => {
const addDirectoryChecked = (directory, visited, callback) => {
fs.realpath(directory, (err, realPath) => {

@@ -302,5 +292,4 @@ if (err) return callback(err);

addDirectory(
ctx,
directory,
(_, dir, callback) => {
(dir, callback) => {
if (recursionStack === undefined) {

@@ -310,3 +299,3 @@ recursionStack = new Set(visited);

}
addDirectoryChecked(ctx, dir, recursionStack, callback);
addDirectoryChecked(dir, recursionStack, callback);
},

@@ -318,3 +307,3 @@ callback

const addDirectory = (ctx, directory, addSubDirectory, callback) => {
const addDirectory = (directory, addSubDirectory, callback) => {
fs.readdir(directory, (err, files) => {

@@ -346,3 +335,3 @@ if (err) return callback(err);

if (!recursive) return callback();
addSubDirectory(ctx, subResource, callback);
addSubDirectory(subResource, callback);
} else if (

@@ -353,5 +342,6 @@ stat.isFile() &&

const obj = {
context: ctx,
context: resource,
request:
"." + subResource.substr(ctx.length).replace(/\\/g, "/")
"." +
subResource.substr(resource.length).replace(/\\/g, "/")
};

@@ -367,7 +357,4 @@

.map(obj => {
const request = severalContexts
? join(fs, obj.context, obj.request)
: obj.request;
const dep = new ContextElementDependency(
request + resourceQuery + resourceFragment,
obj.request + resourceQuery + resourceFragment,
obj.request,

@@ -409,36 +396,10 @@ typePrefix,

const addSubDirectory = (ctx, dir, callback) =>
addDirectory(ctx, dir, addSubDirectory, callback);
const visitResource = (resource, callback) => {
if (typeof fs.realpath === "function") {
addDirectoryChecked(resource, resource, new Set(), callback);
} else {
addDirectory(resource, resource, addSubDirectory, callback);
}
};
if (typeof resource === "string") {
visitResource(resource, callback);
if (typeof fs.realpath === "function") {
addDirectoryChecked(resource, new Set(), callback);
} else {
severalContexts = true;
asyncLib.map(resource, visitResource, (err, result) => {
if (err) return callback(err);
// result dependencies should have unique userRequest
// ordered by resolve result
const temp = new Set();
const res = [];
for (let i = 0; i < result.length; i++) {
const inner = result[i];
for (const el of inner) {
if (temp.has(el.userRequest)) continue;
res.push(el);
temp.add(el.userRequest);
}
}
callback(null, res);
});
const addSubDirectory = (dir, callback) =>
addDirectory(dir, addSubDirectory, callback);
addDirectory(resource, addSubDirectory, callback);
}
}
};
{
"name": "webpack",
"version": "5.69.0",
"version": "5.69.1",
"author": "Tobias Koppers @sokra",

@@ -17,3 +17,3 @@ "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",

"chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.9.0",
"enhanced-resolve": "^5.8.3",
"es-module-lexer": "^0.9.0",

@@ -20,0 +20,0 @@ "eslint-scope": "5.1.1",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc