@tactical-ddd/nx 0.0.1-alpha.1 → 0.0.1-alpha.3
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/README.md +26 -0
- package/generators/shared-kernel/files/contracts/src/index.ts +2 -0
- package/generators/shared-kernel/files/contracts/src/lib/interfaces/http-client.interface.ts +31 -0
- package/generators/shared-kernel/files/contracts/src/lib/interfaces/store.interface.ts +11 -0
- package/generators/shared-kernel/schema.d.ts +6 -0
- package/generators/shared-kernel/schema.json +24 -1
- package/generators/shared-kernel/shared-kernel.d.ts.map +1 -1
- package/generators/shared-kernel/shared-kernel.js +32 -6
- package/generators/shared-kernel/shared-kernel.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +13 -0
- package/types.d.ts.map +1 -1
- package/types.js +9 -0
- package/types.js.map +1 -1
- package/utils/resolve-module-format.d.ts +17 -0
- package/utils/resolve-module-format.d.ts.map +1 -0
- package/utils/resolve-module-format.js +118 -0
- package/utils/resolve-module-format.js.map +1 -0
package/README.md
CHANGED
|
@@ -22,6 +22,29 @@ nx g @tactical-ddd/nx:shared-kernel
|
|
|
22
22
|
|
|
23
23
|
The generator checks for the existence of libraries before creating them, making it safe to run multiple times to restore missing kernel layers.
|
|
24
24
|
|
|
25
|
+
## Options
|
|
26
|
+
|
|
27
|
+
| Option | Type | Default | Required | Description |
|
|
28
|
+
| ---------------- | -------- | ------------- | -------- | ------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `directory` | `string` | `libs/shared` | Yes | Root folder the shared kernel libraries are generated into. Keeping `libs/shared` is recommended. |
|
|
30
|
+
| `prefix` | `string` | — | No | Organization prefix used for the generated import paths, e.g. `@my-org`. |
|
|
31
|
+
| `linter` | `string` | — | Yes | Linter to configure for the generated libraries. One of `eslint`, `none`. |
|
|
32
|
+
| `unitTestRunner` | `string` | — | Yes | Unit test runner to set up. One of `jest`, `vitest`, `none`. |
|
|
33
|
+
| `bundler` | `string` | `none` | No | Bundler used to build the libraries. One of `none`, `swc`, `tsc`, `rollup`, `vite`, `esbuild`. |
|
|
34
|
+
|
|
35
|
+
When run interactively (or via Nx Console), the generator prompts for any required option that is not passed on the command line. Example with explicit flags:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
nx g @tactical-ddd/nx:shared-kernel \
|
|
39
|
+
--directory=libs/shared \
|
|
40
|
+
--prefix=@my-org \
|
|
41
|
+
--linter=eslint \
|
|
42
|
+
--unitTestRunner=jest \
|
|
43
|
+
--bundler=none
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
> Note: the `contracts` library is always generated without a unit test runner — it holds only compile-time types — regardless of the `unitTestRunner` value, which applies to `utils` and `infrastructure`.
|
|
47
|
+
|
|
25
48
|
## Architecture & Folder Structure
|
|
26
49
|
|
|
27
50
|
The generator creates three core libraries inside the `libs/shared/` directory:
|
|
@@ -40,6 +63,9 @@ libs/shared/
|
|
|
40
63
|
This is the lowest and most abstract layer of the application. It establishes the "social contracts" between different parts of the system and the backend.
|
|
41
64
|
|
|
42
65
|
- **What's inside:** Global TypeScript interfaces, data types, validation schemas (Zod/Yup), API response shapes (DTOs), and global domain event structures.
|
|
66
|
+
- **Default Interfaces:**
|
|
67
|
+
- `HttpClient` — a generic interface for HTTP clients (GET, POST, PUT, PATCH, DELETE).
|
|
68
|
+
- `Store` — a simple key-value storage interface (GET, SET, DELETE).
|
|
43
69
|
- **Features:** This library is generated without a unit test runner (`unitTestRunner: 'none'`) because it contains strictly compile-time types and interfaces that carry no executable logic.
|
|
44
70
|
- **Import Rule:** It is strictly forbidden to import anything into this library from any other modules in the workspace.
|
|
45
71
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type HttpClientOptions = {
|
|
2
|
+
timeout: number;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export interface HttpClient {
|
|
6
|
+
get<T>(url: string, options?: HttpClientOptions): Promise<T>;
|
|
7
|
+
|
|
8
|
+
post<T, K = unknown>(
|
|
9
|
+
url: string,
|
|
10
|
+
data?: K,
|
|
11
|
+
options?: HttpClientOptions,
|
|
12
|
+
): Promise<T>;
|
|
13
|
+
|
|
14
|
+
put<T, K = unknown>(
|
|
15
|
+
url: string,
|
|
16
|
+
data?: K,
|
|
17
|
+
options?: HttpClientOptions,
|
|
18
|
+
): Promise<T>;
|
|
19
|
+
|
|
20
|
+
patch<T, K = unknown>(
|
|
21
|
+
url: string,
|
|
22
|
+
data?: K,
|
|
23
|
+
options?: HttpClientOptions,
|
|
24
|
+
): Promise<T>;
|
|
25
|
+
|
|
26
|
+
delete<T>(url: string, options?: HttpClientOptions): Promise<T>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const HttpClient = {
|
|
30
|
+
$: Symbol.for('HttpClient'),
|
|
31
|
+
};
|
|
@@ -9,7 +9,30 @@
|
|
|
9
9
|
"description": "Root folder for the shared kernel (it is recommended to keep libs/shared)",
|
|
10
10
|
"default": "libs/shared",
|
|
11
11
|
"x-prompt": "Which directory should the Shared Kernel be generated into?"
|
|
12
|
+
},
|
|
13
|
+
"prefix": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Organization prefix for the generated libraries, e.g. '@my-org'",
|
|
16
|
+
"x-prompt": "Which organization prefix should be used (e.g. @my-org)?"
|
|
17
|
+
},
|
|
18
|
+
"linter": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"enum": ["eslint", "none"],
|
|
21
|
+
"description": "Which linter to use?",
|
|
22
|
+
"x-prompt": "Which linter should be configured?"
|
|
23
|
+
},
|
|
24
|
+
"unitTestRunner": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"enum": ["jest", "vitest", "none"],
|
|
27
|
+
"description": "Which test runner to use?",
|
|
28
|
+
"x-prompt": "Which unit test runner should be used?"
|
|
29
|
+
},
|
|
30
|
+
"bundler": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"enum": ["none", "swc", "tsc", "rollup", "vite", "esbuild"],
|
|
33
|
+
"default": "none",
|
|
34
|
+
"description": "Which bundler to use?"
|
|
12
35
|
}
|
|
13
36
|
},
|
|
14
|
-
"required": ["directory"]
|
|
37
|
+
"required": ["directory", "linter", "unitTestRunner"]
|
|
15
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-kernel.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/generators/shared-kernel/shared-kernel.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"shared-kernel.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/generators/shared-kernel/shared-kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAIpB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAI5D,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,2BAA2B,iBAoFrC;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -18,7 +18,9 @@ _export(exports, {
|
|
|
18
18
|
});
|
|
19
19
|
const _devkit = require("@nx/devkit");
|
|
20
20
|
const _js = require("@nx/js");
|
|
21
|
+
const _path = require("path");
|
|
21
22
|
const _types = require("../../types");
|
|
23
|
+
const _resolvemoduleformat = require("../../utils/resolve-module-format");
|
|
22
24
|
async function sharedKernelGenerator(tree, options) {
|
|
23
25
|
const sharedDirectory = options.directory;
|
|
24
26
|
const contractsRoot = `${sharedDirectory}/contracts`;
|
|
@@ -27,11 +29,21 @@ async function sharedKernelGenerator(tree, options) {
|
|
|
27
29
|
if (!tree.exists(contractsRoot)) {
|
|
28
30
|
console.log(`Creating contracts library at ${contractsRoot}...`);
|
|
29
31
|
await (0, _js.libraryGenerator)(tree, {
|
|
30
|
-
name: 'contracts',
|
|
32
|
+
name: options.prefix ? `${options.prefix}/shared-contracts` : 'shared-contracts',
|
|
31
33
|
directory: contractsRoot,
|
|
32
34
|
useProjectJson: false,
|
|
33
35
|
unitTestRunner: 'none',
|
|
34
|
-
|
|
36
|
+
bundler: options.bundler,
|
|
37
|
+
linter: options.linter,
|
|
38
|
+
tags: `${_types.LibraryScope.Shared},${_types.LibraryType.Contracts}`,
|
|
39
|
+
minimal: true
|
|
40
|
+
});
|
|
41
|
+
const type = (0, _resolvemoduleformat.resolveLibraryModuleFormat)(tree, contractsRoot);
|
|
42
|
+
tree.delete(`${contractsRoot}/src/lib/shared-contracts.ts`);
|
|
43
|
+
(0, _devkit.generateFiles)(tree, (0, _path.resolve)(__dirname, 'files/contracts'), contractsRoot, {
|
|
44
|
+
esm: type === _types.ModuleFormat.EsModule
|
|
45
|
+
}, {
|
|
46
|
+
overwriteStrategy: _devkit.OverwriteStrategy.Overwrite
|
|
35
47
|
});
|
|
36
48
|
} else {
|
|
37
49
|
console.log(`Contracts library already exists at ${contractsRoot}`);
|
|
@@ -39,22 +51,36 @@ async function sharedKernelGenerator(tree, options) {
|
|
|
39
51
|
if (!tree.exists(utilsRoot)) {
|
|
40
52
|
console.log(`Creating utils library at ${utilsRoot}...`);
|
|
41
53
|
await (0, _js.libraryGenerator)(tree, {
|
|
42
|
-
name: 'utils',
|
|
54
|
+
name: options.prefix ? `${options.prefix}/shared-utils` : 'shared-utils',
|
|
43
55
|
directory: utilsRoot,
|
|
44
56
|
useProjectJson: false,
|
|
45
|
-
|
|
57
|
+
unitTestRunner: options.unitTestRunner,
|
|
58
|
+
bundler: options.bundler,
|
|
59
|
+
linter: options.linter,
|
|
60
|
+
tags: `${_types.LibraryScope.Shared},${_types.LibraryType.Utils}`,
|
|
61
|
+
minimal: true
|
|
46
62
|
});
|
|
63
|
+
tree.delete(`${utilsRoot}/src/lib/shared-utils.ts`);
|
|
64
|
+
tree.delete(`${utilsRoot}/src/lib/shared-utils.spec.ts`);
|
|
65
|
+
tree.write(`${utilsRoot}/src/index.ts`, '');
|
|
47
66
|
} else {
|
|
48
67
|
console.log(`Utils library already exists at ${utilsRoot}`);
|
|
49
68
|
}
|
|
50
69
|
if (!tree.exists(infrastructureRoot)) {
|
|
51
70
|
console.log(`Creating infrastructure library at ${infrastructureRoot}...`);
|
|
52
71
|
await (0, _js.libraryGenerator)(tree, {
|
|
53
|
-
name: 'infrastructure',
|
|
72
|
+
name: options.prefix ? `${options.prefix}/shared-infrastructure` : 'shared-infrastructure',
|
|
54
73
|
directory: infrastructureRoot,
|
|
55
74
|
useProjectJson: false,
|
|
56
|
-
|
|
75
|
+
unitTestRunner: options.unitTestRunner,
|
|
76
|
+
bundler: options.bundler,
|
|
77
|
+
linter: options.linter,
|
|
78
|
+
tags: `${_types.LibraryScope.Shared},${_types.LibraryType.Infrastructure}`,
|
|
79
|
+
minimal: true
|
|
57
80
|
});
|
|
81
|
+
tree.delete(`${infrastructureRoot}/src/lib/shared-infrastructure.ts`);
|
|
82
|
+
tree.delete(`${infrastructureRoot}/src/lib/shared-infrastructure.spec.ts`);
|
|
83
|
+
tree.write(`${infrastructureRoot}/src/index.ts`, '');
|
|
58
84
|
} else {
|
|
59
85
|
console.log(`Infrastructure library already exists at ${infrastructureRoot}`);
|
|
60
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/nx/src/generators/shared-kernel/shared-kernel.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx/src/generators/shared-kernel/shared-kernel.ts"],"sourcesContent":["import {\n formatFiles,\n generateFiles,\n OverwriteStrategy,\n type Tree,\n} from '@nx/devkit';\nimport { libraryGenerator } from '@nx/js';\nimport { resolve } from 'path';\n\nimport type { SharedKernelGeneratorSchema } from './schema';\nimport { LibraryScope, LibraryType, ModuleFormat } from '../../types';\nimport { resolveLibraryModuleFormat } from '../../utils/resolve-module-format';\n\nexport async function sharedKernelGenerator(\n tree: Tree,\n options: SharedKernelGeneratorSchema,\n) {\n const sharedDirectory = options.directory;\n const contractsRoot = `${sharedDirectory}/contracts`;\n const utilsRoot = `${sharedDirectory}/utils`;\n const infrastructureRoot = `${sharedDirectory}/infrastructure`;\n\n if (!tree.exists(contractsRoot)) {\n console.log(`Creating contracts library at ${contractsRoot}...`);\n\n await libraryGenerator(tree, {\n name: options.prefix\n ? `${options.prefix}/shared-contracts`\n : 'shared-contracts',\n directory: contractsRoot,\n useProjectJson: false,\n unitTestRunner: 'none',\n bundler: options.bundler,\n linter: options.linter,\n tags: `${LibraryScope.Shared},${LibraryType.Contracts}`,\n minimal: true,\n });\n\n const type = resolveLibraryModuleFormat(tree, contractsRoot);\n\n tree.delete(`${contractsRoot}/src/lib/shared-contracts.ts`);\n generateFiles(\n tree,\n resolve(__dirname, 'files/contracts'),\n contractsRoot,\n { esm: type === ModuleFormat.EsModule },\n { overwriteStrategy: OverwriteStrategy.Overwrite },\n );\n } else {\n console.log(`Contracts library already exists at ${contractsRoot}`);\n }\n\n if (!tree.exists(utilsRoot)) {\n console.log(`Creating utils library at ${utilsRoot}...`);\n\n await libraryGenerator(tree, {\n name: options.prefix ? `${options.prefix}/shared-utils` : 'shared-utils',\n directory: utilsRoot,\n useProjectJson: false,\n unitTestRunner: options.unitTestRunner,\n bundler: options.bundler,\n linter: options.linter,\n tags: `${LibraryScope.Shared},${LibraryType.Utils}`,\n minimal: true,\n });\n\n tree.delete(`${utilsRoot}/src/lib/shared-utils.ts`);\n tree.delete(`${utilsRoot}/src/lib/shared-utils.spec.ts`);\n tree.write(`${utilsRoot}/src/index.ts`, '');\n } else {\n console.log(`Utils library already exists at ${utilsRoot}`);\n }\n\n if (!tree.exists(infrastructureRoot)) {\n console.log(`Creating infrastructure library at ${infrastructureRoot}...`);\n\n await libraryGenerator(tree, {\n name: options.prefix\n ? `${options.prefix}/shared-infrastructure`\n : 'shared-infrastructure',\n directory: infrastructureRoot,\n useProjectJson: false,\n unitTestRunner: options.unitTestRunner,\n bundler: options.bundler,\n linter: options.linter,\n tags: `${LibraryScope.Shared},${LibraryType.Infrastructure}`,\n minimal: true,\n });\n\n tree.delete(`${infrastructureRoot}/src/lib/shared-infrastructure.ts`);\n tree.delete(`${infrastructureRoot}/src/lib/shared-infrastructure.spec.ts`);\n tree.write(`${infrastructureRoot}/src/index.ts`, '');\n } else {\n console.log(\n `Infrastructure library already exists at ${infrastructureRoot}`,\n );\n }\n\n await formatFiles(tree);\n}\n\nexport default sharedKernelGenerator;\n"],"names":["sharedKernelGenerator","tree","options","sharedDirectory","directory","contractsRoot","utilsRoot","infrastructureRoot","exists","console","log","libraryGenerator","name","prefix","useProjectJson","unitTestRunner","bundler","linter","tags","LibraryScope","Shared","LibraryType","Contracts","minimal","type","resolveLibraryModuleFormat","delete","generateFiles","resolve","__dirname","esm","ModuleFormat","EsModule","overwriteStrategy","OverwriteStrategy","Overwrite","Utils","write","Infrastructure","formatFiles"],"mappings":";;;;;;;;;;;QAqGA;eAAA;;QAxFsBA;eAAAA;;;wBARf;oBAC0B;sBACT;uBAGgC;qCACb;AAEpC,eAAeA,sBACpBC,IAAU,EACVC,OAAoC;IAEpC,MAAMC,kBAAkBD,QAAQE,SAAS;IACzC,MAAMC,gBAAgB,GAAGF,gBAAgB,UAAU,CAAC;IACpD,MAAMG,YAAY,GAAGH,gBAAgB,MAAM,CAAC;IAC5C,MAAMI,qBAAqB,GAAGJ,gBAAgB,eAAe,CAAC;IAE9D,IAAI,CAACF,KAAKO,MAAM,CAACH,gBAAgB;QAC/BI,QAAQC,GAAG,CAAC,CAAC,8BAA8B,EAAEL,cAAc,GAAG,CAAC;QAE/D,MAAMM,IAAAA,oBAAgB,EAACV,MAAM;YAC3BW,MAAMV,QAAQW,MAAM,GAChB,GAAGX,QAAQW,MAAM,CAAC,iBAAiB,CAAC,GACpC;YACJT,WAAWC;YACXS,gBAAgB;YAChBC,gBAAgB;YAChBC,SAASd,QAAQc,OAAO;YACxBC,QAAQf,QAAQe,MAAM;YACtBC,MAAM,GAAGC,mBAAY,CAACC,MAAM,CAAC,CAAC,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AAMI,IAAAA,oBAAgB,EAACV,MAAM;YAC3BW,MAAMV,QAAQW,MAAM,GAChB,GAAGX,QAAQW,MAAM,CAAC,sBAAsB,CAAC,GACzC;YACJT,WAAWG;YACXO,gBAAgB;YAChBC,gBAAgBb,QAAQa,cAAc;YACtCC,SAASd,QAAQc,OAAO;YACxBC,QAAQf,QAAQe,MAAM;YACtBC,MAAM,GAAGC,mBAAY,CAACC,MAAM,CAAC,CAAC,EAAEC,kBAAW,CAACiB,cAAc,EAAE;YAC5Df,SAAS;QACX;QAEAtB,KAAKyB,MAAM,CAAC,GAAGnB,mBAAmB,iCAAiC,CAAC;QACpEN,KAAKyB,MAAM,CAAC,GAAGnB,mBAAmB,sCAAsC,CAAC;QACzEN,KAAKoC,KAAK,CAAC,GAAG9B,mBAAmB,aAAa,CAAC,EAAE;IACnD,OAAO;QACLE,QAAQC,GAAG,CACT,CAAC,yCAAyC,EAAEH,oBAAoB;IAEpE;IAEA,MAAMgC,IAAAA,mBAAW,EAACtC;AACpB;MAEA,WAAeD"}
|
package/index.d.ts
CHANGED
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/nx/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/nx/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,SAAS,CAAC;AACxB,cAAc,+BAA+B,CAAC"}
|
package/index.js
CHANGED
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./generators/shared-kernel/shared-kernel"), exports);
|
|
6
7
|
_export_star._(require("./types"), exports);
|
|
8
|
+
_export_star._(require("./utils/resolve-module-format"), exports);
|
|
7
9
|
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/nx/src/index.ts"],"sourcesContent":["export * from './types';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
|
1
|
+
{"version":3,"sources":["../../../packages/nx/src/index.ts"],"sourcesContent":["export * from './generators/shared-kernel/shared-kernel';\nexport * from './types';\nexport * from './utils/resolve-module-format';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA"}
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -10,4 +10,17 @@ export declare enum LibraryType {
|
|
|
10
10
|
Testing = "type:testing",
|
|
11
11
|
Infrastructure = "type:infrastructure"
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Module system a generated library ships in.
|
|
15
|
+
*
|
|
16
|
+
* Resolved in priority order (most direct signal first):
|
|
17
|
+
* 1. `package.json` `"type"` — `commonjs` → CJS, `module` → ESM
|
|
18
|
+
* 2. `tsconfig.lib.json` `"module"` — `commonjs` → CJS; `esnext`/`nodenext`/`node16` → ESM
|
|
19
|
+
* 3. build target executor + its `format` option (bundler-dependent)
|
|
20
|
+
*/
|
|
21
|
+
export declare enum ModuleFormat {
|
|
22
|
+
CommonJs = "cjs",
|
|
23
|
+
EsModule = "esm",
|
|
24
|
+
Unknown = "unknown"
|
|
25
|
+
}
|
|
13
26
|
//# sourceMappingURL=types.d.ts.map
|
package/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../packages/nx/src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,MAAM,iBAAiB;IACvB,MAAM,iBAAiB;CACxB;AAED,oBAAY,WAAW;IACrB,SAAS,mBAAmB;IAC5B,IAAI,cAAc;IAClB,QAAQ,kBAAkB;IAC1B,KAAK,eAAe;IACpB,OAAO,iBAAiB;IACxB,cAAc,wBAAwB;CACvC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../packages/nx/src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,MAAM,iBAAiB;IACvB,MAAM,iBAAiB;CACxB;AAED,oBAAY,WAAW;IACrB,SAAS,mBAAmB;IAC5B,IAAI,cAAc;IAClB,QAAQ,kBAAkB;IAC1B,KAAK,eAAe;IACpB,OAAO,iBAAiB;IACxB,cAAc,wBAAwB;CACvC;AAED;;;;;;;GAOG;AACH,oBAAY,YAAY;IACtB,QAAQ,QAAQ;IAChB,QAAQ,QAAQ;IAChB,OAAO,YAAY;CACpB"}
|
package/types.js
CHANGED
|
@@ -14,6 +14,9 @@ _export(exports, {
|
|
|
14
14
|
},
|
|
15
15
|
get LibraryType () {
|
|
16
16
|
return LibraryType;
|
|
17
|
+
},
|
|
18
|
+
get ModuleFormat () {
|
|
19
|
+
return ModuleFormat;
|
|
17
20
|
}
|
|
18
21
|
});
|
|
19
22
|
var LibraryScope = /*#__PURE__*/ function(LibraryScope) {
|
|
@@ -30,5 +33,11 @@ var LibraryType = /*#__PURE__*/ function(LibraryType) {
|
|
|
30
33
|
LibraryType["Infrastructure"] = "type:infrastructure";
|
|
31
34
|
return LibraryType;
|
|
32
35
|
}({});
|
|
36
|
+
var ModuleFormat = /*#__PURE__*/ function(ModuleFormat) {
|
|
37
|
+
ModuleFormat["CommonJs"] = "cjs";
|
|
38
|
+
ModuleFormat["EsModule"] = "esm";
|
|
39
|
+
ModuleFormat["Unknown"] = "unknown";
|
|
40
|
+
return ModuleFormat;
|
|
41
|
+
}({});
|
|
33
42
|
|
|
34
43
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/nx/src/types.ts"],"sourcesContent":["export enum LibraryScope {\n Shared = 'scope:shared',\n Domain = 'scope:domain',\n}\n\nexport enum LibraryType {\n Contracts = 'type:contracts',\n Core = 'type:core',\n Features = 'type:features',\n Utils = 'type:utils',\n Testing = 'type:testing',\n Infrastructure = 'type:infrastructure',\n}\n"],"names":["LibraryScope","LibraryType"],"mappings":";;;;;;;;;;;QAAYA;eAAAA;;QAKAC;eAAAA;;;
|
|
1
|
+
{"version":3,"sources":["../../../packages/nx/src/types.ts"],"sourcesContent":["export enum LibraryScope {\n Shared = 'scope:shared',\n Domain = 'scope:domain',\n}\n\nexport enum LibraryType {\n Contracts = 'type:contracts',\n Core = 'type:core',\n Features = 'type:features',\n Utils = 'type:utils',\n Testing = 'type:testing',\n Infrastructure = 'type:infrastructure',\n}\n\n/**\n * Module system a generated library ships in.\n *\n * Resolved in priority order (most direct signal first):\n * 1. `package.json` `\"type\"` — `commonjs` → CJS, `module` → ESM\n * 2. `tsconfig.lib.json` `\"module\"` — `commonjs` → CJS; `esnext`/`nodenext`/`node16` → ESM\n * 3. build target executor + its `format` option (bundler-dependent)\n */\nexport enum ModuleFormat {\n CommonJs = 'cjs',\n EsModule = 'esm',\n Unknown = 'unknown',\n}\n"],"names":["LibraryScope","LibraryType","ModuleFormat"],"mappings":";;;;;;;;;;;QAAYA;eAAAA;;QAKAC;eAAAA;;QAiBAC;eAAAA;;;AAtBL,IAAA,AAAKF,sCAAAA;;;WAAAA;;AAKL,IAAA,AAAKC,qCAAAA;;;;;;;WAAAA;;AAiBL,IAAA,AAAKC,sCAAAA;;;;WAAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
import { ModuleFormat } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Determine which module system a generated library ships in.
|
|
5
|
+
*
|
|
6
|
+
* The signals are inspected in priority order, from the most direct to the
|
|
7
|
+
* most circumstantial. The first signal that yields a definitive answer wins;
|
|
8
|
+
* an indeterminate signal falls through to the next one.
|
|
9
|
+
*
|
|
10
|
+
* 1. `package.json` `"type"` — the most direct signal.
|
|
11
|
+
* 2. `tsconfig.lib.json` `"module"` — follows the `extends` chain.
|
|
12
|
+
* 3. build target executor — bundler-dependent, best effort.
|
|
13
|
+
*
|
|
14
|
+
* Returns {@link ModuleFormat.Unknown} when nothing resolves.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveLibraryModuleFormat(tree: Tree, projectRoot: string): ModuleFormat;
|
|
17
|
+
//# sourceMappingURL=resolve-module-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-module-format.d.ts","sourceRoot":"","sources":["../../../../packages/nx/src/utils/resolve-module-format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAA+B,MAAM,YAAY,CAAC;AAGpE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,GAClB,YAAY,CAed"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "resolveLibraryModuleFormat", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return resolveLibraryModuleFormat;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _devkit = require("@nx/devkit");
|
|
12
|
+
const _path = require("path");
|
|
13
|
+
const _types = require("../types");
|
|
14
|
+
function resolveLibraryModuleFormat(tree, projectRoot) {
|
|
15
|
+
const resolvers = [
|
|
16
|
+
fromPackageJsonType,
|
|
17
|
+
fromTsConfigModule,
|
|
18
|
+
fromBuildTarget
|
|
19
|
+
];
|
|
20
|
+
for (const resolve of resolvers){
|
|
21
|
+
const format = resolve(tree, projectRoot);
|
|
22
|
+
if (format !== _types.ModuleFormat.Unknown) {
|
|
23
|
+
return format;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return _types.ModuleFormat.Unknown;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 1. `package.json` `"type"` — `commonjs` → CJS, `module` → ESM. Absence is
|
|
30
|
+
* not treated as Node's implicit `commonjs` default here; we defer to the
|
|
31
|
+
* stronger TypeScript signal instead.
|
|
32
|
+
*/ function fromPackageJsonType(tree, projectRoot) {
|
|
33
|
+
const packageJsonPath = (0, _devkit.joinPathFragments)(projectRoot, 'package.json');
|
|
34
|
+
if (!tree.exists(packageJsonPath)) {
|
|
35
|
+
return _types.ModuleFormat.Unknown;
|
|
36
|
+
}
|
|
37
|
+
const { type } = (0, _devkit.readJson)(tree, packageJsonPath);
|
|
38
|
+
if (type === 'commonjs') return _types.ModuleFormat.CommonJs;
|
|
39
|
+
if (type === 'module') return _types.ModuleFormat.EsModule;
|
|
40
|
+
return _types.ModuleFormat.Unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 2. `tsconfig.lib.json` `"module"`. `commonjs` → CJS; `esnext`, `nodenext`,
|
|
44
|
+
* `node16` and the rest of the ES-oriented family → ESM. The option is often
|
|
45
|
+
* inherited, so the `extends` chain is walked until a value is found.
|
|
46
|
+
*/ function fromTsConfigModule(tree, projectRoot) {
|
|
47
|
+
const moduleOption = readInheritedModuleOption(tree, (0, _devkit.joinPathFragments)(projectRoot, 'tsconfig.lib.json'));
|
|
48
|
+
return classifyTsModule(moduleOption);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 3. Build target executor. `@nx/js:tsc`/`@nx/js:swc` ultimately defer to the
|
|
52
|
+
* compiler config, so they only decide here when they carry an explicit
|
|
53
|
+
* `format`. Bundlers (`rollup`/`vite`/`esbuild`) expose a `format` array —
|
|
54
|
+
* the presence of `esm`/`cjs` is the signal. Indeterminate → Unknown.
|
|
55
|
+
*/ function fromBuildTarget(tree, projectRoot) {
|
|
56
|
+
var _build_options;
|
|
57
|
+
const build = readBuildTarget(tree, projectRoot);
|
|
58
|
+
if (!build) return _types.ModuleFormat.Unknown;
|
|
59
|
+
const raw = (_build_options = build.options) == null ? void 0 : _build_options.format;
|
|
60
|
+
const formats = (Array.isArray(raw) ? raw : raw ? [
|
|
61
|
+
raw
|
|
62
|
+
] : []).map((value)=>String(value).toLowerCase());
|
|
63
|
+
if (formats.includes('esm')) return _types.ModuleFormat.EsModule;
|
|
64
|
+
if (formats.includes('cjs')) return _types.ModuleFormat.CommonJs;
|
|
65
|
+
return _types.ModuleFormat.Unknown;
|
|
66
|
+
}
|
|
67
|
+
/** Walk the `extends` chain of a tsconfig until `compilerOptions.module` is found. */ function readInheritedModuleOption(tree, tsConfigPath, visited = new Set()) {
|
|
68
|
+
var _config_compilerOptions;
|
|
69
|
+
if (visited.has(tsConfigPath) || !tree.exists(tsConfigPath)) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
visited.add(tsConfigPath);
|
|
73
|
+
const config = (0, _devkit.readJson)(tree, tsConfigPath);
|
|
74
|
+
const localModule = (_config_compilerOptions = config.compilerOptions) == null ? void 0 : _config_compilerOptions.module;
|
|
75
|
+
if (typeof localModule === 'string') {
|
|
76
|
+
return localModule;
|
|
77
|
+
}
|
|
78
|
+
// TS resolves multiple `extends` left-to-right with later entries winning,
|
|
79
|
+
// so search them in reverse for the effective value.
|
|
80
|
+
const parents = Array.isArray(config.extends) ? [
|
|
81
|
+
...config.extends
|
|
82
|
+
].reverse() : config.extends ? [
|
|
83
|
+
config.extends
|
|
84
|
+
] : [];
|
|
85
|
+
for (const parent of parents){
|
|
86
|
+
const resolved = (0, _devkit.joinPathFragments)((0, _path.dirname)(tsConfigPath), parent);
|
|
87
|
+
const inherited = readInheritedModuleOption(tree, resolved, visited);
|
|
88
|
+
if (inherited) return inherited;
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
function classifyTsModule(moduleOption) {
|
|
93
|
+
if (!moduleOption) return _types.ModuleFormat.Unknown;
|
|
94
|
+
const normalized = moduleOption.toLowerCase();
|
|
95
|
+
if (normalized === 'commonjs') return _types.ModuleFormat.CommonJs;
|
|
96
|
+
// esnext / es2015+ / nodenext / node16 / node18 / preserve → ESM-oriented.
|
|
97
|
+
if (normalized.startsWith('es') || normalized.startsWith('node') || normalized === 'preserve') {
|
|
98
|
+
return _types.ModuleFormat.EsModule;
|
|
99
|
+
}
|
|
100
|
+
// amd / umd / system and friends are CJS-era module systems.
|
|
101
|
+
return _types.ModuleFormat.CommonJs;
|
|
102
|
+
}
|
|
103
|
+
/** Read the `build` target from either `project.json` or `package.json` `nx.targets`. */ function readBuildTarget(tree, projectRoot) {
|
|
104
|
+
const projectJsonPath = (0, _devkit.joinPathFragments)(projectRoot, 'project.json');
|
|
105
|
+
if (tree.exists(projectJsonPath)) {
|
|
106
|
+
const { targets } = (0, _devkit.readJson)(tree, projectJsonPath);
|
|
107
|
+
if (targets == null ? void 0 : targets['build']) return targets['build'];
|
|
108
|
+
}
|
|
109
|
+
const packageJsonPath = (0, _devkit.joinPathFragments)(projectRoot, 'package.json');
|
|
110
|
+
if (tree.exists(packageJsonPath)) {
|
|
111
|
+
var _nx_targets;
|
|
112
|
+
const { nx } = (0, _devkit.readJson)(tree, packageJsonPath);
|
|
113
|
+
if (nx == null ? void 0 : (_nx_targets = nx.targets) == null ? void 0 : _nx_targets['build']) return nx.targets['build'];
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=resolve-module-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../packages/nx/src/utils/resolve-module-format.ts"],"sourcesContent":["import { type Tree, readJson, joinPathFragments } from '@nx/devkit';\nimport { dirname } from 'path';\n\nimport { ModuleFormat } from '../types';\n\n/**\n * Determine which module system a generated library ships in.\n *\n * The signals are inspected in priority order, from the most direct to the\n * most circumstantial. The first signal that yields a definitive answer wins;\n * an indeterminate signal falls through to the next one.\n *\n * 1. `package.json` `\"type\"` — the most direct signal.\n * 2. `tsconfig.lib.json` `\"module\"` — follows the `extends` chain.\n * 3. build target executor — bundler-dependent, best effort.\n *\n * Returns {@link ModuleFormat.Unknown} when nothing resolves.\n */\nexport function resolveLibraryModuleFormat(\n tree: Tree,\n projectRoot: string,\n): ModuleFormat {\n const resolvers = [\n fromPackageJsonType,\n fromTsConfigModule,\n fromBuildTarget,\n ] as const;\n\n for (const resolve of resolvers) {\n const format = resolve(tree, projectRoot);\n if (format !== ModuleFormat.Unknown) {\n return format;\n }\n }\n\n return ModuleFormat.Unknown;\n}\n\n/**\n * 1. `package.json` `\"type\"` — `commonjs` → CJS, `module` → ESM. Absence is\n * not treated as Node's implicit `commonjs` default here; we defer to the\n * stronger TypeScript signal instead.\n */\nfunction fromPackageJsonType(tree: Tree, projectRoot: string): ModuleFormat {\n const packageJsonPath = joinPathFragments(projectRoot, 'package.json');\n\n if (!tree.exists(packageJsonPath)) {\n return ModuleFormat.Unknown;\n }\n\n const { type } = readJson<{ type?: string }>(tree, packageJsonPath);\n\n if (type === 'commonjs') return ModuleFormat.CommonJs;\n if (type === 'module') return ModuleFormat.EsModule;\n\n return ModuleFormat.Unknown;\n}\n\n/**\n * 2. `tsconfig.lib.json` `\"module\"`. `commonjs` → CJS; `esnext`, `nodenext`,\n * `node16` and the rest of the ES-oriented family → ESM. The option is often\n * inherited, so the `extends` chain is walked until a value is found.\n */\nfunction fromTsConfigModule(tree: Tree, projectRoot: string): ModuleFormat {\n const moduleOption = readInheritedModuleOption(\n tree,\n joinPathFragments(projectRoot, 'tsconfig.lib.json'),\n );\n\n return classifyTsModule(moduleOption);\n}\n\n/**\n * 3. Build target executor. `@nx/js:tsc`/`@nx/js:swc` ultimately defer to the\n * compiler config, so they only decide here when they carry an explicit\n * `format`. Bundlers (`rollup`/`vite`/`esbuild`) expose a `format` array —\n * the presence of `esm`/`cjs` is the signal. Indeterminate → Unknown.\n */\nfunction fromBuildTarget(tree: Tree, projectRoot: string): ModuleFormat {\n const build = readBuildTarget(tree, projectRoot);\n\n if (!build) return ModuleFormat.Unknown;\n\n const raw = build.options?.format;\n const formats = (Array.isArray(raw) ? raw : raw ? [raw] : []).map((value) =>\n String(value).toLowerCase(),\n );\n\n if (formats.includes('esm')) return ModuleFormat.EsModule;\n if (formats.includes('cjs')) return ModuleFormat.CommonJs;\n\n return ModuleFormat.Unknown;\n}\n\n/** Walk the `extends` chain of a tsconfig until `compilerOptions.module` is found. */\nfunction readInheritedModuleOption(\n tree: Tree,\n tsConfigPath: string,\n visited: Set<string> = new Set(),\n): string | undefined {\n if (visited.has(tsConfigPath) || !tree.exists(tsConfigPath)) {\n return undefined;\n }\n visited.add(tsConfigPath);\n\n const config = readJson<{\n compilerOptions?: { module?: string };\n extends?: string | string[];\n }>(tree, tsConfigPath);\n\n const localModule = config.compilerOptions?.module;\n if (typeof localModule === 'string') {\n return localModule;\n }\n\n // TS resolves multiple `extends` left-to-right with later entries winning,\n // so search them in reverse for the effective value.\n const parents = Array.isArray(config.extends)\n ? [...config.extends].reverse()\n : config.extends\n ? [config.extends]\n : [];\n\n for (const parent of parents) {\n const resolved = joinPathFragments(dirname(tsConfigPath), parent);\n const inherited = readInheritedModuleOption(tree, resolved, visited);\n if (inherited) return inherited;\n }\n\n return undefined;\n}\n\nfunction classifyTsModule(moduleOption: string | undefined): ModuleFormat {\n if (!moduleOption) return ModuleFormat.Unknown;\n\n const normalized = moduleOption.toLowerCase();\n\n if (normalized === 'commonjs') return ModuleFormat.CommonJs;\n\n // esnext / es2015+ / nodenext / node16 / node18 / preserve → ESM-oriented.\n if (\n normalized.startsWith('es') ||\n normalized.startsWith('node') ||\n normalized === 'preserve'\n ) {\n return ModuleFormat.EsModule;\n }\n\n // amd / umd / system and friends are CJS-era module systems.\n return ModuleFormat.CommonJs;\n}\n\n/** Read the `build` target from either `project.json` or `package.json` `nx.targets`. */\nfunction readBuildTarget(\n tree: Tree,\n projectRoot: string,\n): { options?: { format?: unknown } } | undefined {\n const projectJsonPath = joinPathFragments(projectRoot, 'project.json');\n if (tree.exists(projectJsonPath)) {\n const { targets } = readJson<{\n targets?: Record<string, { options?: { format?: unknown } }>;\n }>(tree, projectJsonPath);\n if (targets?.['build']) return targets['build'];\n }\n\n const packageJsonPath = joinPathFragments(projectRoot, 'package.json');\n if (tree.exists(packageJsonPath)) {\n const { nx } = readJson<{\n nx?: { targets?: Record<string, { options?: { format?: unknown } }> };\n }>(tree, packageJsonPath);\n if (nx?.targets?.['build']) return nx.targets['build'];\n }\n\n return undefined;\n}\n"],"names":["resolveLibraryModuleFormat","tree","projectRoot","resolvers","fromPackageJsonType","fromTsConfigModule","fromBuildTarget","resolve","format","ModuleFormat","Unknown","packageJsonPath","joinPathFragments","exists","type","readJson","CommonJs","EsModule","moduleOption","readInheritedModuleOption","classifyTsModule","build","readBuildTarget","raw","options","formats","Array","isArray","map","value","String","toLowerCase","includes","tsConfigPath","visited","Set","config","has","undefined","add","localModule","compilerOptions","module","parents","extends","reverse","parent","resolved","dirname","inherited","normalized","startsWith","projectJsonPath","targets","nx"],"mappings":";;;;+BAkBgBA;;;eAAAA;;;wBAlBuC;sBAC/B;uBAEK;AAetB,SAASA,2BACdC,IAAU,EACVC,WAAmB;IAEnB,MAAMC,YAAY;QAChBC;QACAC;QACAC;KACD;IAED,KAAK,MAAMC,WAAWJ,UAAW;QAC/B,MAAMK,SAASD,QAAQN,MAAMC;QAC7B,IAAIM,WAAWC,mBAAY,CAACC,OAAO,EAAE;YACnC,OAAOF;QACT;IACF;IAEA,OAAOC,mBAAY,CAACC,OAAO;AAC7B;AAEA;;;;CAIC,GACD,SAASN,oBAAoBH,IAAU,EAAEC,WAAmB;IAC1D,MAAMS,kBAAkBC,IAAAA,yBAAiB,EAACV,aAAa;IAEvD,IAAI,CAACD,KAAKY,MAAM,CAACF,kBAAkB;QACjC,OAAOF,mBAAY,CAACC,OAAO;IAC7B;IAEA,MAAM,EAAEI,IAAI,EAAE,GAAGC,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