@jam-comments/server-utilities 5.8.3 → 5.9.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/dist/cjs/index.js CHANGED
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logError = exports.log = exports.removeFalseyValues = exports.fetchAll = exports.markupFetcher = void 0;
6
+ exports.store = exports.logError = exports.log = exports.removeFalseyValues = exports.fetchAll = exports.markupFetcher = void 0;
7
+ const store_1 = __importDefault(require("./store"));
8
+ exports.store = store_1.default;
4
9
  var markupFetcher_1 = require("./markupFetcher");
5
10
  Object.defineProperty(exports, "markupFetcher", { enumerable: true, get: function () { return markupFetcher_1.markupFetcher; } });
6
11
  Object.defineProperty(exports, "fetchAll", { enumerable: true, get: function () { return markupFetcher_1.fetchAll; } });
package/dist/cjs/store.js CHANGED
@@ -1,27 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- globalThis.jamCommentsStore = null;
3
+ let STORE = null;
4
4
  const store = {
5
5
  init() {
6
- globalThis.jamCommentsStore = new Map();
6
+ if (!STORE) {
7
+ STORE = new Map();
8
+ }
7
9
  },
8
10
  isInitialized() {
9
- return globalThis.jamCommentsStore !== null;
11
+ return STORE !== null;
10
12
  },
11
13
  set(path, markup) {
12
- globalThis.jamCommentsStore.set(store.toPathKey(path), markup);
14
+ STORE.set(store.toPathKey(path), markup);
13
15
  },
14
16
  get(path) {
15
- return globalThis.jamCommentsStore.get(store.toPathKey(path)) || null;
17
+ return STORE.get(store.toPathKey(path)) || null;
16
18
  },
17
19
  clear() {
18
- if (globalThis.jamCommentsStore) {
19
- globalThis.jamCommentsStore.clear();
20
- globalThis.jamCommentsStore = null;
20
+ if (STORE) {
21
+ STORE.clear();
22
+ STORE = null;
21
23
  }
22
24
  },
23
25
  getEmptyMarkup() {
24
- return globalThis.jamCommentsStore.get("EMPTY");
26
+ return STORE.get("EMPTY");
25
27
  },
26
28
  toPathKey(path) {
27
29
  return path.replace(/^\//, "").replace(/\//g, "::");
package/dist/esm/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import store from "./store";
1
2
  export { markupFetcher, fetchAll } from "./markupFetcher";
2
3
  export { removeFalseyValues } from "./utils";
3
4
  export { log, logError } from "./log";
5
+ export { store };
package/dist/esm/store.js CHANGED
@@ -1,25 +1,27 @@
1
- globalThis.jamCommentsStore = null;
1
+ let STORE = null;
2
2
  const store = {
3
3
  init() {
4
- globalThis.jamCommentsStore = new Map();
4
+ if (!STORE) {
5
+ STORE = new Map();
6
+ }
5
7
  },
6
8
  isInitialized() {
7
- return globalThis.jamCommentsStore !== null;
9
+ return STORE !== null;
8
10
  },
9
11
  set(path, markup) {
10
- globalThis.jamCommentsStore.set(store.toPathKey(path), markup);
12
+ STORE.set(store.toPathKey(path), markup);
11
13
  },
12
14
  get(path) {
13
- return globalThis.jamCommentsStore.get(store.toPathKey(path)) || null;
15
+ return STORE.get(store.toPathKey(path)) || null;
14
16
  },
15
17
  clear() {
16
- if (globalThis.jamCommentsStore) {
17
- globalThis.jamCommentsStore.clear();
18
- globalThis.jamCommentsStore = null;
18
+ if (STORE) {
19
+ STORE.clear();
20
+ STORE = null;
19
21
  }
20
22
  },
21
23
  getEmptyMarkup() {
22
- return globalThis.jamCommentsStore.get("EMPTY");
24
+ return STORE.get("EMPTY");
23
25
  },
24
26
  toPathKey(path) {
25
27
  return path.replace(/^\//, "").replace(/\//g, "::");
@@ -1,4 +1,6 @@
1
1
  export type { CustomCopy } from "./markupFetcher";
2
+ import store from "./store";
2
3
  export { markupFetcher, fetchAll } from "./markupFetcher";
3
4
  export { removeFalseyValues } from "./utils";
4
5
  export { log, logError } from "./log";
6
+ export { store };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jam-comments/server-utilities",
3
- "version": "5.8.3",
3
+ "version": "5.9.0",
4
4
  "description": "Various JavaScript utilities for JamComments.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",