1
1
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:
Aya Morisawa 2019-01-30 16:56:27 +09:00
parent 1c60a49c96
commit 28bfb45426
No known key found for this signature in database
GPG Key ID: 3E64865D70D579F2
18 changed files with 26 additions and 28 deletions

View File

@ -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';

View File

@ -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({

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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({

View File

@ -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);

View File

@ -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));
}

View File

@ -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;

View File

@ -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>`;
};
}

View File

@ -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);

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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');

View File

@ -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';

View File

@ -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', () => {

View File

@ -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';