@tactical-ddd/nx 0.0.2-alpha.0 → 0.0.2-alpha.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/README.md +137 -1
- package/generators/domain/domain.d.ts +5 -0
- package/generators/domain/domain.d.ts.map +1 -0
- package/generators/domain/domain.js +211 -0
- package/generators/domain/domain.js.map +1 -0
- package/generators/domain/files/contracts/src/index.ts +1 -0
- package/generators/domain/files/contracts/src/lib/interfaces/__name__-facade.interface.ts +7 -0
- package/generators/domain/files/core/src/index.ts +1 -0
- package/generators/domain/files/core/src/lib/application/__name__.facade.ts +7 -0
- package/generators/domain/files/core/src/lib/domain/.gitkeep +0 -0
- package/generators/domain/files/core/src/lib/infrastructure/.gitkeep +0 -0
- package/generators/domain/schema.d.js +6 -0
- package/generators/domain/schema.d.js.map +1 -0
- package/generators/domain/schema.d.ts +12 -0
- package/generators/domain/schema.json +73 -0
- package/generators/init/init.d.ts +5 -0
- package/generators/init/init.d.ts.map +1 -0
- package/generators/init/init.js +193 -0
- package/generators/init/init.js.map +1 -0
- package/generators/init/module-boundaries.d.ts +14 -0
- package/generators/init/module-boundaries.d.ts.map +1 -0
- package/generators/init/module-boundaries.js +140 -0
- package/generators/init/module-boundaries.js.map +1 -0
- package/generators/init/schema.d.js +6 -0
- package/generators/init/schema.d.js.map +1 -0
- package/generators/init/schema.d.ts +10 -0
- package/generators/init/schema.json +55 -0
- package/generators/shared-kernel/schema.json +1 -1
- package/generators/shared-kernel/shared-kernel.d.ts +2 -2
- package/generators/shared-kernel/shared-kernel.d.ts.map +1 -1
- package/generators/shared-kernel/shared-kernel.js +29 -15
- package/generators/shared-kernel/shared-kernel.js.map +1 -1
- package/generators.json +10 -0
- package/index.d.ts +5 -0
- package/index.d.ts.map +1 -1
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/package.json +19 -1
- package/types.d.ts +3 -1
- package/types.d.ts.map +1 -1
- package/types.js +2 -0
- package/types.js.map +1 -1
- package/utils/eslint-module-boundaries.d.ts +30 -0
- package/utils/eslint-module-boundaries.d.ts.map +1 -0
- package/utils/eslint-module-boundaries.js +192 -0
- package/utils/eslint-module-boundaries.js.map +1 -0
- package/utils/library-exist.d.ts +12 -0
- package/utils/library-exist.d.ts.map +1 -0
- package/utils/library-exist.js +15 -0
- package/utils/library-exist.js.map +1 -0
- package/utils/logger.d.ts +13 -0
- package/utils/logger.d.ts.map +1 -0
- package/utils/logger.js +48 -0
- package/utils/logger.js.map +1 -0
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx/src/generators/shared-kernel/shared-kernel.ts"],"sourcesContent":["import {\n formatFiles,\n generateFiles,\n OverwriteStrategy,\n runTasksInSerial,\n type GeneratorCallback,\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';\nimport { libraryExists } from '../../utils/library-exist';\nimport { info } from '../../utils/logger';\n\nexport async function sharedKernelGenerator(\n tree: Tree,\n options: SharedKernelGeneratorSchema,\n): Promise<GeneratorCallback> {\n const sharedDirectory = options.directory;\n const contractsRoot = `${sharedDirectory}/contracts`;\n const utilsRoot = `${sharedDirectory}/utils`;\n const infrastructureRoot = `${sharedDirectory}/infrastructure`;\n\n // Install callbacks returned by the delegated `@nx/js:library` generator.\n // They must be returned to Nx so the packages backing the inferred plugins\n // registered via `addPlugin` — `@nx/eslint`, `@nx/jest` — actually get\n // installed; otherwise nx.json references plugins Nx cannot load on the next\n // command. Every library also passes `addPlugin: true`: the `@nx/js` public\n // wrapper defaults it to `false`, which makes the delegated generators emit\n // deprecated executor targets instead of inferred tasks (Project Crystal).\n const tasks: GeneratorCallback[] = [];\n\n if (!libraryExists(tree, contractsRoot)) {\n info(`Creating contracts library at ${contractsRoot}...`);\n\n tasks.push(\n await libraryGenerator(tree, {\n name: options.prefix\n ? `${options.prefix}/shared-contracts`\n : 'shared-contracts',\n directory: contractsRoot,\n useProjectJson: false,\n addPlugin: true,\n unitTestRunner: 'none',\n bundler: options.bundler,\n linter: options.linter,\n tags: `${LibraryScope.Shared},${LibraryType.Contracts}`,\n minimal: true,\n }),\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 info(`Contracts library already exists at ${contractsRoot}`);\n }\n\n if (!libraryExists(tree, utilsRoot)) {\n info(`Creating utils library at ${utilsRoot}...`);\n\n tasks.push(\n await libraryGenerator(tree, {\n name: options.prefix\n ? `${options.prefix}/shared-utils`\n : 'shared-utils',\n directory: utilsRoot,\n useProjectJson: false,\n addPlugin: true,\n unitTestRunner: options.unitTestRunner,\n bundler: options.bundler,\n linter: options.linter,\n tags: `${LibraryScope.Shared},${LibraryType.Utils}`,\n minimal: true,\n }),\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 info(`Utils library already exists at ${utilsRoot}`);\n }\n\n if (!libraryExists(tree, infrastructureRoot)) {\n info(`Creating infrastructure library at ${infrastructureRoot}...`);\n\n tasks.push(\n await libraryGenerator(tree, {\n name: options.prefix\n ? `${options.prefix}/shared-infrastructure`\n : 'shared-infrastructure',\n directory: infrastructureRoot,\n useProjectJson: false,\n addPlugin: true,\n unitTestRunner: options.unitTestRunner,\n bundler: options.bundler,\n linter: options.linter,\n tags: `${LibraryScope.Shared},${LibraryType.Infrastructure}`,\n minimal: true,\n }),\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 info(`Infrastructure library already exists at ${infrastructureRoot}`);\n }\n\n await formatFiles(tree);\n\n return runTasksInSerial(...tasks);\n}\n\nexport default sharedKernelGenerator;\n"],"names":["sharedKernelGenerator","tree","options","sharedDirectory","directory","contractsRoot","utilsRoot","infrastructureRoot","tasks","libraryExists","info","push","libraryGenerator","name","prefix","useProjectJson","addPlugin","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","runTasksInSerial"],"mappings":";;;;;;;;;;;QA6HA;eAAA;;QA5GsBA;eAAAA;;;wBAVf;oBAC0B;sBACT;uBAGgC;qCACb;8BACb;wBACT;AAEd,eAAeA,sBACpBC,IAAU,EACVC,OAAoC;IAEpC,MAAMC,kBAAkBD,QAAQE,SAAS;IACzC,MAAMC,gBAAgB,GAAGF,gBAAgB,UAAU,CAAC;IACpD,MAAMG,YAAY,GA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CAAC,EAAE;IACnD,OAAO;QACLG,IAAAA,YAAI,EAAC,CAAC,yCAAyC,EAAEH,oBAAoB;IACvE;IAEA,MAAMkC,IAAAA,mBAAW,EAACxC;IAElB,OAAOyC,IAAAA,wBAAgB,KAAIlC;AAC7B;MAEA,WAAeR"}
|
package/generators.json
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
"factory": "./generators/shared-kernel/shared-kernel",
|
|
5
5
|
"schema": "./generators/shared-kernel/schema.json",
|
|
6
6
|
"description": "Shared kernel domain"
|
|
7
|
+
},
|
|
8
|
+
"init": {
|
|
9
|
+
"factory": "./generators/init/init",
|
|
10
|
+
"schema": "./generators/init/schema.json",
|
|
11
|
+
"description": "Bootstrap a Tactical DDD workspace: generator defaults, module-boundary lint rules, the Shared Kernel, and an optional framework preset (e.g. React)"
|
|
12
|
+
},
|
|
13
|
+
"domain": {
|
|
14
|
+
"factory": "./generators/domain/domain",
|
|
15
|
+
"schema": "./generators/domain/schema.json",
|
|
16
|
+
"description": "Scaffold a bounded business domain (contracts/core/ui/features layers) with scope/type tags and per-domain cross-domain import isolation"
|
|
7
17
|
}
|
|
8
18
|
}
|
|
9
19
|
}
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export * from './generators/shared-kernel/shared-kernel';
|
|
2
|
+
export * from './generators/init/init';
|
|
3
|
+
export * from './generators/domain/domain';
|
|
2
4
|
export * from './types';
|
|
3
5
|
export * from './utils/resolve-module-format';
|
|
6
|
+
export * from './utils/library-exist';
|
|
7
|
+
export * from './utils/eslint-module-boundaries';
|
|
8
|
+
export * from './utils/logger';
|
|
4
9
|
//# sourceMappingURL=index.d.ts.map
|
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,0CAA0C,CAAC;AACzD,cAAc,SAAS,CAAC;AACxB,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/nx/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gBAAgB,CAAC"}
|
package/index.js
CHANGED
|
@@ -4,7 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
6
|
_export_star._(require("./generators/shared-kernel/shared-kernel"), exports);
|
|
7
|
+
_export_star._(require("./generators/init/init"), exports);
|
|
8
|
+
_export_star._(require("./generators/domain/domain"), exports);
|
|
7
9
|
_export_star._(require("./types"), exports);
|
|
8
10
|
_export_star._(require("./utils/resolve-module-format"), exports);
|
|
11
|
+
_export_star._(require("./utils/library-exist"), exports);
|
|
12
|
+
_export_star._(require("./utils/eslint-module-boundaries"), exports);
|
|
13
|
+
_export_star._(require("./utils/logger"), exports);
|
|
9
14
|
|
|
10
15
|
//# 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';\nexport * from './utils/resolve-module-format';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA"}
|
|
1
|
+
{"version":3,"sources":["../../../packages/nx/src/index.ts"],"sourcesContent":["export * from './generators/shared-kernel/shared-kernel';\nexport * from './generators/init/init';\nexport * from './generators/domain/domain';\nexport * from './types';\nexport * from './utils/resolve-module-format';\nexport * from './utils/library-exist';\nexport * from './utils/eslint-module-boundaries';\nexport * from './utils/logger';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tactical-ddd/nx",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.1",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"nx",
|
|
6
|
+
"nx-plugin",
|
|
7
|
+
"nx-generator",
|
|
8
|
+
"generator",
|
|
9
|
+
"schematics",
|
|
10
|
+
"scaffolding",
|
|
11
|
+
"ddd",
|
|
12
|
+
"domain-driven-design",
|
|
13
|
+
"clean-architecture",
|
|
14
|
+
"tactical-ddd",
|
|
15
|
+
"monorepo",
|
|
16
|
+
"shared-kernel",
|
|
17
|
+
"module-boundaries",
|
|
18
|
+
"architecture",
|
|
19
|
+
"typescript"
|
|
20
|
+
],
|
|
4
21
|
"license": "MIT",
|
|
5
22
|
"author": {
|
|
6
23
|
"name": "Artyom Kayun",
|
|
@@ -27,6 +44,7 @@
|
|
|
27
44
|
"generators": "./generators.json",
|
|
28
45
|
"dependencies": {
|
|
29
46
|
"@nx/devkit": "^22.0.0 || ^23.0.0",
|
|
47
|
+
"@nx/eslint": "^22.0.0 || ^23.0.0",
|
|
30
48
|
"@nx/js": "^22.0.0 || ^23.0.0",
|
|
31
49
|
"@swc/helpers": "~0.5.18"
|
|
32
50
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export declare enum LibraryScope {
|
|
2
2
|
Shared = "scope:shared",
|
|
3
|
-
Domain = "scope:domain"
|
|
3
|
+
Domain = "scope:domain",
|
|
4
|
+
CrossDomain = "domain:*"
|
|
4
5
|
}
|
|
5
6
|
export declare enum LibraryType {
|
|
6
7
|
Contracts = "type:contracts",
|
|
7
8
|
Core = "type:core",
|
|
8
9
|
Features = "type:features",
|
|
10
|
+
Ui = "type:ui",
|
|
9
11
|
Utils = "type:utils",
|
|
10
12
|
Testing = "type:testing",
|
|
11
13
|
Infrastructure = "type:infrastructure"
|
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;
|
|
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;IACvB,WAAW,aAAa;CACzB;AAED,oBAAY,WAAW;IACrB,SAAS,mBAAmB;IAC5B,IAAI,cAAc;IAClB,QAAQ,kBAAkB;IAC1B,EAAE,YAAY;IACd,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
|
@@ -22,12 +22,14 @@ _export(exports, {
|
|
|
22
22
|
var LibraryScope = /*#__PURE__*/ function(LibraryScope) {
|
|
23
23
|
LibraryScope["Shared"] = "scope:shared";
|
|
24
24
|
LibraryScope["Domain"] = "scope:domain";
|
|
25
|
+
LibraryScope["CrossDomain"] = "domain:*";
|
|
25
26
|
return LibraryScope;
|
|
26
27
|
}({});
|
|
27
28
|
var LibraryType = /*#__PURE__*/ function(LibraryType) {
|
|
28
29
|
LibraryType["Contracts"] = "type:contracts";
|
|
29
30
|
LibraryType["Core"] = "type:core";
|
|
30
31
|
LibraryType["Features"] = "type:features";
|
|
32
|
+
LibraryType["Ui"] = "type:ui";
|
|
31
33
|
LibraryType["Utils"] = "type:utils";
|
|
32
34
|
LibraryType["Testing"] = "type:testing";
|
|
33
35
|
LibraryType["Infrastructure"] = "type:infrastructure";
|
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\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;;
|
|
1
|
+
{"version":3,"sources":["../../../packages/nx/src/types.ts"],"sourcesContent":["export enum LibraryScope {\n Shared = 'scope:shared',\n Domain = 'scope:domain',\n CrossDomain = 'domain:*',\n}\n\nexport enum LibraryType {\n Contracts = 'type:contracts',\n Core = 'type:core',\n Features = 'type:features',\n Ui = 'type:ui',\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;;QAMAC;eAAAA;;QAkBAC;eAAAA;;;AAxBL,IAAA,AAAKF,sCAAAA;;;;WAAAA;;AAML,IAAA,AAAKC,qCAAAA;;;;;;;;WAAAA;;AAkBL,IAAA,AAAKC,sCAAAA;;;;WAAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Tree } from '@nx/devkit';
|
|
2
|
+
/** The module-boundaries rule whose `depConstraints` encode the dependency graph. */
|
|
3
|
+
export declare const MODULE_BOUNDARIES_RULE = "@nx/enforce-module-boundaries";
|
|
4
|
+
/** A single `@nx/enforce-module-boundaries` dependency constraint. */
|
|
5
|
+
export interface DepConstraint {
|
|
6
|
+
sourceTag: string;
|
|
7
|
+
onlyDependOnLibsWithTags: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Ensures the root `@nx/enforce-module-boundaries` rule exists and that every
|
|
11
|
+
* constraint in `constraints` is present in its `depConstraints` (merged by
|
|
12
|
+
* `sourceTag`). Existing rule options are preserved; the baseline options are
|
|
13
|
+
* filled in for any that are missing.
|
|
14
|
+
*
|
|
15
|
+
* Returns `false` (and warns) when there is no ESLint config to update — e.g.
|
|
16
|
+
* the workspace was set up with `linter: none`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function applyDepConstraints(tree: Tree, constraints: DepConstraint[]): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Adds Clean Architecture import boundaries to a `core` library's own ESLint
|
|
21
|
+
* config (`<libraryRoot>/eslint.config.*`) via `no-restricted-imports` overrides
|
|
22
|
+
* scoped to the `domain` and `application` layer folders. `@nx/enforce-module-
|
|
23
|
+
* boundaries` guards dependencies *between* projects; these rules guard the
|
|
24
|
+
* layering *within* the core library.
|
|
25
|
+
*
|
|
26
|
+
* No-op (returning `false`) when the library has no ESLint config — e.g. it was
|
|
27
|
+
* generated with `linter: none`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function applyCleanArchitectureBoundaries(tree: Tree, libraryRoot: string, prefix?: string): boolean;
|
|
30
|
+
//# sourceMappingURL=eslint-module-boundaries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-module-boundaries.d.ts","sourceRoot":"","sources":["../../../../packages/nx/src/utils/eslint-module-boundaries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAYvC,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB,EAAE,MAAM,EAAE,CAAC;CACpC;AAoCD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,aAAa,EAAE,GAC3B,OAAO,CA+DT;AA2DD;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CA0BT"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get MODULE_BOUNDARIES_RULE () {
|
|
13
|
+
return MODULE_BOUNDARIES_RULE;
|
|
14
|
+
},
|
|
15
|
+
get applyCleanArchitectureBoundaries () {
|
|
16
|
+
return applyCleanArchitectureBoundaries;
|
|
17
|
+
},
|
|
18
|
+
get applyDepConstraints () {
|
|
19
|
+
return applyDepConstraints;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _extends = require("@swc/helpers/_/_extends");
|
|
23
|
+
const _internal = require("@nx/eslint/internal");
|
|
24
|
+
const _logger = require("./logger");
|
|
25
|
+
const MODULE_BOUNDARIES_RULE = '@nx/enforce-module-boundaries';
|
|
26
|
+
/**
|
|
27
|
+
* Baseline options every `@nx/enforce-module-boundaries` rule we write carries.
|
|
28
|
+
* The `allow` glob keeps libraries free to import the workspace's flat ESLint
|
|
29
|
+
* config files (which live outside any project's source) without tripping the
|
|
30
|
+
* boundary check.
|
|
31
|
+
*/ const DEFAULT_RULE_OPTIONS = {
|
|
32
|
+
enforceBuildableLibDependency: true,
|
|
33
|
+
allow: [
|
|
34
|
+
'^.*/eslint(\\.base)?\\.config\\.[cm]?[jt]s$'
|
|
35
|
+
]
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Merges `incoming` constraints into `existing`, keyed by `sourceTag`: an
|
|
39
|
+
* incoming constraint replaces any existing one with the same `sourceTag`,
|
|
40
|
+
* otherwise it is appended. Order of first appearance is preserved so the
|
|
41
|
+
* config stays stable across re-runs (idempotent).
|
|
42
|
+
*/ function mergeConstraints(existing, incoming) {
|
|
43
|
+
const bySource = new Map();
|
|
44
|
+
for (const constraint of [
|
|
45
|
+
...existing,
|
|
46
|
+
...incoming
|
|
47
|
+
]){
|
|
48
|
+
bySource.set(constraint.sourceTag, constraint);
|
|
49
|
+
}
|
|
50
|
+
return [
|
|
51
|
+
...bySource.values()
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
function applyDepConstraints(tree, constraints) {
|
|
55
|
+
if (!(0, _internal.isEslintConfigSupported)(tree)) {
|
|
56
|
+
(0, _logger.warning)('No supported ESLint config found at the workspace root — skipping module boundary rules.');
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const hasRule = (0, _internal.lintConfigHasOverride)(tree, '', (override)=>{
|
|
60
|
+
var _override_rules;
|
|
61
|
+
return Boolean((_override_rules = override.rules) == null ? void 0 : _override_rules[MODULE_BOUNDARIES_RULE]);
|
|
62
|
+
});
|
|
63
|
+
if (!hasRule) {
|
|
64
|
+
(0, _internal.addOverrideToLintConfig)(tree, '', {
|
|
65
|
+
files: [
|
|
66
|
+
'**/*.ts',
|
|
67
|
+
'**/*.js'
|
|
68
|
+
],
|
|
69
|
+
rules: {
|
|
70
|
+
[MODULE_BOUNDARIES_RULE]: [
|
|
71
|
+
'error',
|
|
72
|
+
_extends._({}, DEFAULT_RULE_OPTIONS, {
|
|
73
|
+
depConstraints: constraints
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
(0, _internal.updateOverrideInLintConfig)(tree, '', (override)=>{
|
|
81
|
+
var _override_rules;
|
|
82
|
+
return Boolean((_override_rules = override.rules) == null ? void 0 : _override_rules[MODULE_BOUNDARIES_RULE]);
|
|
83
|
+
}, (override)=>{
|
|
84
|
+
var _override_rules, _rule_;
|
|
85
|
+
const rules = (_override_rules = override.rules) != null ? _override_rules : {};
|
|
86
|
+
const rule = rules[MODULE_BOUNDARIES_RULE];
|
|
87
|
+
// The rule may be a bare severity string (`'error'`) or the usual
|
|
88
|
+
// `[severity, options]` tuple. Falling back to `{}` for the non-tuple
|
|
89
|
+
// form would silently drop `enforceBuildableLibDependency`/`allow`, so we
|
|
90
|
+
// start from the baseline options and layer any existing ones on top.
|
|
91
|
+
const severity = Array.isArray(rule) ? rule[0] : rule != null ? rule : 'error';
|
|
92
|
+
const existingOptions = Array.isArray(rule) ? (_rule_ = rule[1]) != null ? _rule_ : {} : {};
|
|
93
|
+
const existingConstraints = Array.isArray(existingOptions.depConstraints) ? existingOptions.depConstraints : [];
|
|
94
|
+
const updatedRule = [
|
|
95
|
+
severity,
|
|
96
|
+
_extends._({}, DEFAULT_RULE_OPTIONS, existingOptions, {
|
|
97
|
+
depConstraints: mergeConstraints(existingConstraints, constraints)
|
|
98
|
+
})
|
|
99
|
+
];
|
|
100
|
+
return _extends._({}, override, {
|
|
101
|
+
rules: _extends._({}, rules, {
|
|
102
|
+
[MODULE_BOUNDARIES_RULE]: updatedRule
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The `no-restricted-imports` patterns enforcing Clean Architecture layering
|
|
110
|
+
* *inside* a domain's `core` library: `domain` may not reach into `application`
|
|
111
|
+
* or `infrastructure`, and `application` may not reach into `infrastructure`.
|
|
112
|
+
*
|
|
113
|
+
* Each layer gets a relative-path rule (sibling folders under `src/lib`) and,
|
|
114
|
+
* when an organization `prefix` is known, an absolute-path rule that closes the
|
|
115
|
+
* loophole of bypassing the relative rule through a workspace alias.
|
|
116
|
+
*/ function domainLayerPatterns(prefix) {
|
|
117
|
+
const patterns = [
|
|
118
|
+
{
|
|
119
|
+
group: [
|
|
120
|
+
'../application/*',
|
|
121
|
+
'../application',
|
|
122
|
+
'../infrastructure/*',
|
|
123
|
+
'../infrastructure'
|
|
124
|
+
],
|
|
125
|
+
message: 'Clean Architecture violation: Domain layer must be independent and cannot import from Application or Infrastructure layers.'
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
if (prefix) {
|
|
129
|
+
patterns.push({
|
|
130
|
+
group: [
|
|
131
|
+
`${prefix}/*/core/infrastructure/*`,
|
|
132
|
+
`${prefix}/*/core/application/*`
|
|
133
|
+
],
|
|
134
|
+
message: 'Clean Architecture violation: Domain layer cannot import upper layers via absolute paths.'
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return patterns;
|
|
138
|
+
}
|
|
139
|
+
function applicationLayerPatterns(prefix) {
|
|
140
|
+
const patterns = [
|
|
141
|
+
{
|
|
142
|
+
group: [
|
|
143
|
+
'../infrastructure/*',
|
|
144
|
+
'../infrastructure'
|
|
145
|
+
],
|
|
146
|
+
message: 'Clean Architecture violation: Application layer cannot import from Infrastructure layer.'
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
if (prefix) {
|
|
150
|
+
patterns.push({
|
|
151
|
+
group: [
|
|
152
|
+
`${prefix}/*/core/infrastructure/*`
|
|
153
|
+
],
|
|
154
|
+
message: 'Clean Architecture violation: Application layer cannot import Infrastructure via absolute paths.'
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
return patterns;
|
|
158
|
+
}
|
|
159
|
+
function applyCleanArchitectureBoundaries(tree, libraryRoot, prefix) {
|
|
160
|
+
if (!(0, _internal.isEslintConfigSupported)(tree, libraryRoot)) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
(0, _internal.addOverrideToLintConfig)(tree, libraryRoot, {
|
|
164
|
+
files: [
|
|
165
|
+
'src/lib/domain/**/*.ts'
|
|
166
|
+
],
|
|
167
|
+
rules: {
|
|
168
|
+
'no-restricted-imports': [
|
|
169
|
+
'error',
|
|
170
|
+
{
|
|
171
|
+
patterns: domainLayerPatterns(prefix)
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
(0, _internal.addOverrideToLintConfig)(tree, libraryRoot, {
|
|
177
|
+
files: [
|
|
178
|
+
'src/lib/application/**/*.ts'
|
|
179
|
+
],
|
|
180
|
+
rules: {
|
|
181
|
+
'no-restricted-imports': [
|
|
182
|
+
'error',
|
|
183
|
+
{
|
|
184
|
+
patterns: applicationLayerPatterns(prefix)
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
//# sourceMappingURL=eslint-module-boundaries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../packages/nx/src/utils/eslint-module-boundaries.ts"],"sourcesContent":["import { type Tree } from '@nx/devkit';\nimport {\n addOverrideToLintConfig,\n isEslintConfigSupported,\n lintConfigHasOverride,\n updateOverrideInLintConfig,\n} from '@nx/eslint/internal';\n\nimport type { Linter } from 'eslint';\n\nimport { warning } from './logger';\n\n/** The module-boundaries rule whose `depConstraints` encode the dependency graph. */\nexport const MODULE_BOUNDARIES_RULE = '@nx/enforce-module-boundaries';\n\n/** A single `@nx/enforce-module-boundaries` dependency constraint. */\nexport interface DepConstraint {\n sourceTag: string;\n onlyDependOnLibsWithTags: string[];\n}\n\n/** A single `no-restricted-imports` pattern group with its violation message. */\ninterface RestrictedImportPattern {\n group: string[];\n message: string;\n}\n\n/**\n * Baseline options every `@nx/enforce-module-boundaries` rule we write carries.\n * The `allow` glob keeps libraries free to import the workspace's flat ESLint\n * config files (which live outside any project's source) without tripping the\n * boundary check.\n */\nconst DEFAULT_RULE_OPTIONS = {\n enforceBuildableLibDependency: true,\n allow: ['^.*/eslint(\\\\.base)?\\\\.config\\\\.[cm]?[jt]s$'],\n};\n\n/**\n * Merges `incoming` constraints into `existing`, keyed by `sourceTag`: an\n * incoming constraint replaces any existing one with the same `sourceTag`,\n * otherwise it is appended. Order of first appearance is preserved so the\n * config stays stable across re-runs (idempotent).\n */\nfunction mergeConstraints(\n existing: DepConstraint[],\n incoming: DepConstraint[],\n): DepConstraint[] {\n const bySource = new Map<string, DepConstraint>();\n for (const constraint of [...existing, ...incoming]) {\n bySource.set(constraint.sourceTag, constraint);\n }\n return [...bySource.values()];\n}\n\n/**\n * Ensures the root `@nx/enforce-module-boundaries` rule exists and that every\n * constraint in `constraints` is present in its `depConstraints` (merged by\n * `sourceTag`). Existing rule options are preserved; the baseline options are\n * filled in for any that are missing.\n *\n * Returns `false` (and warns) when there is no ESLint config to update — e.g.\n * the workspace was set up with `linter: none`.\n */\nexport function applyDepConstraints(\n tree: Tree,\n constraints: DepConstraint[],\n): boolean {\n if (!isEslintConfigSupported(tree)) {\n warning(\n 'No supported ESLint config found at the workspace root — skipping module boundary rules.',\n );\n return false;\n }\n\n const hasRule = lintConfigHasOverride(tree, '', (override) =>\n Boolean(override.rules?.[MODULE_BOUNDARIES_RULE]),\n );\n\n if (!hasRule) {\n addOverrideToLintConfig(tree, '', {\n files: ['**/*.ts', '**/*.js'],\n rules: {\n [MODULE_BOUNDARIES_RULE]: [\n 'error',\n { ...DEFAULT_RULE_OPTIONS, depConstraints: constraints },\n ],\n },\n });\n return true;\n }\n\n updateOverrideInLintConfig(\n tree,\n '',\n (override) => Boolean(override.rules?.[MODULE_BOUNDARIES_RULE]),\n (override) => {\n const rules = override.rules ?? {};\n const rule = rules[MODULE_BOUNDARIES_RULE];\n\n // The rule may be a bare severity string (`'error'`) or the usual\n // `[severity, options]` tuple. Falling back to `{}` for the non-tuple\n // form would silently drop `enforceBuildableLibDependency`/`allow`, so we\n // start from the baseline options and layer any existing ones on top.\n const severity: Linter.RuleSeverity = Array.isArray(rule)\n ? (rule[0] as Linter.RuleSeverity)\n : ((rule as Linter.RuleSeverity) ?? 'error');\n const existingOptions = (\n Array.isArray(rule) ? (rule[1] ?? {}) : {}\n ) as Record<string, unknown>;\n const existingConstraints = Array.isArray(existingOptions.depConstraints)\n ? (existingOptions.depConstraints as DepConstraint[])\n : [];\n\n const updatedRule: Linter.RuleEntry = [\n severity,\n {\n ...DEFAULT_RULE_OPTIONS,\n ...existingOptions,\n depConstraints: mergeConstraints(existingConstraints, constraints),\n },\n ];\n\n return {\n ...override,\n rules: { ...rules, [MODULE_BOUNDARIES_RULE]: updatedRule },\n };\n },\n );\n return true;\n}\n\n/**\n * The `no-restricted-imports` patterns enforcing Clean Architecture layering\n * *inside* a domain's `core` library: `domain` may not reach into `application`\n * or `infrastructure`, and `application` may not reach into `infrastructure`.\n *\n * Each layer gets a relative-path rule (sibling folders under `src/lib`) and,\n * when an organization `prefix` is known, an absolute-path rule that closes the\n * loophole of bypassing the relative rule through a workspace alias.\n */\nfunction domainLayerPatterns(prefix?: string): RestrictedImportPattern[] {\n const patterns: RestrictedImportPattern[] = [\n {\n group: [\n '../application/*',\n '../application',\n '../infrastructure/*',\n '../infrastructure',\n ],\n message:\n 'Clean Architecture violation: Domain layer must be independent and cannot import from Application or Infrastructure layers.',\n },\n ];\n\n if (prefix) {\n patterns.push({\n group: [\n `${prefix}/*/core/infrastructure/*`,\n `${prefix}/*/core/application/*`,\n ],\n message:\n 'Clean Architecture violation: Domain layer cannot import upper layers via absolute paths.',\n });\n }\n\n return patterns;\n}\n\nfunction applicationLayerPatterns(prefix?: string): RestrictedImportPattern[] {\n const patterns: RestrictedImportPattern[] = [\n {\n group: ['../infrastructure/*', '../infrastructure'],\n message:\n 'Clean Architecture violation: Application layer cannot import from Infrastructure layer.',\n },\n ];\n\n if (prefix) {\n patterns.push({\n group: [`${prefix}/*/core/infrastructure/*`],\n message:\n 'Clean Architecture violation: Application layer cannot import Infrastructure via absolute paths.',\n });\n }\n\n return patterns;\n}\n\n/**\n * Adds Clean Architecture import boundaries to a `core` library's own ESLint\n * config (`<libraryRoot>/eslint.config.*`) via `no-restricted-imports` overrides\n * scoped to the `domain` and `application` layer folders. `@nx/enforce-module-\n * boundaries` guards dependencies *between* projects; these rules guard the\n * layering *within* the core library.\n *\n * No-op (returning `false`) when the library has no ESLint config — e.g. it was\n * generated with `linter: none`.\n */\nexport function applyCleanArchitectureBoundaries(\n tree: Tree,\n libraryRoot: string,\n prefix?: string,\n): boolean {\n if (!isEslintConfigSupported(tree, libraryRoot)) {\n return false;\n }\n\n addOverrideToLintConfig(tree, libraryRoot, {\n files: ['src/lib/domain/**/*.ts'],\n rules: {\n 'no-restricted-imports': [\n 'error',\n { patterns: domainLayerPatterns(prefix) },\n ],\n },\n });\n\n addOverrideToLintConfig(tree, libraryRoot, {\n files: ['src/lib/application/**/*.ts'],\n rules: {\n 'no-restricted-imports': [\n 'error',\n { patterns: applicationLayerPatterns(prefix) },\n ],\n },\n });\n\n return true;\n}\n"],"names":["MODULE_BOUNDARIES_RULE","applyCleanArchitectureBoundaries","applyDepConstraints","DEFAULT_RULE_OPTIONS","enforceBuildableLibDependency","allow","mergeConstraints","existing","incoming","bySource","Map","constraint","set","sourceTag","values","tree","constraints","isEslintConfigSupported","warning","hasRule","lintConfigHasOverride","override","Boolean","rules","addOverrideToLintConfig","files","depConstraints","updateOverrideInLintConfig","rule","severity","Array","isArray","existingOptions","existingConstraints","updatedRule","domainLayerPatterns","prefix","patterns","group","message","push","applicationLayerPatterns","libraryRoot"],"mappings":";;;;;;;;;;;QAaaA;eAAAA;;QA0LGC;eAAAA;;QAvIAC;eAAAA;;;;0BA1DT;wBAIiB;AAGjB,MAAMF,yBAAyB;AActC;;;;;CAKC,GACD,MAAMG,uBAAuB;IAC3BC,+BAA+B;IAC/BC,OAAO;QAAC;KAA8C;AACxD;AAEA;;;;;CAKC,GACD,SAASC,iBACPC,QAAyB,EACzBC,QAAyB;IAEzB,MAAMC,WAAW,IAAIC;IACrB,KAAK,MAAMC,cAAc;WAAIJ;WAAaC;KAAS,CAAE;QACnDC,SAASG,GAAG,CAACD,WAAWE,SAAS,EAAEF;IACrC;IACA,OAAO;WAAIF,SAASK,MAAM;KAAG;AAC/B;AAWO,SAASZ,oBACda,IAAU,EACVC,WAA4B;IAE5B,IAAI,CAACC,IAAAA,iCAAuB,EAACF,OAAO;QAClCG,IAAAA,eAAO,EACL;QAEF,OAAO;IACT;IAEA,MAAMC,UAAUC,IAAAA,+BAAqB,EAACL,MAAM,IAAI,CAACM;YACvCA;eAARC,SAAQD,kBAAAA,SAASE,KAAK,qBAAdF,eAAgB,CAACrB,uBAAuB;;IAGlD,IAAI,CAACmB,SAAS;QACZK,IAAAA,iCAAuB,EAACT,MAAM,IAAI;YAChCU,OAAO;gBAAC;gBAAW;aAAU;YAC7BF,OAAO;gBACL,CAACvB,uBAAuB,EAAE;oBACxB;oBACA,eAAKG;wBAAsBuB,gBAAgBV;;iBAC5C;YACH;QACF;QACA,OAAO;IACT;IAEAW,IAAAA,oCAA0B,EACxBZ,MACA,IACA,CAACM;YAAqBA;eAARC,SAAQD,kBAAAA,SAASE,KAAK,qBAAdF,eAAgB,CAACrB,uBAAuB;OAC9D,CAACqB;YACeA,iBAWWO;QAXzB,MAAML,SAAQF,kBAAAA,SAASE,KAAK,YAAdF,kBAAkB,CAAC;QACjC,MAAMO,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AAc;QAC/C,OAAO;IACT;IAEAlB,IAAAA,iCAAuB,EAACT,MAAM2B,aAAa;QACzCjB,OAAO;YAAC;SAAyB;QACjCF,OAAO;YACL,yBAAyB;gBACvB;gBACA;oBAAEc,UAAUF,oBAAoBC;gBAAQ;aACzC;QACH;IACF;IAEAZ,IAAAA,iCAAuB,EAACT,MAAM2B,aAAa;QACzCjB,OAAO;YAAC;SAA8B;QACtCF,OAAO;YACL,yBAAyB;gBACvB;gBACA;oBAAEc,UAAUI,yBAAyBL;gBAAQ;aAC9C;QACH;IACF;IAEA,OAAO;AACT"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a kernel library has actually been generated at `root`.
|
|
4
|
+
*
|
|
5
|
+
* We key off the library manifest (`package.json`) rather than the directory:
|
|
6
|
+
* `tree.exists(root)` is `true` for *any* existing directory — including an
|
|
7
|
+
* empty leftover from an aborted run — which would make the generator wrongly
|
|
8
|
+
* skip a layer that has no files in it. A `package.json` only exists once
|
|
9
|
+
* `@nx/js:library` has scaffolded the library, so it is the reliable marker.
|
|
10
|
+
*/
|
|
11
|
+
export declare function libraryExists(tree: Tree, root: string): boolean;
|
|
12
|
+
//# sourceMappingURL=library-exist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library-exist.d.ts","sourceRoot":"","sources":["../../../../packages/nx/src/utils/library-exist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "libraryExists", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return libraryExists;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function libraryExists(tree, root) {
|
|
12
|
+
return tree.exists(`${root}/package.json`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=library-exist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../packages/nx/src/utils/library-exist.ts"],"sourcesContent":["import { Tree } from '@nx/devkit';\n\n/**\n * Whether a kernel library has actually been generated at `root`.\n *\n * We key off the library manifest (`package.json`) rather than the directory:\n * `tree.exists(root)` is `true` for *any* existing directory — including an\n * empty leftover from an aborted run — which would make the generator wrongly\n * skip a layer that has no files in it. A `package.json` only exists once\n * `@nx/js:library` has scaffolded the library, so it is the reliable marker.\n */\nexport function libraryExists(tree: Tree, root: string): boolean {\n return tree.exists(`${root}/package.json`);\n}\n"],"names":["libraryExists","tree","root","exists"],"mappings":";;;;+BAWgBA;;;eAAAA;;;AAAT,SAASA,cAAcC,IAAU,EAAEC,IAAY;IACpD,OAAOD,KAAKE,MAAM,CAAC,GAAGD,KAAK,aAAa,CAAC;AAC3C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny console helpers for the text generators print while they run.
|
|
3
|
+
*
|
|
4
|
+
* Output is tagged and colorized — `INFO` in blue, `WARNING` in yellow — using
|
|
5
|
+
* raw ANSI escape codes so no color dependency is pulled into the plugin. Color
|
|
6
|
+
* is suppressed when the stream is not a TTY or `NO_COLOR` is set (and forced on
|
|
7
|
+
* by `FORCE_COLOR`), per the https://no-color.org convention.
|
|
8
|
+
*/
|
|
9
|
+
/** Logs an informational message tagged with a blue `INFO` label. */
|
|
10
|
+
export declare function info(message: string): void;
|
|
11
|
+
/** Logs a cautionary message tagged with a yellow `WARNING` label. */
|
|
12
|
+
export declare function warning(message: string): void;
|
|
13
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../packages/nx/src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA4BH,qEAAqE;AACrE,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,sEAAsE;AACtE,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C"}
|
package/utils/logger.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get info () {
|
|
13
|
+
return info;
|
|
14
|
+
},
|
|
15
|
+
get warning () {
|
|
16
|
+
return warning;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Tiny console helpers for the text generators print while they run.
|
|
21
|
+
*
|
|
22
|
+
* Output is tagged and colorized — `INFO` in blue, `WARNING` in yellow — using
|
|
23
|
+
* raw ANSI escape codes so no color dependency is pulled into the plugin. Color
|
|
24
|
+
* is suppressed when the stream is not a TTY or `NO_COLOR` is set (and forced on
|
|
25
|
+
* by `FORCE_COLOR`), per the https://no-color.org convention.
|
|
26
|
+
*/ const RESET = '\x1b[0m';
|
|
27
|
+
const BLUE = '\x1b[34m';
|
|
28
|
+
const YELLOW = '\x1b[33m';
|
|
29
|
+
function colorEnabled(stream) {
|
|
30
|
+
if (process.env.FORCE_COLOR && process.env.FORCE_COLOR !== '0') {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
if (process.env.NO_COLOR !== undefined || process.env.FORCE_COLOR === '0') {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return Boolean(stream && stream.isTTY);
|
|
37
|
+
}
|
|
38
|
+
/** Formats `<LABEL> <message>`, coloring the label when the stream supports it. */ function format(label, color, message, stream) {
|
|
39
|
+
return colorEnabled(stream) ? `${color}${label}${RESET} ${message}` : `${label} ${message}`;
|
|
40
|
+
}
|
|
41
|
+
function info(message) {
|
|
42
|
+
console.log(format('INFO', BLUE, message, process.stdout));
|
|
43
|
+
}
|
|
44
|
+
function warning(message) {
|
|
45
|
+
console.warn(format('WARNING', YELLOW, message, process.stderr));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../packages/nx/src/utils/logger.ts"],"sourcesContent":["/**\n * Tiny console helpers for the text generators print while they run.\n *\n * Output is tagged and colorized — `INFO` in blue, `WARNING` in yellow — using\n * raw ANSI escape codes so no color dependency is pulled into the plugin. Color\n * is suppressed when the stream is not a TTY or `NO_COLOR` is set (and forced on\n * by `FORCE_COLOR`), per the https://no-color.org convention.\n */\n\nconst RESET = '\\x1b[0m';\nconst BLUE = '\\x1b[34m';\nconst YELLOW = '\\x1b[33m';\n\nfunction colorEnabled(stream: NodeJS.WriteStream): boolean {\n if (process.env.FORCE_COLOR && process.env.FORCE_COLOR !== '0') {\n return true;\n }\n if (process.env.NO_COLOR !== undefined || process.env.FORCE_COLOR === '0') {\n return false;\n }\n return Boolean(stream && stream.isTTY);\n}\n\n/** Formats `<LABEL> <message>`, coloring the label when the stream supports it. */\nfunction format(\n label: string,\n color: string,\n message: string,\n stream: NodeJS.WriteStream,\n): string {\n return colorEnabled(stream)\n ? `${color}${label}${RESET} ${message}`\n : `${label} ${message}`;\n}\n\n/** Logs an informational message tagged with a blue `INFO` label. */\nexport function info(message: string): void {\n console.log(format('INFO', BLUE, message, process.stdout));\n}\n\n/** Logs a cautionary message tagged with a yellow `WARNING` label. */\nexport function warning(message: string): void {\n console.warn(format('WARNING', YELLOW, message, process.stderr));\n}\n"],"names":["info","warning","RESET","BLUE","YELLOW","colorEnabled","stream","process","env","FORCE_COLOR","NO_COLOR","undefined","Boolean","isTTY","format","label","color","message","console","log","stdout","warn","stderr"],"mappings":";;;;;;;;;;;QAoCgBA;eAAAA;;QAKAC;eAAAA;;;AAzChB;;;;;;;CAOC,GAED,MAAMC,QAAQ;AACd,MAAMC,OAAO;AACb,MAAMC,SAAS;AAEf,SAASC,aAAaC,MAA0B;IAC9C,IAAIC,QAAQC,GAAG,CAACC,WAAW,IAAIF,QAAQC,GAAG,CAACC,WAAW,KAAK,KAAK;QAC9D,OAAO;IACT;IACA,IAAIF,QAAQC,GAAG,CAACE,QAAQ,KAAKC,aAAaJ,QAAQC,GAAG,CAACC,WAAW,KAAK,KAAK;QACzE,OAAO;IACT;IACA,OAAOG,QAAQN,UAAUA,OAAOO,KAAK;AACvC;AAEA,iFAAiF,GACjF,SAASC,OACPC,KAAa,EACbC,KAAa,EACbC,OAAe,EACfX,MAA0B;IAE1B,OAAOD,aAAaC,UAChB,GAAGU,QAAQD,QAAQb,MAAM,CAAC,EAAEe,SAAS,GACrC,GAAGF,MAAM,CAAC,EAAEE,SAAS;AAC3B;AAGO,SAASjB,KAAKiB,OAAe;IAClCC,QAAQC,GAAG,CAACL,OAAO,QAAQX,MAAMc,SAASV,QAAQa,MAAM;AAC1D;AAGO,SAASnB,QAAQgB,OAAe;IACrCC,QAAQG,IAAI,CAACP,OAAO,WAAWV,QAAQa,SAASV,QAAQe,MAAM;AAChE"}
|