mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-11-24 07:06:26 +09:00
Avoid export default
This commit is contained in:
parent
1c60a49c96
commit
28bfb45426
@ -1,4 +1,4 @@
|
||||
import parse from '../../../../mfm/parse';
|
||||
import { parse } from '../../../../mfm/parse';
|
||||
import { sum, unique } from '../../../../prelude/array';
|
||||
import shouldMuteNote from './should-mute-note';
|
||||
import MkNoteMenu from '../views/components/note-menu.vue';
|
||||
|
@ -34,7 +34,7 @@
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import i18n from '../../../i18n';
|
||||
import parse from '../../../../../mfm/parse';
|
||||
import { parse } from '../../../../../mfm/parse';
|
||||
import { unique } from '../../../../../prelude/array';
|
||||
|
||||
export default Vue.extend({
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Vue, { VNode } from 'vue';
|
||||
import { length } from 'stringz';
|
||||
import { MfmForest } from '../../../../../mfm/types';
|
||||
import parse, { parsePlain } from '../../../../../mfm/parse';
|
||||
import { parse, parsePlain } from '../../../../../mfm/parse';
|
||||
import MkUrl from './url.vue';
|
||||
import MkMention from './mention.vue';
|
||||
import { concat, sum } from '../../../../../prelude/array';
|
||||
|
@ -68,7 +68,7 @@ import insertTextAtCursor from 'insert-text-at-cursor';
|
||||
import * as XDraggable from 'vuedraggable';
|
||||
import getFace from '../../../common/scripts/get-face';
|
||||
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
|
||||
import parse from '../../../../../mfm/parse';
|
||||
import { parse } from '../../../../../mfm/parse';
|
||||
import { host } from '../../../config';
|
||||
import { erase, unique } from '../../../../../prelude/array';
|
||||
import { length } from 'stringz';
|
||||
|
@ -60,7 +60,7 @@ import insertTextAtCursor from 'insert-text-at-cursor';
|
||||
import * as XDraggable from 'vuedraggable';
|
||||
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
|
||||
import getFace from '../../../common/scripts/get-face';
|
||||
import parse from '../../../../../mfm/parse';
|
||||
import { parse } from '../../../../../mfm/parse';
|
||||
import { host } from '../../../config';
|
||||
import { erase, unique } from '../../../../../prelude/array';
|
||||
import { length } from 'stringz';
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import parse from '../../../../mfm/parse';
|
||||
import { parse } from '../../../../mfm/parse';
|
||||
import * as JSON5 from 'json5';
|
||||
|
||||
export default Vue.extend({
|
||||
|
@ -1,7 +1,7 @@
|
||||
const parse5 = require('parse5');
|
||||
import { URL } from 'url';
|
||||
|
||||
export default function(html: string): string {
|
||||
export function fromHtml(html: string): string {
|
||||
if (html == null) return null;
|
||||
|
||||
const dom = parse5.parseFragment(html);
|
||||
|
@ -1,19 +1,19 @@
|
||||
import parser from './parser';
|
||||
import { mfmLanguage } from './parser';
|
||||
import { MfmForest } from './types';
|
||||
import { normalize } from './normalize';
|
||||
|
||||
export default (source: string): MfmForest => {
|
||||
export function parse(source: string): MfmForest {
|
||||
if (source == null || source == '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return normalize(parser.root.tryParse(source));
|
||||
};
|
||||
return normalize(mfmLanguage.root.tryParse(source));
|
||||
}
|
||||
|
||||
export function parsePlain(source: string): MfmForest {
|
||||
if (source == null || source == '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return normalize(parser.plain.tryParse(source));
|
||||
return normalize(mfmLanguage.plain.tryParse(source));
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ const newline = P((input, i) => {
|
||||
}
|
||||
});
|
||||
|
||||
const mfm = P.createLanguage({
|
||||
export const mfmLanguage = P.createLanguage({
|
||||
root: r => P.alt(
|
||||
r.big,
|
||||
r.small,
|
||||
@ -413,5 +413,3 @@ const mfm = P.createLanguage({
|
||||
.map(x => createLeaf('url', { url: x })),
|
||||
//#endregion
|
||||
});
|
||||
|
||||
export default mfm;
|
||||
|
@ -5,7 +5,7 @@ import { INote } from '../models/note';
|
||||
import { intersperse } from '../prelude/array';
|
||||
import { MfmForest, MfmTree } from './types';
|
||||
|
||||
export default (tokens: MfmForest, mentionedRemoteUsers: INote['mentionedRemoteUsers'] = []) => {
|
||||
export function toHtml(tokens: MfmForest, mentionedRemoteUsers: INote['mentionedRemoteUsers'] = []) {
|
||||
if (tokens == null) {
|
||||
return null;
|
||||
}
|
||||
@ -184,4 +184,4 @@ export default (tokens: MfmForest, mentionedRemoteUsers: INote['mentionedRemoteU
|
||||
appendChildren(tokens, doc.body);
|
||||
|
||||
return `<p>${doc.body.innerHTML}</p>`;
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { INote } from '../../../models/note';
|
||||
import toHtml from '../../../mfm/toHtml';
|
||||
import parse from '../../../mfm/parse';
|
||||
import { toHtml } from '../../../mfm/toHtml';
|
||||
import { parse } from '../../../mfm/parse';
|
||||
|
||||
export default function(note: INote) {
|
||||
let html = toHtml(parse(note.text), note.mentionedRemoteUsers);
|
||||
|
@ -9,7 +9,7 @@ import { INote as INoteActivityStreamsObject, IObject } from '../type';
|
||||
import { resolvePerson, updatePerson } from './person';
|
||||
import { resolveImage } from './image';
|
||||
import { IRemoteUser, IUser } from '../../../models/user';
|
||||
import fromHtml from '../../../mfm/fromHtml';
|
||||
import { fromHtml } from '../../../mfm/fromHtml';
|
||||
import Emoji, { IEmoji } from '../../../models/emoji';
|
||||
import { ITag } from './tag';
|
||||
import { toUnicode } from 'punycode';
|
||||
|
@ -9,7 +9,7 @@ import { resolveImage } from './image';
|
||||
import { isCollectionOrOrderedCollection, isCollection, IPerson } from '../type';
|
||||
import { IDriveFile } from '../../../models/drive-file';
|
||||
import Meta from '../../../models/meta';
|
||||
import fromHtml from '../../../mfm/fromHtml';
|
||||
import { fromHtml } from '../../../mfm/fromHtml';
|
||||
import usersChart from '../../../chart/users';
|
||||
import { URL } from 'url';
|
||||
import { resolveNote, extractEmojis } from './note';
|
||||
|
@ -2,8 +2,8 @@ import renderImage from './image';
|
||||
import renderKey from './key';
|
||||
import config from '../../../config';
|
||||
import { ILocalUser } from '../../../models/user';
|
||||
import toHtml from '../../../mfm/toHtml';
|
||||
import parse from '../../../mfm/parse';
|
||||
import { toHtml } from '../../../mfm/toHtml';
|
||||
import { parse } from '../../../mfm/parse';
|
||||
import DriveFile from '../../../models/drive-file';
|
||||
import { getEmojis } from './note';
|
||||
import renderEmoji from './emoji';
|
||||
|
@ -6,7 +6,7 @@ import acceptAllFollowRequests from '../../../../services/following/requests/acc
|
||||
import { publishToFollowers } from '../../../../services/i/update';
|
||||
import define from '../../define';
|
||||
import getDriveFileUrl from '../../../../misc/get-drive-file-url';
|
||||
import parse, { parsePlain } from '../../../../mfm/parse';
|
||||
import { parse, parsePlain } from '../../../../mfm/parse';
|
||||
import extractEmojis from '../../../../misc/extract-emojis';
|
||||
const langmap = require('langmap');
|
||||
|
||||
|
@ -13,7 +13,7 @@ import notify from '../../notify';
|
||||
import NoteWatching from '../../models/note-watching';
|
||||
import watch from './watch';
|
||||
import Mute from '../../models/mute';
|
||||
import parse from '../../mfm/parse';
|
||||
import { parse } from '../../mfm/parse';
|
||||
import { IApp } from '../../models/app';
|
||||
import UserList from '../../models/user-list';
|
||||
import resolveUser from '../../remote/resolve-user';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as assert from 'assert';
|
||||
|
||||
import extractMentions from '../src/misc/extract-mentions';
|
||||
import parse from '../src/mfm/parse';
|
||||
import { parse } from '../src/mfm/parse';
|
||||
|
||||
describe('Extract mentions', () => {
|
||||
it('simple', () => {
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
|
||||
import parse, { parsePlain } from '../src/mfm/parse';
|
||||
import toHtml from '../src/mfm/toHtml';
|
||||
import { parse, parsePlain } from '../src/mfm/parse';
|
||||
import { toHtml } from '../src/mfm/toHtml';
|
||||
import { createTree as tree, createLeaf as leaf, MfmTree } from '../src/mfm/types';
|
||||
import { removeOrphanedBrackets } from '../src/mfm/parser';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user