@nx/plugin 23.0.0-beta.15 → 23.0.0-beta.16

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/plugin",
3
- "version": "23.0.0-beta.15",
3
+ "version": "23.0.0-beta.16",
4
4
  "private": false,
5
5
  "description": "This plugin is used to create Nx plugins! It contains generators for generating common plugin features like generators, executors, migrations and more.",
6
6
  "repository": {
@@ -29,13 +29,13 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "tslib": "^2.3.0",
32
- "@nx/devkit": "23.0.0-beta.15",
33
- "@nx/jest": "23.0.0-beta.15",
34
- "@nx/js": "23.0.0-beta.15",
35
- "@nx/eslint": "23.0.0-beta.15"
32
+ "@nx/devkit": "23.0.0-beta.16",
33
+ "@nx/jest": "23.0.0-beta.16",
34
+ "@nx/js": "23.0.0-beta.16",
35
+ "@nx/eslint": "23.0.0-beta.16"
36
36
  },
37
37
  "devDependencies": {
38
- "nx": "23.0.0-beta.15"
38
+ "nx": "23.0.0-beta.16"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -1,5 +1,5 @@
1
- import { PromiseExecutor } from "@nx/devkit";
2
- import { <%= className %>ExecutorSchema } from './schema';
1
+ import type { PromiseExecutor } from "@nx/devkit";
2
+ import type { <%= className %>ExecutorSchema } from './schema';
3
3
 
4
4
  const runExecutor: PromiseExecutor<<%= className %>ExecutorSchema> = async (options) => {
5
5
  console.log('Executor ran for <%= className %>', options);
@@ -1,4 +1,4 @@
1
- import { CustomHasher } from '@nx/devkit';
1
+ import type { CustomHasher } from '@nx/devkit';
2
2
 
3
3
  /**
4
4
  * This is a boilerplate custom hasher that matches
@@ -2,10 +2,10 @@ import {
2
2
  addProjectConfiguration,
3
3
  formatFiles,
4
4
  generateFiles,
5
- Tree,
5
+ type Tree,
6
6
  } from '@nx/devkit';
7
7
  import * as path from 'path';
8
- import { <%= className %>GeneratorSchema } from './schema';
8
+ import type { <%= className %>GeneratorSchema } from './schema';
9
9
 
10
10
  export async function <%= generatorFnName %> (tree: Tree, options: <%= schemaInterfaceName %>) {
11
11
  const projectRoot = `libs/${options.name}`;
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import { Tree } from '@nx/devkit';
2
+ import type { Tree } from '@nx/devkit';
3
3
 
4
4
  export default function update(host: Tree) {
5
5
  // ...
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/plugin/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAKjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAapB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAuDvC,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAM/D;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAwFvE;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/plugin/src/generators/plugin/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAKjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAapB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAuDvC,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAM/D;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BA+FvE;AAED,eAAe,eAAe,CAAC"}
@@ -65,7 +65,14 @@ async function pluginGeneratorInternal(host, schema) {
65
65
  }));
66
66
  if (options.isTsSolutionSetup) {
67
67
  (0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), (json) => {
68
- delete json.type;
68
+ // Force CommonJS for the plugin package. `jsLibraryGenerator` sets
69
+ // `type: "module"` for TS-solution libs, but Nx-plugin generators
70
+ // and executors that get loaded by `nx generate` / `nx run` rely on
71
+ // CJS globals like `__dirname` (e.g. `path.join(__dirname, 'files')`
72
+ // in generator factories). Setting `type: "commonjs"` explicitly
73
+ // overrides Node's content-based ESM detection so the source TS
74
+ // files load as CJS at runtime.
75
+ json.type = 'commonjs';
69
76
  return json;
70
77
  });
71
78
  }