@jsenv/core 29.9.0 → 29.9.2

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/README.md CHANGED
@@ -17,7 +17,7 @@ https://github.com/jsenv/jsenv-core/wiki
17
17
  npm install --save-dev @jsenv/core
18
18
  ```
19
19
 
20
- _@jsenv/core_ is tested on Mac, Windows, Linux with Node.js 18.12.1.
20
+ _@jsenv/core_ is tested on Mac, Windows, Linux with Node.js 18.
21
21
  Other operating systems and Node.js versions are not tested.
22
22
 
23
23
  # Name
@@ -133,6 +133,7 @@ h4 {
133
133
  padding-top: 25px;
134
134
  padding-left: 25px;
135
135
  padding-right: 25px;
136
+ position: relative;
136
137
  }
137
138
 
138
139
  #explorables_header_bottom_spacing {
@@ -177,7 +178,7 @@ h4 {
177
178
  fill: #24b1b0;
178
179
  }
179
180
 
180
- #fileIconSvgConfig {
181
+ #explorables_icon {
181
182
  width: 25px;
182
183
  height: 25px;
183
184
  stroke: none;
@@ -285,8 +286,8 @@ h4 {
285
286
  <section id="explorables">
286
287
  <div id="explorables-header">
287
288
  <div id="explorables_header_and_menu">
288
- <h2 style="white-space: nowrap">
289
- <svg id="fileIconSvgConfig" viewBox="0 0 24 24" width="32" height="32">
289
+ <h2>
290
+ <svg id="explorables_icon" viewBox="0 0 24 24" width="32" height="32">
290
291
  <path d="M0 0h24v24H0V0z" fill="none"></path>
291
292
  <path d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"></path>
292
293
  </svg>
@@ -1,24 +1,19 @@
1
1
  import { urlHotMetas } from "./import_meta_hot.js";
2
2
  import { parseSrcSet, stringifySrcSet } from "@jsenv/ast/src/html/html_src_set.js";
3
3
 
4
- const isAutoreloadEnabled = () => {
5
- const value = window.localStorage.getItem("autoreload");
6
- if (value === "0") {
7
- return false;
8
- }
9
- return true;
10
- };
11
- const setAutoreloadPreference = value => {
12
- window.localStorage.setItem("autoreload", value ? "1" : "0");
13
- };
14
-
15
4
  const compareTwoUrlPaths = (url, otherUrl) => {
16
5
  if (url === otherUrl) {
17
6
  return true;
18
7
  }
19
8
  const urlObject = new URL(url);
20
9
  const otherUrlObject = new URL(otherUrl);
21
- return urlObject.origin === otherUrlObject.origin && urlObject.pathname === otherUrlObject.pathname;
10
+ if (urlObject.origin !== otherUrlObject.origin) {
11
+ return false;
12
+ }
13
+ if (urlObject.pathname !== otherUrlObject.pathname) {
14
+ return false;
15
+ }
16
+ return true;
22
17
  };
23
18
  const injectQuery = (url, query) => {
24
19
  const urlObject = new URL(url);
@@ -157,44 +152,68 @@ const reloadJsImport = async url => {
157
152
 
158
153
  const reloader = {
159
154
  urlHotMetas,
160
- isAutoreloadEnabled,
161
- setAutoreloadPreference,
162
- status: "idle",
163
- currentExecution: null,
164
- onstatuschange: () => {},
165
- setStatus: status => {
166
- reloader.status = status;
167
- reloader.onstatuschange();
155
+ status: {
156
+ value: "idle",
157
+ onchange: () => {},
158
+ goTo: value => {
159
+ reloader.status.value = value;
160
+ reloader.status.onchange();
161
+ }
168
162
  },
169
- messages: [],
170
- addMessage: reloadMessage => {
171
- reloader.messages.push(reloadMessage);
172
- if (isAutoreloadEnabled()) {
173
- reloader.reload();
174
- } else {
175
- reloader.setStatus("can_reload");
163
+ autoreload: {
164
+ enabled: ["1", null].includes(window.localStorage.getItem("autoreload")),
165
+ onchange: () => {},
166
+ enable: () => {
167
+ reloader.autoreload.enabled = true;
168
+ window.localStorage.setItem("autoreload", "1");
169
+ reloader.autoreload.onchange();
170
+ },
171
+ disable: () => {
172
+ reloader.autoreload.enabled = false;
173
+ window.localStorage.setItem("autoreload", "0");
174
+ reloader.autoreload.onchange();
176
175
  }
177
176
  },
177
+ changes: {
178
+ value: [],
179
+ onchange: () => {},
180
+ add: reloadMessage => {
181
+ reloader.changes.value.push(reloadMessage);
182
+ reloader.changes.onchange();
183
+ if (reloader.autoreload.enabled) {
184
+ reloader.reload();
185
+ } else {
186
+ reloader.status.goTo("can_reload");
187
+ }
188
+ },
189
+ remove: reloadMessage => {
190
+ const index = reloader.changes.value.indexOf(reloadMessage);
191
+ if (index > -1) {
192
+ reloader.changes.value.splice(index, 1);
193
+ if (reloader.changes.value.length === 0) {
194
+ reloader.status.goTo("idle");
195
+ }
196
+ reloader.changes.onchange();
197
+ }
198
+ }
199
+ },
200
+ currentExecution: null,
178
201
  reload: () => {
179
- const someEffectIsFullReload = reloader.messages.some(reloadMessage => reloadMessage.type === "full");
202
+ const someEffectIsFullReload = reloader.changes.value.some(reloadMessage => reloadMessage.type === "full");
180
203
  if (someEffectIsFullReload) {
181
204
  reloadHtmlPage();
182
205
  return;
183
206
  }
184
- reloader.setStatus("reloading");
207
+ reloader.status.goTo("reloading");
185
208
  const onApplied = reloadMessage => {
186
- const index = reloader.messages.indexOf(reloadMessage);
187
- reloader.messages.splice(index, 1);
188
- if (reloader.messages.length === 0) {
189
- reloader.setStatus("idle");
190
- }
209
+ reloader.changes.remove(reloadMessage);
191
210
  };
192
211
  const setReloadMessagePromise = (reloadMessage, promise) => {
193
212
  promise.then(() => {
194
213
  onApplied(reloadMessage);
195
214
  reloader.currentExecution = null;
196
215
  }, e => {
197
- reloader.setStatus("failed");
216
+ reloader.status.goTo("failed");
198
217
  if (typeof window.reportError === "function") {
199
218
  window.reportError(e);
200
219
  } else {
@@ -205,7 +224,7 @@ This could be due to syntax errors or importing non-existent modules (see errors
205
224
  reloader.currentExecution = null;
206
225
  });
207
226
  };
208
- reloader.messages.forEach(reloadMessage => {
227
+ reloader.changes.value.forEach(reloadMessage => {
209
228
  if (reloadMessage.type === "hot") {
210
229
  const promise = addToHotQueue(() => {
211
230
  return applyHotReload(reloadMessage);
@@ -297,7 +316,8 @@ const applyHotReload = async ({
297
316
  return namespace;
298
317
  }
299
318
  if (type === "html") {
300
- if (!compareTwoUrlPaths(urlToFetch, window.location.href)) {
319
+ const isRootHtmlFile = window.location.pathname === "/" && new URL(urlToFetch).pathname.slice(1).indexOf("/") === -1;
320
+ if (!isRootHtmlFile && !compareTwoUrlPaths(urlToFetch, window.location.href)) {
301
321
  // we are not in that HTML page
302
322
  return null;
303
323
  }
@@ -325,6 +345,6 @@ const applyHotReload = async ({
325
345
  window.__reloader__ = reloader;
326
346
  window.__server_events__.listenEvents({
327
347
  reload: reloadServerEvent => {
328
- reloader.addMessage(reloadServerEvent.data);
348
+ reloader.changes.add(reloadServerEvent.data);
329
349
  }
330
350
  });
@@ -30,7 +30,8 @@ const createConnectionManager = (attemptConnection, {
30
30
  let msSpent = 0;
31
31
  const attempt = () => {
32
32
  readyState.goTo(READY_STATES.CONNECTING);
33
- _disconnect = attemptConnection({
33
+ let timeout;
34
+ const cancelAttempt = attemptConnection({
34
35
  onClosed: () => {
35
36
  if (!retry) {
36
37
  readyState.goTo(READY_STATES.CLOSED);
@@ -47,7 +48,6 @@ const createConnectionManager = (attemptConnection, {
47
48
  console.info(`[jsenv] could not connect to server in less than ${retryAllocatedMs}ms`);
48
49
  return;
49
50
  }
50
-
51
51
  // if closed while open -> connection lost
52
52
  // otherwise it's the attempt to connect for the first time
53
53
  // or to reconnect
@@ -55,7 +55,7 @@ const createConnectionManager = (attemptConnection, {
55
55
  console.info(`[jsenv] server connection lost; retrying to connect`);
56
56
  }
57
57
  retryCount++;
58
- setTimeout(() => {
58
+ timeout = setTimeout(() => {
59
59
  msSpent += retryAfter;
60
60
  attempt();
61
61
  }, retryAfter);
@@ -65,8 +65,13 @@ const createConnectionManager = (attemptConnection, {
65
65
  // console.info(`[jsenv] connected to server`)
66
66
  }
67
67
  });
68
- };
69
68
 
69
+ _disconnect = () => {
70
+ cancelAttempt();
71
+ clearTimeout(timeout);
72
+ readyState.goTo(READY_STATES.CLOSED);
73
+ };
74
+ };
70
75
  attempt();
71
76
  };
72
77
  const disconnect = () => {
@@ -650,8 +650,10 @@ window.__supervisor__ = (() => {
650
650
  errorDetailsPromise
651
651
  });
652
652
  if (window.__reloader__) {
653
- window.__reloader__.onstatuschange = () => {
654
- if (window.__reloader__.status === "reloading") {
653
+ const onchange = window.__reloader__.status.onchange;
654
+ window.__reloader__.status.onchange = () => {
655
+ onchange();
656
+ if (window.__reloader__.status.value === "reloading") {
655
657
  removeErrorOverlay();
656
658
  }
657
659
  };
package/dist/main.js CHANGED
@@ -2367,7 +2367,7 @@ const error = (...args) => console.error(...args);
2367
2367
  const errorDisabled = () => {};
2368
2368
 
2369
2369
  // From: https://github.com/sindresorhus/has-flag/blob/main/index.js
2370
- function hasFlag(flag, argv = process$1.argv) {
2370
+ function hasFlag(flag, argv = globalThis.Deno?.args ?? process$1.argv) {
2371
2371
  const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
2372
2372
  const position = argv.indexOf(prefix + flag);
2373
2373
  const terminatorPosition = argv.indexOf('--');
@@ -2424,6 +2424,12 @@ function _supportsColor(haveStream, {
2424
2424
  return 2;
2425
2425
  }
2426
2426
  }
2427
+
2428
+ // Check for Azure DevOps pipelines.
2429
+ // Has to be above the `!streamIsTTY` check.
2430
+ if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
2431
+ return 1;
2432
+ }
2427
2433
  if (haveStream && !streamIsTTY && forceColor === undefined) {
2428
2434
  return 0;
2429
2435
  }
@@ -2441,7 +2447,10 @@ function _supportsColor(haveStream, {
2441
2447
  return 1;
2442
2448
  }
2443
2449
  if ('CI' in env) {
2444
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
2450
+ if ('GITHUB_ACTIONS' in env) {
2451
+ return 3;
2452
+ }
2453
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
2445
2454
  return 1;
2446
2455
  }
2447
2456
  return min;
@@ -2449,14 +2458,12 @@ function _supportsColor(haveStream, {
2449
2458
  if ('TEAMCITY_VERSION' in env) {
2450
2459
  return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2451
2460
  }
2452
-
2453
- // Check for Azure DevOps pipelines
2454
- if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
2455
- return 1;
2456
- }
2457
2461
  if (env.COLORTERM === 'truecolor') {
2458
2462
  return 3;
2459
2463
  }
2464
+ if (env.TERM === 'xterm-kitty') {
2465
+ return 3;
2466
+ }
2460
2467
  if ('TERM_PROGRAM' in env) {
2461
2468
  const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2462
2469
  switch (env.TERM_PROGRAM) {
@@ -20701,7 +20708,7 @@ const jsenvPluginRibbon = ({
20701
20708
  appliesDuring: "dev",
20702
20709
  transformUrlContent: {
20703
20710
  html: (urlInfo, context) => {
20704
- if (urlInfo.data.noribbon) {
20711
+ if (urlInfo.data.isJsenvToolbar || urlInfo.data.noribbon) {
20705
20712
  return null;
20706
20713
  }
20707
20714
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "29.9.0",
3
+ "version": "29.9.2",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -67,15 +67,15 @@
67
67
  "@c88/v8-coverage": "0.1.1",
68
68
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
69
69
  "@jsenv/abort": "4.2.4",
70
- "@jsenv/ast": "1.4.7",
70
+ "@jsenv/ast": "1.4.8",
71
71
  "@jsenv/babel-plugins": "1.1.0",
72
72
  "@jsenv/filesystem": "4.1.6",
73
73
  "@jsenv/importmap": "1.2.1",
74
74
  "@jsenv/integrity": "0.0.1",
75
- "@jsenv/log": "3.3.1",
75
+ "@jsenv/log": "3.3.2",
76
76
  "@jsenv/node-esm-resolution": "1.0.1",
77
- "@jsenv/server": "14.1.10",
78
- "@jsenv/sourcemap": "1.0.7",
77
+ "@jsenv/server": "14.1.11",
78
+ "@jsenv/sourcemap": "1.0.8",
79
79
  "@jsenv/uneval": "1.6.0",
80
80
  "@jsenv/url-meta": "7.0.0",
81
81
  "@jsenv/urls": "1.2.8",
@@ -90,10 +90,10 @@
90
90
  "istanbul-reports": "3.1.5",
91
91
  "launch-editor": "2.6.0",
92
92
  "pidtree": "0.6.0",
93
- "rollup": "3.5.0",
93
+ "rollup": "3.7.4",
94
94
  "string-width": "5.1.2",
95
95
  "strip-ansi": "7.0.1",
96
- "terser": "5.16.0",
96
+ "terser": "5.16.1",
97
97
  "v8-to-istanbul": "9.0.1",
98
98
  "wrap-ansi": "8.0.1"
99
99
  },
@@ -106,11 +106,11 @@
106
106
  "@jsenv/https-local": "3.0.1",
107
107
  "@jsenv/package-workspace": "0.5.1",
108
108
  "@jsenv/performance-impact": "3.0.2",
109
- "eslint": "8.28.0",
109
+ "eslint": "8.29.0",
110
110
  "eslint-plugin-html": "7.1.0",
111
111
  "eslint-plugin-import": "2.26.0",
112
112
  "eslint-plugin-react": "7.31.11",
113
113
  "playwright": "1.28.1",
114
- "prettier": "2.8.0"
114
+ "prettier": "2.8.1"
115
115
  }
116
116
  }
@@ -1,8 +1,4 @@
1
1
  import { urlHotMetas } from "../../import_meta_hot/client/import_meta_hot.js"
2
- import {
3
- isAutoreloadEnabled,
4
- setAutoreloadPreference,
5
- } from "./autoreload_preference.js"
6
2
  import { compareTwoUrlPaths } from "./url_helpers.js"
7
3
  import {
8
4
  reloadHtmlPage,
@@ -12,39 +8,63 @@ import {
12
8
 
13
9
  const reloader = {
14
10
  urlHotMetas,
15
- isAutoreloadEnabled,
16
- setAutoreloadPreference,
17
- status: "idle",
18
- currentExecution: null,
19
- onstatuschange: () => {},
20
- setStatus: (status) => {
21
- reloader.status = status
22
- reloader.onstatuschange()
11
+ status: {
12
+ value: "idle",
13
+ onchange: () => {},
14
+ goTo: (value) => {
15
+ reloader.status.value = value
16
+ reloader.status.onchange()
17
+ },
23
18
  },
24
- messages: [],
25
- addMessage: (reloadMessage) => {
26
- reloader.messages.push(reloadMessage)
27
- if (isAutoreloadEnabled()) {
28
- reloader.reload()
29
- } else {
30
- reloader.setStatus("can_reload")
31
- }
19
+ autoreload: {
20
+ enabled: ["1", null].includes(window.localStorage.getItem("autoreload")),
21
+ onchange: () => {},
22
+ enable: () => {
23
+ reloader.autoreload.enabled = true
24
+ window.localStorage.setItem("autoreload", "1")
25
+ reloader.autoreload.onchange()
26
+ },
27
+ disable: () => {
28
+ reloader.autoreload.enabled = false
29
+ window.localStorage.setItem("autoreload", "0")
30
+ reloader.autoreload.onchange()
31
+ },
32
32
  },
33
+ changes: {
34
+ value: [],
35
+ onchange: () => {},
36
+ add: (reloadMessage) => {
37
+ reloader.changes.value.push(reloadMessage)
38
+ reloader.changes.onchange()
39
+ if (reloader.autoreload.enabled) {
40
+ reloader.reload()
41
+ } else {
42
+ reloader.status.goTo("can_reload")
43
+ }
44
+ },
45
+ remove: (reloadMessage) => {
46
+ const index = reloader.changes.value.indexOf(reloadMessage)
47
+ if (index > -1) {
48
+ reloader.changes.value.splice(index, 1)
49
+ if (reloader.changes.value.length === 0) {
50
+ reloader.status.goTo("idle")
51
+ }
52
+ reloader.changes.onchange()
53
+ }
54
+ },
55
+ },
56
+ currentExecution: null,
33
57
  reload: () => {
34
- const someEffectIsFullReload = reloader.messages.some(
58
+ const someEffectIsFullReload = reloader.changes.value.some(
35
59
  (reloadMessage) => reloadMessage.type === "full",
36
60
  )
37
61
  if (someEffectIsFullReload) {
38
62
  reloadHtmlPage()
39
63
  return
40
64
  }
41
- reloader.setStatus("reloading")
65
+ reloader.status.goTo("reloading")
42
66
  const onApplied = (reloadMessage) => {
43
- const index = reloader.messages.indexOf(reloadMessage)
44
- reloader.messages.splice(index, 1)
45
- if (reloader.messages.length === 0) {
46
- reloader.setStatus("idle")
47
- }
67
+ reloader.changes.remove(reloadMessage)
48
68
  }
49
69
  const setReloadMessagePromise = (reloadMessage, promise) => {
50
70
  promise.then(
@@ -53,7 +73,7 @@ const reloader = {
53
73
  reloader.currentExecution = null
54
74
  },
55
75
  (e) => {
56
- reloader.setStatus("failed")
76
+ reloader.status.goTo("failed")
57
77
  if (typeof window.reportError === "function") {
58
78
  window.reportError(e)
59
79
  } else {
@@ -67,7 +87,7 @@ This could be due to syntax errors or importing non-existent modules (see errors
67
87
  },
68
88
  )
69
89
  }
70
- reloader.messages.forEach((reloadMessage) => {
90
+ reloader.changes.value.forEach((reloadMessage) => {
71
91
  if (reloadMessage.type === "hot") {
72
92
  const promise = addToHotQueue(() => {
73
93
  return applyHotReload(reloadMessage)
@@ -162,7 +182,13 @@ const applyHotReload = async ({ hotInstructions }) => {
162
182
  return namespace
163
183
  }
164
184
  if (type === "html") {
165
- if (!compareTwoUrlPaths(urlToFetch, window.location.href)) {
185
+ const isRootHtmlFile =
186
+ window.location.pathname === "/" &&
187
+ new URL(urlToFetch).pathname.slice(1).indexOf("/") === -1
188
+ if (
189
+ !isRootHtmlFile &&
190
+ !compareTwoUrlPaths(urlToFetch, window.location.href)
191
+ ) {
166
192
  // we are not in that HTML page
167
193
  return null
168
194
  }
@@ -194,6 +220,6 @@ const applyHotReload = async ({ hotInstructions }) => {
194
220
  window.__reloader__ = reloader
195
221
  window.__server_events__.listenEvents({
196
222
  reload: (reloadServerEvent) => {
197
- reloader.addMessage(reloadServerEvent.data)
223
+ reloader.changes.add(reloadServerEvent.data)
198
224
  },
199
225
  })
@@ -4,10 +4,13 @@ export const compareTwoUrlPaths = (url, otherUrl) => {
4
4
  }
5
5
  const urlObject = new URL(url)
6
6
  const otherUrlObject = new URL(otherUrl)
7
- return (
8
- urlObject.origin === otherUrlObject.origin &&
9
- urlObject.pathname === otherUrlObject.pathname
10
- )
7
+ if (urlObject.origin !== otherUrlObject.origin) {
8
+ return false
9
+ }
10
+ if (urlObject.pathname !== otherUrlObject.pathname) {
11
+ return false
12
+ }
13
+ return true
11
14
  }
12
15
 
13
16
  export const injectQuery = (url, query) => {
@@ -175,6 +175,7 @@
175
175
  padding-right: 25px;
176
176
  padding-top: 25px;
177
177
  background-color: #204143;
178
+ position: relative;
178
179
  }
179
180
 
180
181
  #explorables_header_bottom_spacing {
@@ -220,7 +221,7 @@
220
221
  fill: #24b1b0;
221
222
  }
222
223
 
223
- #fileIconSvgConfig {
224
+ #explorables_icon {
224
225
  width: 25px;
225
226
  height: 25px;
226
227
  stroke: none;
@@ -325,9 +326,9 @@
325
326
  <section id="explorables">
326
327
  <div id="explorables-header">
327
328
  <div id="explorables_header_and_menu">
328
- <h2 style="white-space: nowrap">
329
+ <h2>
329
330
  <svg
330
- id="fileIconSvgConfig"
331
+ id="explorables_icon"
331
332
  viewBox="0 0 24 24"
332
333
  width="32"
333
334
  height="32"
@@ -25,7 +25,7 @@ export const jsenvPluginRibbon = ({
25
25
  appliesDuring: "dev",
26
26
  transformUrlContent: {
27
27
  html: (urlInfo, context) => {
28
- if (urlInfo.data.noribbon) {
28
+ if (urlInfo.data.isJsenvToolbar || urlInfo.data.noribbon) {
29
29
  return null
30
30
  }
31
31
  const { ribbon } = URL_META.applyAssociations({
@@ -34,7 +34,8 @@ export const createConnectionManager = (
34
34
  let msSpent = 0
35
35
  const attempt = () => {
36
36
  readyState.goTo(READY_STATES.CONNECTING)
37
- _disconnect = attemptConnection({
37
+ let timeout
38
+ const cancelAttempt = attemptConnection({
38
39
  onClosed: () => {
39
40
  if (!retry) {
40
41
  readyState.goTo(READY_STATES.CLOSED)
@@ -55,7 +56,6 @@ export const createConnectionManager = (
55
56
  )
56
57
  return
57
58
  }
58
-
59
59
  // if closed while open -> connection lost
60
60
  // otherwise it's the attempt to connect for the first time
61
61
  // or to reconnect
@@ -63,7 +63,7 @@ export const createConnectionManager = (
63
63
  console.info(`[jsenv] server connection lost; retrying to connect`)
64
64
  }
65
65
  retryCount++
66
- setTimeout(() => {
66
+ timeout = setTimeout(() => {
67
67
  msSpent += retryAfter
68
68
  attempt()
69
69
  }, retryAfter)
@@ -73,6 +73,11 @@ export const createConnectionManager = (
73
73
  // console.info(`[jsenv] connected to server`)
74
74
  },
75
75
  })
76
+ _disconnect = () => {
77
+ cancelAttempt()
78
+ clearTimeout(timeout)
79
+ readyState.goTo(READY_STATES.CLOSED)
80
+ }
76
81
  }
77
82
  attempt()
78
83
  }
@@ -664,8 +664,10 @@ window.__supervisor__ = (() => {
664
664
  errorDetailsPromise,
665
665
  })
666
666
  if (window.__reloader__) {
667
- window.__reloader__.onstatuschange = () => {
668
- if (window.__reloader__.status === "reloading") {
667
+ const onchange = window.__reloader__.status.onchange
668
+ window.__reloader__.status.onchange = () => {
669
+ onchange()
670
+ if (window.__reloader__.status.value === "reloading") {
669
671
  removeErrorOverlay()
670
672
  }
671
673
  }
@@ -1,11 +0,0 @@
1
- export const isAutoreloadEnabled = () => {
2
- const value = window.localStorage.getItem("autoreload")
3
- if (value === "0") {
4
- return false
5
- }
6
- return true
7
- }
8
-
9
- export const setAutoreloadPreference = (value) => {
10
- window.localStorage.setItem("autoreload", value ? "1" : "0")
11
- }