@nx/js 22.6.0-pr.34722.ef1fe91 → 22.6.0-pr.34746.a1e500d

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-pr.34722.ef1fe91",
3
+ "version": "22.6.0-pr.34746.a1e500d",
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-pr.34722.ef1fe91",
43
- "@nx/workspace": "22.6.0-pr.34722.ef1fe91",
42
+ "@nx/devkit": "22.6.0-pr.34746.a1e500d",
43
+ "@nx/workspace": "22.6.0-pr.34746.a1e500d",
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-pr.34722.ef1fe91"
63
+ "nx": "22.6.0-pr.34746.a1e500d"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "verdaccio": "^6.0.5"
@@ -3,6 +3,7 @@ export interface TscPluginOptions {
3
3
  compiler?: 'tsc' | 'tsgo';
4
4
  typecheck?: boolean | {
5
5
  targetName?: string;
6
+ configName?: string;
6
7
  };
7
8
  build?: boolean | {
8
9
  targetName?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;AAgCpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,SAAS,CAAC,EACN,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACN,KAAK,CAAC,EACF,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;IACN,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA0KD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAI/C,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,gBAAgB,CA0FzD,CAAC;AAEF,eAAO,MAAM,WAAW,iCAAgB,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;AA+BpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,SAAS,CAAC,EACN,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACN,KAAK,CAAC,EACF,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;IACN,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA2KD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAI/C,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,gBAAgB,CA0FzD,CAAC;AAEF,eAAO,MAAM,WAAW,iCAAgB,CAAC"}
@@ -5,7 +5,6 @@ const devkit_1 = require("@nx/devkit");
5
5
  const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
6
6
  const node_fs_1 = require("node:fs");
7
7
  const node_path_1 = require("node:path");
8
- const posix = require("node:path/posix");
9
8
  const file_hasher_1 = require("nx/src/hasher/file-hasher");
10
9
  const picomatch = require("picomatch");
11
10
  // eslint-disable-next-line @typescript-eslint/no-restricted-imports
@@ -67,7 +66,7 @@ function createConfigContext(configFilePath, workspaceRoot, projectContext) {
67
66
  return {
68
67
  originalPath: configFilePath,
69
68
  absolutePath,
70
- relativePath: posix.relative(workspaceRoot, absolutePath),
69
+ relativePath: posixRelative(workspaceRoot, absolutePath),
71
70
  basename: (0, node_path_1.basename)(configFilePath),
72
71
  basenameNoExt: (0, node_path_1.basename)(configFilePath, '.json'),
73
72
  dirname: (0, node_path_1.dirname)(absolutePath),
@@ -87,7 +86,7 @@ function getConfigContext(configPath, workspaceRoot, cache) {
87
86
  if (!cache.projectContexts.has(projectRoot)) {
88
87
  cache.projectContexts.set(projectRoot, {
89
88
  root: projectRoot,
90
- normalized: posix.normalize(projectRoot),
89
+ normalized: (0, devkit_1.normalizePath)(projectRoot),
91
90
  absolute: (0, node_path_1.join)(workspaceRoot, projectRoot),
92
91
  });
93
92
  }
@@ -167,7 +166,8 @@ async function resolveValidConfigFilesAndHashes(configFilePaths, options, option
167
166
  const absolutePath = (0, node_path_1.join)(context.workspaceRoot, configFilePath);
168
167
  const configContext = getConfigContext(absolutePath, context.workspaceRoot, cache);
169
168
  // Skip configs that can't produce any targets based on plugin options
170
- const isTypecheckConfig = configContext.basename === 'tsconfig.json';
169
+ const isTypecheckConfig = configContext.basename ===
170
+ (options.typecheck ? options.typecheck.configName : 'tsconfig.json');
171
171
  const isBuildConfig = options.build && configContext.basename === options.build.configName;
172
172
  if (!isTypecheckConfig && !isBuildConfig) {
173
173
  continue;
@@ -249,8 +249,8 @@ function buildTscTargets(config, options, context, configFiles, cache) {
249
249
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(config.project.root, context);
250
250
  const tsConfig = retrieveTsConfigFromCache(config.absolutePath, context.workspaceRoot, cache);
251
251
  let internalProjectReferences;
252
- if (config.basename === 'tsconfig.json' &&
253
- options.typecheck &&
252
+ if (options.typecheck &&
253
+ config.basename === options.typecheck.configName &&
254
254
  tsConfig.raw?.['nx']?.addTypecheckTarget !== false) {
255
255
  internalProjectReferences = resolveInternalProjectReferences(tsConfig, context.workspaceRoot, config.project, cache);
256
256
  const externalProjectReferences = resolveShallowExternalProjectReferences(tsConfig, context.workspaceRoot, config.project, cache);
@@ -747,6 +747,11 @@ function readTsConfig(tsConfigPath, workspaceRoot, cache) {
747
747
  if (!ts) {
748
748
  ts = require('typescript');
749
749
  }
750
+ // Normalize to forward slashes for TypeScript compatibility on Windows.
751
+ // TypeScript's parser normalizes paths inconsistently — diagnostics use
752
+ // normalized paths but the source file retains the original, causing
753
+ // assertion failures when backslashes are present.
754
+ tsConfigPath = tsConfigPath.replaceAll('\\', '/');
750
755
  const tsSys = {
751
756
  ...ts.sys,
752
757
  readFile: (path) => readFile(path, workspaceRoot, cache),
@@ -761,7 +766,9 @@ function normalizePluginOptions(pluginOptions = {}) {
761
766
  const defaultCompiler = 'tsc';
762
767
  const compiler = pluginOptions.compiler ?? defaultCompiler;
763
768
  const defaultTypecheckTargetName = 'typecheck';
769
+ const defaultTypecheckConfigName = 'tsconfig.json';
764
770
  let typecheck = {
771
+ configName: defaultTypecheckConfigName,
765
772
  targetName: defaultTypecheckTargetName,
766
773
  };
767
774
  if (pluginOptions.typecheck === false) {
@@ -770,6 +777,7 @@ function normalizePluginOptions(pluginOptions = {}) {
770
777
  else if (pluginOptions.typecheck &&
771
778
  typeof pluginOptions.typecheck !== 'boolean') {
772
779
  typecheck = {
780
+ configName: pluginOptions.typecheck.configName ?? defaultTypecheckConfigName,
773
781
  targetName: pluginOptions.typecheck.targetName ?? defaultTypecheckTargetName,
774
782
  };
775
783
  }
@@ -915,5 +923,5 @@ function toRelativePaths(cache, workspaceRoot) {
915
923
  return updatedCache;
916
924
  }
917
925
  function posixRelative(workspaceRoot, path) {
918
- return posix.normalize((0, node_path_1.relative)(workspaceRoot, path));
926
+ return (0, devkit_1.normalizePath)((0, node_path_1.relative)(workspaceRoot, path));
919
927
  }