From 014b58cb4098c31c1d0d8d2ad521e48368491d07 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Sun, 3 Feb 2019 22:21:36 +0900 Subject: Create new type definition for 'is-url' (#4013) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Create new type definition for 'is-url' * [Client] Resolve #3638 * 10.79.1 * New translations ja-JP.yml (Korean) * Add missing semicolon * Remove file-loader from dependencies (#4025) * Update README.md [AUTOGEN] (#4028) * Update README.md [AUTOGEN] (#4030) * Add visibility test (#4029) * Update ws requirement from 6.1.2 to 6.1.3 (#4027) Updates the requirements on [ws](https://github.com/websockets/ws) to permit the latest version. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/commits/6.1.3) Signed-off-by: dependabot[bot] * Module 'web-push' as import syntax (#4017) * Fix visibility test (#4031) * Upgrade gulp version to 4.0.0 * Prevent typescript errors from crashing * Remove duplicated dependencies * Use parallel and task to specify dependencies * Sort tasks by topological ordering * リプライ/メンションされていれば非フォロワーへのフォロワー限定でも参照可能に (#4033) * 非メンション/リプライ投稿がmentionsにあるかどうかはvisibilityと関係ないので削除 * リプライ/メンションされていれば非フォロワーでも参照可能に * New translations ja-JP.yml (Chinese Simplified) * New translations ja-JP.yml (Chinese Simplified) * Fix #4034 (#4037) * Fix #4034 * improve * Module 'crypto' as import syntax (#4011) * Extract MFM normalize function * Extract MFM types * Rename html to toHtml * Rename html-to-mfm to fromHtml * Merge plainParser into mfm * Extract parsePlain function * Rename analyze to parse in MFM tests * Update @types/mongodb requirement from 3.1.18 to 3.1.19 (#4041) Updates the requirements on [@types/mongodb](https://github.com/DefinitelyTyped/DefinitelyTyped) to permit the latest version. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits) Signed-off-by: dependabot[bot] * Update vue-svg-inline-loader requirement from 1.2.7 to 1.2.10 (#4040) Updates the requirements on [vue-svg-inline-loader](https://github.com/oliverfindl/vue-svg-inline-loader) to permit the latest version. - [Release notes](https://github.com/oliverfindl/vue-svg-inline-loader/releases) - [Commits](https://github.com/oliverfindl/vue-svg-inline-loader/commits/v1.2.10) Signed-off-by: dependabot[bot] * Avoid export default * Rename parser to language * Fix import * Introduce silence (#4043) * Introduce silence * Fix icon * delete unnecessary key (#4045) * delete unnecessary key * Add note * Update CHANGELOG.md * [ActivityPub] Use microformats on mentions To avoid pointless link previews. see: https://misskey.xyz/notes/5c51ab5c2d85f2003248eddc * Create type definition for '*/package.json' (#4014) * Create type definition for '*/package.json' * Update tsconfig.json * Update index.ts * Create type definition for 'is-root' (#4001) * Update @types/sharp requirement from 0.21.0 to 0.21.1 Updates the requirements on [@types/sharp](https://github.com/DefinitelyTyped/DefinitelyTyped) to permit the latest version. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits) Signed-off-by: dependabot[bot] * Add multiline math syntax Co-authored-by: syuilo * New translations ja-JP.yml (Catalan) * New translations ja-JP.yml (Chinese Simplified) * New translations ja-JP.yml (English) * New translations ja-JP.yml (French) * New translations ja-JP.yml (German) * New translations ja-JP.yml (Italian) * New translations ja-JP.yml (Korean) * New translations ja-JP.yml (Polish) * New translations ja-JP.yml (Portuguese) * New translations ja-JP.yml (Russian) * New translations ja-JP.yml (Spanish) * New translations ja-JP.yml (Japanese, Kansai) * New translations ja-JP.yml (Dutch) * New translations ja-JP.yml (Norwegian) * New translations ja-JP.yml (English) * Create type definition for 'is-root' * [MFM] Add spin syntax Resolve #4003 * [MFM] Add flip syntax Resolve #4002 * Fix test * Update CHANGELOG.md * 10.79.0 * Update @fortawesome/free-regular-svg-icons requirement (#3963) Updates the requirements on [@fortawesome/free-regular-svg-icons](https://github.com/FortAwesome/Font-Awesome) to permit the latest version. - [Release notes](https://github.com/FortAwesome/Font-Awesome/releases) - [Changelog](https://github.com/FortAwesome/Font-Awesome/blob/master/CHANGELOG.md) - [Commits](https://github.com/FortAwesome/Font-Awesome/commits/5.6.3) Signed-off-by: dependabot[bot] * Update @types/webpack requirement from 4.4.21 to 4.4.24 (#3976) Updates the requirements on [@types/webpack](https://github.com/DefinitelyTyped/DefinitelyTyped) to permit the latest version. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits) Signed-off-by: dependabot[bot] * Update @types/js-yaml requirement from 3.11.4 to 3.12.0 (#3977) Updates the requirements on [@types/js-yaml](https://github.com/DefinitelyTyped/DefinitelyTyped) to permit the latest version. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits) Signed-off-by: dependabot[bot] * Update debug requirement from 4.1.0 to 4.1.1 (#3964) Updates the requirements on [debug](https://github.com/visionmedia/debug) to permit the latest version. - [Release notes](https://github.com/visionmedia/debug/releases) - [Commits](https://github.com/visionmedia/debug/commits/4.1.1) Signed-off-by: dependabot[bot] * New translations ja-JP.yml (Korean) * New translations ja-JP.yml (Korean) * New translations ja-JP.yml (French) * [MFM] spinの中でflipを使えるように * Add jump syntax (#4007) * Add jump syntax * Fix typo: spin -> jump * Fix typo * [MFM] Resolve #4009 * Module 'nprogress' as import syntax (#4012) * :art: * [Client] Fix #4008 * Use yarn instead of npm on CircleCI * touch yarn.lock * [Client] Resolve #3638 * 10.79.1 * New translations ja-JP.yml (Korean) * Add missing semicolon * Remove file-loader from dependencies (#4025) * Update README.md [AUTOGEN] (#4028) * Update README.md [AUTOGEN] (#4030) * Add visibility test (#4029) * Update ws requirement from 6.1.2 to 6.1.3 (#4027) Updates the requirements on [ws](https://github.com/websockets/ws) to permit the latest version. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/commits/6.1.3) Signed-off-by: dependabot[bot] * Module 'web-push' as import syntax (#4017) * Fix visibility test (#4031) * Upgrade gulp version to 4.0.0 * Prevent typescript errors from crashing * Remove duplicated dependencies * Use parallel and task to specify dependencies * Sort tasks by topological ordering * リプライ/メンションされていれば非フォロワーへのフォロワー限定でも参照可能に (#4033) * 非メンション/リプライ投稿がmentionsにあるかどうかはvisibilityと関係ないので削除 * リプライ/メンションされていれば非フォロワーでも参照可能に * New translations ja-JP.yml (Chinese Simplified) * New translations ja-JP.yml (Chinese Simplified) * Fix #4034 (#4037) * Fix #4034 * improve * Module 'crypto' as import syntax (#4011) * Extract MFM normalize function * Extract MFM types * Rename html to toHtml * Rename html-to-mfm to fromHtml * Merge plainParser into mfm * Extract parsePlain function * Rename analyze to parse in MFM tests * Update @types/mongodb requirement from 3.1.18 to 3.1.19 (#4041) Updates the requirements on [@types/mongodb](https://github.com/DefinitelyTyped/DefinitelyTyped) to permit the latest version. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits) Signed-off-by: dependabot[bot] * Update vue-svg-inline-loader requirement from 1.2.7 to 1.2.10 (#4040) Updates the requirements on [vue-svg-inline-loader](https://github.com/oliverfindl/vue-svg-inline-loader) to permit the latest version. - [Release notes](https://github.com/oliverfindl/vue-svg-inline-loader/releases) - [Commits](https://github.com/oliverfindl/vue-svg-inline-loader/commits/v1.2.10) Signed-off-by: dependabot[bot] * Avoid export default * Rename parser to language * Fix import * Introduce silence (#4043) * Introduce silence * Fix icon * Update is-root.d.ts * Update index.ts * Create type definition for 'is-root' * Update is-root.d.ts * Update index.ts * Fix path refs: 7e3a8d56e614a1771015b6b2557fea8127c46aeb * Re-fix path refs: 4bb4903ee513bacf79d475e100019bd3058d9b34, 7e3a8d56e614a1771015b6b2557fea8127c46aeb * Do not import as pack from AP renderer (#4048) * Do not import as pack from AP renderer * rename * Simplify MFM (#4046) * [MFM] Make some syntax block Resolve #3508 * [MFM] Better syntax parsing Allow nesting by same tag * [Client] MFMの制限を緩和 * :art: * Update CHANGELOG.md * 10.80.0 * Update is-url.d.ts --- src/@types/is-url.d.ts | 7 +++++++ src/config/load.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/@types/is-url.d.ts (limited to 'src') diff --git a/src/@types/is-url.d.ts b/src/@types/is-url.d.ts new file mode 100644 index 0000000000..c1ccadd498 --- /dev/null +++ b/src/@types/is-url.d.ts @@ -0,0 +1,7 @@ +declare module 'is-url' { + function isUrl(string: string): boolean; + + namespace isUrl {} // Hack + + export = isUrl; +} diff --git a/src/config/load.ts b/src/config/load.ts index ba8b4af3ce..57cfb8075c 100644 --- a/src/config/load.ts +++ b/src/config/load.ts @@ -6,7 +6,7 @@ import * as fs from 'fs'; import { URL } from 'url'; import * as yaml from 'js-yaml'; import { Source, Mixin } from './types'; -import isUrl = require('is-url'); +import * as isUrl from 'is-url'; import * as pkg from '../../package.json'; /** -- cgit v1.2.3-freya From ceda3dd72a5b4ebe01500d0a5e76a58699c878bc Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Sun, 3 Feb 2019 22:21:47 +0900 Subject: Create new type definition for 'escape-regexp' (#4058) --- src/@types/escape-regexp.d.ts | 7 +++++++ src/server/api/endpoints/hashtags/search.ts | 2 +- src/server/api/endpoints/users/search.ts | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 src/@types/escape-regexp.d.ts (limited to 'src') diff --git a/src/@types/escape-regexp.d.ts b/src/@types/escape-regexp.d.ts new file mode 100644 index 0000000000..d68e6048a1 --- /dev/null +++ b/src/@types/escape-regexp.d.ts @@ -0,0 +1,7 @@ +declare module 'escape-regexp' { + function escapeRegExp(str: string): string; + + namespace escapeRegExp {} // Hack + + export = escapeRegExp; +} diff --git a/src/server/api/endpoints/hashtags/search.ts b/src/server/api/endpoints/hashtags/search.ts index 4d753808d4..d8a2156357 100644 --- a/src/server/api/endpoints/hashtags/search.ts +++ b/src/server/api/endpoints/hashtags/search.ts @@ -1,7 +1,7 @@ import $ from 'cafy'; import Hashtag from '../../../../models/hashtag'; import define from '../../define'; -const escapeRegexp = require('escape-regexp'); +import * as escapeRegexp from 'escape-regexp'; export const meta = { desc: { diff --git a/src/server/api/endpoints/users/search.ts b/src/server/api/endpoints/users/search.ts index 86b16dcbb1..b0a789c7d5 100644 --- a/src/server/api/endpoints/users/search.ts +++ b/src/server/api/endpoints/users/search.ts @@ -1,5 +1,5 @@ import $ from 'cafy'; -const escapeRegexp = require('escape-regexp'); +import * as escapeRegexp from 'escape-regexp'; import User, { pack, validateUsername, IUser } from '../../../../models/user'; import define from '../../define'; -- cgit v1.2.3-freya From ce576dea8fe3356e919723f71d7ea09d378f3bea Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Sun, 3 Feb 2019 22:21:55 +0900 Subject: Create type definition for 'recaptcha-promise' (#4068) --- src/@types/recaptcha-promise.d.ts | 16 ++++++++++++++++ src/server/api/private/signup.ts | 3 +-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/@types/recaptcha-promise.d.ts (limited to 'src') diff --git a/src/@types/recaptcha-promise.d.ts b/src/@types/recaptcha-promise.d.ts new file mode 100644 index 0000000000..cfbd5eebf2 --- /dev/null +++ b/src/@types/recaptcha-promise.d.ts @@ -0,0 +1,16 @@ +declare module 'recaptcha-promise' { + interface IVerifyOptions { + secret_key?: string; + } + + interface IVerify { + (response: string, remoteAddress?: string): Promise; + init(options: IVerifyOptions): IVerify; + } + + namespace recaptchaPromise {} // Hack + + const verify: IVerify; + + export = verify; +} diff --git a/src/server/api/private/signup.ts b/src/server/api/private/signup.ts index b89629bcd1..6318eabdb8 100644 --- a/src/server/api/private/signup.ts +++ b/src/server/api/private/signup.ts @@ -8,14 +8,13 @@ import Meta from '../../../models/meta'; import RegistrationTicket from '../../../models/registration-tickets'; import usersChart from '../../../chart/users'; import fetchMeta from '../../../misc/fetch-meta'; +import * as recaptcha from 'recaptcha-promise'; export default async (ctx: Koa.BaseContext) => { const body = ctx.request.body as any; const instance = await fetchMeta(); - const recaptcha = require('recaptcha-promise'); - // Verify recaptcha // ただしテスト時はこの機構は障害となるため無効にする if (process.env.NODE_ENV !== 'test' && instance.enableRecaptcha) { -- cgit v1.2.3-freya From 5049870b6e2e8371509ac4984cc4f74674245d87 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Sun, 3 Feb 2019 23:01:03 +0900 Subject: Create type definition for 'koa-slow' (#4072) --- src/@types/koa-slow.d.ts | 14 ++++++++++++++ src/server/index.ts | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/@types/koa-slow.d.ts (limited to 'src') diff --git a/src/@types/koa-slow.d.ts b/src/@types/koa-slow.d.ts new file mode 100644 index 0000000000..bca6a8490b --- /dev/null +++ b/src/@types/koa-slow.d.ts @@ -0,0 +1,14 @@ +declare module 'koa-slow' { + import { Middleware } from 'koa'; + + interface ISlowOptions { + url?: RegExp + delay?: number + } + + function slow(options?: ISlowOptions): Middleware; + + namespace slow {} // Hack + + export = slow; +} diff --git a/src/server/index.ts b/src/server/index.ts index 57f1326f2f..be0a6f5c77 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -13,7 +13,7 @@ import * as mount from 'koa-mount'; import * as compress from 'koa-compress'; import * as koaLogger from 'koa-logger'; import * as requestStats from 'request-stats'; -//const slow = require('koa-slow'); +//import * as slow from 'koa-slow'; import activityPub from './activitypub'; import webFinger from './webfinger'; -- cgit v1.2.3-freya From fe13c17fcba8f3507e58adfaac181f77a63518ab Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Sun, 3 Feb 2019 23:41:05 +0900 Subject: Create type definition for 'langmap' (#4059) * Create type definition for 'langmap' * Follow lint --- src/@types/langmap.d.ts | 10 ++++++++++ src/server/api/endpoints/i/update.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/@types/langmap.d.ts (limited to 'src') diff --git a/src/@types/langmap.d.ts b/src/@types/langmap.d.ts new file mode 100644 index 0000000000..a0f99028ab --- /dev/null +++ b/src/@types/langmap.d.ts @@ -0,0 +1,10 @@ +declare module 'langmap' { + type Lang = { + nativeName: string; + englishName: string; + }; + + const langmap: { [lang: string]: Lang }; + + export = langmap; +} diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index 4b02e393bf..d087687a51 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -9,7 +9,7 @@ import getDriveFileUrl from '../../../../misc/get-drive-file-url'; import { parse, parsePlain } from '../../../../mfm/parse'; import extractEmojis from '../../../../misc/extract-emojis'; import extractHashtags from '../../../../misc/extract-hashtags'; -const langmap = require('langmap'); +import * as langmap from 'langmap'; export const meta = { desc: { -- cgit v1.2.3-freya From 893a3b527dbb4364ef20b38efbd0d50df27e89b1 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Sun, 3 Feb 2019 23:41:27 +0900 Subject: Create type definition for 'os-utils' (#4050) --- src/@types/os-utils.d.ts | 30 ++++++++++++++++++++++++++++++ src/daemons/server-stats.ts | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/@types/os-utils.d.ts (limited to 'src') diff --git a/src/@types/os-utils.d.ts b/src/@types/os-utils.d.ts new file mode 100644 index 0000000000..390df17d39 --- /dev/null +++ b/src/@types/os-utils.d.ts @@ -0,0 +1,30 @@ +declare module 'os-utils' { + type FreeCommandCallback = (usedmem: number) => void; + + type HarddriveCallback = (total: number, free: number, used: number) => void; + + type GetProcessesCallback = (result: string) => void; + + type CPUCallback = (perc: number) => void; + + export function platform(): NodeJS.Platform; + export function cpuCount(): number; + export function sysUptime(): number; + export function processUptime(): number; + + export function freemem(): number; + export function totalmem(): number; + export function freememPercentage(): number; + export function freeCommand(callback: FreeCommandCallback): void; + + export function harddrive(callback: HarddriveCallback): void; + + export function getProcesses(callback: GetProcessesCallback): void; + export function getProcesses(nProcess: number, callback: GetProcessesCallback): void; + + export function allLoadavg(): string; + export function loadavg(_time?: number): number; + + export function cpuFree(callback: CPUCallback): void; + export function cpuUsage(callback: CPUCallback): void; +} diff --git a/src/daemons/server-stats.ts b/src/daemons/server-stats.ts index 6028277b25..b82f421779 100644 --- a/src/daemons/server-stats.ts +++ b/src/daemons/server-stats.ts @@ -3,7 +3,7 @@ import * as sysUtils from 'systeminformation'; import * as diskusage from 'diskusage'; import * as Deque from 'double-ended-queue'; import Xev from 'xev'; -const osUtils = require('os-utils'); +import * as osUtils from 'os-utils'; const ev = new Xev(); -- cgit v1.2.3-freya From 6e0c055fafca940f13893123fe2303394d48f498 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Sun, 3 Feb 2019 23:49:00 +0900 Subject: Module 'jsdom' as import syntax (#4016) --- package.json | 1 + src/mfm/toHtml.ts | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/package.json b/package.json index 8eb1cf9657..b480519f99 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "@types/is-root": "1.0.0", "@types/is-svg": "3.0.0", "@types/js-yaml": "3.12.0", + "@types/jsdom": "12.2.1", "@types/katex": "0.5.0", "@types/koa": "2.0.48", "@types/koa-bodyparser": "5.0.2", diff --git a/src/mfm/toHtml.ts b/src/mfm/toHtml.ts index 85e8c8a7fe..e67ccc5035 100644 --- a/src/mfm/toHtml.ts +++ b/src/mfm/toHtml.ts @@ -1,5 +1,4 @@ -const jsdom = require('jsdom'); -const { JSDOM } = jsdom; +import { JSDOM } from 'jsdom'; import config from '../config'; import { INote } from '../models/note'; import { intersperse } from '../prelude/array'; @@ -158,9 +157,9 @@ export function toHtml(tokens: MfmForest, mentionedRemoteUsers: INote['mentioned text(token) { const el = doc.createElement('span'); - const nodes = (token.node.props.text as string).split(/\r\n|\r|\n/).map(x => doc.createTextNode(x)); + const nodes = (token.node.props.text as string).split(/\r\n|\r|\n/).map(x => doc.createTextNode(x) as Node); - for (const x of intersperse('br', nodes)) { + for (const x of intersperse('br', nodes)) { el.appendChild(x === 'br' ? doc.createElement('br') : x); } -- cgit v1.2.3-freya From 8f2f4b6d2d64dd83643f958bb5863f40aa563e6a Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sun, 3 Feb 2019 23:52:46 +0900 Subject: Add missing semicolons --- src/@types/deepcopy.d.ts | 2 +- src/@types/koa-slow.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/@types/deepcopy.d.ts b/src/@types/deepcopy.d.ts index afeee51913..3eb08d5772 100644 --- a/src/@types/deepcopy.d.ts +++ b/src/@types/deepcopy.d.ts @@ -8,7 +8,7 @@ declare namespace deepcopy { valueType: DeepcopyCustomizerValueType) => T; interface DeepcopyOptions { - customizer: DeepcopyCustomizer + customizer: DeepcopyCustomizer; } export function deepcopy( diff --git a/src/@types/koa-slow.d.ts b/src/@types/koa-slow.d.ts index bca6a8490b..a7908d8607 100644 --- a/src/@types/koa-slow.d.ts +++ b/src/@types/koa-slow.d.ts @@ -2,13 +2,13 @@ declare module 'koa-slow' { import { Middleware } from 'koa'; interface ISlowOptions { - url?: RegExp - delay?: number + url?: RegExp; + delay?: number; } function slow(options?: ISlowOptions): Middleware; - namespace slow {} // Hack + namespace slow { } // Hack export = slow; } -- cgit v1.2.3-freya From c4f74913225cc92d4285b6da0182b0daf62ca404 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Mon, 4 Feb 2019 01:30:33 +0900 Subject: Revert "Create new type definition for 'is-url' (#4013)" This reverts commit 014b58cb4098c31c1d0d8d2ad521e48368491d07. --- package.json | 1 + src/@types/is-url.d.ts | 7 ------- src/config/load.ts | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 src/@types/is-url.d.ts (limited to 'src') diff --git a/package.json b/package.json index b480519f99..ad24a1ef19 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@types/gulp-util": "3.0.34", "@types/is-root": "1.0.0", "@types/is-svg": "3.0.0", + "@types/is-url": "1.2.28", "@types/js-yaml": "3.12.0", "@types/jsdom": "12.2.1", "@types/katex": "0.5.0", diff --git a/src/@types/is-url.d.ts b/src/@types/is-url.d.ts deleted file mode 100644 index c1ccadd498..0000000000 --- a/src/@types/is-url.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module 'is-url' { - function isUrl(string: string): boolean; - - namespace isUrl {} // Hack - - export = isUrl; -} diff --git a/src/config/load.ts b/src/config/load.ts index 57cfb8075c..ba8b4af3ce 100644 --- a/src/config/load.ts +++ b/src/config/load.ts @@ -6,7 +6,7 @@ import * as fs from 'fs'; import { URL } from 'url'; import * as yaml from 'js-yaml'; import { Source, Mixin } from './types'; -import * as isUrl from 'is-url'; +import isUrl = require('is-url'); import * as pkg from '../../package.json'; /** -- cgit v1.2.3-freya From 5891135ac17aa94bd9c20bf84d5afc1b6290fbec Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Mon, 4 Feb 2019 01:46:59 +0900 Subject: Create type definition for ./locales (#4117) --- locales/index.d.ts | 5 +++++ src/server/web/docs.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 locales/index.d.ts (limited to 'src') diff --git a/locales/index.d.ts b/locales/index.d.ts new file mode 100644 index 0000000000..4a9672c63f --- /dev/null +++ b/locales/index.d.ts @@ -0,0 +1,5 @@ +type Locale = { [key: string]: string }; + +declare const locales: { [lang: string]: Locale }; + +export default locales; diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index f823c308c2..1455abae78 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -16,7 +16,7 @@ import config from '../../config'; import { licenseHtml } from '../../misc/license'; const constants = require('../../const.json'); import endpoints from '../api/endpoints'; -const locales = require('../../../locales'); +import locales from '../../../locales'; import * as nestedProperty from 'nested-property'; function getLang(lang: string): string { -- cgit v1.2.3-freya From 99d8d0a484eca8901ea6f1d556d51411ddfd9209 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Mon, 4 Feb 2019 01:47:12 +0900 Subject: Create type definition for '*/const.json' (#4118) --- src/@types/const.json.d.ts | 3 +++ src/server/web/docs.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 src/@types/const.json.d.ts (limited to 'src') diff --git a/src/@types/const.json.d.ts b/src/@types/const.json.d.ts new file mode 100644 index 0000000000..40a96f2a2a --- /dev/null +++ b/src/@types/const.json.d.ts @@ -0,0 +1,3 @@ +declare module '*/const.json' { + const copyright: string; +} diff --git a/src/server/web/docs.ts b/src/server/web/docs.ts index 1455abae78..0597f50a9c 100644 --- a/src/server/web/docs.ts +++ b/src/server/web/docs.ts @@ -14,7 +14,7 @@ import * as glob from 'glob'; import * as yaml from 'js-yaml'; import config from '../../config'; import { licenseHtml } from '../../misc/license'; -const constants = require('../../const.json'); +import { copyright } from '../../const.json'; import endpoints from '../api/endpoints'; import locales from '../../../locales'; import * as nestedProperty from 'nested-property'; @@ -59,7 +59,7 @@ async function genVars(lang: string): Promise<{ [key: string]: any }> { vars['config'] = config; - vars['copyright'] = constants.copyright; + vars['copyright'] = copyright; vars['license'] = licenseHtml; -- cgit v1.2.3-freya