@jsenv/core 20.0.1 → 20.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/.DS_Store ADDED
Binary file
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "20.0.1",
3
+ "version": "20.0.2",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -11,8 +11,7 @@
11
11
  "node": ">=14.9.0"
12
12
  },
13
13
  "publishConfig": {
14
- "access": "public",
15
- "registry": "https://registry.npmjs.org"
14
+ "access": "public"
16
15
  },
17
16
  "type": "module",
18
17
  "exports": {
@@ -38,6 +38,7 @@ import {
38
38
  parseSrcset,
39
39
  stringifySrcset,
40
40
  } from "@jsenv/core/src/internal/compiling/compileHtml.js"
41
+ import { setJavaScriptSourceMappingUrl } from "@jsenv/core/src/internal/sourceMappingURLUtils.js"
41
42
  import {
42
43
  getTargetAsBase64Url,
43
44
  targetIsReferencedOnlyByRessourceHint,
@@ -258,8 +259,14 @@ const moduleScriptSrcVisitor = (script, { format, notifyReferenceFound }) => {
258
259
  // here put a warning if we cannot inline importmap because it would mess
259
260
  // the remapping (note that it's feasible) but not yet supported
260
261
  removeHtmlNodeAttribute(script, srcAttribute)
261
- const { targetBuildBuffer } = script.target
262
- setHtmlNodeText(script, targetBuildBuffer)
262
+ const { targetBuildBuffer } = remoteScriptReference.target
263
+ const jsString = String(targetBuildBuffer)
264
+
265
+ const codeWithSourcemapComment = setJavaScriptSourceMappingUrl(
266
+ jsString,
267
+ `${remoteScriptReference.target.targetFileName}.map`
268
+ )
269
+ setHtmlNodeText(script, codeWithSourcemapComment)
263
270
  return
264
271
  }
265
272
 
@@ -669,6 +676,10 @@ const shouldInline = ({ reference, htmlNode }) => {
669
676
  return true
670
677
  }
671
678
 
679
+ return readAndRemoveForceInline(htmlNode)
680
+ }
681
+
682
+ const readAndRemoveForceInline = (htmlNode) => {
672
683
  const jsenvForceInlineAttribute = getHtmlNodeAttributeByName(
673
684
  htmlNode,
674
685
  "data-jsenv-force-inline",
@@ -286,9 +286,13 @@ export const replaceHtmlNode = (
286
286
 
287
287
  if (inheritAttributes) {
288
288
  newNode.attrs = [
289
- // inherit script attributes except src, type, href
289
+ // inherit script attributes except src, type, href, rel
290
290
  ...node.attrs.filter(
291
- ({ name }) => name !== "type" && name !== "src" && name !== "href",
291
+ ({ name }) =>
292
+ name !== "type" &&
293
+ name !== "src" &&
294
+ name !== "href" &&
295
+ name !== "rel",
292
296
  ),
293
297
  ...newNode.attrs,
294
298
  ]