@atlaspack/build-cache 2.13.4-typescript-80839fbd5.0 → 2.13.4-typescript-c10a7ae7b.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/lib/serializer.js +4 -0
- package/package.json +2 -2
- package/src/serializer.ts +8 -8
package/lib/serializer.js
CHANGED
|
@@ -26,6 +26,10 @@ Object.defineProperty(exports, "serializeRaw", {
|
|
|
26
26
|
exports.unregisterSerializableClass = unregisterSerializableClass;
|
|
27
27
|
var _buildCache = require("./buildCache");
|
|
28
28
|
var _serializerCore = require("./serializerCore");
|
|
29
|
+
// flow-to-ts helpers
|
|
30
|
+
|
|
31
|
+
// /flow-to-ts helpers
|
|
32
|
+
|
|
29
33
|
const nameToCtor = new Map();
|
|
30
34
|
const ctorToName = new Map();
|
|
31
35
|
function registerSerializableClass(name, ctor) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/build-cache",
|
|
3
3
|
"description": "Serialize and deserialize data structures to a build cache",
|
|
4
|
-
"version": "2.13.4-typescript-
|
|
4
|
+
"version": "2.13.4-typescript-c10a7ae7b.0",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"publishConfig": {
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"check-ts": "tsc --noEmit"
|
|
21
21
|
},
|
|
22
22
|
"types": "src/index.ts",
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "c10a7ae7b0dc2c79430506d16447ff9bb9966043"
|
|
24
24
|
}
|
package/src/serializer.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {Flow} from 'flow-to-typescript-codemod';
|
|
2
1
|
import {createBuildCache} from './buildCache';
|
|
3
2
|
import {serializeRaw, deserializeRaw} from './serializerCore';
|
|
4
3
|
|
|
5
4
|
export {serializeRaw, deserializeRaw} from './serializerCore';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// flow-to-ts helpers
|
|
7
|
+
export type Class<T> = new (...args: any[]) => T;
|
|
8
|
+
// /flow-to-ts helpers
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const nameToCtor: Map<string, Class<any>> = new Map();
|
|
11
|
+
const ctorToName: Map<Class<any>, string> = new Map();
|
|
12
|
+
|
|
13
|
+
export function registerSerializableClass(name: string, ctor: Class<any>) {
|
|
11
14
|
if (ctorToName.has(ctor)) {
|
|
12
15
|
throw new Error('Class already registered with serializer');
|
|
13
16
|
}
|
|
@@ -16,10 +19,7 @@ export function registerSerializableClass(name: string, ctor: Flow.Class<any>) {
|
|
|
16
19
|
ctorToName.set(ctor, name);
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
export function unregisterSerializableClass(
|
|
20
|
-
name: string,
|
|
21
|
-
ctor: Flow.Class<any>,
|
|
22
|
-
) {
|
|
22
|
+
export function unregisterSerializableClass(name: string, ctor: Class<any>) {
|
|
23
23
|
if (nameToCtor.get(name) === ctor) {
|
|
24
24
|
nameToCtor.delete(name);
|
|
25
25
|
}
|