@tactical-ddd/nx 0.0.1-alpha.2 → 0.0.2-alpha.0
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 +66 -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/shared-kernel.d.ts.map +1 -1
- package/generators/shared-kernel/shared-kernel.js +21 -3
- package/generators/shared-kernel/shared-kernel.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -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
|
@@ -63,9 +63,75 @@ libs/shared/
|
|
|
63
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.
|
|
64
64
|
|
|
65
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:** Ships with two foundational infrastructure contracts — `HttpClient` and `Store` (see [Default Contracts](#default-contracts) below).
|
|
66
67
|
- **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.
|
|
67
68
|
- **Import Rule:** It is strictly forbidden to import anything into this library from any other modules in the workspace.
|
|
68
69
|
|
|
70
|
+
#### Default Contracts
|
|
71
|
+
|
|
72
|
+
The `contracts` library is not generated empty — it is seeded with two foundational infrastructure contracts that the rest of the architecture (notably `libs/shared/infrastructure`) is expected to implement. Each interface is paired with a DI token (`Symbol.for(...)`), so it can be bound and resolved through a dependency-injection container (e.g. Inversify) without leaking the concrete implementation. Both are re-exported from the library barrel (`index.ts`):
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { HttpClient, HttpClientOptions, Store } from '@my-org/shared-contracts';
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
| Interface | DI Token | Purpose |
|
|
79
|
+
| ------------ | -------------- | ------------------------------------------------------------------------------- |
|
|
80
|
+
| `HttpClient` | `HttpClient.$` | Transport-agnostic HTTP contract (`get` / `post` / `put` / `patch` / `delete`). |
|
|
81
|
+
| `Store` | `Store.$` | Async key/value persistence contract (`set` / `get` / `delete`). |
|
|
82
|
+
|
|
83
|
+
##### `HttpClient`
|
|
84
|
+
|
|
85
|
+
A framework- and library-agnostic HTTP boundary. Concrete implementations (Axios, Fetch, etc.) live in `libs/shared/infrastructure`; consumers depend only on this interface. The companion `HttpClientOptions` type carries per-request settings (e.g. `timeout`).
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
export type HttpClientOptions = {
|
|
89
|
+
timeout: number;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export interface HttpClient {
|
|
93
|
+
get<T>(url: string, options?: HttpClientOptions): Promise<T>;
|
|
94
|
+
post<T, K = unknown>(
|
|
95
|
+
url: string,
|
|
96
|
+
data?: K,
|
|
97
|
+
options?: HttpClientOptions,
|
|
98
|
+
): Promise<T>;
|
|
99
|
+
put<T, K = unknown>(
|
|
100
|
+
url: string,
|
|
101
|
+
data?: K,
|
|
102
|
+
options?: HttpClientOptions,
|
|
103
|
+
): Promise<T>;
|
|
104
|
+
patch<T, K = unknown>(
|
|
105
|
+
url: string,
|
|
106
|
+
data?: K,
|
|
107
|
+
options?: HttpClientOptions,
|
|
108
|
+
): Promise<T>;
|
|
109
|
+
delete<T>(url: string, options?: HttpClientOptions): Promise<T>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// DI token — bind your concrete client to this symbol.
|
|
113
|
+
export const HttpClient = {
|
|
114
|
+
$: Symbol.for('HttpClient'),
|
|
115
|
+
};
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
##### `Store`
|
|
119
|
+
|
|
120
|
+
A generic, async key/value persistence boundary. Back it with `localStorage`, `IndexedDB`, an in-memory map, or any remote store — the contract stays the same.
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
export interface Store {
|
|
124
|
+
set<T>(key: string, value: T): Promise<boolean>;
|
|
125
|
+
get<T>(key: string): Promise<T | null>;
|
|
126
|
+
delete(service: string): Promise<boolean>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// DI token — bind your concrete store to this symbol.
|
|
130
|
+
export const Store = {
|
|
131
|
+
$: Symbol.for('Store'),
|
|
132
|
+
};
|
|
133
|
+
```
|
|
134
|
+
|
|
69
135
|
### 2. 🛠 utils
|
|
70
136
|
|
|
71
137
|
**Nx Tags:** `scope:shared`, `type:utils`
|
|
@@ -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
|
+
};
|
|
@@ -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`;
|
|
@@ -33,7 +35,15 @@ async function sharedKernelGenerator(tree, options) {
|
|
|
33
35
|
unitTestRunner: 'none',
|
|
34
36
|
bundler: options.bundler,
|
|
35
37
|
linter: options.linter,
|
|
36
|
-
tags: `${_types.LibraryScope.Shared},${_types.LibraryType.Contracts}
|
|
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
|
|
37
47
|
});
|
|
38
48
|
} else {
|
|
39
49
|
console.log(`Contracts library already exists at ${contractsRoot}`);
|
|
@@ -47,8 +57,12 @@ async function sharedKernelGenerator(tree, options) {
|
|
|
47
57
|
unitTestRunner: options.unitTestRunner,
|
|
48
58
|
bundler: options.bundler,
|
|
49
59
|
linter: options.linter,
|
|
50
|
-
tags: `${_types.LibraryScope.Shared},${_types.LibraryType.Utils}
|
|
60
|
+
tags: `${_types.LibraryScope.Shared},${_types.LibraryType.Utils}`,
|
|
61
|
+
minimal: true
|
|
51
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`, '');
|
|
52
66
|
} else {
|
|
53
67
|
console.log(`Utils library already exists at ${utilsRoot}`);
|
|
54
68
|
}
|
|
@@ -61,8 +75,12 @@ async function sharedKernelGenerator(tree, options) {
|
|
|
61
75
|
unitTestRunner: options.unitTestRunner,
|
|
62
76
|
bundler: options.bundler,
|
|
63
77
|
linter: options.linter,
|
|
64
|
-
tags: `${_types.LibraryScope.Shared},${_types.LibraryType.Infrastructure}
|
|
78
|
+
tags: `${_types.LibraryScope.Shared},${_types.LibraryType.Infrastructure}`,
|
|
79
|
+
minimal: true
|
|
65
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`, '');
|
|
66
84
|
} else {
|
|
67
85
|
console.log(`Infrastructure library already exists at ${infrastructureRoot}`);
|
|
68
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;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1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/nx/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,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
|
@@ -5,5 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
6
|
_export_star._(require("./generators/shared-kernel/shared-kernel"), exports);
|
|
7
7
|
_export_star._(require("./types"), exports);
|
|
8
|
+
_export_star._(require("./utils/resolve-module-format"), exports);
|
|
8
9
|
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/nx/src/index.ts"],"sourcesContent":["export * from './generators/shared-kernel/shared-kernel';\nexport * from './types';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA"}
|
|
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","projectJs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