| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 72dc967 commit 31c0456
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -80,6 +80,7 @@ export class BundlerContext { | |||
| 80 | 80 | #optionsFactory: BundlerOptionsFactory<BuildOptions & { metafile: true; write: false }>; | |
| 81 | 81 | #shouldCacheResult: boolean; | |
| 82 | 82 | #loadCache?: LoadResultCache; | |
| 83 | + #invalidationEpoch = 0; | ||
| 83 | 84 | readonly watchFiles = new Set<string>(); | |
| 84 | 85 | ||
| 85 | 86 | constructor( | |
@@ -128,8 +129,8 @@ export class BundlerContext { | |||
| 128 | 129 | const externalImportsBrowser = new Set<string>(); | |
| 129 | 130 | const externalImportsServer = new Set<string>(); | |
| 130 | 131 | ||
| 131 | - const outputFiles = []; | ||
| 132 | - let externalConfiguration; | ||
| 132 | + const outputFiles: BuildOutputFile[] = []; | ||
| 133 | + let externalConfiguration: Set<string> | undefined; | ||
| 133 | 134 | for (const result of results) { | |
| 134 | 135 | warnings.push(...result.warnings); | |
| 135 | 136 | if (result.errors) { | |
@@ -202,6 +203,7 @@ export class BundlerContext { | |||
| 202 | 203 | return this.#activeBundlePromise; | |
| 203 | 204 | } | |
| 204 | 205 | ||
| 206 | + const bundleEpoch = this.#invalidationEpoch; | ||
| 205 | 207 | const bundlePromise = this.#performBundle().finally(() => { | |
| 206 | 208 | if (this.#activeBundlePromise === bundlePromise) { | |
| 207 | 209 | this.#activeBundlePromise = undefined; | |
@@ -210,7 +212,7 @@ export class BundlerContext { | |||
| 210 | 212 | this.#activeBundlePromise = bundlePromise; | |
| 211 | 213 | ||
| 212 | 214 | const result = await bundlePromise; | |
| 213 | - if (this.#shouldCacheResult) { | ||
| 215 | + if (this.#shouldCacheResult && bundleEpoch === this.#invalidationEpoch) { | ||
| 214 | 216 | this.#esbuildResult = result; | |
| 215 | 217 | } | |
| 216 | 218 | ||
@@ -286,9 +288,10 @@ export class BundlerContext { | |||
| 286 | 288 | } | |
| 287 | 289 | ||
| 288 | 290 | if (this.#loadCache) { | |
| 289 | - const cachedLoad = await (this.#loadCache.get(input) ?? | ||
| 290 | - this.#loadCache.get(input.replace(';', ':')) ?? | ||
| 291 | - this.#loadCache.get('file:' + normalizedAbsoluteInput)); | ||
| 291 | + const cachedLoad = | ||
| 292 | + (await this.#loadCache.get(input)) ?? | ||
| 293 | + (await this.#loadCache.get(input.replace(';', ':'))) ?? | ||
| 294 | + (await this.#loadCache.get('file:' + normalizedAbsoluteInput)); | ||
| 292 | 295 | if (cachedLoad?.watchFiles) { | |
| 293 | 296 | for (const file of cachedLoad.watchFiles) { | |
| 294 | 297 | if (!isInternalAngularFile(file)) { | |
@@ -551,6 +554,7 @@ export class BundlerContext { | |||
| 551 | 554 | } | |
| 552 | 555 | ||
| 553 | 556 | if (invalid) { | |
| 557 | + this.#invalidationEpoch++; | ||
| 554 | 558 | this.#esbuildResult = undefined; | |
| 555 | 559 | } | |
| 556 | 560 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments