@dr.pogodin/react-utils 1.23.8 → 1.23.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.
Files changed (89) hide show
  1. package/README.md +4 -2
  2. package/build/development/client/getInj.js.map +1 -1
  3. package/build/development/client/index.js.map +1 -1
  4. package/build/development/client/init.js.map +1 -1
  5. package/build/development/index.js.map +1 -1
  6. package/build/development/server/Cache.js.map +1 -1
  7. package/build/development/server/index.js.map +1 -1
  8. package/build/development/server/renderer.js +2 -2
  9. package/build/development/server/renderer.js.map +1 -1
  10. package/build/development/server/server.js.map +1 -1
  11. package/build/development/shared/components/Button/index.js +1 -1
  12. package/build/development/shared/components/Button/index.js.map +1 -1
  13. package/build/development/shared/components/Checkbox/index.js.map +1 -1
  14. package/build/development/shared/components/CodeSplit/index.js.map +1 -1
  15. package/build/development/shared/components/Dropdown/index.js.map +1 -1
  16. package/build/development/shared/components/GenericLink/index.js.map +1 -1
  17. package/build/development/shared/components/Input/index.js.map +1 -1
  18. package/build/development/shared/components/Link.js.map +1 -1
  19. package/build/development/shared/components/MetaTags.js.map +1 -1
  20. package/build/development/shared/components/Modal/index.js.map +1 -1
  21. package/build/development/shared/components/NavLink.js.map +1 -1
  22. package/build/development/shared/components/PageLayout/index.js.map +1 -1
  23. package/build/development/shared/components/ScalableRect/index.js.map +1 -1
  24. package/build/development/shared/components/Throbber/index.js.map +1 -1
  25. package/build/development/shared/components/WithTooltip/Tooltip.js.map +1 -1
  26. package/build/development/shared/components/WithTooltip/index.js.map +1 -1
  27. package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
  28. package/build/development/shared/utils/Barrier.js +10 -49
  29. package/build/development/shared/utils/Barrier.js.map +1 -1
  30. package/build/development/shared/utils/config.js.map +1 -1
  31. package/build/development/shared/utils/index.js +5 -6
  32. package/build/development/shared/utils/index.js.map +1 -1
  33. package/build/development/shared/utils/isomorphy/index.js.map +1 -1
  34. package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  35. package/build/development/shared/utils/jest/index.js.map +1 -1
  36. package/build/development/shared/utils/splitComponent.js.map +1 -1
  37. package/build/development/shared/utils/time.js +12 -86
  38. package/build/development/shared/utils/time.js.map +1 -1
  39. package/build/development/web.bundle.js +73 -62
  40. package/build/production/client/getInj.js.map +1 -1
  41. package/build/production/client/index.js.map +1 -1
  42. package/build/production/client/init.js.map +1 -1
  43. package/build/production/index.js.map +1 -1
  44. package/build/production/server/Cache.js.map +1 -1
  45. package/build/production/server/index.js +1 -1
  46. package/build/production/server/index.js.map +1 -1
  47. package/build/production/server/renderer.js +2 -2
  48. package/build/production/server/renderer.js.map +1 -1
  49. package/build/production/server/server.js.map +1 -1
  50. package/build/production/shared/components/Button/index.js +1 -1
  51. package/build/production/shared/components/Button/index.js.map +1 -1
  52. package/build/production/shared/components/Checkbox/index.js.map +1 -1
  53. package/build/production/shared/components/CodeSplit/index.js.map +1 -1
  54. package/build/production/shared/components/Dropdown/index.js.map +1 -1
  55. package/build/production/shared/components/GenericLink/index.js.map +1 -1
  56. package/build/production/shared/components/Input/index.js.map +1 -1
  57. package/build/production/shared/components/Link.js.map +1 -1
  58. package/build/production/shared/components/MetaTags.js.map +1 -1
  59. package/build/production/shared/components/Modal/index.js.map +1 -1
  60. package/build/production/shared/components/NavLink.js.map +1 -1
  61. package/build/production/shared/components/PageLayout/index.js.map +1 -1
  62. package/build/production/shared/components/ScalableRect/index.js.map +1 -1
  63. package/build/production/shared/components/Throbber/index.js.map +1 -1
  64. package/build/production/shared/components/WithTooltip/Tooltip.js.map +1 -1
  65. package/build/production/shared/components/WithTooltip/index.js.map +1 -1
  66. package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
  67. package/build/production/shared/utils/Barrier.js +4 -5
  68. package/build/production/shared/utils/Barrier.js.map +1 -1
  69. package/build/production/shared/utils/config.js.map +1 -1
  70. package/build/production/shared/utils/index.js +2 -2
  71. package/build/production/shared/utils/index.js.map +1 -1
  72. package/build/production/shared/utils/isomorphy/index.js.map +1 -1
  73. package/build/production/shared/utils/jest/E2eSsrEnv.js +1 -1
  74. package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
  75. package/build/production/shared/utils/jest/index.js.map +1 -1
  76. package/build/production/shared/utils/splitComponent.js.map +1 -1
  77. package/build/production/shared/utils/time.js +2 -52
  78. package/build/production/shared/utils/time.js.map +1 -1
  79. package/build/production/web.bundle.js +1 -1
  80. package/build/production/web.bundle.js.map +1 -1
  81. package/package.json +29 -28
  82. package/build/development/shared/utils/Emitter.js +0 -61
  83. package/build/development/shared/utils/Emitter.js.map +0 -1
  84. package/build/development/shared/utils/Semaphore.js +0 -81
  85. package/build/development/shared/utils/Semaphore.js.map +0 -1
  86. package/build/production/shared/utils/Emitter.js +0 -19
  87. package/build/production/shared/utils/Emitter.js.map +0 -1
  88. package/build/production/shared/utils/Semaphore.js +0 -24
  89. package/build/production/shared/utils/Semaphore.js.map +0 -1
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.23.8",
2
+ "version": "1.23.10",
3
3
  "bin": {
4
4
  "react-utils-build": "bin/build.js",
5
5
  "react-utils-setup": "bin/setup.js"
@@ -8,13 +8,14 @@
8
8
  "url": "https://github.com/birdofpreyru/react-utils/issues"
9
9
  },
10
10
  "dependencies": {
11
- "@babel/runtime": "^7.21.0",
11
+ "@babel/runtime": "^7.21.5",
12
12
  "@dr.pogodin/babel-plugin-react-css-modules": "^6.9.4",
13
13
  "@dr.pogodin/csurf": "^1.12.4",
14
+ "@dr.pogodin/js-utils": "^0.0.5",
14
15
  "@dr.pogodin/react-global-state": "^0.9.3",
15
16
  "@dr.pogodin/react-themes": "^1.4.8",
16
- "axios": "^1.3.5",
17
- "commander": "^10.0.0",
17
+ "axios": "^1.4.0",
18
+ "commander": "^10.0.1",
18
19
  "compression": "^1.7.4",
19
20
  "config": "^3.3.9",
20
21
  "cookie": "^0.5.0",
@@ -22,21 +23,21 @@
22
23
  "cross-env": "^7.0.3",
23
24
  "dayjs": "^1.11.7",
24
25
  "express": "^4.18.2",
25
- "helmet": "^6.1.3",
26
+ "helmet": "^7.0.0",
26
27
  "http-status-codes": "^2.2.0",
27
- "joi": "^17.9.1",
28
+ "joi": "^17.9.2",
28
29
  "lodash": "^4.17.21",
29
30
  "morgan": "^1.10.0",
30
31
  "node-forge": "^1.3.1",
31
32
  "prop-types": "^15.8.1",
32
- "qs": "^6.11.1",
33
+ "qs": "^6.11.2",
33
34
  "raf": "^3.4.1",
34
35
  "react": "^18.2.0",
35
36
  "react-dom": "^18.2.0",
36
37
  "react-helmet": "^6.1.0",
37
- "react-router-dom": "^6.10.0",
38
+ "react-router-dom": "^6.11.2",
38
39
  "request-ip": "^3.3.0",
39
- "rimraf": "^5.0.0",
40
+ "rimraf": "^5.0.1",
40
41
  "serialize-javascript": "^6.0.1",
41
42
  "serve-favicon": "^2.5.0",
42
43
  "source-map-support": "^0.5.21",
@@ -45,26 +46,26 @@
45
46
  },
46
47
  "description": "Collection of generic ReactJS components and utils",
