@nx/js 22.4.0-beta.0 → 22.4.0-beta.1

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.4.0-beta.0",
3
+ "version": "22.4.0-beta.1",
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.4.0-beta.0",
43
- "@nx/workspace": "22.4.0-beta.0",
42
+ "@nx/devkit": "22.4.0-beta.1",
43
+ "@nx/workspace": "22.4.0-beta.1",
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.4.0-beta.0"
63
+ "nx": "22.4.0-beta.1"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "verdaccio": "^6.0.5"
@@ -1,4 +1,3 @@
1
1
  import type { NxJsonConfiguration } from '@nx/devkit';
2
2
  export declare function ensureProjectIsIncludedInPluginRegistrations(nxJson: NxJsonConfiguration, projectRoot: string, buildTargetName: string | null): void;
3
- export declare function ensureProjectIsExcludedFromPluginRegistrations(nxJson: NxJsonConfiguration, projectRoot: string): void;
4
3
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAIpB,wBAAgB,4CAA4C,CAC1D,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,GAAG,IAAI,GAC7B,IAAI,CAmGN;AAED,wBAAgB,8CAA8C,CAC5D,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,MAAM,GAClB,IAAI,CAyCN"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAIpB,wBAAgB,4CAA4C,CAC1D,MAAM,EAAE,mBAAmB,EAC3B,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,GAAG,IAAI,GAC7B,IAAI,CAmGN"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ensureProjectIsIncludedInPluginRegistrations = ensureProjectIsIncludedInPluginRegistrations;
4
- exports.ensureProjectIsExcludedFromPluginRegistrations = ensureProjectIsExcludedFromPluginRegistrations;
5
4
  const devkit_internals_1 = require("nx/src/devkit-internals");
6
5
  function ensureProjectIsIncludedInPluginRegistrations(nxJson, projectRoot, buildTargetName) {
7
6
  nxJson.plugins ??= [];
@@ -14,7 +13,7 @@ function ensureProjectIsIncludedInPluginRegistrations(nxJson, projectRoot, build
14
13
  }
15
14
  if (typeof registration === 'string') {
16
15
  if (buildTargetName) {
17
- // if it's a string all projects are included but the are no user-specified options
16
+ // if it's a string all projects are included but there are no user-specified options
18
17
  // and the build task is not inferred by default, so we need to exclude it
19
18
  nxJson.plugins[index] = {
20
19
  plugin: '@nx/js/typescript',
@@ -87,38 +86,6 @@ function ensureProjectIsIncludedInPluginRegistrations(nxJson, projectRoot, build
87
86
  nxJson.plugins.push(registration);
88
87
  }
89
88
  }
90
- function ensureProjectIsExcludedFromPluginRegistrations(nxJson, projectRoot) {
91
- if (!nxJson.plugins?.length ||
92
- !nxJson.plugins.some(isTypeScriptPluginRegistration)) {
93
- return;
94
- }
95
- let index = 0;
96
- for (const registration of nxJson.plugins) {
97
- if (!isTypeScriptPluginRegistration(registration)) {
98
- index++;
99
- continue;
100
- }
101
- if (typeof registration === 'string') {
102
- // if it's a string, it includes all projects, so we need to exclude it
103
- nxJson.plugins[index] = {
104
- plugin: '@nx/js/typescript',
105
- exclude: [`${projectRoot}/*`],
106
- };
107
- }
108
- else {
109
- // check if the project would be included by the plugin registration
110
- const matchingConfigFiles = (0, devkit_internals_1.findMatchingConfigFiles)([`${projectRoot}/tsconfig.json`], '**/tsconfig.json', registration.include, registration.exclude);
111
- if (matchingConfigFiles.length &&
112
- (registration.options?.typecheck !== false ||
113
- registration.options?.build)) {
114
- // the project is included by a plugin registration that infers any of the targets, so we need to exclude it
115
- registration.exclude ??= [];
116
- registration.exclude.push(`${projectRoot}/*`);
117
- }
118
- }
119
- index++;
120
- }
121
- }
122
89
  function isTypeScriptPluginRegistration(plugin) {
123
90
  return ((typeof plugin === 'string' && plugin === '@nx/js/typescript') ||
124
91
  (typeof plugin !== 'string' && plugin.plugin === '@nx/js/typescript'));
@@ -128,7 +95,13 @@ function matchesBuildTargetDefinition(buildOptions, buildTargetName) {
128
95
  return !buildTargetName;
129
96
  }
130
97
  if (!buildTargetName) {
131
- return false;
98
+ // we don't want a build target to be inferred, in which case we'll generate
99
+ // the package.json with the entry points pointing to source, so, as long as
100
+ // we don't skip the build check, this registration is valid even if it has
101
+ // build options defined
102
+ return typeof buildOptions === 'object'
103
+ ? !buildOptions.skipBuildCheck
104
+ : true;
132
105
  }
133
106
  if (buildOptions === true && buildTargetName === 'build') {
134
107
  return true;