@nx/js 22.7.0-pr.35356.e1b62ce → 22.7.0-rc.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "22.7.0-pr.35356.e1b62ce",
3
+ "version": "22.7.0-rc.0",
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": {
@@ -40,8 +40,8 @@
40
40
  "@babel/preset-env": "^7.23.2",
41
41
  "@babel/preset-typescript": "^7.22.5",
42
42
  "@babel/runtime": "^7.22.6",
43
- "@nx/devkit": "22.7.0-pr.35356.e1b62ce",
44
- "@nx/workspace": "22.7.0-pr.35356.e1b62ce",
43
+ "@nx/devkit": "22.7.0-rc.0",
44
+ "@nx/workspace": "22.7.0-rc.0",
45
45
  "@zkochan/js-yaml": "0.0.7",
46
46
  "babel-plugin-const-enum": "^1.0.1",
47
47
  "babel-plugin-macros": "^3.1.0",
@@ -61,7 +61,7 @@
61
61
  "tslib": "^2.3.0"
62
62
  },
63
63
  "devDependencies": {
64
- "nx": "22.7.0-pr.35356.e1b62ce"
64
+ "nx": "22.7.0-rc.0"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "verdaccio": "^6.0.5"
@@ -1 +1 @@
1
- {"version":3,"file":"node.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/node/node.impl.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EAQhB,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAe,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAqB5D,wBAAuB,YAAY,CACjC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,eAAe;aAgEb,OAAO;cACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;cA6QhC;AA+HD,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"node.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/node/node.impl.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EAQhB,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAe,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAqB5D,wBAAuB,YAAY,CACjC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,eAAe;aAgEb,OAAO;cACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;cA6QhC;AAmJD,eAAe,YAAY,CAAC"}
@@ -295,7 +295,11 @@ function calculateResolveMappings(context, options) {
295
295
  const { dependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, parsed.project, parsed.target, parsed.configuration);
296
296
  return dependencies.reduce((m, c) => {
297
297
  if (c.node.type !== 'npm' && c.outputs[0] != null) {
298
- m[c.name] = (0, devkit_1.joinPathFragments)(context.root, c.outputs[0]);
298
+ // `outputs` are cache patterns and may contain globs (e.g. from the
299
+ // inferred `@nx/js/typescript` build target). Strip the glob portion
300
+ // so the runtime require overrides resolve to the actual output dir.
301
+ const outputDir = stripGlobToBaseDir(c.outputs[0]);
302
+ m[c.name] = (0, devkit_1.joinPathFragments)(context.root, outputDir);
299
303
  }
300
304
  return m;
301
305
  }, {});
@@ -329,7 +333,13 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
329
333
  projectRoot: project.data.root,
330
334
  workspaceRoot: context.root,
331
335
  });
332
- return path.join(outputFilePath, 'main.js');
336
+ // `outputs` are cache patterns and may contain globs (e.g. the inferred
337
+ // `@nx/js/typescript` build target scopes its output to
338
+ // `{projectRoot}/dist/**/*.{js,...}` to avoid caching non-tsc files).
339
+ // Strip the glob portion back to the last path separator before it to
340
+ // recover the base output directory.
341
+ const outputDir = stripGlobToBaseDir(outputFilePath);
342
+ return path.join(outputDir, 'main.js');
333
343
  }
334
344
  const fallbackFile = path.join('dist', project.data.root, 'main.js');
335
345
  devkit_1.logger.warn(`Build option ${chalk_1.default.bold('outputFileName')} not set for ${chalk_1.default.bold(project.name)}. Using fallback value of ${chalk_1.default.bold(fallbackFile)}.`);
@@ -348,6 +358,15 @@ function getFileToRun(context, project, buildOptions, buildTargetExecutor) {
348
358
  }
349
359
  return (0, path_1.join)(context.root, buildOptions.outputPath, outputFileName);
350
360
  }
