@jsenv/core 28.5.0 → 29.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "28.5.0",
3
+ "version": "29.0.0",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -123,8 +123,8 @@ export const build = async ({
123
123
  sourcemaps = false,
124
124
  sourcemapsSourcesContent,
125
125
  urlAnalysis = {},
126
- nodeEsmResolution = true,
127
- fileSystemMagicResolution,
126
+ urlResolution,
127
+ fileSystemMagicRedirection,
128
128
  directoryReferenceAllowed,
129
129
  transpilation = {},
130
130
  bundling = true,
@@ -221,8 +221,8 @@ build ${entryPointKeys.length} entry points`)
221
221
  runtimeCompat,
222
222
 
223
223
  urlAnalysis,
224
- nodeEsmResolution,
225
- fileSystemMagicResolution,
224
+ urlResolution,
225
+ fileSystemMagicRedirection,
226
226
  directoryReferenceAllowed,
227
227
  transpilation: {
228
228
  ...transpilation,
@@ -326,10 +326,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
326
326
  if (rawUrlInfo.content === reference.content) {
327
327
  return true
328
328
  }
329
- if (rawUrlInfo.originalContent === reference.content) {
330
- return true
331
- }
332
- return false
329
+ return rawUrlInfo.originalContent === reference.content
333
330
  })
334
331
  const parentUrlInfo = finalGraph.getUrlInfo(reference.parentUrl)
335
332
  if (!rawUrlInfo) {
@@ -635,7 +632,6 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
635
632
  const bundler = bundlers[rawUrlInfo.type]
636
633
  if (bundler) {
637
634
  bundler.urlInfos.push(rawUrlInfo)
638
- return
639
635
  }
640
636
  }
641
637
  GRAPH.forEach(rawGraph, (rawUrlInfo) => {
@@ -1510,18 +1506,12 @@ const isUsed = (urlInfo) => {
1510
1506
  if (urlInfo.injected) {
1511
1507
  return true
1512
1508
  }
1513
- if (urlInfo.dependents.size > 0) {
1514
- return true
1515
- }
1516
- return false
1509
+ return urlInfo.dependents.size > 0
1517
1510
  }
1518
1511
 
1519
1512
  const canUseVersionedUrl = (urlInfo) => {
1520
1513
  if (urlInfo.isEntryPoint) {
1521
1514
  return false
1522
1515
  }
1523
- if (urlInfo.type === "webmanifest") {
1524
- return false
1525
- }
1526
- return true
1516
+ return urlInfo.type !== "webmanifest"
1527
1517
  }
@@ -39,6 +39,7 @@ export const startDevServer = async ({
39
39
  "./jsenv.config.mjs": true,
40
40
  },
41
41
  clientAutoreload = true,
42
+ clientMainFileUrl,
42
43
  devServerAutoreload = false,
43
44
  devServerMainFile = getCallerPosition().url,
44
45
  cooldownBetweenFileEvents,
@@ -49,20 +50,11 @@ export const startDevServer = async ({
49
50
  runtimeCompat = defaultRuntimeCompat,
50
51
  plugins = [],
51
52
  urlAnalysis = {},
53
+ urlResolution,
52
54
  supervisor = true,
53
- nodeEsmResolution,
54
- fileSystemMagicResolution,
55
+ fileSystemMagicRedirection,
55
56
  transpilation,
56
- explorer = {
57
- groups: {
58
- src: {
59
- "./src/**/*.html": true,
60
- },
61
- tests: {
62
- "./tests/**/*.test.html": true,
63
- },
64
- },
65
- },
57
+ explorer = true, // see jsenv_plugin_explorer.js
66
58
  // toolbar = false,
67
59
 
68
60
  sourcemaps = "inline",
@@ -128,9 +120,6 @@ export const startDevServer = async ({
128
120
  worker.once("message", resolve)
129
121
  })
130
122
  const origin = await messagePromise
131
- // if (!keepProcessAlive) {
132
- // worker.unref()
133
- // }
134
123
  return {
135
124
  origin,
136
125
  stop: () => {
@@ -163,11 +152,12 @@ export const startDevServer = async ({
163
152
 
164
153
  plugins,
165
154
  urlAnalysis,
155
+ urlResolution,
156
+ fileSystemMagicRedirection,
166
157
  supervisor,
167
- nodeEsmResolution,
168
- fileSystemMagicResolution,
169
158
  transpilation,
170
159
  clientFiles,
160
+ clientMainFileUrl,
171
161
  clientAutoreload,
172
162
  cooldownBetweenFileEvents,
173
163
  explorer,
@@ -355,7 +355,6 @@ export const createRuntimeFromPlaywright = ({
355
355
  })
356
356
  }
357
357
  })
358
- return
359
358
  }
360
359
 
361
360
  try {
@@ -479,10 +478,7 @@ const isTargetClosedError = (error) => {
479
478
  if (error.message.match(/Protocol error \(.*?\): Browser.*?closed/)) {
480
479
  return true
481
480
  }
482
- if (error.message.includes("browserContext.close: Browser closed")) {
483
- return true
484
- }
485
- return false
481
+ return error.message.includes("browserContext.close: Browser closed")
486
482
  }
487
483
 
488
484
  const extractTextFromConsoleMessage = (consoleMessage) => {
@@ -134,6 +134,7 @@ export const createKitchen = ({
134
134
  isResourceHint,
135
135
  isImplicit,
136
136
  hasVersioningEffect,
137
+ version: null,
137
138
  injected,
138
139
  timing: {},
139
140
  // for inline resources the reference contains the content
@@ -936,53 +937,3 @@ const determineFileUrlForOutDirectory = ({ urlInfo, context }) => {
936
937
  preferAbsolute: true,
937
938
  })
938
939
  }
939
-
940
- // import { getOriginalPosition } from "@jsenv/core/src/utils/sourcemap/original_position.js"
941
- // const getUrlSite = async (
942
- // urlInfo,
943
- // { line, column, originalLine, originalColumn },
944
- // ) => {
945
- // if (typeof originalLine === "number") {
946
- // return {
947
- // url: urlInfo.url,
948
- // line: originalLine,
949
- // column: originalColumn,
950
- // }
951
- // }
952
- // if (urlInfo.content === urlInfo.originalContent) {
953
- // return {
954
- // url: urlInfo.url,
955
- // line,
956
- // column,
957
- // }
958
- // }
959
- // // at this point things were transformed: line and column are generated
960
- // // no sourcemap -> cannot map back to original file
961
- // const { sourcemap } = urlInfo
962
- // if (!sourcemap) {
963
- // return {
964
- // url: urlInfo.generatedUrl,
965
- // content: urlInfo.content,
966
- // line,
967
- // column,
968
- // }
969
- // }
970
- // const originalPosition = await getOriginalPosition({
971
- // sourcemap,
972
- // line,
973
- // column,
974
- // })
975
- // // cannot map back to original file
976
- // if (!originalPosition || originalPosition.line === null) {
977
- // return {
978
- // url: urlInfo.generatedUrl,
979
- // line,
980
- // column,
981
- // }
982
- // }
983
- // return {
984
- // url: urlInfo.url,
985
- // line: originalPosition.line,
986
- // column: originalPosition.column,
987
- // }
988
- // }
@@ -30,12 +30,13 @@ export const startOmegaServer = async ({
30
30
 
31
31
  plugins,
32
32
  urlAnalysis,
33
+ urlResolution,
34
+ fileSystemMagicRedirection,
33
35
  supervisor,
34
- nodeEsmResolution,
35
- fileSystemMagicResolution,
36
36
  transpilation,
37
37
  clientAutoreload,
38
38
  clientFiles,
39
+ clientMainFileUrl,
39
40
  cooldownBetweenFileEvents,
40
41
  explorer,
41
42
  sourcemaps,
@@ -92,12 +93,13 @@ export const startOmegaServer = async ({
92
93
 
93
94
  plugins,
94
95
  urlAnalysis,
96
+ urlResolution,
97
+ fileSystemMagicRedirection,
95
98
  supervisor,
96
- nodeEsmResolution,
97
- fileSystemMagicResolution,
98
99
  transpilation,
99
100
  clientAutoreload,
100
101
  clientFiles,
102
+ clientMainFileUrl,
101
103
  cooldownBetweenFileEvents,
102
104
  explorer,
103
105
  sourcemaps,
@@ -26,12 +26,13 @@ export const createFileService = ({
26
26
 
27
27
  plugins,
28
28
  urlAnalysis,
29
+ urlResolution,
30
+ fileSystemMagicRedirection,
29
31
  supervisor,
30
- nodeEsmResolution,
31
- fileSystemMagicResolution,
32
32
  transpilation,
33
33
  clientAutoreload,
34
34
  clientFiles,
35
+ clientMainFileUrl,
35
36
  cooldownBetweenFileEvents,
36
37
  explorer,
37
38
  sourcemaps,
@@ -127,11 +128,12 @@ export const createFileService = ({
127
128
  runtimeCompat,
128
129
 
129
130
  urlAnalysis,
131
+ urlResolution,
132
+ fileSystemMagicRedirection,
130
133
  supervisor,
131
- nodeEsmResolution,
132
- fileSystemMagicResolution,
133
134
  transpilation,
134
135
 
136
+ clientMainFileUrl,
135
137
  clientAutoreload,
136
138
  clientFileChangeCallbackList,
137
139
  clientFilesPruneCallbackList,
@@ -144,9 +146,7 @@ export const createFileService = ({
144
146
  writeGeneratedFiles,
145
147
  outDirectoryUrl: scenarios.dev
146
148
  ? `${rootDirectoryUrl}.jsenv/${runtimeName}@${runtimeVersion}/`
147
- : `${rootDirectoryUrl}.jsenv/${
148
- scenarios.test ? "test" : "build"
149
- }/${runtimeName}@${runtimeVersion}/`,
149
+ : `${rootDirectoryUrl}.jsenv/build/${runtimeName}@${runtimeVersion}/`,
150
150
  })
151
151
  urlGraph.createUrlInfoCallbackRef.current = (urlInfo) => {
152
152
  const { watch } = URL_META.applyAssociations({
@@ -352,7 +352,9 @@ export const createFileService = ({
352
352
  return {
353
353
  url: reference.url,
354
354
  status: 200, // let the browser re-throw the syntax error
355
- statusText: originalError.reason,
355
+ // reason becomes the http response statusText, it must not contain invalid chars
356
+ // https://github.com/nodejs/node/blob/0c27ca4bc9782d658afeaebcec85ec7b28f1cc35/lib/_http_common.js#L221
357
+ statusText: e.reason,
356
358
  statusMessage: originalError.message,
357
359
  headers: {
358
360
  "content-type": urlInfo.contentType,
@@ -31,7 +31,7 @@ export const urlSpecifierEncoding = {
31
31
  const formatters = {
32
32
  "js_import_export": { encode: JSON.stringify, decode: JSON.parse },
33
33
  "js_url_specifier": { encode: JSON.stringify, decode: JSON.parse },
34
- "css_@import": { encode: JSON.stringify, code: JSON.stringify },
34
+ "css_@import": { encode: JSON.stringify, decode: JSON.stringify },
35
35
  // https://github.com/webpack-contrib/css-loader/pull/627/files
36
36
  "css_url": {
37
37
  encode: (url) => {
@@ -197,11 +197,3 @@ window.__server_events__.listenEvents({
197
197
  reloader.addMessage(reloadServerEvent.data)
198
198
  },
199
199
  })
200
-
201
- // const findHotMetaUrl = (originalFileRelativeUrl) => {
202
- // return Object.keys(urlHotMetas).find((compileUrl) => {
203
- // return (
204
- // parseCompiledUrl(compileUrl).fileRelativeUrl === originalFileRelativeUrl
205
- // )
206
- // })
207
- // }
@@ -99,7 +99,6 @@ export const jsenvPluginAutoreloadServer = ({
99
99
  return dependentPropagationResult
100
100
  }
101
101
  // declined by absence of boundary, we can keep searching
102
- continue
103
102
  }
104
103
  if (instructions.length === 0) {
105
104
  return {
@@ -2,17 +2,7 @@ export const jsenvPluginCacheControl = () => {
2
2
  return {
3
3
  name: "jsenv:cache_control",
4
4
  appliesDuring: "dev",
5
- augmentResponse: ({ reference }, context) => {
6
- if (context.scenarios.test) {
7
- // During dev, all files are put into browser cache for 1 hour because:
8
- // 1: Browser cache is a temporary directory created by playwright
9
- // 2: We assume source files won't be modified while tests are running
10
- return {
11
- headers: {
12
- "cache-control": `private,max-age=3600,immutable`,
13
- },
14
- }
15
- }
5
+ augmentResponse: ({ reference }) => {
16
6
  if (
17
7
  reference.searchParams.has("v") &&
18
8
  !reference.searchParams.has("hmr")
@@ -365,7 +365,7 @@
365
365
  </section>
366
366
  </article>
367
367
  </div>
368
- <script>
368
+ <script no-supervisor>
369
369
  // eslint-disable-next-line no-undef
370
370
  const { rootDirectoryUrl, groups, files } = SERVER_PARAMS
371
371
 
@@ -479,7 +479,7 @@
479
479
 
480
480
  document.querySelector("main").appendChild(fileListElement)
481
481
  </script>
482
- <script>
482
+ <script no-supervisor>
483
483
  // make menu scrollable
484
484
  const getMenuWrapperSize = () => {
485
485
  return document.querySelector(".menu-wrapper").getBoundingClientRect()
@@ -3,65 +3,85 @@ import { DATA_URL } from "@jsenv/urls"
3
3
  import { collectFiles } from "@jsenv/filesystem"
4
4
  import { CONTENT_TYPE } from "@jsenv/utils/src/content_type/content_type.js"
5
5
 
6
- export const jsenvPluginExplorer = ({ groups }) => {
7
- const htmlClientFileUrl = new URL("./client/explorer.html", import.meta.url)
6
+ export const explorerHtmlFileUrl = new URL(
7
+ "./client/explorer.html",
8
+ import.meta.url,
9
+ )
10
+
11
+ export const jsenvPluginExplorer = ({
12
+ groups = {
13
+ src: {
14
+ "./src/**/*.html": true,
15
+ },
16
+ tests: {
17
+ "./tests/**/*.test.html": true,
18
+ },
19
+ },
20
+ clientMainFileUrl,
21
+ }) => {
8
22
  const faviconClientFileUrl = new URL("./client/jsenv.png", import.meta.url)
9
23
 
10
24
  return {
11
25
  name: "jsenv:explorer",
12
26
  appliesDuring: "dev",
13
- serve: async (request, { rootDirectoryUrl }) => {
14
- if (request.pathname !== "/") {
15
- return null
16
- }
17
- const associationsForExplorable = {}
18
- Object.keys(groups).forEach((groupName) => {
19
- const groupConfig = groups[groupName]
20
- associationsForExplorable[groupName] = {
21
- "**/.jsenv/": false, // avoid visting .jsenv directory in jsenv itself
22
- ...groupConfig,
27
+ transformUrlContent: {
28
+ html: async (urlInfo, context) => {
29
+ if (urlInfo.url !== clientMainFileUrl) {
30
+ return null
31
+ }
32
+ let html = urlInfo.content
33
+ if (html.includes("ignore:FAVICON_HREF")) {
34
+ html = html.replace(
35
+ "ignore:FAVICON_HREF",
36
+ DATA_URL.stringify({
37
+ contentType: CONTENT_TYPE.fromUrlExtension(faviconClientFileUrl),
38
+ base64Flag: true,
39
+ data: readFileSync(new URL(faviconClientFileUrl)).toString(
40
+ "base64",
41
+ ),
42
+ }),
43
+ )
44
+ }
45
+ if (html.includes("SERVER_PARAMS")) {
46
+ const associationsForExplorable = {}
47
+ Object.keys(groups).forEach((groupName) => {
48
+ const groupConfig = groups[groupName]
49
+ associationsForExplorable[groupName] = {
50
+ "**/.jsenv/": false, // avoid visting .jsenv directory in jsenv itself
51
+ ...groupConfig,
52
+ }
53
+ })
54
+ const matchingFileResultArray = await collectFiles({
55
+ directoryUrl: context.rootDirectoryUrl,
56
+ associations: associationsForExplorable,
57
+ predicate: (meta) =>
58
+ Object.keys(meta).some((group) => Boolean(meta[group])),
59
+ })
60
+ const files = matchingFileResultArray.map(
61
+ ({ relativeUrl, meta }) => ({
62
+ relativeUrl,
63
+ meta,
64
+ }),
65
+ )
66
+
67
+ html = html.replace(
68
+ "SERVER_PARAMS",
69
+ JSON.stringify(
70
+ {
71
+ rootDirectoryUrl: context.rootDirectoryUrl,
72
+ groups,
73
+ files,
74
+ },
75
+ null,
76
+ " ",
77
+ ),
78
+ )
79
+ Object.assign(urlInfo.headers, {
80
+ "cache-control": "no-store",
81
+ })
23
82
  }
24
- })
25
- const matchingFileResultArray = await collectFiles({
26
- directoryUrl: rootDirectoryUrl,
27
- associations: associationsForExplorable,
28
- predicate: (meta) =>
29
- Object.keys(meta).some((group) => Boolean(meta[group])),
30
- })
31
- const files = matchingFileResultArray.map(({ relativeUrl, meta }) => ({
32
- relativeUrl,
33
- meta,
34
- }))
35
- let html = String(readFileSync(new URL(htmlClientFileUrl)))
36
- html = html.replace(
37
- "ignore:FAVICON_HREF",
38
- DATA_URL.stringify({
39
- contentType: CONTENT_TYPE.fromUrlExtension(faviconClientFileUrl),
40
- base64Flag: true,
41
- data: readFileSync(new URL(faviconClientFileUrl)).toString("base64"),
42
- }),
43
- )
44
- html = html.replace(
45
- "SERVER_PARAMS",
46
- JSON.stringify(
47
- {
48
- rootDirectoryUrl,
49
- groups,
50
- files,
51
- },
52
- null,
53
- " ",
54
- ),
55
- )
56
- return {
57
- status: 200,
58
- headers: {
59
- "cache-control": "no-store",
60
- "content-type": "text/html",
61
- "content-length": Buffer.byteLength(html),
62
- },
63
- body: html,
64
- }
83
+ return html
84
+ },
65
85
  },
66
86
  }
67
87
  }
@@ -125,14 +125,9 @@ const htmlNodeCanHotReload = (node) => {
125
125
  return true
126
126
  }
127
127
  if (isResourceHint) {
128
- // for resource hints html will be notified the underlying resource has changed
129
- // but we won't do anything (if the resource is deleted we should?)
130
- return true
131
- }
132
- if (rel === "icon") {
133
- return true
128
+ return false
134
129
  }
135
- return false
130
+ return rel === "icon"
136
131
  }
137
132
  return [
138
133
  // "script_src", // script src cannot hot reload
@@ -1,8 +1,6 @@
1
1
  import { jsenvPluginUrlAnalysis } from "../plugins/url_analysis/jsenv_plugin_url_analysis.js"
2
- import { jsenvPluginLeadingSlash } from "./leading_slash/jsenv_plugin_leading_slash.js"
3
2
  import { jsenvPluginImportmap } from "./importmap/jsenv_plugin_importmap.js"
4
3
  import { jsenvPluginUrlResolution } from "./url_resolution/jsenv_plugin_url_resolution.js"
5
- import { jsenvPluginNodeEsmResolution } from "./node_esm_resolution/jsenv_plugin_node_esm_resolution.js"
6
4
  import { jsenvPluginUrlVersion } from "./url_version/jsenv_plugin_url_version.js"
7
5
  import { jsenvPluginFileUrls } from "./file_urls/jsenv_plugin_file_urls.js"
8
6
  import { jsenvPluginHttpUrls } from "./http_urls/jsenv_plugin_http_urls.js"
@@ -20,38 +18,49 @@ import { jsenvPluginImportMetaHot } from "./import_meta_hot/jsenv_plugin_import_
20
18
  import { jsenvPluginAutoreload } from "./autoreload/jsenv_plugin_autoreload.js"
21
19
  import { jsenvPluginCacheControl } from "./cache_control/jsenv_plugin_cache_control.js"
22
20
  // dev only
23
- import { jsenvPluginExplorer } from "./explorer/jsenv_plugin_explorer.js"
21
+ import {
22
+ explorerHtmlFileUrl,
23
+ jsenvPluginExplorer,
24
+ } from "./explorer/jsenv_plugin_explorer.js"
24
25
 
25
26
  export const getCorePlugins = ({
26
27
  rootDirectoryUrl,
27
28
  runtimeCompat,
28
29
 
29
30
  urlAnalysis = {},
30
- supervisor,
31
- nodeEsmResolution = true,
32
- fileSystemMagicResolution,
31
+ urlResolution = {},
32
+ fileSystemMagicRedirection,
33
33
  directoryReferenceAllowed,
34
+ supervisor,
34
35
  transpilation = true,
35
36
  minification = false,
36
37
  bundling = false,
37
38
 
39
+ clientMainFileUrl,
38
40
  clientAutoreload = false,
39
41
  clientFileChangeCallbackList,
40
42
  clientFilesPruneCallbackList,
41
43
  explorer,
42
44
  } = {}) => {
45
+ if (explorer === true) {
46
+ explorer = {}
47
+ }
43
48
  if (supervisor === true) {
44
49
  supervisor = {}
45
50
  }
46
- if (nodeEsmResolution === true) {
47
- nodeEsmResolution = {}
48
- }
49
- if (fileSystemMagicResolution === true) {
50
- fileSystemMagicResolution = {}
51
+ if (fileSystemMagicRedirection === true) {
52
+ fileSystemMagicRedirection = {}
51
53
  }
52
54
  if (clientAutoreload === true) {
53
55
  clientAutoreload = {}
54
56
  }
57
+ if (clientMainFileUrl === undefined) {
58
+ clientMainFileUrl = explorer
59
+ ? String(explorerHtmlFileUrl)
60
+ : String(new URL("./index.html", rootDirectoryUrl))
61
+ } else {
62
+ clientMainFileUrl = String(clientMainFileUrl)
63
+ }
55
64
 
56
65
  return [
57
66
  jsenvPluginUrlAnalysis({ rootDirectoryUrl, ...urlAnalysis }),
@@ -63,13 +72,14 @@ export const getCorePlugins = ({
63
72
  jsenvPluginInline(), // before "file urls" to resolve and load inline urls
64
73
  jsenvPluginFileUrls({
65
74
  directoryReferenceAllowed,
66
- ...fileSystemMagicResolution,
75
+ ...fileSystemMagicRedirection,
67
76
  }),
68
77
  jsenvPluginHttpUrls(),
69
- jsenvPluginLeadingSlash(),
70
- // before url resolution to handle "js_import_export" resolution
71
- jsenvPluginNodeEsmResolution(nodeEsmResolution),
72
- jsenvPluginUrlResolution(),
78
+ jsenvPluginUrlResolution({
79
+ runtimeCompat,
80
+ urlResolution,
81
+ clientMainFileUrl,
82
+ }),
73
83
  jsenvPluginUrlVersion(),
74
84
  jsenvPluginCommonJsGlobals(),
75
85
  jsenvPluginImportMetaScenarios(),
@@ -89,6 +99,13 @@ export const getCorePlugins = ({
89
99
  ]
90
100
  : []),
91
101
  jsenvPluginCacheControl(),
92
- ...(explorer ? [jsenvPluginExplorer(explorer)] : []),
102
+ ...(explorer
103
+ ? [
104
+ jsenvPluginExplorer({
105
+ ...explorer,
106
+ clientMainFileUrl,
107
+ }),
108
+ ]
109
+ : []),
93
110
  ]
94
111
  }
@@ -191,11 +191,13 @@ window.__supervisor__ = (() => {
191
191
  }
192
192
 
193
193
  const stringifyUrlSite = ({ url, line, column }) => {
194
- return typeof line === "number" && typeof column === "number"
195
- ? `${url}:${line}:${column}`
196
- : typeof line === "number"
197
- ? `${url}:${line}`
198
- : url
194
+ if (typeof line === "number" && typeof column === "number") {
195
+ return `${url}:${line}:${column}`
196
+ }
197
+ if (typeof line === "number") {
198
+ return `${url}:${line}`
199
+ }
200
+ return url
199
201
  }
200
202
 
201
203
  const resolveUrlSite = ({ url, line, column }) => {
@@ -913,10 +915,7 @@ window.__supervisor__ = (() => {
913
915
  if (type && supervisedScriptCandidate.type !== type) {
914
916
  return false
915
917
  }
916
- if (supervisedScriptCandidate.src !== src) {
917
- return false
918
- }
919
- return true
918
+ return supervisedScriptCandidate.src === src
920
919
  },
921
920
  )
922
921
  if (supervisedScript) {
@@ -116,9 +116,6 @@ export const fetchUsingXHR = async (
116
116
  if (responseBodyType === "arrayBuffer") {
117
117
  return arrayBufferToText(responseBody)
118
118
  }
119
- // if (responseBodyType === "text" || responseBodyType === 'searchParams') {
120
- // return body
121
- // }
122
119
  return String(responseBody)
123
120
  }
124
121