@jsenv/plugin-supervisor 1.6.10 → 1.6.11
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/jsenv_plugin_supervisor.js +20 -13
- package/package.json +4 -4
|
@@ -2,7 +2,6 @@ import { applyBabelPlugins, parseHtml, visitHtmlNodes, analyzeScriptNode, getHtm
|
|
|
2
2
|
import process$1 from "node:process";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import tty from "node:tty";
|
|
5
|
-
import "string-width";
|
|
6
5
|
import { createRequire } from "node:module";
|
|
7
6
|
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
8
7
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -469,30 +468,38 @@ const fillLeft = (value, biggestValue, char = " ") => {
|
|
|
469
468
|
// becoming "file:///file.css?css_module="
|
|
470
469
|
// we want to get rid of the "=" and consider it's the same url
|
|
471
470
|
const normalizeUrl = url => {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
471
|
+
const calledWithString = typeof url === "string";
|
|
472
|
+
const urlObject = calledWithString ? new URL(url) : url;
|
|
473
|
+
let urlString = urlObject.href;
|
|
474
|
+
if (!urlString.includes("?")) {
|
|
475
|
+
return url;
|
|
476
|
+
}
|
|
477
|
+
// disable on data urls (would mess up base64 encoding)
|
|
478
|
+
if (urlString.startsWith("data:")) {
|
|
479
|
+
return url;
|
|
478
480
|
}
|
|
479
|
-
|
|
481
|
+
urlString = urlString.replace(/[=](?=&|$)/g, "");
|
|
482
|
+
if (calledWithString) {
|
|
483
|
+
return urlString;
|
|
484
|
+
}
|
|
485
|
+
urlObject.href = urlString;
|
|
486
|
+
return urlObject;
|
|
480
487
|
};
|
|
481
488
|
const injectQueryParams = (url, params) => {
|
|
482
|
-
const
|
|
489
|
+
const calledWithString = typeof url === "string";
|
|
490
|
+
const urlObject = calledWithString ? new URL(url) : url;
|
|
483
491
|
const {
|
|
484
492
|
searchParams
|
|
485
493
|
} = urlObject;
|
|
486
|
-
Object.keys(params)
|
|
494
|
+
for (const key of Object.keys(params)) {
|
|
487
495
|
const value = params[key];
|
|
488
496
|
if (value === undefined) {
|
|
489
497
|
searchParams.delete(key);
|
|
490
498
|
} else {
|
|
491
499
|
searchParams.set(key, value);
|
|
492
500
|
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
return normalizeUrl(urlWithParams);
|
|
501
|
+
}
|
|
502
|
+
return normalizeUrl(calledWithString ? urlObject.href : urlObject);
|
|
496
503
|
};
|
|
497
504
|
|
|
498
505
|
const getCommonPathname = (pathname, otherPathname) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/plugin-supervisor",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"./src/client/supervisor.js"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@jsenv/ast": "6.6.
|
|
33
|
-
"@jsenv/urls": "2.
|
|
34
|
-
"@jsenv/sourcemap": "1.3.
|
|
32
|
+
"@jsenv/ast": "6.6.6",
|
|
33
|
+
"@jsenv/urls": "2.7.0",
|
|
34
|
+
"@jsenv/sourcemap": "1.3.3"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "node ./scripts/build.mjs",
|