mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 09:16:30 -05:00
refactor: reorganize files in commons package
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
c9b98f6185
commit
4d9792bcb9
23 changed files with 94 additions and 69 deletions
8
commons/src/frontmatter-extractor/index.ts
Normal file
8
commons/src/frontmatter-extractor/index.ts
Normal file
|
@ -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'
|
|
@ -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'
|
||||
|
|
11
commons/src/message-transporters/index.ts
Normal file
11
commons/src/message-transporters/index.ts
Normal file
|
@ -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'
|
|
@ -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'
|
||||
|
||||
|
|
10
commons/src/note-frontmatter-parser/index.ts
Normal file
10
commons/src/note-frontmatter-parser/index.ts
Normal file
|
@ -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'
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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',
|
10
commons/src/note-frontmatter/index.ts
Normal file
10
commons/src/note-frontmatter/index.ts
Normal file
|
@ -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'
|
8
commons/src/parse-url/index.ts
Normal file
8
commons/src/parse-url/index.ts
Normal file
|
@ -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'
|
8
commons/src/permissions/index.ts
Normal file
8
commons/src/permissions/index.ts
Normal file
|
@ -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'
|
8
commons/src/title-extraction/index.ts
Normal file
8
commons/src/title-extraction/index.ts
Normal file
|
@ -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'
|
|
@ -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<void> {
|
||||
return new Promise((resolve) => process.nextTick(resolve))
|
||||
}
|
9
commons/src/y-doc-sync/index.ts
Normal file
9
commons/src/y-doc-sync/index.ts
Normal file
|
@ -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'
|
2
commons/types/reveal.d.ts
vendored
2
commons/types/reveal.d.ts
vendored
|
@ -122,7 +122,7 @@ declare module 'reveal.js' {
|
|||
export interface Plugin {
|
||||
id: string
|
||||
|
||||
init(deck: RevealStatic): void | Promise<void>
|
||||
init(deck: Reveal): void | Promise<void>
|
||||
}
|
||||
|
||||
export default class Reveal {
|
||||
|
|
|
@ -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<void> {
|
||||
return new Promise((resolve) => process.nextTick(resolve))
|
||||
}
|
||||
|
||||
jest.mock('../../../api/notes')
|
||||
jest.mock('../../../hooks/common/use-single-string-url-parameter')
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ declare module 'reveal.js' {
|
|||
export interface Plugin {
|
||||
id: string
|
||||
|
||||
init(deck: RevealStatic): void | Promise<void>
|
||||
init(deck: Reveal): void | Promise<void>
|
||||
}
|
||||
|
||||
export default class Reveal {
|
||||
|
|
Loading…
Reference in a new issue