@nx/js 22.6.0-beta.10 → 22.6.0-beta.11

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": "@nx/js",
3
- "version": "22.6.0-beta.10",
3
+ "version": "22.6.0-beta.11",
4
4
  "private": false,
5
5
  "description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
6
6
  "repository": {
@@ -39,8 +39,8 @@
39
39
  "@babel/preset-env": "^7.23.2",
40
40
  "@babel/preset-typescript": "^7.22.5",
41
41
  "@babel/runtime": "^7.22.6",
42
- "@nx/devkit": "22.6.0-beta.10",
43
- "@nx/workspace": "22.6.0-beta.10",
42
+ "@nx/devkit": "22.6.0-beta.11",
43
+ "@nx/workspace": "22.6.0-beta.11",
44
44
  "@zkochan/js-yaml": "0.0.7",
45
45
  "babel-plugin-const-enum": "^1.0.1",
46
46
  "babel-plugin-macros": "^3.1.0",
@@ -60,7 +60,7 @@
60
60
  "tslib": "^2.3.0"
61
61
  },
62
62
  "devDependencies": {
63
- "nx": "22.6.0-beta.10"
63
+ "nx": "22.6.0-beta.11"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "verdaccio": "^6.0.5"
@@ -457,9 +457,11 @@ function getInputs(namedInputs, config, tsConfig, internalProjectReferences, wor
457
457
  inputs.push(...Array.from(excludePaths).map((p) => `!${pathToInputOrOutput((0, devkit_1.joinPathFragments)(config.project.root, p), workspaceRoot, config.project)}`));
458
458
  }
459
459
  if (hasExternalProjectReferences(config.originalPath, tsConfig, workspaceRoot, config.project, cache)) {
460
- // Importing modules from a referenced project will load its output declaration files (d.ts)
460
+ // tsc --build reads .d.ts and .tsbuildinfo files from referenced projects
461
461
  // https://www.typescriptlang.org/docs/handbook/project-references.html#what-is-a-project-reference
462
- inputs.push({ dependentTasksOutputFiles: '**/*.d.ts' });
462
+ inputs.push({
463
+ dependentTasksOutputFiles: '**/*.{d.ts,tsbuildinfo}',
464
+ });
463
465
  }
464
466
  else {
465
467
  inputs.push('production' in namedInputs ? '^production' : '^default');
@@ -467,17 +469,23 @@ function getInputs(namedInputs, config, tsConfig, internalProjectReferences, wor
467
469
  // inputs.push({ externalDependencies });
468
470
  return inputs;
469
471
  }
470
- function getOutputs(config, tsConfig, internalProjectReferences, workspaceRoot, emitDeclarationOnly) {
472
+ function getOutputs(config, rootTsConfig, internalProjectReferences, workspaceRoot, emitDeclarationOnly) {
471
473
  const outputs = new Set();
472
474
  // We could have more surgical outputs based on the tsconfig options, but the
473
475
  // user could override them through the command line and that wouldn't be
474
476
  // reflected in the outputs. So, we just include everything that could be
475
477
  // produced by the tsc command.
476
- [tsConfig, ...Object.values(internalProjectReferences)].forEach((tsconfig) => {
477
- if (tsconfig.options.outFile) {
478
- const outFileName = (0, node_path_1.basename)(tsconfig.options.outFile, '.js');
479
- const outFileDir = (0, node_path_1.dirname)(tsconfig.options.outFile);
480
- outputs.add(pathToInputOrOutput(tsconfig.options.outFile, workspaceRoot, config.project));
478
+ [
479
+ { configBaseNameNoExt: config.basenameNoExt, tsConfig: rootTsConfig },
480
+ ...Object.entries(internalProjectReferences).map(([internalConfigPath, internalConfig]) => ({
481
+ configBaseNameNoExt: (0, node_path_1.basename)(internalConfigPath, '.json'),
482
+ tsConfig: internalConfig,
483
+ })),
484
+ ].forEach(({ configBaseNameNoExt, tsConfig }) => {
485
+ if (tsConfig.options.outFile) {
486
+ const outFileName = (0, node_path_1.basename)(tsConfig.options.outFile, '.js');
487
+ const outFileDir = (0, node_path_1.dirname)(tsConfig.options.outFile);
488
+ outputs.add(pathToInputOrOutput(tsConfig.options.outFile, workspaceRoot, config.project));
481
489
  // outFile is not be used with .cjs, .mjs, .jsx, so the list is simpler
482
490
  const outDir = (0, node_path_1.relative)(workspaceRoot, outFileDir);
483
491
  outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(outDir, `${outFileName}.js.map`), workspaceRoot, config.project));
@@ -488,38 +496,36 @@ function getOutputs(config, tsConfig, internalProjectReferences, workspaceRoot,
488
496
  ? pathToInputOrOutput(tsConfig.options.tsBuildInfoFile, workspaceRoot, config.project)
489
497
  : pathToInputOrOutput((0, devkit_1.joinPathFragments)(outDir, `${outFileName}.tsbuildinfo`), workspaceRoot, config.project));
490
498
  }
491
- else if (tsconfig.options.outDir) {
499
+ else if (tsConfig.options.outDir) {
492
500
  if (emitDeclarationOnly) {
493
- outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsconfig.options.outDir, '**/*.d.ts'), workspaceRoot, config.project));
501
+ outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, '**/*.d.ts'), workspaceRoot, config.project));
494
502
  if (tsConfig.options.declarationMap) {
495
- outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsconfig.options.outDir, '**/*.d.ts.map'), workspaceRoot, config.project));
503
+ outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, '**/*.d.ts.map'), workspaceRoot, config.project));
496
504
  }
