nx 21.3.0-canary.20250712-18e5d95 → 21.3.0-canary.20250715-cf994df

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.
Binary file
@@ -24,7 +24,7 @@ export declare function registerTsProject(tsConfigPath: string): () => void;
24
24
  */
25
25
  export declare function registerTsProject(path: string, configFilename: string): any;
26
26
  export declare function getSwcTranspiler(compilerOptions: CompilerOptions): (...args: unknown[]) => unknown;
27
- export declare function getTsNodeTranspiler(compilerOptions: CompilerOptions, tsNodeOptions?: TsConfigOptions): (...args: unknown[]) => unknown;
27
+ export declare function getTsNodeTranspiler(compilerOptions: CompilerOptions, tsNodeOptions?: TsConfigOptions, preferTsNode?: boolean): (...args: unknown[]) => unknown;
28
28
  export declare function getTranspiler(compilerOptions: CompilerOptions, tsConfigRaw?: unknown): () => (...args: unknown[]) => unknown;
29
29
  /**
30
30
  * Register ts-node or swc-node given a set of compiler options.
@@ -91,7 +91,7 @@ function getSwcTranspiler(compilerOptions) {
91
91
  const cleanupFn = register(compilerOptions);
92
92
  return typeof cleanupFn === 'function' ? cleanupFn : () => { };
93
93
  }
94
- function getTsNodeTranspiler(compilerOptions, tsNodeOptions) {
94
+ function getTsNodeTranspiler(compilerOptions, tsNodeOptions, preferTsNode) {
95
95
  const { register } = require('ts-node');
96
96
  // ts-node doesn't provide a cleanup method
97
97
  const service = register({
@@ -106,7 +106,7 @@ function getTsNodeTranspiler(compilerOptions, tsNodeOptions) {
106
106
  });
107
107
  const { transpiler, swc } = service.options;
108
108
  // Don't warn if a faster transpiler is enabled
109
- if (!transpiler && !swc) {
109
+ if (!transpiler && !swc && !preferTsNode) {
110
110
  warnTsNodeUsage();
111
111
  }
112
112
  return () => {
@@ -170,6 +170,14 @@ function getTranspiler(compilerOptions, tsConfigRaw) {
170
170
  compilerOptions.target = ts.ScriptTarget.ES2021;
171
171
  compilerOptions.inlineSourceMap = true;
172
172
  compilerOptions.skipLibCheck = true;
173
+ // These options are different per project, and since they are not needed for transpilation, we can remove them so we have more cache hits.
174
+ compilerOptions.outDir = undefined;
175
+ compilerOptions.outFile = undefined;
176
+ compilerOptions.declaration = undefined;
177
+ compilerOptions.declarationMap = undefined;
178
+ compilerOptions.composite = undefined;
179
+ compilerOptions.tsBuildInfoFile = undefined;
180
+ delete compilerOptions.strict;
173
181
  let _getTranspiler;
174
182
  let registrationKey = JSON.stringify(compilerOptions);
175
183
  let tsNodeOptions;
@@ -193,7 +201,7 @@ function getTranspiler(compilerOptions, tsConfigRaw) {
193
201
  return registrationEntry.cleanup;
194
202
  }
195
203
  if (_getTranspiler) {
196
- const transpilerCleanup = _getTranspiler(compilerOptions, tsNodeOptions);
204
+ const transpilerCleanup = _getTranspiler(compilerOptions, tsNodeOptions, preferTsNode);
197
205
  const currRegistrationEntry = {
198
206
  refCount: 1,
199
207
  cleanup: () => {