Skip to content

Commit

Permalink
fix: relative imports when swizzling
Browse files Browse the repository at this point in the history
  • Loading branch information
jy95 committed May 14, 2023
1 parent 7b31a26 commit ff933fc
Show file tree
Hide file tree
Showing 76 changed files with 316 additions and 263 deletions.
11 changes: 4 additions & 7 deletions src/theme-json-schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,25 @@ declare module "docusaurus-json-schema-plugin" {

// Viewer component
declare module "@theme/JSONSchemaViewer" {
import type { Props } from "docusaurus-json-schema-plugin/src/theme/JSONSchemaViewer/index"
import type { Props } from "@theme/JSONSchemaViewer/index"

export default function JSONSchemaViewer(props: Props): JSX.Element
}

// Editor component
declare module "@theme/JSONSchemaEditor" {
import type { Props } from "docusaurus-json-schema-plugin/src/theme/JSONSchemaEditor/index"
import type { Props } from "@theme/JSONSchemaEditor/index"

export default function JSONSchemaEditor(props: Props): JSX.Element
}

// MonacoEditor component
declare module "@theme/MonacoEditor" {
import type { Props } from "docusaurus-json-schema-plugin/src/theme/MonacoEditor/index"
import type { Props } from "@theme/MonacoEditor/index"

export default function MonacoEditor(props: Props): JSX.Element

export type {
MonacoEditorTypes,
Props,
} from "docusaurus-json-schema-plugin/src/theme/MonacoEditor/index"
export type { MonacoEditorTypes, Props } from "@theme/MonacoEditor/index"

// Re-export Monaco own interface, in case people want to add custom validation, ...
export * as monaco from "monaco-editor/esm/vs/editor/editor.api"
Expand Down
2 changes: 1 addition & 1 deletion src/theme/JSONSchemaEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ErrorBoundary from "@docusaurus/ErrorBoundary"
import {
LoadingLabel,
ErrorOccurredLabel,
} from "../JSONSchemaViewer/labels/index"
} from "@theme/JSONSchemaViewer/labels/index"

import type { JSONSchema as Draft_07 } from "json-schema-typed/draft-07"
import type { EditorWillMount, MonacoEditorProps } from "react-monaco-editor"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"
import Translate from "@docusaurus/Translate"

import { TypeLabel, FalseLabel } from "../labels/index"
import { TypeLabel, FalseLabel } from "@theme/JSONSchemaViewer/labels/index"

// When schema has the value "true", it means that it is ALWAYS valid
export default function CreateAlwaysValid(): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react"
import Translate from "@docusaurus/Translate"

import { TypeLabel, TrueLabel } from "../labels/index"
import { useJSVOptionsContext } from "../contexts/index"
import { QualifierMessages } from "../utils/index"
import { CreateDescription } from "./index"
import { TypeLabel, TrueLabel } from "@theme/JSONSchemaViewer/labels/index"
import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts/index"
import { QualifierMessages } from "@theme/JSONSchemaViewer/utils/index"
import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements/index"

import type { JSONSchema } from "../types"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
[x: string]: any
Expand Down
10 changes: 5 additions & 5 deletions src/theme/JSONSchemaViewer/JSONSchemaElements/CreateBoolean.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react"

import { QualifierMessages } from "../utils/index"
import { QualifierMessages } from "@theme/JSONSchemaViewer/utils/index"

import { useJSVOptionsContext } from "../contexts/index"
import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts/index"

import { TypeLabel, BooleanLabel } from "../labels/index"
import { TypeLabel, BooleanLabel } from "@theme/JSONSchemaViewer/labels/index"

import { CreateDescription } from "./index"
import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements/index"

import type { JSONSchemaNS } from "../types"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
[x: string]: any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"

import { useJSVOptionsContext } from "../contexts/index"
import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts/index"

type Props = {
description: string
Expand Down
10 changes: 5 additions & 5 deletions src/theme/JSONSchemaViewer/JSONSchemaElements/CreateInteger.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react"

import { QualifierMessages } from "../utils/index"
import { QualifierMessages } from "@theme/JSONSchemaViewer/utils/index"

import { useJSVOptionsContext } from "../contexts/index"
import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts/index"

import { TypeLabel, IntegerLabel } from "../labels/index"
import { TypeLabel, IntegerLabel } from "@theme/JSONSchemaViewer/labels/index"

import { CreateDescription } from "./index"
import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements/index"

import type { JSONSchemaNS } from "../types"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
[x: string]: any
Expand Down
10 changes: 5 additions & 5 deletions src/theme/JSONSchemaViewer/JSONSchemaElements/CreateNull.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react"

import { QualifierMessages } from "../utils/index"
import { QualifierMessages } from "@theme/JSONSchemaViewer/utils/index"

import { useJSVOptionsContext } from "../contexts/index"
import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts/index"

import { TypeLabel, NullLabel } from "../labels/index"
import { TypeLabel, NullLabel } from "@theme/JSONSchemaViewer/labels/index"

import { CreateDescription } from "./index"
import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements/index"

import type { JSONSchemaNS } from "../types"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
[x: string]: any
Expand Down
10 changes: 5 additions & 5 deletions src/theme/JSONSchemaViewer/JSONSchemaElements/CreateNumber.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react"

import { QualifierMessages } from "../utils/index"
import { QualifierMessages } from "@theme/JSONSchemaViewer/utils/index"

import { useJSVOptionsContext } from "../contexts/index"
import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts/index"

import { TypeLabel, NumberLabel } from "../labels/index"
import { TypeLabel, NumberLabel } from "@theme/JSONSchemaViewer/labels/index"

import { CreateDescription } from "./index"
import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements/index"

import type { JSONSchemaNS } from "../types"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
[x: string]: any
Expand Down
10 changes: 5 additions & 5 deletions src/theme/JSONSchemaViewer/JSONSchemaElements/CreateString.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react"

import { QualifierMessages } from "../utils/index"
import { QualifierMessages } from "@theme/JSONSchemaViewer/utils/index"

import { useJSVOptionsContext } from "../contexts/index"
import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts/index"

import { TypeLabel, StringLabel } from "../labels/index"
import { TypeLabel, StringLabel } from "@theme/JSONSchemaViewer/labels/index"

import { CreateDescription } from "./index"
import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements/index"

import type { JSONSchemaNS } from "../types"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
[x: string]: any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import React from "react"

import { DependentRequired, DependentSchemas } from "./index"
import {
DependentRequired,
DependentSchemas,
} from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/index"

import type { JSONSchema } from "../../types"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
schema: Exclude<JSONSchema, true | false>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react"

import { AllOfSchema } from "../schemaComposition/index"
import { AllOfSchema } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/index"

import type { JSONSchema, JSONSchemaNS } from "../../types"
import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
schema: Exclude<JSONSchema, true | false>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react"

import { AllOfSchema } from "../schemaComposition/index"
import { AllOfSchema } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/index"

import type { JSONSchema, JSONSchemaNS } from "../../types"
import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
schema: Exclude<JSONSchema, true | false>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ import React from "react"
import TabItem from "@theme-original/TabItem"
import Tabs from "@theme-original/Tabs"

import { CreateNodes } from "../../components/index"
import { CreateNodes } from "@theme/JSONSchemaViewer/components/index"

import { IfLabel, ThenLabel, ElseLabel } from "../../labels/index"
import {
IfLabel,
ThenLabel,
ElseLabel,
} from "@theme/JSONSchemaViewer/labels/index"

import type { JSONSchema } from "../../types"
import type { JSONSchema } from "@theme/JSONSchemaViewer/types"

type Props = {
schema: Exclude<JSONSchema, true | false>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export { default as IfElseThen } from "./if-else-then"
export { default as IfElseThen } from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/if-else-then"

export { default as DependentRequired } from "./dependentRequired"
export { default as DependentRequired } from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentRequired"

export { default as DependentSchemas } from "./dependentSchemas"
export { default as DependentSchemas } from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentSchemas"

export { default as Dependencies } from "./dependencies"
export { default as Dependencies } from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependencies"

// main entry point
export { default as SchemaConditional } from "./schemaConditional"
export { default as SchemaConditional } from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/schemaConditional"
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {
DependentRequired,
DependentSchemas,
Dependencies,
} from "./index"
import { Collapsible } from "../../components/index"
} from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/index"
import { Collapsible } from "@theme/JSONSchemaViewer/components/index"

import type { JSONSchema, JSONSchemaNS } from "../../types"
import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
schema: Exclude<JSONSchema, true | false>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react"
import Translate from "@docusaurus/Translate"

import { CreateEdge } from "../../components/index"
import { CreateEdge } from "@theme/JSONSchemaViewer/components/index"

import type { JSONSchemaNS } from "../../types"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
[x: string]: any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react"
import Translate from "@docusaurus/Translate"

import { CreateEdge } from "../../components/index"
import { CreateEdge } from "@theme/JSONSchemaViewer/components/index"

import type { JSONSchemaNS } from "../../types"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
[x: string]: any
Expand Down
20 changes: 10 additions & 10 deletions src/theme/JSONSchemaViewer/JSONSchemaElements/array/CreateArray.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import React from "react"

import Items from "./Items"
import Contains from "./Contains"
import PrefixItems from "./PrefixItems"
import AdditionalItems from "./AdditionalItems"
import UnevaluatedItems from "./UnevaluatedItems"
import Items from "@theme/JSONSchemaViewer/JSONSchemaElements/array/Items"
import Contains from "@theme/JSONSchemaViewer/JSONSchemaElements/array/Contains"
import PrefixItems from "@theme/JSONSchemaViewer/JSONSchemaElements/array/PrefixItems"
import AdditionalItems from "@theme/JSONSchemaViewer/JSONSchemaElements/array/AdditionalItems"
import UnevaluatedItems from "@theme/JSONSchemaViewer/JSONSchemaElements/array/UnevaluatedItems"

import { QualifierMessages } from "../../utils/index"
import { QualifierMessages } from "@theme/JSONSchemaViewer/utils/index"

import { useJSVOptionsContext } from "../../contexts/index"
import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts/index"

import { ArrayLabel, TypeLabel } from "../../labels/index"
import { ArrayLabel, TypeLabel } from "@theme/JSONSchemaViewer/labels/index"

import { CreateDescription } from "../index"
import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements/index"

import type { JSONSchemaNS } from "../../types"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
schema: JSONSchemaNS.Array
Expand Down
4 changes: 2 additions & 2 deletions src/theme/JSONSchemaViewer/JSONSchemaElements/array/Items.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react"
import Translate from "@docusaurus/Translate"

import { CreateEdge } from "../../components/index"
import { CreateEdge } from "@theme/JSONSchemaViewer/components/index"

import type { JSONSchemaNS } from "../../types"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
[x: string]: any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react"
import Translate from "@docusaurus/Translate"

import { CreateEdge } from "../../components/index"
import { CreateEdge } from "@theme/JSONSchemaViewer/components/index"

import type { JSONSchema, JSONSchemaNS } from "../../types"
import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
[x: string]: any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react"
import Translate from "@docusaurus/Translate"

import { CreateEdge } from "../../components/index"
import { CreateEdge } from "@theme/JSONSchemaViewer/components/index"

import type { JSONSchemaNS } from "../../types"
import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types"

type Props = {
[x: string]: any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// The main function that will be imported
export { default as CreateArray } from "./CreateArray"
export { default as CreateArray } from "@theme/JSONSchemaViewer/JSONSchemaElements/array/CreateArray"
Loading

0 comments on commit ff933fc

Please sign in to comment.