1- 'use strict ';
1+ import globals from 'globals ';
22
33// These are string replacements specific to Node.js API docs for anchor IDs
44export const DOC_API_SLUGS_REPLACEMENTS = [
@@ -71,15 +71,20 @@ export const DOC_API_HEADING_TYPES = [
7171
7272// This is a mapping for types within the Markdown content and their respective
7373// JavaScript primitive types within the MDN JavaScript docs
74- // @see DOC_MDN_BASE_URL_JS_PRIMITIVES
74+ // @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Data_structures#primitive_values
7575export const DOC_TYPES_MAPPING_PRIMITIVES = {
76- boolean : 'Boolean' ,
77- integer : 'Number' , // Not a primitive, used for clarification.
78- null : 'Null' ,
79- number : 'Number' ,
80- string : 'String' ,
81- symbol : 'Symbol' ,
82- undefined : 'Undefined' ,
76+ ...Object . fromEntries (
77+ [
78+ 'null' ,
79+ 'undefined' ,
80+ 'boolean' ,
81+ 'number' ,
82+ 'bigint' ,
83+ 'string' ,
84+ 'symbol' ,
85+ ] . map ( e => [ e , e ] )
86+ ) ,
87+ integer : 'number' ,
8388} ;
8489
8590// This is a mapping for types within the Markdown content and their respective
@@ -88,45 +93,15 @@ export const DOC_TYPES_MAPPING_PRIMITIVES = {
8893export const DOC_TYPES_MAPPING_GLOBALS = {
8994 ...Object . fromEntries (
9095 [
91- 'AggregateError' ,
92- 'Array' ,
93- 'ArrayBuffer' ,
94- 'DataView' ,
95- 'Date' ,
96- 'Error' ,
97- 'EvalError' ,
98- 'Function' ,
99- 'Map' ,
100- 'NaN' ,
101- 'Object' ,
102- 'Promise' ,
103- 'Proxy' ,
104- 'RangeError' ,
105- 'ReferenceError' ,
106- 'RegExp' ,
107- 'Set' ,
108- 'SharedArrayBuffer' ,
109- 'SyntaxError' ,
110- 'Symbol' ,
111- 'TypeError' ,
112- 'URIError' ,
113- 'WeakMap' ,
114- 'WeakSet' ,
115-
116- 'TypedArray' ,
117- 'Float16Array' ,
118- 'Float32Array' ,
119- 'Float64Array' ,
120- 'Int8Array' ,
121- 'Int16Array' ,
122- 'Int32Array' ,
123- 'Uint8Array' ,
124- 'Uint8ClampedArray' ,
125- 'Uint16Array' ,
126- 'Uint32Array' ,
96+ // This is updated with every ES-spec, so, as long as the
97+ // `globals` package is up-to-date, so will our globals
98+ // list.
99+ ...Object . keys ( globals . builtin ) ,
100+ 'AsyncGeneratorFunction' ,
101+ 'AsyncIterator' ,
102+ 'AsyncFunction' ,
127103 ] . map ( e => [ e , e ] )
128104 ) ,
129- bigint : 'BigInt' ,
130105 'WebAssembly.Instance' : 'WebAssembly/Instance' ,
131106} ;
132107
@@ -331,18 +306,12 @@ export const DOC_TYPES_MAPPING_OTHER = {
331306
332307 ArrayBufferView : `${ DOC_MDN_BASE_URL } /API/ArrayBufferView` ,
333308
334- AsyncIterator : 'https://tc39.github.io/ecma262/#sec-asynciterator-interface' ,
335309 AsyncIterable : 'https://tc39.github.io/ecma262/#sec-asynciterable-interface' ,
336- AsyncFunction : 'https://tc39.es/ecma262/#sec-async-function-constructor' ,
337310
338311 'Module Namespace Object' :
339312 'https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects' ,
340313
341- AsyncGeneratorFunction :
342- 'https://tc39.es/proposal-async-iteration/#sec-asyncgeneratorfunction-constructor' ,
343-
344314 Iterable : `${ DOC_MDN_BASE_URL_JS } Reference/Iteration_protocols#The_iterable_protocol` ,
345- Iterator : `${ DOC_MDN_BASE_URL_JS } Reference/Iteration_protocols#The_iterator_protocol` ,
346315
347316 CloseEvent : `${ DOC_MDN_BASE_URL } /API/CloseEvent` ,
348317 EventSource : `${ DOC_MDN_BASE_URL } /API/EventSource` ,
0 commit comments