497
505
  }
498
506
  else {
499
- outputs.add(pathToInputOrOutput(tsconfig.options.outDir, workspaceRoot, config.project));
507
+ outputs.add(pathToInputOrOutput(tsConfig.options.outDir, workspaceRoot, config.project));
500
508
  }
501
- if (tsconfig.options.tsBuildInfoFile) {
509
+ if (tsConfig.options.tsBuildInfoFile) {
502
510
  if (emitDeclarationOnly ||
503
- !(0, node_path_1.normalize)(tsconfig.options.tsBuildInfoFile).startsWith(`${(0, node_path_1.normalize)(tsconfig.options.outDir)}${node_path_1.sep}`)) {
511
+ !(0, node_path_1.normalize)(tsConfig.options.tsBuildInfoFile).startsWith(`${(0, node_path_1.normalize)(tsConfig.options.outDir)}${node_path_1.sep}`)) {
504
512
  // https://www.typescriptlang.org/tsconfig#tsBuildInfoFile
505
- outputs.add(pathToInputOrOutput(tsconfig.options.tsBuildInfoFile, workspaceRoot, config.project));
513
+ outputs.add(pathToInputOrOutput(tsConfig.options.tsBuildInfoFile, workspaceRoot, config.project));
506
514
  }
507
515
  }
508
- else if (tsconfig.options.rootDir &&
509
- tsconfig.options.rootDir !== '.') {
516
+ else if (tsConfig.options.rootDir && tsConfig.options.rootDir !== '.') {
510
517
  // If rootDir is set, then the tsbuildinfo file will be outside the outDir so we need to add it.
511
- const relativeRootDir = (0, node_path_1.relative)(tsconfig.options.rootDir, (0, node_path_1.join)(workspaceRoot, config.project.root));
512
- outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsconfig.options.outDir, relativeRootDir, `*.tsbuildinfo`), workspaceRoot, config.project));
518
+ const relativeRootDir = (0, node_path_1.relative)(tsConfig.options.rootDir, (0, node_path_1.join)(workspaceRoot, config.project.root));
519
+ outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, relativeRootDir, `*.tsbuildinfo`), workspaceRoot, config.project));
513
520
  }
514
521
  else if (emitDeclarationOnly) {
515
522
  // https://www.typescriptlang.org/tsconfig#tsBuildInfoFile
516
- const name = config.basenameNoExt;
517
- outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsconfig.options.outDir, `${name}.tsbuildinfo`), workspaceRoot, config.project));
523
+ outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, `${configBaseNameNoExt}.tsbuildinfo`), workspaceRoot, config.project));
518
524
  }
519
525
  }
520
- else if (tsconfig.raw?.include?.length ||
521
- tsconfig.raw?.files?.length ||
522
- (!tsconfig.raw?.include && !tsconfig.raw?.files)) {
526
+ else if (tsConfig.raw?.include?.length ||
527
+ tsConfig.raw?.files?.length ||
528
+ (!tsConfig.raw?.include && !tsConfig.raw?.files)) {
523
529
  // tsc produce files in place when no outDir or outFile is set
524
530
  outputs.add((0, devkit_1.joinPathFragments)('{projectRoot}', '**/*.js'));
525
531
  outputs.add((0, devkit_1.joinPathFragments)('{projectRoot}', '**/*.cjs'));
@@ -534,10 +540,9 @@ function getOutputs(config, tsConfig, internalProjectReferences, workspaceRoot,
534
540
  outputs.add((0, devkit_1.joinPathFragments)('{projectRoot}', '**/*.d.cts.map'));
535
541
  outputs.add((0, devkit_1.joinPathFragments)('{projectRoot}', '**/*.d.mts.map'));
536
542
  // https://www.typescriptlang.org/tsconfig#tsBuildInfoFile
537
- const name = config.basenameNoExt;
538
543
  outputs.add(tsConfig.options.tsBuildInfoFile
539
544
  ? pathToInputOrOutput(tsConfig.options.tsBuildInfoFile, workspaceRoot, config.project)
540
- : (0, devkit_1.joinPathFragments)('{projectRoot}', `${name}.tsbuildinfo`));
545
+ : (0, devkit_1.joinPathFragments)('{projectRoot}', `${configBaseNameNoExt}.tsbuildinfo`));
541
546
  }
542
547
  });
543
548
  return Array.from(outputs);