marked-base-url 1.1.8 → 1.1.10

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/lib/index.cjs CHANGED
@@ -4,8 +4,7 @@ function baseUrl(base) {
4
4
  // extension code here
5
5
 
6
6
  base = base.trim().replace(/\/+$/, '/'); // if multiple '/' at the end, just keep one
7
- const reIsAbsolute = /^[\w+]+:\/\//;
8
- const isBaseAbsolute = reIsAbsolute.test(base);
7
+ const isBaseAbsolute = URL.canParse(base);
9
8
  const dummyUrl = 'http://__dummy__';
10
9
  const dummyBaseUrl = new URL(base, dummyUrl);
11
10
  const dummyUrlLength = dummyUrl.length + (base.startsWith('/') ? 0 : 1);
@@ -16,7 +15,7 @@ function baseUrl(base) {
16
15
  return;
17
16
  }
18
17
 
19
- if (reIsAbsolute.test(token.href)) {
18
+ if (URL.canParse(token.href)) {
20
19
  // the URL is absolute, do not touch it
21
20
  return;
22
21
  }
package/lib/index.umd.js CHANGED
@@ -8,8 +8,7 @@
8
8
  // extension code here
9
9
 
10
10
  base = base.trim().replace(/\/+$/, '/'); // if multiple '/' at the end, just keep one
11
- const reIsAbsolute = /^[\w+]+:\/\//;
12
- const isBaseAbsolute = reIsAbsolute.test(base);
11
+ const isBaseAbsolute = URL.canParse(base);
13
12
  const dummyUrl = 'http://__dummy__';
14
13
  const dummyBaseUrl = new URL(base, dummyUrl);
15
14
  const dummyUrlLength = dummyUrl.length + (base.startsWith('/') ? 0 : 1);
@@ -20,7 +19,7 @@
20
19
  return;
21
20
  }
22
21
 
23
- if (reIsAbsolute.test(token.href)) {
22
+ if (URL.canParse(token.href)) {
24
23
  // the URL is absolute, do not touch it
25
24
  return;
26
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marked-base-url",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "description": "marked base url",
5
5
  "main": "./lib/index.cjs",
6
6
  "module": "./src/index.js",
@@ -24,8 +24,8 @@
24
24
  }
25
25
  },
26
26
  "scripts": {
27
- "test": "jest --verbose",
28
- "test:cover": "jest --coverage",
27
+ "test": "node --test",
28
+ "test:cover": "node --experimental-test-coverage --test",
29
29
  "test:types": "tsd -t src/index.d.ts -f types_test/index.test-d.ts",
30
30
  "lint": "eslint",
31
31
  "format": "eslint --fix",
@@ -42,25 +42,21 @@
42
42
  },
43
43
  "homepage": "https://github.com/markedjs/marked-base-url#readme",
44
44
  "peerDependencies": {
45
- "marked": ">= 4 < 18"
45
+ "marked": ">= 4 < 19"
46
46
  },
47
47
  "devDependencies": {
48
- "@babel/core": "^7.28.5",
49
- "@babel/preset-env": "^7.28.5",
50
- "@markedjs/eslint-config": "^1.0.13",
48
+ "@markedjs/eslint-config": "^1.0.14",
51
49
  "@semantic-release/changelog": "^6.0.3",
52
50
  "@semantic-release/commit-analyzer": "^13.0.1",
53
51
  "@semantic-release/git": "^10.0.1",
54
- "@semantic-release/github": "^12.0.1",
55
- "@semantic-release/npm": "^13.1.1",
56
- "@semantic-release/release-notes-generator": "^14.1.0",
57
- "babel-jest": "^30.1.2",
58
- "eslint": "^9.39.0",
59
- "globals": "^16.5.0",
60
- "jest-cli": "^30.2.0",
61
- "marked": "^17.0.0",
62
- "rollup": "^4.52.5",
63
- "semantic-release": "^25.0.1",
52
+ "@semantic-release/github": "^12.0.9",
53
+ "@semantic-release/npm": "^13.1.5",
54
+ "@semantic-release/release-notes-generator": "^14.1.1",
55
+ "eslint": "^10.6.0",
56
+ "globals": "^17.7.0",
57
+ "marked": "^18.0.5",
58
+ "rollup": "^4.62.2",
59
+ "semantic-release": "^25.0.5",
64
60
  "tsd": "^0.33.0"
65
61
  },
66
62
  "tsd": {
package/src/index.d.ts CHANGED
@@ -6,6 +6,6 @@ declare module 'marked-base-url' {
6
6
  * @return A MarkedExtension to be passed to `marked.use()`
7
7
  */
8
8
  export function baseUrl(
9
- baseUrl: string
9
+ baseUrl: string,
10
10
  ): import('marked').MarkedExtension;
11
11
  }
package/src/index.js CHANGED
@@ -2,8 +2,7 @@ export function baseUrl(base) {
2
2
  // extension code here
3
3
 
4
4
  base = base.trim().replace(/\/+$/, '/'); // if multiple '/' at the end, just keep one
5
- const reIsAbsolute = /^[\w+]+:\/\//;
6
- const isBaseAbsolute = reIsAbsolute.test(base);
5
+ const isBaseAbsolute = URL.canParse(base);
7
6
  const dummyUrl = 'http://__dummy__';
8
7
  const dummyBaseUrl = new URL(base, dummyUrl);
9
8
  const dummyUrlLength = dummyUrl.length + (base.startsWith('/') ? 0 : 1);
@@ -14,7 +13,7 @@ export function baseUrl(base) {
14
13
  return;
15
14
  }
16
15
 
17
- if (reIsAbsolute.test(token.href)) {
16
+ if (URL.canParse(token.href)) {
18
17
  // the URL is absolute, do not touch it
19
18
  return;
20
19
  }