@docusaurus/theme-live-codeblock 2.0.0-beta.16 → 2.0.0-beta.19
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/lib/index.js +3 -5
- package/lib/theme/Playground/index.js +1 -0
- package/lib/theme/ReactLiveScope/index.d.ts +15 -3
- package/lib/validateThemeConfig.d.ts +2 -5
- package/package.json +12 -9
- package/src/deps.d.ts +2 -2
- package/src/index.ts +3 -4
- package/src/theme/Playground/index.tsx +1 -0
- package/src/theme-live-codeblock.d.ts +2 -2
- package/src/types.d.ts +3 -1
- package/src/validateThemeConfig.ts +5 -5
package/lib/index.js
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
9
9
|
exports.validateThemeConfig = void 0;
|
|
10
|
-
const tslib_1 = require('tslib');
|
|
11
|
-
const path_1 = (0, tslib_1.__importDefault)(require('path'));
|
|
12
10
|
const theme_translations_1 = require('@docusaurus/theme-translations');
|
|
13
11
|
function themeLiveCodeblock(context) {
|
|
14
12
|
const {
|
|
@@ -17,10 +15,10 @@ function themeLiveCodeblock(context) {
|
|
|
17
15
|
return {
|
|
18
16
|
name: 'docusaurus-theme-live-codeblock',
|
|
19
17
|
getThemePath() {
|
|
20
|
-
return
|
|
18
|
+
return '../lib/theme';
|
|
21
19
|
},
|
|
22
20
|
getTypeScriptThemePath() {
|
|
23
|
-
return
|
|
21
|
+
return '../src/theme';
|
|
24
22
|
},
|
|
25
23
|
getDefaultCodeTranslationMessages() {
|
|
26
24
|
return (0, theme_translations_1.readDefaultCodeTranslationMessages)({
|
|
@@ -32,7 +30,7 @@ function themeLiveCodeblock(context) {
|
|
|
32
30
|
return {
|
|
33
31
|
resolve: {
|
|
34
32
|
alias: {
|
|
35
|
-
buble:
|
|
33
|
+
buble: require.resolve('./custom-buble.js'),
|
|
36
34
|
},
|
|
37
35
|
},
|
|
38
36
|
};
|
|
@@ -32,7 +32,7 @@ declare const ReactLiveScope: {
|
|
|
32
32
|
isValidElement<P_19>(object: {} | null | undefined): object is React.ReactElement<P_19, string | React.JSXElementConstructor<any>>;
|
|
33
33
|
createRef<T_13>(): React.RefObject<T_13>;
|
|
34
34
|
forwardRef<T_14, P_20 = {}>(render: React.ForwardRefRenderFunction<T_14, P_20>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P_20> & React.RefAttributes<T_14>>;
|
|
35
|
-
memo<P_21 extends object>(Component: React.FunctionComponent<P_21>, propsAreEqual?: ((prevProps: Readonly<
|
|
35
|
+
memo<P_21 extends object>(Component: React.FunctionComponent<P_21>, propsAreEqual?: ((prevProps: Readonly<P_21>, nextProps: Readonly<P_21>) => boolean) | undefined): React.NamedExoticComponent<P_21>;
|
|
36
36
|
memo<T_15 extends React.ComponentType<any>>(Component: T_15, propsAreEqual?: ((prevProps: Readonly<React.ComponentProps<T_15>>, nextProps: Readonly<React.ComponentProps<T_15>>) => boolean) | undefined): React.MemoExoticComponent<T_15>;
|
|
37
37
|
lazy<T_16 extends React.ComponentType<any>>(factory: () => Promise<{
|
|
38
38
|
default: T_16;
|
|
@@ -51,10 +51,22 @@ declare const ReactLiveScope: {
|
|
|
51
51
|
useLayoutEffect(effect: React.EffectCallback, deps?: React.DependencyList | undefined): void;
|
|
52
52
|
useEffect(effect: React.EffectCallback, deps?: React.DependencyList | undefined): void;
|
|
53
53
|
useImperativeHandle<T_21, R_5 extends T_21>(ref: React.Ref<T_21> | undefined, init: () => R_5, deps?: React.DependencyList | undefined): void;
|
|
54
|
-
useCallback<T_22 extends
|
|
54
|
+
useCallback<T_22 extends Function>(callback: T_22, deps: React.DependencyList): T_22;
|
|
55
55
|
useMemo<T_23>(factory: () => T_23, deps: React.DependencyList | undefined): T_23;
|
|
56
56
|
useDebugValue<T_24>(value: T_24, format?: ((value: T_24) => any) | undefined): void;
|
|
57
|
-
|
|
57
|
+
useDeferredValue<T_25>(value: T_25): T_25;
|
|
58
|
+
useTransition(): [boolean, React.TransitionStartFunction];
|
|
59
|
+
startTransition(scope: React.TransitionFunction): void;
|
|
60
|
+
useId(): string;
|
|
61
|
+
useInsertionEffect(effect: React.EffectCallback, deps?: React.DependencyList | undefined): void;
|
|
62
|
+
useSyncExternalStore<Snapshot>(subscribe: (onStoreChange: () => void) => () => void, getSnapshot: () => Snapshot, getServerSnapshot?: (() => Snapshot) | undefined): Snapshot;
|
|
63
|
+
Children: {
|
|
64
|
+
map<T_26, C_2>(children: C_2 | readonly C_2[], fn: (child: C_2, index: number) => T_26): C_2 extends null | undefined ? C_2 : Exclude<T_26, boolean | null | undefined>[];
|
|
65
|
+
forEach<C_3>(children: C_3 | readonly C_3[], fn: (child: C_3, index: number) => void): void;
|
|
66
|
+
count(children: any): number;
|
|
67
|
+
only<C_4>(children: C_4): C_4 extends any[] ? never : C_4;
|
|
68
|
+
toArray(children: React.ReactNode | React.ReactNode[]): (string | number | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | React.ReactPortal)[];
|
|
69
|
+
};
|
|
58
70
|
Fragment: React.ExoticComponent<{
|
|
59
71
|
children?: React.ReactNode;
|
|
60
72
|
}>;
|
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { Joi } from '@docusaurus/utils-validation';
|
|
8
|
-
import type { ThemeConfig,
|
|
8
|
+
import type { ThemeConfig, ThemeConfigValidationContext } from '@docusaurus/types';
|
|
9
9
|
export declare const DEFAULT_CONFIG: {
|
|
10
10
|
playgroundPosition: string;
|
|
11
11
|
};
|
|
12
12
|
export declare const Schema: Joi.ObjectSchema<any>;
|
|
13
|
-
export declare function validateThemeConfig({ validate, themeConfig, }:
|
|
14
|
-
validate: Validate<ThemeConfig>;
|
|
15
|
-
themeConfig: ThemeConfig;
|
|
16
|
-
}): ValidationResult<ThemeConfig>;
|
|
13
|
+
export declare function validateThemeConfig({ validate, themeConfig, }: ThemeConfigValidationContext<ThemeConfig>): ThemeConfig;
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-live-codeblock",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.19",
|
|
4
4
|
"description": "Docusaurus live code block component.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-live-codeblock.d.ts",
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"lib/theme/Playground/*"
|
|
9
|
+
],
|
|
7
10
|
"publishConfig": {
|
|
8
11
|
"access": "public"
|
|
9
12
|
},
|
|
@@ -21,18 +24,18 @@
|
|
|
21
24
|
},
|
|
22
25
|
"license": "MIT",
|
|
23
26
|
"dependencies": {
|
|
24
|
-
"@docusaurus/core": "2.0.0-beta.
|
|
25
|
-
"@docusaurus/theme-common": "2.0.0-beta.
|
|
26
|
-
"@docusaurus/theme-translations": "2.0.0-beta.
|
|
27
|
-
"@docusaurus/utils-validation": "2.0.0-beta.
|
|
27
|
+
"@docusaurus/core": "2.0.0-beta.19",
|
|
28
|
+
"@docusaurus/theme-common": "2.0.0-beta.19",
|
|
29
|
+
"@docusaurus/theme-translations": "2.0.0-beta.19",
|
|
30
|
+
"@docusaurus/utils-validation": "2.0.0-beta.19",
|
|
28
31
|
"@philpl/buble": "^0.19.7",
|
|
29
32
|
"clsx": "^1.1.1",
|
|
30
|
-
"fs-extra": "^10.0
|
|
33
|
+
"fs-extra": "^10.1.0",
|
|
31
34
|
"react-live": "2.2.3",
|
|
32
|
-
"tslib": "^2.
|
|
35
|
+
"tslib": "^2.4.0"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
35
|
-
"@docusaurus/types": "2.0.0-beta.
|
|
38
|
+
"@docusaurus/types": "2.0.0-beta.19",
|
|
36
39
|
"@types/buble": "^0.20.1"
|
|
37
40
|
},
|
|
38
41
|
"peerDependencies": {
|
|
@@ -42,5 +45,5 @@
|
|
|
42
45
|
"engines": {
|
|
43
46
|
"node": ">=14"
|
|
44
47
|
},
|
|
45
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "a71e60a49cce93c1006ef10c41ac03187f057102"
|
|
46
49
|
}
|
package/src/deps.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ declare module '@philpl/buble' {
|
|
|
10
10
|
// eslint-disable-next-line import/no-extraneous-dependencies, no-restricted-syntax
|
|
11
11
|
export * from 'buble';
|
|
12
12
|
export const features: string[];
|
|
13
|
-
export
|
|
13
|
+
export type TransformOptions = OriginalTransformOptions & {
|
|
14
14
|
transforms?: OriginalTransformOptions['transforms'] & {
|
|
15
15
|
asyncAwait?: boolean;
|
|
16
16
|
getterSetter?: boolean;
|
|
17
17
|
};
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
}
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import path from 'path';
|
|
9
8
|
import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
|
|
10
9
|
import type {LoadContext, Plugin} from '@docusaurus/types';
|
|
11
10
|
|
|
@@ -18,10 +17,10 @@ export default function themeLiveCodeblock(context: LoadContext): Plugin {
|
|
|
18
17
|
name: 'docusaurus-theme-live-codeblock',
|
|
19
18
|
|
|
20
19
|
getThemePath() {
|
|
21
|
-
return
|
|
20
|
+
return '../lib/theme';
|
|
22
21
|
},
|
|
23
22
|
getTypeScriptThemePath() {
|
|
24
|
-
return
|
|
23
|
+
return '../src/theme';
|
|
25
24
|
},
|
|
26
25
|
|
|
27
26
|
getDefaultCodeTranslationMessages() {
|
|
@@ -35,7 +34,7 @@ export default function themeLiveCodeblock(context: LoadContext): Plugin {
|
|
|
35
34
|
return {
|
|
36
35
|
resolve: {
|
|
37
36
|
alias: {
|
|
38
|
-
buble:
|
|
37
|
+
buble: require.resolve('./custom-buble.js'),
|
|
39
38
|
},
|
|
40
39
|
},
|
|
41
40
|
};
|
package/src/types.d.ts
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/// <reference types="@docusaurus/theme-classic" />
|
|
9
|
+
/// <reference types="@docusaurus/module-type-aliases" />
|
|
9
10
|
|
|
10
11
|
declare module '@theme-init/CodeBlock' {
|
|
11
|
-
import type CodeBlock
|
|
12
|
+
import type CodeBlock from '@theme/CodeBlock';
|
|
13
|
+
import type {Props as BaseProps} from '@theme/CodeBlock';
|
|
12
14
|
|
|
13
15
|
export interface Props extends BaseProps {
|
|
14
16
|
live?: boolean;
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import {Joi} from '@docusaurus/utils-validation';
|
|
9
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
ThemeConfig,
|
|
11
|
+
ThemeConfigValidationContext,
|
|
12
|
+
} from '@docusaurus/types';
|
|
10
13
|
|
|
11
14
|
export const DEFAULT_CONFIG = {
|
|
12
15
|
playgroundPosition: 'bottom',
|
|
@@ -25,9 +28,6 @@ export const Schema = Joi.object({
|
|
|
25
28
|
export function validateThemeConfig({
|
|
26
29
|
validate,
|
|
27
30
|
themeConfig,
|
|
28
|
-
}: {
|
|
29
|
-
validate: Validate<ThemeConfig>;
|
|
30
|
-
themeConfig: ThemeConfig;
|
|
31
|
-
}): ValidationResult<ThemeConfig> {
|
|
31
|
+
}: ThemeConfigValidationContext<ThemeConfig>): ThemeConfig {
|
|
32
32
|
return validate(Schema, themeConfig);
|
|
33
33
|
}
|