@jsenv/urls 2.1.0 → 2.2.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 +1 -1
- package/src/main.js +0 -1
- package/src/inline_content_url_generator.js +0 -29
package/package.json
CHANGED
package/src/main.js
CHANGED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { urlToFilename } from "./url_to_filename.js";
|
|
2
|
-
|
|
3
|
-
export const generateInlineContentUrl = ({
|
|
4
|
-
url,
|
|
5
|
-
extension,
|
|
6
|
-
basename,
|
|
7
|
-
line,
|
|
8
|
-
column,
|
|
9
|
-
lineEnd,
|
|
10
|
-
columnEnd,
|
|
11
|
-
}) => {
|
|
12
|
-
let generatedName = "";
|
|
13
|
-
if (basename !== undefined) {
|
|
14
|
-
generatedName += basename;
|
|
15
|
-
}
|
|
16
|
-
if (line !== undefined && column !== undefined) {
|
|
17
|
-
generatedName = `L${line}C${column}`;
|
|
18
|
-
if (lineEnd !== undefined && columnEnd !== undefined) {
|
|
19
|
-
generatedName += `-L${lineEnd}C${columnEnd}`;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const filenameRaw = urlToFilename(url);
|
|
24
|
-
const filename = `${filenameRaw}@${generatedName}${extension}`;
|
|
25
|
-
// ideally we should keep query params from url
|
|
26
|
-
// maybe we could use a custom scheme like "inline:"
|
|
27
|
-
const inlineContentUrl = new URL(filename, url).href;
|
|
28
|
-
return inlineContentUrl;
|
|
29
|
-
};
|