Commit 4c08e23f authored by Robert Knight's avatar Robert Knight

Normalize several `require` statements

Normalize several require statements into a form that can be handled
more easily by an automated tool to convert them to ES modules.
parent fd434d95
const html = require('../html');
const toResult = require('../../../shared/test/promise-util').toResult;
const { toResult } = require('../../../shared/test/promise-util');
const fixture = require('./html-anchoring-fixture.html');
/** Return all text node children of `container`. */
......
const isLoaded = require('../../util/frame-util').isLoaded;
const { isLoaded } = require('../../util/frame-util');
const FRAME_DEBOUNCE_WAIT = require('../../frame-observer').DEBOUNCE_WAIT + 10;
const CrossFrame = require('../../plugin/cross-frame');
......
......@@ -10,9 +10,11 @@
/* global __MANIFEST__ */
const boot = require('./boot');
const settings = require('../shared/settings').jsonConfigsFrom(document);
const { jsonConfigsFrom } = require('../shared/settings');
const processUrlTemplate = require('./url-template');
const settings = jsonConfigsFrom(document);
boot(document, {
assetRoot: processUrlTemplate(settings.assetRoot || '__ASSET_ROOT__'),
manifest: __MANIFEST__,
......
......@@ -5,7 +5,7 @@ const fixtures = require('../../test/annotation-fixtures');
const util = require('../../directive/test/util');
const annotationComponent = require('../annotation');
const { $imports } = require('../annotation');
const { $imports, updateModel } = require('../annotation');
const inject = angular.mock.inject;
......@@ -34,8 +34,6 @@ const groupFixtures = {
describe('annotation', function() {
describe('updateModel()', function() {
const updateModel = require('../annotation').updateModel;
function fakePermissions() {
return {
shared: function() {},
......
......@@ -2,12 +2,13 @@ const addAnalytics = require('./ga');
const disableOpenerForExternalLinks = require('./util/disable-opener-for-external-links');
const { fetchConfig } = require('./util/fetch-config');
const serviceConfig = require('./service-config');
const { jsonConfigsFrom } = require('../shared/settings');
const crossOriginRPC = require('./cross-origin-rpc.js');
let sentry;
// Read settings rendered into sidebar app HTML by service/extension.
const appConfig = require('../shared/settings').jsonConfigsFrom(document);
const appConfig = jsonConfigsFrom(document);
if (appConfig.sentry) {
// Initialize Sentry. This is required at the top of this file
......
const events = require('../events');
const resolve = require('../util/url').resolve;
const { resolve } = require('../util/url');
const serviceConfig = require('../service-config');
/**
......
......@@ -3,9 +3,8 @@ const EventEmitter = require('tiny-emitter');
const annotationFixtures = require('../../test/annotation-fixtures');
const events = require('../../events');
const FrameSync = require('../frame-sync').default;
const createFakeStore = require('../../test/fake-redux-store');
const formatAnnot = require('../frame-sync').formatAnnot;
const { default: FrameSync, formatAnnot } = require('../frame-sync');
const uiConstants = require('../../ui-constants');
const fixtures = {
......
const redux = require('redux');
// `.default` is needed because 'redux-thunk' is built as an ES2015 module
const thunk = require('redux-thunk').default;
const { default: thunk } = require('redux-thunk');
const { createReducer, bindSelectors } = require('./util');
......
......@@ -19,7 +19,7 @@ const immutable = require('seamless-immutable');
const arrayUtil = require('../../util/array');
const metadata = require('../../util/annotation-metadata');
const toSet = require('../../util/array').toSet;
const { toSet } = require('../../util/array');
const uiConstants = require('../../ui-constants');
const util = require('../util');
......
......@@ -8,10 +8,12 @@ sinon.assert.expose(assert, { prefix: null });
// the directive tests rely on angular.element() returning
// a full version of jQuery.
//
window.jQuery = window.$ = require('jquery');
const jQuery = require('jquery');
require('angular');
require('angular-mocks');
window.jQuery = window.$ = jQuery;
// Configure Enzyme for UI tests.
require('preact/debug');
const { configure } = require('enzyme');
......
const retryUtil = require('../retry');
const toResult = require('../../../shared/test/promise-util').toResult;
const { toResult } = require('../../../shared/test/promise-util');
describe('sidebar.util.retry', function() {
describe('.retryPromiseOperation', function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment