Skip to content

Commit 656376d

Browse files
committed
test with node 22 #30
1 parent 6bbd140 commit 656376d

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

.github/workflows/node.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
node-version: [ 18.x, 20.x, 21.x ]
20+
node-version: [ 18.x, 20.x, 22.x ]
2121
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2222

2323
steps:

dist/index-umd-web.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9401,8 +9401,10 @@
94019401
if (matchUrl.test(currentFile)) {
94029402
return fetch(new URL(url, currentFile)).then(parseResponse);
94039403
}
9404+
const path = resolve(url, currentFile).absolute;
9405+
const t = new URL(path, self.origin);
94049406
// return fetch(new URL(url, new URL(currentFile, self.location.href).href)).then(parseResponse);
9405-
return fetch(resolve(url, currentFile).absolute).then(parseResponse);
9407+
return fetch(url, t.origin != self.location.origin ? { mode: 'cors' } : {}).then(parseResponse);
94069408
}
94079409

94089410
function render(data, options = {}) {

dist/web/load.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ async function load(url, currentFile) {
1313
if (matchUrl.test(currentFile)) {
1414
return fetch(new URL(url, currentFile)).then(parseResponse);
1515
}
16+
const path = resolve(url, currentFile).absolute;
17+
const t = new URL(path, self.origin);
1618
// return fetch(new URL(url, new URL(currentFile, self.location.href).href)).then(parseResponse);
17-
return fetch(resolve(url, currentFile).absolute).then(parseResponse);
19+
return fetch(url, t.origin != self.location.origin ? { mode: 'cors' } : {}).then(parseResponse);
1820
}
1921

2022
export { load };

src/web/load.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export async function load(url: string, currentFile: string) {
2222
return fetch(new URL(url, currentFile)).then(parseResponse);
2323
}
2424

25+
const path: string = resolve(url, currentFile).absolute;
26+
const t: URL = new URL(path, self.origin);
27+
2528
// return fetch(new URL(url, new URL(currentFile, self.location.href).href)).then(parseResponse);
26-
return fetch(resolve(url, currentFile).absolute).then(parseResponse);
29+
return fetch(url, t.origin != self.location.origin ? {mode: 'cors'} : {}).then(parseResponse);
2730
}

0 commit comments

Comments
 (0)