added unmanagedPaths to snapshot options
This commit is contained in:
parent
36d70c0a6a
commit
7d8799ac4b
|
@ -29,3 +29,5 @@ schemas/**/*.check.js
|
|||
# Ignore example fixtures
|
||||
examples/
|
||||
!examples/**/webpack.config.js
|
||||
|
||||
.vscode/**/*.*
|
||||
|
|
|
@ -2376,6 +2376,10 @@ export interface SnapshotOptions {
|
|||
*/
|
||||
timestamp?: boolean;
|
||||
};
|
||||
/**
|
||||
* List of paths that are not managed by a package manager and the contents are subject to change.
|
||||
*/
|
||||
unmanagedPaths?: (RegExp | string)[];
|
||||
}
|
||||
/**
|
||||
* Stats options object.
|
||||
|
|
|
@ -885,6 +885,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|||
this.resolverFactory = compiler.resolverFactory;
|
||||
this.inputFileSystem = compiler.inputFileSystem;
|
||||
this.fileSystemInfo = new FileSystemInfo(this.inputFileSystem, {
|
||||
unmanagedPaths: compiler.unmanagedPaths,
|
||||
managedPaths: compiler.managedPaths,
|
||||
immutablePaths: compiler.immutablePaths,
|
||||
logger: this.getLogger("webpack.FileSystemInfo"),
|
||||
|
|
|
@ -228,6 +228,8 @@ class Compiler {
|
|||
/** @type {Set<string | RegExp>} */
|
||||
this.managedPaths = new Set();
|
||||
/** @type {Set<string | RegExp>} */
|
||||
this.unmanagedPaths = new Set();
|
||||
/** @type {Set<string | RegExp>} */
|
||||
this.immutablePaths = new Set();
|
||||
|
||||
/** @type {ReadonlySet<string> | undefined} */
|
||||
|
|
|
@ -588,7 +588,8 @@ class WebpackOptionsApply extends OptionsApply {
|
|||
const AddManagedPathsPlugin = require("./cache/AddManagedPathsPlugin");
|
||||
new AddManagedPathsPlugin(
|
||||
options.snapshot.managedPaths,
|
||||
options.snapshot.immutablePaths
|
||||
options.snapshot.immutablePaths,
|
||||
options.snapshot.unmanagedPaths
|
||||
).apply(compiler);
|
||||
|
||||
if (options.cache && typeof options.cache === "object") {
|
||||
|
|
|
@ -11,10 +11,12 @@ class AddManagedPathsPlugin {
|
|||
/**
|
||||
* @param {Iterable<string | RegExp>} managedPaths list of managed paths
|
||||
* @param {Iterable<string | RegExp>} immutablePaths list of immutable paths
|
||||
* @param {Iterable<string | RegExp>} unmanagedPaths list of unmanaged paths
|
||||
*/
|
||||
constructor(managedPaths, immutablePaths) {
|
||||
constructor(managedPaths, immutablePaths, unmanagedPaths) {
|
||||
this.managedPaths = new Set(managedPaths);
|
||||
this.immutablePaths = new Set(immutablePaths);
|
||||
this.unmanagedPaths = new Set(unmanagedPaths);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,6 +31,9 @@ class AddManagedPathsPlugin {
|
|||
for (const immutablePath of this.immutablePaths) {
|
||||
compiler.immutablePaths.add(immutablePath);
|
||||
}
|
||||
for (const unmanagedPath of this.unmanagedPaths) {
|
||||
compiler.unmanagedPaths.add(unmanagedPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4614,6 +4614,26 @@
|
|||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"unmanagedPaths": {
|
||||
"description": "List of paths that are not managed by a package manager and the contents are subject to change.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "List of paths that are not managed by a package manager and the contents are subject to change.",
|
||||
"anyOf": [
|
||||
{
|
||||
"description": "A RegExp matching an unmanaged directory.",
|
||||
"instanceof": "RegExp",
|
||||
"tsType": "RegExp"
|
||||
},
|
||||
{
|
||||
"description": "A path to an unmanaged directory.",
|
||||
"type": "string",
|
||||
"absolutePath": true,
|
||||
"minLength": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -2242,6 +2242,7 @@ declare class Compiler {
|
|||
recordsOutputPath: null | string;
|
||||
records: object;
|
||||
managedPaths: Set<string | RegExp>;
|
||||
unmanagedPaths: Set<string | RegExp>;
|
||||
immutablePaths: Set<string | RegExp>;
|
||||
modifiedFiles?: ReadonlySet<string>;
|
||||
removedFiles?: ReadonlySet<string>;
|
||||
|
@ -11941,6 +11942,11 @@ declare interface SnapshotOptionsWebpackOptions {
|
|||
*/
|
||||
timestamp?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* List of paths that are not managed by a package manager and the contents are subject to change.
|
||||
*/
|
||||
unmanagedPaths?: (string | RegExp)[];
|
||||
}
|
||||
declare abstract class SortableSet<T> extends Set<T> {
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue