Skip to content

Commit 767ce36

Browse files
committed
fix: ensure to wrap fetch in setFetch
1 parent 75a3e8a commit 767ce36

File tree

2 files changed

+55
-70
lines changed

2 files changed

+55
-70
lines changed

src/common/fetch.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ let _fetch: WrappedFetch = wrappedFetch(fetchImpl);
4545
* Allows customizing the fetch implementation used by the generator.
4646
*/
4747
export function setFetch(fetch: typeof globalThis.fetch | WrappedFetch) {
48-
_fetch = fetch as WrappedFetch;
48+
_fetch = wrappedFetch(fetch as WrappedFetch);
4949
}
5050

5151
export { clearCache, _fetch as fetch };

test/test.html

+54-69
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,85 @@
11
<!DOCTYPE html>
22
<!-- Generated by @jspm/generator - https://github.com/jspm/generator -->
3-
<script async src="https://ga.jspm.io/npm:es-module-shims@1.10.0/dist/es-module-shims.js" crossorigin="anonymous"></script>
3+
<script async src="https://ga.jspm.io/npm:es-module-shims@2.0.9/dist/es-module-shims.js" crossorigin="anonymous"></script>
44
<script type="importmap">
55
{
66
"imports": {
77
"@jspm/generator": "../dist/generator.js",
8-
"assert": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/assert.js"
8+
"assert": "https://ga.jspm.io/npm:@jspm/core@2.1.0/nodelibs/browser/assert.js"
99
},
1010
"scopes": {
1111
"../": {
1212
"#fetch": "../dist/fetch-native.js",
13-
"@babel/core": "https://ga.jspm.io/npm:@babel/core@7.25.8/lib/index.js",
14-
"@babel/plugin-syntax-import-attributes": "https://ga.jspm.io/npm:@babel/plugin-syntax-import-attributes@7.25.7/lib/index.js",
15-
"@babel/preset-typescript": "https://ga.jspm.io/npm:@babel/preset-typescript@7.24.7/lib/index.js",
13+
"@babel/core": "https://ga.jspm.io/npm:@babel/core@7.26.9/lib/index.js",
14+
"@babel/plugin-syntax-import-attributes": "https://ga.jspm.io/npm:@babel/plugin-syntax-import-attributes@7.26.0/lib/index.js",
15+
"@babel/preset-typescript": "https://ga.jspm.io/npm:@babel/preset-typescript@7.26.0/lib/index.js",
1616
"@jspm/import-map": "https://ga.jspm.io/npm:@jspm/[email protected]/dist/map.js",
17-
"es-module-lexer": "https://ga.jspm.io/npm:es-module-lexer@1.5.4/dist/lexer.js",
18-
"es-module-lexer/js": "https://ga.jspm.io/npm:es-module-lexer@1.5.4/dist/lexer.asm.js",
19-
"fs": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/fs.js",
20-
"process": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/process-production.js",
17+
"es-module-lexer": "https://ga.jspm.io/npm:es-module-lexer@1.6.0/dist/lexer.js",
18+
"es-module-lexer/js": "https://ga.jspm.io/npm:es-module-lexer@1.6.0/dist/lexer.asm.js",
19+
"fs": "https://ga.jspm.io/npm:@jspm/core@2.1.0/nodelibs/browser/fs.js",
20+
"process": "https://ga.jspm.io/npm:@jspm/core@2.1.0/nodelibs/browser/process-production.js",
2121
"sver": "https://ga.jspm.io/npm:[email protected]/sver.js",
2222
"sver/convert-range.js": "https://ga.jspm.io/npm:[email protected]/convert-range.js",
23-
"url": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/url.js"
23+
"url": "https://ga.jspm.io/npm:@jspm/core@2.1.0/nodelibs/browser/url.js"
2424
},
2525
"https://ga.jspm.io/": {
26-
"#lib/config/files/index.js": "https://ga.jspm.io/npm:@babel/core@7.25.8/lib/config/files/index-browser.js",
27-
"#lib/config/resolve-targets.js": "https://ga.jspm.io/npm:@babel/core@7.25.8/lib/config/resolve-targets-browser.js",
28-
"#lib/transform-file.js": "https://ga.jspm.io/npm:@babel/core@7.25.8/lib/transform-file-browser.js",
29-
"#node.js": "https://ga.jspm.io/npm:[email protected].0/browser.js",
26+
"#lib/config/files/index.js": "https://ga.jspm.io/npm:@babel/core@7.26.9/lib/config/files/index-browser.js",
27+
"#lib/config/resolve-targets.js": "https://ga.jspm.io/npm:@babel/core@7.26.9/lib/config/resolve-targets-browser.js",
28+
"#lib/transform-file.js": "https://ga.jspm.io/npm:@babel/core@7.26.9/lib/transform-file-browser.js",
29+
"#node.js": "https://ga.jspm.io/npm:[email protected].4/browser.js",
3030
"@ampproject/remapping": "https://ga.jspm.io/npm:@ampproject/[email protected]/dist/remapping.umd.js",
31-
"@babel/code-frame": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
32-
"@babel/compat-data/native-modules": "https://ga.jspm.io/npm:@babel/[email protected]/native-modules.js",
33-
"@babel/compat-data/plugins": "https://ga.jspm.io/npm:@babel/[email protected]/plugins.js",
34-
"@babel/core": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
35-
"@babel/generator": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
36-
"@babel/helper-annotate-as-pure": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
37-
"@babel/helper-compilation-targets": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
38-
"@babel/helper-create-class-features-plugin": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
39-
"@babel/helper-member-expression-to-functions": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
40-
"@babel/helper-module-imports": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
41-
"@babel/helper-module-transforms": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
42-
"@babel/helper-optimise-call-expression": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
43-
"@babel/helper-plugin-utils": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
44-
"@babel/helper-replace-supers": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
45-
"@babel/helper-simple-access": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
46-
"@babel/helper-skip-transparent-expression-wrappers": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
47-
"@babel/helper-string-parser": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
48-
"@babel/helper-validator-identifier": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
49-
"@babel/helper-validator-option": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
50-
"@babel/helpers": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
51-
"@babel/highlight": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
52-
"@babel/parser": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
53-
"@babel/plugin-syntax-jsx": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
54-
"@babel/plugin-syntax-typescript": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
55-
"@babel/plugin-transform-modules-commonjs": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
56-
"@babel/plugin-transform-typescript": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
57-
"@babel/template": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
58-
"@babel/traverse": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
59-
"@babel/types": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
60-
"@jridgewell/gen-mapping": "https://ga.jspm.io/npm:@jridgewell/[email protected]/dist/gen-mapping.umd.js",
31+
"@babel/code-frame": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
32+
"@babel/compat-data/native-modules": "https://ga.jspm.io/npm:@babel/[email protected]/native-modules.js",
33+
"@babel/compat-data/plugins": "https://ga.jspm.io/npm:@babel/[email protected]/plugins.js",
34+
"@babel/core": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
35+
"@babel/generator": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
36+
"@babel/helper-annotate-as-pure": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
37+
"@babel/helper-compilation-targets": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
38+
"@babel/helper-create-class-features-plugin": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
39+
"@babel/helper-member-expression-to-functions": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
40+
"@babel/helper-module-imports": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
41+
"@babel/helper-module-transforms": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
42+
"@babel/helper-optimise-call-expression": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
43+
"@babel/helper-plugin-utils": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
44+
"@babel/helper-replace-supers": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
45+
"@babel/helper-skip-transparent-expression-wrappers": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
46+
"@babel/helper-string-parser": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
47+
"@babel/helper-validator-identifier": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
48+
"@babel/helper-validator-option": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
49+
"@babel/helpers": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
50+
"@babel/parser": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
51+
"@babel/plugin-syntax-jsx": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
52+
"@babel/plugin-syntax-typescript": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
53+
"@babel/plugin-transform-modules-commonjs": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
54+
"@babel/plugin-transform-typescript": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
55+
"@babel/template": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
56+
"@babel/traverse": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
57+
"@babel/types": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js",
58+
"@jridgewell/gen-mapping": "https://ga.jspm.io/npm:@jridgewell/[email protected]/dist/gen-mapping.umd.js",
6159
"@jridgewell/resolve-uri": "https://ga.jspm.io/npm:@jridgewell/[email protected]/dist/resolve-uri.umd.js",
6260
"@jridgewell/set-array": "https://ga.jspm.io/npm:@jridgewell/[email protected]/dist/set-array.umd.js",
6361
"@jridgewell/sourcemap-codec": "https://ga.jspm.io/npm:@jridgewell/[email protected]/dist/sourcemap-codec.umd.js",
6462
"@jridgewell/trace-mapping": "https://ga.jspm.io/npm:@jridgewell/[email protected]/dist/trace-mapping.umd.js",
65-
"ansi-styles": "https://ga.jspm.io/npm:[email protected]/index.js",
66-
"browserslist": "https://ga.jspm.io/npm:[email protected]/index.js",
67-
"buffer": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/buffer.js",
68-
"caniuse-lite/dist/unpacker/agents": "https://ga.jspm.io/npm:[email protected]/dist/unpacker/agents.js",
69-
"chalk": "https://ga.jspm.io/npm:[email protected]/index.js",
70-
"color-convert": "https://ga.jspm.io/npm:[email protected]/index.js",
71-
"color-name": "https://ga.jspm.io/npm:[email protected]/index.js",
63+
"browserslist": "https://ga.jspm.io/npm:[email protected]/index.js",
64+
"buffer": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/buffer.js",
65+
"caniuse-lite/dist/unpacker/agents": "https://ga.jspm.io/npm:[email protected]/dist/unpacker/agents.js",
7266
"convert-source-map": "https://ga.jspm.io/npm:[email protected]/index.js",
73-
"debug": "https://ga.jspm.io/npm:[email protected]/src/browser.js",
74-
"electron-to-chromium/versions": "https://ga.jspm.io/npm:[email protected]/versions.js",
75-
"escape-string-regexp": "https://ga.jspm.io/npm:[email protected]/index.js",
76-
"fs": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/fs.js",
67+
"debug": "https://ga.jspm.io/npm:[email protected]/src/browser.js",
68+
"electron-to-chromium/versions": "https://ga.jspm.io/npm:[email protected]/versions.js",
69+
"fs": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/browser/fs.js",
7770
"gensync": "https://ga.jspm.io/npm:[email protected]/index.js",
7871
"globals": "https://ga.jspm.io/npm:[email protected]/index.js",
7972
"js-tokens": "https://ga.jspm.io/npm:[email protected]/index.js",
80-
"jsesc": "https://ga.jspm.io/npm:jsesc@2.5.2/jsesc.js",
73+
"jsesc": "https://ga.jspm.io/npm:jsesc@3.1.0/jsesc.js",
8174
"lru-cache": "https://ga.jspm.io/npm:[email protected]/index.js",
8275
"ms": "https://ga.jspm.io/npm:[email protected]/index.js",
83-
"node-releases/data/processed/envs.json": "https://ga.jspm.io/npm:[email protected].18/data/processed/envs.json.js",
84-
"node-releases/data/release-schedule/release-schedule.json": "https://ga.jspm.io/npm:[email protected].18/data/release-schedule/release-schedule.json.js",
85-
"path": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/path.js",
86-
"picocolors": "https://ga.jspm.io/npm:[email protected].0/picocolors.browser.js",
87-
"process": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/process-production.js",
76+
"node-releases/data/processed/envs.json": "https://ga.jspm.io/npm:[email protected].19/data/processed/envs.json.js",
77+
"node-releases/data/release-schedule/release-schedule.json": "https://ga.jspm.io/npm:[email protected].19/data/release-schedule/release-schedule.json.js",
78+
"path": "https://ga.jspm.io/npm:@jspm/core@2.1.0/nodelibs/browser/path.js",
79+
"picocolors": "https://ga.jspm.io/npm:[email protected].1/picocolors.browser.js",
80+
"process": "https://ga.jspm.io/npm:@jspm/core@2.1.0/nodelibs/browser/process-production.js",
8881
"semver": "https://ga.jspm.io/npm:[email protected]/semver.js",
89-
"supports-color": "https://ga.jspm.io/npm:[email protected]/browser.js",
90-
"to-fast-properties": "https://ga.jspm.io/npm:[email protected]/index.js",
9182
"yallist": "https://ga.jspm.io/npm:[email protected]/yallist.js"
92-
},
93-
"https://ga.jspm.io/npm:@babel/[email protected]/": {
94-
"@babel/helper-member-expression-to-functions": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js"
95-
},
96-
"https://ga.jspm.io/npm:@babel/[email protected]/": {
97-
"@babel/helper-skip-transparent-expression-wrappers": "https://ga.jspm.io/npm:@babel/[email protected]/lib/index.js"
9883
}
9984
}
10085
}

0 commit comments

Comments
 (0)