@purview-dev/astroc4 1.0.0-prerelease.4 → 1.0.0-prerelease.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/dist/index.d.ts CHANGED
@@ -1,64 +1,42 @@
1
1
  import type { StarlightPlugin } from '@astrojs/starlight/types';
2
- import { LikeC4VitePlugin } from 'likec4/vite-plugin';
3
- /**
4
- * LikeC4 syntax highlighting, derived from the Langium grammar in
5
- * `likec4/likec4` and registered with the site's Expressive Code.
6
- */
2
+ import type { AstroIntegration } from 'astro';
3
+ import { missingOptimizedDependencies } from './integration.js';
4
+ import type { LikeC4IntegrationOptions } from './integration.js';
5
+ export { missingOptimizedDependencies };
7
6
  export interface LikeC4HighlightingOptions {
8
- /**
9
- * Branch, tag or commit SHA to read `like-c4.langium` from.
10
- * Defaults to `main`; pin a tag (`v1.59.4`) or a SHA for reproducible CI.
11
- * Also read from `ASTROC4_REF`.
12
- */
7
+ /** Branch, tag or commit SHA of `likec4/likec4`. Defaults to `main`; also `ASTROC4_REF`. */
13
8
  ref?: string;
14
- /** Repository to read from. Defaults to `likec4/likec4`. */
9
+ /** Defaults to `likec4/likec4`. */
15
10
  repo?: string;
16
11
  /** Use the bundled snapshot and never touch the network. Also `ASTROC4_OFFLINE=1`. */
17
12
  offline?: boolean;
18
- /**
19
- * What to do when the grammar cannot be fetched. Defaults to `fail`, so
20
- * `astro build` and `astro check` fail like any other build error.
21
- * A `ref` that does not exist always fails.
22
- */
13
+ /** When the grammar cannot be fetched. Defaults to `fail`; a `ref` that does not exist always fails. */
23
14
  onError?: 'fail' | 'warn' | 'silent';
24
- /** Seconds a cached fetch stays fresh. Defaults to an hour. */
15
+ /** Seconds a cached fetch stays fresh. Defaults to 3600. */
25
16
  cacheTtl?: number;
26
17
  /** Ignore the cache and refetch. */
27
18
  refresh?: boolean;
28
- /** Where to cache. Defaults to `node_modules/.cache/astroc4`. */
19
+ /** Defaults to `node_modules/.cache/astroc4`. */
29
20
  cacheDir?: string;
30
- /** Raw host to read from, for mirrors. Defaults to raw.githubusercontent.com. */
21
+ /** Raw host to read from. Defaults to `https://raw.githubusercontent.com`. */
31
22
  baseUrl?: string;
32
23
  /** Request timeout in milliseconds. Defaults to 15000. */
33
24
  timeout?: number;
34
25
  }
35
- export interface StarlightLikeC4Options {
36
- /**
37
- * Passed through to `LikeC4VitePlugin` — e.g. `{ workspace: 'diagrams' }` to
38
- * look for .c4 files somewhere other than the site root.
39
- */
40
- vitePlugin?: Parameters<typeof LikeC4VitePlugin>[0];
41
- /** Render ```likec4 fences in .mdx pages as diagrams. Defaults to `true`. */
42
- fences?: boolean;
43
- /**
44
- * Highlight ```c4 / ```likec4 source. Defaults to `true`; `false` leaves
45
- * Expressive Code entirely to the site.
46
- */
26
+ export interface StarlightLikeC4Options extends LikeC4IntegrationOptions {
27
+ /** Highlight ```c4 / ```likec4 source. Defaults to `true`; `false` leaves Expressive Code to the site. */
47
28
  highlighting?: boolean | LikeC4HighlightingOptions;
48
29
  }
49
- export default function starlightLikeC4(options?: StarlightLikeC4Options): StarlightPlugin;
50
30
  /**
51
- * Add the LikeC4 language to a site's Expressive Code options without
52
- * disturbing anything already set.
53
- *
54
- * Replacing an existing entry rather than appending matters: a site that
55
- * pinned `likec4Language` from `@purview-dev/astroc4/expressive-code` should get the
56
- * grammar for the ref it configured here, not two grammars for the same scope.
57
- * Expressive Code concatenates `shiki.langs` when it merges these options with
58
- * an `ec.config.mjs`, so a site's own languages survive either way.
59
- *
60
- * @param expressiveCode The site's `expressiveCode` option.
61
- * @param registration Shiki language registration.
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.
33
+ */
34
+ export type LikeC4StarlightPlugin = StarlightPlugin & Pick<AstroIntegration, 'hooks'>;
35
+ export default function starlightLikeC4(options?: StarlightLikeC4Options): LikeC4StarlightPlugin;
36
+ /**
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.
62
40
  */
63
41
  export declare function withLikeC4Language(expressiveCode: unknown, registration: Record<string, unknown>): Record<string, unknown> & {
64
42
  shiki: {