@lexibase/rdx-types 2.0.0 → 2.1.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/content.d.ts +3 -0
- package/dist/index.d.ts +7 -0
- package/dist/plugins.d.ts +60 -5
- package/package.json +1 -1
package/dist/content.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,13 @@ export {
|
|
|
8
8
|
ResolvedRdxConfig,
|
|
9
9
|
} from './config'
|
|
10
10
|
export {
|
|
11
|
+
RdxLocaleDefinition,
|
|
12
|
+
RdxLocale,
|
|
13
|
+
RdxLocalizationOptions,
|
|
14
|
+
RdxLocalization,
|
|
15
|
+
RdxSourceLocalization,
|
|
16
|
+
RdxSnapshotContext,
|
|
17
|
+
RdxSnapshotContribution,
|
|
11
18
|
RdxContentSource,
|
|
12
19
|
RdxPlugin,
|
|
13
20
|
RdxPluginCommand,
|
package/dist/plugins.d.ts
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
import type { ResolvedRdxConfig } from './config'
|
|
2
2
|
|
|
3
|
+
/** A content language; folder aliases are separate from language tags. */
|
|
4
|
+
export type RdxLocaleDefinition = {
|
|
5
|
+
code: string
|
|
6
|
+
label: string
|
|
7
|
+
folder?: string
|
|
8
|
+
}
|
|
9
|
+
export type RdxLocalizationOptions = {
|
|
10
|
+
locales: RdxLocaleDefinition[]
|
|
11
|
+
/** Absolute HTTP(S) URL for community translations, e.g. the repository's locale/ directory. */
|
|
12
|
+
contributionUrl?: string
|
|
13
|
+
}
|
|
14
|
+
export type RdxLocale = RdxLocaleDefinition & { path: string }
|
|
15
|
+
export type RdxLocalization = {
|
|
16
|
+
defaultLocale: string
|
|
17
|
+
locales: RdxLocale[]
|
|
18
|
+
/** Current contribution destination, shared across languages and editions. */
|
|
19
|
+
contributionUrl?: string
|
|
20
|
+
}
|
|
21
|
+
/** Language inventory frozen for one content source/edition. */
|
|
22
|
+
export type RdxSourceLocalization = RdxLocalization & {
|
|
23
|
+
docs: Record<string, string>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type RdxSnapshotContext = RdxPluginContext & {
|
|
27
|
+
version: string
|
|
28
|
+
/** New primary snapshot directory, relative to the project. */
|
|
29
|
+
snapshotDir: string
|
|
30
|
+
}
|
|
31
|
+
/** Hooks declare files/trees; the snapshot owner copies them in one transaction. */
|
|
32
|
+
export type RdxSnapshotContribution = {
|
|
33
|
+
directories?: { sourceDir: string; snapshotDir: string }[]
|
|
34
|
+
files?: { filename: string; content: string }[]
|
|
35
|
+
}
|
|
36
|
+
|
|
3
37
|
/** A separate documentation tree exposed below /docs/<routePrefix>. */
|
|
4
38
|
export type RdxContentSource = {
|
|
5
39
|
id: string
|
|
@@ -9,6 +43,16 @@ export type RdxContentSource = {
|
|
|
9
43
|
badge?: string
|
|
10
44
|
/** Canonical route prefix to redirect this historical source to. */
|
|
11
45
|
redirectTo?: string
|
|
46
|
+
/** Canonical snapshot label, including when this source is a redirect alias. */
|
|
47
|
+
version?: string
|
|
48
|
+
/** Retained identity metadata for a replaced snapshot; its content is not served. */
|
|
49
|
+
previousSnapshot?: { version: string; docsDir: string }
|
|
50
|
+
/** Internal localized view; the original source/edition identity is unchanged. */
|
|
51
|
+
basePath?: string
|
|
52
|
+
fallbackDocsDir?: string
|
|
53
|
+
fallbackOnly?: boolean
|
|
54
|
+
/** Internal source-language inventory; snapshot values are immutable. */
|
|
55
|
+
localization?: RdxSourceLocalization
|
|
12
56
|
}
|
|
13
57
|
|
|
14
58
|
export type RdxPluginContext = {
|
|
@@ -27,13 +71,21 @@ export type RdxPluginCommand = {
|
|
|
27
71
|
export type RdxPlugin = {
|
|
28
72
|
name: string
|
|
29
73
|
apiVersion: 1
|
|
30
|
-
setup?: (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
74
|
+
setup?: (context: RdxPluginContext) =>
|
|
75
|
+
| {
|
|
76
|
+
sources?: RdxContentSource[]
|
|
77
|
+
runtimeFiles?: string[]
|
|
78
|
+
localization?: RdxLocalizationOptions
|
|
79
|
+
}
|
|
34
80
|
| void
|
|
35
|
-
| Promise<{
|
|
81
|
+
| Promise<{
|
|
82
|
+
sources?: RdxContentSource[]
|
|
83
|
+
runtimeFiles?: string[]
|
|
84
|
+
localization?: RdxLocalizationOptions
|
|
85
|
+
} | void>
|
|
36
86
|
commands?: RdxPluginCommand[]
|
|
87
|
+
/** Synchronous, declaration-only hook. It must not write or reserve paths. */
|
|
88
|
+
snapshot?: (context: RdxSnapshotContext) => RdxSnapshotContribution | void
|
|
37
89
|
}
|
|
38
90
|
|
|
39
91
|
export type RdxProject = {
|
|
@@ -43,4 +95,7 @@ export type RdxProject = {
|
|
|
43
95
|
commands: RdxPluginCommand[]
|
|
44
96
|
/** Project-relative files plugins need when serving deployed documentation. */
|
|
45
97
|
runtimeFiles: string[]
|
|
98
|
+
localization?: RdxLocalization
|
|
99
|
+
/** Selected locale on a request-scoped view, never a global mutable setting. */
|
|
100
|
+
locale?: RdxLocale
|
|
46
101
|
}
|