diff options
Diffstat (limited to 'src/bun.js/scripts/class-definitions.ts')
-rw-r--r-- | src/bun.js/scripts/class-definitions.ts | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/bun.js/scripts/class-definitions.ts b/src/bun.js/scripts/class-definitions.ts index 17c82d166..53d168d35 100644 --- a/src/bun.js/scripts/class-definitions.ts +++ b/src/bun.js/scripts/class-definitions.ts @@ -1,19 +1,24 @@ +interface PropertyAttribute { + enumerable?: boolean; + configurable?: boolean; +} + export type Field = - | { getter: string; cache?: true | string; this?: boolean } - | { setter: string; this?: boolean } - | { + | ({ getter: string; cache?: true | string; this?: boolean } & PropertyAttribute) + | ({ setter: string; this?: boolean } & PropertyAttribute) + | ({ accessor: { getter: string; setter: string }; cache?: true | string; this?: boolean; - } - | { + } & PropertyAttribute) + | ({ fn: string; length?: number; DOMJIT?: { returns: string; args?: [string, string] | [string, string, string] | [string]; }; - } + } & PropertyAttribute) | { internal: true }; export interface ClassDefinition { @@ -31,6 +36,9 @@ export interface ClassDefinition { isEventEmitter?: boolean; custom?: Record<string, CustomField>; + + configurable?: boolean; + enumerable?: boolean; } export interface CustomField { @@ -57,11 +65,7 @@ export function define( construct, estimatedSize, values, - klass: Object.fromEntries( - Object.entries(klass).sort(([a], [b]) => a.localeCompare(b)), - ), - proto: Object.fromEntries( - Object.entries(proto).sort(([a], [b]) => a.localeCompare(b)), - ), + klass: Object.fromEntries(Object.entries(klass).sort(([a], [b]) => a.localeCompare(b))), + proto: Object.fromEntries(Object.entries(proto).sort(([a], [b]) => a.localeCompare(b))), }; } |