yansu 0.0.0-beta.1

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 (142) hide show
  1. package/README.md +1 -0
  2. package/bin.mjs +18 -0
  3. package/dist/cli.d.mts +2 -0
  4. package/dist/cli.mjs +68 -0
  5. package/dist/dirs.d.mts +4 -0
  6. package/dist/dirs.mjs +6 -0
  7. package/dist/index.d.mts +78 -0
  8. package/dist/index.mjs +121 -0
  9. package/dist/nitro.json +15 -0
  10. package/dist/public/_nuxt/BHIHUtPz.js +4 -0
  11. package/dist/public/_nuxt/CCgOhniq.js +1 -0
  12. package/dist/public/_nuxt/CR6vfq1R.js +1 -0
  13. package/dist/public/_nuxt/DmxzK6E8.js +1 -0
  14. package/dist/public/_nuxt/builds/latest.json +1 -0
  15. package/dist/public/_nuxt/builds/meta/e9079134-f314-434b-b3a7-092c4a1e187d.json +1 -0
  16. package/dist/public/_nuxt/entry.DJ3VOi_0.css +1 -0
  17. package/dist/public/_nuxt/error-404.lC6KBLNm.css +1 -0
  18. package/dist/public/_nuxt/error-500.NtBcR2wE.css +1 -0
  19. package/dist/server/chunks/_/error-500.mjs +9 -0
  20. package/dist/server/chunks/build/_plugin-vue_export-helper-DjsbPc54.mjs +29 -0
  21. package/dist/server/chunks/build/client.precomputed.mjs +3 -0
  22. package/dist/server/chunks/build/error-404-Du0ot2hm.mjs +369 -0
  23. package/dist/server/chunks/build/error-500-Y3RUV6n2.mjs +73 -0
  24. package/dist/server/chunks/build/server.mjs +727 -0
  25. package/dist/server/chunks/nitro/nitro.mjs +5176 -0
  26. package/dist/server/chunks/routes/api/metadata.json.mjs +147 -0
  27. package/dist/server/chunks/routes/api/platform.json.mjs +20 -0
  28. package/dist/server/chunks/routes/renderer.mjs +408 -0
  29. package/dist/server/chunks/virtual/_virtual_spa-template.mjs +3 -0
  30. package/dist/server/index.mjs +9 -0
  31. package/dist/server/node_modules/.nitro/@vue/shared@3.5.25/dist/shared.cjs.prod.js +604 -0
  32. package/dist/server/node_modules/.nitro/@vue/shared@3.5.25/package.json +47 -0
  33. package/dist/server/node_modules/.nitro/@vue/shared@3.5.26/dist/shared.cjs.prod.js +604 -0
  34. package/dist/server/node_modules/.nitro/@vue/shared@3.5.26/package.json +47 -0
  35. package/dist/server/node_modules/@babel/parser/lib/index.js +14662 -0
  36. package/dist/server/node_modules/@babel/parser/package.json +50 -0
  37. package/dist/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6763 -0
  38. package/dist/server/node_modules/@vue/compiler-core/package.json +58 -0
  39. package/dist/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +689 -0
  40. package/dist/server/node_modules/@vue/compiler-dom/package.json +57 -0
  41. package/dist/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1413 -0
  42. package/dist/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  43. package/dist/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1853 -0
  44. package/dist/server/node_modules/@vue/reactivity/package.json +55 -0
  45. package/dist/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6770 -0
  46. package/dist/server/node_modules/@vue/runtime-core/package.json +52 -0
  47. package/dist/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1732 -0
  48. package/dist/server/node_modules/@vue/runtime-dom/package.json +60 -0
  49. package/dist/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +879 -0
  50. package/dist/server/node_modules/@vue/server-renderer/package.json +55 -0
  51. package/dist/server/node_modules/ansis/index.cjs +1 -0
  52. package/dist/server/node_modules/ansis/index.mjs +1 -0
  53. package/dist/server/node_modules/ansis/package.json +25 -0
  54. package/dist/server/node_modules/birpc/dist/index.mjs +173 -0
  55. package/dist/server/node_modules/birpc/package.json +56 -0
  56. package/dist/server/node_modules/consola/dist/chunks/prompt.mjs +280 -0
  57. package/dist/server/node_modules/consola/dist/core.mjs +512 -0
  58. package/dist/server/node_modules/consola/dist/index.mjs +651 -0
  59. package/dist/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
  60. package/dist/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
  61. package/dist/server/node_modules/consola/package.json +136 -0
  62. package/dist/server/node_modules/devalue/index.js +4 -0
  63. package/dist/server/node_modules/devalue/package.json +37 -0
  64. package/dist/server/node_modules/devalue/src/base64.js +110 -0
  65. package/dist/server/node_modules/devalue/src/constants.js +6 -0
  66. package/dist/server/node_modules/devalue/src/parse.js +205 -0
  67. package/dist/server/node_modules/devalue/src/stringify.js +265 -0
  68. package/dist/server/node_modules/devalue/src/uneval.js +407 -0
  69. package/dist/server/node_modules/devalue/src/utils.js +118 -0
  70. package/dist/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
  71. package/dist/server/node_modules/entities/dist/commonjs/decode.js +568 -0
  72. package/dist/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
  73. package/dist/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
  74. package/dist/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
  75. package/dist/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
  76. package/dist/server/node_modules/entities/dist/commonjs/package.json +3 -0
  77. package/dist/server/node_modules/entities/package.json +113 -0
  78. package/dist/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  79. package/dist/server/node_modules/estree-walker/package.json +37 -0
  80. package/dist/server/node_modules/get-port-please/dist/index.mjs +430 -0
  81. package/dist/server/node_modules/get-port-please/package.json +39 -0
  82. package/dist/server/node_modules/hookable/dist/index.mjs +290 -0
  83. package/dist/server/node_modules/hookable/package.json +49 -0
  84. package/dist/server/node_modules/source-map-js/lib/array-set.js +121 -0
  85. package/dist/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  86. package/dist/server/node_modules/source-map-js/lib/base64.js +67 -0
  87. package/dist/server/node_modules/source-map-js/lib/binary-search.js +111 -0
  88. package/dist/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
  89. package/dist/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
  90. package/dist/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  91. package/dist/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  92. package/dist/server/node_modules/source-map-js/lib/source-node.js +413 -0
  93. package/dist/server/node_modules/source-map-js/lib/util.js +594 -0
  94. package/dist/server/node_modules/source-map-js/package.json +71 -0
  95. package/dist/server/node_modules/source-map-js/source-map.js +8 -0
  96. package/dist/server/node_modules/structured-clone-es/dist/index.mjs +285 -0
  97. package/dist/server/node_modules/structured-clone-es/package.json +56 -0
  98. package/dist/server/node_modules/ufo/dist/index.mjs +638 -0
  99. package/dist/server/node_modules/ufo/package.json +47 -0
  100. package/dist/server/node_modules/unhead/dist/index.mjs +9 -0
  101. package/dist/server/node_modules/unhead/dist/parser.mjs +508 -0
  102. package/dist/server/node_modules/unhead/dist/plugins.mjs +101 -0
  103. package/dist/server/node_modules/unhead/dist/scripts.mjs +30 -0
  104. package/dist/server/node_modules/unhead/dist/server.mjs +182 -0
  105. package/dist/server/node_modules/unhead/dist/shared/unhead.B578PsDV.mjs +266 -0
  106. package/dist/server/node_modules/unhead/dist/shared/unhead.BPM0-cfG.mjs +44 -0
  107. package/dist/server/node_modules/unhead/dist/shared/unhead.BYvz9V1x.mjs +43 -0
  108. package/dist/server/node_modules/unhead/dist/shared/unhead.BpRRHAhY.mjs +194 -0
  109. package/dist/server/node_modules/unhead/dist/shared/unhead.CApf5sj3.mjs +148 -0
  110. package/dist/server/node_modules/unhead/dist/shared/unhead.DH45uomy.mjs +180 -0
  111. package/dist/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs +196 -0
  112. package/dist/server/node_modules/unhead/dist/shared/unhead.DZbvapt-.mjs +70 -0
  113. package/dist/server/node_modules/unhead/dist/shared/unhead.Djo8ep_Y.mjs +166 -0
  114. package/dist/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs +38 -0
  115. package/dist/server/node_modules/unhead/dist/utils.mjs +5 -0
  116. package/dist/server/node_modules/unhead/package.json +105 -0
  117. package/dist/server/node_modules/vue/dist/vue.cjs.js +80 -0
  118. package/dist/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  119. package/dist/server/node_modules/vue/index.js +7 -0
  120. package/dist/server/node_modules/vue/index.mjs +1 -0
  121. package/dist/server/node_modules/vue/package.json +112 -0
  122. package/dist/server/node_modules/vue/server-renderer/index.mjs +1 -0
  123. package/dist/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +301 -0
  124. package/dist/server/node_modules/vue-bundle-renderer/package.json +55 -0
  125. package/dist/server/node_modules/ws/lib/buffer-util.js +131 -0
  126. package/dist/server/node_modules/ws/lib/constants.js +19 -0
  127. package/dist/server/node_modules/ws/lib/event-target.js +292 -0
  128. package/dist/server/node_modules/ws/lib/extension.js +203 -0
  129. package/dist/server/node_modules/ws/lib/limiter.js +55 -0
  130. package/dist/server/node_modules/ws/lib/permessage-deflate.js +528 -0
  131. package/dist/server/node_modules/ws/lib/receiver.js +706 -0
  132. package/dist/server/node_modules/ws/lib/sender.js +602 -0
  133. package/dist/server/node_modules/ws/lib/stream.js +161 -0
  134. package/dist/server/node_modules/ws/lib/subprotocol.js +62 -0
  135. package/dist/server/node_modules/ws/lib/validation.js +152 -0
  136. package/dist/server/node_modules/ws/lib/websocket-server.js +554 -0
  137. package/dist/server/node_modules/ws/lib/websocket.js +1393 -0
  138. package/dist/server/node_modules/ws/package.json +69 -0
  139. package/dist/server/node_modules/ws/wrapper.mjs +8 -0
  140. package/dist/server/package.json +32 -0
  141. package/dist/shared/yansu.DmdNF4qf.mjs +151 -0
  142. package/package.json +50 -0
