Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
b72e00eb
Unverified
Commit
b72e00eb
authored
Jan 16, 2020
by
Robert Knight
Committed by
GitHub
Jan 16, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1681 from hypothesis/convert-boot-to-es-modules
Convert src/boot to ES modules
parents
c3a1170d
c0070e6b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
13 deletions
+10
-13
boot.js
src/boot/boot.js
+2
-4
index.js
src/boot/index.js
+4
-3
boot-test.js
src/boot/test/boot-test.js
+2
-2
url-template-test.js
src/boot/test/url-template-test.js
+1
-1
url-template.js
src/boot/url-template.js
+1
-3
No files found.
src/boot/boot.js
View file @
b72e00eb
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
;
src/boot/index.js
View file @
b72e00eb
...
...
@@ -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
);
...
...
src/boot/test/boot-test.js
View file @
b72e00eb
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
}
`
;
...
...
src/boot/test/url-template-test.js
View file @
b72e00eb
const
processUrlTemplate
=
require
(
'../url-template'
)
;
import
processUrlTemplate
from
'../url-template'
;
describe
(
'processUrlTemplate'
,
()
=>
{
let
fakeDocument
;
...
...
src/boot/url-template.js
View file @
b72e00eb
...
...
@@ -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
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment