diff options
| author | Kagami Sascha Rosylight <saschanaz@outlook.com> | 2022-12-18 07:51:31 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-18 07:51:31 +0900 |
| commit | af9034355c4dd07a497f99afc1cb7e66d3745f26 (patch) | |
| tree | bc58686c78f13f196221c743e5322c9a1893bbe3 /packages/backend/test/loader.js | |
| parent | enhance: Implement the toggle to (or not to) close push notifications when n... (diff) | |
| download | misskey-af9034355c4dd07a497f99afc1cb7e66d3745f26.tar.gz misskey-af9034355c4dd07a497f99afc1cb7e66d3745f26.tar.bz2 misskey-af9034355c4dd07a497f99afc1cb7e66d3745f26.zip | |
Remove redundant ts-node things (#9335)
Diffstat (limited to 'packages/backend/test/loader.js')
| -rw-r--r-- | packages/backend/test/loader.js | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/packages/backend/test/loader.js b/packages/backend/test/loader.js deleted file mode 100644 index 6b21587e32..0000000000 --- a/packages/backend/test/loader.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * ts-node/esmローダーに投げる前にpath mappingを解決する - * 参考 - * - https://github.com/TypeStrong/ts-node/discussions/1450#discussioncomment-1806115 - * - https://nodejs.org/api/esm.html#loaders - * ※ https://github.com/TypeStrong/ts-node/pull/1585 が取り込まれたらこのカスタムローダーは必要なくなる - */ - -import { resolve as resolveTs, load } from 'ts-node/esm'; -import { loadConfig, createMatchPath } from 'tsconfig-paths'; -import { pathToFileURL } from 'url'; - -const tsconfig = loadConfig(); -const matchPath = createMatchPath(tsconfig.absoluteBaseUrl, tsconfig.paths); - -export function resolve(specifier, ctx, defaultResolve) { - let resolvedSpecifier; - if (specifier.endsWith('.js')) { - // maybe transpiled - const specifierWithoutExtension = specifier.substring(0, specifier.length - '.js'.length); - const matchedSpecifier = matchPath(specifierWithoutExtension); - if (matchedSpecifier) { - resolvedSpecifier = pathToFileURL(`${matchedSpecifier}.js`).href; - } - } else { - const matchedSpecifier = matchPath(specifier); - if (matchedSpecifier) { - resolvedSpecifier = pathToFileURL(matchedSpecifier).href; - } - } - return resolveTs(resolvedSpecifier ?? specifier, ctx, defaultResolve); -} - -export { load }; |