@nx/js 19.2.0-beta.4 → 19.2.0-beta.6

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": "19.2.0-beta.4",
3
+ "version": "19.2.0-beta.6",
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": {
@@ -58,9 +58,9 @@
58
58
  "semver": "^7.5.3",
59
59
  "source-map-support": "0.5.19",
60
60
  "tslib": "^2.3.0",
61
- "@nx/devkit": "19.2.0-beta.4",
62
- "@nx/workspace": "19.2.0-beta.4",
63
- "@nrwl/js": "19.2.0-beta.4"
61
+ "@nx/devkit": "19.2.0-beta.6",
62
+ "@nx/workspace": "19.2.0-beta.6",
63
+ "@nrwl/js": "19.2.0-beta.6"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "verdaccio": "^5.0.4"
@@ -41,6 +41,14 @@ async function libraryGeneratorInternal(tree, schema) {
41
41
  if (options.publishable) {
42
42
  tasks.push(await (0, generator_1.default)(tree, { ...options, skipFormat: true }));
43
43
  }
44
+ if (options.bundler === 'rollup') {
45
+ const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/rollup', versions_1.nxVersion);
46
+ await configurationGenerator(tree, {
47
+ project: options.name,
48
+ compiler: 'swc',
49
+ format: ['cjs', 'esm'],
50
+ });
51
+ }
44
52
  if (options.bundler === 'vite') {
45
53
  const { viteConfigurationGenerator, createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
46
54
  const viteTask = await viteConfigurationGenerator(tree, {
@@ -124,36 +132,31 @@ async function addProject(tree, options) {
124
132
  if (options.bundler &&
125
133
  options.bundler !== 'none' &&
126
134
  options.config !== 'npm-scripts') {
127
- const outputPath = getOutputPath(options);
128
- const executor = getBuildExecutor(options.bundler);
129
- (0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, executor);
130
- projectConfiguration.targets.build = {
131
- executor,
132
- outputs: ['{options.outputPath}'],
133
- options: {
134
- outputPath,
135
- main: `${options.projectRoot}/src/index` + (options.js ? '.js' : '.ts'),
136
- tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
137
- assets: [],
138
- },
139
- };
140
- if (options.bundler === 'esbuild') {
141
- projectConfiguration.targets.build.options.generatePackageJson = true;
142
- projectConfiguration.targets.build.options.format = ['cjs'];
143
- }
144
- if (options.bundler === 'rollup') {
145
- projectConfiguration.targets.build.options.project = `${options.projectRoot}/package.json`;
146
- projectConfiguration.targets.build.options.compiler = 'swc';
147
- projectConfiguration.targets.build.options.format = ['cjs', 'esm'];
148
- }
149
- if (options.bundler === 'swc' && options.skipTypeCheck) {
150
- projectConfiguration.targets.build.options.skipTypeCheck = true;
151
- }
152
- if (!options.minimal &&
153
- // TODO(jack): assets for rollup have validation that we need to fix (assets must be under <project-root>/src)
154
- options.bundler !== 'rollup') {
155
- projectConfiguration.targets.build.options.assets ??= [];
156
- projectConfiguration.targets.build.options.assets.push((0, devkit_1.joinPathFragments)(options.projectRoot, '*.md'));
135
+ if (options.bundler !== 'rollup') {
136
+ const outputPath = getOutputPath(options);
137
+ const executor = getBuildExecutor(options.bundler);
138
+ (0, add_build_target_defaults_1.addBuildTargetDefaults)(tree, executor);
139
+ projectConfiguration.targets.build = {
140
+ executor,
141
+ outputs: ['{options.outputPath}'],
142
+ options: {
143
+ outputPath,
144
+ main: `${options.projectRoot}/src/index` + (options.js ? '.js' : '.ts'),
145
+ tsConfig: `${options.projectRoot}/tsconfig.lib.json`,
146
+ assets: [],
147
+ },
148
+ };
149
+ if (options.bundler === 'esbuild') {
150
+ projectConfiguration.targets.build.options.generatePackageJson = true;
151
+ projectConfiguration.targets.build.options.format = ['cjs'];
152
+ }
153
+ if (options.bundler === 'swc' && options.skipTypeCheck) {
154
+ projectConfiguration.targets.build.options.skipTypeCheck = true;
155
+ }
156
+ if (!options.minimal) {
157
+ projectConfiguration.targets.build.options.assets ??= [];
158
+ projectConfiguration.targets.build.options.assets.push((0, devkit_1.joinPathFragments)(options.projectRoot, '*.md'));
159
+ }
157
160
  }
158
161
  if (options.publishable) {
159
162
  const packageRoot = (0, path_1.join)(defaultOutputDirectory, '{projectRoot}');
@@ -201,6 +204,8 @@ async function addLint(tree, options) {
201
204
  setParserOptionsProject: options.setParserOptionsProject,
202
205
  rootProject: options.rootProject,
203
206
  addPlugin: options.addPlugin,
207
+ // Since the build target is inferred now, we need to let the generator know to add @nx/dependency-checks regardless.
208
+ addPackageJsonDependencyChecks: options.bundler !== 'none',
204
209
  });
205
210
  const { addOverrideToLintConfig, lintConfigHasOverride, isEslintConfigSupported, updateOverrideInLintConfig,
206
211
  // nx-ignore-next-line
@@ -1,7 +1,6 @@
1
1
  import type { OutputBundle } from 'rollup';
2
2
  export declare function typeDefinitions(options: {
3
3
  projectRoot: string;
4
- main: string;
5
4
  }): {
6
5
  name: string;
7
6
  generateBundle(_opts: unknown, bundle: OutputBundle): Promise<void>;
@@ -31,7 +31,7 @@ exports.createDependencies = createDependencies;
31
31
  exports.PLUGIN_NAME = '@nx/js/typescript';
32
32
  exports.createNodes = [
33
33
  '**/tsconfig*.json',
34
- (configFilePath, options, context) => {
34
+ async (configFilePath, options, context) => {
35
35
  const pluginOptions = normalizePluginOptions(options);
36
36
  const projectRoot = (0, node_path_1.dirname)(configFilePath);
37
37
  const fullConfigPath = (0, devkit_1.joinPathFragments)(context.workspaceRoot, configFilePath);
@@ -46,7 +46,7 @@ exports.createNodes = [
46
46
  !siblingFiles.includes('tsconfig.json')) {
47
47
  return {};
48
48
  }
49
- const nodeHash = (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, pluginOptions, context, [(0, lock_file_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
49
+ const nodeHash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, pluginOptions, context, [(0, lock_file_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
50
50
  // The hash is calculated at the node/project level, so we add the config file path to avoid conflicts when caching
51
51
  const cacheKey = `${nodeHash}_${configFilePath}`;
52
52
  targetsCache[cacheKey] ??= buildTscTargets(fullConfigPath, projectRoot, pluginOptions, context);