@jsenv/ast 6.7.15 → 6.7.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/ast",
3
- "version": "6.7.15",
3
+ "version": "6.7.17",
4
4
  "description": "Parse and transform HTML, CSS and JS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,11 +24,11 @@
24
24
  "/src/"
25
25
  ],
26
26
  "dependencies": {
27
- "@babel/core": "7.28.4",
27
+ "@babel/core": "7.28.5",
28
28
  "@babel/helper-module-imports": "7.27.1",
29
- "@babel/parser": "7.28.4",
30
- "@jsenv/humanize": "1.7.0",
31
- "@jsenv/urls": "2.9.2",
29
+ "@babel/parser": "7.28.5",
30
+ "@jsenv/humanize": "1.7.2",
31
+ "@jsenv/urls": "2.9.4",
32
32
  "@jsenv/utils": "2.3.1",
33
33
  "acorn": "8.15.0",
34
34
  "acorn-import-attributes": "1.9.5",
@@ -37,8 +37,25 @@ export const getUrlForContentInsideHtml = (node, htmlUrlInfo, reference) => {
37
37
  const { line, column, lineEnd, columnEnd } = getHtmlNodePosition(node, {
38
38
  preferOriginal: true,
39
39
  });
40
+ let url;
41
+ let htmlFileUrl = htmlUrlInfo.url;
42
+ const originalHtmFilelUrl = htmlUrlInfo.originalUrl;
43
+ if (originalHtmFilelUrl && originalHtmFilelUrl !== htmlFileUrl) {
44
+ if (
45
+ htmlUrlInfo.firstReference.type === "http_request" &&
46
+ htmlUrlInfo.firstReference.original.url !== htmlFileUrl
47
+ ) {
48
+ // html got redirected because of spa navigation
49
+ // we want to keep the original url as base for inline content
50
+ url = htmlFileUrl;
51
+ } else {
52
+ url = originalHtmFilelUrl;
53
+ }
54
+ } else {
55
+ url = htmlFileUrl;
56
+ }
40
57
  const inlineContentUrl = generateUrlForInlineContent({
41
- url: htmlUrlInfo.originalUrl || htmlUrlInfo.url,
58
+ url,
42
59
  basename,
43
60
  extension,
44
61
  line,