Socket
Socket
Sign inDemoInstall

@docusaurus/types

Package Overview
Dependencies
Maintainers
5
Versions
1769
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@docusaurus/types - npm Package Compare versions

Comparing version 2.0.0-alpha.58 to 2.0.0-alpha.59

7

package.json
{
"name": "@docusaurus/types",
"version": "2.0.0-alpha.58",
"version": "2.0.0-alpha.59",
"description": "Common used typings for Docusaurus packages",

@@ -14,5 +14,6 @@ "main": "./src/index.js",

"commander": "^4.0.1",
"querystring": "0.2.0"
"querystring": "0.2.0",
"webpack-merge": "^4.2.2"
},
"gitHead": "16ba6e54b672151a2fcd0ded8deb56f638f6ec01"
"gitHead": "a1f688789f501bf3f597acbde0f347eca9cadd6f"
}

@@ -11,3 +11,6 @@ /**

import {ParsedUrlQueryInput} from 'querystring';
import {MergeStrategy} from 'webpack-merge';
export type OnBrokenLinks = 'ignore' | 'log' | 'error' | 'throw';
export interface DocusaurusConfig {

@@ -19,2 +22,3 @@ baseUrl: string;

url: string;
onBrokenLinks: OnBrokenLinks;
organizationName?: string;

@@ -27,6 +31,6 @@ projectName?: string;

themeConfig?: {
[key: string]: any;
[key: string]: unknown;
};
customFields?: {
[key: string]: any;
[key: string]: unknown;
};

@@ -37,3 +41,3 @@ scripts?: (

src: string;
[key: string]: any;
[key: string]: unknown;
}

@@ -45,3 +49,3 @@ )[];

href: string;
[key: string]: any;
[key: string]: unknown;
}

@@ -51,5 +55,25 @@ )[];

/**
* - `type: 'package'`, plugin is in a different package.
* - `type: 'project'`, plugin is in the same docusaurus project.
* - `type: 'local'`, none of plugin's ancestor directory contains any package.json.
* - `type: 'synthetic'`, docusaurus generated internal plugin.
*/
export type DocusaurusPluginVersionInformation =
| {readonly type: 'package'; readonly version?: string}
| {readonly type: 'project'}
| {readonly type: 'local'}
| {readonly type: 'synthetic'};
export interface DocusaurusSiteMetadata {
readonly docusaurusVersion: string;
readonly siteVersion?: string;
readonly pluginVersions: Record<string, DocusaurusPluginVersionInformation>;
}
export interface DocusaurusContext {
siteConfig?: DocusaurusConfig;
isClient?: boolean;
siteConfig: DocusaurusConfig;
siteMetadata: DocusaurusSiteMetadata;
globalData: Record<string, any>;
isClient: boolean;
}

@@ -62,3 +86,6 @@

export type PresetConfig = [string, Object] | [string] | string;
export type PresetConfig =
| [string, Record<string, unknown>]
| [string]
| string;

@@ -97,4 +124,5 @@ export interface StartCLIOptions {

export interface Props extends LoadContext, InjectedHtmlTags {
routes: RouteConfig[];
routesPaths: string[];
plugins: Plugin<any>[];
plugins: Plugin<any, unknown>[];
}

@@ -105,7 +133,11 @@

createData(name: string, data: any): Promise<string>;
setGlobalData<T = unknown>(data: T): void;
}
export interface Plugin<T> {
export interface Plugin<T, U = unknown> {
id?: string;
name: string;
loadContent?(): Promise<T>;
validateOptions?(): ValidationResult<U>;
validateThemeConfig?(): ValidationResult<any>;
contentLoaded?({

@@ -125,4 +157,5 @@ content,

utils: ConfigureWebpackUtils,
): Configuration;
): Configuration & {mergeStrategy?: ConfigureWebpackFnMergeStrategy};
getThemePath?(): string;
getTypeScriptThemePath?(): string;
getPathsToWatch?(): string[];

@@ -138,4 +171,9 @@ getClientModules?(): string[];

export type PluginConfig = [string, Object] | [string] | string;
export type ConfigureWebpackFn = Plugin<unknown>['configureWebpack'];
export type ConfigureWebpackFnMergeStrategy = Record<string, MergeStrategy>;
export type PluginOptions = {id?: string} & Record<string, unknown>;
export type PluginConfig = [string, PluginOptions] | [string] | string;
export interface ChunkRegistry {

@@ -179,7 +217,13 @@ loader: string;

cssOptions: {
[key: string]: any;
[key: string]: unknown;
},
) => Loader[];
getCacheLoader: (isServer: boolean, cacheOptions?: {}) => Loader | null;
getBabelLoader: (isServer: boolean, babelOptions?: {}) => Loader;
getCacheLoader: (
isServer: boolean,
cacheOptions?: Record<string, unknown>,
) => Loader | null;
getBabelLoader: (
isServer: boolean,
babelOptions?: Record<string, unknown>,
) => Loader;
}

@@ -204,1 +248,28 @@

}
export interface ValidationResult<T, E extends Error = Error> {
error?: E;
value: T;
}
export type Validate<T, E extends Error = Error> = (
validationSchema: ValidationSchema<T>,
options: Partial<T>,
) => ValidationResult<T, E>;
export interface OptionValidationContext<T, E extends Error = Error> {
validate: Validate<T, E>;
options: Partial<T>;
}
export interface ThemeConfigValidationContext<T, E extends Error = Error> {
validate: Validate<T, E>;
themeConfig: Partial<T>;
}
// TODO we should use a Joi type here
export interface ValidationSchema<T> {
validate(options: Partial<T>, opt: object): ValidationResult<T>;
unknown(): ValidationSchema<T>;
append(data: any): ValidationSchema<T>;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc