@depup/ngtools__webpack 21.2.2-depup.0

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.
Files changed (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -0
  3. package/changes.json +5 -0
  4. package/index.d.ts +8 -0
  5. package/index.js +25 -0
  6. package/index.js.map +1 -0
  7. package/package.json +50 -0
  8. package/src/benchmark.d.ts +9 -0
  9. package/src/benchmark.js +27 -0
  10. package/src/benchmark.js.map +1 -0
  11. package/src/index.d.ts +8 -0
  12. package/src/index.js +19 -0
  13. package/src/index.js.map +1 -0
  14. package/src/ivy/cache.d.ts +14 -0
  15. package/src/ivy/cache.js +33 -0
  16. package/src/ivy/cache.js.map +1 -0
  17. package/src/ivy/diagnostics.d.ts +13 -0
  18. package/src/ivy/diagnostics.js +33 -0
  19. package/src/ivy/diagnostics.js.map +1 -0
  20. package/src/ivy/host.d.ts +32 -0
  21. package/src/ivy/host.js +226 -0
  22. package/src/ivy/host.js.map +1 -0
  23. package/src/ivy/index.d.ts +10 -0
  24. package/src/ivy/index.js +17 -0
  25. package/src/ivy/index.js.map +1 -0
  26. package/src/ivy/loader.d.ts +10 -0
  27. package/src/ivy/loader.js +95 -0
  28. package/src/ivy/loader.js.map +1 -0
  29. package/src/ivy/paths.d.ts +11 -0
  30. package/src/ivy/paths.js +70 -0
  31. package/src/ivy/paths.js.map +1 -0
  32. package/src/ivy/plugin.d.ts +53 -0
  33. package/src/ivy/plugin.js +556 -0
  34. package/src/ivy/plugin.js.map +1 -0
  35. package/src/ivy/symbol.d.ts +25 -0
  36. package/src/ivy/symbol.js +45 -0
  37. package/src/ivy/symbol.js.map +1 -0
  38. package/src/ivy/system.d.ts +15 -0
  39. package/src/ivy/system.js +115 -0
  40. package/src/ivy/system.js.map +1 -0
  41. package/src/ivy/transformation.d.ts +18 -0
  42. package/src/ivy/transformation.js +137 -0
  43. package/src/ivy/transformation.js.map +1 -0
  44. package/src/loaders/inline-resource.d.ts +16 -0
  45. package/src/loaders/inline-resource.js +25 -0
  46. package/src/loaders/inline-resource.js.map +1 -0
  47. package/src/paths-plugin.d.ts +32 -0
  48. package/src/paths-plugin.js +255 -0
  49. package/src/paths-plugin.js.map +1 -0
  50. package/src/resource_loader.d.ts +29 -0
  51. package/src/resource_loader.js +321 -0
  52. package/src/resource_loader.js.map +1 -0
  53. package/src/transformers/elide_imports.d.ts +9 -0
  54. package/src/transformers/elide_imports.js +165 -0
  55. package/src/transformers/elide_imports.js.map +1 -0
  56. package/src/transformers/find_image_domains.d.ts +9 -0
  57. package/src/transformers/find_image_domains.js +132 -0
  58. package/src/transformers/find_image_domains.js.map +1 -0
  59. package/src/transformers/index.d.ts +9 -0
  60. package/src/transformers/index.js +26 -0
  61. package/src/transformers/index.js.map +1 -0
  62. package/src/transformers/remove-ivy-jit-support-calls.d.ts +9 -0
  63. package/src/transformers/remove-ivy-jit-support-calls.js +136 -0
  64. package/src/transformers/remove-ivy-jit-support-calls.js.map +1 -0
  65. package/src/transformers/replace_resources.d.ts +11 -0
  66. package/src/transformers/replace_resources.js +250 -0
  67. package/src/transformers/replace_resources.js.map +1 -0
  68. package/src/transformers/spec_helpers.d.ts +13 -0
  69. package/src/transformers/spec_helpers.js +89 -0
  70. package/src/transformers/spec_helpers.js.map +1 -0
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.dev/license
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.angularWebpackLoader = angularWebpackLoader;
44
+ exports.default = angularWebpackLoader;
45
+ const path = __importStar(require("node:path"));
46
+ const symbol_1 = require("./symbol");
47
+ const JS_FILE_REGEXP = /\.[cm]?js$/;
48
+ function angularWebpackLoader(content, map) {
49
+ const callback = this.async();
50
+ if (!callback) {
51
+ throw new Error('Invalid webpack version');
52
+ }
53
+ const fileEmitter = this[symbol_1.AngularPluginSymbol];
54
+ if (!fileEmitter || typeof fileEmitter !== 'object') {
55
+ if (JS_FILE_REGEXP.test(this.resourcePath)) {
56
+ // Passthrough for JS files when no plugin is used
57
+ this.callback(undefined, content, map);
58
+ return;
59
+ }
60
+ callback(new Error('The Angular Webpack loader requires the AngularWebpackPlugin.'));
61
+ return;
62
+ }
63
+ fileEmitter
64
+ .emit(this.resourcePath)
65
+ .then((result) => {
66
+ if (!result) {
67
+ if (JS_FILE_REGEXP.test(this.resourcePath)) {
68
+ // Return original content for JS files if not compiled by TypeScript ("allowJs")
69
+ this.callback(undefined, content, map);
70
+ }
71
+ else {
72
+ // File is not part of the compilation
73
+ const message = `${this.resourcePath} is missing from the TypeScript compilation. ` +
74
+ `Please make sure it is in your tsconfig via the 'files' or 'include' property.`;
75
+ callback(new Error(message));
76
+ }
77
+ return;
78
+ }
79
+ result.dependencies.forEach((dependency) => this.addDependency(dependency));
80
+ let resultContent = result.content || '';
81
+ let resultMap;
82
+ if (result.map) {
83
+ resultContent = resultContent.replace(/^\/\/# sourceMappingURL=[^\r\n]*/gm, '');
84
+ resultMap = JSON.parse(result.map);
85
+ resultMap.sources = resultMap.sources.map((source) => path.join(path.dirname(this.resourcePath), source));
86
+ }
87
+ callback(undefined, resultContent, resultMap);
88
+ })
89
+ .catch((err) => {
90
+ // The below is needed to hide stacktraces from users.
91
+ const message = err instanceof Error ? err.message : err;
92
+ callback(new Error(message));
93
+ });
94
+ }
95
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["loader.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYH,oDA+DC;AAEgC,uCAAO;AA3ExC,gDAAkC;AAElC,qCAAsE;AAMtE,MAAM,cAAc,GAAG,YAAY,CAAC;AAEpC,SAAgB,oBAAoB,CAElC,OAAe,EACf,GAAW;IAEX,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAC9B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,WAAW,GACf,IACD,CAAC,4BAAmB,CAAC,CAAC;IACvB,IAAI,CAAC,WAAW,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpD,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAC3C,kDAAkD;YAClD,IAAI,CAAC,QAAQ,CAAC,SAA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AAC,CACnD,CAAC;QACJ,CAAC;QAED,QAAQ,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,sDAAsD;QACtD,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;QACzD,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+ export declare function normalizePath(path: string): string;
9
+ declare function externalizeForWindows(path: string): string;
10
+ export declare const externalizePath: typeof externalizeForWindows;
11
+ export {};
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.dev/license
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.externalizePath = void 0;
44
+ exports.normalizePath = normalizePath;
45
+ const nodePath = __importStar(require("node:path"));
46
+ const normalizationCache = new Map();
47
+ function normalizePath(path) {
48
+ let result = normalizationCache.get(path);
49
+ if (result === undefined) {
50
+ result = nodePath.win32.normalize(path).replace(/\\/g, nodePath.posix.sep);
51
+ normalizationCache.set(path, result);
52
+ }
53
+ return result;
54
+ }
55
+ const externalizationCache = new Map();
56
+ function externalizeForWindows(path) {
57
+ let result = externalizationCache.get(path);
58
+ if (result === undefined) {
59
+ result = nodePath.win32.normalize(path);
60
+ externalizationCache.set(path, result);
61
+ }
62
+ return result;
63
+ }
64
+ exports.externalizePath = (() => {
65
+ if (process.platform !== 'win32') {
66
+ return (path) => path;
67
+ }
68
+ return externalizeForWindows;
69
+ })();
70
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["paths.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMH,sCASC;AAbD,oDAAsC;AAEtC,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAErD,SAAgB,aAAa,CAAC,IAAY;IACxC,IAAI,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAE1C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3E,kBAAkB,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEvD,SAAS,qBAAqB,CAAC,IAAY;IACzC,IAAI,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAE5C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACxC,oBAAoB,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAEY,QAAA,eAAe,GAAiC,CAAC,GAAG,EAAE;IACjE,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC;IAChC,CAAC;IAED,OAAO,qBAAqB,CAAC;AAC/B,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+ import type { CompilerOptions } from '@angular/compiler-cli';
9
+ import type { Compiler } from 'webpack';
10
+ export declare const imageDomains: Set<string>;
11
+ export interface AngularWebpackPluginOptions {
12
+ tsconfig: string;
13
+ compilerOptions?: CompilerOptions;
14
+ fileReplacements: Record<string, string>;
15
+ substitutions: Record<string, string>;
16
+ directTemplateLoading: boolean;
17
+ emitClassMetadata: boolean;
18
+ emitNgModuleScope: boolean;
19
+ emitSetClassDebugInfo?: boolean;
20
+ jitMode: boolean;
21
+ inlineStyleFileExtension?: string;
22
+ }
23
+ export declare class AngularWebpackPlugin {
24
+ private readonly pluginOptions;
25
+ private compilerCliModule?;
26
+ private compilerCliToolingModule?;
27
+ private watchMode?;
28
+ private ngtscNextProgram?;
29
+ private builder?;
30
+ private sourceFileCache?;
31
+ private webpackCache?;
32
+ private webpackCreateHash?;
33
+ private readonly fileDependencies;
34
+ private readonly requiredFilesToEmit;
35
+ private readonly requiredFilesToEmitCache;
36
+ private readonly fileEmitHistory;
37
+ constructor(options?: Partial<AngularWebpackPluginOptions>);
38
+ private get compilerCli();
39
+ private get compilerCliTooling();
40
+ get options(): AngularWebpackPluginOptions;
41
+ apply(compiler: Compiler): void;
42
+ private setupCompilation;
43
+ private registerWithCompilation;
44
+ private markResourceUsed;
45
+ private rebuildRequiredFiles;
46
+ private loadConfiguration;
47
+ private updateAotProgram;
48
+ private updateJitProgram;
49
+ private createFileEmitter;
50
+ private initializeCompilerCli;
51
+ private addFileEmitHistory;
52
+ private getFileEmitHistory;
53
+ }