@stardeck-customer-apps/compose 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -44,6 +44,47 @@ declare const composeInputsSchema: z.ZodObject<{
44
44
  type ComposeInputsFile = z.infer<typeof composeInputsSchema>;
45
45
  type ComposeInputsInstall = ComposeInputsFile["installs"][string];
46
46
 
47
+ /** A kept Module file that reaches into a peer which may be absent. */
48
+ interface BoundaryViolation {
49
+ /** Path relative to the Modules dir, e.g. `pos/tests/x.test.ts`. */
50
+ file: string;
51
+ module: string;
52
+ peer: string;
53
+ }
54
+ /**
55
+ * Files of each `module` that would import a deleted path once the given peers
56
+ * are pruned: a path under `<peer>/` or under any Module's `enhancements/<peer>/`
57
+ * (the folders `--prune` removes with the peer), directly or through another
58
+ * scanned file that does. A file inside the module's own `enhancements/<peer>/`
59
+ * goes with the peer and is exempt. Anything else left behind breaks
60
+ * `next build`, which type-checks it.
61
+ *
62
+ * Import specifiers come from the TypeScript pre-processor (static, `export …
63
+ * from`, dynamic `import()`, `require`), so comments and code-shaped strings in
64
+ * test fixtures do not count. Data files read by path also count: any `.sql` /
65
+ * `.json` string literal under `modules/<peer>/` (e.g. a test reading
66
+ * `src/modules/<peer>/datastore/schema.sql`). Relative specifiers are resolved.
67
+ * ponytail: a path assembled from pieces (`path.join("modules", peer)`) and a
68
+ * `vi.mock("@/modules/<peer>")` are not seen.
69
+ *
70
+ * `pruning`: the peers are all removed together, so a file inside the module's
71
+ * `enhancements/<q>/` for any listed peer `q` goes too and is exempt from every
72
+ * peer (a `booking` slice may import `membership` when both are pruned). The
73
+ * lint leaves it off: some customer keeps booking and drops membership.
74
+ */
75
+ declare function findModuleBoundaryViolations(modulesDir: string, peersByModule: Record<string, readonly string[]>, { pruning }?: {
76
+ pruning?: boolean;
77
+ }): BoundaryViolation[];
78
+ /**
79
+ * Blueprint lint: every Module against every feature Module it does not list
80
+ * in `uses` — the peers some customer can switch off while keeping it (listed
81
+ * in `enhancements` or not at all) — regardless of which Modules a given app
82
+ * enables. Library and contract Modules are always composed, so never peers.
83
+ */
84
+ declare function findOptionalPeerViolations(modulesDir: string): BoundaryViolation[];
85
+ /** The refusal text, shared by `--prune` and `--check-boundaries`. */
86
+ declare function formatBoundaryViolations(modulesDirLabel: string, violations: BoundaryViolation[]): string;
87
+
47
88
  interface ComposeOptions {
48
89
  /** Repo root of the customer app (the directory holding `apps/web`). */
49
90
  cwd: string;
@@ -89,9 +130,9 @@ declare function assertSupportedTypescript(versionMajorMinor: string): void;
89
130
  */
90
131
  declare function escapeGitignore(pattern: string): string;
91
132
  /**
92
- * Regenerate the Module-rail artifacts (the five `src/*.gen.ts` files and every
133
+ * Regenerate the Module-rail artifacts (the six `src/*.gen.ts` files and every
93
134
  * route/endpoint stub under `src/app`) for the app rooted at `options.cwd`.
94
135
  */
95
136
  declare function compose(options: ComposeOptions): Promise<ComposeResult>;
96
137
 
97
- export { COMPOSE_INPUTS_PATH, type ComposeInputs, type ComposeOptions, type ComposeResult, assertSupportedTypescript, compose, escapeGitignore, readComposeInputs };
138
+ export { type BoundaryViolation, COMPOSE_INPUTS_PATH, type ComposeInputs, type ComposeOptions, type ComposeResult, assertSupportedTypescript, compose, escapeGitignore, findModuleBoundaryViolations, findOptionalPeerViolations, formatBoundaryViolations, readComposeInputs };
package/dist/index.d.ts CHANGED
@@ -44,6 +44,47 @@ declare const composeInputsSchema: z.ZodObject<{
44
44
  type ComposeInputsFile = z.infer<typeof composeInputsSchema>;
45
45
  type ComposeInputsInstall = ComposeInputsFile["installs"][string];
46
46
 
47
+ /** A kept Module file that reaches into a peer which may be absent. */
48
+ interface BoundaryViolation {
49
+ /** Path relative to the Modules dir, e.g. `pos/tests/x.test.ts`. */
50
+ file: string;
51
+ module: string;
52
+ peer: string;
53
+ }
54
+ /**
55
+ * Files of each `module` that would import a deleted path once the given peers
56
+ * are pruned: a path under `<peer>/` or under any Module's `enhancements/<peer>/`
57
+ * (the folders `--prune` removes with the peer), directly or through another
58
+ * scanned file that does. A file inside the module's own `enhancements/<peer>/`
59
+ * goes with the peer and is exempt. Anything else left behind breaks
60
+ * `next build`, which type-checks it.
61
+ *
62
+ * Import specifiers come from the TypeScript pre-processor (static, `export …
63
+ * from`, dynamic `import()`, `require`), so comments and code-shaped strings in
64
+ * test fixtures do not count. Data files read by path also count: any `.sql` /
65
+ * `.json` string literal under `modules/<peer>/` (e.g. a test reading
66
+ * `src/modules/<peer>/datastore/schema.sql`). Relative specifiers are resolved.
67
+ * ponytail: a path assembled from pieces (`path.join("modules", peer)`) and a
68
+ * `vi.mock("@/modules/<peer>")` are not seen.
69
+ *
70
+ * `pruning`: the peers are all removed together, so a file inside the module's
71
+ * `enhancements/<q>/` for any listed peer `q` goes too and is exempt from every
72
+ * peer (a `booking` slice may import `membership` when both are pruned). The
73
+ * lint leaves it off: some customer keeps booking and drops membership.
74
+ */
75
+ declare function findModuleBoundaryViolations(modulesDir: string, peersByModule: Record<string, readonly string[]>, { pruning }?: {
76
+ pruning?: boolean;
77
+ }): BoundaryViolation[];
78
+ /**
79
+ * Blueprint lint: every Module against every feature Module it does not list
80
+ * in `uses` — the peers some customer can switch off while keeping it (listed
81
+ * in `enhancements` or not at all) — regardless of which Modules a given app
82
+ * enables. Library and contract Modules are always composed, so never peers.
83
+ */
84
+ declare function findOptionalPeerViolations(modulesDir: string): BoundaryViolation[];
85
+ /** The refusal text, shared by `--prune` and `--check-boundaries`. */
86
+ declare function formatBoundaryViolations(modulesDirLabel: string, violations: BoundaryViolation[]): string;
87
+
47
88
  interface ComposeOptions {
48
89
  /** Repo root of the customer app (the directory holding `apps/web`). */
49
90
  cwd: string;
@@ -89,9 +130,9 @@ declare function assertSupportedTypescript(versionMajorMinor: string): void;
89
130
  */
90
131
  declare function escapeGitignore(pattern: string): string;
91
132
  /**
92
- * Regenerate the Module-rail artifacts (the five `src/*.gen.ts` files and every
133
+ * Regenerate the Module-rail artifacts (the six `src/*.gen.ts` files and every
93
134
  * route/endpoint stub under `src/app`) for the app rooted at `options.cwd`.
94
135
  */
95
136
  declare function compose(options: ComposeOptions): Promise<ComposeResult>;
96
137
 
97
- export { COMPOSE_INPUTS_PATH, type ComposeInputs, type ComposeOptions, type ComposeResult, assertSupportedTypescript, compose, escapeGitignore, readComposeInputs };
138
+ export { type BoundaryViolation, COMPOSE_INPUTS_PATH, type ComposeInputs, type ComposeOptions, type ComposeResult, assertSupportedTypescript, compose, escapeGitignore, findModuleBoundaryViolations, findOptionalPeerViolations, formatBoundaryViolations, readComposeInputs };