47
48
  "devDependencies": {
48
- "@babel/cli": "^7.21.0",
49
- "@babel/core": "^7.21.4",
50
- "@babel/eslint-parser": "^7.21.3",
49
+ "@babel/cli": "^7.21.5",
50
+ "@babel/core": "^7.21.8",
51
+ "@babel/eslint-parser": "^7.21.8",
51
52
  "@babel/eslint-plugin": "^7.19.1",
52
53
  "@babel/node": "^7.20.7",
53
54
  "@babel/plugin-transform-runtime": "^7.21.4",
54
- "@babel/preset-env": "^7.21.4",
55
+ "@babel/preset-env": "^7.21.5",
55
56
  "@babel/preset-react": "^7.18.6",
56
57
  "@babel/register": "^7.21.0",
57
58
  "@dr.pogodin/babel-plugin-transform-assets": "^1.2.2",
58
- "@dr.pogodin/babel-preset-svgr": "^1.6.0",
59
+ "@dr.pogodin/babel-preset-svgr": "^1.7.0",
59
60
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
60
61
  "autoprefixer": "^10.4.14",
61
62
  "babel-jest": "^29.5.0",
62
63
  "babel-loader": "^9.1.2",
63
64
  "babel-plugin-module-resolver": "^5.0.0",
64
- "core-js": "^3.30.0",
65
- "css-loader": "^6.7.3",
65
+ "core-js": "^3.30.2",
66
+ "css-loader": "^6.7.4",
66
67
  "css-minimizer-webpack-plugin": "^5.0.0",
67
- "eslint": "^8.38.0",
68
+ "eslint": "^8.40.0",
68
69
  "eslint-config-airbnb": "^19.0.4",
69
70
  "eslint-import-resolver-babel-module": "^5.3.2",
70
71
  "eslint-plugin-import": "^2.27.5",
@@ -75,26 +76,26 @@
75
76
  "identity-obj-proxy": "^3.0.0",
76
77
  "jest": "^29.5.0",
77
78
  "jest-environment-jsdom": "^29.5.0",
78
- "memfs": "^3.5.0",
79
- "mini-css-extract-plugin": "^2.7.5",
79
+ "memfs": "^3.5.1",
80
+ "mini-css-extract-plugin": "^2.7.6",
80
81
  "mockdate": "^3.0.5",
81
82
  "nodelist-foreach-polyfill": "^1.2.0",
82
- "postcss": "^8.4.21",
83
- "postcss-loader": "^7.2.4",
83
+ "postcss": "^8.4.23",
84
+ "postcss-loader": "^7.3.0",
84
85
  "postcss-scss": "^4.0.6",
85
86
  "pretty": "^2.0.0",
86
87
  "react-refresh": "^0.14.0",
87
88
  "react-test-renderer": "^18.2.0",
88
89
  "regenerator-runtime": "^0.13.11",
89
90
  "resolve-url-loader": "^5.0.0",
90
- "sass": "^1.61.0",
91
+ "sass": "^1.62.1",
91
92
  "sass-loader": "^13.2.2",
92
93
  "sitemap": "^7.1.1",
93
- "stylelint": "^15.4.0",
94
- "stylelint-config-standard-scss": "^8.0.0",
94
+ "stylelint": "^15.6.2",
95
+ "stylelint-config-standard-scss": "^9.0.0",
95
96
  "supertest": "^6.3.3",
96
- "webpack": "^5.78.0",
97
- "webpack-dev-middleware": "^6.0.2",
97
+ "webpack": "^5.83.1",
98
+ "webpack-dev-middleware": "^6.1.1",
98
99
  "webpack-hot-middleware": "^2.25.3",
99
100
  "webpack-merge": "^5.8.0",
100
101
  "workbox-core": "^6.5.4",
@@ -102,8 +103,8 @@
102
103
  "workbox-webpack-plugin": "^6.5.4"
103
104
  },
104
105
  "engines": {
105
- "node": ">=18.12",
106
- "npm": ">=8.19"
106
+ "node": ">=18",
107
+ "npm": ">=9"
107
108
  },
108
109
  "main": "./node-entry.js",
