Fix source URL pragmas

This commit is contained in:
Adrian Vollmer 2024-04-03 20:17:43 +02:00
parent b99d1c2977
commit f7530f8ff9
2 changed files with 5 additions and 5 deletions

View File

@ -91,7 +91,7 @@ var embed_js = function(doc) {
let [path, get_parameters, anchor] = split_url(src);
path = normalize_path(path);
console.debug("Embed script: " + path);
var src = retrieve_file(path) + ' //# sourceMap=' + path;
var src = retrieve_file(path) + ' \n//# sourceURL=' + path;
newScript.appendChild(doc.createTextNode(src));
newScript.removeAttribute('src');
oldScript.parentNode.replaceChild(newScript, oldScript);

View File

@ -93,8 +93,8 @@ def embed_assets(index_file, output_path=None, append_pre="", append_post=""):
<head><style>{style}</style></head>
<body>{body}
<script>window.global_context = "{global_context}"</script>
<script>{pako} //# sourceURL=pako.js</script>
<script>{bootstrap} //# sourceURL=boostrap.js</script>
<script>{pako} \n//# sourceURL=pako.js</script>
<script>{bootstrap} \n//# sourceURL=boostrap.js</script>
</body><!-- {license} --></html>
""".format(
style=init_files["init.css"],
@ -193,12 +193,12 @@ def embed_html_resources(html, base_dir, before, after):
if head and before:
script = soup.new_tag("script")
script.string = before + "//# sourceURL=inject_pre.js"
script.string = before + "\n//# sourceURL=inject_pre.js"
head.insert(0, script)
if body and after:
script = soup.new_tag("script")
script.string = after + "//# sourceURL=inject_post.js"
script.string = after + "\n//# sourceURL=inject_post.js"
body.append(script)
# TODO embed remote resources in case we want the entire file to be