* Creates an instance of PackFileCacheStrategy. * @param {object} options options * @param {Compiler} options.compiler the compiler * @param {IntermediateFileSystem} options.fs the filesystem * @param {string} options.context the context directory * @param {string} options.cacheLocation th
({
compiler,
fs,
context,
cacheLocation,
version,
logger,
snapshot,
maxAge,
profile,
allowCollectingMemory,
compression,
readonly
})
| 1138 | * @param {boolean=} options.readonly disable storing cache into filesystem |
| 1139 | */ |
| 1140 | constructor({ |
| 1141 | compiler, |
| 1142 | fs, |
| 1143 | context, |
| 1144 | cacheLocation, |
| 1145 | version, |
| 1146 | logger, |
| 1147 | snapshot, |
| 1148 | maxAge, |
| 1149 | profile, |
| 1150 | allowCollectingMemory, |
| 1151 | compression, |
| 1152 | readonly |
| 1153 | }) { |
| 1154 | /** @type {import(class="st">"../serialization/Serializer")<PackContainer, null, EXPECTED_OBJECT>} */ |
| 1155 | this.fileSerializer = createFileSerializer( |
| 1156 | fs, |
| 1157 | /** @type {HashFunction} */ |
| 1158 | (compiler.options.output.hashFunction) |
| 1159 | ); |
| 1160 | /** @type {FileSystemInfo} */ |
| 1161 | this.fileSystemInfo = new FileSystemInfo(fs, { |
| 1162 | managedPaths: snapshot.managedPaths, |
| 1163 | immutablePaths: snapshot.immutablePaths, |
| 1164 | logger: logger.getChildLogger(class="st">"webpack.FileSystemInfo"), |
| 1165 | hashFunction: compiler.options.output.hashFunction |
| 1166 | }); |
| 1167 | /** @type {Compiler} */ |
| 1168 | this.compiler = compiler; |
| 1169 | /** @type {string} */ |
| 1170 | this.context = context; |
| 1171 | /** @type {string} */ |
| 1172 | this.cacheLocation = cacheLocation; |
| 1173 | /** @type {string} */ |
| 1174 | this.version = version; |
| 1175 | /** @type {Logger} */ |
| 1176 | this.logger = logger; |
| 1177 | /** @type {number} */ |
| 1178 | this.maxAge = maxAge; |
| 1179 | /** @type {boolean | undefined} */ |
| 1180 | this.profile = profile; |
| 1181 | /** @type {boolean | undefined} */ |
| 1182 | this.readonly = readonly; |
| 1183 | /** @type {boolean | undefined} */ |
| 1184 | this.allowCollectingMemory = allowCollectingMemory; |
| 1185 | /** @type {false | class="st">"gzip" | class="st">"brotli" | undefined} */ |
| 1186 | this.compression = compression; |
| 1187 | /** @type {string} */ |
| 1188 | this._extension = |
| 1189 | compression === class="st">"brotli" |
| 1190 | ? class="st">".pack.br" |
| 1191 | : compression === class="st">"gzip" |
| 1192 | ? class="st">".pack.gz" |
| 1193 | : class="st">".pack"; |
| 1194 | /** @type {SnapshotOptions} */ |
| 1195 | this.snapshot = snapshot; |
| 1196 | /** @type {BuildDependencies} */ |
| 1197 | this.buildDependencies = new Set(); |