diff --git a/commons/src/frontmatter-extractor/index.ts b/commons/src/frontmatter-extractor/index.ts new file mode 100644 index 000000000..82645914d --- /dev/null +++ b/commons/src/frontmatter-extractor/index.ts @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export * from './extractor.js' +export * from './types.js' diff --git a/commons/src/index.ts b/commons/src/index.ts index 14fe1fbea..d6a3281c6 100644 --- a/commons/src/index.ts +++ b/commons/src/index.ts @@ -4,40 +4,11 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -export * from './message-transporters/mocked-backend-message-transporter.js' -export * from './message-transporters/message.js' -export * from './message-transporters/message-transporter.js' -export * from './message-transporters/realtime-user.js' -export * from './message-transporters/websocket-transporter.js' - -export { parseUrl } from './utils/parse-url.js' -export { - MissingTrailingSlashError, - WrongProtocolError -} from './utils/errors.js' -export * from './utils/permissions.js' -export * from './utils/permissions.types.js' - -export * from './y-doc-sync/y-doc-sync-client-adapter.js' -export * from './y-doc-sync/y-doc-sync-server-adapter.js' -export * from './y-doc-sync/y-doc-sync-adapter.js' -export * from './y-doc-sync/realtime-doc.js' - -export { waitForOtherPromisesToFinish } from './utils/wait-for-other-promises-to-finish.js' - -export * from './frontmatter-extractor/extractor.js' -export * from './frontmatter-extractor/types.js' - -export * from './note-frontmatter-parser/parse-raw-frontmatter-from-yaml.js' -export * from './note-frontmatter-parser/convert-raw-frontmatter-to-note-frontmatter.js' -export * from './note-frontmatter-parser/default-values.js' -export * from './note-frontmatter-parser/parse-tags.js' -export * from './note-frontmatter-parser/types.js' - -export * from './note-frontmatter/iso6391.js' -export * from './note-frontmatter/frontmatter.js' -export * from './note-frontmatter/slide-show-options.js' - -export * from './title-extraction/generate-note-title.js' - -export { extractFirstHeading } from './title-extraction/extract-first-heading.js' +export * from './frontmatter-extractor/index.js' +export * from './message-transporters/index.js' +export * from './note-frontmatter/index.js' +export * from './note-frontmatter-parser/index.js' +export * from './parse-url/index.js' +export * from './permissions/index.js' +export * from './title-extraction/index.js' +export * from './y-doc-sync/index.js' diff --git a/commons/src/message-transporters/index.ts b/commons/src/message-transporters/index.ts new file mode 100644 index 000000000..f8cbd8c27 --- /dev/null +++ b/commons/src/message-transporters/index.ts @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export * from './mocked-backend-message-transporter.js' +export * from './message.js' +export * from './message-transporter.js' +export * from './realtime-user.js' +export * from './websocket-transporter.js' diff --git a/commons/src/note-frontmatter-parser/convert-raw-frontmatter-to-note-frontmatter.ts b/commons/src/note-frontmatter-parser/convert-raw-frontmatter-to-note-frontmatter.ts index 2245bb0ce..234504375 100644 --- a/commons/src/note-frontmatter-parser/convert-raw-frontmatter-to-note-frontmatter.ts +++ b/commons/src/note-frontmatter-parser/convert-raw-frontmatter-to-note-frontmatter.ts @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import { NoteFrontmatter } from '../note-frontmatter/frontmatter.js' +import { NoteFrontmatter } from '../note-frontmatter/index.js' import { parseTags } from './parse-tags.js' import { RawNoteFrontmatter } from './types.js' diff --git a/commons/src/note-frontmatter-parser/index.ts b/commons/src/note-frontmatter-parser/index.ts new file mode 100644 index 000000000..e207ee8a9 --- /dev/null +++ b/commons/src/note-frontmatter-parser/index.ts @@ -0,0 +1,10 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export * from './parse-raw-frontmatter-from-yaml.js' +export * from './convert-raw-frontmatter-to-note-frontmatter.js' +export * from './parse-tags.js' +export * from './types.js' diff --git a/commons/src/note-frontmatter-parser/parse-raw-frontmatter-from-yaml.ts b/commons/src/note-frontmatter-parser/parse-raw-frontmatter-from-yaml.ts index 322856250..b7f87e8df 100644 --- a/commons/src/note-frontmatter-parser/parse-raw-frontmatter-from-yaml.ts +++ b/commons/src/note-frontmatter-parser/parse-raw-frontmatter-from-yaml.ts @@ -3,14 +3,14 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ +import { defaultNoteFrontmatter } from '../note-frontmatter/index.js' import { NoteTextDirection, NoteType, OpenGraph -} from '../note-frontmatter/frontmatter.js' +} from '../note-frontmatter/index.js' +import { SlideOptions } from '../note-frontmatter/index.js' import { ISO6391 } from '../note-frontmatter/iso6391.js' -import { SlideOptions } from '../note-frontmatter/slide-show-options.js' -import { defaultNoteFrontmatter } from './default-values.js' import type { RawNoteFrontmatter } from './types.js' import type { ValidationError } from 'joi' import Joi from 'joi' diff --git a/commons/src/note-frontmatter-parser/types.ts b/commons/src/note-frontmatter-parser/types.ts index 8c6f5313f..f4b07e8d8 100644 --- a/commons/src/note-frontmatter-parser/types.ts +++ b/commons/src/note-frontmatter-parser/types.ts @@ -8,8 +8,8 @@ import { NoteTextDirection, NoteType, OpenGraph -} from '../note-frontmatter/frontmatter.js' -import { SlideOptions } from '../note-frontmatter/slide-show-options.js' +} from '../note-frontmatter/index.js' +import { SlideOptions } from '../note-frontmatter/index.js' export interface RawNoteFrontmatter { title: string diff --git a/commons/src/note-frontmatter-parser/default-values.ts b/commons/src/note-frontmatter/default-values.ts similarity index 76% rename from commons/src/note-frontmatter-parser/default-values.ts rename to commons/src/note-frontmatter/default-values.ts index 21874db5b..2b9479461 100644 --- a/commons/src/note-frontmatter-parser/default-values.ts +++ b/commons/src/note-frontmatter/default-values.ts @@ -3,12 +3,8 @@ * * SPDX-License-Identifier: AGPL-3.0-only */ -import { - NoteFrontmatter, - NoteTextDirection, - NoteType -} from '../note-frontmatter/frontmatter.js' -import { SlideOptions } from '../note-frontmatter/slide-show-options.js' +import { NoteFrontmatter, NoteTextDirection, NoteType } from './frontmatter.js' +import { SlideOptions } from './slide-show-options.js' export const defaultSlideOptions: SlideOptions = { transition: 'zoom', diff --git a/commons/src/note-frontmatter/index.ts b/commons/src/note-frontmatter/index.ts new file mode 100644 index 000000000..82311938d --- /dev/null +++ b/commons/src/note-frontmatter/index.ts @@ -0,0 +1,10 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export * from './iso6391.js' +export * from './frontmatter.js' +export * from './slide-show-options.js' +export * from './default-values.js' diff --git a/commons/src/utils/errors.ts b/commons/src/parse-url/errors.ts similarity index 100% rename from commons/src/utils/errors.ts rename to commons/src/parse-url/errors.ts diff --git a/commons/src/parse-url/index.ts b/commons/src/parse-url/index.ts new file mode 100644 index 000000000..84629aa6b --- /dev/null +++ b/commons/src/parse-url/index.ts @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export { parseUrl } from './parse-url.js' +export { MissingTrailingSlashError, WrongProtocolError } from './errors.js' diff --git a/commons/src/utils/parse-url.spec.ts b/commons/src/parse-url/parse-url.spec.ts similarity index 100% rename from commons/src/utils/parse-url.spec.ts rename to commons/src/parse-url/parse-url.spec.ts diff --git a/commons/src/utils/parse-url.ts b/commons/src/parse-url/parse-url.ts similarity index 100% rename from commons/src/utils/parse-url.ts rename to commons/src/parse-url/parse-url.ts diff --git a/commons/src/permissions/index.ts b/commons/src/permissions/index.ts new file mode 100644 index 000000000..c2b4c88db --- /dev/null +++ b/commons/src/permissions/index.ts @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export * from './permissions.js' +export * from './permissions.types.js' diff --git a/commons/src/utils/permissions.spec.ts b/commons/src/permissions/permissions.spec.ts similarity index 100% rename from commons/src/utils/permissions.spec.ts rename to commons/src/permissions/permissions.spec.ts diff --git a/commons/src/utils/permissions.ts b/commons/src/permissions/permissions.ts similarity index 100% rename from commons/src/utils/permissions.ts rename to commons/src/permissions/permissions.ts diff --git a/commons/src/utils/permissions.types.ts b/commons/src/permissions/permissions.types.ts similarity index 100% rename from commons/src/utils/permissions.types.ts rename to commons/src/permissions/permissions.types.ts diff --git a/commons/src/title-extraction/index.ts b/commons/src/title-extraction/index.ts new file mode 100644 index 000000000..fd87a7dfa --- /dev/null +++ b/commons/src/title-extraction/index.ts @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export * from './generate-note-title.js' +export * from './extract-first-heading.js' diff --git a/commons/src/utils/wait-for-other-promises-to-finish.ts b/commons/src/utils/wait-for-other-promises-to-finish.ts deleted file mode 100644 index 1cda0349e..000000000 --- a/commons/src/utils/wait-for-other-promises-to-finish.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ - -/** - * Waits until all other pending promises are processed. - * - * NodeJS has a queue for async code that waits for being processed. This method adds a promise to the very end of this queue. - * If the promise is resolved then this means that all other promises before it have been processed as well. - * - * @return A promise which resolves when all other promises have been processed - */ -export function waitForOtherPromisesToFinish(): Promise { - return new Promise((resolve) => process.nextTick(resolve)) -} diff --git a/commons/src/y-doc-sync/index.ts b/commons/src/y-doc-sync/index.ts new file mode 100644 index 000000000..72c76aa79 --- /dev/null +++ b/commons/src/y-doc-sync/index.ts @@ -0,0 +1,9 @@ +/* + * SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file) + * + * SPDX-License-Identifier: AGPL-3.0-only + */ +export * from './y-doc-sync-client-adapter.js' +export * from './y-doc-sync-server-adapter.js' +export * from './y-doc-sync-adapter.js' +export * from './realtime-doc.js' diff --git a/commons/types/reveal.d.ts b/commons/types/reveal.d.ts index aa2b23ee8..e465d4f3d 100644 --- a/commons/types/reveal.d.ts +++ b/commons/types/reveal.d.ts @@ -122,7 +122,7 @@ declare module 'reveal.js' { export interface Plugin { id: string - init(deck: RevealStatic): void | Promise + init(deck: Reveal): void | Promise } export default class Reveal { diff --git a/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.spec.tsx b/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.spec.tsx index d32aff7d7..411cb7e79 100644 --- a/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.spec.tsx +++ b/frontend/src/components/common/note-loading-boundary/create-non-existing-note-hint.spec.tsx @@ -8,10 +8,13 @@ import type { Note, NoteMetadata } from '../../../api/notes/types' import * as useSingleStringUrlParameterModule from '../../../hooks/common/use-single-string-url-parameter' import { mockI18n } from '../../../test-utils/mock-i18n' import { CreateNonExistingNoteHint } from './create-non-existing-note-hint' -import { waitForOtherPromisesToFinish } from '@hedgedoc/commons' import { act, render, screen, waitFor } from '@testing-library/react' import { Mock } from 'ts-mockery' +function waitForOtherPromisesToFinish(): Promise { + return new Promise((resolve) => process.nextTick(resolve)) +} + jest.mock('../../../api/notes') jest.mock('../../../hooks/common/use-single-string-url-parameter') diff --git a/frontend/src/external-types/reveal.js/index.d.ts b/frontend/src/external-types/reveal.js/index.d.ts index 2ecd5b700..a40b608e9 100644 --- a/frontend/src/external-types/reveal.js/index.d.ts +++ b/frontend/src/external-types/reveal.js/index.d.ts @@ -122,7 +122,7 @@ declare module 'reveal.js' { export interface Plugin { id: string - init(deck: RevealStatic): void | Promise + init(deck: Reveal): void | Promise } export default class Reveal {