qunitx-cli 0.6.0 → 0.7.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/deno.lock
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
"npm:@types/picomatch@*": "4.0.2",
|
|
7
7
|
"npm:@types/ws@*": "8.18.1",
|
|
8
8
|
"npm:cheerio@*": "1.2.0",
|
|
9
|
-
"npm:cheerio@^1.2.0": "1.2.0",
|
|
10
9
|
"npm:chokidar@*": "5.0.0",
|
|
11
10
|
"npm:chokidar@5": "5.0.0",
|
|
12
11
|
"npm:cors@^2.8.6": "2.8.6",
|
|
@@ -1324,7 +1323,6 @@
|
|
|
1324
1323
|
],
|
|
1325
1324
|
"packageJson": {
|
|
1326
1325
|
"dependencies": [
|
|
1327
|
-
"npm:cheerio@^1.2.0",
|
|
1328
1326
|
"npm:chokidar@5",
|
|
1329
1327
|
"npm:cors@^2.8.6",
|
|
1330
1328
|
"npm:esbuild@~0.27.3",
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
1
|
+
const ABSOLUTE_URL_REGEX = /^(?:[a-z]+:)?\/\//i;
|
|
2
|
+
const SCRIPT_SRC_REGEX = /<script[^>]+\bsrc=['"]([^'"]+)['"]/gi;
|
|
3
|
+
const LINK_HREF_REGEX = /<link[^>]+\bhref=['"]([^'"]+)['"]/gi;
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Parses an HTML string and returns all internal (non-absolute-URL) `<script src>` and `<link href>` paths.
|
|
7
7
|
* @returns {string[]}
|
|
8
8
|
*/
|
|
9
9
|
export default function findInternalAssetsFromHTML(htmlContent) {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
.toArray()
|
|
13
|
-
.map((scriptNode) => $(scriptNode).attr('src'))
|
|
10
|
+
const links = [...htmlContent.matchAll(LINK_HREF_REGEX)]
|
|
11
|
+
.map((m) => m[1])
|
|
14
12
|
.filter((uri) => !ABSOLUTE_URL_REGEX.test(uri));
|
|
15
|
-
const
|
|
16
|
-
.
|
|
17
|
-
.map((scriptNode) => $(scriptNode).attr('href'))
|
|
13
|
+
const scripts = [...htmlContent.matchAll(SCRIPT_SRC_REGEX)]
|
|
14
|
+
.map((m) => m[1])
|
|
18
15
|
.filter((uri) => !ABSOLUTE_URL_REGEX.test(uri));
|
|
19
16
|
|
|
20
|
-
return
|
|
21
|
-
// TODO: maybe needs normalization ? .map((fileReferencePath) => fileReferencePath.replace('/assets', `${projectRoot}/tmp/assets`));
|
|
17
|
+
return links.concat(scripts);
|
|
22
18
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qunitx-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"description": "Browser runner for QUnitx: run your qunitx tests in google-chrome",
|
|
6
6
|
"main": "cli.js",
|
|
7
7
|
"author": "Izel Nakri",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"url": "https://github.com/izelnakri/qunitx-cli.git"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"cheerio": "^1.2.0",
|
|
47
46
|
"chokidar": "^5.0.0",
|
|
48
47
|
"esbuild": "^0.27.3",
|
|
49
48
|
"picomatch": "^4.0.3",
|