@reqvire-org/ads-guard 0.5.1 → 0.5.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/dist/cli.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  GUARD_CONFIG_FILE2,
5
5
  runGuard2,
6
6
  guardText2
7
- } from "./chunk-qm6jh9dj.mjs";
7
+ } from "./chunk-8g49j1kb.mjs";
8
8
 
9
9
  // src/guard/cli.mts
10
10
  var HELP = `ads-guard [directory] [--json]
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  readGuardConfig2,
7
7
  runGuard2,
8
8
  guardText2
9
- } from "./chunk-qm6jh9dj.mjs";
9
+ } from "./chunk-8g49j1kb.mjs";
10
10
  export {
11
11
  GUARD_CONFIG_FILE2 as GUARD_CONFIG_FILE,
12
12
  checkDesignUsage2 as checkDesignUsage,
@@ -22,6 +22,8 @@ export interface AnalysisProviders {
22
22
  readonly resolveModuleDetails?: (specifier: string, file: string, options: ProgramOptions) => Promise<ResolvedModule | null>;
23
23
  /** The captured revision: owner of revision-lifetime facts. */
24
24
  readonly revision?: object;
25
+ /** Aborted when the request is canceled: long analyses stop at their next `throwIfCancelled`. */
26
+ readonly signal?: AbortSignal;
25
27
  /** Identity of the revision's inputs outside its captured files (installed dependencies); absent when unknown. */
26
28
  readonly environment?: () => string;
27
29
  /**
@@ -41,6 +43,29 @@ export interface AnalysisContext extends AnalysisProviders {
41
43
  export declare function runAnalysis<T>(root: string, run: (context: AnalysisContext) => T, providers?: AnalysisProviders): T;
42
44
  export declare function currentAnalysis(): AnalysisContext | undefined;
43
45
  /** Share pure project discovery during one fenced analysis operation. */
46
+ /** The error a canceled analysis stops with (the code callers recognise as cancellation). */
47
+ export declare class AnalysisCancelled extends Error {
48
+ readonly code = "ADS_CANCELLED";
49
+ readonly diagnostic: {
50
+ readonly rule: "mutation-cancelled";
51
+ readonly message: "Analysis cancelled.";
52
+ };
53
+ constructor();
54
+ }
55
+ /**
56
+ * Stops a canceled analysis: throws when `signal` (by default the current analysis's) is aborted. Called between
57
+ * units of work (an owner, a choice, a scenario, a file, a construction), so cancellation does not wait for the
58
+ * request to finish. Caches never store the exception (they keep settled outcomes only).
59
+ */
60
+ export declare function throwIfCancelled(signal?: AbortSignal | undefined): void;
61
+ /**
62
+ * A file's text in the captured revision: `{ text }` (`null` when the revision has no such file) inside a
63
+ * revision-scoped analysis whose root holds the file, else `undefined` (the caller reads its own live files).
64
+ * Dependencies below `node_modules` are not captured text.
65
+ */
66
+ export declare function revisionText(file: string): {
67
+ readonly text: string | null;
68
+ } | undefined;
44
69
  export declare function memoFact<T>(owner: object, key: string, compute: () => T): T;
45
70
  /** Pure facts may live as long as their immutable program/tree or captured view, never by path alone. */
46
71
  export declare function memoProgram<T>(program: object, key: string, compute: () => T): T;
@@ -9,6 +9,26 @@ export declare function closeSyntax(): Promise<void>;
9
9
  export declare function parseSource(file: string, text: string, scriptKind?: ScriptKind): Promise<SourceFile>;
10
10
  /** Reads configuration `text` as if it were a file beside `file`, without writing it. */
11
11
  export declare function parseConfigText(file: string, text: string): Promise<ReadConfigFileResponse>;
12
+ /** A TypeScript configuration's compiler options, and what kept it (or a configuration it extends) from parsing. */
13
+ export interface ConfigurationRead {
14
+ readonly options: ParsedCommandLine["options"];
15
+ /** Each problem with the configuration file it concerns (`file` itself or an `extends` target). */
16
+ readonly problems: readonly {
17
+ readonly file: string;
18
+ readonly message: string;
19
+ }[];
20
+ }
21
+ /**
22
+ * The compiler options of the configuration `file` as `read` gives it (a captured revision's bytes; `null`: the
23
+ * file is absent), with what kept any configuration from parsing. Every `extends` target named by a path (relative
24
+ * or absolute) is read through `read` too, never by the native parser from disk: a readable one is served under a
25
+ * virtual name beside it (so its own relative paths resolve as they do on disk), an absent one under a virtual
26
+ * name that does not exist, and an unparsable one as an empty configuration; each is reported here, by its
27
+ * authored name, as is a circular chain or one longer than `MAX_EXTENDS_DEPTH`. Nothing of the chain is left for
28
+ * TypeScript to read from disk. A package configuration is an installed dependency and is read from it. Nothing
29
+ * is written.
30
+ */
31
+ export declare function parseCompilerOptionsFrom(file: string, read: (file: string) => string | null): Promise<ConfigurationRead>;
12
32
  export declare const readConfig: (file: string) => Promise<ReadConfigFileResponse>;
13
33
  export declare const parseConfig: (config: unknown, directory: string) => Promise<ParsedCommandLine>;
14
34
  export declare const parseCompilerOptions: (config: Readonly<Record<string, unknown>>, directory: string) => Promise<ParsedCommandLine>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads-guard",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Confirms that an application's source does no design of its own and uses its ADS design system only.",
5
5
  "repository": {
6
6
  "type": "git",
File without changes