aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/scripts/class-definitions.ts
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-02-06 19:27:21 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-02-06 19:27:21 -0800
commit77974f2a6ed7b2b07e1ef82ff27cb57bd2ff07d7 (patch)
tree82b2db93c085d6e16760fa4d7151a0f5a104619c /src/bun.js/scripts/class-definitions.ts
parented72bee37339dacb36dc167146ff22f25f97d82a (diff)
downloadbun-77974f2a6ed7b2b07e1ef82ff27cb57bd2ff07d7.tar.gz
bun-77974f2a6ed7b2b07e1ef82ff27cb57bd2ff07d7.tar.zst
bun-77974f2a6ed7b2b07e1ef82ff27cb57bd2ff07d7.zip
tweaks to generator
Diffstat (limited to 'src/bun.js/scripts/class-definitions.ts')
-rw-r--r--src/bun.js/scripts/class-definitions.ts28
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))),
};
}