1
>
/*---------------------------------------------------------------------------------------------
marshalling.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { VSBuffer } from './buffer.js';
7
>
import { URI, UriComponents } from './uri.js';
8
>
import { MarshalledId } from './marshallingIds.js';
9
>
10
>
export function stringify(obj: unknown): string {
11
return JSON.stringify(obj, replacer);
12
}
14
>
export function parse(text: string): any {
15
let data = JSON.parse(text);
16
data = revive(data);
17
return data;
18
}
20
>
export interface MarshalledObject {
21
>
$mid: MarshalledId;
22
>
}
23
>
24
function replacer(key: string, value: any): any {
25
// URI is done via toJSON-member