0
0
Fork 0

Dont use CommonJS (require, module.exports) anywhere (#24913)

This commit is contained in:
Renaud Chaput 2023-05-09 03:08:47 +02:00 committed by GitHub
parent 89269e4b71
commit 955179fc55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 79 additions and 41 deletions

View file

@ -1,13 +1,24 @@
import './public-path';
import escapeTextContentForBrowser from 'escape-html';
import loadPolyfills from '../mastodon/load_polyfills';
import ready from '../mastodon/ready';
import { start } from '../mastodon/common';
import escapeTextContentForBrowser from 'escape-html';
import ready from '../mastodon/ready';
import loadKeyboardExtensions from '../mastodon/load_keyboard_extensions';
import 'cocoon-js-vanilla';
import axios from 'axios';
import { throttle } from 'lodash';
import { defineMessages } from 'react-intl';
import * as IntlMessageFormat from 'intl-messageformat';
import { timeAgoString } from '../mastodon/components/relative_timestamp';
import { delegate } from '@rails/ujs';
import * as emojify from '../mastodon/features/emoji/emoji';
import { getLocale } from '../mastodon/locales';
import React from 'react';
import ReactDOM from 'react-dom';
import { createBrowserHistory } from 'history';
start();
const messages = defineMessages({
usernameTaken: { id: 'username.taken', defaultMessage: 'That username is taken. Try another' },
@ -15,8 +26,6 @@ const messages = defineMessages({
passwordDoesNotMatch: { id: 'password_confirmation.mismatching', defaultMessage: 'Password confirmation does not match' },
});
start();
window.addEventListener('message', e => {
const data = e.data || {};
@ -33,16 +42,8 @@ window.addEventListener('message', e => {
});
});
function main() {
const IntlMessageFormat = require('intl-messageformat').default;
const { timeAgoString } = require('../mastodon/components/relative_timestamp');
const { delegate } = require('@rails/ujs');
const emojify = require('../mastodon/features/emoji/emoji').default;
const { getLocale } = require('../mastodon/locales');
function loaded() {
const { localeData } = getLocale();
const React = require('react');
const ReactDOM = require('react-dom');
const { createBrowserHistory } = require('history');
const scrollToDetailedStatus = () => {
const history = createBrowserHistory();
@ -341,6 +342,11 @@ function main() {
});
}
function main() {
ready(loaded);
}
loadPolyfills()
.then(main)
.then(loadKeyboardExtensions)