index.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. import {createRequire as __cjsCompatRequire} from 'module';
  2. const require = __cjsCompatRequire(import.meta.url);
  3. import {
  4. GLOBAL_DEFS_FOR_TERSER,
  5. GLOBAL_DEFS_FOR_TERSER_WITH_AOT,
  6. constructorParametersDownlevelTransform
  7. } from "./chunk-ZSPLLTLI.js";
  8. import {
  9. DEFAULT_ERROR_CODE,
  10. DecoratorType,
  11. DocsExtractor,
  12. EmitFlags,
  13. EntryType,
  14. MemberTags,
  15. MemberType,
  16. NgCompiler,
  17. NgCompilerHost,
  18. NgtscProgram,
  19. PatchedProgramIncrementalBuildStrategy,
  20. SOURCE,
  21. UNKNOWN_ERROR_CODE,
  22. calcProjectFileAndBasePath,
  23. createCompilerHost,
  24. createProgram,
  25. defaultGatherDiagnostics,
  26. exitCodeFromResult,
  27. formatDiagnostics,
  28. freshCompilationTicket,
  29. incrementalFromStateTicket,
  30. isDocEntryWithSourceInfo,
  31. isTsDiagnostic,
  32. performCompilation,
  33. readConfiguration
  34. } from "./chunk-Z4732XCW.js";
  35. import {
  36. angularJitApplicationTransform,
  37. getDownlevelDecoratorsTransform,
  38. getInitializerApiJitTransform
  39. } from "./chunk-YEQZ4XY7.js";
  40. import {
  41. OptimizeFor,
  42. TsCreateProgramDriver
  43. } from "./chunk-YNWO773W.js";
  44. import {
  45. ErrorCode,
  46. isLocalCompilationDiagnostics,
  47. ngErrorCode
  48. } from "./chunk-KOIBHR3X.js";
  49. import {
  50. ActivePerfRecorder,
  51. PerfPhase
  52. } from "./chunk-I6R3GL3L.js";
  53. import {
  54. ConsoleLogger,
  55. LogLevel
  56. } from "./chunk-GBKXY6BH.js";
  57. import {
  58. LogicalFileSystem,
  59. LogicalProjectPath,
  60. NgtscCompilerHost,
  61. NodeJSFileSystem,
  62. absoluteFrom,
  63. absoluteFromSourceFile,
  64. basename,
  65. createFileSystemTsReadDirectoryFn,
  66. dirname,
  67. getFileSystem,
  68. getSourceFileOrError,
  69. isLocalRelativePath,
  70. isRoot,
  71. isRooted,
  72. join,
  73. relative,
  74. relativeFrom,
  75. resolve,
  76. setFileSystem,
  77. toRelativeImport
  78. } from "./chunk-STORTTKY.js";
  79. import "./chunk-KPQ72R34.js";
  80. // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version.mjs
  81. import { Version } from "@angular/compiler";
  82. var VERSION = new Version("19.2.4");
  83. // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/tsc_plugin.mjs
  84. var NgTscPlugin = class {
  85. ngOptions;
  86. name = "ngtsc";
  87. options = null;
  88. host = null;
  89. _compiler = null;
  90. get compiler() {
  91. if (this._compiler === null) {
  92. throw new Error("Lifecycle error: setupCompilation() must be called first.");
  93. }
  94. return this._compiler;
  95. }
  96. constructor(ngOptions) {
  97. this.ngOptions = ngOptions;
  98. setFileSystem(new NodeJSFileSystem());
  99. }
  100. wrapHost(host, inputFiles, options) {
  101. this.options = { ...this.ngOptions, ...options };
  102. this.host = NgCompilerHost.wrap(host, inputFiles, this.options, null);
  103. return this.host;
  104. }
  105. setupCompilation(program, oldProgram) {
  106. var _a;
  107. const perfRecorder = ActivePerfRecorder.zeroedToNow();
  108. if (this.host === null || this.options === null) {
  109. throw new Error("Lifecycle error: setupCompilation() before wrapHost().");
  110. }
  111. this.host.postProgramCreationCleanup();
  112. const programDriver = new TsCreateProgramDriver(program, this.host, this.options, this.host.shimExtensionPrefixes);
  113. const strategy = new PatchedProgramIncrementalBuildStrategy();
  114. const oldState = oldProgram !== void 0 ? strategy.getIncrementalState(oldProgram) : null;
  115. let ticket;
  116. const modifiedResourceFiles = /* @__PURE__ */ new Set();
  117. if (this.host.getModifiedResourceFiles !== void 0) {
  118. for (const resourceFile of (_a = this.host.getModifiedResourceFiles()) != null ? _a : []) {
  119. modifiedResourceFiles.add(resolve(resourceFile));
  120. }
  121. }
  122. if (oldProgram === void 0 || oldState === null) {
  123. ticket = freshCompilationTicket(
  124. program,
  125. this.options,
  126. strategy,
  127. programDriver,
  128. perfRecorder,
  129. false,
  130. false
  131. );
  132. } else {
  133. strategy.toNextBuildStrategy().getIncrementalState(oldProgram);
  134. ticket = incrementalFromStateTicket(oldProgram, oldState, program, this.options, strategy, programDriver, modifiedResourceFiles, perfRecorder, false, false);
  135. }
  136. this._compiler = NgCompiler.fromTicket(ticket, this.host);
  137. return {
  138. ignoreForDiagnostics: this._compiler.ignoreForDiagnostics,
  139. ignoreForEmit: this._compiler.ignoreForEmit
  140. };
  141. }
  142. getDiagnostics(file) {
  143. if (file === void 0) {
  144. return this.compiler.getDiagnostics();
  145. }
  146. return this.compiler.getDiagnosticsForFile(file, OptimizeFor.WholeProgram);
  147. }
  148. getOptionDiagnostics() {
  149. return this.compiler.getOptionDiagnostics();
  150. }
  151. getNextProgram() {
  152. return this.compiler.getCurrentProgram();
  153. }
  154. createTransformers() {
  155. this.compiler.perfRecorder.phase(PerfPhase.TypeScriptEmit);
  156. return this.compiler.prepareEmit().transformers;
  157. }
  158. };
  159. // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/index.mjs
  160. setFileSystem(new NodeJSFileSystem());
  161. export {
  162. ConsoleLogger,
  163. DEFAULT_ERROR_CODE,
  164. DecoratorType,
  165. DocsExtractor,
  166. EmitFlags,
  167. EntryType,
  168. ErrorCode,
  169. GLOBAL_DEFS_FOR_TERSER,
  170. GLOBAL_DEFS_FOR_TERSER_WITH_AOT,
  171. LogLevel,
  172. LogicalFileSystem,
  173. LogicalProjectPath,
  174. MemberTags,
  175. MemberType,
  176. NgTscPlugin,
  177. NgtscCompilerHost,
  178. NgtscProgram,
  179. NodeJSFileSystem,
  180. OptimizeFor,
  181. SOURCE,
  182. UNKNOWN_ERROR_CODE,
  183. VERSION,
  184. absoluteFrom,
  185. absoluteFromSourceFile,
  186. angularJitApplicationTransform,
  187. basename,
  188. calcProjectFileAndBasePath,
  189. constructorParametersDownlevelTransform,
  190. createCompilerHost,
  191. createFileSystemTsReadDirectoryFn,
  192. createProgram,
  193. defaultGatherDiagnostics,
  194. dirname,
  195. exitCodeFromResult,
  196. formatDiagnostics,
  197. getDownlevelDecoratorsTransform,
  198. getFileSystem,
  199. getInitializerApiJitTransform,
  200. getSourceFileOrError,
  201. isDocEntryWithSourceInfo,
  202. isLocalCompilationDiagnostics,
  203. isLocalRelativePath,
  204. isRoot,
  205. isRooted,
  206. isTsDiagnostic,
  207. join,
  208. ngErrorCode,
  209. performCompilation,
  210. readConfiguration,
  211. relative,
  212. relativeFrom,
  213. resolve,
  214. setFileSystem,
  215. toRelativeImport
  216. };
  217. /**
  218. * @license
  219. * Copyright Google LLC All Rights Reserved.
  220. *
  221. * Use of this source code is governed by an MIT-style license that can be
  222. * found in the LICENSE file at https://angular.dev/license
  223. */
  224. //# sourceMappingURL=index.js.map