109
110
  "exports": {
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /**
8
- * Simple listeneable data Emitter.
9
- */
10
- class Emitter {
11
- /**
12
- * Creates a new Emitter.
13
- */
14
- constructor() {
15
- this.listeners = [];
16
- }
17
-
18
- /**
19
- * Returns "true" if any listener is connected; "false" otherwise.
20
- * @return {boolean}
21
- */
22
- get hasListeners() {
23
- return !!this.listeners.length;
24
- }
25
-
26
- /**
27
- * Adds `listener` if it is not already connected.
28
- * @param {function} listener
29
- * @return {function} Unsubscribe function.
30
- */
31
- addListener(listener) {
32
- if (!this.listeners.includes(listener)) {
33
- this.listeners.push(listener);
34
- }
35
- return () => this.removeListener(listener);
36
- }
37
-
38
- /**
39
- * Calls every connected listener with the given arguments.
40
- * @param {...any} args
41
- */
42
- emit(...args) {
43
- const {
44
- listeners
45
- } = this;
46
- for (let i = 0; i < listeners.length; ++i) {
47
- listeners[i](...args);
48
- }
49
- }
50
-
51
- /**
52
- * Removes specified `listener`, if connected.
53
- * @param {function} listener
54
- */
55
- removeListener(listener) {
56
- const idx = this.listeners.indexOf(listener);
57
- if (idx >= 0) this.listeners.splice(idx, 1);
58
- }
59
- }
60
- exports.default = Emitter;
61
- //# sourceMappingURL=Emitter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Emitter.js","names":["Emitter","constructor","listeners","hasListeners","length","addListener","listener","includes","push","removeListener","emit","args","i","idx","indexOf","splice","exports","default"],"sources":["../../../../src/shared/utils/Emitter.js"],"sourcesContent":["/**\n * Simple listeneable data Emitter.\n */\nexport default class Emitter {\n /**\n * Creates a new Emitter.\n */\n constructor() {\n this.listeners = [];\n }\n\n /**\n * Returns \"true\" if any listener is connected; \"false\" otherwise.\n * @return {boolean}\n */\n get hasListeners() {\n return !!this.listeners.length;\n }\n\n /**\n * Adds `listener` if it is not already connected.\n * @param {function} listener\n * @return {function} Unsubscribe function.\n */\n addListener(listener) {\n if (!this.listeners.includes(listener)) {\n this.listeners.push(listener);\n }\n return () => this.removeListener(listener);\n }\n\n /**\n * Calls every connected listener with the given arguments.\n * @param {...any} args\n */\n emit(...args) {\n const { listeners } = this;\n for (let i = 0; i < listeners.length; ++i) {\n listeners[i](...args);\n }\n }\n\n /**\n * Removes specified `listener`, if connected.\n * @param {function} listener\n */\n removeListener(listener) {\n const idx = this.listeners.indexOf(listener);\n if (idx >= 0) this.listeners.splice(idx, 1);\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACe,MAAMA,OAAO,CAAC;EAC3B;AACF;AACA;EACEC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,SAAS,GAAG,EAAE;EACrB;;EAEA;AACF;AACA;AACA;EACE,IAAIC,YAAYA,CAAA,EAAG;IACjB,OAAO,CAAC,CAAC,IAAI,CAACD,SAAS,CAACE,MAAM;EAChC;;EAEA;AACF;AACA;AACA;AACA;EACEC,WAAWA,CAACC,QAAQ,EAAE;IACpB,IAAI,CAAC,IAAI,CAACJ,SAAS,CAACK,QAAQ,CAACD,QAAQ,CAAC,EAAE;MACtC,IAAI,CAACJ,SAAS,CAACM,IAAI,CAACF,QAAQ,CAAC;IAC/B;IACA,OAAO,MAAM,IAAI,CAACG,cAAc,CAACH,QAAQ,CAAC;EAC5C;;EAEA;AACF;AACA;AACA;EACEI,IAAIA,CAAC,GAAGC,IAAI,EAAE;IACZ,MAAM;MAAET;IAAU,CAAC,GAAG,IAAI;IAC1B,KAAK,IAAIU,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGV,SAAS,CAACE,MAAM,EAAE,EAAEQ,CAAC,EAAE;MACzCV,SAAS,CAACU,CAAC,CAAC,CAAC,GAAGD,IAAI,CAAC;IACvB;EACF;;EAEA;AACF;AACA;AACA;EACEF,cAAcA,CAACH,QAAQ,EAAE;IACvB,MAAMO,GAAG,GAAG,IAAI,CAACX,SAAS,CAACY,OAAO,CAACR,QAAQ,CAAC;IAC5C,IAAIO,GAAG,IAAI,CAAC,EAAE,IAAI,CAACX,SAAS,CAACa,MAAM,CAACF,GAAG,EAAE,CAAC,CAAC;EAC7C;AACF;AAACG,OAAA,CAAAC,OAAA,GAAAjB,OAAA"}
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _Barrier = require("./Barrier");
8
- /**
9
- * Implements a simple semaphore for async code logic.
10
- */
11
- class Semaphore {
12
- constructor(ready) {
13
- this.#ready = !!ready;
14
- }
15
- get ready() {
16
- return this.#ready;
17
- }
18
- setReady(ready) {
19
- const bool = !!ready;
20
- if (this.#ready !== bool) {
21
- this.#ready = bool;
22
- if (bool && !this.#draining && this.#queue.length) this.#drainQueue();
23
- }
24
- }
25
-
26
- /**
27
- * Waits until the semaphore is ready, and marks it as non-ready (seizes it).
28
- * @return {Promise}
29
- */
30
- async seize() {
31
- return this.waitReady(true);
32
- }
33
- async waitReady(seize = false) {
34
- if (!this.#ready || this.#queue.length) {
35
- const barrier = new _Barrier.Barrier();
36
- this.#queue.push(barrier);
37
- await barrier;
38
- if (seize) this.#ready = false;
39
- this.#drainLock.resolve();
40
- } else if (seize) this.#ready = false;
41
- }
42
-
43
- // Private members below this point.
44
-
45
- /**
46
- * If semaphore is ready, it releases the next barrier in the queue, if any,
47
- * and reschedules itself for a call in the next event loop iteration.
48
- * Otherwise, it breaks the queue draining loop, which will be restarted
49
- * the next time the semaphore is set ready.
50
- */
51
- async #drainQueue() {
52
- this.#draining = true;
53
- while (this.#ready && this.#queue.length) {
54
- this.#drainLock = new _Barrier.Barrier();
55
- this.#queue[0].resolve();
56
- await this.#drainLock; // eslint-disable-line no-await-in-loop
57
- this.#queue.shift();
58
- }
59
- this.#draining = false;
60
- this.#drainLock = null;
61
- }
62
-
63
- // "true" when the drain queue process is running (and thus no need to start
64
- // a new one).
65
- #draining = false;
66
-
67
- // Each time a Promise from drain queue is resolved this drainLock is set
68
- // to block further queue draining until the promise resolution handler
69
- // (.seize() or .waitReady()) unlocks it, thus confirming it is fine
70
- // to continue the draining. This is specifically important for .seize(),
71
- // which should have a chance to switch semaphore state to non-ready prior
72
- // to next Promise in the queue being unlocked.
73
- #drainLock = null;
74
-
75
- // The array of barriers set for each async code flow awaiting for
76
- // the Semaphore to become ready.
77
- #queue = [];
78
- #ready;
79
- }
80
- exports.default = Semaphore;
81
- //# sourceMappingURL=Semaphore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Semaphore.js","names":["_Barrier","require","Semaphore","constructor","ready","setReady","bool","draining","queue","length","drainQueue","seize","waitReady","barrier","Barrier","push","drainLock","resolve","#drainQueue","shift","exports","default"],"sources":["../../../../src/shared/utils/Semaphore.js"],"sourcesContent":["import { Barrier } from './Barrier';\n\n/**\n * Implements a simple semaphore for async code logic.\n */\nexport default class Semaphore {\n constructor(ready) {\n this.#ready = !!ready;\n }\n\n get ready() { return this.#ready; }\n\n setReady(ready) {\n const bool = !!ready;\n if (this.#ready !== bool) {\n this.#ready = bool;\n if (bool && !this.#draining && this.#queue.length) this.#drainQueue();\n }\n }\n\n /**\n * Waits until the semaphore is ready, and marks it as non-ready (seizes it).\n * @return {Promise}\n */\n async seize() {\n return this.waitReady(true);\n }\n\n async waitReady(seize = false) {\n if (!this.#ready || this.#queue.length) {\n const barrier = new Barrier();\n this.#queue.push(barrier);\n await barrier;\n if (seize) this.#ready = false;\n this.#drainLock.resolve();\n } else if (seize) this.#ready = false;\n }\n\n // Private members below this point.\n\n /**\n * If semaphore is ready, it releases the next barrier in the queue, if any,\n * and reschedules itself for a call in the next event loop iteration.\n * Otherwise, it breaks the queue draining loop, which will be restarted\n * the next time the semaphore is set ready.\n */\n async #drainQueue() {\n this.#draining = true;\n while (this.#ready && this.#queue.length) {\n this.#drainLock = new Barrier();\n this.#queue[0].resolve();\n await this.#drainLock; // eslint-disable-line no-await-in-loop\n this.#queue.shift();\n }\n this.#draining = false;\n this.#drainLock = null;\n }\n\n // \"true\" when the drain queue process is running (and thus no need to start\n // a new one).\n #draining = false;\n\n // Each time a Promise from drain queue is resolved this drainLock is set\n // to block further queue draining until the promise resolution handler\n // (.seize() or .waitReady()) unlocks it, thus confirming it is fine\n // to continue the draining. This is specifically important for .seize(),\n // which should have a chance to switch semaphore state to non-ready prior\n // to next Promise in the queue being unlocked.\n #drainLock = null;\n\n // The array of barriers set for each async code flow awaiting for\n // the Semaphore to become ready.\n #queue = [];\n\n #ready;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACe,MAAMC,SAAS,CAAC;EAC7BC,WAAWA,CAACC,KAAK,EAAE;IACjB,IAAI,CAAC,CAACA,KAAK,GAAG,CAAC,CAACA,KAAK;EACvB;EAEA,IAAIA,KAAKA,CAAA,EAAG;IAAE,OAAO,IAAI,CAAC,CAACA,KAAK;EAAE;EAElCC,QAAQA,CAACD,KAAK,EAAE;IACd,MAAME,IAAI,GAAG,CAAC,CAACF,KAAK;IACpB,IAAI,IAAI,CAAC,CAACA,KAAK,KAAKE,IAAI,EAAE;MACxB,IAAI,CAAC,CAACF,KAAK,GAAGE,IAAI;MAClB,IAAIA,IAAI,IAAI,CAAC,IAAI,CAAC,CAACC,QAAQ,IAAI,IAAI,CAAC,CAACC,KAAK,CAACC,MAAM,EAAE,IAAI,CAAC,CAACC,UAAU,EAAE;IACvE;EACF;;EAEA;AACF;AACA;AACA;EACE,MAAMC,KAAKA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACC,SAAS,CAAC,IAAI,CAAC;EAC7B;EAEA,MAAMA,SAASA,CAACD,KAAK,GAAG,KAAK,EAAE;IAC7B,IAAI,CAAC,IAAI,CAAC,CAACP,KAAK,IAAI,IAAI,CAAC,CAACI,KAAK,CAACC,MAAM,EAAE;MACtC,MAAMI,OAAO,GAAG,IAAIC,gBAAO,EAAE;MAC7B,IAAI,CAAC,CAACN,KAAK,CAACO,IAAI,CAACF,OAAO,CAAC;MACzB,MAAMA,OAAO;MACb,IAAIF,KAAK,EAAE,IAAI,CAAC,CAACP,KAAK,GAAG,KAAK;MAC9B,IAAI,CAAC,CAACY,SAAS,CAACC,OAAO,EAAE;IAC3B,CAAC,MAAM,IAAIN,KAAK,EAAE,IAAI,CAAC,CAACP,KAAK,GAAG,KAAK;EACvC;;EAEA;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,MAAM,CAACM,UAAUQ,CAAA,EAAG;IAClB,IAAI,CAAC,CAACX,QAAQ,GAAG,IAAI;IACrB,OAAO,IAAI,CAAC,CAACH,KAAK,IAAI,IAAI,CAAC,CAACI,KAAK,CAACC,MAAM,EAAE;MACxC,IAAI,CAAC,CAACO,SAAS,GAAG,IAAIF,gBAAO,EAAE;MAC/B,IAAI,CAAC,CAACN,KAAK,CAAC,CAAC,CAAC,CAACS,OAAO,EAAE;MACxB,MAAM,IAAI,CAAC,CAACD,SAAS,CAAC,CAAC;MACvB,IAAI,CAAC,CAACR,KAAK,CAACW,KAAK,EAAE;IACrB;IACA,IAAI,CAAC,CAACZ,QAAQ,GAAG,KAAK;IACtB,IAAI,CAAC,CAACS,SAAS,GAAG,IAAI;EACxB;;EAEA;EACA;EACA,CAACT,QAAQ,GAAG,KAAK;;EAEjB;EACA;EACA;EACA;EACA;EACA;EACA,CAACS,SAAS,GAAG,IAAI;;EAEjB;EACA;EACA,CAACR,KAAK,GAAG,EAAE;EAEX,CAACJ,KAAK;AACR;AAACgB,OAAA,CAAAC,OAAA,GAAAnB,SAAA"}
@@ -1,19 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;/**
2
- * Simple listeneable data Emitter.
3
- */class Emitter{/**
4
- * Creates a new Emitter.
5
- */constructor(){this.listeners=[]}/**
6
- * Returns "true" if any listener is connected; "false" otherwise.
7
- * @return {boolean}
8
- */get hasListeners(){return!!this.listeners.length}/**
9
- * Adds `listener` if it is not already connected.
10
- * @param {function} listener
11
- * @return {function} Unsubscribe function.
12
- */addListener(listener){if(!this.listeners.includes(listener)){this.listeners.push(listener)}return()=>this.removeListener(listener)}/**
13
- * Calls every connected listener with the given arguments.
14
- * @param {...any} args
15
- */emit(...args){const{listeners}=this;for(let i=0;i<listeners.length;++i){listeners[i](...args)}}/**
16
- * Removes specified `listener`, if connected.
17
- * @param {function} listener
18
- */removeListener(listener){const idx=this.listeners.indexOf(listener);if(idx>=0)this.listeners.splice(idx,1)}}exports.default=Emitter;
19
- //# sourceMappingURL=Emitter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Emitter.js","names":["Emitter","constructor","listeners","hasListeners","length","addListener","listener","includes","push","removeListener","emit","args","i","idx","indexOf","splice","exports","default"],"sources":["../../../../src/shared/utils/Emitter.js"],"sourcesContent":["/**\n * Simple listeneable data Emitter.\n */\nexport default class Emitter {\n /**\n * Creates a new Emitter.\n */\n constructor() {\n this.listeners = [];\n }\n\n /**\n * Returns \"true\" if any listener is connected; \"false\" otherwise.\n * @return {boolean}\n */\n get hasListeners() {\n return !!this.listeners.length;\n }\n\n /**\n * Adds `listener` if it is not already connected.\n * @param {function} listener\n * @return {function} Unsubscribe function.\n */\n addListener(listener) {\n if (!this.listeners.includes(listener)) {\n this.listeners.push(listener);\n }\n return () => this.removeListener(listener);\n }\n\n /**\n * Calls every connected listener with the given arguments.\n * @param {...any} args\n */\n emit(...args) {\n const { listeners } = this;\n for (let i = 0; i < listeners.length; ++i) {\n listeners[i](...args);\n }\n }\n\n /**\n * Removes specified `listener`, if connected.\n * @param {function} listener\n */\n removeListener(listener) {\n const idx = this.listeners.indexOf(listener);\n if (idx >= 0) this.listeners.splice(idx, 1);\n }\n}\n"],"mappings":"6FAAA;AACA;AACA,GACe,KAAM,CAAAA,OAAQ,CAC3B;AACF;AACA,KACEC,WAAWA,CAAA,CAAG,CACZ,IAAI,CAACC,SAAS,CAAG,EACnB,CAEA;AACF;AACA;AACA,KACE,GAAI,CAAAC,YAAYA,CAAA,CAAG,CACjB,MAAO,CAAC,CAAC,IAAI,CAACD,SAAS,CAACE,MAC1B,CAEA;AACF;AACA;AACA;AACA,KACEC,WAAWA,CAACC,QAAQ,CAAE,CACpB,GAAI,CAAC,IAAI,CAACJ,SAAS,CAACK,QAAQ,CAACD,QAAQ,CAAC,CAAE,CACtC,IAAI,CAACJ,SAAS,CAACM,IAAI,CAACF,QAAQ,CAC9B,CACA,MAAO,IAAM,IAAI,CAACG,cAAc,CAACH,QAAQ,CAC3C,CAEA;AACF;AACA;AACA,KACEI,IAAIA,CAAC,GAAGC,IAAI,CAAE,CACZ,KAAM,CAAET,SAAU,CAAC,CAAG,IAAI,CAC1B,IAAK,GAAI,CAAAU,CAAC,CAAG,CAAC,CAAEA,CAAC,CAAGV,SAAS,CAACE,MAAM,CAAE,EAAEQ,CAAC,CAAE,CACzCV,SAAS,CAACU,CAAC,CAAC,CAAC,GAAGD,IAAI,CACtB,CACF,CAEA;AACF;AACA;AACA,KACEF,cAAcA,CAACH,QAAQ,CAAE,CACvB,KAAM,CAAAO,GAAG,CAAG,IAAI,CAACX,SAAS,CAACY,OAAO,CAACR,QAAQ,CAAC,CAC5C,GAAIO,GAAG,EAAI,CAAC,CAAE,IAAI,CAACX,SAAS,CAACa,MAAM,CAACF,GAAG,CAAE,CAAC,CAC5C,CACF,CAACG,OAAA,CAAAC,OAAA,CAAAjB,OAAA"}
@@ -1,24 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _Barrier=require("./Barrier");/**
2
- * Implements a simple semaphore for async code logic.
3
- */class Semaphore{constructor(ready){this.#ready=!!ready}get ready(){return this.#ready}setReady(ready){const bool=!!ready;if(this.#ready!==bool){this.#ready=bool;if(bool&&!this.#draining&&this.#queue.length)this.#drainQueue()}}/**
4
- * Waits until the semaphore is ready, and marks it as non-ready (seizes it).
5
- * @return {Promise}
6
- */async seize(){return this.waitReady(true)}async waitReady(seize=false){if(!this.#ready||this.#queue.length){const barrier=new _Barrier.Barrier;this.#queue.push(barrier);await barrier;if(seize)this.#ready=false;this.#drainLock.resolve()}else if(seize)this.#ready=false}// Private members below this point.
7
- /**
8
- * If semaphore is ready, it releases the next barrier in the queue, if any,
9
- * and reschedules itself for a call in the next event loop iteration.
10
- * Otherwise, it breaks the queue draining loop, which will be restarted
11
- * the next time the semaphore is set ready.
12
- */async#drainQueue(){this.#draining=true;while(this.#ready&&this.#queue.length){this.#drainLock=new _Barrier.Barrier;this.#queue[0].resolve();await this.#drainLock;// eslint-disable-line no-await-in-loop
13
- this.#queue.shift()}this.#draining=false;this.#drainLock=null}// "true" when the drain queue process is running (and thus no need to start
14
- // a new one).
15
- #draining=false;// Each time a Promise from drain queue is resolved this drainLock is set
16
- // to block further queue draining until the promise resolution handler
17
- // (.seize() or .waitReady()) unlocks it, thus confirming it is fine
18
- // to continue the draining. This is specifically important for .seize(),
19
- // which should have a chance to switch semaphore state to non-ready prior
20
- // to next Promise in the queue being unlocked.
21
- #drainLock=null;// The array of barriers set for each async code flow awaiting for
22
- // the Semaphore to become ready.
23
- #queue=[];#ready}exports.default=Semaphore;
24
- //# sourceMappingURL=Semaphore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Semaphore.js","names":["_Barrier","require","Semaphore","constructor","ready","setReady","bool","draining","queue","length","drainQueue","seize","waitReady","barrier","Barrier","push","drainLock","resolve","#drainQueue","shift","exports","default"],"sources":["../../../../src/shared/utils/Semaphore.js"],"sourcesContent":["import { Barrier } from './Barrier';\n\n/**\n * Implements a simple semaphore for async code logic.\n */\nexport default class Semaphore {\n constructor(ready) {\n this.#ready = !!ready;\n }\n\n get ready() { return this.#ready; }\n\n setReady(ready) {\n const bool = !!ready;\n if (this.#ready !== bool) {\n this.#ready = bool;\n if (bool && !this.#draining && this.#queue.length) this.#drainQueue();\n }\n }\n\n /**\n * Waits until the semaphore is ready, and marks it as non-ready (seizes it).\n * @return {Promise}\n */\n async seize() {\n return this.waitReady(true);\n }\n\n async waitReady(seize = false) {\n if (!this.#ready || this.#queue.length) {\n const barrier = new Barrier();\n this.#queue.push(barrier);\n await barrier;\n if (seize) this.#ready = false;\n this.#drainLock.resolve();\n } else if (seize) this.#ready = false;\n }\n\n // Private members below this point.\n\n /**\n * If semaphore is ready, it releases the next barrier in the queue, if any,\n * and reschedules itself for a call in the next event loop iteration.\n * Otherwise, it breaks the queue draining loop, which will be restarted\n * the next time the semaphore is set ready.\n */\n async #drainQueue() {\n this.#draining = true;\n while (this.#ready && this.#queue.length) {\n this.#drainLock = new Barrier();\n this.#queue[0].resolve();\n await this.#drainLock; // eslint-disable-line no-await-in-loop\n this.#queue.shift();\n }\n this.#draining = false;\n this.#drainLock = null;\n }\n\n // \"true\" when the drain queue process is running (and thus no need to start\n // a new one).\n #draining = false;\n\n // Each time a Promise from drain queue is resolved this drainLock is set\n // to block further queue draining until the promise resolution handler\n // (.seize() or .waitReady()) unlocks it, thus confirming it is fine\n // to continue the draining. This is specifically important for .seize(),\n // which should have a chance to switch semaphore state to non-ready prior\n // to next Promise in the queue being unlocked.\n #drainLock = null;\n\n // The array of barriers set for each async code flow awaiting for\n // the Semaphore to become ready.\n #queue = [];\n\n #ready;\n}\n"],"mappings":"6FAAA,IAAAA,QAAA,CAAAC,OAAA,cAEA;AACA;AACA,GACe,KAAM,CAAAC,SAAU,CAC7BC,WAAWA,CAACC,KAAK,CAAE,CACjB,IAAI,CAAC,CAACA,KAAK,CAAG,CAAC,CAACA,KAClB,CAEA,GAAI,CAAAA,KAAKA,CAAA,CAAG,CAAE,MAAO,KAAI,CAAC,CAACA,KAAO,CAElCC,QAAQA,CAACD,KAAK,CAAE,CACd,KAAM,CAAAE,IAAI,CAAG,CAAC,CAACF,KAAK,CACpB,GAAI,IAAI,CAAC,CAACA,KAAK,GAAKE,IAAI,CAAE,CACxB,IAAI,CAAC,CAACF,KAAK,CAAGE,IAAI,CAClB,GAAIA,IAAI,EAAI,CAAC,IAAI,CAAC,CAACC,QAAQ,EAAI,IAAI,CAAC,CAACC,KAAK,CAACC,MAAM,CAAE,IAAI,CAAC,CAACC,UAAU,EACrE,CACF,CAEA;AACF;AACA;AACA,KACE,KAAM,CAAAC,KAAKA,CAAA,CAAG,CACZ,MAAO,KAAI,CAACC,SAAS,CAAC,IAAI,CAC5B,CAEA,KAAM,CAAAA,SAASA,CAACD,KAAK,CAAG,KAAK,CAAE,CAC7B,GAAI,CAAC,IAAI,CAAC,CAACP,KAAK,EAAI,IAAI,CAAC,CAACI,KAAK,CAACC,MAAM,CAAE,CACtC,KAAM,CAAAI,OAAO,CAAG,GAAI,CAAAC,gBAAS,CAC7B,IAAI,CAAC,CAACN,KAAK,CAACO,IAAI,CAACF,OAAO,CAAC,CACzB,KAAM,CAAAA,OAAO,CACb,GAAIF,KAAK,CAAE,IAAI,CAAC,CAACP,KAAK,CAAG,KAAK,CAC9B,IAAI,CAAC,CAACY,SAAS,CAACC,OAAO,EACzB,CAAC,IAAM,IAAIN,KAAK,CAAE,IAAI,CAAC,CAACP,KAAK,CAAG,KAClC,CAEA;AAEA;AACF;AACA;AACA;AACA;AACA,KACE,KAAM,CAACM,UAAUQ,CAAA,CAAG,CAClB,IAAI,CAAC,CAACX,QAAQ,CAAG,IAAI,CACrB,MAAO,IAAI,CAAC,CAACH,KAAK,EAAI,IAAI,CAAC,CAACI,KAAK,CAACC,MAAM,CAAE,CACxC,IAAI,CAAC,CAACO,SAAS,CAAG,GAAI,CAAAF,gBAAS,CAC/B,IAAI,CAAC,CAACN,KAAK,CAAC,CAAC,CAAC,CAACS,OAAO,EAAE,CACxB,KAAM,KAAI,CAAC,CAACD,SAAS,CAAE;AACvB,IAAI,CAAC,CAACR,KAAK,CAACW,KAAK,EACnB,CACA,IAAI,CAAC,CAACZ,QAAQ,CAAG,KAAK,CACtB,IAAI,CAAC,CAACS,SAAS,CAAG,IACpB,CAEA;AACA;AACA,CAACT,QAAQ,CAAG,KAAK,CAEjB;AACA;AACA;AACA;AACA;AACA;AACA,CAACS,SAAS,CAAG,IAAI,CAEjB;AACA;AACA,CAACR,KAAK,CAAG,EAAE,CAEX,CAACJ,KACH,CAACgB,OAAA,CAAAC,OAAA,CAAAnB,SAAA"}