diff --git a/data/builtin.mjs b/data/builtin.mjs index a7f65a1..b499a19 100644 --- a/data/builtin.mjs +++ b/data/builtin.mjs @@ -10,7 +10,6 @@ export default { BigInt64Array: false, BigUint64Array: false, Boolean: false, - constructor: false, DataView: false, Date: false, decodeURI: false, @@ -26,7 +25,6 @@ export default { Float64Array: false, Function: false, globalThis: false, - hasOwnProperty: false, Infinity: false, Int16Array: false, Int32Array: false, @@ -34,7 +32,6 @@ export default { Intl: false, isFinite: false, isNaN: false, - isPrototypeOf: false, JSON: false, Map: false, Math: false, @@ -44,7 +41,6 @@ export default { parseFloat: false, parseInt: false, Promise: false, - propertyIsEnumerable: false, Proxy: false, RangeError: false, ReferenceError: false, @@ -55,8 +51,6 @@ export default { String: false, Symbol: false, SyntaxError: false, - toLocaleString: false, - toString: false, TypeError: false, Uint16Array: false, Uint32Array: false, @@ -65,7 +59,6 @@ export default { undefined: false, unescape: false, URIError: false, - valueOf: false, WeakMap: false, WeakRef: false, WeakSet: false, diff --git a/data/es5.mjs b/data/es5.mjs index 11619f1..8d05b23 100644 --- a/data/es5.mjs +++ b/data/es5.mjs @@ -1,7 +1,6 @@ export default { Array: false, Boolean: false, - constructor: false, Date: false, decodeURI: false, decodeURIComponent: false, @@ -12,11 +11,9 @@ export default { eval: false, EvalError: false, Function: false, - hasOwnProperty: false, Infinity: false, isFinite: false, isNaN: false, - isPrototypeOf: false, JSON: false, Math: false, NaN: false, @@ -24,17 +21,13 @@ export default { Object: false, parseFloat: false, parseInt: false, - propertyIsEnumerable: false, RangeError: false, ReferenceError: false, RegExp: false, String: false, SyntaxError: false, - toLocaleString: false, - toString: false, TypeError: false, undefined: false, unescape: false, URIError: false, - valueOf: false, }; diff --git a/globals.json b/globals.json index 63b0bab..7e6de42 100644 --- a/globals.json +++ b/globals.json @@ -8,7 +8,6 @@ "BigInt64Array": false, "BigUint64Array": false, "Boolean": false, - "constructor": false, "DataView": false, "Date": false, "decodeURI": false, @@ -24,7 +23,6 @@ "Float64Array": false, "Function": false, "globalThis": false, - "hasOwnProperty": false, "Infinity": false, "Int16Array": false, "Int32Array": false, @@ -32,7 +30,6 @@ "Intl": false, "isFinite": false, "isNaN": false, - "isPrototypeOf": false, "JSON": false, "Map": false, "Math": false, @@ -42,7 +39,6 @@ "parseFloat": false, "parseInt": false, "Promise": false, - "propertyIsEnumerable": false, "Proxy": false, "RangeError": false, "ReferenceError": false, @@ -53,8 +49,6 @@ "String": false, "Symbol": false, "SyntaxError": false, - "toLocaleString": false, - "toString": false, "TypeError": false, "Uint16Array": false, "Uint32Array": false, @@ -63,7 +57,6 @@ "undefined": false, "unescape": false, "URIError": false, - "valueOf": false, "WeakMap": false, "WeakRef": false, "WeakSet": false @@ -71,7 +64,6 @@ "es5": { "Array": false, "Boolean": false, - "constructor": false, "Date": false, "decodeURI": false, "decodeURIComponent": false, @@ -82,11 +74,9 @@ "eval": false, "EvalError": false, "Function": false, - "hasOwnProperty": false, "Infinity": false, "isFinite": false, "isNaN": false, - "isPrototypeOf": false, "JSON": false, "Math": false, "NaN": false, @@ -94,25 +84,20 @@ "Object": false, "parseFloat": false, "parseInt": false, - "propertyIsEnumerable": false, "RangeError": false, "ReferenceError": false, "RegExp": false, "String": false, "SyntaxError": false, - "toLocaleString": false, - "toString": false, "TypeError": false, "undefined": false, "unescape": false, - "URIError": false, - "valueOf": false + "URIError": false }, "es2015": { "Array": false, "ArrayBuffer": false, "Boolean": false, - "constructor": false, "DataView": false, "Date": false, "decodeURI": false, @@ -126,7 +111,6 @@ "Float32Array": false, "Float64Array": false, "Function": false, - "hasOwnProperty": false, "Infinity": false, "Int16Array": false, "Int32Array": false, @@ -134,7 +118,6 @@ "Intl": false, "isFinite": false, "isNaN": false, - "isPrototypeOf": false, "JSON": false, "Map": false, "Math": false, @@ -144,7 +127,6 @@ "parseFloat": false, "parseInt": false, "Promise": false, - "propertyIsEnumerable": false, "Proxy": false, "RangeError": false, "ReferenceError": false, @@ -154,8 +136,6 @@ "String": false, "Symbol": false, "SyntaxError": false, - "toLocaleString": false, - "toString": false, "TypeError": false, "Uint16Array": false, "Uint32Array": false, @@ -164,7 +144,6 @@ "undefined": false, "unescape": false, "URIError": false, - "valueOf": false, "WeakMap": false, "WeakSet": false }, @@ -173,7 +152,6 @@ "ArrayBuffer": false, "Atomics": false, "Boolean": false, - "constructor": false, "DataView": false, "Date": false, "decodeURI": false, @@ -187,7 +165,6 @@ "Float32Array": false, "Float64Array": false, "Function": false, - "hasOwnProperty": false, "Infinity": false, "Int16Array": false, "Int32Array": false, @@ -195,7 +172,6 @@ "Intl": false, "isFinite": false, "isNaN": false, - "isPrototypeOf": false, "JSON": false, "Map": false, "Math": false, @@ -205,7 +181,6 @@ "parseFloat": false, "parseInt": false, "Promise": false, - "propertyIsEnumerable": false, "Proxy": false, "RangeError": false, "ReferenceError": false, @@ -216,8 +191,6 @@ "String": false, "Symbol": false, "SyntaxError": false, - "toLocaleString": false, - "toString": false, "TypeError": false, "Uint16Array": false, "Uint32Array": false, @@ -226,7 +199,6 @@ "undefined": false, "unescape": false, "URIError": false, - "valueOf": false, "WeakMap": false, "WeakSet": false }, @@ -238,7 +210,6 @@ "BigInt64Array": false, "BigUint64Array": false, "Boolean": false, - "constructor": false, "DataView": false, "Date": false, "decodeURI": false, @@ -253,7 +224,6 @@ "Float64Array": false, "Function": false, "globalThis": false, - "hasOwnProperty": false, "Infinity": false, "Int16Array": false, "Int32Array": false, @@ -261,7 +231,6 @@ "Intl": false, "isFinite": false, "isNaN": false, - "isPrototypeOf": false, "JSON": false, "Map": false, "Math": false, @@ -271,7 +240,6 @@ "parseFloat": false, "parseInt": false, "Promise": false, - "propertyIsEnumerable": false, "Proxy": false, "RangeError": false, "ReferenceError": false, @@ -282,8 +250,6 @@ "String": false, "Symbol": false, "SyntaxError": false, - "toLocaleString": false, - "toString": false, "TypeError": false, "Uint16Array": false, "Uint32Array": false, @@ -292,7 +258,6 @@ "undefined": false, "unescape": false, "URIError": false, - "valueOf": false, "WeakMap": false, "WeakSet": false }, @@ -305,7 +270,6 @@ "BigInt64Array": false, "BigUint64Array": false, "Boolean": false, - "constructor": false, "DataView": false, "Date": false, "decodeURI": false, @@ -321,7 +285,6 @@ "Float64Array": false, "Function": false, "globalThis": false, - "hasOwnProperty": false, "Infinity": false, "Int16Array": false, "Int32Array": false, @@ -329,7 +292,6 @@ "Intl": false, "isFinite": false, "isNaN": false, - "isPrototypeOf": false, "JSON": false, "Map": false, "Math": false, @@ -339,7 +301,6 @@ "parseFloat": false, "parseInt": false, "Promise": false, - "propertyIsEnumerable": false, "Proxy": false, "RangeError": false, "ReferenceError": false, @@ -350,8 +311,6 @@ "String": false, "Symbol": false, "SyntaxError": false, - "toLocaleString": false, - "toString": false, "TypeError": false, "Uint16Array": false, "Uint32Array": false, @@ -360,7 +319,6 @@ "undefined": false, "unescape": false, "URIError": false, - "valueOf": false, "WeakMap": false, "WeakRef": false, "WeakSet": false diff --git a/scripts/get-builtin-globals.mjs b/scripts/get-builtin-globals.mjs index 1343383..6bc895d 100644 --- a/scripts/get-builtin-globals.mjs +++ b/scripts/get-builtin-globals.mjs @@ -59,35 +59,12 @@ function * getGlobalObjects(specification) { } } -function * getObjectProperties(specification) { - const $ = cheerio.load(specification); - - for (const element of $('emu-clause#sec-properties-of-the-object-prototype-object > emu-clause > h1')) { - const text = $(element).text().trim(); - if (!text.startsWith('Object.prototype.')) { - continue; - } - - const property = text.split(/\s/)[0].slice('Object.prototype.'.length); - // `Object.prototype.{__proto__, ..}` - if (property.startsWith('_')) { - continue; - } - - if (Object.hasOwn(Object.prototype, property)) { - yield property; - } - } -} - export default async function getBuiltinGlobals() { const specification = await getSpecification(); return Object.fromEntries( [ ...getGlobalObjects(specification), - // `globalThis` is an object - ...getObjectProperties(specification), ...additionalGlobals, ].map(name => [name, false]), ); diff --git a/scripts/get-node-globals.mjs b/scripts/get-node-globals.mjs deleted file mode 100644 index f71d1c9..0000000 --- a/scripts/get-node-globals.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import {updateGlobals, getGlobalThisProperties, createGlobals} from './utilities.mjs'; - -const ignore = [ - /^__/, -]; - -const properties = getGlobalThisProperties(); - -const nodeBuiltinGlobals = await createGlobals(properties, {ignore}); -await updateGlobals('nodeBuiltin', nodeBuiltinGlobals); diff --git a/scripts/utilities.mjs b/scripts/utilities.mjs index 68240e5..6efbffb 100644 --- a/scripts/utilities.mjs +++ b/scripts/utilities.mjs @@ -44,11 +44,15 @@ async function updateGlobals({environment, getGlobals, dryRun, incremental}) { function getGlobalThisProperties() { const keys = []; - for (let object = globalThis; object; object = Object.getPrototypeOf(object)) { + for ( + let object = globalThis; + object && object !== Object.prototype; + object = Object.getPrototypeOf(object) + ) { keys.push(...Object.getOwnPropertyNames(object)); } - return keys; + return keys.filter(key => key !== 'constructor'); } async function createGlobals(names, {