archicat 0.1.1 → 0.1.2

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 CHANGED
@@ -170,19 +170,20 @@ export default defineArchicatConfig({
170
170
  });
171
171
  ```
172
172
 
173
- App `tsconfig.json`:
173
+ The generated `.archicat/tsconfig.json` is a composable TypeScript config fragment. Consumers own their own `tsconfig.json` and may compose it however they need. For example, with TypeScript 5+ multiple `extends`:
174
174
 
175
175
  ```json
176
176
  {
177
- "extends": "./.archicat/tsconfig.json",
177
+ "extends": ["../../tsconfig.node.json", "./.archicat/tsconfig.json"],
178
178
  "compilerOptions": {
179
179
  "rootDir": ".",
180
180
  "outDir": "./dist"
181
- }
181
+ },
182
+ "include": ["main.ts", "src", "test"]
182
183
  }
183
184
  ```
184
185
 
185
- User aliases belong in `archicat.config.ts`, not in `compilerOptions.paths`.
186
+ Archicat does not inspect or enforce the consumer `tsconfig.json`. User aliases that should be part of the generated Archicat layer belong in `archicat.config.ts`.
186
187
 
187
188
  ## Output
188
189
 
@@ -752,60 +752,7 @@ function formatRows(rows) {
752
752
  //#endregion
753
753
  //#region src-internal/doctor/doctor.ts
754
754
  function doctorProject(project) {
755
- return [...checkConsumerTsconfig(project), ...checkPhysicalOmissions(project)];
756
- }
757
- function checkConsumerTsconfig(project) {
758
- const consumerTsconfig = makeConsumerTsconfigPath(project);
759
- if (!fs.existsSync(consumerTsconfig)) return [`Consumer tsconfig was not found: ${consumerTsconfig}`];
760
- const issues = [];
761
- const config = readConsumerTsconfig(consumerTsconfig, issues);
762
- if (!config) return issues;
763
- const compilerOptions = readConsumerCompilerOptions(config, consumerTsconfig, issues);
764
- if (!compilerOptions) return issues;
765
- pushInvalidExtendsIssue(issues, project, config);
766
- pushRootDirIssue(issues, compilerOptions);
767
- pushPathsIssue(issues, compilerOptions);
768
- pushBaseUrlIssue(issues, compilerOptions);
769
- pushOwnedCollectionIssue(issues, config);
770
- return issues;
771
- }
772
- function readConsumerTsconfig(tsconfigPath, issues) {
773
- try {
774
- return readTsconfigFile(tsconfigPath);
775
- } catch (error) {
776
- issues.push(`Failed to parse consumer tsconfig: ${formatError(error)}`);
777
- return;
778
- }
779
- }
780
- function readConsumerCompilerOptions(config, tsconfigPath, issues) {
781
- try {
782
- return readTsconfigCompilerOptions(config, tsconfigPath);
783
- } catch (error) {
784
- issues.push(formatError(error));
785
- return;
786
- }
787
- }
788
- function pushInvalidExtendsIssue(issues, project, config) {
789
- const expectedExtends = makeExpectedConsumerExtends(project);
790
- if (config.extends === expectedExtends) return;
791
- issues.push(`Consumer tsconfig should extend ${expectedExtends} for generated Archicat aliases to work.`);
792
- }
793
- function pushRootDirIssue(issues, compilerOptions) {
794
- const rootDir = compilerOptions.rootDir;
795
- if (rootDir !== "src" && rootDir !== "./src") return;
796
- issues.push("compilerOptions.rootDir is set to src. Generated Archicat files live outside src and may break tsc.");
797
- }
798
- function pushPathsIssue(issues, compilerOptions) {
799
- if (!Object.hasOwn(compilerOptions, "paths")) return;
800
- issues.push("compilerOptions.paths should move to archicat.config.ts alias. Consumer tsconfig paths can override generated Archicat aliases.");
801
- }
802
- function pushBaseUrlIssue(issues, compilerOptions) {
803
- if (!Object.hasOwn(compilerOptions, "baseUrl")) return;
804
- issues.push("compilerOptions.baseUrl is not supported. Move aliases into archicat.config.ts alias.");
805
- }
806
- function pushOwnedCollectionIssue(issues, config) {
807
- if (config.include === void 0 && config.exclude === void 0 && config.files === void 0) return;
808
- issues.push("Consumer tsconfig include/exclude/files should move to archicat.config.ts typescript.tsConfig so generated Archicat types stay included.");
755
+ return checkPhysicalOmissions(project);
809
756
  }
810
757
  function checkPhysicalOmissions(project) {
811
758
  const issues = [];
@@ -817,23 +764,6 @@ function checkPhysicalOmissions(project) {
817
764
  }
818
765
  return issues;
819
766
  }
820
- function makeConsumerTsconfigPath(project) {
821
- return path.join(project.rootDir, ArchicatDefaults.typescript.consumerTsconfigFileName);
822
- }
823
- function makeGeneratedTsconfigPath(project) {
824
- return path.join(project.outDir, ArchicatDefaults.generated.tsconfigFileName);
825
- }
826
- function makeExpectedConsumerExtends(project) {
827
- let relative = normalizePath(path.relative(project.rootDir, makeGeneratedTsconfigPath(project)));
828
- if (!isRelativeSpecifier(relative)) relative = `./${relative}`;
829
- return relative;
830
- }
831
- function isRelativeSpecifier(value) {
832
- return value.startsWith("./") || value.startsWith("../");
833
- }
834
- function formatError(error) {
835
- return error instanceof Error ? error.message : String(error);
836
- }
837
767
  function capitalize$1(value) {
838
768
  return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;
839
769
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archicat",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Modular mirroring (M²) for clean TypeScript architecture.",
5
5
  "keywords": [
6
6
  "architecture",