refactor: Use ESM (#8358)

* wip

* wip

* fix

* clean up

* Update tsconfig.json

* Update activitypub.ts

* wip
This commit is contained in:
syuilo 2022-02-27 11:07:39 +09:00 committed by GitHub
parent 0a882471f3
commit d071d18dd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
737 changed files with 4135 additions and 3678 deletions

View file

@ -1,6 +1,6 @@
import * as mfm from 'mfm-js';
import { Note } from '@/models/entities/note';
import { toHtml } from '../../../mfm/to-html';
import { Note } from '@/models/entities/note.js';
import { toHtml } from '../../../mfm/to-html.js';
export default function(note: Note) {
let html = note.text ? toHtml(mfm.parse(note.text), JSON.parse(note.mentionedRemoteUsers)) : null;

View file

@ -1,6 +1,6 @@
import { IObject } from '../type';
import { extractApHashtagObjects } from '../models/tag';
import { fromHtml } from '../../../mfm/from-html';
import { IObject } from '../type.js';
import { extractApHashtagObjects } from '../models/tag.js';
import { fromHtml } from '../../../mfm/from-html.js';
export function htmlToMfm(html: string, tag?: IObject | IObject[]) {
const hashtagNames = extractApHashtagObjects(tag).map(x => x.name).filter((x): x is string => x != null);

View file

@ -1,8 +1,8 @@
import * as crypto from 'crypto';
import * as crypto from 'node:crypto';
import * as jsonld from 'jsonld';
import { CONTEXTS } from './contexts';
import { CONTEXTS } from './contexts.js';
import fetch from 'node-fetch';
import { httpAgent, httpsAgent } from '@/misc/fetch';
import { httpAgent, httpsAgent } from '@/misc/fetch.js';
// RsaSignature2017 based from https://github.com/transmute-industries/RsaSignature2017