Socket
Socket
Sign inDemoInstall

webpack

Package Overview
Dependencies
Maintainers
2
Versions
837
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack - npm Package Compare versions

Comparing version 5.58.2 to 5.59.0

4

lib/cache/AddManagedPathsPlugin.js

@@ -12,4 +12,4 @@ /*

/**
* @param {Iterable<string>} managedPaths list of managed paths
* @param {Iterable<string>} immutablePaths list of immutable paths
* @param {Iterable<string | RegExp>} managedPaths list of managed paths
* @param {Iterable<string | RegExp>} immutablePaths list of immutable paths
*/

@@ -16,0 +16,0 @@ constructor(managedPaths, immutablePaths) {

@@ -373,4 +373,4 @@ /*

}
for (const identifer of content.used) {
mergedUsedItems.add(identifer);
for (const identifier of content.used) {
mergedUsedItems.add(identifier);
}

@@ -377,0 +377,0 @@ addToMergedMap.push(async map => {

@@ -222,5 +222,5 @@ /*

this.records = {};
/** @type {Set<string>} */
/** @type {Set<string | RegExp>} */
this.managedPaths = new Set();
/** @type {Set<string>} */
/** @type {Set<string | RegExp>} */
this.immutablePaths = new Set();

@@ -227,0 +227,0 @@

@@ -22,2 +22,3 @@ /*

/** @typedef {import("../../declarations/WebpackOptions").Experiments} Experiments */
/** @typedef {import("../../declarations/WebpackOptions").ExperimentsNormalized} ExperimentsNormalized */
/** @typedef {import("../../declarations/WebpackOptions").ExternalsPresets} ExternalsPresets */

@@ -165,2 +166,4 @@ /** @typedef {import("../../declarations/WebpackOptions").ExternalsType} ExternalsType */

const futureDefaults = options.experiments.futureDefaults;
F(options, "cache", () =>

@@ -177,3 +180,6 @@ development ? { type: /** @type {"memory"} */ ("memory") } : false

applySnapshotDefaults(options.snapshot, { production });
applySnapshotDefaults(options.snapshot, {
production,
futureDefaults
});

@@ -198,3 +204,3 @@ applyModuleDefaults(options.module, {

module: options.module,
futureDefaults: options.experiments.futureDefaults
futureDefaults
});

@@ -259,3 +265,3 @@

/**
* @param {Experiments} experiments options
* @param {ExperimentsNormalized} experiments options
* @param {Object} options options

@@ -273,4 +279,4 @@ * @param {boolean} options.production is production

D(experiments, "layers", false);
D(experiments, "lazyCompilation", false);
D(experiments, "buildHttp", false);
D(experiments, "lazyCompilation", undefined);
D(experiments, "buildHttp", undefined);
D(experiments, "futureDefaults", false);

@@ -281,3 +287,3 @@ D(experiments, "cacheUnaffected", experiments.futureDefaults);

D(experiments.buildHttp, "frozen", production);
D(experiments.buildHttp, "upgrade", development);
D(experiments.buildHttp, "upgrade", false);
}

@@ -358,45 +364,61 @@ };

* @param {boolean} options.production is production
* @param {boolean} options.futureDefaults is future defaults enabled
* @returns {void}
*/
const applySnapshotDefaults = (snapshot, { production }) => {
A(snapshot, "managedPaths", () => {
if (process.versions.pnp === "3") {
const match =
/^(.+?)[\\/]cache[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec(
const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => {
if (futureDefaults) {
F(snapshot, "managedPaths", () =>
process.versions.pnp === "3"
? [
/^(.+?(?:[\\/]\.yarn[\\/]unplugged[\\/][^\\/]+)?[\\/]node_modules[\\/])/
]
: [/^(.+?[\\/]node_modules[\\/])/]
);
F(snapshot, "immutablePaths", () =>
process.versions.pnp === "3"
? [/^(.+?[\\/]cache[\\/][^\\/]+\.zip[\\/]node_modules[\\/])/]
: []
);
} else {
A(snapshot, "managedPaths", () => {
if (process.versions.pnp === "3") {
const match =
/^(.+?)[\\/]cache[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec(
require.resolve("watchpack")
);
if (match) {
return [path.resolve(match[1], "unplugged")];
}
} else {
const match = /^(.+?[\\/]node_modules)[\\/]/.exec(
// eslint-disable-next-line node/no-extraneous-require
require.resolve("watchpack")
);
if (match) {
return [path.resolve(match[1], "unplugged")];
if (match) {
return [match[1]];
}
}
} else {
const match = /^(.+?[\\/]node_modules)[\\/]/.exec(
// eslint-disable-next-line node/no-extraneous-require
require.resolve("watchpack")
);
if (match) {
return [match[1]];
return [];
});
A(snapshot, "immutablePaths", () => {
if (process.versions.pnp === "1") {
const match =
/^(.+?[\\/]v4)[\\/]npm-watchpack-[^\\/]+-[\da-f]{40}[\\/]node_modules[\\/]/.exec(
require.resolve("watchpack")
);
if (match) {
return [match[1]];
}
} else if (process.versions.pnp === "3") {
const match =
/^(.+?)[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec(
require.resolve("watchpack")
);
if (match) {
return [match[1]];
}
}
}
return [];
});
A(snapshot, "immutablePaths", () => {
if (process.versions.pnp === "1") {
const match =
/^(.+?[\\/]v4)[\\/]npm-watchpack-[^\\/]+-[\da-f]{40}[\\/]node_modules[\\/]/.exec(
require.resolve("watchpack")
);
if (match) {
return [match[1]];
}
} else if (process.versions.pnp === "3") {
const match =
/^(.+?)[\\/]watchpack-npm-[^\\/]+\.zip[\\/]node_modules[\\/]/.exec(
require.resolve("watchpack")
);
if (match) {
return [match[1]];
}
}
return [];
});
return [];
});
}
F(snapshot, "resolveBuildDependencies", () => ({

@@ -403,0 +425,0 @@ timestamp: true,

@@ -177,3 +177,8 @@ /*

buildHttp: optionalNestedConfig(experiments.buildHttp, options =>
options === true ? {} : options
Array.isArray(options) ? { allowedUris: options } : options
),
lazyCompilation: optionalNestedConfig(
experiments.lazyCompilation,
options =>
options === true ? {} : options === false ? undefined : options
)

@@ -180,0 +185,0 @@ })),

@@ -154,3 +154,3 @@ /*

default:
return `Object(${code})`;
return `/*#__PURE__*/Object(${code})`;
}

@@ -157,0 +157,0 @@ };

@@ -190,2 +190,4 @@ /*

* @property {SyncHook<[LoaderItem[], NormalModule, object]>} beforeLoaders
* @property {SyncHook<[NormalModule]>} beforeParse
* @property {SyncHook<[NormalModule]>} beforeSnapshot
* @property {HookMap<AsyncSeriesBailHook<[string, NormalModule], string | Buffer>>} readResourceForScheme

@@ -215,2 +217,4 @@ * @property {HookMap<AsyncSeriesBailHook<[object], string | Buffer>>} readResource

beforeLoaders: new SyncHook(["loaders", "module", "loaderContext"]),
beforeParse: new SyncHook(["module"]),
beforeSnapshot: new SyncHook(["module"]),
// TODO webpack 6 deprecate

@@ -392,2 +396,3 @@ readResourceForScheme: new HookMap(scheme => {

this.resource = m.resource;
this.resourceResolveData = m.resourceResolveData;
this.context = m.context;

@@ -494,5 +499,6 @@ this.matchResource = m.matchResource;

* @param {InputFileSystem} fs file system from reading
* @param {NormalModuleCompilationHooks} hooks the hooks
* @returns {NormalModuleLoaderContext} loader context
*/
createLoaderContext(resolver, options, compilation, fs) {
_createLoaderContext(resolver, options, compilation, fs, hooks) {
const { requestShortener } = compilation.runtimeTemplate;

@@ -666,6 +672,3 @@ const getCurrentLoaderName = () => {

NormalModule.getCompilationHooks(compilation).loader.call(
loaderContext,
this
);
hooks.loader.call(loaderContext, this);

@@ -731,11 +734,13 @@ return loaderContext;

* @param {InputFileSystem} fs the file system
* @param {NormalModuleCompilationHooks} hooks the hooks
* @param {function(WebpackError=): void} callback callback function
* @returns {void}
*/
doBuild(options, compilation, resolver, fs, callback) {
const loaderContext = this.createLoaderContext(
_doBuild(options, compilation, resolver, fs, hooks, callback) {
const loaderContext = this._createLoaderContext(
resolver,
options,
compilation,
fs
fs,
hooks
);

@@ -794,4 +799,2 @@

const hooks = NormalModule.getCompilationHooks(compilation);
this.buildInfo.fileDependencies = new LazySet();

@@ -952,3 +955,5 @@ this.buildInfo.contextDependencies = new LazySet();

return this.doBuild(options, compilation, resolver, fs, err => {
const hooks = NormalModule.getCompilationHooks(compilation);
return this._doBuild(options, compilation, resolver, fs, hooks, err => {
// if we have an error mark module as failed and exit

@@ -985,2 +990,9 @@ if (err) {

const handleBuildDone = () => {
try {
hooks.beforeSnapshot.call(this);
} catch (err) {
this.markModuleAsErrored(err);
return callback();
}
const snapshotOptions = compilation.options.snapshot.module;

@@ -1050,2 +1062,10 @@ if (!this.buildInfo.cacheable || !snapshotOptions) {

try {
hooks.beforeParse.call(this);
} catch (err) {
this.markModuleAsErrored(err);
this._initBuildHash(compilation);
return callback();
}
// check if this module should !not! be parsed.

@@ -1052,0 +1072,0 @@ // if so, exit here;

@@ -567,3 +567,3 @@ /*

? `;(0,${reference})`
: `Object(${reference})`;
: `/*#__PURE__*/Object(${reference})`;
}

@@ -570,0 +570,0 @@ return reference;

@@ -62,2 +62,3 @@ /*

* @property {SplitChunksSizes} minSize
* @property {SplitChunksSizes} minSizeReduction
* @property {SplitChunksSizes} minRemainingSize

@@ -84,2 +85,3 @@ * @property {SplitChunksSizes} enforceSizeThreshold

* @property {SplitChunksSizes} minSize
* @property {SplitChunksSizes} minSizeReduction
* @property {SplitChunksSizes} minRemainingSize

@@ -137,2 +139,3 @@ * @property {SplitChunksSizes} enforceSizeThreshold

* @property {SplitChunksSizes} minSize
* @property {SplitChunksSizes} minSizeReduction
* @property {SplitChunksSizes} minRemainingSize

@@ -344,2 +347,17 @@ * @property {SplitChunksSizes} enforceSizeThreshold

* @param {SplitChunksSizes} sizes the sizes
* @param {SplitChunksSizes} minSizeReduction the min sizes
* @param {number} chunkCount number of chunks
* @returns {boolean} true if there are sizes and all existing sizes are at least `minSizeReduction`
*/
const checkMinSizeReduction = (sizes, minSizeReduction, chunkCount) => {
for (const key of Object.keys(minSizeReduction)) {
const size = sizes[key];
if (size === undefined || size === 0) continue;
if (size * chunkCount < minSizeReduction[key]) return false;
}
return true;
};
/**
* @param {SplitChunksSizes} sizes the sizes
* @param {SplitChunksSizes} minSize the min sizes

@@ -555,2 +573,6 @@ * @returns {undefined | string[]} list of size types that are below min size

const minSize = normalizeSizes(options.minSize, defaultSizeTypes);
const minSizeReduction = normalizeSizes(
options.minSizeReduction,
defaultSizeTypes
);
const maxSize = normalizeSizes(options.maxSize, defaultSizeTypes);

@@ -564,2 +586,3 @@ return {

minSize,
minSizeReduction,
minRemainingSize: mergeSizes(

@@ -603,2 +626,6 @@ normalizeSizes(options.minRemainingSize, defaultSizeTypes),

const minSize = normalizeSizes(options.minSize, defaultSizeTypes);
const minSizeReduction = normalizeSizes(
options.minSizeReduction,
defaultSizeTypes
);
const maxSize = normalizeSizes(options.maxSize, defaultSizeTypes);

@@ -611,2 +638,3 @@

minSize,
minSizeReduction,
minRemainingSize: mergeSizes(

@@ -679,2 +707,6 @@ normalizeSizes(options.minRemainingSize, defaultSizeTypes),

);
const minSizeReduction = mergeSizes(
cacheGroupSource.minSizeReduction,
cacheGroupSource.enforce ? undefined : this.options.minSizeReduction
);
const minRemainingSize = mergeSizes(

@@ -693,2 +725,3 @@ cacheGroupSource.minRemainingSize,

minSize,
minSizeReduction,
minRemainingSize,

@@ -1257,2 +1290,10 @@ enforceSizeThreshold,

chunksInfoMap.delete(key);
} else if (
!checkMinSizeReduction(
info.sizes,
info.cacheGroup.minSizeReduction,
info.chunks.size
)
) {
chunksInfoMap.delete(key);
}

@@ -1545,3 +1586,10 @@ }

}
if (removeMinSizeViolatingModules(info)) {
if (
removeMinSizeViolatingModules(info) ||
!checkMinSizeReduction(
info.sizes,
info.cacheGroup.minSizeReduction,
info.chunks.size
)
) {
chunksInfoMap.delete(key);

@@ -1548,0 +1596,0 @@ continue;

@@ -810,3 +810,3 @@ /*

? `;(0,${access})`
: `Object(${access})`;
: `/*#__PURE__*/Object(${access})`;
}

@@ -813,0 +813,0 @@ return access;

@@ -8,8 +8,9 @@ /*

const { resolve, extname, dirname } = require("path");
const { extname, basename } = require("path");
const { URL } = require("url");
const { createGunzip, createBrotliDecompress, createInflate } = require("zlib");
const NormalModule = require("../NormalModule");
const createSchemaValidation = require("../util/create-schema-validation");
const createHash = require("../util/createHash");
const { mkdirp } = require("../util/fs");
const { mkdirp, dirname, join } = require("../util/fs");
const memoize = require("../util/memoize");

@@ -23,2 +24,14 @@

/** @type {(() => void)[] | undefined} */
let inProgressWrite = undefined;
const validate = createSchemaValidation(
require("../../schemas/plugins/schemes/HttpUriPlugin.check.js"),
() => require("../../schemas/plugins/schemes/HttpUriPlugin.json"),
{
name: "Http Uri Plugin",
baseDataPath: "options"
}
);
const toSafePath = str =>

@@ -109,3 +122,2 @@ str

this.entries = new Map();
this.outdated = false;
}

@@ -257,14 +269,8 @@

/**
* @typedef {Object} HttpUriPluginAdvancedOptions
* @property {string | typeof import("../util/Hash")=} hashFunction
* @property {string=} hashDigest
* @property {number=} hashDigestLength
*/
class HttpUriPlugin {
/**
* @param {HttpUriPluginOptions & HttpUriPluginAdvancedOptions} options options
* @param {HttpUriPluginOptions} options options
*/
constructor(options = {}) {
constructor(options) {
validate(options);
this._lockfileLocation = options.lockfileLocation;

@@ -274,5 +280,3 @@ this._cacheLocation = options.cacheLocation;

this._frozen = options.frozen;
this._hashFunction = options.hashFunction;
this._hashDigest = options.hashDigest;
this._hashDigestLength = options.hashDigestLength;
this._allowedUris = options.allowedUris;
}

@@ -307,3 +311,4 @@

this._lockfileLocation ||
resolve(
join(
intermediateFs,
compiler.context,

@@ -320,7 +325,6 @@ compiler.name

const frozen = this._frozen || false;
const hashFunction = this._hashFunction || "sha512";
const hashDigest =
this._hashDigest || compilation.outputOptions.hashDigest;
const hashDigestLength =
this._hashDigestLength || compilation.outputOptions.hashDigestLength;
const hashFunction = "sha512";
const hashDigest = "hex";
const hashDigestLength = 20;
const allowedUris = this._allowedUris;

@@ -410,7 +414,9 @@ let warnedAboutEol = false;

let outdatedLockfile = undefined;
/** @type {Map<string, LockfileEntry | "ignore" | "no-cache"> | undefined} */
let lockfileUpdates = undefined;
const storeLockEntry = (lockfile, url, entry) => {
const oldEntry = lockfile.entries.get(url);
if (lockfileUpdates === undefined) lockfileUpdates = new Map();
lockfileUpdates.set(url, entry);
lockfile.entries.set(url, entry);
outdatedLockfile = lockfile;
if (!oldEntry) {

@@ -451,4 +457,4 @@ logger.log(`${url} added to lockfile`);

const key = getCacheKey(result.entry.resolved);
const filePath = resolve(cacheLocation, key);
mkdirp(intermediateFs, dirname(filePath), err => {
const filePath = join(intermediateFs, cacheLocation, key);
mkdirp(intermediateFs, dirname(intermediateFs, filePath), err => {
if (err) return callback(err);

@@ -683,2 +689,15 @@ intermediateFs.writeFile(filePath, result.content, err => {

const isAllowed = uri => {
for (const allowed of allowedUris) {
if (typeof allowed === "string") {
if (uri.startsWith(allowed)) return true;
} else if (typeof allowed === "function") {
if (allowed(uri)) return true;
} else {
if (allowed.test(uri)) return true;
}
}
return false;
};
const getInfo = cachedWithKey(

@@ -691,2 +710,11 @@ /**

(url, callback) => {
if (!isAllowed(url)) {
return callback(
new Error(
`${url} doesn't match the allowedUris policy. These URIs are allowed:\n${allowedUris
.map(uri => ` - ${uri}`)
.join("\n")}`
)
);
}
getLockfile((err, lockfile) => {

@@ -803,3 +831,3 @@ if (err) return callback(err);

const key = getCacheKey(entry.resolved);
const filePath = resolve(cacheLocation, key);
const filePath = join(intermediateFs, cacheLocation, key);
fs.readFile(filePath, (err, result) => {

@@ -949,2 +977,3 @@ const content = /** @type {Buffer} */ (result);

if (err) return callback(err);
module.buildInfo.resourceIntegrity = result.entry.integrity;
callback(null, result.content);

@@ -979,8 +1008,55 @@ });

(modules, callback) => {
if (!outdatedLockfile) return callback();
intermediateFs.writeFile(
lockfileLocation,
outdatedLockfile.toString(),
callback
if (!lockfileUpdates) return callback();
const ext = extname(lockfileLocation);
const tempFile = join(
intermediateFs,
dirname(intermediateFs, lockfileLocation),
`.${basename(lockfileLocation, ext)}.${
(Math.random() * 10000) | 0
}${ext}`
);
const writeDone = () => {
const nextOperation = inProgressWrite.shift();
if (nextOperation) {
nextOperation();
} else {
inProgressWrite = undefined;
}
};
const runWrite = () => {
intermediateFs.readFile(lockfileLocation, (err, buffer) => {
if (err && err.code !== "ENOENT") {
writeDone();
return callback(err);
}
const lockfile = buffer
? Lockfile.parse(buffer.toString("utf-8"))
: new Lockfile();
for (const [key, value] of lockfileUpdates) {
lockfile.entries.set(key, value);
}
intermediateFs.writeFile(tempFile, lockfile.toString(), err => {
if (err) {
writeDone();
return intermediateFs.unlink(tempFile, () => callback(err));
}
intermediateFs.rename(tempFile, lockfileLocation, err => {
if (err) {
writeDone();
return intermediateFs.unlink(tempFile, () =>
callback(err)
);
}
writeDone();
callback();
});
});
});
};
if (inProgressWrite) {
inProgressWrite.push(runWrite);
} else {
inProgressWrite = [];
}
}

@@ -987,0 +1063,0 @@ );

@@ -86,2 +86,4 @@ /*

// TODO webpack 6 make optional methods required
/**

@@ -88,0 +90,0 @@ * @typedef {Object} OutputFileSystem

@@ -9,3 +9,3 @@ /*

const SAFE_IDENTIFIER = /^[_a-zA-Z$][_a-zA-Z$0-9]*$/;
const RESERVED_IDENTIFER = new Set([
const RESERVED_IDENTIFIER = new Set([
"break",

@@ -70,3 +70,3 @@ "case",

str += `[${p}]`;
} else if (SAFE_IDENTIFIER.test(p) && !RESERVED_IDENTIFER.has(p)) {
} else if (SAFE_IDENTIFIER.test(p) && !RESERVED_IDENTIFIER.has(p)) {
str += `.${p}`;

@@ -73,0 +73,0 @@ } else {

@@ -282,4 +282,2 @@ /*

const httpOptions = options.experiments.buildHttp;
if (httpOptions === true)
throw new Error("Unexpected due to normalization");
new HttpUriPlugin(httpOptions).apply(compiler);

@@ -286,0 +284,0 @@ }

{
"name": "webpack",
"version": "5.58.2",
"version": "5.59.0",
"author": "Tobias Koppers @sokra",

@@ -5,0 +5,0 @@ "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.",

@@ -6,2 +6,2 @@ /*

*/
const o=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;function t(e,{instancePath:n="",parentData:s,parentDataProperty:l,rootData:a=e}={}){let i=null,r=0;const c=r;let p=!1,u=null;const f=r;if(r==r)if(e&&"object"==typeof e&&!Array.isArray(e)){const t=r;for(const o in e)if("cacheLocation"!==o&&"frozen"!==o&&"lockfileLocation"!==o&&"upgrade"!==o){const t={params:{additionalProperty:o}};null===i?i=[t]:i.push(t),r++;break}if(t===r){if(void 0!==e.cacheLocation){let t=e.cacheLocation;const n=r,s=r;let l=!1;const a=r;if(!1!==t){const o={params:{}};null===i?i=[o]:i.push(o),r++}var h=a===r;if(l=l||h,!l){const e=r;if(r===e)if("string"==typeof t){if(t.includes("!")||!0!==o.test(t)){const o={params:{}};null===i?i=[o]:i.push(o),r++}}else{const o={params:{type:"string"}};null===i?i=[o]:i.push(o),r++}h=e===r,l=l||h}if(l)r=s,null!==i&&(s?i.length=s:i=null);else{const o={params:{}};null===i?i=[o]:i.push(o),r++}var d=n===r}else d=!0;if(d){if(void 0!==e.frozen){const o=r;if("boolean"!=typeof e.frozen){const o={params:{type:"boolean"}};null===i?i=[o]:i.push(o),r++}d=o===r}else d=!0;if(d){if(void 0!==e.lockfileLocation){let t=e.lockfileLocation;const n=r;if(r===n)if("string"==typeof t){if(t.includes("!")||!0!==o.test(t)){const o={params:{}};null===i?i=[o]:i.push(o),r++}}else{const o={params:{type:"string"}};null===i?i=[o]:i.push(o),r++}d=n===r}else d=!0;if(d)if(void 0!==e.upgrade){const o=r;if("boolean"!=typeof e.upgrade){const o={params:{type:"boolean"}};null===i?i=[o]:i.push(o),r++}d=o===r}else d=!0}}}}else{const o={params:{type:"object"}};null===i?i=[o]:i.push(o),r++}if(f===r&&(p=!0,u=0),!p){const o={params:{passingSchemas:u}};return null===i?i=[o]:i.push(o),r++,t.errors=i,!1}return r=c,null!==i&&(c?i.length=c:i=null),t.errors=i,0===r}module.exports=t,module.exports.default=t;
const r=/^(?:[A-Za-z]:[\\/]|\\\\|\/)/;module.exports=n,module.exports.default=n;const t=new RegExp("^https?://","u");function e(n,{instancePath:o="",parentData:s,parentDataProperty:a,rootData:l=n}={}){let i=null,p=0;if(0===p){if(!n||"object"!=typeof n||Array.isArray(n))return e.errors=[{params:{type:"object"}}],!1;{let o;if(void 0===n.allowedUris&&(o="allowedUris"))return e.errors=[{params:{missingProperty:o}}],!1;{const o=p;for(const r in n)if("allowedUris"!==r&&"cacheLocation"!==r&&"frozen"!==r&&"lockfileLocation"!==r&&"upgrade"!==r)return e.errors=[{params:{additionalProperty:r}}],!1;if(o===p){if(void 0!==n.allowedUris){let r=n.allowedUris;const o=p;if(p==p){if(!Array.isArray(r))return e.errors=[{params:{type:"array"}}],!1;{const n=r.length;for(let o=0;o<n;o++){let n=r[o];const s=p,a=p;let l=!1;const f=p;if(!(n instanceof RegExp)){const r={params:{}};null===i?i=[r]:i.push(r),p++}var c=f===p;if(l=l||c,!l){const r=p;if(p===r)if("string"==typeof n){if(!t.test(n)){const r={params:{pattern:"^https?://"}};null===i?i=[r]:i.push(r),p++}}else{const r={params:{type:"string"}};null===i?i=[r]:i.push(r),p++}if(c=r===p,l=l||c,!l){const r=p;if(!(n instanceof Function)){const r={params:{}};null===i?i=[r]:i.push(r),p++}c=r===p,l=l||c}}if(!l){const r={params:{}};return null===i?i=[r]:i.push(r),p++,e.errors=i,!1}if(p=a,null!==i&&(a?i.length=a:i=null),s!==p)break}}}var f=o===p}else f=!0;if(f){if(void 0!==n.cacheLocation){let t=n.cacheLocation;const o=p,s=p;let a=!1;const l=p;if(!1!==t){const r={params:{}};null===i?i=[r]:i.push(r),p++}var u=l===p;if(a=a||u,!a){const e=p;if(p===e)if("string"==typeof t){if(t.includes("!")||!0!==r.test(t)){const r={params:{}};null===i?i=[r]:i.push(r),p++}}else{const r={params:{type:"string"}};null===i?i=[r]:i.push(r),p++}u=e===p,a=a||u}if(!a){const r={params:{}};return null===i?i=[r]:i.push(r),p++,e.errors=i,!1}p=s,null!==i&&(s?i.length=s:i=null),f=o===p}else f=!0;if(f){if(void 0!==n.frozen){const r=p;if("boolean"!=typeof n.frozen)return e.errors=[{params:{type:"boolean"}}],!1;f=r===p}else f=!0;if(f){if(void 0!==n.lockfileLocation){let t=n.lockfileLocation;const o=p;if(p===o){if("string"!=typeof t)return e.errors=[{params:{type:"string"}}],!1;if(t.includes("!")||!0!==r.test(t))return e.errors=[{params:{}}],!1}f=o===p}else f=!0;if(f)if(void 0!==n.upgrade){const r=p;if("boolean"!=typeof n.upgrade)return e.errors=[{params:{type:"boolean"}}],!1;f=r===p}else f=!0}}}}}}}return e.errors=i,0===p}function n(r,{instancePath:t="",parentData:o,parentDataProperty:s,rootData:a=r}={}){let l=null,i=0;const p=i;let c=!1,f=null;const u=i;if(e(r,{instancePath:t,parentData:o,parentDataProperty:s,rootData:a})||(l=null===l?e.errors:l.concat(e.errors),i=l.length),u===i&&(c=!0,f=0),!c){const r={params:{passingSchemas:f}};return null===l?l=[r]:l.push(r),i++,n.errors=l,!1}return i=p,null!==l&&(p?l.length=p:l=null),n.errors=l,0===i}

@@ -8,2 +8,5 @@ {

"properties": {
"allowedUris": {
"$ref": "#/definitions/HttpUriOptionsAllowedUris"
},
"cacheLocation": {

@@ -34,2 +37,27 @@ "description": "Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.",

}
},
"required": ["allowedUris"]
},
"HttpUriOptionsAllowedUris": {
"description": "List of allowed URIs (resp. the beginning of them).",
"type": "array",
"items": {
"description": "List of allowed URIs (resp. the beginning of them).",
"anyOf": [
{
"description": "Allowed URI pattern.",
"instanceof": "RegExp",
"tsType": "RegExp"
},
{
"description": "Allowed URI (resp. the beginning of it).",
"type": "string",
"pattern": "^https?://"
},
{
"description": "Allowed URI filter function.",
"instanceof": "Function",
"tsType": "((uri: string) => boolean)"
}
]
}

@@ -36,0 +64,0 @@ }

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

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

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

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

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc