informa 5.0.5 → 5.0.7
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/internals.d.ts +20 -9
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +19 -26
- package/dist/internals.js.map +1 -1
- package/package.json +1 -1
- package/src/internals.ts +32 -27
package/dist/internals.d.ts
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import type { StateMetadata, Exitable, StatifiableObj } from "./low.js";
|
|
2
|
-
|
|
2
|
+
interface InformaGlobalContext {
|
|
3
|
+
mode: "normal" | "extract-proxy-path";
|
|
4
|
+
metadataMap: WeakMap<Statify<StatifiableObj>, StateMetadata>;
|
|
5
|
+
proxyMemoized: WeakMap<object, Statify<StatifiableObj>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const exitProxySymbol = "__informa_exit_proxy__";
|
|
8
|
+
export declare const globalStateMode: InformaGlobalContext;
|
|
3
9
|
export declare function setGlobalStateMode(mode: "normal" | "extract-proxy-path"): void;
|
|
4
|
-
export declare function getGlobalStateMode():
|
|
5
|
-
export declare const metadataMap:
|
|
6
|
-
|
|
10
|
+
export declare function getGlobalStateMode(): "normal" | "extract-proxy-path";
|
|
11
|
+
export declare const metadataMap: WeakMap<{
|
|
12
|
+
__informa_statify_seal__: true;
|
|
13
|
+
} & Exitable, StateMetadata>;
|
|
14
|
+
export declare function getMetadataOf(v: Statify<StatifiableObj>): StateMetadata;
|
|
7
15
|
export declare function setMetadataOf(v: Statify<StatifiableObj>, s: StateMetadata): StateMetadata;
|
|
8
|
-
export declare const proxyMemoized:
|
|
9
|
-
|
|
16
|
+
export declare const proxyMemoized: WeakMap<object, {
|
|
17
|
+
__informa_statify_seal__: true;
|
|
18
|
+
} & Exitable>;
|
|
19
|
+
export declare const statifySealKey = "__informa_statify_seal__";
|
|
10
20
|
export declare function isStatified<T extends StatifiableObj>(v: T): v is Statify<T>;
|
|
11
21
|
export type Statify<T extends StatifiableObj> = T & {
|
|
12
22
|
[statifySealKey]: true;
|
|
13
23
|
} & Exitable;
|
|
14
|
-
export declare const isStatifiedSetKey
|
|
15
|
-
export declare const isStatifiedArrayKey
|
|
16
|
-
export declare const isStatifiedMapKey
|
|
24
|
+
export declare const isStatifiedSetKey = "__informa_is_statified_set__";
|
|
25
|
+
export declare const isStatifiedArrayKey = "__informa_is_statified_array__";
|
|
26
|
+
export declare const isStatifiedMapKey = "__informa_is_statified_map__";
|
|
27
|
+
export {};
|
|
17
28
|
//# sourceMappingURL=internals.d.ts.map
|
package/dist/internals.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internals.d.ts","sourceRoot":"","sources":["../src/internals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGxE,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"internals.d.ts","sourceRoot":"","sources":["../src/internals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGxE,UAAU,oBAAoB;IAC5B,IAAI,EAAE,QAAQ,GAAG,oBAAoB,CAAC;IACtC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC,CAAC;IAC7D,aAAa,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;CACzD;AAYD,eAAO,MAAM,eAAe,2BAA2B,CAAC;AAExD,eAAO,MAAM,eAAe,sBAAgB,CAAC;AAE7C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,oBAAoB,QAEvE;AAED,wBAAgB,kBAAkB,IAAI,QAAQ,GAAG,oBAAoB,CAEpE;AAED,eAAO,MAAM,WAAW;8BAsBgD,IAAI;4BAtBxB,CAAC;AAErD,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,iBAMvD;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,aAAa,iBAIzE;AAED,eAAO,MAAM,aAAa;8BAM8C,IAAI;aANpB,CAAC;AAEzD,eAAO,MAAM,cAAc,6BAA6B,CAAC;AACzD,wBAAgB,WAAW,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAE3E;AACD,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,GAAG;IAAE,CAAC,cAAc,CAAC,EAAE,IAAI,CAAA;CAAE,GAAG,QAAQ,CAAC;AAE1F,eAAO,MAAM,iBAAiB,iCAAiC,CAAC;AAChE,eAAO,MAAM,mBAAmB,mCAAmC,CAAC;AACpE,eAAO,MAAM,iBAAiB,iCAAiC,CAAC"}
|
package/dist/internals.js
CHANGED
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isStatifiedMapKey = exports.isStatifiedArrayKey = exports.isStatifiedSetKey = exports.statifySealKey = exports.proxyMemoized = exports.metadataMap = exports.exitProxySymbol = void 0;
|
|
3
|
+
exports.isStatifiedMapKey = exports.isStatifiedArrayKey = exports.isStatifiedSetKey = exports.statifySealKey = exports.proxyMemoized = exports.metadataMap = exports.globalStateMode = exports.exitProxySymbol = void 0;
|
|
4
4
|
exports.setGlobalStateMode = setGlobalStateMode;
|
|
5
5
|
exports.getGlobalStateMode = getGlobalStateMode;
|
|
6
6
|
exports.getMetadataOf = getMetadataOf;
|
|
7
7
|
exports.setMetadataOf = setMetadataOf;
|
|
8
8
|
exports.isStatified = isStatified;
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const INFORMA_GLOBAL_KEY = "__INFORMA__";
|
|
10
|
+
const informaGlobal = Reflect.get(globalThis, INFORMA_GLOBAL_KEY) ?? {
|
|
11
|
+
mode: "normal",
|
|
12
|
+
metadataMap: new WeakMap(),
|
|
13
|
+
proxyMemoized: new WeakMap(),
|
|
14
|
+
};
|
|
15
|
+
Reflect.defineProperty(globalThis, INFORMA_GLOBAL_KEY, { value: informaGlobal, configurable: true, writable: true });
|
|
16
|
+
exports.exitProxySymbol = "__informa_exit_proxy__";
|
|
17
|
+
exports.globalStateMode = informaGlobal;
|
|
14
18
|
function setGlobalStateMode(mode) {
|
|
15
|
-
|
|
16
|
-
return;
|
|
17
|
-
if (mode === "normal") {
|
|
18
|
-
Reflect.deleteProperty(globalThis, globalStateModeSymbol);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
Reflect.defineProperty(globalThis, globalStateModeSymbol, { value: mode, configurable: true });
|
|
22
|
-
}
|
|
19
|
+
informaGlobal.mode = mode;
|
|
23
20
|
}
|
|
24
21
|
function getGlobalStateMode() {
|
|
25
|
-
return
|
|
22
|
+
return informaGlobal.mode;
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
exports.metadataMap = Reflect.get(globalThis, metadataMapSymbol) ?? new WeakMap();
|
|
29
|
-
Reflect.defineProperty(globalThis, metadataMapSymbol, { value: exports.metadataMap });
|
|
24
|
+
exports.metadataMap = informaGlobal.metadataMap;
|
|
30
25
|
function getMetadataOf(v) {
|
|
31
26
|
const result = exports.metadataMap.get(v);
|
|
32
27
|
if (!result)
|
|
@@ -37,14 +32,12 @@ function setMetadataOf(v, s) {
|
|
|
37
32
|
exports.metadataMap.set(v, s);
|
|
38
33
|
return s;
|
|
39
34
|
}
|
|
40
|
-
|
|
41
|
-
exports.
|
|
42
|
-
Reflect.defineProperty(globalThis, proxyMemoizedSymbol, { value: exports.proxyMemoized });
|
|
43
|
-
exports.statifySealKey = Symbol.for(`hi-this-is-informa-${package_json_1.version}-s--statify-seal-key`);
|
|
35
|
+
exports.proxyMemoized = informaGlobal.proxyMemoized;
|
|
36
|
+
exports.statifySealKey = "__informa_statify_seal__";
|
|
44
37
|
function isStatified(v) {
|
|
45
|
-
return v[exports.statifySealKey];
|
|
38
|
+
return Boolean(v?.[exports.statifySealKey]);
|
|
46
39
|
}
|
|
47
|
-
exports.isStatifiedSetKey =
|
|
48
|
-
exports.isStatifiedArrayKey =
|
|
49
|
-
exports.isStatifiedMapKey =
|
|
40
|
+
exports.isStatifiedSetKey = "__informa_is_statified_set__";
|
|
41
|
+
exports.isStatifiedArrayKey = "__informa_is_statified_array__";
|
|
42
|
+
exports.isStatifiedMapKey = "__informa_is_statified_map__";
|
|
50
43
|
//# sourceMappingURL=internals.js.map
|
package/dist/internals.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internals.js","sourceRoot":"","sources":["../src/internals.ts"],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"internals.js","sourceRoot":"","sources":["../src/internals.ts"],"names":[],"mappings":";;;;;;;;AASA,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAEzC,MAAM,aAAa,GAAyB,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,kBAAkB,CAAC,IAAI;IACzF,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,IAAI,OAAO,EAAE;IAC1B,aAAa,EAAE,IAAI,OAAO,EAAE;CAC7B,CAAC;AAEF,OAAO,CAAC,cAAc,CAAC,UAAU,EAAE,kBAAkB,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAExG,QAAA,eAAe,GAAG,wBAAwB,CAAC;AAE3C,QAAA,eAAe,GAAG,aAAa,CAAC;AAE7C,4BAAmC,IAAqC;IACtE,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC;AAC5B,CAAC;AAED;IACE,OAAO,aAAa,CAAC,IAAI,CAAC;AAC5B,CAAC;AAEY,QAAA,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;AAErD,uBAA8B,CAA0B;IACtD,MAAM,MAAM,GAAG,QAAA,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAElC,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;IAE/G,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,uBAA8B,CAA0B,EAAE,CAAgB;IACxE,QAAA,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEtB,OAAO,CAAC,CAAC;AACX,CAAC;AAEY,QAAA,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC;AAE5C,QAAA,cAAc,GAAG,0BAA0B,CAAC;AACzD,qBAAsD,CAAI;IACxD,OAAO,OAAO,CAAE,CAAS,EAAE,CAAC,QAAA,cAAc,CAAC,CAAC,CAAC;AAC/C,CAAC;AAGY,QAAA,iBAAiB,GAAG,8BAA8B,CAAC;AACnD,QAAA,mBAAmB,GAAG,gCAAgC,CAAC;AACvD,QAAA,iBAAiB,GAAG,8BAA8B,CAAC"}
|
package/package.json
CHANGED
package/src/internals.ts
CHANGED
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
import type { StateMetadata, Exitable, StatifiableObj } from "./low.js";
|
|
2
|
-
import { version } from "../package.json";
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
// Single shared namespace object on globalThis
|
|
4
|
+
interface InformaGlobalContext {
|
|
5
|
+
mode: "normal" | "extract-proxy-path";
|
|
6
|
+
metadataMap: WeakMap<Statify<StatifiableObj>, StateMetadata>;
|
|
7
|
+
proxyMemoized: WeakMap<object, Statify<StatifiableObj>>;
|
|
8
|
+
}
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
// no concurrency issues arise because of the unique call stack.
|
|
8
|
-
const globalStateModeSymbol = Symbol.for(`hi-this-is-informa-${version}-s--global-state-mode`);
|
|
9
|
-
export function setGlobalStateMode(mode: "normal" | "extract-proxy-path") {
|
|
10
|
-
if (getGlobalStateMode() === mode) return;
|
|
10
|
+
const INFORMA_GLOBAL_KEY = "__INFORMA__";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const informaGlobal: InformaGlobalContext = Reflect.get(globalThis, INFORMA_GLOBAL_KEY) ?? {
|
|
13
|
+
mode: "normal",
|
|
14
|
+
metadataMap: new WeakMap(),
|
|
15
|
+
proxyMemoized: new WeakMap(),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
Reflect.defineProperty(globalThis, INFORMA_GLOBAL_KEY, { value: informaGlobal, configurable: true, writable: true });
|
|
19
|
+
|
|
20
|
+
export const exitProxySymbol = "__informa_exit_proxy__";
|
|
21
|
+
|
|
22
|
+
export const globalStateMode = informaGlobal;
|
|
23
|
+
|
|
24
|
+
export function setGlobalStateMode(mode: "normal" | "extract-proxy-path") {
|
|
25
|
+
informaGlobal.mode = mode;
|
|
20
26
|
}
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
export function getGlobalStateMode(): "normal" | "extract-proxy-path" {
|
|
29
|
+
return informaGlobal.mode;
|
|
30
|
+
}
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
export const metadataMap = informaGlobal.metadataMap;
|
|
26
33
|
|
|
27
34
|
export function getMetadataOf(v: Statify<StatifiableObj>) {
|
|
28
35
|
const result = metadataMap.get(v);
|
|
@@ -31,23 +38,21 @@ export function getMetadataOf(v: Statify<StatifiableObj>) {
|
|
|
31
38
|
|
|
32
39
|
return result;
|
|
33
40
|
}
|
|
41
|
+
|
|
34
42
|
export function setMetadataOf(v: Statify<StatifiableObj>, s: StateMetadata) {
|
|
35
43
|
metadataMap.set(v, s);
|
|
36
44
|
|
|
37
45
|
return s;
|
|
38
46
|
}
|
|
39
47
|
|
|
40
|
-
const
|
|
41
|
-
export const proxyMemoized = Reflect.get(globalThis, proxyMemoizedSymbol) ?? new WeakMap<object, Statify<StatifiableObj>>();
|
|
42
|
-
|
|
43
|
-
Reflect.defineProperty(globalThis, proxyMemoizedSymbol, { value: proxyMemoized });
|
|
48
|
+
export const proxyMemoized = informaGlobal.proxyMemoized;
|
|
44
49
|
|
|
45
|
-
export const statifySealKey =
|
|
50
|
+
export const statifySealKey = "__informa_statify_seal__";
|
|
46
51
|
export function isStatified<T extends StatifiableObj>(v: T): v is Statify<T> {
|
|
47
|
-
return (v as
|
|
52
|
+
return Boolean((v as any)?.[statifySealKey]);
|
|
48
53
|
}
|
|
49
54
|
export type Statify<T extends StatifiableObj> = T & { [statifySealKey]: true } & Exitable;
|
|
50
55
|
|
|
51
|
-
export const isStatifiedSetKey =
|
|
52
|
-
export const isStatifiedArrayKey =
|
|
53
|
-
export const isStatifiedMapKey =
|
|
56
|
+
export const isStatifiedSetKey = "__informa_is_statified_set__";
|
|
57
|
+
export const isStatifiedArrayKey = "__informa_is_statified_array__";
|
|
58
|
+
export const isStatifiedMapKey = "__informa_is_statified_map__";
|