Unverified Commit b72e00eb authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #1681 from hypothesis/convert-boot-to-es-modules

Convert src/boot to ES modules
parents c3a1170d c0070e6b
const { requiredPolyfillSets } = require('../shared/polyfills');
import { requiredPolyfillSets } from '../shared/polyfills';
function injectStylesheet(doc, href) {
const link = doc.createElement('link');
......@@ -126,12 +126,10 @@ function bootSidebarApp(doc, config) {
]);
}
function boot(document_, config) {
export default function boot(document_, config) {
if (document_.querySelector('hypothesis-app')) {
bootSidebarApp(document_, config);
} else {
bootHypothesisClient(document_, config);
}
}
module.exports = boot;
......@@ -9,9 +9,10 @@
/* global __MANIFEST__ */
const boot = require('./boot');
const { jsonConfigsFrom } = require('../shared/settings');
const processUrlTemplate = require('./url-template');
import { jsonConfigsFrom } from '../shared/settings';
import boot from './boot';
import processUrlTemplate from './url-template';
const settings = jsonConfigsFrom(document);
......
const boot = require('../boot');
const { $imports } = require('../boot');
import boot from '../boot';
import { $imports } from '../boot';
function assetUrl(url) {
return `https://marginal.ly/client/build/${url}`;
......
const processUrlTemplate = require('../url-template');
import processUrlTemplate from '../url-template';
describe('processUrlTemplate', () => {
let fakeDocument;
......
......@@ -38,7 +38,7 @@ function currentScriptOrigin(document_ = document) {
* running. In that case, all references to `localhost` need to be replaced
* with the IP/hostname of the dev server.
*/
function processUrlTemplate(url, document_ = document) {
export default function processUrlTemplate(url, document_ = document) {
if (url.indexOf('{') === -1) {
// Not a template. This should always be the case in production.
return url;
......@@ -53,5 +53,3 @@ function processUrlTemplate(url, document_ = document) {
return url;
}
module.exports = processUrlTemplate;
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