@purview-dev/astroc4 1.0.0-prerelease.5 → 1.0.0-prerelease.7

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.ts CHANGED
@@ -2,78 +2,41 @@ import type { StarlightPlugin } from '@astrojs/starlight/types';
2
2
  import type { AstroIntegration } from 'astro';
3
3
  import { missingOptimizedDependencies } from './integration.js';
4
4
  import type { LikeC4IntegrationOptions } from './integration.js';
5
- /**
6
- * Re-exported for the Starlight entry point's callers and tests: the merge that
7
- * keeps `react/compiler-runtime` in the site's optimized dependencies is part of
8
- * both entry points' behaviour, and both are asserted against this function.
9
- */
10
5
  export { missingOptimizedDependencies };
11
- /**
12
- * LikeC4 syntax highlighting, derived from the Langium grammar in
13
- * `likec4/likec4` and registered with the site's Expressive Code.
14
- */
15
6
  export interface LikeC4HighlightingOptions {
16
- /**
17
- * Branch, tag or commit SHA to read `like-c4.langium` from.
18
- * Defaults to `main`; pin a tag (`v1.59.4`) or a SHA for reproducible CI.
19
- * Also read from `ASTROC4_REF`.
20
- */
7
+ /** Branch, tag or commit SHA of `likec4/likec4`. Defaults to `main`; also `ASTROC4_REF`. */
21
8
  ref?: string;
22
- /** Repository to read from. Defaults to `likec4/likec4`. */
9
+ /** Defaults to `likec4/likec4`. */
23
10
  repo?: string;
24
11
  /** Use the bundled snapshot and never touch the network. Also `ASTROC4_OFFLINE=1`. */
25
12
  offline?: boolean;
26
- /**
27
- * What to do when the grammar cannot be fetched. Defaults to `fail`, so
28
- * `astro build` and `astro check` fail like any other build error.
29
- * A `ref` that does not exist always fails.
30
- */
13
+ /** When the grammar cannot be fetched. Defaults to `fail`; a `ref` that does not exist always fails. */
31
14
  onError?: 'fail' | 'warn' | 'silent';
32
- /** Seconds a cached fetch stays fresh. Defaults to an hour. */
15
+ /** Seconds a cached fetch stays fresh. Defaults to 3600. */
33
16
  cacheTtl?: number;
34
17
  /** Ignore the cache and refetch. */
35
18
  refresh?: boolean;
36
- /** Where to cache. Defaults to `node_modules/.cache/astroc4`. */
19
+ /** Defaults to `node_modules/.cache/astroc4`. */
37
20
  cacheDir?: string;
38
- /** Raw host to read from, for mirrors. Defaults to raw.githubusercontent.com. */
21
+ /** Raw host to read from. Defaults to `https://raw.githubusercontent.com`. */
39
22
  baseUrl?: string;
40
23
  /** Request timeout in milliseconds. Defaults to 15000. */
41
24
  timeout?: number;
42
25
  }
43
- /**
44
- * The Starlight plugin's options: the integration's, plus the Starlight-only
45
- * highlighting injection.
46
- */
47
26
  export interface StarlightLikeC4Options extends LikeC4IntegrationOptions {
48
- /**
49
- * Highlight ```c4 / ```likec4 source. Defaults to `true`; `false` leaves
50
- * Expressive Code entirely to the site.
51
- */
27
+ /** Highlight ```c4 / ```likec4 source. Defaults to `true`; `false` leaves Expressive Code to the site. */
52
28
  highlighting?: boolean | LikeC4HighlightingOptions;
53
29
  }
54
30
  /**
55
- * The Starlight plugin **and** the Astro integration: one object, two hook sets.
56
- *
57
- * Starlight calls `config:setup` and `i18n:setup` on a plugin; Astro calls only
58
- * `astro:*` hooks on something in `integrations`. Since the sets are disjoint,
59
- * carrying both is safe — and it is what makes `astro add`'s automatic wiring
60
- * (`integrations: [astroc4()]`, from the `astro-integration` keyword and the
61
- * default export) produce a working site.
31
+ * A Starlight plugin and an Astro integration in one object. The hook sets are
32
+ * disjoint, so `astro add`'s `integrations: [astroc4()]` works too.
62
33
  */
63
34
  export type LikeC4StarlightPlugin = StarlightPlugin & Pick<AstroIntegration, 'hooks'>;
64
35
  export default function starlightLikeC4(options?: StarlightLikeC4Options): LikeC4StarlightPlugin;
65
36
  /**
66
- * Add the LikeC4 language to a site's Expressive Code options without
67
- * disturbing anything already set.
68
- *
69
- * Replacing an existing entry rather than appending matters: a site that
70
- * pinned `likec4Language` from `@purview-dev/astroc4/expressive-code` should get the
71
- * grammar for the ref it configured here, not two grammars for the same scope.
72
- * Expressive Code concatenates `shiki.langs` when it merges these options with
73
- * an `ec.config.mjs`, so a site's own languages survive either way.
74
- *
75
- * @param expressiveCode The site's `expressiveCode` option.
76
- * @param registration Shiki language registration.
37
+ * The site's Expressive Code options plus the LikeC4 language. Starlight's
38
+ * `updateConfig` merges shallowly, so existing options are carried over; an
39
+ * existing LikeC4 entry is replaced so the configured ref wins.
77
40
  */
78
41
  export declare function withLikeC4Language(expressiveCode: unknown, registration: Record<string, unknown>): Record<string, unknown> & {
79
42
  shiki: {