361
+ function stripGlobToBaseDir(pathWithGlob) {
362
+ const globIdx = pathWithGlob.search(/[*?[{(]/);
363
+ if (globIdx === -1) {
364
+ return pathWithGlob.replace(/[\\/]+$/, '');
365
+ }
366
+ const prefix = pathWithGlob.slice(0, globIdx);
367
+ const lastSep = Math.max(prefix.lastIndexOf('/'), prefix.lastIndexOf('\\'));
368
+ return lastSep === -1 ? '' : prefix.slice(0, lastSep);
369
+ }
351
370
  function fileToRunCorrectPath(fileToRun) {
352
371
  if ((0, fileutils_1.fileExists)(fileToRun))
353
372
  return fileToRun;
@@ -61,7 +61,6 @@ function* compileTS(context, logger, hooks, reporters) {
61
61
  });
62
62
  const rootNames = Object.keys(context);
63
63
  const solutionBuilder = ts.createSolutionBuilder(solutionBuilderHost, rootNames, {});
64
- // eslint-disable-next-line no-constant-condition
65
64
  while (true) {
66
65
  project = solutionBuilder.getNextInvalidatedProject();
67
66
  if (!project) {
@@ -456,17 +456,18 @@ function getInputs(namedInputs, config, tsConfig, internalProjectReferences, wor
456
456
  if (excludePaths.size) {
457
457
  inputs.push(...Array.from(excludePaths).map((p) => `!${pathToInputOrOutput((0, devkit_1.joinPathFragments)(config.project.root, p), workspaceRoot, config.project)}`));
458
458
  }
459
- // tsc --build reads .d.ts and .tsbuildinfo files from dependent tasks, not
460
- // the source files of dependencies. This correctly tracks build outputs from
461
- // both external project references and same-project task dependencies (e.g.
462
- // build-native producing .d.ts files that may be excluded from file watching
463
- // via .nxignore. "*.d.ts" are also read from the deps projects sources.
459
+ // tsc --build reads .d.ts/.d.cts/.d.mts and .tsbuildinfo files from dependent
460
+ // tasks, not the source files of dependencies. This correctly tracks build
461
+ // outputs from both external project references and same-project task
462
+ // dependencies (e.g. build-native producing .d.ts files that may be excluded
463
+ // from file watching via .nxignore). Declaration files are also read from
464
+ // the deps projects sources.
464
465
  inputs.push({
465
- dependentTasksOutputFiles: '**/*.{d.ts,tsbuildinfo}',
466
+ dependentTasksOutputFiles: '**/*.{d.ts,d.cts,d.mts,tsbuildinfo}',
466
467
  transitive: true,
467
468
  });
468
469
  inputs.push({
469
- fileset: '{projectRoot}/**/*.d.ts',
470
+ fileset: '{projectRoot}/**/*.{d.ts,d.cts,d.mts}',
470
471
  dependencies: true,
471
472
  });
472
473
  const externalRefPatterns = getExternalProjectReferenceTsconfigPatterns(tsConfig, internalProjectReferences, workspaceRoot, config.project, cache);
@@ -499,9 +500,9 @@ function getOutputs(config, rootTsConfig, internalProjectReferences, workspaceRo
499
500
  }
500
501
  else if (tsConfig.options.outDir) {
501
502
  if (emitDeclarationOnly) {
502
- outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, '**/*.d.ts'), workspaceRoot, config.project));
503
+ outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, '**/*.{d.ts,d.cts,d.mts}'), workspaceRoot, config.project));
503
504
  if (tsConfig.options.declarationMap) {
504
- outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, '**/*.d.ts.map'), workspaceRoot, config.project));
505
+ outputs.add(pathToInputOrOutput((0, devkit_1.joinPathFragments)(tsConfig.options.outDir, '**/*.{d.ts,d.cts,d.mts}.map'), workspaceRoot, config.project));
505
506
  }
506
507
  }
507
508
  else {