@jsenv/ast 6.4.3 → 6.5.0
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.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "Parse and transform HTML, CSS and JS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/parser": "7.26.5",
|
|
33
33
|
"@jsenv/humanize": "1.2.8",
|
|
34
|
-
"@jsenv/urls": "2.
|
|
34
|
+
"@jsenv/urls": "2.6.0",
|
|
35
35
|
"acorn": "8.14.0",
|
|
36
36
|
"acorn-import-attributes": "1.9.5",
|
|
37
37
|
"acorn-walk": "8.3.4",
|
|
@@ -5,7 +5,7 @@ import { analyzeScriptNode } from "./html_analysis.js";
|
|
|
5
5
|
import { getHtmlNodeAttribute } from "./html_node_attributes.js";
|
|
6
6
|
import { getHtmlNodePosition } from "./html_node_position.js";
|
|
7
7
|
|
|
8
|
-
export const getUrlForContentInsideHtml = (node,
|
|
8
|
+
export const getUrlForContentInsideHtml = (node, htmlUrlInfo, reference) => {
|
|
9
9
|
let externalSpecifierAttributeName;
|
|
10
10
|
let basename;
|
|
11
11
|
let extension;
|
|
@@ -18,8 +18,8 @@ export const getUrlForContentInsideHtml = (node, { htmlUrl, url }) => {
|
|
|
18
18
|
externalSpecifierAttributeName = "inlined-from-href";
|
|
19
19
|
extension = ".css";
|
|
20
20
|
} else if (node.nodeName === "link") {
|
|
21
|
-
basename = urlToBasename(url);
|
|
22
|
-
extension = urlToExtension(url);
|
|
21
|
+
basename = urlToBasename(reference.url);
|
|
22
|
+
extension = urlToExtension(reference.url);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
if (externalSpecifierAttributeName) {
|
|
@@ -38,7 +38,7 @@ export const getUrlForContentInsideHtml = (node, { htmlUrl, url }) => {
|
|
|
38
38
|
preferOriginal: true,
|
|
39
39
|
});
|
|
40
40
|
const inlineContentUrl = generateUrlForInlineContent({
|
|
41
|
-
url:
|
|
41
|
+
url: htmlUrlInfo.originalUrl || htmlUrlInfo.url,
|
|
42
42
|
basename,
|
|
43
43
|
extension,
|
|
44
44
|
line,
|
|
@@ -26,8 +26,8 @@ export const generateUrlForInlineContent = ({
|
|
|
26
26
|
|
|
27
27
|
const filenameRaw = urlToFilename(url);
|
|
28
28
|
const filename = `${filenameRaw}@${generatedName}${extension}`;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return inlineContentUrl;
|
|
29
|
+
const inlineContentUrl = new URL(filename, url);
|
|
30
|
+
const { search } = new URL(url);
|
|
31
|
+
inlineContentUrl.search = search;
|
|
32
|
+
return inlineContentUrl.href;
|
|
33
33
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { injectQueryParams } from "@jsenv/urls";
|
|
2
2
|
import { CONTENT_TYPE } from "@jsenv/utils/src/content_type/content_type.js";
|
|
3
|
-
|
|
4
3
|
import { generateUrlForInlineContent } from "../inline_content_url.js";
|
|
5
4
|
|
|
6
|
-
export const getUrlForContentInsideJs = (inlineReferenceInfo,
|
|
5
|
+
export const getUrlForContentInsideJs = (inlineReferenceInfo, jsUrlInfo) => {
|
|
7
6
|
const { inlinedFromUrl } = inlineReferenceInfo;
|
|
8
7
|
if (inlinedFromUrl) {
|
|
9
8
|
return injectQueryParams(inlinedFromUrl, { inlined: "" });
|
|
10
9
|
}
|
|
11
10
|
return generateUrlForInlineContent({
|
|
12
|
-
url,
|
|
11
|
+
url: jsUrlInfo.originalUrl || jsUrlInfo.url,
|
|
13
12
|
extension: CONTENT_TYPE.asFileExtension(inlineReferenceInfo.contentType),
|
|
14
13
|
line: inlineReferenceInfo.line,
|
|
15
14
|
column: inlineReferenceInfo.column,
|