@ngtools/webpack 11.2.5 → 11.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngtools/webpack",
3
- "version": "11.2.5",
3
+ "version": "11.2.6",
4
4
  "description": "Webpack plugin that AoT compiles your Angular components and modules.",
5
5
  "main": "./src/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "homepage": "https://github.com/angular/angular-cli",
27
27
  "dependencies": {
28
- "@angular-devkit/core": "11.2.5",
28
+ "@angular-devkit/core": "11.2.6",
29
29
  "enhanced-resolve": "5.7.0",
30
30
  "webpack-sources": "2.2.0"
31
31
  },
package/src/ivy/host.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as ts from 'typescript';
2
2
  import { NgccProcessor } from '../ngcc_processor';
3
- import { WebpackResourceLoader } from '../resource_loader';
4
- export declare function augmentHostWithResources(host: ts.CompilerHost, resourceLoader: WebpackResourceLoader, options?: {
3
+ import { ResourceLoader } from '../resource_loader';
4
+ export declare function augmentHostWithResources(host: ts.CompilerHost, resourceLoader: ResourceLoader, options?: {
5
5
  directTemplateLoading?: boolean;
6
6
  }): void;
7
7
  /**
package/src/ivy/plugin.js CHANGED
@@ -91,7 +91,9 @@ class AngularWebpackPlugin {
91
91
  });
92
92
  });
93
93
  let ngccProcessor;
94
- const resourceLoader = new resource_loader_1.WebpackResourceLoader();
94
+ const resourceLoader = this.pluginOptions.jitMode
95
+ ? new resource_loader_1.NoopResourceLoader()
96
+ : new resource_loader_1.WebpackResourceLoader();
95
97
  let previousUnused;
96
98
  compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (thisCompilation) => {
97
99
  var _a;
@@ -145,7 +147,7 @@ class AngularWebpackPlugin {
145
147
  // Setup resource loading
146
148
  resourceLoader.update(compilation, changedFiles);
147
149
  host_1.augmentHostWithResources(host, resourceLoader, {
148
- directTemplateLoading: this.pluginOptions.directTemplateLoading,
150
+ directTemplateLoading: !this.pluginOptions.jitMode && this.pluginOptions.directTemplateLoading,
149
151
  });
150
152
  // Setup source file adjustment options
151
153
  host_1.augmentHostWithReplacements(host, this.pluginOptions.fileReplacements, moduleResolutionCache);
@@ -1,3 +1,17 @@
1
+ export interface ResourceLoader {
2
+ get(file: string): Promise<string>;
3
+ getModifiedResourceFiles(): Set<string>;
4
+ getResourceDependencies(file: string): Iterable<string>;
5
+ setAffectedResources(file: string, resources: Iterable<string>): void;
6
+ update(parentCompilation: import('webpack').compilation.Compilation, changedFiles?: Iterable<string>): void;
7
+ }
8
+ export declare class NoopResourceLoader implements ResourceLoader {
9
+ get(): Promise<string>;
10
+ getModifiedResourceFiles(): Set<string>;
11
+ getResourceDependencies(): Iterable<string>;
12
+ setAffectedResources(): void;
13
+ update(): void;
14
+ }
1
15
  export declare class WebpackResourceLoader {
2
16
  private _parentCompilation;
3
17
  private _fileDependencies;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebpackResourceLoader = void 0;
3
+ exports.WebpackResourceLoader = exports.NoopResourceLoader = void 0;
4
4
  /**
5
5
  * @license
6
6
  * Copyright Google Inc. All Rights Reserved.
@@ -19,6 +19,20 @@ const NodeTemplatePlugin = require('webpack/lib/node/NodeTemplatePlugin');
19
19
  const NodeTargetPlugin = require('webpack/lib/node/NodeTargetPlugin');
20
20
  const LibraryTemplatePlugin = require('webpack/lib/LibraryTemplatePlugin');
21
21
  const SingleEntryPlugin = require('webpack/lib/SingleEntryPlugin');
22
+ class NoopResourceLoader {
23
+ async get() {
24
+ return '';
25
+ }
26
+ getModifiedResourceFiles() {
27
+ return new Set();
28
+ }
29
+ getResourceDependencies() {
30
+ return [];
31
+ }
32
+ setAffectedResources() { }
33
+ update() { }
34
+ }
35
+ exports.NoopResourceLoader = NoopResourceLoader;
22
36
  class WebpackResourceLoader {
23
37
  constructor() {
24
38
  this._fileDependencies = new Map();