archicat 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -35
- package/dist/cli/index.mjs +25 -15
- package/dist/src/index.cjs +1 -1
- package/dist/src/index.d.cts +145 -38
- package/dist/src/index.d.mts +145 -38
- package/dist/src/index.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
The generative architecture framework for clean architecture.
|
|
6
6
|
|
|
7
|
-
Archicat generates a
|
|
7
|
+
Archicat generates a mirror from your source code. APIs become aliases. Implementations stay behind architecture rules.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm i -D archicat
|
|
@@ -12,53 +12,111 @@ npm i -D archicat
|
|
|
12
12
|
|
|
13
13
|
## Why
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
TypeScript asks: can this import resolve?
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Archicat asks: should this import exist?
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Definitions
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
### Module
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
source modules
|
|
25
|
-
-> module definitions
|
|
26
|
-
-> generated mirror
|
|
27
|
-
-> checked boundaries
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
You define the module:
|
|
23
|
+
Business/application unit.
|
|
31
24
|
|
|
32
25
|
```ts
|
|
33
26
|
import { defineModule } from 'archicat';
|
|
34
27
|
|
|
35
28
|
export default defineModule({
|
|
36
|
-
|
|
29
|
+
name: 'media',
|
|
30
|
+
|
|
31
|
+
api: {
|
|
32
|
+
root: './api',
|
|
33
|
+
dependencies: ['module.account.api', 'library.error.api'],
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
impl: {
|
|
37
|
+
root: './impl',
|
|
38
|
+
dependencies: ['module.account.api', 'library.backend.api'],
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Library
|
|
44
|
+
|
|
45
|
+
Lower reusable unit.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { defineLibrary } from 'archicat';
|
|
49
|
+
|
|
50
|
+
export default defineLibrary({
|
|
51
|
+
name: 'backend',
|
|
52
|
+
|
|
37
53
|
api: './api',
|
|
38
54
|
impl: './impl',
|
|
39
|
-
dependencies: ['module.account.api'],
|
|
40
55
|
});
|
|
41
56
|
```
|
|
42
57
|
|
|
43
|
-
|
|
58
|
+
### App
|
|
44
59
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
60
|
+
Composition root.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { defineApp } from 'archicat';
|
|
64
|
+
|
|
65
|
+
export default defineApp({
|
|
66
|
+
name: 'main-api',
|
|
67
|
+
root: './src/app',
|
|
68
|
+
|
|
69
|
+
dependencies: [
|
|
70
|
+
'module.media.impl',
|
|
71
|
+
'library.backend.impl',
|
|
72
|
+
],
|
|
73
|
+
});
|
|
49
74
|
```
|
|
50
75
|
|
|
51
|
-
|
|
76
|
+
## Dependency rules
|
|
77
|
+
|
|
78
|
+
### Module
|
|
79
|
+
|
|
80
|
+
| Source | Can depend on | Cannot depend on |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| `module.*.api` | `module.*.api`, `library.*.api` | `module.*.impl`, `library.*.impl` |
|
|
83
|
+
| `module.*.impl` | own `module.*.api`, `module.*.api`, `library.*.api` | `module.*.impl`, `library.*.impl` |
|
|
84
|
+
|
|
85
|
+
### Library
|
|
86
|
+
|
|
87
|
+
| Source | Can depend on | Cannot depend on |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| `library.*.api` | `library.*.api` | `module.*`, `library.*.impl` |
|
|
90
|
+
| `library.*.impl` | own `library.*.api`, `library.*.api` | `module.*`, `library.*.impl` |
|
|
91
|
+
|
|
92
|
+
### App
|
|
93
|
+
|
|
94
|
+
| Source | Can depend on | Cannot depend on |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `app.*` | `module.*.api`, `module.*.impl`, `library.*.api`, `library.*.impl` | nothing inside the Archicat graph |
|
|
97
|
+
|
|
98
|
+
> [!IMPORTANT]
|
|
99
|
+
> Implementation targets are wired by app composition. Normal modules and libraries depend on API targets.
|
|
100
|
+
|
|
101
|
+
## Imports
|
|
102
|
+
|
|
103
|
+
Public API import:
|
|
52
104
|
|
|
53
105
|
```ts
|
|
54
106
|
import { AccountReader } from '@module/account';
|
|
55
107
|
```
|
|
56
108
|
|
|
57
|
-
|
|
109
|
+
App composition import:
|
|
58
110
|
|
|
59
111
|
```ts
|
|
60
|
-
import {
|
|
61
|
-
|
|
112
|
+
import { mediaAssembly } from '@module/media/impl';
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Blocked outside app composition:
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import { MediaRepository } from '@module/media/impl';
|
|
119
|
+
import { MediaRepository } from '../../media/impl/repository';
|
|
62
120
|
```
|
|
63
121
|
|
|
64
122
|
## Config
|
|
@@ -67,30 +125,49 @@ import { AccountRepository } from '../../account/impl/repository'; // blocked
|
|
|
67
125
|
import { defineArchicatConfig } from 'archicat';
|
|
68
126
|
|
|
69
127
|
export default defineArchicatConfig({
|
|
128
|
+
tsconfig: './tsconfig.json',
|
|
129
|
+
|
|
130
|
+
alias: {
|
|
131
|
+
'@app': './src/app/index.ts',
|
|
132
|
+
'@app/*': './src/app/*',
|
|
133
|
+
},
|
|
134
|
+
|
|
70
135
|
modules: {
|
|
71
136
|
include: ['./src/modules'],
|
|
72
137
|
},
|
|
138
|
+
|
|
139
|
+
libraries: {
|
|
140
|
+
include: ['./src/libraries'],
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
apps: {
|
|
144
|
+
include: ['./src/app'],
|
|
145
|
+
},
|
|
73
146
|
});
|
|
74
147
|
```
|
|
75
148
|
|
|
149
|
+
Root `tsconfig.json`:
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"extends": "./.archicat/tsconfig.json"
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
> [!IMPORTANT]
|
|
158
|
+
> Put user aliases in `archicat.config.ts`, not in root `compilerOptions.paths`.
|
|
159
|
+
|
|
76
160
|
## Output
|
|
77
161
|
|
|
78
162
|
```txt
|
|
79
163
|
.archicat/
|
|
80
164
|
tsconfig.json
|
|
81
165
|
modules/
|
|
166
|
+
libraries/
|
|
82
167
|
types/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Extend the generated config:
|
|
89
|
-
|
|
90
|
-
```json
|
|
91
|
-
{
|
|
92
|
-
"extends": "./.archicat/tsconfig.json"
|
|
93
|
-
}
|
|
168
|
+
reports/
|
|
169
|
+
build.report.json
|
|
170
|
+
graph.report.json
|
|
94
171
|
```
|
|
95
172
|
|
|
96
173
|
## Commands
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
|
-
import e from"node:path";import t from"node:fs";import{createJiti as n}from"jiti";import r from"typescript";const i=Object.freeze({root:`.`,outDir:`.archicat`,reportDir:`archicat-report`,prefixes:Object.freeze({module:`@module`,library:`@library`}),modules:Object.freeze({include:Object.freeze([`./src/modules`])}),libraries:Object.freeze({include:Object.freeze([])})});async function a(n=`archicat.config.ts`){let r=process.cwd(),i=e.resolve(r,n);if(!t.existsSync(i))throw Error(`Archicat config was not found: ${i}`);let a=await o(i,r);l(a,i);let u=s(a),d=e.resolve(r,u.root),f=e.resolve(d,u.outDir),p=e.resolve(d,u.reportDir),m=c(d,u.tsconfig);return{configFilePath:i,rootDir:d,outDir:f,reportDir:p,...m?{tsconfigPath:m}:{},config:a,resolvedConfig:u}}async function o(e,t){return await n(t,{interopDefault:!0,extensions:[`.js`,`.cjs`,`.mjs`,`.ts`,`.cts`,`.mts`,`.json`]}).import(e,{default:!0})}function s(e){return{root:e.root??i.root,outDir:e.outDir??i.outDir,reportDir:e.reportDir??i.reportDir,...e.tsconfig===void 0?{}:{tsconfig:e.tsconfig},prefixes:{module:e.prefixes?.module??i.prefixes.module,library:e.prefixes?.library??i.prefixes.library},modules:{include:[...e.modules?.include??i.modules.include]},libraries:{include:[...e.libraries?.include??i.libraries.include]}}}function c(n,r){if(r){let i=e.resolve(n,r);if(!t.existsSync(i))throw Error(`Configured Archicat tsconfig was not found: ${i}`);return i}return[`tsconfig.base.json`,`tsconfig.json`].map(t=>e.join(n,t)).find(e=>t.existsSync(e))}function l(e,t){if(typeof e!=`object`||!e)throw Error(`Invalid Archicat config: ${t}`);let n=e;u(n.root,`root`,t),u(n.outDir,`outDir`,t),u(n.reportDir,`reportDir`,t),u(n.tsconfig,`tsconfig`,t),d(n.modules?.include,`modules.include`,t),d(n.libraries?.include,`libraries.include`,t),f(n.prefixes?.module,`prefixes.module`,t),f(n.prefixes?.library,`prefixes.library`,t)}function u(e,t,n){if(e!==void 0&&(typeof e!=`string`||e.trim()===``))throw Error(`Archicat ${t} must be a non-empty string when defined: ${n}`)}function d(e,t,n){if(e!==void 0&&(!Array.isArray(e)||e.some(e=>typeof e!=`string`||e.trim()===``)))throw Error(`Archicat config ${t} must be an array of non-empty strings: ${n}`)}function f(e,t,n){if(e!==void 0&&(typeof e!=`string`||e.trim()===``||e.includes(`*`)||e.endsWith(`/`)))throw Error(`Archicat config ${t} must be a non-empty prefix without wildcard or trailing slash: ${n}`)}function p(e,t,n){let r=t.flatMap(t=>m(e,t,n));return Array.from(new Set(r)).sort((e,t)=>e.localeCompare(t))}function m(n,r,i){let a=e.resolve(n,r);if(r.includes(`*`))return ee(n,r).filter(t=>e.basename(t)===i);if(!t.existsSync(a))return[];let o=t.statSync(a);return o.isFile()?e.basename(a)===i?[a]:[]:o.isDirectory()?h(a,i):[]}function h(n,r){let i=[],a=t.readdirSync(n,{withFileTypes:!0});for(let t of a){if(ne(t.name))continue;let a=e.join(n,t.name);if(t.isDirectory()){i.push(...h(a,r));continue}t.isFile()&&t.name===r&&i.push(a)}return i}function ee(n,r){let i=e.resolve(n,r).split(e.sep);if(i.filter(e=>e.includes(`*`)).length!==1)throw Error(`Archicat supports exactly one wildcard segment per include pattern: ${r}`);let a=i.findIndex(e=>e.includes(`*`)),o=i.slice(0,a).join(e.sep)||e.sep,s=i[a]??`*`,c=i.slice(a+1),l=te(s);return t.existsSync(o)?t.readdirSync(o,{withFileTypes:!0}).filter(e=>e.isDirectory()).filter(e=>l.test(e.name)).map(t=>e.join(o,t.name,...c)).filter(e=>t.existsSync(e)&&t.statSync(e).isFile()):[]}function te(e){let t=e.replace(/[.+?^${}()|[\]\\]/gu,`\\$&`).replace(/\*/gu,`.*`);return RegExp(`^${t}$`,`u`)}function ne(e){return[`node_modules`,`.git`,`.archicat`,`archicat-report`,`dist`,`build`,`coverage`].includes(e)}async function g(e,t){switch(t){case`module`:return re(e);case`library`:return ie(e)}}async function re(t){let n=await _(t,e.dirname(t));return v(n,t,`module`),{kind:`module`,contractFilePath:t,definitionDir:e.dirname(t),contract:n}}async function ie(t){let n=await _(t,e.dirname(t));return v(n,t,`library`),{kind:`library`,contractFilePath:t,definitionDir:e.dirname(t),contract:n}}async function _(e,t){return await n(t,{interopDefault:!0,extensions:[`.js`,`.cjs`,`.mjs`,`.ts`,`.cts`,`.mts`,`.json`]}).import(e,{default:!0})}function v(e,t,n){if(typeof e!=`object`||!e)throw Error(`Invalid Archicat ${n} definition: ${t}`);let r=e;if(r.kind!==n)throw Error(`Archicat ${n} file must export define${ae(n)}(...): ${t}`);if(typeof r.id!=`string`||r.id.trim()===``)throw Error(`Archicat ${n} must define a non-empty id: ${t}`);if(y(r.api,`api`,t),n===`module`&&y(r.impl,`impl`,t),!Array.isArray(r.dependencies))throw Error(`Archicat ${n} dependencies must be an array: ${t}`)}function y(e,t,n){if(e!==void 0&&(typeof e!=`string`||e.trim()===``))throw Error(`Archicat ${t} must be a non-empty string when defined: ${n}`)}function ae(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function oe(e,t){let n=t.filter(e=>e.kind===`module`).map(t=>se(e,t)),r=t.filter(e=>e.kind===`library`).map(t=>ce(e,t)),i=[...n,...r];le(i);let a=x(i);return ue(i,a.targets),de(i),{rootDir:e.rootDir,outDir:e.outDir,reportDir:e.reportDir,...e.tsconfigPath?{tsconfigPath:e.tsconfigPath}:{},configFilePath:e.configFilePath,config:e.resolvedConfig,modules:n,libraries:r,definitions:i,graph:a}}function se(t,n){let{contract:r,contractFilePath:i,definitionDir:a}=n;S(r.id,i,`module`);let o=r.api?b(a,r.api,`api`,r.id):void 0,s=r.impl?b(a,r.impl,`impl`,r.id):void 0,c=`${t.resolvedConfig.prefixes.module}/${r.id}`;return{kind:`module`,id:r.id,apiTarget:`module.${r.id}.api`,implTarget:`module.${r.id}.impl`,alias:c,aliasGlob:`${c}/*`,dependencies:[...r.dependencies],contractFilePath:i,definitionDir:a,apiRootPath:o,implRootPath:s,mirrorApiRootPath:e.join(t.outDir,`modules`,r.id,`api`),mirrorImplRootPath:e.join(t.outDir,`modules`,r.id,`impl`)}}function ce(t,n){let{contract:r,contractFilePath:i,definitionDir:a}=n;S(r.id,i,`library`);let o=r.api?b(a,r.api,`api`,r.id):void 0,s=`${t.resolvedConfig.prefixes.library}/${r.id}`;return{kind:`library`,id:r.id,apiTarget:`library.${r.id}.api`,alias:s,aliasGlob:`${s}/*`,dependencies:[...r.dependencies],contractFilePath:i,definitionDir:a,apiRootPath:o,mirrorApiRootPath:e.join(t.outDir,`libraries`,r.id,`api`)}}function b(n,r,i,a){let o=e.resolve(n,r);if(!t.existsSync(o))throw Error(`Definition "${a}" declares ${i} root that does not exist: ${o}`);if(!t.statSync(o).isDirectory())throw Error(`Definition "${a}" declares ${i} root that is not a directory: ${o}`);return o}function x(e){let t=e.flatMap(e=>e.kind===`module`?[{key:e.apiTarget,kind:e.kind,id:e.id,surface:`api`},{key:e.implTarget,kind:e.kind,id:e.id,surface:`impl`}]:[{key:e.apiTarget,kind:e.kind,id:e.id,surface:`api`}]),n=e.flatMap(e=>{let t=e.kind===`module`?e.implTarget:e.apiTarget;return e.dependencies.map(e=>({from:t,to:e,origin:`declared`}))});return{targets:t,dependencies:[...e.filter(e=>e.kind===`module`).map(e=>({from:e.implTarget,to:e.apiTarget,origin:`derived`})),...n]}}function S(e,t,n){if(!/^[a-z][a-z0-9-]*$/u.test(e))throw Error(`Invalid Archicat ${n} id "${e}" in ${t}. Use ^[a-z][a-z0-9-]*$`)}function le(e){let t=new Map;for(let n of e){let e=`${n.kind}.${n.id}`,r=t.get(e);if(r)throw Error(`Duplicate Archicat ${n.kind} id "${n.id}" in ${r} and ${n.contractFilePath}`);t.set(e,n.contractFilePath)}}function ue(e,t){let n=new Set(t.map(e=>e.key));for(let r of e)for(let e of r.dependencies){if(!n.has(e))throw Error(`${C(r)} declares unknown dependency "${e}".`);let i=t.find(t=>t.key===e);if(i&&i.kind===r.kind&&i.id===r.id)throw Error(`${C(r)} cannot depend on itself: ${e}`)}}function de(e){let t=new Map(e.filter(e=>e.kind===`module`).map(e=>[e.apiTarget,e])),n=new Set,r=new Set,i=(e,a)=>{if(!r.has(e.id)){if(n.has(e.id))throw Error(`Cyclic Archicat module dependency detected: ${[...a,e.id].join(` -> `)}`);n.add(e.id);for(let n of e.dependencies){let r=t.get(n);r&&i(r,[...a,e.id])}n.delete(e.id),r.add(e.id)}};for(let e of t.values())i(e,[])}function C(e){return`${e.kind} "${e.id}"`}async function w(e){let t=await a(e),n=p(t.rootDir,t.resolvedConfig.modules.include,`archicat.module.ts`),r=p(t.rootDir,t.resolvedConfig.libraries.include,`archicat.library.ts`);if(n.length===0)throw Error(`No Archicat module definitions matched modules.include.`);return oe(t,[...await Promise.all(n.map(e=>g(e,`module`))),...await Promise.all(r.map(e=>g(e,`library`)))])}function T(t){return t.split(e.sep).join(`/`)}function fe(t,n){let r=e.dirname(t),i=e.parse(n),a=e.join(i.dir,i.name),o=T(e.relative(r,a));return o.startsWith(`.`)||(o=`./${o}`),`${o}.js`}function pe(t,n){let r=e.relative(n,t);return r===``||!!r&&!r.startsWith(`..`)&&!e.isAbsolute(r)}function E(e){return e.replace(/\.(?:js|mjs|cjs|ts|mts|cts|tsx)$/u,``)}function D(t,n){return T(e.relative(t,n))}function O(e){return t.existsSync(e)?t.statSync(e).isFile()?k(e)?[e]:[]:A(e).filter(k).sort((e,t)=>e.localeCompare(t)):[]}function k(e){return/\.(?:ts|mts|cts|tsx)$/u.test(e)&&!/\.d\.(?:ts|mts|cts)$/u.test(e)}function A(n){let r=[],i=t.readdirSync(n,{withFileTypes:!0});for(let t of i){let i=e.join(n,t.name);if(t.isDirectory()){r.push(...A(i));continue}t.isFile()&&r.push(i)}return r}function me(e){let n=r.createSourceFile(e,t.readFileSync(e,`utf8`),r.ScriptTarget.Latest,!0),i=[],a=e=>{if(r.isImportDeclaration(e)&&r.isStringLiteral(e.moduleSpecifier)&&i.push({moduleSpecifier:e.moduleSpecifier.text,kind:`import`}),r.isExportDeclaration(e)&&e.moduleSpecifier&&r.isStringLiteral(e.moduleSpecifier)&&i.push({moduleSpecifier:e.moduleSpecifier.text,kind:`export`}),r.isCallExpression(e)&&e.expression.kind===r.SyntaxKind.ImportKeyword){let[t]=e.arguments;t&&r.isStringLiteral(t)&&i.push({moduleSpecifier:t.text,kind:`dynamic-import`})}r.forEachChild(e,a)};return a(n),i}function j(e){let n=r.createSourceFile(e,t.readFileSync(e,`utf8`),r.ScriptTarget.Latest,!0),i=!1,a=e=>{if(!i){if(r.isExportAssignment(e)&&!e.isExportEquals){i=!0;return}if(M(e)){i=!0;return}if(r.isExportDeclaration(e)&&e.exportClause&&r.isNamedExports(e.exportClause))for(let t of e.exportClause.elements){let e=t.name.text,n=t.propertyName?.text;if(e==="default"||n==="default"){i=!0;return}}r.forEachChild(e,a)}};return a(n),i}function M(e){let t=r.canHaveModifiers(e)?r.getModifiers(e):void 0;if(!t)return!1;let n=t.some(e=>e.kind===r.SyntaxKind.ExportKeyword),i=t.some(e=>e.kind===r.SyntaxKind.DefaultKeyword);return n&&i}async function N(e){return P(await w(e))}function P(e){let t=[],n=e.definitions.flatMap(e=>F(e));for(let r of n){let n=z(e.definitions,r);if(n)for(let i of me(r)){let a=I(e,n,r,i.moduleSpecifier);a&&t.push(a)}}return t}function F(e){return e.kind===`module`?[...e.apiRootPath?O(e.apiRootPath):[],...e.implRootPath?O(e.implRootPath):[]]:e.apiRootPath?O(e.apiRootPath):[]}function I(e,t,n,r){let i=ge(e,r);if(i)return i.kind===t.kind&&i.id===t.id||t.dependencies.includes(i.target)?void 0:B(e,n,r,`${V(t.kind)} "${t.id}" imports "${i.target}" but does not declare it in dependencies.`);if(r.startsWith(`.`)||r.startsWith(`/`))return L(e,t,n,r)}function L(e,t,n,r){let i=R(n,r),a=z(e.definitions,i);if(!(!a||a.kind===t.kind&&a.id===t.id))return B(e,n,r,`${V(t.kind)} "${t.id}" imports ${a.kind} "${a.id}" through a source path. Use "${a.alias}" instead.`)}function R(t,n){return E(n.startsWith(`/`)?n:e.resolve(e.dirname(t),n))}function z(e,t){let n=E(t);return e.find(e=>he(e).filter(e=>!!e).some(e=>pe(n,E(e))))}function he(e){return e.kind===`module`?[e.apiRootPath,e.implRootPath,e.definitionDir]:[e.apiRootPath,e.definitionDir]}function ge(e,t){for(let n of e.definitions)if(t===n.alias||t.startsWith(`${n.alias}/`))return{kind:n.kind,id:n.id,target:n.apiTarget}}function B(e,t,n,r){return{filePath:D(e.rootDir,t),importPath:n,message:r}}function V(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function H(e){return{exitCode:0,lines:e.map(e=>({kind:`success`,message:e}))}}function _e(e){return{exitCode:1,lines:e.map(e=>({kind:`error`,message:e}))}}async function ve(e){let t=await N(e.config);return t.length===0?H([`Architecture check passed.`]):_e(t.map(e=>`${e.filePath}\n import: ${e.importPath}\n ${e.message}`))}async function ye(e){let t=await w(e);return[...be(t),...xe(t),...Se(t)]}function be(n){let r=e.join(n.outDir,`tsconfig.json`);return t.existsSync(r)?[]:[{severity:`warning`,message:`Generated tsconfig does not exist yet: ${r}. Run archicat generate.`}]}function xe(n){let r=e.join(n.rootDir,`tsconfig.json`);if(!t.existsSync(r))return[{severity:`warning`,message:`Root tsconfig.json was not found: ${r}`}];try{let e=JSON.parse(t.readFileSync(r,`utf8`)),n=[];return e.extends!==`./.archicat/tsconfig.json`&&e.extends!==`.archicat/tsconfig.json`&&n.push({severity:`warning`,message:`Root tsconfig.json should extend ./.archicat/tsconfig.json for Archicat aliases to work like Nuxt.`}),(e.compilerOptions?.rootDir===`src`||e.compilerOptions?.rootDir===`./src`)&&n.push({severity:`warning`,message:`compilerOptions.rootDir is set to src. Generated .archicat files live outside src and may break tsc.`}),n}catch(e){return[{severity:`warning`,message:`Failed to parse root tsconfig.json: ${e}`}]}}function Se(n){let r=[];for(let i of n.modules){let n=e.join(i.definitionDir,`api`),a=e.join(i.definitionDir,`impl`);!i.apiRootPath&&t.existsSync(n)&&r.push({severity:`warning`,message:`Module "${i.id}" has a physical api directory but its contract omits api. Archicat treats the public API as empty.`}),!i.implRootPath&&t.existsSync(a)&&r.push({severity:`warning`,message:`Module "${i.id}" has a physical impl directory but its contract omits impl. Archicat treats the implementation as no-op.`})}return r}async function Ce(e){let t=await ye(e.config);return t.length===0?H([`Doctor found no issues.`]):{exitCode:+!!t.some(e=>e.severity===`error`),lines:t.map(e=>({kind:e.severity===`error`?`error`:`warning`,message:e.message}))}}function U(e){t.existsSync(e)&&t.rmSync(e,{recursive:!0,force:!0}),t.mkdirSync(e,{recursive:!0})}function W(n,r){t.mkdirSync(e.dirname(n),{recursive:!0}),t.writeFileSync(n,r,`utf8`)}function G(e,t){W(e,`${JSON.stringify(t,null,2)}\n`)}function we(t){let n=`declare module 'archicat' {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import e from"node:path";import t from"node:fs";import{createJiti as n}from"jiti";import r from"typescript";const i=Object.freeze({root:`.`,outDir:`.archicat`,alias:Object.freeze({}),prefixes:Object.freeze({module:`@module`,library:`@library`}),modules:Object.freeze({include:Object.freeze([`./src/modules`])}),libraries:Object.freeze({include:Object.freeze([])}),apps:Object.freeze({include:Object.freeze([])})});async function a(n=`archicat.config.ts`){let r=process.cwd(),i=e.resolve(r,n);if(!t.existsSync(i))throw Error(`Archicat config was not found: ${i}`);let a=await o(i,r);l(a,i);let u=s(a),d=e.resolve(r,u.root),f=e.resolve(d,u.outDir),p=e.resolve(f,`reports`),m=c(d,u.tsconfig);return{configFilePath:i,rootDir:d,outDir:f,reportsDir:p,...m?{tsconfigPath:m}:{},config:a,resolvedConfig:u}}async function o(e,t){return await n(t,{interopDefault:!0,extensions:[`.js`,`.cjs`,`.mjs`,`.ts`,`.cts`,`.mts`,`.json`]}).import(e,{default:!0})}function s(e){return{root:e.root??i.root,outDir:e.outDir??i.outDir,alias:{...i.alias,...e.alias??{}},...e.tsconfig===void 0?{}:{tsconfig:e.tsconfig},prefixes:{module:e.prefixes?.module??i.prefixes.module,library:e.prefixes?.library??i.prefixes.library},modules:{include:[...e.modules?.include??i.modules.include]},libraries:{include:[...e.libraries?.include??i.libraries.include]},apps:{include:[...e.apps?.include??i.apps.include]}}}function c(n,r){if(r){let i=e.resolve(n,r);if(!t.existsSync(i))throw Error(`Configured Archicat tsconfig was not found: ${i}`);return i}return[`tsconfig.base.json`,`tsconfig.json`].map(t=>e.join(n,t)).find(e=>t.existsSync(e))}function l(e,t){if(typeof e!=`object`||!e)throw Error(`Invalid Archicat config: ${t}`);let n=e;u(n.root,`root`,t),u(n.outDir,`outDir`,t),u(n.tsconfig,`tsconfig`,t),d(n.modules?.include,`modules.include`,t),d(n.libraries?.include,`libraries.include`,t),d(n.apps?.include,`apps.include`,t),p(n.alias,`alias`,t),f(n.prefixes?.module,`prefixes.module`,t),f(n.prefixes?.library,`prefixes.library`,t)}function u(e,t,n){if(e!==void 0&&(typeof e!=`string`||e.trim()===``))throw Error(`Archicat ${t} must be a non-empty string when defined: ${n}`)}function d(e,t,n){if(e!==void 0&&(!Array.isArray(e)||e.some(e=>typeof e!=`string`||e.trim()===``)))throw Error(`Archicat config ${t} must be an array of non-empty strings: ${n}`)}function f(e,t,n){if(e!==void 0&&(typeof e!=`string`||e.trim()===``||e.includes(`*`)||e.endsWith(`/`)))throw Error(`Archicat config ${t} must be a non-empty prefix without wildcard or trailing slash: ${n}`)}function p(e,t,n){if(e!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Archicat config ${t} must be an object of non-empty string aliases: ${n}`);for(let[r,i]of Object.entries(e))if(r.trim()===``||typeof i!=`string`||i.trim()===``)throw Error(`Archicat config ${t} must contain non-empty string aliases: ${n}`)}}function m(e,t,n){let r=t.flatMap(t=>ee(e,t,n));return Array.from(new Set(r)).sort((e,t)=>e.localeCompare(t))}function ee(n,r,i){let a=e.resolve(n,r);if(r.includes(`*`))return te(n,r).filter(t=>e.basename(t)===i);if(!t.existsSync(a))return[];let o=t.statSync(a);return o.isFile()?e.basename(a)===i?[a]:[]:o.isDirectory()?h(a,i):[]}function h(n,r){let i=[],a=t.readdirSync(n,{withFileTypes:!0});for(let t of a){if(re(t.name))continue;let a=e.join(n,t.name);if(t.isDirectory()){i.push(...h(a,r));continue}t.isFile()&&t.name===r&&i.push(a)}return i}function te(n,r){let i=e.resolve(n,r).split(e.sep);if(i.filter(e=>e.includes(`*`)).length!==1)throw Error(`Archicat supports exactly one wildcard segment per include pattern: ${r}`);let a=i.findIndex(e=>e.includes(`*`)),o=i.slice(0,a).join(e.sep)||e.sep,s=i[a]??`*`,c=i.slice(a+1),l=ne(s);return t.existsSync(o)?t.readdirSync(o,{withFileTypes:!0}).filter(e=>e.isDirectory()).filter(e=>l.test(e.name)).map(t=>e.join(o,t.name,...c)).filter(e=>t.existsSync(e)&&t.statSync(e).isFile()):[]}function ne(e){let t=e.replace(/[.+?^${}()|[\]\\]/gu,`\\$&`).replace(/\*/gu,`.*`);return RegExp(`^${t}$`,`u`)}function re(e){return[`node_modules`,`.git`,`.archicat`,`archicat-report`,`dist`,`build`,`coverage`].includes(e)}async function g(e,t){switch(t){case`module`:return ie(e);case`library`:return ae(e);case`app`:return oe(e)}}async function ie(t){let n=await _(t,e.dirname(t));return v(n,t,`module`),{kind:`module`,contractFilePath:t,definitionDir:e.dirname(t),contract:n}}async function ae(t){let n=await _(t,e.dirname(t));return v(n,t,`library`),{kind:`library`,contractFilePath:t,definitionDir:e.dirname(t),contract:n}}async function oe(t){let n=await _(t,e.dirname(t));return v(n,t,`app`),{kind:`app`,contractFilePath:t,definitionDir:e.dirname(t),contract:n}}async function _(e,t){return await n(t,{interopDefault:!0,extensions:[`.js`,`.cjs`,`.mjs`,`.ts`,`.cts`,`.mts`,`.json`]}).import(e,{default:!0})}function v(e,t,n){if(typeof e!=`object`||!e)throw Error(`Invalid Archicat ${n} definition: ${t}`);let r=e;if(r.kind!==n)throw Error(`Archicat ${n} file must export define${se(n)}(...): ${t}`);if(typeof r.name!=`string`||r.name.trim()===``)throw Error(`Archicat ${n} must define a non-empty name: ${t}`);if(n===`app`){x(r.root,`root`,t),b(r.dependencies,t,n);return}let i=r;y(i.api,`api`,t,n),y(i.impl,`impl`,t,n)}function y(e,t,n,r){if(typeof e!=`object`||!e)throw Error(`Archicat ${r}.${t} must be a surface object: ${n}`);x(e.root,`${t}.root`,n),b(e.dependencies,n,`${r}.${t}`)}function b(e,t,n){if(!Array.isArray(e)||e.some(e=>typeof e!=`string`||e.trim()===``))throw Error(`Archicat ${n} dependencies must be an array of non-empty strings: ${t}`)}function x(e,t,n){if(e!==void 0&&(typeof e!=`string`||e.trim()===``))throw Error(`Archicat ${t} must be a non-empty string when defined: ${n}`)}function se(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function ce(e){let t=new Map;for(let n of e){let e=t.get(n.from)??[];e.push(n.to),t.set(n.from,e)}let n=new Set,r=new Set;for(let e of t.keys())S(e,t,n,r,[])}function S(e,t,n,r,i){if(!r.has(e)){if(n.has(e)){let t=i.indexOf(e),n=[...i.slice(t<0?0:t),e];throw Error(`Cyclic Archicat dependency detected: ${n.join(` -> `)}`)}n.add(e);for(let a of t.get(e)??[])S(a,t,n,r,[...i,e]);n.delete(e),r.add(e)}}function le(e){let t=/^(module|library)\.([a-z][a-z0-9-]*)\.(api|impl)$/u.exec(e);if(t)return{kind:t[1],name:t[2],surface:t[3]}}function ue(e){return`${e.kind}.${e.surface}`}function C(e,t,n){let r=le(t);if(!r)throw Error(`${w(e)} declares invalid dependency target "${t}".`);if(!n.has(t))throw Error(`${w(e)} declares unknown dependency "${t}".`);if(e.kind===r.kind&&e.name===r.name)throw Error(`${w(e)} cannot depend on itself: ${t}`);if(!de(e,r))throw Error(`${w(e)} cannot depend on ${ue(r)} target "${t}".`)}function de(e,t){switch(e.surface){case`api`:return e.kind===`module`?t.surface===`api`&&(t.kind===`module`||t.kind===`library`):e.kind===`library`?t.surface===`api`&&t.kind===`library`:!1;case`impl`:return e.kind===`module`?t.surface===`api`&&(t.kind===`module`||t.kind===`library`):e.kind===`library`?t.surface===`api`&&t.kind===`library`:!1;case`app`:return t.kind===`module`||t.kind===`library`}}function w(e){return e.kind===`app`?`App "${e.name}"`:`${fe(e.kind)} "${e.name}" ${e.surface}`}function fe(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function pe(e,t){let n=t.filter(e=>e.kind===`module`).map(t=>me(e,t)),r=t.filter(e=>e.kind===`library`).map(t=>he(e,t)),i=t.filter(e=>e.kind===`app`).map(e=>ge(e)),a=[...n,...r];ve([...a,...i]);let o=_e(a,i);return ye(a,i,o.targets),ce(o.dependencies),{rootDir:e.rootDir,outDir:e.outDir,reportsDir:e.reportsDir,...e.tsconfigPath?{tsconfigPath:e.tsconfigPath}:{},configFilePath:e.configFilePath,config:e.resolvedConfig,modules:n,libraries:r,apps:i,definitions:a,graph:o}}function me(t,n){let{contract:r,contractFilePath:i,definitionDir:a}=n;D(r.name,i,`module`);let o=r.api.root?E(a,r.api.root,`api`,r.name):void 0,s=r.impl.root?E(a,r.impl.root,`impl`,r.name):void 0,c=`${t.resolvedConfig.prefixes.module}/${r.name}`;return{kind:`module`,name:r.name,apiTarget:`module.${r.name}.api`,implTarget:`module.${r.name}.impl`,alias:c,aliasGlob:`${c}/*`,implAlias:`${c}/impl`,implAliasGlob:`${c}/impl/*`,contractFilePath:i,definitionDir:a,api:T(o,r.api.dependencies,e.join(t.outDir,`modules`,r.name,`api`)),impl:T(s,r.impl.dependencies,e.join(t.outDir,`modules`,r.name,`impl`))}}function he(t,n){let{contract:r,contractFilePath:i,definitionDir:a}=n;D(r.name,i,`library`);let o=r.api.root?E(a,r.api.root,`api`,r.name):void 0,s=r.impl.root?E(a,r.impl.root,`impl`,r.name):void 0,c=`${t.resolvedConfig.prefixes.library}/${r.name}`;return{kind:`library`,name:r.name,apiTarget:`library.${r.name}.api`,implTarget:`library.${r.name}.impl`,alias:c,aliasGlob:`${c}/*`,implAlias:`${c}/impl`,implAliasGlob:`${c}/impl/*`,contractFilePath:i,definitionDir:a,api:T(o,r.api.dependencies,e.join(t.outDir,`libraries`,r.name,`api`)),impl:T(s,r.impl.dependencies,e.join(t.outDir,`libraries`,r.name,`impl`))}}function ge(e){let{contract:t,contractFilePath:n,definitionDir:r}=e;return D(t.name,n,`app`),{kind:`app`,name:t.name,target:`app.${t.name}`,contractFilePath:n,definitionDir:r,rootPath:t.root?E(r,t.root,`app`,t.name):r,dependencies:[...t.dependencies]}}function T(e,t,n){return{...e?{rootPath:e}:{},mirrorRootPath:n,dependencies:[...t]}}function E(n,r,i,a){let o=e.resolve(n,r);if(!t.existsSync(o))throw Error(`Definition "${a}" declares ${i} root that does not exist: ${o}`);if(!t.statSync(o).isDirectory())throw Error(`Definition "${a}" declares ${i} root that is not a directory: ${o}`);return o}function _e(e,t){let n=e.flatMap(e=>[{key:e.apiTarget,kind:e.kind,name:e.name,surface:`api`},{key:e.implTarget,kind:e.kind,name:e.name,surface:`impl`}]),r=[...e.flatMap(e=>[...e.api.dependencies.map(t=>({from:e.apiTarget,to:t,origin:`declared`})),...e.impl.dependencies.map(t=>({from:e.implTarget,to:t,origin:`declared`}))]),...t.flatMap(e=>e.dependencies.map(t=>({from:e.target,to:t,origin:`declared`})))];return{targets:n,dependencies:[...e.map(e=>({from:e.implTarget,to:e.apiTarget,origin:`derived`})),...r]}}function D(e,t,n){if(!/^[a-z][a-z0-9-]*$/u.test(e))throw Error(`Invalid Archicat ${n} name "${e}" in ${t}. Use ^[a-z][a-z0-9-]*$`)}function ve(e){let t=new Map;for(let n of e){let e=`${n.kind}.${n.name}`,r=t.get(e);if(r)throw Error(`Duplicate Archicat ${n.kind} name "${n.name}" in ${r} and ${n.contractFilePath}`);t.set(e,n.contractFilePath)}}function ye(e,t,n){let r=new Set(n.map(e=>e.key));for(let t of e){for(let e of t.api.dependencies)C(O(t,`api`),e,r);for(let e of t.impl.dependencies)C(O(t,`impl`),e,r)}for(let e of t)for(let t of e.dependencies)C({kind:`app`,name:e.name,surface:`app`,target:e.target},t,r)}function O(e,t){return{kind:e.kind,name:e.name,surface:t,target:t===`api`?e.apiTarget:e.implTarget}}async function k(e){let t=await a(e),n=m(t.rootDir,t.resolvedConfig.modules.include,`archicat.module.ts`),r=m(t.rootDir,t.resolvedConfig.libraries.include,`archicat.library.ts`),i=m(t.rootDir,t.resolvedConfig.apps.include,`archicat.app.ts`);if(n.length===0&&r.length===0&&i.length===0)throw Error(`No Archicat definition files matched configured include roots.`);return pe(t,[...await Promise.all(n.map(e=>g(e,`module`))),...await Promise.all(r.map(e=>g(e,`library`))),...await Promise.all(i.map(e=>g(e,`app`)))])}function A(t){return t.split(e.sep).join(`/`)}function be(t,n){let r=e.dirname(t),i=e.parse(n),a=e.join(i.dir,i.name),o=A(e.relative(r,a));return o.startsWith(`.`)||(o=`./${o}`),`${o}.js`}function j(t,n){let r=e.relative(n,t);return r===``||!!r&&!r.startsWith(`..`)&&!e.isAbsolute(r)}function M(e){return e.replace(/\.(?:js|mjs|cjs|ts|mts|cts|tsx)$/u,``)}function N(t,n){return A(e.relative(t,n))}function P(e){return t.existsSync(e)?t.statSync(e).isFile()?F(e)?[e]:[]:I(e).filter(F).sort((e,t)=>e.localeCompare(t)):[]}function F(e){return/\.(?:ts|mts|cts|tsx)$/u.test(e)&&!/\.d\.(?:ts|mts|cts)$/u.test(e)}function I(n){let r=[],i=t.readdirSync(n,{withFileTypes:!0});for(let t of i){let i=e.join(n,t.name);if(t.isDirectory()){r.push(...I(i));continue}t.isFile()&&r.push(i)}return r}function xe(e){let n=r.createSourceFile(e,t.readFileSync(e,`utf8`),r.ScriptTarget.Latest,!0),i=[],a=e=>{if(r.isImportDeclaration(e)&&r.isStringLiteral(e.moduleSpecifier)&&i.push({moduleSpecifier:e.moduleSpecifier.text,kind:`import`}),r.isExportDeclaration(e)&&e.moduleSpecifier&&r.isStringLiteral(e.moduleSpecifier)&&i.push({moduleSpecifier:e.moduleSpecifier.text,kind:`export`}),r.isCallExpression(e)&&e.expression.kind===r.SyntaxKind.ImportKeyword){let[t]=e.arguments;t&&r.isStringLiteral(t)&&i.push({moduleSpecifier:t.text,kind:`dynamic-import`})}r.forEachChild(e,a)};return a(n),i}function Se(e){let n=r.createSourceFile(e,t.readFileSync(e,`utf8`),r.ScriptTarget.Latest,!0),i=!1,a=e=>{if(!i){if(r.isExportAssignment(e)&&!e.isExportEquals){i=!0;return}if(Ce(e)){i=!0;return}if(r.isExportDeclaration(e)&&e.exportClause&&r.isNamedExports(e.exportClause))for(let t of e.exportClause.elements){let e=t.name.text,n=t.propertyName?.text;if(e==="default"||n==="default"){i=!0;return}}r.forEachChild(e,a)}};return a(n),i}function Ce(e){let t=r.canHaveModifiers(e)?r.getModifiers(e):void 0;if(!t)return!1;let n=t.some(e=>e.kind===r.SyntaxKind.ExportKeyword),i=t.some(e=>e.kind===r.SyntaxKind.DefaultKeyword);return n&&i}async function we(e){return Te(await k(e))}function Te(e){let t=[],n=[...e.definitions.flatMap(e=>Ee(e)),...e.apps.flatMap(e=>P(e.rootPath))];for(let r of n){let n=L(e,r);if(n)for(let i of xe(r)){let a=De(e,n,r,i.moduleSpecifier);a&&t.push(a)}}return t}function Ee(e){return[...e.api.rootPath?P(e.api.rootPath):[],...e.impl.rootPath?P(e.impl.rootPath):[]]}function De(e,t,n,r){let i=je(e,r);if(i)return Me(t,i)?void 0:i.surface===`impl`&&t.kind!==`app`?R(e,n,r,`${z(t)} cannot import implementation target "${i.target}". Implementation imports are allowed only from app composition roots.`):Ne(e,t.target,i.target)?void 0:R(e,n,r,`${z(t)} imports "${i.target}" but does not declare a dependency that allows it.`);if(r.startsWith(`.`)||r.startsWith(`/`))return Oe(e,t,n,r)}function Oe(e,t,n,r){let i=L(e,ke(n,r));if(!(!i||Ae(t,i)))return R(e,n,r,`${z(t)} imports ${z(i)} through a source path. Use an Archicat alias instead.`)}function L(e,t){let n=M(t);for(let t of e.definitions){if(t.api.rootPath&&j(n,M(t.api.rootPath)))return{kind:t.kind,name:t.name,surface:`api`,target:t.apiTarget,definition:t};if(t.impl.rootPath&&j(n,M(t.impl.rootPath)))return{kind:t.kind,name:t.name,surface:`impl`,target:t.implTarget,definition:t}}for(let t of e.apps)if(j(n,M(t.rootPath)))return{kind:`app`,name:t.name,surface:`app`,target:t.target,app:t}}function ke(t,n){return M(n.startsWith(`/`)?n:e.resolve(e.dirname(t),n))}function Ae(e,t){return e.kind===t.kind&&e.name===t.name}function je(e,t){for(let n of e.definitions){if(n.implAlias&&(t===n.implAlias||t.startsWith(`${n.implAlias}/`)))return{kind:n.kind,name:n.name,surface:`impl`,target:n.implTarget};if(t===n.alias||t.startsWith(`${n.alias}/`))return{kind:n.kind,name:n.name,surface:`api`,target:n.apiTarget}}}function Me(e,t){return e.kind===t.kind&&e.name===t.name&&t.surface===`api`}function Ne(e,t,n){let r=new Set,i=[t];for(;i.length>0;){let t=i.shift();if(t===n)return!0;if(!r.has(t)){r.add(t);for(let n of e.graph.dependencies.filter(e=>e.from===t))i.push(n.to)}}return!1}function R(e,t,n,r){return{filePath:N(e.rootDir,t),importPath:n,message:r}}function z(e){return e.kind===`app`?`App "${e.name}"`:`${Pe(e.kind)} "${e.name}" ${e.surface}`}function Pe(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}function B(e){return{exitCode:0,lines:e.map(e=>({kind:`success`,message:e}))}}function Fe(e){return{exitCode:1,lines:e.map(e=>({kind:`error`,message:e}))}}async function Ie(e){let t=await we(e.config);return t.length===0?B([`Architecture check passed.`]):Fe(t.map(e=>`${e.filePath}\n import: ${e.importPath}\n ${e.message}`))}async function Le(e){let t=await k(e);return[...Re(t),...ze(t),...Be(t)]}function Re(n){let r=e.join(n.outDir,`tsconfig.json`);return t.existsSync(r)?[]:[{severity:`warning`,message:`Generated tsconfig does not exist yet: ${r}. Run archicat generate.`}]}function ze(n){let i=e.join(n.rootDir,`tsconfig.json`);if(!t.existsSync(i))return[{severity:`warning`,message:`Root tsconfig.json was not found: ${i}`}];let a=r.parseConfigFileTextToJson(i,t.readFileSync(i,`utf8`));if(a.error)return[{severity:`warning`,message:`Failed to parse root tsconfig.json: ${r.flattenDiagnosticMessageText(a.error.messageText,`
|
|
2
|
+
`)}`}];let o=a.config,s=[];return o.extends!==`./.archicat/tsconfig.json`&&o.extends!==`.archicat/tsconfig.json`&&s.push({severity:`warning`,message:`Root tsconfig.json should extend ./.archicat/tsconfig.json for Archicat aliases to work like Nuxt.`}),(o.compilerOptions?.rootDir===`src`||o.compilerOptions?.rootDir===`./src`)&&s.push({severity:`warning`,message:`compilerOptions.rootDir is set to src. Generated .archicat files live outside src and may break tsc.`}),o.compilerOptions?.paths!==void 0&&s.push({severity:`warning`,message:`compilerOptions.paths should move to archicat.config.ts alias. Root tsconfig paths can override generated Archicat aliases.`}),s}function Be(n){let r=[];for(let i of n.definitions){let n=e.join(i.definitionDir,`api`),a=e.join(i.definitionDir,`impl`);!i.api.rootPath&&t.existsSync(n)&&r.push({severity:`warning`,message:`${V(i.kind)} "${i.name}" has a physical api directory but its contract omits api.root. Archicat treats the public API as empty.`}),!i.impl.rootPath&&t.existsSync(a)&&r.push({severity:`warning`,message:`${V(i.kind)} "${i.name}" has a physical impl directory but its contract omits impl.root. Archicat treats the implementation as no-op.`})}return r}function V(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}async function Ve(e){let t=await Le(e.config);return t.length===0?B([`Doctor found no issues.`]):{exitCode:+!!t.some(e=>e.severity===`error`),lines:t.map(e=>({kind:e.severity===`error`?`error`:`warning`,message:e.message}))}}function He(e){t.existsSync(e)&&t.rmSync(e,{recursive:!0,force:!0}),t.mkdirSync(e,{recursive:!0})}function H(n,r){t.mkdirSync(e.dirname(n),{recursive:!0}),t.writeFileSync(n,r,`utf8`)}function U(e,t){H(e,`${JSON.stringify(t,null,2)}\n`)}function Ue(t){let n=[...t.modules.map(e=>e.apiTarget),...t.libraries.map(e=>e.apiTarget)],r=n,i=t.libraries.map(e=>e.apiTarget),a=i,o=t.graph.targets.map(e=>e.key),s=`import 'archicat';
|
|
3
|
+
|
|
4
|
+
declare module 'archicat' {
|
|
5
|
+
${W(`ArchicatModuleApiDependencies`,n)}
|
|
6
|
+
|
|
7
|
+
${W(`ArchicatModuleImplDependencies`,r)}
|
|
8
|
+
|
|
9
|
+
${W(`ArchicatLibraryApiDependencies`,i)}
|
|
10
|
+
|
|
11
|
+
${W(`ArchicatLibraryImplDependencies`,a)}
|
|
12
|
+
|
|
13
|
+
${W(`ArchicatAppDependencies`,o)}
|
|
6
14
|
}
|
|
7
15
|
|
|
8
16
|
export {};
|
|
9
|
-
`;
|
|
10
|
-
`)
|
|
11
|
-
`)}
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
`;H(e.join(t.outDir,`types`,`graph.d.ts`),s)}function W(e,t){return` interface ${e} {\n${Array.from(new Set(t)).sort((e,t)=>e.localeCompare(t)).map(e=>` '${e}': true;`).join(`
|
|
18
|
+
`)}\n }`}function We(e){for(let t of e)switch(t.kind){case`module`:Ge(t);break;case`library`:Ke(t);break}}function Ge(e){G(e.api),K(e,`module`)}function Ke(e){G(e.api),K(e,`library`)}function G(t){if(!t.rootPath){H(e.join(t.mirrorRootPath,`index.ts`),`${J()}export {};
|
|
19
|
+
`);return}let n=P(t.rootPath),r=new Set;for(let i of n){let n=A(e.relative(t.rootPath,i));r.add(n),q(e.join(t.mirrorRootPath,n),i)}r.has(`index.ts`)||H(e.join(t.mirrorRootPath,`index.ts`),`${J()}export {};
|
|
20
|
+
`)}function K(t,n){let r=t.impl.rootPath?qe(t.impl.rootPath):void 0;if(!r){let r=n===`module`?`ArchicatModuleImplementation`:`ArchicatLibraryImplementation`,i=`${J()}
|
|
21
|
+
export const ${r} = {
|
|
22
|
+
name: '${t.name}',
|
|
14
23
|
assemblies: [],
|
|
15
24
|
schemas: [],
|
|
16
25
|
routes: [],
|
|
17
26
|
} as const;
|
|
18
27
|
|
|
19
|
-
export default
|
|
20
|
-
`;
|
|
28
|
+
export default ${r};
|
|
29
|
+
`;H(e.join(t.impl.mirrorRootPath,`index.ts`),i);return}q(e.join(t.impl.mirrorRootPath,`index.ts`),r)}function q(e,t){let n=be(e,t),r=Se(t)?`export { default } from '${n}';\n`:``;H(e,`${J()}
|
|
21
30
|
export * from '${n}';
|
|
22
|
-
${r}`)}function
|
|
23
|
-
`}function
|
|
24
|
-
`))}function $(e){
|
|
31
|
+
${r}`)}function qe(t){for(let n of[`index.ts`,`index.mts`,`index.cts`,`index.tsx`]){let r=e.join(t,n);if(P(r).length>0)return r}}function J(){return`// Mirrored by Archicat.
|
|
32
|
+
`}function Je(t){U(e.join(t.reportsDir,`build.report.json`),Ye(t)),U(e.join(t.reportsDir,`graph.report.json`),Xe(t))}function Ye(e){return{generatedBy:`archicat`,schemaVersion:1,prefixes:e.config.prefixes,outputs:{outDir:N(e.rootDir,e.outDir),reportsDir:N(e.rootDir,e.reportsDir)},targets:e.graph.targets.map(e=>e.key),definitions:[...e.definitions.map(t=>Ze(e,t)),...e.apps.map(t=>({kind:t.kind,name:t.name,targets:{app:t.target},aliases:{},dependencies:t.dependencies,contractFilePath:N(e.rootDir,t.contractFilePath),source:{root:N(e.rootDir,t.rootPath)},mirror:{}}))],dependencies:e.graph.dependencies}}function Xe(e){return{generatedBy:`archicat`,schemaVersion:1,targets:e.graph.targets.map(e=>e.key),dependencies:e.graph.dependencies}}function Ze(e,t){return{kind:t.kind,name:t.name,targets:{api:t.apiTarget,impl:t.implTarget},aliases:{api:t.alias,impl:e.apps.length>0?t.implAlias:void 0},dependencies:{api:t.api.dependencies,impl:t.impl.dependencies},contractFilePath:N(e.rootDir,t.contractFilePath),source:{root:N(e.rootDir,t.definitionDir),api:t.api.rootPath?N(e.rootDir,t.api.rootPath):void 0,impl:t.impl.rootPath?N(e.rootDir,t.impl.rootPath):void 0},mirror:{api:N(e.rootDir,t.api.mirrorRootPath),impl:N(e.rootDir,t.impl.mirrorRootPath)}}}function Qe(t){let n=nt(t.tsconfigPath?tt(t.tsconfigPath):{}),r=rt(n,t.tsconfigPath);if(Object.keys(r).length>0)throw Error(`Root tsconfig compilerOptions.paths is not supported by Archicat. Move aliases into archicat.config.ts alias.`);let i=et(t),a=$e(t);X(t,i,a);let o={compilerOptions:{...it(t,ot(n,[`baseUrl`,`paths`])),paths:{...i,...a}},include:[`../src/**/*.ts`,`./**/*.ts`,`./types/**/*.d.ts`],exclude:[`../node_modules`,`../dist`]};U(e.join(t.outDir,`tsconfig.json`),o)}function $e(t){let n={},r=t.apps.length>0;for(let i of t.definitions)n[i.alias]=[Y(t.outDir,e.join(i.api.mirrorRootPath,`index.ts`))],n[i.aliasGlob]=[Y(t.outDir,e.join(i.api.mirrorRootPath,`*`))],r&&i.implAlias&&i.implAliasGlob&&(n[i.implAlias]=[Y(t.outDir,e.join(i.impl.mirrorRootPath,`index.ts`))],n[i.implAliasGlob]=[Y(t.outDir,e.join(i.impl.mirrorRootPath,`*`))]);return n}function et(t){let n={};for(let[r,i]of Object.entries(t.config.alias)){let a=e.isAbsolute(i)?i:e.resolve(t.rootDir,i);n[r]=[Y(t.outDir,a)]}return n}function tt(e){let n=t.readFileSync(e,`utf8`),i=r.parseConfigFileTextToJson(e,n);if(i.error)throw Error(at(i.error));if(i.config==null||typeof i.config!=`object`||Array.isArray(i.config))throw Error(`Invalid tsconfig object: ${e}`);return i.config}function nt(e){let t=e.compilerOptions;return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}function rt(e,t){let n=e.paths;if(!n||typeof n!=`object`||Array.isArray(n))return{};let r={};for(let[e,i]of Object.entries(n)){if(!Array.isArray(i)||!i.every(e=>typeof e==`string`))throw Error(`Tsconfig paths.${e} must be an array of strings${t?`: ${t}`:``}.`);r[e]=[...i]}return r}function it(t,n){if(!t.tsconfigPath)return n;let r=e.dirname(t.tsconfigPath),i={...n};for(let n of[`rootDir`,`outDir`,`declarationDir`]){let a=i[n];if(typeof a==`string`){let o=e.isAbsolute(a)?a:e.resolve(r,a);i[n]=Y(t.outDir,o)}}return i}function Y(t,n){let r=A(e.relative(t,n));return r.startsWith(`.`)||(r=`./${r}`),r}function X(e,t,n){let r=Object.keys(t),i=Object.keys(n),a=Object.values(e.config.prefixes);for(let e of r){if(i.includes(e))throw Error(`Alias conflict: archicat.config.ts alias already defines "${e}", but Archicat needs it.`);for(let t of a)if(e===t||e===`${t}/*`||e.startsWith(`${t}/`))throw Error(`Alias conflict: archicat.config.ts alias "${e}" is inside Archicat reserved prefix "${t}". Remove the alias or configure another Archicat prefix.`)}}function at(e){let t=r.flattenDiagnosticMessageText(e.messageText,`
|
|
33
|
+
`);if(e.file&&e.start!==void 0){let n=e.file.getLineAndCharacterOfPosition(e.start);return`${e.file.fileName}:${n.line+1}:${n.character+1} - ${t}`}return t}function ot(e,t){let n={...e};for(let e of t)delete n[e];return n}async function st(n){let r=await k(n);if(e.resolve(r.outDir)===e.resolve(r.rootDir))throw Error(`Archicat outDir cannot be the project root.`);return He(r.outDir),t.mkdirSync(e.join(r.outDir,`modules`),{recursive:!0}),t.mkdirSync(e.join(r.outDir,`libraries`),{recursive:!0}),t.mkdirSync(e.join(r.outDir,`types`),{recursive:!0}),t.mkdirSync(r.reportsDir,{recursive:!0}),We(r.definitions),Ue(r),Qe(r),Je(r),r}async function ct(e){let t=await st(e.config);return B([`Mirrored modules: ${t.modules.length}`,`Mirrored libraries: ${t.libraries.length}`,`Resolved apps: ${t.apps.length}`])}function lt(e){let t=[`Modules: ${e.modules.length}`,``];for(let n of e.modules)t.push(n.name),t.push(` api: ${n.apiTarget}`),Z(t,e.graph.dependencies.filter(e=>e.from===n.apiTarget),` api dependsOn`),t.push(` impl: ${n.implTarget}`),Z(t,e.graph.dependencies.filter(e=>e.from===n.implTarget),` impl dependsOn`),t.push(``);t.push(`Libraries: ${e.libraries.length}`),e.libraries.length>0&&t.push(``);for(let n of e.libraries)t.push(n.name),t.push(` api: ${n.apiTarget}`),Z(t,e.graph.dependencies.filter(e=>e.from===n.apiTarget),` api dependsOn`),t.push(` impl: ${n.implTarget}`),Z(t,e.graph.dependencies.filter(e=>e.from===n.implTarget),` impl dependsOn`),t.push(``);t.push(`Apps: ${e.apps.length}`),e.apps.length>0&&t.push(``);for(let n of e.apps)t.push(n.name),t.push(` app: ${n.target}`),Z(t,e.graph.dependencies.filter(e=>e.from===n.target),` dependsOn`),t.push(``);return ut(t)}function Z(e,t,n){if(t.length===0){e.push(`${n}: none`);return}e.push(`${n}:`);for(let n of t){let t=n.origin===`derived`?` (derived)`:``;e.push(` ${n.to}${t}`)}}function ut(e){let t=[...e];for(;t.at(-1)===``;)t.pop();return t}async function dt(e){return{exitCode:0,lines:lt(await k(e.config)).map(e=>({kind:`info`,message:e}))}}async function ft(e=process.argv.slice(2)){let[t,...n]=e;try{let e=await pt(t,mt(n));if(!e)return;ht(e),process.exitCode=e.exitCode}catch(e){$({kind:`error`,message:e instanceof Error?e.message:String(e)}),process.exitCode=1}}async function pt(e,t){switch(e){case`generate`:return ct(t);case`check`:return Ie(t);case`graph`:return dt(t);case`doctor`:return Ve(t);case`help`:case`--help`:case`-h`:case void 0:Q();return;default:return $({kind:`error`,message:`Unknown command: ${e}`}),Q(),{exitCode:1,lines:[]}}}function mt(e){let t={};for(let n=0;n<e.length;n+=1){let r=e[n];if(r===`--config`||r===`-c`){let i=e[n+1];if(!i)throw Error(`${r} requires a value.`);t.config=i,n+=1}}return t}function ht(e){for(let t of e.lines)$(t)}function Q(){console.log([`Archicat`,``,`Usage:`,` archicat generate [--config archicat.config.ts]`,` archicat check [--config archicat.config.ts]`,` archicat graph [--config archicat.config.ts]`,` archicat doctor [--config archicat.config.ts]`,``].join(`
|
|
34
|
+
`))}function $(e){switch(e.kind){case`success`:console.log(`✓ ${e.message}`);return;case`warning`:console.warn(`! ${e.message}`);return;case`error`:console.error(`✗ ${e.message}`);return;case`info`:console.log(e.message);return}}export{ft as runMain};
|
package/dist/src/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e={}){return Object.freeze({...e.root===void 0?{}:{root:e.root},...e.outDir===void 0?{}:{outDir:e.outDir},...e.
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e){return Object.freeze({kind:`app`,name:e.name,...e.root===void 0?{}:{root:e.root},dependencies:Object.freeze([...e.dependencies??[]])})}function t(e={}){return Object.freeze({...e.root===void 0?{}:{root:e.root},...e.outDir===void 0?{}:{outDir:e.outDir},...e.tsconfig===void 0?{}:{tsconfig:e.tsconfig},...e.alias===void 0?{}:{alias:Object.freeze({...e.alias})},...e.prefixes===void 0?{}:{prefixes:Object.freeze({...e.prefixes.module===void 0?{}:{module:e.prefixes.module},...e.prefixes.library===void 0?{}:{library:e.prefixes.library}})},...e.modules===void 0?{}:{modules:Object.freeze({...e.modules.include===void 0?{}:{include:Object.freeze([...e.modules.include])}})},...e.libraries===void 0?{}:{libraries:Object.freeze({...e.libraries.include===void 0?{}:{include:Object.freeze([...e.libraries.include])}})},...e.apps===void 0?{}:{apps:Object.freeze({...e.apps.include===void 0?{}:{include:Object.freeze([...e.apps.include])}})}})}function n(e){return Object.freeze({kind:`library`,name:e.name,api:r(e.api),impl:r(e.impl)})}function r(e){return Object.freeze(typeof e==`string`?{root:e,dependencies:Object.freeze([])}:{...e?.root===void 0?{}:{root:e.root},dependencies:Object.freeze([...e?.dependencies??[]])})}function i(e){return Object.freeze({kind:`module`,name:e.name,api:a(e.api),impl:a(e.impl)})}function a(e){return Object.freeze(typeof e==`string`?{root:e,dependencies:Object.freeze([])}:{...e?.root===void 0?{}:{root:e.root},dependencies:Object.freeze([...e?.dependencies??[]])})}exports.defineApp=e,exports.defineArchicatConfig=t,exports.defineLibrary=n,exports.defineModule=i;
|
package/dist/src/index.d.cts
CHANGED
|
@@ -1,3 +1,79 @@
|
|
|
1
|
+
//#region src/configs/archicat-project-graph.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* @description Generated dependency targets allowed in module API surfaces.
|
|
4
|
+
*/
|
|
5
|
+
interface ArchicatModuleApiDependencies {}
|
|
6
|
+
/**
|
|
7
|
+
* @description Generated dependency targets allowed in module implementation surfaces.
|
|
8
|
+
*/
|
|
9
|
+
interface ArchicatModuleImplDependencies {}
|
|
10
|
+
/**
|
|
11
|
+
* @description Generated dependency targets allowed in library API surfaces.
|
|
12
|
+
*/
|
|
13
|
+
interface ArchicatLibraryApiDependencies {}
|
|
14
|
+
/**
|
|
15
|
+
* @description Generated dependency targets allowed in library implementation surfaces.
|
|
16
|
+
*/
|
|
17
|
+
interface ArchicatLibraryImplDependencies {}
|
|
18
|
+
/**
|
|
19
|
+
* @description Generated dependency targets allowed in app composition roots.
|
|
20
|
+
*/
|
|
21
|
+
interface ArchicatAppDependencies {}
|
|
22
|
+
/**
|
|
23
|
+
* @description Dependency key fallback used before `.archicat/types/graph.d.ts` exists.
|
|
24
|
+
*/
|
|
25
|
+
type ArchicatDependencyKey<Dependencies> = keyof Dependencies extends never ? string : Extract<keyof Dependencies, string>;
|
|
26
|
+
/**
|
|
27
|
+
* @description Dependency target allowed from a module API surface.
|
|
28
|
+
*/
|
|
29
|
+
type ArchicatModuleApiDependency = ArchicatDependencyKey<ArchicatModuleApiDependencies>;
|
|
30
|
+
/**
|
|
31
|
+
* @description Dependency target allowed from a module implementation surface.
|
|
32
|
+
*/
|
|
33
|
+
type ArchicatModuleImplDependency = ArchicatDependencyKey<ArchicatModuleImplDependencies>;
|
|
34
|
+
/**
|
|
35
|
+
* @description Dependency target allowed from a library API surface.
|
|
36
|
+
*/
|
|
37
|
+
type ArchicatLibraryApiDependency = ArchicatDependencyKey<ArchicatLibraryApiDependencies>;
|
|
38
|
+
/**
|
|
39
|
+
* @description Dependency target allowed from a library implementation surface.
|
|
40
|
+
*/
|
|
41
|
+
type ArchicatLibraryImplDependency = ArchicatDependencyKey<ArchicatLibraryImplDependencies>;
|
|
42
|
+
/**
|
|
43
|
+
* @description Dependency target allowed from an app composition root.
|
|
44
|
+
*/
|
|
45
|
+
type ArchicatAppDependency = ArchicatDependencyKey<ArchicatAppDependencies>;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/configs/app-config.d.ts
|
|
48
|
+
/**
|
|
49
|
+
* @description User-facing app composition definition input.
|
|
50
|
+
*/
|
|
51
|
+
interface ArchicatAppInput {
|
|
52
|
+
/**
|
|
53
|
+
* @description Stable app name used in the Archicat project graph.
|
|
54
|
+
*/
|
|
55
|
+
readonly name: string;
|
|
56
|
+
/**
|
|
57
|
+
* @description App source root, relative to the app definition file.
|
|
58
|
+
* @default The directory containing `archicat.app.ts`.
|
|
59
|
+
*/
|
|
60
|
+
readonly root?: string;
|
|
61
|
+
/**
|
|
62
|
+
* @description Dependency targets visible from this app composition root.
|
|
63
|
+
* @default []
|
|
64
|
+
*/
|
|
65
|
+
readonly dependencies?: readonly ArchicatAppDependency[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @description Immutable app composition contract loaded by Archicat.
|
|
69
|
+
*/
|
|
70
|
+
type ArchicatAppContract = Readonly<{
|
|
71
|
+
readonly kind: 'app';
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly root?: string;
|
|
74
|
+
readonly dependencies: readonly ArchicatAppDependency[];
|
|
75
|
+
}>;
|
|
76
|
+
//#endregion
|
|
1
77
|
//#region src/configs/archicat-config.d.ts
|
|
2
78
|
/**
|
|
3
79
|
* @description Definition discovery roots for one Archicat definition kind.
|
|
@@ -23,6 +99,11 @@ interface ArchicatPrefixConfig {
|
|
|
23
99
|
*/
|
|
24
100
|
readonly library?: string;
|
|
25
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* @description User TypeScript aliases generated into `.archicat/tsconfig.json`.
|
|
104
|
+
* @default {}
|
|
105
|
+
*/
|
|
106
|
+
type ArchicatAliasConfig = Readonly<Record<string, string>>;
|
|
26
107
|
/**
|
|
27
108
|
* @description User-facing Archicat root config input.
|
|
28
109
|
*/
|
|
@@ -33,20 +114,20 @@ interface ArchicatConfigInput {
|
|
|
33
114
|
*/
|
|
34
115
|
readonly root?: string;
|
|
35
116
|
/**
|
|
36
|
-
* @description Directory for generated mirror files
|
|
117
|
+
* @description Directory for generated mirror files, generated types, and reports.
|
|
37
118
|
* @default '.archicat'
|
|
38
119
|
*/
|
|
39
120
|
readonly outDir?: string;
|
|
40
|
-
/**
|
|
41
|
-
* @description Directory for generated debug reports.
|
|
42
|
-
* @default 'archicat-report'
|
|
43
|
-
*/
|
|
44
|
-
readonly reportDir?: string;
|
|
45
121
|
/**
|
|
46
122
|
* @description User tsconfig file to merge into the generated Archicat tsconfig.
|
|
47
123
|
* @default Auto-detects tsconfig.base.json, then tsconfig.json.
|
|
48
124
|
*/
|
|
49
125
|
readonly tsconfig?: string;
|
|
126
|
+
/**
|
|
127
|
+
* @description User TypeScript aliases generated by Archicat.
|
|
128
|
+
* @default {}
|
|
129
|
+
*/
|
|
130
|
+
readonly alias?: ArchicatAliasConfig;
|
|
50
131
|
/**
|
|
51
132
|
* @description Reserved TypeScript import prefixes generated by Archicat.
|
|
52
133
|
* @default { module: '@module', library: '@library' }
|
|
@@ -62,6 +143,11 @@ interface ArchicatConfigInput {
|
|
|
62
143
|
* @default { include: [] }
|
|
63
144
|
*/
|
|
64
145
|
readonly libraries?: ArchicatDefinitionRootConfig;
|
|
146
|
+
/**
|
|
147
|
+
* @description App composition definition discovery config.
|
|
148
|
+
* @default { include: [] }
|
|
149
|
+
*/
|
|
150
|
+
readonly apps?: ArchicatDefinitionRootConfig;
|
|
65
151
|
}
|
|
66
152
|
/**
|
|
67
153
|
* @description Normalized immutable Archicat config contract.
|
|
@@ -69,8 +155,8 @@ interface ArchicatConfigInput {
|
|
|
69
155
|
type ArchicatConfig = Readonly<{
|
|
70
156
|
readonly root?: string;
|
|
71
157
|
readonly outDir?: string;
|
|
72
|
-
readonly reportDir?: string;
|
|
73
158
|
readonly tsconfig?: string;
|
|
159
|
+
readonly alias?: ArchicatAliasConfig;
|
|
74
160
|
readonly prefixes?: Readonly<{
|
|
75
161
|
readonly module?: string;
|
|
76
162
|
readonly library?: string;
|
|
@@ -81,17 +167,38 @@ type ArchicatConfig = Readonly<{
|
|
|
81
167
|
readonly libraries?: Readonly<{
|
|
82
168
|
readonly include?: readonly string[];
|
|
83
169
|
}>;
|
|
170
|
+
readonly apps?: Readonly<{
|
|
171
|
+
readonly include?: readonly string[];
|
|
172
|
+
}>;
|
|
84
173
|
}>;
|
|
85
174
|
//#endregion
|
|
86
|
-
//#region src/configs/
|
|
175
|
+
//#region src/configs/surface-config.d.ts
|
|
87
176
|
/**
|
|
88
|
-
* @description
|
|
177
|
+
* @description Surface root shorthand or full surface config.
|
|
89
178
|
*/
|
|
90
|
-
|
|
179
|
+
type ArchicatSurfaceInput<Dependency extends string> = string | ArchicatSurfaceConfig<Dependency>;
|
|
91
180
|
/**
|
|
92
|
-
* @description
|
|
181
|
+
* @description Source surface config.
|
|
93
182
|
*/
|
|
94
|
-
|
|
183
|
+
interface ArchicatSurfaceConfig<Dependency extends string> {
|
|
184
|
+
/**
|
|
185
|
+
* @description Surface source root, relative to the definition file.
|
|
186
|
+
* @default Generates an empty mirror for the surface.
|
|
187
|
+
*/
|
|
188
|
+
readonly root?: string;
|
|
189
|
+
/**
|
|
190
|
+
* @description Dependency targets visible from this surface.
|
|
191
|
+
* @default []
|
|
192
|
+
*/
|
|
193
|
+
readonly dependencies?: readonly Dependency[];
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @description Immutable normalized surface contract.
|
|
197
|
+
*/
|
|
198
|
+
type ArchicatSurfaceContract<Dependency extends string> = Readonly<{
|
|
199
|
+
readonly root?: string;
|
|
200
|
+
readonly dependencies: readonly Dependency[];
|
|
201
|
+
}>;
|
|
95
202
|
//#endregion
|
|
96
203
|
//#region src/configs/library-config.d.ts
|
|
97
204
|
/**
|
|
@@ -99,28 +206,28 @@ type ArchicatDependency = keyof ArchicatProjectGraph extends never ? string : ke
|
|
|
99
206
|
*/
|
|
100
207
|
interface ArchicatLibraryInput {
|
|
101
208
|
/**
|
|
102
|
-
* @description Stable library
|
|
209
|
+
* @description Stable library name used in the Archicat project graph.
|
|
103
210
|
*/
|
|
104
|
-
readonly
|
|
211
|
+
readonly name: string;
|
|
105
212
|
/**
|
|
106
|
-
* @description Library public API
|
|
213
|
+
* @description Library public API surface.
|
|
107
214
|
* @default Generates an empty public API mirror.
|
|
108
215
|
*/
|
|
109
|
-
readonly api?:
|
|
216
|
+
readonly api?: ArchicatSurfaceInput<ArchicatLibraryApiDependency>;
|
|
110
217
|
/**
|
|
111
|
-
* @description
|
|
112
|
-
* @default
|
|
218
|
+
* @description Library implementation surface.
|
|
219
|
+
* @default Generates a no-op implementation mirror.
|
|
113
220
|
*/
|
|
114
|
-
readonly
|
|
221
|
+
readonly impl?: ArchicatSurfaceInput<ArchicatLibraryImplDependency>;
|
|
115
222
|
}
|
|
116
223
|
/**
|
|
117
224
|
* @description Immutable library definition contract loaded by Archicat.
|
|
118
225
|
*/
|
|
119
226
|
type ArchicatLibraryContract = Readonly<{
|
|
120
227
|
readonly kind: 'library';
|
|
121
|
-
readonly
|
|
122
|
-
readonly api
|
|
123
|
-
readonly
|
|
228
|
+
readonly name: string;
|
|
229
|
+
readonly api: ArchicatSurfaceContract<ArchicatLibraryApiDependency>;
|
|
230
|
+
readonly impl: ArchicatSurfaceContract<ArchicatLibraryImplDependency>;
|
|
124
231
|
}>;
|
|
125
232
|
//#endregion
|
|
126
233
|
//#region src/configs/module-config.d.ts
|
|
@@ -129,36 +236,36 @@ type ArchicatLibraryContract = Readonly<{
|
|
|
129
236
|
*/
|
|
130
237
|
interface ArchicatModuleInput {
|
|
131
238
|
/**
|
|
132
|
-
* @description Stable module
|
|
239
|
+
* @description Stable module name used in the Archicat project graph.
|
|
133
240
|
*/
|
|
134
|
-
readonly
|
|
241
|
+
readonly name: string;
|
|
135
242
|
/**
|
|
136
|
-
* @description Module public API
|
|
243
|
+
* @description Module public API surface.
|
|
137
244
|
* @default Generates an empty public API mirror.
|
|
138
245
|
*/
|
|
139
|
-
readonly api?:
|
|
246
|
+
readonly api?: ArchicatSurfaceInput<ArchicatModuleApiDependency>;
|
|
140
247
|
/**
|
|
141
|
-
* @description Module implementation
|
|
248
|
+
* @description Module implementation surface.
|
|
142
249
|
* @default Generates a no-op implementation mirror.
|
|
143
250
|
*/
|
|
144
|
-
readonly impl?:
|
|
145
|
-
/**
|
|
146
|
-
* @description Public graph dependencies this module may import.
|
|
147
|
-
* @default []
|
|
148
|
-
*/
|
|
149
|
-
readonly dependencies?: readonly ArchicatDependency[];
|
|
251
|
+
readonly impl?: ArchicatSurfaceInput<ArchicatModuleImplDependency>;
|
|
150
252
|
}
|
|
151
253
|
/**
|
|
152
254
|
* @description Immutable module definition contract loaded by Archicat.
|
|
153
255
|
*/
|
|
154
256
|
type ArchicatModuleContract = Readonly<{
|
|
155
257
|
readonly kind: 'module';
|
|
156
|
-
readonly
|
|
157
|
-
readonly api
|
|
158
|
-
readonly impl
|
|
159
|
-
readonly dependencies: readonly ArchicatDependency[];
|
|
258
|
+
readonly name: string;
|
|
259
|
+
readonly api: ArchicatSurfaceContract<ArchicatModuleApiDependency>;
|
|
260
|
+
readonly impl: ArchicatSurfaceContract<ArchicatModuleImplDependency>;
|
|
160
261
|
}>;
|
|
161
262
|
//#endregion
|
|
263
|
+
//#region src/configs/define-app-config.d.ts
|
|
264
|
+
/**
|
|
265
|
+
* @description Defines one Archicat app composition root.
|
|
266
|
+
*/
|
|
267
|
+
declare function defineApp(app: ArchicatAppInput): ArchicatAppContract;
|
|
268
|
+
//#endregion
|
|
162
269
|
//#region src/configs/define-archicat-config.d.ts
|
|
163
270
|
/**
|
|
164
271
|
* @description Defines the root Archicat config.
|
|
@@ -177,4 +284,4 @@ declare function defineLibrary(library: ArchicatLibraryInput): ArchicatLibraryCo
|
|
|
177
284
|
*/
|
|
178
285
|
declare function defineModule(module: ArchicatModuleInput): ArchicatModuleContract;
|
|
179
286
|
//#endregion
|
|
180
|
-
export { type ArchicatConfig, type ArchicatConfigInput, type ArchicatDefinitionRootConfig, type
|
|
287
|
+
export { type ArchicatAliasConfig, type ArchicatAppContract, type ArchicatAppDependencies, type ArchicatAppDependency, type ArchicatAppInput, type ArchicatConfig, type ArchicatConfigInput, type ArchicatDefinitionRootConfig, type ArchicatLibraryApiDependencies, type ArchicatLibraryApiDependency, type ArchicatLibraryContract, type ArchicatLibraryImplDependencies, type ArchicatLibraryImplDependency, type ArchicatLibraryInput, type ArchicatModuleApiDependencies, type ArchicatModuleApiDependency, type ArchicatModuleContract, type ArchicatModuleImplDependencies, type ArchicatModuleImplDependency, type ArchicatModuleInput, type ArchicatPrefixConfig, type ArchicatSurfaceConfig, type ArchicatSurfaceContract, type ArchicatSurfaceInput, defineApp, defineArchicatConfig, defineLibrary, defineModule };
|
package/dist/src/index.d.mts
CHANGED
|
@@ -1,3 +1,79 @@
|
|
|
1
|
+
//#region src/configs/archicat-project-graph.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* @description Generated dependency targets allowed in module API surfaces.
|
|
4
|
+
*/
|
|
5
|
+
interface ArchicatModuleApiDependencies {}
|
|
6
|
+
/**
|
|
7
|
+
* @description Generated dependency targets allowed in module implementation surfaces.
|
|
8
|
+
*/
|
|
9
|
+
interface ArchicatModuleImplDependencies {}
|
|
10
|
+
/**
|
|
11
|
+
* @description Generated dependency targets allowed in library API surfaces.
|
|
12
|
+
*/
|
|
13
|
+
interface ArchicatLibraryApiDependencies {}
|
|
14
|
+
/**
|
|
15
|
+
* @description Generated dependency targets allowed in library implementation surfaces.
|
|
16
|
+
*/
|
|
17
|
+
interface ArchicatLibraryImplDependencies {}
|
|
18
|
+
/**
|
|
19
|
+
* @description Generated dependency targets allowed in app composition roots.
|
|
20
|
+
*/
|
|
21
|
+
interface ArchicatAppDependencies {}
|
|
22
|
+
/**
|
|
23
|
+
* @description Dependency key fallback used before `.archicat/types/graph.d.ts` exists.
|
|
24
|
+
*/
|
|
25
|
+
type ArchicatDependencyKey<Dependencies> = keyof Dependencies extends never ? string : Extract<keyof Dependencies, string>;
|
|
26
|
+
/**
|
|
27
|
+
* @description Dependency target allowed from a module API surface.
|
|
28
|
+
*/
|
|
29
|
+
type ArchicatModuleApiDependency = ArchicatDependencyKey<ArchicatModuleApiDependencies>;
|
|
30
|
+
/**
|
|
31
|
+
* @description Dependency target allowed from a module implementation surface.
|
|
32
|
+
*/
|
|
33
|
+
type ArchicatModuleImplDependency = ArchicatDependencyKey<ArchicatModuleImplDependencies>;
|
|
34
|
+
/**
|
|
35
|
+
* @description Dependency target allowed from a library API surface.
|
|
36
|
+
*/
|
|
37
|
+
type ArchicatLibraryApiDependency = ArchicatDependencyKey<ArchicatLibraryApiDependencies>;
|
|
38
|
+
/**
|
|
39
|
+
* @description Dependency target allowed from a library implementation surface.
|
|
40
|
+
*/
|
|
41
|
+
type ArchicatLibraryImplDependency = ArchicatDependencyKey<ArchicatLibraryImplDependencies>;
|
|
42
|
+
/**
|
|
43
|
+
* @description Dependency target allowed from an app composition root.
|
|
44
|
+
*/
|
|
45
|
+
type ArchicatAppDependency = ArchicatDependencyKey<ArchicatAppDependencies>;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/configs/app-config.d.ts
|
|
48
|
+
/**
|
|
49
|
+
* @description User-facing app composition definition input.
|
|
50
|
+
*/
|
|
51
|
+
interface ArchicatAppInput {
|
|
52
|
+
/**
|
|
53
|
+
* @description Stable app name used in the Archicat project graph.
|
|
54
|
+
*/
|
|
55
|
+
readonly name: string;
|
|
56
|
+
/**
|
|
57
|
+
* @description App source root, relative to the app definition file.
|
|
58
|
+
* @default The directory containing `archicat.app.ts`.
|
|
59
|
+
*/
|
|
60
|
+
readonly root?: string;
|
|
61
|
+
/**
|
|
62
|
+
* @description Dependency targets visible from this app composition root.
|
|
63
|
+
* @default []
|
|
64
|
+
*/
|
|
65
|
+
readonly dependencies?: readonly ArchicatAppDependency[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @description Immutable app composition contract loaded by Archicat.
|
|
69
|
+
*/
|
|
70
|
+
type ArchicatAppContract = Readonly<{
|
|
71
|
+
readonly kind: 'app';
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly root?: string;
|
|
74
|
+
readonly dependencies: readonly ArchicatAppDependency[];
|
|
75
|
+
}>;
|
|
76
|
+
//#endregion
|
|
1
77
|
//#region src/configs/archicat-config.d.ts
|
|
2
78
|
/**
|
|
3
79
|
* @description Definition discovery roots for one Archicat definition kind.
|
|
@@ -23,6 +99,11 @@ interface ArchicatPrefixConfig {
|
|
|
23
99
|
*/
|
|
24
100
|
readonly library?: string;
|
|
25
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* @description User TypeScript aliases generated into `.archicat/tsconfig.json`.
|
|
104
|
+
* @default {}
|
|
105
|
+
*/
|
|
106
|
+
type ArchicatAliasConfig = Readonly<Record<string, string>>;
|
|
26
107
|
/**
|
|
27
108
|
* @description User-facing Archicat root config input.
|
|
28
109
|
*/
|
|
@@ -33,20 +114,20 @@ interface ArchicatConfigInput {
|
|
|
33
114
|
*/
|
|
34
115
|
readonly root?: string;
|
|
35
116
|
/**
|
|
36
|
-
* @description Directory for generated mirror files
|
|
117
|
+
* @description Directory for generated mirror files, generated types, and reports.
|
|
37
118
|
* @default '.archicat'
|
|
38
119
|
*/
|
|
39
120
|
readonly outDir?: string;
|
|
40
|
-
/**
|
|
41
|
-
* @description Directory for generated debug reports.
|
|
42
|
-
* @default 'archicat-report'
|
|
43
|
-
*/
|
|
44
|
-
readonly reportDir?: string;
|
|
45
121
|
/**
|
|
46
122
|
* @description User tsconfig file to merge into the generated Archicat tsconfig.
|
|
47
123
|
* @default Auto-detects tsconfig.base.json, then tsconfig.json.
|
|
48
124
|
*/
|
|
49
125
|
readonly tsconfig?: string;
|
|
126
|
+
/**
|
|
127
|
+
* @description User TypeScript aliases generated by Archicat.
|
|
128
|
+
* @default {}
|
|
129
|
+
*/
|
|
130
|
+
readonly alias?: ArchicatAliasConfig;
|
|
50
131
|
/**
|
|
51
132
|
* @description Reserved TypeScript import prefixes generated by Archicat.
|
|
52
133
|
* @default { module: '@module', library: '@library' }
|
|
@@ -62,6 +143,11 @@ interface ArchicatConfigInput {
|
|
|
62
143
|
* @default { include: [] }
|
|
63
144
|
*/
|
|
64
145
|
readonly libraries?: ArchicatDefinitionRootConfig;
|
|
146
|
+
/**
|
|
147
|
+
* @description App composition definition discovery config.
|
|
148
|
+
* @default { include: [] }
|
|
149
|
+
*/
|
|
150
|
+
readonly apps?: ArchicatDefinitionRootConfig;
|
|
65
151
|
}
|
|
66
152
|
/**
|
|
67
153
|
* @description Normalized immutable Archicat config contract.
|
|
@@ -69,8 +155,8 @@ interface ArchicatConfigInput {
|
|
|
69
155
|
type ArchicatConfig = Readonly<{
|
|
70
156
|
readonly root?: string;
|
|
71
157
|
readonly outDir?: string;
|
|
72
|
-
readonly reportDir?: string;
|
|
73
158
|
readonly tsconfig?: string;
|
|
159
|
+
readonly alias?: ArchicatAliasConfig;
|
|
74
160
|
readonly prefixes?: Readonly<{
|
|
75
161
|
readonly module?: string;
|
|
76
162
|
readonly library?: string;
|
|
@@ -81,17 +167,38 @@ type ArchicatConfig = Readonly<{
|
|
|
81
167
|
readonly libraries?: Readonly<{
|
|
82
168
|
readonly include?: readonly string[];
|
|
83
169
|
}>;
|
|
170
|
+
readonly apps?: Readonly<{
|
|
171
|
+
readonly include?: readonly string[];
|
|
172
|
+
}>;
|
|
84
173
|
}>;
|
|
85
174
|
//#endregion
|
|
86
|
-
//#region src/configs/
|
|
175
|
+
//#region src/configs/surface-config.d.ts
|
|
87
176
|
/**
|
|
88
|
-
* @description
|
|
177
|
+
* @description Surface root shorthand or full surface config.
|
|
89
178
|
*/
|
|
90
|
-
|
|
179
|
+
type ArchicatSurfaceInput<Dependency extends string> = string | ArchicatSurfaceConfig<Dependency>;
|
|
91
180
|
/**
|
|
92
|
-
* @description
|
|
181
|
+
* @description Source surface config.
|
|
93
182
|
*/
|
|
94
|
-
|
|
183
|
+
interface ArchicatSurfaceConfig<Dependency extends string> {
|
|
184
|
+
/**
|
|
185
|
+
* @description Surface source root, relative to the definition file.
|
|
186
|
+
* @default Generates an empty mirror for the surface.
|
|
187
|
+
*/
|
|
188
|
+
readonly root?: string;
|
|
189
|
+
/**
|
|
190
|
+
* @description Dependency targets visible from this surface.
|
|
191
|
+
* @default []
|
|
192
|
+
*/
|
|
193
|
+
readonly dependencies?: readonly Dependency[];
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @description Immutable normalized surface contract.
|
|
197
|
+
*/
|
|
198
|
+
type ArchicatSurfaceContract<Dependency extends string> = Readonly<{
|
|
199
|
+
readonly root?: string;
|
|
200
|
+
readonly dependencies: readonly Dependency[];
|
|
201
|
+
}>;
|
|
95
202
|
//#endregion
|
|
96
203
|
//#region src/configs/library-config.d.ts
|
|
97
204
|
/**
|
|
@@ -99,28 +206,28 @@ type ArchicatDependency = keyof ArchicatProjectGraph extends never ? string : ke
|
|
|
99
206
|
*/
|
|
100
207
|
interface ArchicatLibraryInput {
|
|
101
208
|
/**
|
|
102
|
-
* @description Stable library
|
|
209
|
+
* @description Stable library name used in the Archicat project graph.
|
|
103
210
|
*/
|
|
104
|
-
readonly
|
|
211
|
+
readonly name: string;
|
|
105
212
|
/**
|
|
106
|
-
* @description Library public API
|
|
213
|
+
* @description Library public API surface.
|
|
107
214
|
* @default Generates an empty public API mirror.
|
|
108
215
|
*/
|
|
109
|
-
readonly api?:
|
|
216
|
+
readonly api?: ArchicatSurfaceInput<ArchicatLibraryApiDependency>;
|
|
110
217
|
/**
|
|
111
|
-
* @description
|
|
112
|
-
* @default
|
|
218
|
+
* @description Library implementation surface.
|
|
219
|
+
* @default Generates a no-op implementation mirror.
|
|
113
220
|
*/
|
|
114
|
-
readonly
|
|
221
|
+
readonly impl?: ArchicatSurfaceInput<ArchicatLibraryImplDependency>;
|
|
115
222
|
}
|
|
116
223
|
/**
|
|
117
224
|
* @description Immutable library definition contract loaded by Archicat.
|
|
118
225
|
*/
|
|
119
226
|
type ArchicatLibraryContract = Readonly<{
|
|
120
227
|
readonly kind: 'library';
|
|
121
|
-
readonly
|
|
122
|
-
readonly api
|
|
123
|
-
readonly
|
|
228
|
+
readonly name: string;
|
|
229
|
+
readonly api: ArchicatSurfaceContract<ArchicatLibraryApiDependency>;
|
|
230
|
+
readonly impl: ArchicatSurfaceContract<ArchicatLibraryImplDependency>;
|
|
124
231
|
}>;
|
|
125
232
|
//#endregion
|
|
126
233
|
//#region src/configs/module-config.d.ts
|
|
@@ -129,36 +236,36 @@ type ArchicatLibraryContract = Readonly<{
|
|
|
129
236
|
*/
|
|
130
237
|
interface ArchicatModuleInput {
|
|
131
238
|
/**
|
|
132
|
-
* @description Stable module
|
|
239
|
+
* @description Stable module name used in the Archicat project graph.
|
|
133
240
|
*/
|
|
134
|
-
readonly
|
|
241
|
+
readonly name: string;
|
|
135
242
|
/**
|
|
136
|
-
* @description Module public API
|
|
243
|
+
* @description Module public API surface.
|
|
137
244
|
* @default Generates an empty public API mirror.
|
|
138
245
|
*/
|
|
139
|
-
readonly api?:
|
|
246
|
+
readonly api?: ArchicatSurfaceInput<ArchicatModuleApiDependency>;
|
|
140
247
|
/**
|
|
141
|
-
* @description Module implementation
|
|
248
|
+
* @description Module implementation surface.
|
|
142
249
|
* @default Generates a no-op implementation mirror.
|
|
143
250
|
*/
|
|
144
|
-
readonly impl?:
|
|
145
|
-
/**
|
|
146
|
-
* @description Public graph dependencies this module may import.
|
|
147
|
-
* @default []
|
|
148
|
-
*/
|
|
149
|
-
readonly dependencies?: readonly ArchicatDependency[];
|
|
251
|
+
readonly impl?: ArchicatSurfaceInput<ArchicatModuleImplDependency>;
|
|
150
252
|
}
|
|
151
253
|
/**
|
|
152
254
|
* @description Immutable module definition contract loaded by Archicat.
|
|
153
255
|
*/
|
|
154
256
|
type ArchicatModuleContract = Readonly<{
|
|
155
257
|
readonly kind: 'module';
|
|
156
|
-
readonly
|
|
157
|
-
readonly api
|
|
158
|
-
readonly impl
|
|
159
|
-
readonly dependencies: readonly ArchicatDependency[];
|
|
258
|
+
readonly name: string;
|
|
259
|
+
readonly api: ArchicatSurfaceContract<ArchicatModuleApiDependency>;
|
|
260
|
+
readonly impl: ArchicatSurfaceContract<ArchicatModuleImplDependency>;
|
|
160
261
|
}>;
|
|
161
262
|
//#endregion
|
|
263
|
+
//#region src/configs/define-app-config.d.ts
|
|
264
|
+
/**
|
|
265
|
+
* @description Defines one Archicat app composition root.
|
|
266
|
+
*/
|
|
267
|
+
declare function defineApp(app: ArchicatAppInput): ArchicatAppContract;
|
|
268
|
+
//#endregion
|
|
162
269
|
//#region src/configs/define-archicat-config.d.ts
|
|
163
270
|
/**
|
|
164
271
|
* @description Defines the root Archicat config.
|
|
@@ -177,4 +284,4 @@ declare function defineLibrary(library: ArchicatLibraryInput): ArchicatLibraryCo
|
|
|
177
284
|
*/
|
|
178
285
|
declare function defineModule(module: ArchicatModuleInput): ArchicatModuleContract;
|
|
179
286
|
//#endregion
|
|
180
|
-
export { type ArchicatConfig, type ArchicatConfigInput, type ArchicatDefinitionRootConfig, type
|
|
287
|
+
export { type ArchicatAliasConfig, type ArchicatAppContract, type ArchicatAppDependencies, type ArchicatAppDependency, type ArchicatAppInput, type ArchicatConfig, type ArchicatConfigInput, type ArchicatDefinitionRootConfig, type ArchicatLibraryApiDependencies, type ArchicatLibraryApiDependency, type ArchicatLibraryContract, type ArchicatLibraryImplDependencies, type ArchicatLibraryImplDependency, type ArchicatLibraryInput, type ArchicatModuleApiDependencies, type ArchicatModuleApiDependency, type ArchicatModuleContract, type ArchicatModuleImplDependencies, type ArchicatModuleImplDependency, type ArchicatModuleInput, type ArchicatPrefixConfig, type ArchicatSurfaceConfig, type ArchicatSurfaceContract, type ArchicatSurfaceInput, defineApp, defineArchicatConfig, defineLibrary, defineModule };
|
package/dist/src/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e={}){return Object.freeze({...e.root===void 0?{}:{root:e.root},...e.outDir===void 0?{}:{outDir:e.outDir},...e.
|
|
1
|
+
function e(e){return Object.freeze({kind:`app`,name:e.name,...e.root===void 0?{}:{root:e.root},dependencies:Object.freeze([...e.dependencies??[]])})}function t(e={}){return Object.freeze({...e.root===void 0?{}:{root:e.root},...e.outDir===void 0?{}:{outDir:e.outDir},...e.tsconfig===void 0?{}:{tsconfig:e.tsconfig},...e.alias===void 0?{}:{alias:Object.freeze({...e.alias})},...e.prefixes===void 0?{}:{prefixes:Object.freeze({...e.prefixes.module===void 0?{}:{module:e.prefixes.module},...e.prefixes.library===void 0?{}:{library:e.prefixes.library}})},...e.modules===void 0?{}:{modules:Object.freeze({...e.modules.include===void 0?{}:{include:Object.freeze([...e.modules.include])}})},...e.libraries===void 0?{}:{libraries:Object.freeze({...e.libraries.include===void 0?{}:{include:Object.freeze([...e.libraries.include])}})},...e.apps===void 0?{}:{apps:Object.freeze({...e.apps.include===void 0?{}:{include:Object.freeze([...e.apps.include])}})}})}function n(e){return Object.freeze({kind:`library`,name:e.name,api:r(e.api),impl:r(e.impl)})}function r(e){return Object.freeze(typeof e==`string`?{root:e,dependencies:Object.freeze([])}:{...e?.root===void 0?{}:{root:e.root},dependencies:Object.freeze([...e?.dependencies??[]])})}function i(e){return Object.freeze({kind:`module`,name:e.name,api:a(e.api),impl:a(e.impl)})}function a(e){return Object.freeze(typeof e==`string`?{root:e,dependencies:Object.freeze([])}:{...e?.root===void 0?{}:{root:e.root},dependencies:Object.freeze([...e?.dependencies??[]])})}export{e as defineApp,t as defineArchicatConfig,n as defineLibrary,i as defineModule};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "archicat",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "M²: modular mirroring for clean architecture.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"m2",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"registry": "https://registry.npmjs.org/"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "edbae12165337e2a6caa43aa0bd4fb53cfb26b4c"
|
|
60
60
|
}
|