@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/README.md +155 -95
- package/dist/expressive-code.d.ts +0 -4
- package/dist/expressive-code.js.map +5 -5
- package/dist/fences.d.ts +37 -22
- package/dist/file-layout.d.ts +4 -0
- package/dist/grammar/langium.d.ts +0 -4
- package/dist/grammar/source.d.ts +0 -12
- package/dist/grammar/textmate.d.ts +0 -2
- package/dist/icon-assets.d.ts +28 -0
- package/dist/icon-plugin.d.ts +16 -0
- package/dist/index.d.ts +12 -49
- package/dist/index.js +629 -78
- package/dist/index.js.map +15 -10
- package/dist/integration.d.ts +14 -24
- package/dist/integration.js +612 -43
- package/dist/integration.js.map +11 -5
- package/dist/projects.d.ts +24 -0
- package/dist/translations.d.ts +1 -0
- package/dist/workspace.d.ts +5 -0
- package/package.json +8 -3
- package/src/components/DiagramFrame.astro +13 -23
- package/src/components/DiagramShell.astro +18 -30
- package/src/components/ErrorBoundary.tsx +1 -5
- package/src/components/LikeC4Fence.astro +1 -5
- package/src/components/LikeC4InlineView.tsx +6 -16
- package/src/components/LikeC4ProjectView.tsx +0 -5
- package/src/components/LikeC4View.astro +73 -28
- package/src/components/LoadingPlaceholder.astro +9 -14
- package/src/components/icon-source.ts +5 -22
- package/src/components/labels.ts +10 -16
- package/src/components/md-fences.tsx +37 -0
- package/src/components/render-icon.tsx +0 -9
- package/src/components/utils.ts +40 -7
- package/src/translations.ts +3 -10
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
|
-
/**
|
|
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
|
|
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
|
-
/**
|
|
19
|
+
/** Defaults to `node_modules/.cache/astroc4`. */
|
|
37
20
|
cacheDir?: string;
|
|
38
|
-
/** Raw host to read from
|
|
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
|
-
*
|
|
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
|
-
*
|
|
67
|
-
*
|
|
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: {
|