-
Notifications
You must be signed in to change notification settings - Fork 50
Update to 0.15.0; use ES Module Shims #275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 27 commits
00ed3da
098fb42
905d54d
3880074
37cf79a
db55540
479619b
8474470
91f18d1
84f9908
f436199
37cdfc8
8fa99e8
b15c61b
7366787
76a5345
29c602b
121f928
3309843
60730cb
37fb6cf
16aaff7
e4b49d2
40f0d95
f671cbc
6b81543
27eb703
f9c30d6
c059482
a993bc6
9a97914
0fb4edc
0584223
0369198
1cc3451
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,59 @@ | |
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> | ||
<meta content="utf-8" http-equiv="encoding"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<script src="js/frame.js"></script> | ||
<!-- Do not edit the base element's 'href' manually. Use the 'base:dev' or 'base:prod' script --> | ||
<base href="/js/output/ignored/"> | ||
<script> | ||
window.esmsInitOptions = { | ||
// -- Hooks -- | ||
// Module load error | ||
onerror: (e) => { | ||
console.log("Error while loading module: "); | ||
console.log(e); | ||
throw e; | ||
}, | ||
}; | ||
</script> | ||
<!-- | ||
JSPM Generator Import Map | ||
Edit URL: https://generator.jspm.io/#Y2NnYGCzD80rySzJSU1hSMpM183MK0lNTy1yMNQz0zM1ZEhJTc7MTczRyyp2MDTQM9YzZChKTUwu0U3Jz3UwNNMzxCqiX5xaVJZaBJGAKystzUxxsACaYQQAoBlP83cA | ||
--> | ||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"big-integer": "https://ga.jspm.io/npm:[email protected]/BigInteger.js", | ||
"decimal.js": "https://ga.jspm.io/npm:[email protected]/decimal.js", | ||
"react": "https://ga.jspm.io/npm:[email protected]/index.js", | ||
"react-dom": "https://ga.jspm.io/npm:[email protected]/index.js", | ||
"react-dom/server": "https://ga.jspm.io/npm:[email protected]/server.browser.js", | ||
"uuid": "https://ga.jspm.io/npm:[email protected]/dist/esm-browser/index.js" | ||
}, | ||
"scopes": { | ||
"https://ga.jspm.io/": { | ||
"object-assign": "https://ga.jspm.io/npm:[email protected]/index.js", | ||
"react": "https://ga.jspm.io/npm:[email protected]/index.js", | ||
"scheduler": "https://ga.jspm.io/npm:[email protected]/index.js" | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<!-- ES Module Shims: Import maps polyfill for modules browsers without import maps support (all except Chrome 89+) --> | ||
<script async src="https://ga.jspm.io/npm:[email protected]/dist/es-module-shims.js" integrity="sha384-Zt+0efULC2q2dftjz0uNzXeTpPVuSLLekXQv9HoRuigkAyLPaUFvPVpYYhu2Xc/t" crossorigin="anonymous"></script> | ||
|
||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/BigInteger.js" integrity="sha384-Lxn1K4ox8//F5O+uihYrTIJvbfM+UJaRL2SdFA2s/z0v6i5TrWg9B8RzfjM60R9y"/> | ||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/decimal.js" integrity="sha384-camBDJB1KoavtyRdQfdzzR4mj+uAKnNlvseJIwqKYOaHWnjZmnXR+1vyBP1WlZd0"/> | ||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/index.js" integrity="sha384-iQp1zoaqIhfUYyYkz3UNk1QeFfmBGgt1Ojq0kZD5Prql1g7fgJVzVgsjDoR65lv8"/> | ||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/cjs/react-dom-server.browser.production.min.js" integrity="sha384-XL5bjsaJ5UPjTIPsyzUfscq41OFbVXsLojl53DCgFfdzKNNUL2MOSd0WM/upjd53"/> | ||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/cjs/react-dom.production.min.js" integrity="sha384-HDQjgsF+F2j5XuiiDtCiuLA1vgyHr9ONiNrBhKmJEVa43KqIZdAB7VN2+QjUGwvq"/> | ||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/index.js" integrity="sha384-zAu0L7n/xnRAG7+D/qd1K4E1/2tYK4hL3puH/5YEliHNnO3OOt5jUhnnemFTHmIG"/> | ||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/server.browser.js" integrity="sha384-dsW+4a3rjWELxqtR1rVEIeLNHGyMjRFwdBVz6OG30oBLs8tO2/dYUIxEvc515PSZ"/> | ||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/index.js" integrity="sha384-T0mNrKFgmKBye+m7XrpShrh+7kfix2zQd9qrR8xytnppcxESpgzrb4IJXvE+uJcl"/> | ||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/cjs/react.production.min.js" integrity="sha384-pTMZhybzHZ+1G029kWUmoGvTrBp1C+2oJAkZV48BBq7+e6Hk3bGuXtvxT2vQfBqj"/> | ||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/index.js" integrity="sha384-jVagjV+2YtlseazU2byX6gMLPHaA5Ps2c6HhvsGDlWjn45YCCoU1q+QtQTOb1MjT"/> | ||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/index.js" integrity="sha384-HIW1B3OQdGPkUEgh29MiYoUKQp+mFTjw50hRVvGhZgUaNYrUFYN07a+3CqC0/I7L"/> | ||
<link rel="modulepreload" href="https://ga.jspm.io/npm:[email protected]/dist/esm-browser/index.js" integrity="sha384-y7UmGnwe+/V/S4AD5T6MLU9dHjA3PLvuVGNhrqZApiNbq9Lf8s3aNRrcnzOa+qtR"/> | ||
<script src="/js/frame.js"></script> | ||
</head> | ||
<body> | ||
<main id="main"></main> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env node | ||
|
||
import path from "path"; | ||
import fs from "fs"; | ||
import process from "process"; | ||
|
||
const filePath = path.join("public", "frame.html"); | ||
|
||
// PureScript generates JS with the following import lines: | ||
// `import * as Data_Foo from "../Data.Foo/index.js" | ||
// To remap `../Data.Foo/index.js` to `output/Data.Foo/index.js` | ||
// we append `/ignored/`. | ||
// | ||
// This: `/output/ignored/../Data.Foo/index.js` | ||
// becomes: `/output/Data.Foo/index.js` | ||
const prodPath = "/output/ignored/" | ||
const devPath = "/js/output/ignored/" | ||
|
||
const environment = process.argv[2] || "dev"; | ||
const baseHref = environment === "prod" ? prodPath : devPath; | ||
|
||
const frameHtml = fs.readFileSync(filePath, "utf-8"); | ||
const newHtml = frameHtml | ||
.split("\n") | ||
.map((line) => line.replace(/^( *<base href=")[^"]*(".+)$/, `$1${baseHref}$2`)) | ||
.join("\n"); | ||
|
||
fs.writeFileSync(filePath, newHtml); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we have to rewrite the file in place, I'm not sure this is the best way to do this. Will this dirty the source tree? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm also curious how this works with the actual prod deployment of the UI. I'm not fully aware of all that goes into that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, it would dirty the source tree. The client is built in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How should this issue be resolved? Do we create 2 versions of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a check in CI to fail the build if the
I believe that resolves your final issue with this PR. |
Uh oh!
There was an error while loading. Please reload this page.