@@ -0,0 +1,205 @@
1
+ import { decode64 } from './base64.js';
2
+ import {
3
+ HOLE,
4
+ NAN,
5
+ NEGATIVE_INFINITY,
6
+ NEGATIVE_ZERO,
7
+ POSITIVE_INFINITY,
8
+ UNDEFINED
9
+ } from './constants.js';
10
+
11
+ /**
12
+ * Revive a value serialized with `devalue.stringify`
13
+ * @param {string} serialized
14
+ * @param {Record<string, (value: any) => any>} [revivers]
15
+ */
16
+ export function parse(serialized, revivers) {
17
+ return unflatten(JSON.parse(serialized), revivers);
18
+ }
19
+
20
+ /**
21
+ * Revive a value flattened with `devalue.stringify`
22
+ * @param {number | any[]} parsed
23
+ * @param {Record<string, (value: any) => any>} [revivers]
24
+ */
25
+ export function unflatten(parsed, revivers) {
26
+ if (typeof parsed === 'number') return hydrate(parsed, true);
27
+
28
+ if (!Array.isArray(parsed) || parsed.length === 0) {
29
+ throw new Error('Invalid input');
30
+ }
31
+
32
+ const values = /** @type {any[]} */ (parsed);
33
+
34
+ const hydrated = Array(values.length);
35
+
36
+ /**
37
+ * @param {number} index
38
+ * @returns {any}
39
+ */
40
+ function hydrate(index, standalone = false) {
41
+ if (index === UNDEFINED) return undefined;
42
+ if (index === NAN) return NaN;
43
+ if (index === POSITIVE_INFINITY) return Infinity;
44
+ if (index === NEGATIVE_INFINITY) return -Infinity;
45
+ if (index === NEGATIVE_ZERO) return -0;
46
+
47
+ if (standalone || typeof index !== 'number') {
48
+ throw new Error(`Invalid input`);
49
+ }
50
+
51
+ if (index in hydrated) return hydrated[index];
52
+
53
+ const value = values[index];
54
+
55
+ if (!value || typeof value !== 'object') {
56
+ hydrated[index] = value;
57
+ } else if (Array.isArray(value)) {
58
+ if (typeof value[0] === 'string') {
59
+ const type = value[0];
60
+
61
+ const reviver =
62
+ revivers && Object.hasOwn(revivers, type)
63
+ ? revivers[type]
64
+ : undefined;
65
+
66
+ if (reviver) {
67
+ let i = value[1];
68
+ if (typeof i !== 'number') {
69
+ // if it's not a number, it was serialized by a builtin reviver
70
+ // so we need to munge it into the format expected by a custom reviver
71
+ i = values.push(value[1]) - 1;
72
+ }
73
+ return (hydrated[index] = reviver(hydrate(i)));
74
+ }
75
+
76
+ switch (type) {
77
+ case 'Date':
78
+ hydrated[index] = new Date(value[1]);
79
+ break;
80
+
81
+ case 'Set':
82
+ const set = new Set();
83
+ hydrated[index] = set;
84
+ for (let i = 1; i < value.length; i += 1) {
85
+ set.add(hydrate(value[i]));
86
+ }
87
+ break;
88
+
89
+ case 'Map':
90
+ const map = new Map();
91
+ hydrated[index] = map;
92
+ for (let i = 1; i < value.length; i += 2) {
93
+ map.set(hydrate(value[i]), hydrate(value[i + 1]));
94
+ }
95
+ break;
96
+
97
+ case 'RegExp':
98
+ hydrated[index] = new RegExp(value[1], value[2]);
99
+ break;
100
+
101
+ case 'Object':
102
+ hydrated[index] = Object(value[1]);
103
+ break;
104
+
105
+ case 'BigInt':
106
+ hydrated[index] = BigInt(value[1]);
107
+ break;
108
+
109
+ case 'null':
110
+ const obj = Object.create(null);
111
+ hydrated[index] = obj;
112
+ for (let i = 1; i < value.length; i += 2) {
113
+ obj[value[i]] = hydrate(value[i + 1]);
114
+ }
115
+ break;
116
+
117
+ case 'Int8Array':
118
+ case 'Uint8Array':
119
+ case 'Uint8ClampedArray':
120
+ case 'Int16Array':
121
+ case 'Uint16Array':
122
+ case 'Int32Array':
123
+ case 'Uint32Array':
124
+ case 'Float32Array':
125
+ case 'Float64Array':
126
+ case 'BigInt64Array':
127
+ case 'BigUint64Array': {
128
+ const TypedArrayConstructor = globalThis[type];
129
+ const typedArray = new TypedArrayConstructor(hydrate(value[1]));
130
+
131
+ hydrated[index] =
132
+ value[2] !== undefined
133
+ ? typedArray.subarray(value[2], value[3])
134
+ : typedArray;
135
+
136
+ break;
137
+ }
138
+
139
+ case 'ArrayBuffer': {
140
+ const base64 = value[1];
141
+ const arraybuffer = decode64(base64);
142
+ hydrated[index] = arraybuffer;
143
+ break;
144
+ }
145
+
146
+ case 'Temporal.Duration':
147
+ case 'Temporal.Instant':
148
+ case 'Temporal.PlainDate':
149
+ case 'Temporal.PlainTime':
150
+ case 'Temporal.PlainDateTime':
151
+ case 'Temporal.PlainMonthDay':
152
+ case 'Temporal.PlainYearMonth':
153
+ case 'Temporal.ZonedDateTime': {
154
+ const temporalName = type.slice(9);
155
+ // @ts-expect-error TS doesn't know about Temporal yet
156
+ hydrated[index] = Temporal[temporalName].from(value[1]);
157
+ break;
158
+ }
159
+
160
+ case 'URL': {
161
+ const url = new URL(value[1]);
162
+ hydrated[index] = url;
163
+ break;
164
+ }
165
+
166
+ case 'URLSearchParams': {
167
+ const url = new URLSearchParams(value[1]);
168
+ hydrated[index] = url;
169
+ break;
170
+ }
171
+
172
+ default:
173
+ throw new Error(`Unknown type ${type}`);
174
+ }
175
+ } else {
176
+ const array = new Array(value.length);
177
+ hydrated[index] = array;
178
+
179
+ for (let i = 0; i < value.length; i += 1) {
180
+ const n = value[i];
181
+ if (n === HOLE) continue;
182
+
183
+ array[i] = hydrate(n);
184
+ }
185
+ }
186
+ } else {
187
+ /** @type {Record<string, any>} */
188
+ const object = {};
189
+ hydrated[index] = object;
190
+
191
+ for (const key in value) {
192
+ if (key === '__proto__') {
193
+ throw new Error('Cannot parse an object with a `__proto__` property');
194
+ }
195
+
196
+ const n = value[key];
197
+ object[key] = hydrate(n);
198
+ }
199
+ }
200
+
201
+ return hydrated[index];
202
+ }
203
+
204
+ return hydrate(0);
205
+ }
@@ -0,0 +1,265 @@
1
+ import {
2
+ DevalueError,
3
+ enumerable_symbols,
4
+ get_type,
5
+ is_plain_object,
6
+ is_primitive,
7
+ stringify_key,
8
+ stringify_string
9
+ } from './utils.js';
10
+ import {
11
+ HOLE,
12
+ NAN,
13
+ NEGATIVE_INFINITY,
14
+ NEGATIVE_ZERO,
15
+ POSITIVE_INFINITY,
16
+ UNDEFINED
17
+ } from './constants.js';
18
+ import { encode64 } from './base64.js';
19
+
20
+ /**
21
+ * Turn a value into a JSON string that can be parsed with `devalue.parse`
22
+ * @param {any} value
23
+ * @param {Record<string, (value: any) => any>} [reducers]
24
+ */
25
+ export function stringify(value, reducers) {
26
+ /** @type {any[]} */
27
+ const stringified = [];
28
+
29
+ /** @type {Map<any, number>} */
30
+ const indexes = new Map();
31
+
32
+ /** @type {Array<{ key: string, fn: (value: any) => any }>} */
33
+ const custom = [];
34
+ if (reducers) {
35
+ for (const key of Object.getOwnPropertyNames(reducers)) {
36
+ custom.push({ key, fn: reducers[key] });
37
+ }
38
+ }
39
+
40
+ /** @type {string[]} */
41
+ const keys = [];
42
+
43
+ let p = 0;
44
+
45
+ /** @param {any} thing */
46
+ function flatten(thing) {
47
+ if (thing === undefined) return UNDEFINED;
48
+ if (Number.isNaN(thing)) return NAN;
49
+ if (thing === Infinity) return POSITIVE_INFINITY;
50
+ if (thing === -Infinity) return NEGATIVE_INFINITY;
51
+ if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO;
52
+
53
+ if (indexes.has(thing)) return indexes.get(thing);
54
+
55
+ const index = p++;
56
+ indexes.set(thing, index);
57
+
58
+ for (const { key, fn } of custom) {
59
+ const value = fn(thing);
60
+ if (value) {
61
+ stringified[index] = `["${key}",${flatten(value)}]`;
62
+ return index;
63
+ }
64
+ }
65
+
66
+ if (typeof thing === 'function') {
67
+ throw new DevalueError(`Cannot stringify a function`, keys, thing, value);
68
+ }
69
+
70
+ let str = '';
71
+
72
+ if (is_primitive(thing)) {
73
+ str = stringify_primitive(thing);
74
+ } else {
75
+ const type = get_type(thing);
76
+
77
+ switch (type) {
78
+ case 'Number':
79
+ case 'String':
80
+ case 'Boolean':
81
+ str = `["Object",${stringify_primitive(thing)}]`;
82
+ break;
83
+
84
+ case 'BigInt':
85
+ str = `["BigInt",${thing}]`;
86
+ break;
87
+
88
+ case 'Date':
89
+ const valid = !isNaN(thing.getDate());
90
+ str = `["Date","${valid ? thing.toISOString() : ''}"]`;
91
+ break;
92
+
93
+ case 'URL':
94
+ str = `["URL",${stringify_string(thing.toString())}]`;
95
+ break;
96
+
97
+ case 'URLSearchParams':
98
+ str = `["URLSearchParams",${stringify_string(thing.toString())}]`;
99
+ break;
100
+
101
+ case 'RegExp':
102
+ const { source, flags } = thing;
103
+ str = flags
104
+ ? `["RegExp",${stringify_string(source)},"${flags}"]`
105
+ : `["RegExp",${stringify_string(source)}]`;
106
+ break;
107
+
108
+ case 'Array':
109
+ str = '[';
110
+
111
+ for (let i = 0; i < thing.length; i += 1) {
112
+ if (i > 0) str += ',';
113
+
114
+ if (i in thing) {
115
+ keys.push(`[${i}]`);
116
+ str += flatten(thing[i]);
117
+ keys.pop();
118
+ } else {
119
+ str += HOLE;
120
+ }
121
+ }
122
+
123
+ str += ']';
124
+
125
+ break;
126
+
127
+ case 'Set':
128
+ str = '["Set"';
129
+
130
+ for (const value of thing) {
131
+ str += `,${flatten(value)}`;
132
+ }
133
+
134
+ str += ']';
135
+ break;
136
+
137
+ case 'Map':
138
+ str = '["Map"';
139
+
140
+ for (const [key, value] of thing) {
141
+ keys.push(
142
+ `.get(${is_primitive(key) ? stringify_primitive(key) : '...'})`
143
+ );
144
+ str += `,${flatten(key)},${flatten(value)}`;
145
+ keys.pop();
146
+ }
147
+
148
+ str += ']';
149
+ break;
150
+
151
+ case 'Int8Array':
152
+ case 'Uint8Array':
153
+ case 'Uint8ClampedArray':
154
+ case 'Int16Array':
155
+ case 'Uint16Array':
156
+ case 'Int32Array':
157
+ case 'Uint32Array':
158
+ case 'Float32Array':
159
+ case 'Float64Array':
160
+ case 'BigInt64Array':
161
+ case 'BigUint64Array': {
162
+ /** @type {import("./types.js").TypedArray} */
163
+ const typedArray = thing;
164
+ str = '["' + type + '",' + flatten(typedArray.buffer);
165
+
166
+ const a = thing.byteOffset;
167
+ const b = a + thing.byteLength;
168
+
169
+ // handle subarrays
170
+ if (a > 0 || b !== typedArray.buffer.byteLength) {
171
+ const m = +/(\d+)/.exec(type)[1] / 8;
172
+ str += `,${a / m},${b / m}`;
173
+ }
174
+
175
+ str += ']';
176
+ break;
177
+ }
178
+
179
+ case 'ArrayBuffer': {
180
+ /** @type {ArrayBuffer} */
181
+ const arraybuffer = thing;
182
+ const base64 = encode64(arraybuffer);
183
+
184
+ str = `["ArrayBuffer","${base64}"]`;
185
+ break;
186
+ }
187
+
188
+ case 'Temporal.Duration':
189
+ case 'Temporal.Instant':
190
+ case 'Temporal.PlainDate':
191
+ case 'Temporal.PlainTime':
192
+ case 'Temporal.PlainDateTime':
193
+ case 'Temporal.PlainMonthDay':
194
+ case 'Temporal.PlainYearMonth':
195
+ case 'Temporal.ZonedDateTime':
196
+ str = `["${type}",${stringify_string(thing.toString())}]`;
197
+ break;
198
+
199
+ default:
200
+ if (!is_plain_object(thing)) {
201
+ throw new DevalueError(
202
+ `Cannot stringify arbitrary non-POJOs`,
203
+ keys,
204
+ thing,
205
+ value
206
+ );
207
+ }
208
+
209
+ if (enumerable_symbols(thing).length > 0) {
210
+ throw new DevalueError(
211
+ `Cannot stringify POJOs with symbolic keys`,
212
+ keys,
213
+ thing,
214
+ value
215
+ );
216
+ }
217
+
218
+ if (Object.getPrototypeOf(thing) === null) {
219
+ str = '["null"';
220
+ for (const key in thing) {
221
+ keys.push(stringify_key(key));
222
+ str += `,${stringify_string(key)},${flatten(thing[key])}`;
223
+ keys.pop();
224
+ }
225
+ str += ']';
226
+ } else {
227
+ str = '{';
228
+ let started = false;
229
+ for (const key in thing) {
230
+ if (started) str += ',';
231
+ started = true;
232
+ keys.push(stringify_key(key));
233
+ str += `${stringify_string(key)}:${flatten(thing[key])}`;
234
+ keys.pop();
235
+ }
236
+ str += '}';
237
+ }
238
+ }
239
+ }
240
+
241
+ stringified[index] = str;
242
+ return index;
243
+ }
244
+
245
+ const index = flatten(value);
246
+
247
+ // special case — value is represented as a negative index
248
+ if (index < 0) return `${index}`;
249
+
250
+ return `[${stringified.join(',')}]`;
251
+ }
252
+
253
+ /**
254
+ * @param {any} thing
255
+ * @returns {string}
256
+ */
257
+ function stringify_primitive(thing) {
258
+ const type = typeof thing;
259
+ if (type === 'string') return stringify_string(thing);
260
+ if (thing instanceof String) return stringify_string(thing.toString());
261
+ if (thing === void 0) return UNDEFINED.toString();
262
+ if (thing === 0 && 1 / thing < 0) return NEGATIVE_ZERO.toString();
263
+ if (type === 'bigint') return `["BigInt","${thing}"]`;
264
+ return String(thing);
265
+ }