@docusaurus/types
Advanced tools
Comparing version 2.0.0-alpha.69 to 2.0.0-alpha.378053ac5
{ | ||
"name": "@docusaurus/types", | ||
"version": "2.0.0-alpha.69", | ||
"version": "2.0.0-alpha.378053ac5", | ||
"description": "Common used typings for Docusaurus packages", | ||
@@ -22,3 +22,3 @@ "main": "./src/index.js", | ||
}, | ||
"gitHead": "4410a9eb01b87c2df664986ba37e748ed34a3c78" | ||
"gitHead": "de6131ca7167543245c4a468122559901a442519" | ||
} |
@@ -17,2 +17,6 @@ /** | ||
export type ThemeConfig = { | ||
[key: string]: unknown; | ||
}; | ||
export interface DocusaurusConfig { | ||
@@ -25,2 +29,3 @@ baseUrl: string; | ||
url: string; | ||
i18n: I18nConfig; | ||
onBrokenLinks: ReportingSeverity; | ||
@@ -36,5 +41,3 @@ onBrokenMarkdownLinks: ReportingSeverity; | ||
presets?: PresetConfig[]; | ||
themeConfig?: { | ||
[key: string]: unknown; | ||
}; | ||
themeConfig: ThemeConfig; | ||
customFields?: { | ||
@@ -84,2 +87,22 @@ [key: string]: unknown; | ||
// Inspired by Chrome JSON, because it's a widely supported i18n format | ||
// https://developer.chrome.com/apps/i18n-messages | ||
// https://support.crowdin.com/file-formats/chrome-json/ | ||
// https://www.applanga.com/docs/formats/chrome_i18n_json | ||
// https://docs.transifex.com/formats/chrome-json | ||
// https://help.phrase.com/help/chrome-json-messages | ||
export type TranslationMessage = {message: string; description?: string}; | ||
export type TranslationFileContent = Record<string, TranslationMessage>; | ||
export type TranslationFile = {path: string; content: TranslationFileContent}; | ||
export type TranslationFiles = TranslationFile[]; | ||
export type I18nConfig = { | ||
defaultLocale: string; | ||
locales: [string, ...string[]]; | ||
}; | ||
export type I18n = I18nConfig & { | ||
currentLocale: string; | ||
}; | ||
export interface DocusaurusContext { | ||
@@ -89,2 +112,4 @@ siteConfig: DocusaurusConfig; | ||
globalData: Record<string, any>; | ||
i18n: I18n; | ||
codeTranslations: Record<string, string>; | ||
isClient: boolean; | ||
@@ -112,2 +137,3 @@ } | ||
poll: boolean | number; | ||
locale?: string; | ||
}; | ||
@@ -120,3 +146,3 @@ | ||
export interface BuildCLIOptions { | ||
export type BuildOptions = { | ||
bundleAnalyzer: boolean; | ||
@@ -126,4 +152,8 @@ outDir: string; | ||
skipBuild: boolean; | ||
} | ||
}; | ||
export type BuildCLIOptions = BuildOptions & { | ||
locale?: string; | ||
}; | ||
export interface LoadContext { | ||
@@ -135,3 +165,5 @@ siteDir: string; | ||
baseUrl: string; | ||
i18n: I18n; | ||
ssrTemplate?: string; | ||
codeTranslations: Record<string, string>; | ||
} | ||
@@ -199,2 +231,19 @@ | ||
getSwizzleComponentList?(): string[]; | ||
// translations | ||
getTranslationFiles?(): Promise<TranslationFiles>; | ||
translateContent?({ | ||
content, | ||
translationFiles, | ||
}: { | ||
content: T; // the content loaded by this plugin instance | ||
translationFiles: TranslationFiles; | ||
}): T; | ||
translateThemeConfig?({ | ||
themeConfig, | ||
translationFiles, | ||
}: { | ||
themeConfig: ThemeConfig; | ||
translationFiles: TranslationFiles; | ||
}): ThemeConfig; | ||
} | ||
@@ -300,3 +349,6 @@ | ||
export interface ValidationSchema<T> { | ||
validate(options: Partial<T>, opt: object): ValidationResult<T>; | ||
validate( | ||
options: Partial<T>, | ||
opt: Record<string, unknown>, | ||
): ValidationResult<T>; | ||
unknown(): ValidationSchema<T>; | ||
@@ -303,0 +355,0 @@ append(data: any): ValidationSchema<T>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10723
318
1