From 99cc26da81ca19af4ab6b8f06c4ae30e7df331a7 Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Sun, 14 Aug 2022 17:02:55 +0900 Subject: [PATCH 1/8] add global objects/interfaces extractor --- scripts/globals-extractor.mjs | 56 ++ src/compiler/utils/names.ts | 1407 ++++++++++++++++++++++++++++++++- 2 files changed, 1435 insertions(+), 28 deletions(-) create mode 100644 scripts/globals-extractor.mjs diff --git a/scripts/globals-extractor.mjs b/scripts/globals-extractor.mjs new file mode 100644 index 00000000000..b2e0f523314 --- /dev/null +++ b/scripts/globals-extractor.mjs @@ -0,0 +1,56 @@ +/** ---------------------------------------------------------------------- +This script gets a list of global objects/interfaces of browser. +This process is simple for now, so it is handled without AST parser. +see: https://github.com/microsoft/TypeScript/tree/main/lib + ---------------------------------------------------------------------- */ + +import http from 'https'; + +const get_url = (name) => `https://raw.githubusercontent.com/microsoft/TypeScript/main/lib/lib.${name}.d.ts`; +const extract_name = (split) => split.match(/^[a-zA-Z0-9_$]+/)[0]; + +const extract_interfaces_and_references = (data) => { + const interfaces = []; + const references = []; + data.split('\n').forEach(line => { + const trimmed = line.trim(); + const split = trimmed.replace(/[\s+]/, ' ').split(' '); + if (split[0] === 'interface') interfaces.push(extract_name(split[1])); + else if (split[0] === 'declare') interfaces.push(extract_name(split[2])); + else if (trimmed.startsWith('/// new Promise((resolve, reject) => { + http.get(url, (res) => { + let body = ''; + res.setEncoding('utf8'); + res.on('data', (chunk) => body += chunk); + res.on('end', () => resolve(body)); + }).on('error', (e) => { + console.error(e.message); + reject(e); + }); +}); + +const get_interfaces = async (name) => { + const res = []; + const body = await do_get(get_url(name)); + const { interfaces, references } = extract_interfaces_and_references(body); + res.push(...interfaces); + const chile_interfaces = await Promise.all(references.map(get_interfaces)); + chile_interfaces.forEach(i => res.push(...i)); + return res; +}; + +(async () => { + const interfaces = await get_interfaces('es2021.full'); + // MEMO: add additional objects/interfaces which existed in `src/compiler/utils/names.ts` + // before this script was introduced but could not be retrieved by this process. + interfaces.push(...['globalThis', 'InternalError', 'process', 'undefined']); + new Set(interfaces.sort()).forEach((i) => console.log(`'${i}',`)); +})(); diff --git a/src/compiler/utils/names.ts b/src/compiler/utils/names.ts index e091edb19eb..2073b7e8e84 100644 --- a/src/compiler/utils/names.ts +++ b/src/compiler/utils/names.ts @@ -2,67 +2,1418 @@ import { isIdentifierStart, isIdentifierChar } from 'acorn'; import full_char_code_at from './full_char_code_at'; export const globals = new Set([ - 'alert', + 'ANGLE_instanced_arrays', + 'ARIAMixin', + 'AbortController', + 'AbortSignal', + 'AbortSignalEventMap', + 'AbstractRange', + 'AbstractWorker', + 'AbstractWorkerEventMap', + 'ActiveXObject', + 'AddEventListenerOptions', + 'AesCbcParams', + 'AesCtrParams', + 'AesDerivedKeyParams', + 'AesGcmParams', + 'AesKeyAlgorithm', + 'AesKeyGenParams', + 'AggregateError', + 'AggregateErrorConstructor', + 'Algorithm', + 'AnalyserNode', + 'AnalyserOptions', + 'Animatable', + 'Animation', + 'AnimationEffect', + 'AnimationEvent', + 'AnimationEventInit', + 'AnimationEventMap', + 'AnimationFrameProvider', + 'AnimationPlaybackEvent', + 'AnimationPlaybackEventInit', + 'AnimationTimeline', 'Array', + 'ArrayBuffer', + 'ArrayBufferConstructor', + 'ArrayBufferTypes', + 'ArrayBufferView', + 'ArrayConstructor', + 'ArrayLike', + 'AssignedNodesOptions', + 'AsyncGenerator', + 'AsyncGeneratorFunction', + 'AsyncGeneratorFunctionConstructor', + 'AsyncIterable', + 'AsyncIterableIterator', + 'AsyncIterator', + 'Atomics', + 'Attr', + 'Audio', + 'AudioBuffer', + 'AudioBufferOptions', + 'AudioBufferSourceNode', + 'AudioBufferSourceOptions', + 'AudioConfiguration', + 'AudioContext', + 'AudioContextOptions', + 'AudioDestinationNode', + 'AudioListener', + 'AudioNode', + 'AudioNodeOptions', + 'AudioParam', + 'AudioParamMap', + 'AudioProcessingEvent', + 'AudioProcessingEventInit', + 'AudioScheduledSourceNode', + 'AudioScheduledSourceNodeEventMap', + 'AudioTimestamp', + 'AudioWorklet', + 'AudioWorkletNode', + 'AudioWorkletNodeEventMap', + 'AudioWorkletNodeOptions', + 'AuthenticationExtensionsClientInputs', + 'AuthenticationExtensionsClientOutputs', + 'AuthenticatorAssertionResponse', + 'AuthenticatorAttestationResponse', + 'AuthenticatorResponse', + 'AuthenticatorSelectionCriteria', + 'BarProp', + 'BaseAudioContext', + 'BaseAudioContextEventMap', + 'BeforeUnloadEvent', 'BigInt', + 'BigInt64Array', + 'BigInt64ArrayConstructor', + 'BigIntConstructor', + 'BigIntToLocaleStringOptions', + 'BigUint64Array', + 'BigUint64ArrayConstructor', + 'BiquadFilterNode', + 'BiquadFilterOptions', + 'Blob', + 'BlobCallback', + 'BlobEvent', + 'BlobEventInit', + 'BlobPropertyBag', + 'Body', 'Boolean', - 'clearInterval', - 'clearTimeout', - 'confirm', - 'console', + 'BooleanConstructor', + 'BroadcastChannel', + 'BroadcastChannelEventMap', + 'ByteLengthQueuingStrategy', + 'CDATASection', + 'CSS', + 'CSSAnimation', + 'CSSConditionRule', + 'CSSCounterStyleRule', + 'CSSFontFaceRule', + 'CSSGroupingRule', + 'CSSImportRule', + 'CSSKeyframeRule', + 'CSSKeyframesRule', + 'CSSMediaRule', + 'CSSNamespaceRule', + 'CSSPageRule', + 'CSSRule', + 'CSSRuleList', + 'CSSStyleDeclaration', + 'CSSStyleRule', + 'CSSStyleSheet', + 'CSSSupportsRule', + 'CSSTransition', + 'Cache', + 'CacheQueryOptions', + 'CacheStorage', + 'CallableFunction', + 'CanvasCompositing', + 'CanvasDrawImage', + 'CanvasDrawPath', + 'CanvasFillStrokeStyles', + 'CanvasFilters', + 'CanvasGradient', + 'CanvasImageData', + 'CanvasImageSmoothing', + 'CanvasPath', + 'CanvasPathDrawingStyles', + 'CanvasPattern', + 'CanvasRect', + 'CanvasRenderingContext2D', + 'CanvasRenderingContext2DSettings', + 'CanvasShadowStyles', + 'CanvasState', + 'CanvasText', + 'CanvasTextDrawingStyles', + 'CanvasTransform', + 'CanvasUserInterface', + 'ChannelMergerNode', + 'ChannelMergerOptions', + 'ChannelSplitterNode', + 'ChannelSplitterOptions', + 'CharacterData', + 'ChildNode', + 'ClassDecorator', + 'ClientQueryOptions', + 'ClientRect', + 'Clipboard', + 'ClipboardEvent', + 'ClipboardEventInit', + 'ClipboardItem', + 'ClipboardItemOptions', + 'CloseEvent', + 'CloseEventInit', + 'Collator', + 'CollatorOptions', + 'Comment', + 'CompileError', + 'CompositionEvent', + 'CompositionEventInit', + 'ComputedEffectTiming', + 'ComputedKeyframe', + 'ConcatArray', + 'Console', + 'ConstantSourceNode', + 'ConstantSourceOptions', + 'ConstrainBooleanParameters', + 'ConstrainDOMStringParameters', + 'ConstrainDoubleRange', + 'ConstrainULongRange', + 'ConvolverNode', + 'ConvolverOptions', + 'CountQueuingStrategy', + 'Credential', + 'CredentialCreationOptions', + 'CredentialPropertiesOutput', + 'CredentialRequestOptions', + 'CredentialsContainer', + 'Crypto', + 'CryptoKey', + 'CryptoKeyPair', + 'CustomElementConstructor', + 'CustomElementRegistry', + 'CustomEvent', + 'CustomEventInit', + 'DOMException', + 'DOMImplementation', + 'DOMMatrix', + 'DOMMatrix2DInit', + 'DOMMatrixInit', + 'DOMMatrixReadOnly', + 'DOMParser', + 'DOMPoint', + 'DOMPointInit', + 'DOMPointReadOnly', + 'DOMQuad', + 'DOMQuadInit', + 'DOMRect', + 'DOMRectInit', + 'DOMRectList', + 'DOMRectReadOnly', + 'DOMStringList', + 'DOMStringMap', + 'DOMTokenList', + 'DataTransfer', + 'DataTransferItem', + 'DataTransferItemList', + 'DataView', + 'DataViewConstructor', 'Date', - 'decodeURI', - 'decodeURIComponent', - 'document', + 'DateConstructor', + 'DateTimeFormat', + 'DateTimeFormatOptions', + 'DateTimeFormatPart', + 'DecodeErrorCallback', + 'DecodeSuccessCallback', + 'DelayNode', + 'DelayOptions', + 'DeviceMotionEvent', + 'DeviceMotionEventAcceleration', + 'DeviceMotionEventAccelerationInit', + 'DeviceMotionEventInit', + 'DeviceMotionEventRotationRate', + 'DeviceMotionEventRotationRateInit', + 'DeviceOrientationEvent', + 'DeviceOrientationEventInit', + 'DisplayMediaStreamConstraints', + 'Document', + 'DocumentAndElementEventHandlers', + 'DocumentAndElementEventHandlersEventMap', + 'DocumentEventMap', + 'DocumentFragment', + 'DocumentOrShadowRoot', + 'DocumentTimeline', + 'DocumentTimelineOptions', + 'DocumentType', + 'DoubleRange', + 'DragEvent', + 'DragEventInit', + 'DynamicsCompressorNode', + 'DynamicsCompressorOptions', + 'EXT_blend_minmax', + 'EXT_color_buffer_float', + 'EXT_color_buffer_half_float', + 'EXT_float_blend', + 'EXT_frag_depth', + 'EXT_sRGB', + 'EXT_shader_texture_lod', + 'EXT_texture_compression_rgtc', + 'EXT_texture_filter_anisotropic', + 'EcKeyAlgorithm', + 'EcKeyGenParams', + 'EcKeyImportParams', + 'EcdhKeyDeriveParams', + 'EcdsaParams', + 'EffectTiming', 'Element', - 'encodeURI', - 'encodeURIComponent', + 'ElementCSSInlineStyle', + 'ElementContentEditable', + 'ElementCreationOptions', + 'ElementDefinitionOptions', + 'ElementEventMap', + 'Enumerator', + 'EnumeratorConstructor', 'Error', + 'ErrorCallback', + 'ErrorConstructor', + 'ErrorEvent', + 'ErrorEventInit', 'EvalError', + 'EvalErrorConstructor', 'Event', + 'EventInit', + 'EventListener', + 'EventListenerObject', + 'EventListenerOptions', + 'EventModifierInit', 'EventSource', - 'fetch', + 'EventSourceEventMap', + 'EventSourceInit', + 'EventTarget', + 'External', + 'File', + 'FileCallback', + 'FileList', + 'FilePropertyBag', + 'FileReader', + 'FileReaderEventMap', + 'FileSystem', + 'FileSystemDirectoryEntry', + 'FileSystemDirectoryReader', + 'FileSystemEntriesCallback', + 'FileSystemEntry', + 'FileSystemEntryCallback', + 'FileSystemFileEntry', + 'FileSystemFlags', + 'FinalizationRegistry', + 'FinalizationRegistryConstructor', + 'Float32Array', + 'Float32ArrayConstructor', + 'Float64Array', + 'Float64ArrayConstructor', + 'FocusEvent', + 'FocusEventInit', + 'FocusOptions', + 'FontFace', + 'FontFaceDescriptors', + 'FontFaceSet', + 'FontFaceSetEventMap', + 'FontFaceSetLoadEvent', + 'FontFaceSetLoadEventInit', + 'FontFaceSource', 'FormData', - 'global', - 'globalThis', - 'history', + 'FormDataEvent', + 'FormDataEventInit', + 'FrameRequestCallback', + 'FullscreenOptions', + 'Function', + 'FunctionConstructor', + 'FunctionStringCallback', + 'GainNode', + 'GainOptions', + 'Gamepad', + 'GamepadButton', + 'GamepadEvent', + 'GamepadEventInit', + 'GamepadHapticActuator', + 'Generator', + 'GeneratorFunction', + 'GeneratorFunctionConstructor', + 'GenericTransformStream', + 'Geolocation', + 'GeolocationCoordinates', + 'GeolocationPosition', + 'GeolocationPositionError', + 'GetAnimationsOptions', + 'GetNotificationOptions', + 'GetRootNodeOptions', + 'Global', + 'GlobalDescriptor', + 'GlobalEventHandlers', + 'GlobalEventHandlersEventMap', + 'HTMLAllCollection', + 'HTMLAnchorElement', + 'HTMLAreaElement', + 'HTMLAudioElement', + 'HTMLBRElement', + 'HTMLBaseElement', + 'HTMLBodyElement', + 'HTMLBodyElementEventMap', + 'HTMLButtonElement', + 'HTMLCanvasElement', + 'HTMLCollection', + 'HTMLCollectionBase', + 'HTMLCollectionOf', + 'HTMLDListElement', + 'HTMLDataElement', + 'HTMLDataListElement', + 'HTMLDetailsElement', + 'HTMLDialogElement', + 'HTMLDirectoryElement', + 'HTMLDivElement', + 'HTMLDocument', 'HTMLElement', + 'HTMLElementDeprecatedTagNameMap', + 'HTMLElementEventMap', + 'HTMLElementTagNameMap', + 'HTMLEmbedElement', + 'HTMLFieldSetElement', + 'HTMLFontElement', + 'HTMLFormControlsCollection', + 'HTMLFormElement', + 'HTMLFrameElement', + 'HTMLFrameSetElement', + 'HTMLFrameSetElementEventMap', + 'HTMLHRElement', + 'HTMLHeadElement', + 'HTMLHeadingElement', + 'HTMLHtmlElement', + 'HTMLHyperlinkElementUtils', + 'HTMLIFrameElement', + 'HTMLImageElement', + 'HTMLInputElement', + 'HTMLLIElement', + 'HTMLLabelElement', + 'HTMLLegendElement', + 'HTMLLinkElement', + 'HTMLMapElement', + 'HTMLMarqueeElement', + 'HTMLMediaElement', + 'HTMLMediaElementEventMap', + 'HTMLMenuElement', + 'HTMLMetaElement', + 'HTMLMeterElement', + 'HTMLModElement', + 'HTMLOListElement', + 'HTMLObjectElement', + 'HTMLOptGroupElement', + 'HTMLOptionElement', + 'HTMLOptionsCollection', + 'HTMLOrSVGElement', + 'HTMLOutputElement', + 'HTMLParagraphElement', + 'HTMLParamElement', + 'HTMLPictureElement', + 'HTMLPreElement', + 'HTMLProgressElement', + 'HTMLQuoteElement', + 'HTMLScriptElement', + 'HTMLSelectElement', + 'HTMLSlotElement', + 'HTMLSourceElement', + 'HTMLSpanElement', + 'HTMLStyleElement', + 'HTMLTableCaptionElement', + 'HTMLTableCellElement', + 'HTMLTableColElement', + 'HTMLTableDataCellElement', + 'HTMLTableElement', + 'HTMLTableHeaderCellElement', + 'HTMLTableRowElement', + 'HTMLTableSectionElement', + 'HTMLTemplateElement', + 'HTMLTextAreaElement', + 'HTMLTimeElement', + 'HTMLTitleElement', + 'HTMLTrackElement', + 'HTMLUListElement', + 'HTMLUnknownElement', + 'HTMLVideoElement', + 'HTMLVideoElementEventMap', + 'HashChangeEvent', + 'HashChangeEventInit', + 'Headers', + 'History', + 'HkdfParams', + 'HmacImportParams', + 'HmacKeyAlgorithm', + 'HmacKeyGenParams', + 'IArguments', + 'IDBCursor', + 'IDBCursorWithValue', + 'IDBDatabase', + 'IDBDatabaseEventMap', + 'IDBDatabaseInfo', + 'IDBFactory', + 'IDBIndex', + 'IDBIndexParameters', + 'IDBKeyRange', + 'IDBObjectStore', + 'IDBObjectStoreParameters', + 'IDBOpenDBRequest', + 'IDBOpenDBRequestEventMap', + 'IDBRequest', + 'IDBRequestEventMap', + 'IDBTransaction', + 'IDBTransactionEventMap', + 'IDBVersionChangeEvent', + 'IDBVersionChangeEventInit', + 'IIRFilterNode', + 'IIRFilterOptions', + 'ITextWriter', + 'IdleDeadline', + 'IdleRequestCallback', + 'IdleRequestOptions', + 'Image', + 'ImageBitmap', + 'ImageBitmapOptions', + 'ImageBitmapRenderingContext', + 'ImageBitmapRenderingContextSettings', + 'ImageData', + 'ImageDataSettings', + 'ImportMeta', 'Infinity', + 'InnerHTML', + 'InputEvent', + 'InputEventInit', + 'Instance', + 'Int16Array', + 'Int16ArrayConstructor', + 'Int32Array', + 'Int32ArrayConstructor', + 'Int8Array', + 'Int8ArrayConstructor', 'InternalError', + 'IntersectionObserver', + 'IntersectionObserverCallback', + 'IntersectionObserverEntry', + 'IntersectionObserverEntryInit', + 'IntersectionObserverInit', 'Intl', - 'isFinite', - 'isNaN', + 'Iterable', + 'IterableIterator', + 'Iterator', + 'IteratorReturnResult', + 'IteratorYieldResult', 'JSON', - 'localStorage', - 'location', + 'JsonWebKey', + 'KHR_parallel_shader_compile', + 'KeyAlgorithm', + 'KeyboardEvent', + 'KeyboardEventInit', + 'Keyframe', + 'KeyframeAnimationOptions', + 'KeyframeEffect', + 'KeyframeEffectOptions', + 'LinkError', + 'LinkStyle', + 'Location', 'Map', + 'MapConstructor', 'Math', + 'MathMLElement', + 'MathMLElementEventMap', + 'MediaCapabilities', + 'MediaCapabilitiesDecodingInfo', + 'MediaCapabilitiesEncodingInfo', + 'MediaCapabilitiesInfo', + 'MediaConfiguration', + 'MediaDecodingConfiguration', + 'MediaDeviceInfo', + 'MediaDevices', + 'MediaDevicesEventMap', + 'MediaElementAudioSourceNode', + 'MediaElementAudioSourceOptions', + 'MediaEncodingConfiguration', + 'MediaEncryptedEvent', + 'MediaEncryptedEventInit', + 'MediaError', + 'MediaImage', + 'MediaKeyMessageEvent', + 'MediaKeyMessageEventInit', + 'MediaKeySession', + 'MediaKeySessionEventMap', + 'MediaKeyStatusMap', + 'MediaKeySystemAccess', + 'MediaKeySystemConfiguration', + 'MediaKeySystemMediaCapability', + 'MediaKeys', + 'MediaList', + 'MediaMetadata', + 'MediaMetadataInit', + 'MediaPositionState', + 'MediaQueryList', + 'MediaQueryListEvent', + 'MediaQueryListEventInit', + 'MediaQueryListEventMap', + 'MediaRecorder', + 'MediaRecorderErrorEvent', + 'MediaRecorderErrorEventInit', + 'MediaRecorderEventMap', + 'MediaRecorderOptions', + 'MediaSession', + 'MediaSessionActionDetails', + 'MediaSessionActionHandler', + 'MediaSource', + 'MediaSourceEventMap', + 'MediaStream', + 'MediaStreamAudioDestinationNode', + 'MediaStreamAudioSourceNode', + 'MediaStreamAudioSourceOptions', + 'MediaStreamConstraints', + 'MediaStreamEventMap', + 'MediaStreamTrack', + 'MediaStreamTrackEvent', + 'MediaStreamTrackEventInit', + 'MediaStreamTrackEventMap', + 'MediaTrackCapabilities', + 'MediaTrackConstraintSet', + 'MediaTrackConstraints', + 'MediaTrackSettings', + 'MediaTrackSupportedConstraints', + 'Memory', + 'MemoryDescriptor', + 'MessageChannel', + 'MessageEvent', + 'MessageEventInit', + 'MessagePort', + 'MessagePortEventMap', + 'MethodDecorator', + 'MimeType', + 'MimeTypeArray', + 'Module', + 'ModuleExportDescriptor', + 'ModuleImportDescriptor', + 'MouseEvent', + 'MouseEventInit', + 'MultiCacheQueryOptions', + 'MutationCallback', + 'MutationEvent', + 'MutationObserver', + 'MutationObserverInit', + 'MutationRecord', 'NaN', - 'navigator', + 'NamedNodeMap', + 'Navigator', + 'NavigatorAutomationInformation', + 'NavigatorConcurrentHardware', + 'NavigatorContentUtils', + 'NavigatorCookies', + 'NavigatorID', + 'NavigatorLanguage', + 'NavigatorNetworkInformation', + 'NavigatorOnLine', + 'NavigatorPlugins', + 'NavigatorStorage', + 'NetworkInformation', + 'NewableFunction', 'Node', + 'NodeFilter', + 'NodeIterator', + 'NodeList', + 'NodeListOf', + 'NonDocumentTypeChildNode', + 'NonElementParentNode', + 'Notification', + 'NotificationAction', + 'NotificationEventMap', + 'NotificationOptions', + 'NotificationPermissionCallback', 'Number', + 'NumberConstructor', + 'NumberFormat', + 'NumberFormatOptions', + 'OES_element_index_uint', + 'OES_fbo_render_mipmap', + 'OES_standard_derivatives', + 'OES_texture_float', + 'OES_texture_float_linear', + 'OES_texture_half_float', + 'OES_texture_half_float_linear', + 'OES_vertex_array_object', + 'OVR_multiview2', 'Object', - 'parseFloat', - 'parseInt', - 'process', + 'ObjectConstructor', + 'OfflineAudioCompletionEvent', + 'OfflineAudioCompletionEventInit', + 'OfflineAudioContext', + 'OfflineAudioContextEventMap', + 'OfflineAudioContextOptions', + 'OffscreenCanvas', + 'OnBeforeUnloadEventHandlerNonNull', + 'OnErrorEventHandlerNonNull', + 'Option', + 'OptionalEffectTiming', + 'OscillatorNode', + 'OscillatorOptions', + 'OverconstrainedError', + 'PageTransitionEvent', + 'PageTransitionEventInit', + 'PannerNode', + 'PannerOptions', + 'ParameterDecorator', + 'ParentNode', + 'Path2D', + 'PaymentAddress', + 'PaymentCurrencyAmount', + 'PaymentDetailsBase', + 'PaymentDetailsInit', + 'PaymentDetailsModifier', + 'PaymentDetailsUpdate', + 'PaymentItem', + 'PaymentMethodChangeEvent', + 'PaymentMethodChangeEventInit', + 'PaymentMethodData', + 'PaymentRequest', + 'PaymentRequestEventMap', + 'PaymentRequestUpdateEvent', + 'PaymentRequestUpdateEventInit', + 'PaymentResponse', + 'PaymentValidationErrors', + 'Pbkdf2Params', + 'Performance', + 'PerformanceEntry', + 'PerformanceEventMap', + 'PerformanceEventTiming', + 'PerformanceMark', + 'PerformanceMarkOptions', + 'PerformanceMeasure', + 'PerformanceMeasureOptions', + 'PerformanceNavigation', + 'PerformanceNavigationTiming', + 'PerformanceObserver', + 'PerformanceObserverCallback', + 'PerformanceObserverEntryList', + 'PerformanceObserverInit', + 'PerformancePaintTiming', + 'PerformanceResourceTiming', + 'PerformanceServerTiming', + 'PerformanceTiming', + 'PeriodicWave', + 'PeriodicWaveConstraints', + 'PeriodicWaveOptions', + 'PermissionDescriptor', + 'PermissionStatus', + 'PermissionStatusEventMap', + 'Permissions', + 'PictureInPictureWindow', + 'PictureInPictureWindowEventMap', + 'Plugin', + 'PluginArray', + 'PluralRules', + 'PluralRulesOptions', + 'PointerEvent', + 'PointerEventInit', + 'PopStateEvent', + 'PopStateEventInit', + 'PositionCallback', + 'PositionErrorCallback', + 'PositionOptions', + 'PostMessageOptions', + 'ProcessingInstruction', + 'ProgressEvent', + 'ProgressEventInit', 'Promise', - 'prompt', + 'PromiseConstructor', + 'PromiseConstructorLike', + 'PromiseFulfilledResult', + 'PromiseLike', + 'PromiseRejectedResult', + 'PromiseRejectionEvent', + 'PromiseRejectionEventInit', + 'PropertyDecorator', + 'PropertyDescriptor', + 'PropertyDescriptorMap', + 'PropertyIndexedKeyframes', + 'PropertyKey', + 'Proxy', + 'ProxyConstructor', + 'ProxyHandler', + 'PublicKeyCredential', + 'PublicKeyCredentialCreationOptions', + 'PublicKeyCredentialDescriptor', + 'PublicKeyCredentialEntity', + 'PublicKeyCredentialParameters', + 'PublicKeyCredentialRequestOptions', + 'PublicKeyCredentialRpEntity', + 'PublicKeyCredentialUserEntity', + 'PushManager', + 'PushSubscription', + 'PushSubscriptionJSON', + 'PushSubscriptionOptions', + 'PushSubscriptionOptionsInit', + 'QueuingStrategy', + 'QueuingStrategyInit', + 'QueuingStrategySize', + 'RTCAnswerOptions', + 'RTCCertificate', + 'RTCCertificateExpiration', + 'RTCConfiguration', + 'RTCDTMFSender', + 'RTCDTMFSenderEventMap', + 'RTCDTMFToneChangeEvent', + 'RTCDTMFToneChangeEventInit', + 'RTCDataChannel', + 'RTCDataChannelEvent', + 'RTCDataChannelEventInit', + 'RTCDataChannelEventMap', + 'RTCDataChannelInit', + 'RTCDtlsFingerprint', + 'RTCDtlsTransport', + 'RTCDtlsTransportEventMap', + 'RTCIceCandidate', + 'RTCIceCandidateInit', + 'RTCIceCandidatePairStats', + 'RTCIceServer', + 'RTCIceTransport', + 'RTCInboundRtpStreamStats', + 'RTCLocalSessionDescriptionInit', + 'RTCOfferAnswerOptions', + 'RTCOfferOptions', + 'RTCOutboundRtpStreamStats', + 'RTCPeerConnection', + 'RTCPeerConnectionErrorCallback', + 'RTCPeerConnectionEventMap', + 'RTCPeerConnectionIceErrorEvent', + 'RTCPeerConnectionIceErrorEventInit', + 'RTCPeerConnectionIceEvent', + 'RTCPeerConnectionIceEventInit', + 'RTCReceivedRtpStreamStats', + 'RTCRtcpParameters', + 'RTCRtpCapabilities', + 'RTCRtpCodecCapability', + 'RTCRtpCodecParameters', + 'RTCRtpCodingParameters', + 'RTCRtpContributingSource', + 'RTCRtpEncodingParameters', + 'RTCRtpHeaderExtensionCapability', + 'RTCRtpHeaderExtensionParameters', + 'RTCRtpParameters', + 'RTCRtpReceiveParameters', + 'RTCRtpReceiver', + 'RTCRtpSendParameters', + 'RTCRtpSender', + 'RTCRtpStreamStats', + 'RTCRtpSynchronizationSource', + 'RTCRtpTransceiver', + 'RTCRtpTransceiverInit', + 'RTCSentRtpStreamStats', + 'RTCSessionDescription', + 'RTCSessionDescriptionCallback', + 'RTCSessionDescriptionInit', + 'RTCStats', + 'RTCStatsReport', + 'RTCTrackEvent', + 'RTCTrackEventInit', + 'RTCTransportStats', + 'RadioNodeList', + 'Range', 'RangeError', + 'RangeErrorConstructor', + 'ReadableStream', + 'ReadableStreamDefaultController', + 'ReadableStreamDefaultReadDoneResult', + 'ReadableStreamDefaultReadValueResult', + 'ReadableStreamDefaultReader', + 'ReadableStreamGenericReader', + 'ReadableWritablePair', + 'ReadonlyArray', + 'ReadonlyMap', + 'ReadonlySet', 'ReferenceError', + 'ReferenceErrorConstructor', + 'Reflect', 'RegExp', - 'sessionStorage', + 'RegExpConstructor', + 'RegExpExecArray', + 'RegExpMatchArray', + 'RegistrationOptions', + 'RelativeTimeFormat', + 'RelativeTimeFormatOptions', + 'RelativeTimeFormatPart', + 'RemotePlayback', + 'RemotePlaybackAvailabilityCallback', + 'RemotePlaybackEventMap', + 'Request', + 'RequestInit', + 'ResizeObserver', + 'ResizeObserverCallback', + 'ResizeObserverEntry', + 'ResizeObserverOptions', + 'ResizeObserverSize', + 'ResolvedCollatorOptions', + 'ResolvedDateTimeFormatOptions', + 'ResolvedNumberFormatOptions', + 'ResolvedPluralRulesOptions', + 'ResolvedRelativeTimeFormatOptions', + 'Response', + 'ResponseInit', + 'RsaHashedImportParams', + 'RsaHashedKeyAlgorithm', + 'RsaHashedKeyGenParams', + 'RsaKeyAlgorithm', + 'RsaKeyGenParams', + 'RsaOaepParams', + 'RsaOtherPrimesInfo', + 'RsaPssParams', + 'RuntimeError', + 'SVGAElement', + 'SVGAngle', + 'SVGAnimateElement', + 'SVGAnimateMotionElement', + 'SVGAnimateTransformElement', + 'SVGAnimatedAngle', + 'SVGAnimatedBoolean', + 'SVGAnimatedEnumeration', + 'SVGAnimatedInteger', + 'SVGAnimatedLength', + 'SVGAnimatedLengthList', + 'SVGAnimatedNumber', + 'SVGAnimatedNumberList', + 'SVGAnimatedPoints', + 'SVGAnimatedPreserveAspectRatio', + 'SVGAnimatedRect', + 'SVGAnimatedString', + 'SVGAnimatedTransformList', + 'SVGAnimationElement', + 'SVGBoundingBoxOptions', + 'SVGCircleElement', + 'SVGClipPathElement', + 'SVGComponentTransferFunctionElement', + 'SVGCursorElement', + 'SVGDefsElement', + 'SVGDescElement', + 'SVGElement', + 'SVGElementEventMap', + 'SVGElementTagNameMap', + 'SVGEllipseElement', + 'SVGFEBlendElement', + 'SVGFEColorMatrixElement', + 'SVGFEComponentTransferElement', + 'SVGFECompositeElement', + 'SVGFEConvolveMatrixElement', + 'SVGFEDiffuseLightingElement', + 'SVGFEDisplacementMapElement', + 'SVGFEDistantLightElement', + 'SVGFEDropShadowElement', + 'SVGFEFloodElement', + 'SVGFEFuncAElement', + 'SVGFEFuncBElement', + 'SVGFEFuncGElement', + 'SVGFEFuncRElement', + 'SVGFEGaussianBlurElement', + 'SVGFEImageElement', + 'SVGFEMergeElement', + 'SVGFEMergeNodeElement', + 'SVGFEMorphologyElement', + 'SVGFEOffsetElement', + 'SVGFEPointLightElement', + 'SVGFESpecularLightingElement', + 'SVGFESpotLightElement', + 'SVGFETileElement', + 'SVGFETurbulenceElement', + 'SVGFilterElement', + 'SVGFilterPrimitiveStandardAttributes', + 'SVGFitToViewBox', + 'SVGForeignObjectElement', + 'SVGGElement', + 'SVGGeometryElement', + 'SVGGradientElement', + 'SVGGraphicsElement', + 'SVGImageElement', + 'SVGLength', + 'SVGLengthList', + 'SVGLineElement', + 'SVGLinearGradientElement', + 'SVGMPathElement', + 'SVGMarkerElement', + 'SVGMaskElement', + 'SVGMatrix', + 'SVGMetadataElement', + 'SVGNumber', + 'SVGNumberList', + 'SVGPathElement', + 'SVGPatternElement', + 'SVGPoint', + 'SVGPointList', + 'SVGPolygonElement', + 'SVGPolylineElement', + 'SVGPreserveAspectRatio', + 'SVGRadialGradientElement', + 'SVGRect', + 'SVGRectElement', + 'SVGSVGElement', + 'SVGSVGElementEventMap', + 'SVGScriptElement', + 'SVGSetElement', + 'SVGStopElement', + 'SVGStringList', + 'SVGStyleElement', + 'SVGSwitchElement', + 'SVGSymbolElement', + 'SVGTSpanElement', + 'SVGTests', + 'SVGTextContentElement', + 'SVGTextElement', + 'SVGTextPathElement', + 'SVGTextPositioningElement', + 'SVGTitleElement', + 'SVGTransform', + 'SVGTransformList', + 'SVGURIReference', + 'SVGUnitTypes', + 'SVGUseElement', + 'SVGViewElement', + 'SafeArray', + 'Screen', + 'ScreenOrientation', + 'ScreenOrientationEventMap', + 'ScriptProcessorNode', + 'ScriptProcessorNodeEventMap', + 'ScrollIntoViewOptions', + 'ScrollOptions', + 'ScrollToOptions', + 'SecurityPolicyViolationEvent', + 'SecurityPolicyViolationEventInit', + 'Selection', + 'ServiceWorker', + 'ServiceWorkerContainer', + 'ServiceWorkerContainerEventMap', + 'ServiceWorkerEventMap', + 'ServiceWorkerRegistration', + 'ServiceWorkerRegistrationEventMap', 'Set', - 'setInterval', - 'setTimeout', + 'SetConstructor', + 'ShadowRoot', + 'ShadowRootInit', + 'ShareData', + 'SharedArrayBuffer', + 'SharedArrayBufferConstructor', + 'SharedWorker', + 'Slottable', + 'SourceBuffer', + 'SourceBufferEventMap', + 'SourceBufferList', + 'SourceBufferListEventMap', + 'SpeechRecognitionAlternative', + 'SpeechRecognitionErrorEvent', + 'SpeechRecognitionErrorEventInit', + 'SpeechRecognitionResult', + 'SpeechRecognitionResultList', + 'SpeechSynthesis', + 'SpeechSynthesisErrorEvent', + 'SpeechSynthesisErrorEventInit', + 'SpeechSynthesisEvent', + 'SpeechSynthesisEventInit', + 'SpeechSynthesisEventMap', + 'SpeechSynthesisUtterance', + 'SpeechSynthesisUtteranceEventMap', + 'SpeechSynthesisVoice', + 'StaticRange', + 'StaticRangeInit', + 'StereoPannerNode', + 'StereoPannerOptions', + 'Storage', + 'StorageEstimate', + 'StorageEvent', + 'StorageEventInit', + 'StorageManager', + 'StreamPipeOptions', 'String', - 'SVGElement', + 'StringConstructor', + 'StyleMedia', + 'StyleSheet', + 'StyleSheetList', + 'SubmitEvent', + 'SubmitEventInit', + 'SubtleCrypto', 'Symbol', + 'SymbolConstructor', 'SyntaxError', + 'SyntaxErrorConstructor', + 'Table', + 'TableDescriptor', + 'TemplateStringsArray', + 'Text', + 'TextDecodeOptions', + 'TextDecoder', + 'TextDecoderCommon', + 'TextDecoderOptions', + 'TextDecoderStream', + 'TextEncoder', + 'TextEncoderCommon', + 'TextEncoderEncodeIntoResult', + 'TextEncoderStream', + 'TextMetrics', + 'TextStreamBase', + 'TextStreamReader', + 'TextStreamWriter', + 'TextTrack', + 'TextTrackCue', + 'TextTrackCueEventMap', + 'TextTrackCueList', + 'TextTrackEventMap', + 'TextTrackList', + 'TextTrackListEventMap', + 'ThisType', + 'TimeRanges', + 'Touch', + 'TouchEvent', + 'TouchEventInit', + 'TouchInit', + 'TouchList', + 'TrackEvent', + 'TrackEventInit', + 'TransformStream', + 'TransformStreamDefaultController', + 'Transformer', + 'TransformerFlushCallback', + 'TransformerStartCallback', + 'TransformerTransformCallback', + 'TransitionEvent', + 'TransitionEventInit', + 'TreeWalker', 'TypeError', - 'undefined', + 'TypeErrorConstructor', + 'TypedPropertyDescriptor', + 'UIEvent', + 'UIEventInit', + 'ULongRange', 'URIError', + 'URIErrorConstructor', 'URL', 'URLSearchParams', + 'Uint16Array', + 'Uint16ArrayConstructor', + 'Uint32Array', + 'Uint32ArrayConstructor', + 'Uint8Array', + 'Uint8ArrayConstructor', + 'Uint8ClampedArray', + 'Uint8ClampedArrayConstructor', + 'UnderlyingSink', + 'UnderlyingSinkAbortCallback', + 'UnderlyingSinkCloseCallback', + 'UnderlyingSinkStartCallback', + 'UnderlyingSinkWriteCallback', + 'UnderlyingSource', + 'UnderlyingSourceCancelCallback', + 'UnderlyingSourcePullCallback', + 'UnderlyingSourceStartCallback', + 'VBArray', + 'VBArrayConstructor', + 'VTTCue', + 'VTTRegion', + 'ValidityState', + 'VarDate', + 'VideoConfiguration', + 'VideoPlaybackQuality', + 'VisualViewport', + 'VisualViewportEventMap', + 'VoidFunction', + 'WEBGL_color_buffer_float', + 'WEBGL_compressed_texture_astc', + 'WEBGL_compressed_texture_etc', + 'WEBGL_compressed_texture_etc1', + 'WEBGL_compressed_texture_pvrtc', + 'WEBGL_compressed_texture_s3tc', + 'WEBGL_compressed_texture_s3tc_srgb', + 'WEBGL_debug_renderer_info', + 'WEBGL_debug_shaders', + 'WEBGL_depth_texture', + 'WEBGL_draw_buffers', + 'WEBGL_lose_context', + 'WSH', + 'WScript', + 'WaveShaperNode', + 'WaveShaperOptions', + 'WeakMap', + 'WeakMapConstructor', + 'WeakRef', + 'WeakRefConstructor', + 'WeakSet', + 'WeakSetConstructor', + 'WebAssembly', + 'WebAssemblyInstantiatedSource', + 'WebGL2RenderingContext', + 'WebGL2RenderingContextBase', + 'WebGL2RenderingContextOverloads', + 'WebGLActiveInfo', + 'WebGLBuffer', + 'WebGLContextAttributes', + 'WebGLContextEvent', + 'WebGLContextEventInit', + 'WebGLFramebuffer', + 'WebGLProgram', + 'WebGLQuery', + 'WebGLRenderbuffer', + 'WebGLRenderingContext', + 'WebGLRenderingContextBase', + 'WebGLRenderingContextOverloads', + 'WebGLSampler', + 'WebGLShader', + 'WebGLShaderPrecisionFormat', + 'WebGLSync', + 'WebGLTexture', + 'WebGLTransformFeedback', + 'WebGLUniformLocation', + 'WebGLVertexArrayObject', + 'WebGLVertexArrayObjectOES', + 'WebKitCSSMatrix', + 'WebSocket', + 'WebSocketEventMap', + 'WheelEvent', + 'WheelEventInit', + 'Window', + 'WindowEventHandlers', + 'WindowEventHandlersEventMap', + 'WindowEventMap', + 'WindowLocalStorage', + 'WindowOrWorkerGlobalScope', + 'WindowPostMessageOptions', + 'WindowSessionStorage', + 'Worker', + 'WorkerEventMap', + 'WorkerOptions', + 'Worklet', + 'WorkletOptions', + 'WritableStream', + 'WritableStreamDefaultController', + 'WritableStreamDefaultWriter', + 'XMLDocument', + 'XMLHttpRequest', + 'XMLHttpRequestEventMap', + 'XMLHttpRequestEventTarget', + 'XMLHttpRequestEventTargetEventMap', + 'XMLHttpRequestUpload', + 'XMLSerializer', + 'XPathEvaluator', + 'XPathEvaluatorBase', + 'XPathExpression', + 'XPathResult', + 'XSLTProcessor', + 'addEventListener', + 'alert', + 'atob', + 'blur', + 'btoa', + 'caches', + 'cancelAnimationFrame', + 'cancelIdleCallback', + 'captureEvents', + 'clearInterval', + 'clearTimeout', + 'close', + 'closed', + 'confirm', + 'console', + 'createImageBitmap', + 'crossOriginIsolated', + 'crypto', + 'customElements', + 'decodeURI', + 'decodeURIComponent', + 'devicePixelRatio', + 'dispatchEvent', + 'document', + 'encodeURI', + 'encodeURIComponent', + 'escape', + 'eval', + 'event', + 'external', + 'fetch', + 'focus', + 'frameElement', + 'frames', + 'getComputedStyle', + 'getSelection', + 'globalThis', + 'history', + 'importScripts', + 'indexedDB', + 'innerHeight', + 'innerWidth', + 'isFinite', + 'isNaN', + 'isSecureContext', + 'length', + 'localStorage', + 'location', + 'locationbar', + 'matchMedia', + 'menubar', + 'moveBy', + 'moveTo', + 'name', + 'navigator', + 'onabort', + 'onafterprint', + 'onanimationcancel', + 'onanimationend', + 'onanimationiteration', + 'onanimationstart', + 'onauxclick', + 'onbeforeprint', + 'onbeforeunload', + 'onblur', + 'oncanplay', + 'oncanplaythrough', + 'onchange', + 'onclick', + 'onclose', + 'oncontextmenu', + 'oncuechange', + 'ondblclick', + 'ondevicemotion', + 'ondeviceorientation', + 'ondrag', + 'ondragend', + 'ondragenter', + 'ondragleave', + 'ondragover', + 'ondragstart', + 'ondrop', + 'ondurationchange', + 'onemptied', + 'onended', + 'onerror', + 'onfocus', + 'onformdata', + 'ongamepadconnected', + 'ongamepaddisconnected', + 'ongotpointercapture', + 'onhashchange', + 'oninput', + 'oninvalid', + 'onkeydown', + 'onkeypress', + 'onkeyup', + 'onlanguagechange', + 'onload', + 'onloadeddata', + 'onloadedmetadata', + 'onloadstart', + 'onlostpointercapture', + 'onmessage', + 'onmessageerror', + 'onmousedown', + 'onmouseenter', + 'onmouseleave', + 'onmousemove', + 'onmouseout', + 'onmouseover', + 'onmouseup', + 'onoffline', + 'ononline', + 'onorientationchange', + 'onpagehide', + 'onpageshow', + 'onpause', + 'onplay', + 'onplaying', + 'onpointercancel', + 'onpointerdown', + 'onpointerenter', + 'onpointerleave', + 'onpointermove', + 'onpointerout', + 'onpointerover', + 'onpointerup', + 'onpopstate', + 'onprogress', + 'onratechange', + 'onrejectionhandled', + 'onreset', + 'onresize', + 'onscroll', + 'onseeked', + 'onseeking', + 'onselect', + 'onselectionchange', + 'onselectstart', + 'onstalled', + 'onstorage', + 'onsubmit', + 'onsuspend', + 'ontimeupdate', + 'ontoggle', + 'ontouchcancel', + 'ontouchend', + 'ontouchmove', + 'ontouchstart', + 'ontransitioncancel', + 'ontransitionend', + 'ontransitionrun', + 'ontransitionstart', + 'onunhandledrejection', + 'onunload', + 'onvolumechange', + 'onwaiting', + 'onwebkitanimationend', + 'onwebkitanimationiteration', + 'onwebkitanimationstart', + 'onwebkittransitionend', + 'onwheel', + 'open', + 'opener', + 'orientation', + 'origin', + 'outerHeight', + 'outerWidth', + 'pageXOffset', + 'pageYOffset', + 'parent', + 'parseFloat', + 'parseInt', + 'performance', + 'personalbar', + 'postMessage', + 'print', + 'process', + 'prompt', + 'queueMicrotask', + 'releaseEvents', + 'removeEventListener', + 'requestAnimationFrame', + 'requestIdleCallback', + 'resizeBy', + 'resizeTo', + 'screen', + 'screenLeft', + 'screenTop', + 'screenX', + 'screenY', + 'scroll', + 'scrollBy', + 'scrollTo', + 'scrollX', + 'scrollY', + 'scrollbars', + 'self', + 'sessionStorage', + 'setInterval', + 'setTimeout', + 'speechSynthesis', + 'status', + 'statusbar', + 'stop', + 'toString', + 'toolbar', + 'top', + 'undefined', + 'unescape', + 'visualViewport', + 'webkitURL', 'window' ]); From 07a2aa053135710225a177ccc34139975990d28f Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Sun, 14 Aug 2022 18:30:37 +0900 Subject: [PATCH 2/8] remove typescript interfaces --- scripts/globals-extractor.mjs | 5 +- src/compiler/utils/names.ts | 601 +--------------------------------- 2 files changed, 3 insertions(+), 603 deletions(-) diff --git a/scripts/globals-extractor.mjs b/scripts/globals-extractor.mjs index b2e0f523314..80f5277f377 100644 --- a/scripts/globals-extractor.mjs +++ b/scripts/globals-extractor.mjs @@ -15,8 +15,7 @@ const extract_interfaces_and_references = (data) => { data.split('\n').forEach(line => { const trimmed = line.trim(); const split = trimmed.replace(/[\s+]/, ' ').split(' '); - if (split[0] === 'interface') interfaces.push(extract_name(split[1])); - else if (split[0] === 'declare') interfaces.push(extract_name(split[2])); + if (split[0] === 'declare') interfaces.push(extract_name(split[2])); else if (trimmed.startsWith('/// { const interfaces = await get_interfaces('es2021.full'); // MEMO: add additional objects/interfaces which existed in `src/compiler/utils/names.ts` // before this script was introduced but could not be retrieved by this process. - interfaces.push(...['globalThis', 'InternalError', 'process', 'undefined']); + interfaces.push(...['global', 'globalThis', 'InternalError', 'process', 'undefined']); new Set(interfaces.sort()).forEach((i) => console.log(`'${i}',`)); })(); diff --git a/src/compiler/utils/names.ts b/src/compiler/utils/names.ts index 2073b7e8e84..52e09edf326 100644 --- a/src/compiler/utils/names.ts +++ b/src/compiler/utils/names.ts @@ -2,105 +2,48 @@ import { isIdentifierStart, isIdentifierChar } from 'acorn'; import full_char_code_at from './full_char_code_at'; export const globals = new Set([ - 'ANGLE_instanced_arrays', - 'ARIAMixin', 'AbortController', 'AbortSignal', - 'AbortSignalEventMap', 'AbstractRange', - 'AbstractWorker', - 'AbstractWorkerEventMap', 'ActiveXObject', - 'AddEventListenerOptions', - 'AesCbcParams', - 'AesCtrParams', - 'AesDerivedKeyParams', - 'AesGcmParams', - 'AesKeyAlgorithm', - 'AesKeyGenParams', 'AggregateError', - 'AggregateErrorConstructor', - 'Algorithm', 'AnalyserNode', - 'AnalyserOptions', - 'Animatable', 'Animation', 'AnimationEffect', 'AnimationEvent', - 'AnimationEventInit', - 'AnimationEventMap', - 'AnimationFrameProvider', 'AnimationPlaybackEvent', - 'AnimationPlaybackEventInit', 'AnimationTimeline', 'Array', 'ArrayBuffer', - 'ArrayBufferConstructor', - 'ArrayBufferTypes', - 'ArrayBufferView', - 'ArrayConstructor', - 'ArrayLike', - 'AssignedNodesOptions', - 'AsyncGenerator', - 'AsyncGeneratorFunction', - 'AsyncGeneratorFunctionConstructor', - 'AsyncIterable', - 'AsyncIterableIterator', - 'AsyncIterator', 'Atomics', 'Attr', 'Audio', 'AudioBuffer', - 'AudioBufferOptions', 'AudioBufferSourceNode', - 'AudioBufferSourceOptions', - 'AudioConfiguration', 'AudioContext', - 'AudioContextOptions', 'AudioDestinationNode', 'AudioListener', 'AudioNode', - 'AudioNodeOptions', 'AudioParam', 'AudioParamMap', 'AudioProcessingEvent', - 'AudioProcessingEventInit', 'AudioScheduledSourceNode', - 'AudioScheduledSourceNodeEventMap', - 'AudioTimestamp', 'AudioWorklet', 'AudioWorkletNode', - 'AudioWorkletNodeEventMap', - 'AudioWorkletNodeOptions', - 'AuthenticationExtensionsClientInputs', - 'AuthenticationExtensionsClientOutputs', 'AuthenticatorAssertionResponse', 'AuthenticatorAttestationResponse', 'AuthenticatorResponse', - 'AuthenticatorSelectionCriteria', 'BarProp', 'BaseAudioContext', - 'BaseAudioContextEventMap', 'BeforeUnloadEvent', 'BigInt', 'BigInt64Array', - 'BigInt64ArrayConstructor', - 'BigIntConstructor', - 'BigIntToLocaleStringOptions', 'BigUint64Array', - 'BigUint64ArrayConstructor', 'BiquadFilterNode', - 'BiquadFilterOptions', 'Blob', - 'BlobCallback', 'BlobEvent', - 'BlobEventInit', - 'BlobPropertyBag', - 'Body', 'Boolean', - 'BooleanConstructor', 'BroadcastChannel', - 'BroadcastChannelEventMap', 'ByteLengthQueuingStrategy', 'CDATASection', 'CSS', @@ -123,90 +66,39 @@ export const globals = new Set([ 'CSSSupportsRule', 'CSSTransition', 'Cache', - 'CacheQueryOptions', 'CacheStorage', - 'CallableFunction', - 'CanvasCompositing', - 'CanvasDrawImage', - 'CanvasDrawPath', - 'CanvasFillStrokeStyles', - 'CanvasFilters', 'CanvasGradient', - 'CanvasImageData', - 'CanvasImageSmoothing', - 'CanvasPath', - 'CanvasPathDrawingStyles', 'CanvasPattern', - 'CanvasRect', 'CanvasRenderingContext2D', - 'CanvasRenderingContext2DSettings', - 'CanvasShadowStyles', - 'CanvasState', - 'CanvasText', - 'CanvasTextDrawingStyles', - 'CanvasTransform', - 'CanvasUserInterface', 'ChannelMergerNode', - 'ChannelMergerOptions', 'ChannelSplitterNode', - 'ChannelSplitterOptions', 'CharacterData', - 'ChildNode', 'ClassDecorator', - 'ClientQueryOptions', 'ClientRect', 'Clipboard', 'ClipboardEvent', - 'ClipboardEventInit', 'ClipboardItem', - 'ClipboardItemOptions', 'CloseEvent', - 'CloseEventInit', - 'Collator', - 'CollatorOptions', 'Comment', - 'CompileError', 'CompositionEvent', - 'CompositionEventInit', - 'ComputedEffectTiming', - 'ComputedKeyframe', - 'ConcatArray', - 'Console', 'ConstantSourceNode', - 'ConstantSourceOptions', - 'ConstrainBooleanParameters', - 'ConstrainDOMStringParameters', - 'ConstrainDoubleRange', - 'ConstrainULongRange', 'ConvolverNode', - 'ConvolverOptions', 'CountQueuingStrategy', 'Credential', - 'CredentialCreationOptions', - 'CredentialPropertiesOutput', - 'CredentialRequestOptions', 'CredentialsContainer', 'Crypto', 'CryptoKey', - 'CryptoKeyPair', - 'CustomElementConstructor', 'CustomElementRegistry', 'CustomEvent', - 'CustomEventInit', 'DOMException', 'DOMImplementation', 'DOMMatrix', - 'DOMMatrix2DInit', - 'DOMMatrixInit', 'DOMMatrixReadOnly', 'DOMParser', 'DOMPoint', - 'DOMPointInit', 'DOMPointReadOnly', 'DOMQuad', - 'DOMQuadInit', 'DOMRect', - 'DOMRectInit', 'DOMRectList', 'DOMRectReadOnly', 'DOMStringList', @@ -216,140 +108,52 @@ export const globals = new Set([ 'DataTransferItem', 'DataTransferItemList', 'DataView', - 'DataViewConstructor', 'Date', - 'DateConstructor', - 'DateTimeFormat', - 'DateTimeFormatOptions', - 'DateTimeFormatPart', - 'DecodeErrorCallback', - 'DecodeSuccessCallback', 'DelayNode', - 'DelayOptions', 'DeviceMotionEvent', - 'DeviceMotionEventAcceleration', - 'DeviceMotionEventAccelerationInit', - 'DeviceMotionEventInit', - 'DeviceMotionEventRotationRate', - 'DeviceMotionEventRotationRateInit', 'DeviceOrientationEvent', - 'DeviceOrientationEventInit', - 'DisplayMediaStreamConstraints', 'Document', - 'DocumentAndElementEventHandlers', - 'DocumentAndElementEventHandlersEventMap', - 'DocumentEventMap', 'DocumentFragment', - 'DocumentOrShadowRoot', 'DocumentTimeline', - 'DocumentTimelineOptions', 'DocumentType', - 'DoubleRange', 'DragEvent', - 'DragEventInit', 'DynamicsCompressorNode', - 'DynamicsCompressorOptions', - 'EXT_blend_minmax', - 'EXT_color_buffer_float', - 'EXT_color_buffer_half_float', - 'EXT_float_blend', - 'EXT_frag_depth', - 'EXT_sRGB', - 'EXT_shader_texture_lod', - 'EXT_texture_compression_rgtc', - 'EXT_texture_filter_anisotropic', - 'EcKeyAlgorithm', - 'EcKeyGenParams', - 'EcKeyImportParams', - 'EcdhKeyDeriveParams', - 'EcdsaParams', - 'EffectTiming', 'Element', - 'ElementCSSInlineStyle', - 'ElementContentEditable', - 'ElementCreationOptions', - 'ElementDefinitionOptions', - 'ElementEventMap', 'Enumerator', - 'EnumeratorConstructor', 'Error', - 'ErrorCallback', - 'ErrorConstructor', 'ErrorEvent', - 'ErrorEventInit', 'EvalError', - 'EvalErrorConstructor', 'Event', - 'EventInit', - 'EventListener', - 'EventListenerObject', - 'EventListenerOptions', - 'EventModifierInit', 'EventSource', - 'EventSourceEventMap', - 'EventSourceInit', 'EventTarget', 'External', 'File', - 'FileCallback', 'FileList', - 'FilePropertyBag', 'FileReader', - 'FileReaderEventMap', 'FileSystem', 'FileSystemDirectoryEntry', 'FileSystemDirectoryReader', - 'FileSystemEntriesCallback', 'FileSystemEntry', - 'FileSystemEntryCallback', 'FileSystemFileEntry', - 'FileSystemFlags', 'FinalizationRegistry', - 'FinalizationRegistryConstructor', 'Float32Array', - 'Float32ArrayConstructor', 'Float64Array', - 'Float64ArrayConstructor', 'FocusEvent', - 'FocusEventInit', - 'FocusOptions', 'FontFace', - 'FontFaceDescriptors', 'FontFaceSet', - 'FontFaceSetEventMap', 'FontFaceSetLoadEvent', - 'FontFaceSetLoadEventInit', - 'FontFaceSource', 'FormData', 'FormDataEvent', - 'FormDataEventInit', - 'FrameRequestCallback', - 'FullscreenOptions', 'Function', - 'FunctionConstructor', - 'FunctionStringCallback', 'GainNode', - 'GainOptions', 'Gamepad', 'GamepadButton', 'GamepadEvent', - 'GamepadEventInit', 'GamepadHapticActuator', - 'Generator', - 'GeneratorFunction', - 'GeneratorFunctionConstructor', - 'GenericTransformStream', 'Geolocation', 'GeolocationCoordinates', 'GeolocationPosition', 'GeolocationPositionError', - 'GetAnimationsOptions', - 'GetNotificationOptions', - 'GetRootNodeOptions', - 'Global', - 'GlobalDescriptor', - 'GlobalEventHandlers', - 'GlobalEventHandlersEventMap', 'HTMLAllCollection', 'HTMLAnchorElement', 'HTMLAreaElement', @@ -357,24 +161,17 @@ export const globals = new Set([ 'HTMLBRElement', 'HTMLBaseElement', 'HTMLBodyElement', - 'HTMLBodyElementEventMap', 'HTMLButtonElement', 'HTMLCanvasElement', 'HTMLCollection', - 'HTMLCollectionBase', - 'HTMLCollectionOf', 'HTMLDListElement', 'HTMLDataElement', 'HTMLDataListElement', 'HTMLDetailsElement', - 'HTMLDialogElement', 'HTMLDirectoryElement', 'HTMLDivElement', 'HTMLDocument', 'HTMLElement', - 'HTMLElementDeprecatedTagNameMap', - 'HTMLElementEventMap', - 'HTMLElementTagNameMap', 'HTMLEmbedElement', 'HTMLFieldSetElement', 'HTMLFontElement', @@ -382,12 +179,10 @@ export const globals = new Set([ 'HTMLFormElement', 'HTMLFrameElement', 'HTMLFrameSetElement', - 'HTMLFrameSetElementEventMap', 'HTMLHRElement', 'HTMLHeadElement', 'HTMLHeadingElement', 'HTMLHtmlElement', - 'HTMLHyperlinkElementUtils', 'HTMLIFrameElement', 'HTMLImageElement', 'HTMLInputElement', @@ -398,7 +193,6 @@ export const globals = new Set([ 'HTMLMapElement', 'HTMLMarqueeElement', 'HTMLMediaElement', - 'HTMLMediaElementEventMap', 'HTMLMenuElement', 'HTMLMetaElement', 'HTMLMeterElement', @@ -408,7 +202,6 @@ export const globals = new Set([ 'HTMLOptGroupElement', 'HTMLOptionElement', 'HTMLOptionsCollection', - 'HTMLOrSVGElement', 'HTMLOutputElement', 'HTMLParagraphElement', 'HTMLParamElement', @@ -425,9 +218,7 @@ export const globals = new Set([ 'HTMLTableCaptionElement', 'HTMLTableCellElement', 'HTMLTableColElement', - 'HTMLTableDataCellElement', 'HTMLTableElement', - 'HTMLTableHeaderCellElement', 'HTMLTableRowElement', 'HTMLTableSectionElement', 'HTMLTemplateElement', @@ -438,434 +229,166 @@ export const globals = new Set([ 'HTMLUListElement', 'HTMLUnknownElement', 'HTMLVideoElement', - 'HTMLVideoElementEventMap', 'HashChangeEvent', - 'HashChangeEventInit', 'Headers', 'History', - 'HkdfParams', - 'HmacImportParams', - 'HmacKeyAlgorithm', - 'HmacKeyGenParams', - 'IArguments', 'IDBCursor', 'IDBCursorWithValue', 'IDBDatabase', - 'IDBDatabaseEventMap', - 'IDBDatabaseInfo', 'IDBFactory', 'IDBIndex', - 'IDBIndexParameters', 'IDBKeyRange', 'IDBObjectStore', - 'IDBObjectStoreParameters', 'IDBOpenDBRequest', - 'IDBOpenDBRequestEventMap', 'IDBRequest', - 'IDBRequestEventMap', 'IDBTransaction', - 'IDBTransactionEventMap', 'IDBVersionChangeEvent', - 'IDBVersionChangeEventInit', 'IIRFilterNode', - 'IIRFilterOptions', - 'ITextWriter', 'IdleDeadline', - 'IdleRequestCallback', - 'IdleRequestOptions', 'Image', 'ImageBitmap', - 'ImageBitmapOptions', 'ImageBitmapRenderingContext', - 'ImageBitmapRenderingContextSettings', 'ImageData', - 'ImageDataSettings', - 'ImportMeta', 'Infinity', - 'InnerHTML', 'InputEvent', - 'InputEventInit', - 'Instance', 'Int16Array', - 'Int16ArrayConstructor', 'Int32Array', - 'Int32ArrayConstructor', 'Int8Array', - 'Int8ArrayConstructor', 'InternalError', 'IntersectionObserver', - 'IntersectionObserverCallback', 'IntersectionObserverEntry', - 'IntersectionObserverEntryInit', - 'IntersectionObserverInit', 'Intl', - 'Iterable', - 'IterableIterator', - 'Iterator', - 'IteratorReturnResult', - 'IteratorYieldResult', 'JSON', - 'JsonWebKey', - 'KHR_parallel_shader_compile', - 'KeyAlgorithm', 'KeyboardEvent', - 'KeyboardEventInit', - 'Keyframe', - 'KeyframeAnimationOptions', 'KeyframeEffect', - 'KeyframeEffectOptions', - 'LinkError', - 'LinkStyle', 'Location', 'Map', - 'MapConstructor', 'Math', 'MathMLElement', - 'MathMLElementEventMap', 'MediaCapabilities', - 'MediaCapabilitiesDecodingInfo', - 'MediaCapabilitiesEncodingInfo', - 'MediaCapabilitiesInfo', - 'MediaConfiguration', - 'MediaDecodingConfiguration', 'MediaDeviceInfo', 'MediaDevices', - 'MediaDevicesEventMap', 'MediaElementAudioSourceNode', - 'MediaElementAudioSourceOptions', - 'MediaEncodingConfiguration', 'MediaEncryptedEvent', - 'MediaEncryptedEventInit', 'MediaError', - 'MediaImage', 'MediaKeyMessageEvent', - 'MediaKeyMessageEventInit', 'MediaKeySession', - 'MediaKeySessionEventMap', 'MediaKeyStatusMap', 'MediaKeySystemAccess', - 'MediaKeySystemConfiguration', - 'MediaKeySystemMediaCapability', 'MediaKeys', 'MediaList', 'MediaMetadata', - 'MediaMetadataInit', - 'MediaPositionState', 'MediaQueryList', 'MediaQueryListEvent', - 'MediaQueryListEventInit', - 'MediaQueryListEventMap', 'MediaRecorder', 'MediaRecorderErrorEvent', - 'MediaRecorderErrorEventInit', - 'MediaRecorderEventMap', - 'MediaRecorderOptions', 'MediaSession', - 'MediaSessionActionDetails', - 'MediaSessionActionHandler', 'MediaSource', - 'MediaSourceEventMap', 'MediaStream', 'MediaStreamAudioDestinationNode', 'MediaStreamAudioSourceNode', - 'MediaStreamAudioSourceOptions', - 'MediaStreamConstraints', - 'MediaStreamEventMap', 'MediaStreamTrack', 'MediaStreamTrackEvent', - 'MediaStreamTrackEventInit', - 'MediaStreamTrackEventMap', - 'MediaTrackCapabilities', - 'MediaTrackConstraintSet', - 'MediaTrackConstraints', - 'MediaTrackSettings', - 'MediaTrackSupportedConstraints', - 'Memory', - 'MemoryDescriptor', 'MessageChannel', 'MessageEvent', - 'MessageEventInit', 'MessagePort', - 'MessagePortEventMap', 'MethodDecorator', 'MimeType', 'MimeTypeArray', - 'Module', - 'ModuleExportDescriptor', - 'ModuleImportDescriptor', 'MouseEvent', - 'MouseEventInit', - 'MultiCacheQueryOptions', - 'MutationCallback', 'MutationEvent', 'MutationObserver', - 'MutationObserverInit', 'MutationRecord', 'NaN', 'NamedNodeMap', 'Navigator', - 'NavigatorAutomationInformation', - 'NavigatorConcurrentHardware', - 'NavigatorContentUtils', - 'NavigatorCookies', - 'NavigatorID', - 'NavigatorLanguage', - 'NavigatorNetworkInformation', - 'NavigatorOnLine', - 'NavigatorPlugins', - 'NavigatorStorage', 'NetworkInformation', - 'NewableFunction', 'Node', 'NodeFilter', 'NodeIterator', 'NodeList', - 'NodeListOf', - 'NonDocumentTypeChildNode', - 'NonElementParentNode', 'Notification', - 'NotificationAction', - 'NotificationEventMap', - 'NotificationOptions', - 'NotificationPermissionCallback', 'Number', - 'NumberConstructor', - 'NumberFormat', - 'NumberFormatOptions', - 'OES_element_index_uint', - 'OES_fbo_render_mipmap', - 'OES_standard_derivatives', - 'OES_texture_float', - 'OES_texture_float_linear', - 'OES_texture_half_float', - 'OES_texture_half_float_linear', - 'OES_vertex_array_object', - 'OVR_multiview2', 'Object', - 'ObjectConstructor', 'OfflineAudioCompletionEvent', - 'OfflineAudioCompletionEventInit', 'OfflineAudioContext', - 'OfflineAudioContextEventMap', - 'OfflineAudioContextOptions', - 'OffscreenCanvas', - 'OnBeforeUnloadEventHandlerNonNull', - 'OnErrorEventHandlerNonNull', 'Option', - 'OptionalEffectTiming', 'OscillatorNode', - 'OscillatorOptions', 'OverconstrainedError', 'PageTransitionEvent', - 'PageTransitionEventInit', 'PannerNode', - 'PannerOptions', 'ParameterDecorator', - 'ParentNode', 'Path2D', 'PaymentAddress', - 'PaymentCurrencyAmount', - 'PaymentDetailsBase', - 'PaymentDetailsInit', - 'PaymentDetailsModifier', - 'PaymentDetailsUpdate', - 'PaymentItem', 'PaymentMethodChangeEvent', - 'PaymentMethodChangeEventInit', - 'PaymentMethodData', 'PaymentRequest', - 'PaymentRequestEventMap', 'PaymentRequestUpdateEvent', - 'PaymentRequestUpdateEventInit', 'PaymentResponse', - 'PaymentValidationErrors', - 'Pbkdf2Params', 'Performance', 'PerformanceEntry', - 'PerformanceEventMap', 'PerformanceEventTiming', 'PerformanceMark', - 'PerformanceMarkOptions', 'PerformanceMeasure', - 'PerformanceMeasureOptions', 'PerformanceNavigation', 'PerformanceNavigationTiming', 'PerformanceObserver', - 'PerformanceObserverCallback', 'PerformanceObserverEntryList', - 'PerformanceObserverInit', 'PerformancePaintTiming', 'PerformanceResourceTiming', 'PerformanceServerTiming', 'PerformanceTiming', 'PeriodicWave', - 'PeriodicWaveConstraints', - 'PeriodicWaveOptions', - 'PermissionDescriptor', 'PermissionStatus', - 'PermissionStatusEventMap', 'Permissions', 'PictureInPictureWindow', - 'PictureInPictureWindowEventMap', 'Plugin', 'PluginArray', - 'PluralRules', - 'PluralRulesOptions', 'PointerEvent', - 'PointerEventInit', 'PopStateEvent', - 'PopStateEventInit', - 'PositionCallback', - 'PositionErrorCallback', - 'PositionOptions', - 'PostMessageOptions', 'ProcessingInstruction', 'ProgressEvent', - 'ProgressEventInit', 'Promise', - 'PromiseConstructor', 'PromiseConstructorLike', - 'PromiseFulfilledResult', - 'PromiseLike', - 'PromiseRejectedResult', 'PromiseRejectionEvent', - 'PromiseRejectionEventInit', 'PropertyDecorator', - 'PropertyDescriptor', - 'PropertyDescriptorMap', - 'PropertyIndexedKeyframes', 'PropertyKey', 'Proxy', - 'ProxyConstructor', - 'ProxyHandler', 'PublicKeyCredential', - 'PublicKeyCredentialCreationOptions', - 'PublicKeyCredentialDescriptor', - 'PublicKeyCredentialEntity', - 'PublicKeyCredentialParameters', - 'PublicKeyCredentialRequestOptions', - 'PublicKeyCredentialRpEntity', - 'PublicKeyCredentialUserEntity', 'PushManager', 'PushSubscription', - 'PushSubscriptionJSON', 'PushSubscriptionOptions', - 'PushSubscriptionOptionsInit', - 'QueuingStrategy', - 'QueuingStrategyInit', - 'QueuingStrategySize', - 'RTCAnswerOptions', 'RTCCertificate', - 'RTCCertificateExpiration', - 'RTCConfiguration', 'RTCDTMFSender', - 'RTCDTMFSenderEventMap', 'RTCDTMFToneChangeEvent', - 'RTCDTMFToneChangeEventInit', 'RTCDataChannel', 'RTCDataChannelEvent', - 'RTCDataChannelEventInit', - 'RTCDataChannelEventMap', - 'RTCDataChannelInit', - 'RTCDtlsFingerprint', 'RTCDtlsTransport', - 'RTCDtlsTransportEventMap', 'RTCIceCandidate', - 'RTCIceCandidateInit', - 'RTCIceCandidatePairStats', - 'RTCIceServer', 'RTCIceTransport', - 'RTCInboundRtpStreamStats', - 'RTCLocalSessionDescriptionInit', - 'RTCOfferAnswerOptions', - 'RTCOfferOptions', - 'RTCOutboundRtpStreamStats', 'RTCPeerConnection', - 'RTCPeerConnectionErrorCallback', - 'RTCPeerConnectionEventMap', 'RTCPeerConnectionIceErrorEvent', - 'RTCPeerConnectionIceErrorEventInit', 'RTCPeerConnectionIceEvent', - 'RTCPeerConnectionIceEventInit', - 'RTCReceivedRtpStreamStats', - 'RTCRtcpParameters', - 'RTCRtpCapabilities', - 'RTCRtpCodecCapability', - 'RTCRtpCodecParameters', - 'RTCRtpCodingParameters', - 'RTCRtpContributingSource', - 'RTCRtpEncodingParameters', - 'RTCRtpHeaderExtensionCapability', - 'RTCRtpHeaderExtensionParameters', - 'RTCRtpParameters', - 'RTCRtpReceiveParameters', 'RTCRtpReceiver', - 'RTCRtpSendParameters', 'RTCRtpSender', - 'RTCRtpStreamStats', - 'RTCRtpSynchronizationSource', 'RTCRtpTransceiver', - 'RTCRtpTransceiverInit', - 'RTCSentRtpStreamStats', 'RTCSessionDescription', - 'RTCSessionDescriptionCallback', - 'RTCSessionDescriptionInit', - 'RTCStats', 'RTCStatsReport', 'RTCTrackEvent', - 'RTCTrackEventInit', - 'RTCTransportStats', 'RadioNodeList', 'Range', 'RangeError', - 'RangeErrorConstructor', 'ReadableStream', 'ReadableStreamDefaultController', - 'ReadableStreamDefaultReadDoneResult', - 'ReadableStreamDefaultReadValueResult', 'ReadableStreamDefaultReader', - 'ReadableStreamGenericReader', - 'ReadableWritablePair', - 'ReadonlyArray', - 'ReadonlyMap', - 'ReadonlySet', 'ReferenceError', - 'ReferenceErrorConstructor', 'Reflect', 'RegExp', - 'RegExpConstructor', - 'RegExpExecArray', - 'RegExpMatchArray', - 'RegistrationOptions', - 'RelativeTimeFormat', - 'RelativeTimeFormatOptions', - 'RelativeTimeFormatPart', 'RemotePlayback', - 'RemotePlaybackAvailabilityCallback', - 'RemotePlaybackEventMap', 'Request', - 'RequestInit', 'ResizeObserver', - 'ResizeObserverCallback', 'ResizeObserverEntry', - 'ResizeObserverOptions', 'ResizeObserverSize', - 'ResolvedCollatorOptions', - 'ResolvedDateTimeFormatOptions', - 'ResolvedNumberFormatOptions', - 'ResolvedPluralRulesOptions', - 'ResolvedRelativeTimeFormatOptions', 'Response', - 'ResponseInit', - 'RsaHashedImportParams', - 'RsaHashedKeyAlgorithm', - 'RsaHashedKeyGenParams', - 'RsaKeyAlgorithm', - 'RsaKeyGenParams', - 'RsaOaepParams', - 'RsaOtherPrimesInfo', - 'RsaPssParams', - 'RuntimeError', 'SVGAElement', 'SVGAngle', 'SVGAnimateElement', @@ -879,13 +402,11 @@ export const globals = new Set([ 'SVGAnimatedLengthList', 'SVGAnimatedNumber', 'SVGAnimatedNumberList', - 'SVGAnimatedPoints', 'SVGAnimatedPreserveAspectRatio', 'SVGAnimatedRect', 'SVGAnimatedString', 'SVGAnimatedTransformList', 'SVGAnimationElement', - 'SVGBoundingBoxOptions', 'SVGCircleElement', 'SVGClipPathElement', 'SVGComponentTransferFunctionElement', @@ -893,8 +414,6 @@ export const globals = new Set([ 'SVGDefsElement', 'SVGDescElement', 'SVGElement', - 'SVGElementEventMap', - 'SVGElementTagNameMap', 'SVGEllipseElement', 'SVGFEBlendElement', 'SVGFEColorMatrixElement', @@ -922,8 +441,6 @@ export const globals = new Set([ 'SVGFETileElement', 'SVGFETurbulenceElement', 'SVGFilterElement', - 'SVGFilterPrimitiveStandardAttributes', - 'SVGFitToViewBox', 'SVGForeignObjectElement', 'SVGGElement', 'SVGGeometryElement', @@ -952,7 +469,6 @@ export const globals = new Set([ 'SVGRect', 'SVGRectElement', 'SVGSVGElement', - 'SVGSVGElementEventMap', 'SVGScriptElement', 'SVGSetElement', 'SVGStopElement', @@ -961,7 +477,6 @@ export const globals = new Set([ 'SVGSwitchElement', 'SVGSymbolElement', 'SVGTSpanElement', - 'SVGTests', 'SVGTextContentElement', 'SVGTextElement', 'SVGTextPathElement', @@ -969,196 +484,97 @@ export const globals = new Set([ 'SVGTitleElement', 'SVGTransform', 'SVGTransformList', - 'SVGURIReference', 'SVGUnitTypes', 'SVGUseElement', 'SVGViewElement', 'SafeArray', 'Screen', 'ScreenOrientation', - 'ScreenOrientationEventMap', 'ScriptProcessorNode', - 'ScriptProcessorNodeEventMap', - 'ScrollIntoViewOptions', - 'ScrollOptions', - 'ScrollToOptions', 'SecurityPolicyViolationEvent', - 'SecurityPolicyViolationEventInit', 'Selection', 'ServiceWorker', 'ServiceWorkerContainer', - 'ServiceWorkerContainerEventMap', - 'ServiceWorkerEventMap', 'ServiceWorkerRegistration', - 'ServiceWorkerRegistrationEventMap', 'Set', - 'SetConstructor', 'ShadowRoot', - 'ShadowRootInit', - 'ShareData', 'SharedArrayBuffer', - 'SharedArrayBufferConstructor', 'SharedWorker', - 'Slottable', 'SourceBuffer', - 'SourceBufferEventMap', 'SourceBufferList', - 'SourceBufferListEventMap', 'SpeechRecognitionAlternative', 'SpeechRecognitionErrorEvent', - 'SpeechRecognitionErrorEventInit', 'SpeechRecognitionResult', 'SpeechRecognitionResultList', 'SpeechSynthesis', 'SpeechSynthesisErrorEvent', - 'SpeechSynthesisErrorEventInit', 'SpeechSynthesisEvent', - 'SpeechSynthesisEventInit', - 'SpeechSynthesisEventMap', 'SpeechSynthesisUtterance', - 'SpeechSynthesisUtteranceEventMap', 'SpeechSynthesisVoice', 'StaticRange', - 'StaticRangeInit', 'StereoPannerNode', - 'StereoPannerOptions', 'Storage', - 'StorageEstimate', 'StorageEvent', - 'StorageEventInit', 'StorageManager', - 'StreamPipeOptions', 'String', - 'StringConstructor', 'StyleMedia', 'StyleSheet', 'StyleSheetList', 'SubmitEvent', - 'SubmitEventInit', 'SubtleCrypto', 'Symbol', - 'SymbolConstructor', 'SyntaxError', - 'SyntaxErrorConstructor', - 'Table', - 'TableDescriptor', - 'TemplateStringsArray', 'Text', - 'TextDecodeOptions', 'TextDecoder', - 'TextDecoderCommon', - 'TextDecoderOptions', 'TextDecoderStream', 'TextEncoder', - 'TextEncoderCommon', - 'TextEncoderEncodeIntoResult', 'TextEncoderStream', 'TextMetrics', - 'TextStreamBase', - 'TextStreamReader', - 'TextStreamWriter', 'TextTrack', 'TextTrackCue', - 'TextTrackCueEventMap', 'TextTrackCueList', - 'TextTrackEventMap', 'TextTrackList', - 'TextTrackListEventMap', - 'ThisType', 'TimeRanges', 'Touch', 'TouchEvent', - 'TouchEventInit', - 'TouchInit', 'TouchList', 'TrackEvent', - 'TrackEventInit', 'TransformStream', 'TransformStreamDefaultController', - 'Transformer', - 'TransformerFlushCallback', - 'TransformerStartCallback', - 'TransformerTransformCallback', 'TransitionEvent', - 'TransitionEventInit', 'TreeWalker', 'TypeError', - 'TypeErrorConstructor', - 'TypedPropertyDescriptor', 'UIEvent', - 'UIEventInit', - 'ULongRange', 'URIError', - 'URIErrorConstructor', 'URL', 'URLSearchParams', 'Uint16Array', - 'Uint16ArrayConstructor', 'Uint32Array', - 'Uint32ArrayConstructor', 'Uint8Array', - 'Uint8ArrayConstructor', 'Uint8ClampedArray', - 'Uint8ClampedArrayConstructor', - 'UnderlyingSink', - 'UnderlyingSinkAbortCallback', - 'UnderlyingSinkCloseCallback', - 'UnderlyingSinkStartCallback', - 'UnderlyingSinkWriteCallback', - 'UnderlyingSource', - 'UnderlyingSourceCancelCallback', - 'UnderlyingSourcePullCallback', - 'UnderlyingSourceStartCallback', 'VBArray', - 'VBArrayConstructor', 'VTTCue', 'VTTRegion', 'ValidityState', 'VarDate', - 'VideoConfiguration', 'VideoPlaybackQuality', 'VisualViewport', - 'VisualViewportEventMap', - 'VoidFunction', - 'WEBGL_color_buffer_float', - 'WEBGL_compressed_texture_astc', - 'WEBGL_compressed_texture_etc', - 'WEBGL_compressed_texture_etc1', - 'WEBGL_compressed_texture_pvrtc', - 'WEBGL_compressed_texture_s3tc', - 'WEBGL_compressed_texture_s3tc_srgb', - 'WEBGL_debug_renderer_info', - 'WEBGL_debug_shaders', - 'WEBGL_depth_texture', - 'WEBGL_draw_buffers', - 'WEBGL_lose_context', 'WSH', 'WScript', 'WaveShaperNode', - 'WaveShaperOptions', 'WeakMap', - 'WeakMapConstructor', 'WeakRef', - 'WeakRefConstructor', 'WeakSet', - 'WeakSetConstructor', 'WebAssembly', - 'WebAssemblyInstantiatedSource', 'WebGL2RenderingContext', - 'WebGL2RenderingContextBase', - 'WebGL2RenderingContextOverloads', 'WebGLActiveInfo', 'WebGLBuffer', - 'WebGLContextAttributes', 'WebGLContextEvent', - 'WebGLContextEventInit', 'WebGLFramebuffer', 'WebGLProgram', 'WebGLQuery', 'WebGLRenderbuffer', 'WebGLRenderingContext', - 'WebGLRenderingContextBase', - 'WebGLRenderingContextOverloads', 'WebGLSampler', 'WebGLShader', 'WebGLShaderPrecisionFormat', @@ -1167,37 +583,21 @@ export const globals = new Set([ 'WebGLTransformFeedback', 'WebGLUniformLocation', 'WebGLVertexArrayObject', - 'WebGLVertexArrayObjectOES', 'WebKitCSSMatrix', 'WebSocket', - 'WebSocketEventMap', 'WheelEvent', - 'WheelEventInit', 'Window', - 'WindowEventHandlers', - 'WindowEventHandlersEventMap', - 'WindowEventMap', - 'WindowLocalStorage', - 'WindowOrWorkerGlobalScope', - 'WindowPostMessageOptions', - 'WindowSessionStorage', 'Worker', - 'WorkerEventMap', - 'WorkerOptions', 'Worklet', - 'WorkletOptions', 'WritableStream', 'WritableStreamDefaultController', 'WritableStreamDefaultWriter', 'XMLDocument', 'XMLHttpRequest', - 'XMLHttpRequestEventMap', 'XMLHttpRequestEventTarget', - 'XMLHttpRequestEventTargetEventMap', 'XMLHttpRequestUpload', 'XMLSerializer', 'XPathEvaluator', - 'XPathEvaluatorBase', 'XPathExpression', 'XPathResult', 'XSLTProcessor', @@ -1237,6 +637,7 @@ export const globals = new Set([ 'frames', 'getComputedStyle', 'getSelection', + 'global', 'globalThis', 'history', 'importScripts', From 86d1f802714c5bd59ab65f9d252446a44e8f53bc Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Sun, 14 Aug 2022 18:52:54 +0900 Subject: [PATCH 3/8] exract all globals and output to ts file --- scripts/globals-extractor.mjs | 45 +- src/compiler/compile/Component.ts | 3 +- src/compiler/utils/globals.ts | 821 ++++++++++++++++++++++++++++++ src/compiler/utils/names.ts | 817 ----------------------------- 4 files changed, 854 insertions(+), 832 deletions(-) create mode 100644 src/compiler/utils/globals.ts diff --git a/scripts/globals-extractor.mjs b/scripts/globals-extractor.mjs index 80f5277f377..c479418aad1 100644 --- a/scripts/globals-extractor.mjs +++ b/scripts/globals-extractor.mjs @@ -1,27 +1,30 @@ /** ---------------------------------------------------------------------- -This script gets a list of global objects/interfaces of browser. +This script gets a list of global objects/functions of browser. This process is simple for now, so it is handled without AST parser. +Please run `node scripts/globals-extractor.mjs` at the project root. + see: https://github.com/microsoft/TypeScript/tree/main/lib ---------------------------------------------------------------------- */ import http from 'https'; +import fs from 'fs'; const get_url = (name) => `https://raw.githubusercontent.com/microsoft/TypeScript/main/lib/lib.${name}.d.ts`; const extract_name = (split) => split.match(/^[a-zA-Z0-9_$]+/)[0]; -const extract_interfaces_and_references = (data) => { - const interfaces = []; +const extract_functions_and_references = (data) => { + const functions = []; const references = []; data.split('\n').forEach(line => { const trimmed = line.trim(); const split = trimmed.replace(/[\s+]/, ' ').split(' '); - if (split[0] === 'declare') interfaces.push(extract_name(split[2])); + if (split[0] === 'declare') functions.push(extract_name(split[2])); else if (trimmed.startsWith('/// new Promise((resolve, reject) => { @@ -36,20 +39,34 @@ const do_get = (url) => new Promise((resolve, reject) => { }); }); -const get_interfaces = async (name) => { +const get_functions = async (name) => { const res = []; const body = await do_get(get_url(name)); - const { interfaces, references } = extract_interfaces_and_references(body); - res.push(...interfaces); - const chile_interfaces = await Promise.all(references.map(get_interfaces)); - chile_interfaces.forEach(i => res.push(...i)); + const { functions, references } = extract_functions_and_references(body); + res.push(...functions); + const chile_functions = await Promise.all(references.map(get_functions)); + chile_functions.forEach(i => res.push(...i)); return res; }; +const build_output = (functions) => { + const sorted = Array.from(new Set(functions.sort())); + return ` +/** ---------------------------------------------------------------------- +This file is automatically generated by \`scripts/globals-extractor.mjs\`. +Generated At: ${new Date().toISOString()} +---------------------------------------------------------------------- */ + +export default new Set([ +${sorted.map((i) => `\t'${i}'`).join(',\n')} +]); +`.substring(1); +}; + (async () => { - const interfaces = await get_interfaces('es2021.full'); - // MEMO: add additional objects/interfaces which existed in `src/compiler/utils/names.ts` + const functions = await get_functions('es2021.full'); + // MEMO: add additional objects/functions which existed in `src/compiler/utils/names.ts` // before this script was introduced but could not be retrieved by this process. - interfaces.push(...['global', 'globalThis', 'InternalError', 'process', 'undefined']); - new Set(interfaces.sort()).forEach((i) => console.log(`'${i}',`)); + functions.push(...['global', 'globalThis', 'InternalError', 'process', 'undefined']); + fs.writeFileSync('src/compiler/utils/globals.ts', build_output(functions)); })(); diff --git a/src/compiler/compile/Component.ts b/src/compiler/compile/Component.ts index 63c62a256a3..2f8874de7ac 100644 --- a/src/compiler/compile/Component.ts +++ b/src/compiler/compile/Component.ts @@ -1,7 +1,8 @@ import { walk } from 'estree-walker'; import { getLocator } from 'locate-character'; import Stats from '../Stats'; -import { globals, reserved, is_valid } from '../utils/names'; +import { reserved, is_valid } from '../utils/names'; +import globals from '../utils/globals'; import { namespaces, valid_namespaces } from '../utils/namespaces'; import create_module from './create_module'; import { diff --git a/src/compiler/utils/globals.ts b/src/compiler/utils/globals.ts new file mode 100644 index 00000000000..9406aee71d6 --- /dev/null +++ b/src/compiler/utils/globals.ts @@ -0,0 +1,821 @@ +/** ---------------------------------------------------------------------- +This file is automatically generated by `scripts/globals-extractor.mjs`. +Generated At: 2022-08-14T09:54:06.940Z +---------------------------------------------------------------------- */ + +export default new Set([ + 'AbortController', + 'AbortSignal', + 'AbstractRange', + 'ActiveXObject', + 'AggregateError', + 'AnalyserNode', + 'Animation', + 'AnimationEffect', + 'AnimationEvent', + 'AnimationPlaybackEvent', + 'AnimationTimeline', + 'Array', + 'ArrayBuffer', + 'Atomics', + 'Attr', + 'Audio', + 'AudioBuffer', + 'AudioBufferSourceNode', + 'AudioContext', + 'AudioDestinationNode', + 'AudioListener', + 'AudioNode', + 'AudioParam', + 'AudioParamMap', + 'AudioProcessingEvent', + 'AudioScheduledSourceNode', + 'AudioWorklet', + 'AudioWorkletNode', + 'AuthenticatorAssertionResponse', + 'AuthenticatorAttestationResponse', + 'AuthenticatorResponse', + 'BarProp', + 'BaseAudioContext', + 'BeforeUnloadEvent', + 'BigInt', + 'BigInt64Array', + 'BigUint64Array', + 'BiquadFilterNode', + 'Blob', + 'BlobEvent', + 'Boolean', + 'BroadcastChannel', + 'ByteLengthQueuingStrategy', + 'CDATASection', + 'CSS', + 'CSSAnimation', + 'CSSConditionRule', + 'CSSCounterStyleRule', + 'CSSFontFaceRule', + 'CSSGroupingRule', + 'CSSImportRule', + 'CSSKeyframeRule', + 'CSSKeyframesRule', + 'CSSMediaRule', + 'CSSNamespaceRule', + 'CSSPageRule', + 'CSSRule', + 'CSSRuleList', + 'CSSStyleDeclaration', + 'CSSStyleRule', + 'CSSStyleSheet', + 'CSSSupportsRule', + 'CSSTransition', + 'Cache', + 'CacheStorage', + 'CanvasGradient', + 'CanvasPattern', + 'CanvasRenderingContext2D', + 'ChannelMergerNode', + 'ChannelSplitterNode', + 'CharacterData', + 'ClassDecorator', + 'ClientRect', + 'Clipboard', + 'ClipboardEvent', + 'ClipboardItem', + 'CloseEvent', + 'Comment', + 'CompositionEvent', + 'ConstantSourceNode', + 'ConvolverNode', + 'CountQueuingStrategy', + 'Credential', + 'CredentialsContainer', + 'Crypto', + 'CryptoKey', + 'CustomElementRegistry', + 'CustomEvent', + 'DOMException', + 'DOMImplementation', + 'DOMMatrix', + 'DOMMatrixReadOnly', + 'DOMParser', + 'DOMPoint', + 'DOMPointReadOnly', + 'DOMQuad', + 'DOMRect', + 'DOMRectList', + 'DOMRectReadOnly', + 'DOMStringList', + 'DOMStringMap', + 'DOMTokenList', + 'DataTransfer', + 'DataTransferItem', + 'DataTransferItemList', + 'DataView', + 'Date', + 'DelayNode', + 'DeviceMotionEvent', + 'DeviceOrientationEvent', + 'Document', + 'DocumentFragment', + 'DocumentTimeline', + 'DocumentType', + 'DragEvent', + 'DynamicsCompressorNode', + 'Element', + 'Enumerator', + 'Error', + 'ErrorEvent', + 'EvalError', + 'Event', + 'EventSource', + 'EventTarget', + 'External', + 'File', + 'FileList', + 'FileReader', + 'FileSystem', + 'FileSystemDirectoryEntry', + 'FileSystemDirectoryReader', + 'FileSystemEntry', + 'FileSystemFileEntry', + 'FinalizationRegistry', + 'Float32Array', + 'Float64Array', + 'FocusEvent', + 'FontFace', + 'FontFaceSet', + 'FontFaceSetLoadEvent', + 'FormData', + 'FormDataEvent', + 'Function', + 'GainNode', + 'Gamepad', + 'GamepadButton', + 'GamepadEvent', + 'GamepadHapticActuator', + 'Geolocation', + 'GeolocationCoordinates', + 'GeolocationPosition', + 'GeolocationPositionError', + 'HTMLAllCollection', + 'HTMLAnchorElement', + 'HTMLAreaElement', + 'HTMLAudioElement', + 'HTMLBRElement', + 'HTMLBaseElement', + 'HTMLBodyElement', + 'HTMLButtonElement', + 'HTMLCanvasElement', + 'HTMLCollection', + 'HTMLDListElement', + 'HTMLDataElement', + 'HTMLDataListElement', + 'HTMLDetailsElement', + 'HTMLDirectoryElement', + 'HTMLDivElement', + 'HTMLDocument', + 'HTMLElement', + 'HTMLEmbedElement', + 'HTMLFieldSetElement', + 'HTMLFontElement', + 'HTMLFormControlsCollection', + 'HTMLFormElement', + 'HTMLFrameElement', + 'HTMLFrameSetElement', + 'HTMLHRElement', + 'HTMLHeadElement', + 'HTMLHeadingElement', + 'HTMLHtmlElement', + 'HTMLIFrameElement', + 'HTMLImageElement', + 'HTMLInputElement', + 'HTMLLIElement', + 'HTMLLabelElement', + 'HTMLLegendElement', + 'HTMLLinkElement', + 'HTMLMapElement', + 'HTMLMarqueeElement', + 'HTMLMediaElement', + 'HTMLMenuElement', + 'HTMLMetaElement', + 'HTMLMeterElement', + 'HTMLModElement', + 'HTMLOListElement', + 'HTMLObjectElement', + 'HTMLOptGroupElement', + 'HTMLOptionElement', + 'HTMLOptionsCollection', + 'HTMLOutputElement', + 'HTMLParagraphElement', + 'HTMLParamElement', + 'HTMLPictureElement', + 'HTMLPreElement', + 'HTMLProgressElement', + 'HTMLQuoteElement', + 'HTMLScriptElement', + 'HTMLSelectElement', + 'HTMLSlotElement', + 'HTMLSourceElement', + 'HTMLSpanElement', + 'HTMLStyleElement', + 'HTMLTableCaptionElement', + 'HTMLTableCellElement', + 'HTMLTableColElement', + 'HTMLTableElement', + 'HTMLTableRowElement', + 'HTMLTableSectionElement', + 'HTMLTemplateElement', + 'HTMLTextAreaElement', + 'HTMLTimeElement', + 'HTMLTitleElement', + 'HTMLTrackElement', + 'HTMLUListElement', + 'HTMLUnknownElement', + 'HTMLVideoElement', + 'HashChangeEvent', + 'Headers', + 'History', + 'IDBCursor', + 'IDBCursorWithValue', + 'IDBDatabase', + 'IDBFactory', + 'IDBIndex', + 'IDBKeyRange', + 'IDBObjectStore', + 'IDBOpenDBRequest', + 'IDBRequest', + 'IDBTransaction', + 'IDBVersionChangeEvent', + 'IIRFilterNode', + 'IdleDeadline', + 'Image', + 'ImageBitmap', + 'ImageBitmapRenderingContext', + 'ImageData', + 'Infinity', + 'InputEvent', + 'Int16Array', + 'Int32Array', + 'Int8Array', + 'InternalError', + 'IntersectionObserver', + 'IntersectionObserverEntry', + 'Intl', + 'JSON', + 'KeyboardEvent', + 'KeyframeEffect', + 'Location', + 'Map', + 'Math', + 'MathMLElement', + 'MediaCapabilities', + 'MediaDeviceInfo', + 'MediaDevices', + 'MediaElementAudioSourceNode', + 'MediaEncryptedEvent', + 'MediaError', + 'MediaKeyMessageEvent', + 'MediaKeySession', + 'MediaKeyStatusMap', + 'MediaKeySystemAccess', + 'MediaKeys', + 'MediaList', + 'MediaMetadata', + 'MediaQueryList', + 'MediaQueryListEvent', + 'MediaRecorder', + 'MediaRecorderErrorEvent', + 'MediaSession', + 'MediaSource', + 'MediaStream', + 'MediaStreamAudioDestinationNode', + 'MediaStreamAudioSourceNode', + 'MediaStreamTrack', + 'MediaStreamTrackEvent', + 'MessageChannel', + 'MessageEvent', + 'MessagePort', + 'MethodDecorator', + 'MimeType', + 'MimeTypeArray', + 'MouseEvent', + 'MutationEvent', + 'MutationObserver', + 'MutationRecord', + 'NaN', + 'NamedNodeMap', + 'Navigator', + 'NetworkInformation', + 'Node', + 'NodeFilter', + 'NodeIterator', + 'NodeList', + 'Notification', + 'Number', + 'Object', + 'OfflineAudioCompletionEvent', + 'OfflineAudioContext', + 'Option', + 'OscillatorNode', + 'OverconstrainedError', + 'PageTransitionEvent', + 'PannerNode', + 'ParameterDecorator', + 'Path2D', + 'PaymentAddress', + 'PaymentMethodChangeEvent', + 'PaymentRequest', + 'PaymentRequestUpdateEvent', + 'PaymentResponse', + 'Performance', + 'PerformanceEntry', + 'PerformanceEventTiming', + 'PerformanceMark', + 'PerformanceMeasure', + 'PerformanceNavigation', + 'PerformanceNavigationTiming', + 'PerformanceObserver', + 'PerformanceObserverEntryList', + 'PerformancePaintTiming', + 'PerformanceResourceTiming', + 'PerformanceServerTiming', + 'PerformanceTiming', + 'PeriodicWave', + 'PermissionStatus', + 'Permissions', + 'PictureInPictureWindow', + 'Plugin', + 'PluginArray', + 'PointerEvent', + 'PopStateEvent', + 'ProcessingInstruction', + 'ProgressEvent', + 'Promise', + 'PromiseConstructorLike', + 'PromiseRejectionEvent', + 'PropertyDecorator', + 'PropertyKey', + 'Proxy', + 'PublicKeyCredential', + 'PushManager', + 'PushSubscription', + 'PushSubscriptionOptions', + 'RTCCertificate', + 'RTCDTMFSender', + 'RTCDTMFToneChangeEvent', + 'RTCDataChannel', + 'RTCDataChannelEvent', + 'RTCDtlsTransport', + 'RTCIceCandidate', + 'RTCIceTransport', + 'RTCPeerConnection', + 'RTCPeerConnectionIceErrorEvent', + 'RTCPeerConnectionIceEvent', + 'RTCRtpReceiver', + 'RTCRtpSender', + 'RTCRtpTransceiver', + 'RTCSessionDescription', + 'RTCStatsReport', + 'RTCTrackEvent', + 'RadioNodeList', + 'Range', + 'RangeError', + 'ReadableStream', + 'ReadableStreamDefaultController', + 'ReadableStreamDefaultReader', + 'ReferenceError', + 'Reflect', + 'RegExp', + 'RemotePlayback', + 'Request', + 'ResizeObserver', + 'ResizeObserverEntry', + 'ResizeObserverSize', + 'Response', + 'SVGAElement', + 'SVGAngle', + 'SVGAnimateElement', + 'SVGAnimateMotionElement', + 'SVGAnimateTransformElement', + 'SVGAnimatedAngle', + 'SVGAnimatedBoolean', + 'SVGAnimatedEnumeration', + 'SVGAnimatedInteger', + 'SVGAnimatedLength', + 'SVGAnimatedLengthList', + 'SVGAnimatedNumber', + 'SVGAnimatedNumberList', + 'SVGAnimatedPreserveAspectRatio', + 'SVGAnimatedRect', + 'SVGAnimatedString', + 'SVGAnimatedTransformList', + 'SVGAnimationElement', + 'SVGCircleElement', + 'SVGClipPathElement', + 'SVGComponentTransferFunctionElement', + 'SVGCursorElement', + 'SVGDefsElement', + 'SVGDescElement', + 'SVGElement', + 'SVGEllipseElement', + 'SVGFEBlendElement', + 'SVGFEColorMatrixElement', + 'SVGFEComponentTransferElement', + 'SVGFECompositeElement', + 'SVGFEConvolveMatrixElement', + 'SVGFEDiffuseLightingElement', + 'SVGFEDisplacementMapElement', + 'SVGFEDistantLightElement', + 'SVGFEDropShadowElement', + 'SVGFEFloodElement', + 'SVGFEFuncAElement', + 'SVGFEFuncBElement', + 'SVGFEFuncGElement', + 'SVGFEFuncRElement', + 'SVGFEGaussianBlurElement', + 'SVGFEImageElement', + 'SVGFEMergeElement', + 'SVGFEMergeNodeElement', + 'SVGFEMorphologyElement', + 'SVGFEOffsetElement', + 'SVGFEPointLightElement', + 'SVGFESpecularLightingElement', + 'SVGFESpotLightElement', + 'SVGFETileElement', + 'SVGFETurbulenceElement', + 'SVGFilterElement', + 'SVGForeignObjectElement', + 'SVGGElement', + 'SVGGeometryElement', + 'SVGGradientElement', + 'SVGGraphicsElement', + 'SVGImageElement', + 'SVGLength', + 'SVGLengthList', + 'SVGLineElement', + 'SVGLinearGradientElement', + 'SVGMPathElement', + 'SVGMarkerElement', + 'SVGMaskElement', + 'SVGMatrix', + 'SVGMetadataElement', + 'SVGNumber', + 'SVGNumberList', + 'SVGPathElement', + 'SVGPatternElement', + 'SVGPoint', + 'SVGPointList', + 'SVGPolygonElement', + 'SVGPolylineElement', + 'SVGPreserveAspectRatio', + 'SVGRadialGradientElement', + 'SVGRect', + 'SVGRectElement', + 'SVGSVGElement', + 'SVGScriptElement', + 'SVGSetElement', + 'SVGStopElement', + 'SVGStringList', + 'SVGStyleElement', + 'SVGSwitchElement', + 'SVGSymbolElement', + 'SVGTSpanElement', + 'SVGTextContentElement', + 'SVGTextElement', + 'SVGTextPathElement', + 'SVGTextPositioningElement', + 'SVGTitleElement', + 'SVGTransform', + 'SVGTransformList', + 'SVGUnitTypes', + 'SVGUseElement', + 'SVGViewElement', + 'SafeArray', + 'Screen', + 'ScreenOrientation', + 'ScriptProcessorNode', + 'SecurityPolicyViolationEvent', + 'Selection', + 'ServiceWorker', + 'ServiceWorkerContainer', + 'ServiceWorkerRegistration', + 'Set', + 'ShadowRoot', + 'SharedArrayBuffer', + 'SharedWorker', + 'SourceBuffer', + 'SourceBufferList', + 'SpeechRecognitionAlternative', + 'SpeechRecognitionErrorEvent', + 'SpeechRecognitionResult', + 'SpeechRecognitionResultList', + 'SpeechSynthesis', + 'SpeechSynthesisErrorEvent', + 'SpeechSynthesisEvent', + 'SpeechSynthesisUtterance', + 'SpeechSynthesisVoice', + 'StaticRange', + 'StereoPannerNode', + 'Storage', + 'StorageEvent', + 'StorageManager', + 'String', + 'StyleMedia', + 'StyleSheet', + 'StyleSheetList', + 'SubmitEvent', + 'SubtleCrypto', + 'Symbol', + 'SyntaxError', + 'Text', + 'TextDecoder', + 'TextDecoderStream', + 'TextEncoder', + 'TextEncoderStream', + 'TextMetrics', + 'TextTrack', + 'TextTrackCue', + 'TextTrackCueList', + 'TextTrackList', + 'TimeRanges', + 'Touch', + 'TouchEvent', + 'TouchList', + 'TrackEvent', + 'TransformStream', + 'TransformStreamDefaultController', + 'TransitionEvent', + 'TreeWalker', + 'TypeError', + 'UIEvent', + 'URIError', + 'URL', + 'URLSearchParams', + 'Uint16Array', + 'Uint32Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'VBArray', + 'VTTCue', + 'VTTRegion', + 'ValidityState', + 'VarDate', + 'VideoPlaybackQuality', + 'VisualViewport', + 'WSH', + 'WScript', + 'WaveShaperNode', + 'WeakMap', + 'WeakRef', + 'WeakSet', + 'WebAssembly', + 'WebGL2RenderingContext', + 'WebGLActiveInfo', + 'WebGLBuffer', + 'WebGLContextEvent', + 'WebGLFramebuffer', + 'WebGLProgram', + 'WebGLQuery', + 'WebGLRenderbuffer', + 'WebGLRenderingContext', + 'WebGLSampler', + 'WebGLShader', + 'WebGLShaderPrecisionFormat', + 'WebGLSync', + 'WebGLTexture', + 'WebGLTransformFeedback', + 'WebGLUniformLocation', + 'WebGLVertexArrayObject', + 'WebKitCSSMatrix', + 'WebSocket', + 'WheelEvent', + 'Window', + 'Worker', + 'Worklet', + 'WritableStream', + 'WritableStreamDefaultController', + 'WritableStreamDefaultWriter', + 'XMLDocument', + 'XMLHttpRequest', + 'XMLHttpRequestEventTarget', + 'XMLHttpRequestUpload', + 'XMLSerializer', + 'XPathEvaluator', + 'XPathExpression', + 'XPathResult', + 'XSLTProcessor', + 'addEventListener', + 'alert', + 'atob', + 'blur', + 'btoa', + 'caches', + 'cancelAnimationFrame', + 'cancelIdleCallback', + 'captureEvents', + 'clearInterval', + 'clearTimeout', + 'close', + 'closed', + 'confirm', + 'console', + 'createImageBitmap', + 'crossOriginIsolated', + 'crypto', + 'customElements', + 'decodeURI', + 'decodeURIComponent', + 'devicePixelRatio', + 'dispatchEvent', + 'document', + 'encodeURI', + 'encodeURIComponent', + 'escape', + 'eval', + 'event', + 'external', + 'fetch', + 'focus', + 'frameElement', + 'frames', + 'getComputedStyle', + 'getSelection', + 'global', + 'globalThis', + 'history', + 'importScripts', + 'indexedDB', + 'innerHeight', + 'innerWidth', + 'isFinite', + 'isNaN', + 'isSecureContext', + 'length', + 'localStorage', + 'location', + 'locationbar', + 'matchMedia', + 'menubar', + 'moveBy', + 'moveTo', + 'name', + 'navigator', + 'onabort', + 'onafterprint', + 'onanimationcancel', + 'onanimationend', + 'onanimationiteration', + 'onanimationstart', + 'onauxclick', + 'onbeforeprint', + 'onbeforeunload', + 'onblur', + 'oncanplay', + 'oncanplaythrough', + 'onchange', + 'onclick', + 'onclose', + 'oncontextmenu', + 'oncuechange', + 'ondblclick', + 'ondevicemotion', + 'ondeviceorientation', + 'ondrag', + 'ondragend', + 'ondragenter', + 'ondragleave', + 'ondragover', + 'ondragstart', + 'ondrop', + 'ondurationchange', + 'onemptied', + 'onended', + 'onerror', + 'onfocus', + 'onformdata', + 'ongamepadconnected', + 'ongamepaddisconnected', + 'ongotpointercapture', + 'onhashchange', + 'oninput', + 'oninvalid', + 'onkeydown', + 'onkeypress', + 'onkeyup', + 'onlanguagechange', + 'onload', + 'onloadeddata', + 'onloadedmetadata', + 'onloadstart', + 'onlostpointercapture', + 'onmessage', + 'onmessageerror', + 'onmousedown', + 'onmouseenter', + 'onmouseleave', + 'onmousemove', + 'onmouseout', + 'onmouseover', + 'onmouseup', + 'onoffline', + 'ononline', + 'onorientationchange', + 'onpagehide', + 'onpageshow', + 'onpause', + 'onplay', + 'onplaying', + 'onpointercancel', + 'onpointerdown', + 'onpointerenter', + 'onpointerleave', + 'onpointermove', + 'onpointerout', + 'onpointerover', + 'onpointerup', + 'onpopstate', + 'onprogress', + 'onratechange', + 'onrejectionhandled', + 'onreset', + 'onresize', + 'onscroll', + 'onseeked', + 'onseeking', + 'onselect', + 'onselectionchange', + 'onselectstart', + 'onstalled', + 'onstorage', + 'onsubmit', + 'onsuspend', + 'ontimeupdate', + 'ontoggle', + 'ontouchcancel', + 'ontouchend', + 'ontouchmove', + 'ontouchstart', + 'ontransitioncancel', + 'ontransitionend', + 'ontransitionrun', + 'ontransitionstart', + 'onunhandledrejection', + 'onunload', + 'onvolumechange', + 'onwaiting', + 'onwebkitanimationend', + 'onwebkitanimationiteration', + 'onwebkitanimationstart', + 'onwebkittransitionend', + 'onwheel', + 'open', + 'opener', + 'orientation', + 'origin', + 'outerHeight', + 'outerWidth', + 'pageXOffset', + 'pageYOffset', + 'parent', + 'parseFloat', + 'parseInt', + 'performance', + 'personalbar', + 'postMessage', + 'print', + 'process', + 'prompt', + 'queueMicrotask', + 'releaseEvents', + 'removeEventListener', + 'requestAnimationFrame', + 'requestIdleCallback', + 'resizeBy', + 'resizeTo', + 'screen', + 'screenLeft', + 'screenTop', + 'screenX', + 'screenY', + 'scroll', + 'scrollBy', + 'scrollTo', + 'scrollX', + 'scrollY', + 'scrollbars', + 'self', + 'sessionStorage', + 'setInterval', + 'setTimeout', + 'speechSynthesis', + 'status', + 'statusbar', + 'stop', + 'toString', + 'toolbar', + 'top', + 'undefined', + 'unescape', + 'visualViewport', + 'webkitURL', + 'window' +]); diff --git a/src/compiler/utils/names.ts b/src/compiler/utils/names.ts index 52e09edf326..9d5b78fcebc 100644 --- a/src/compiler/utils/names.ts +++ b/src/compiler/utils/names.ts @@ -1,823 +1,6 @@ import { isIdentifierStart, isIdentifierChar } from 'acorn'; import full_char_code_at from './full_char_code_at'; -export const globals = new Set([ - 'AbortController', - 'AbortSignal', - 'AbstractRange', - 'ActiveXObject', - 'AggregateError', - 'AnalyserNode', - 'Animation', - 'AnimationEffect', - 'AnimationEvent', - 'AnimationPlaybackEvent', - 'AnimationTimeline', - 'Array', - 'ArrayBuffer', - 'Atomics', - 'Attr', - 'Audio', - 'AudioBuffer', - 'AudioBufferSourceNode', - 'AudioContext', - 'AudioDestinationNode', - 'AudioListener', - 'AudioNode', - 'AudioParam', - 'AudioParamMap', - 'AudioProcessingEvent', - 'AudioScheduledSourceNode', - 'AudioWorklet', - 'AudioWorkletNode', - 'AuthenticatorAssertionResponse', - 'AuthenticatorAttestationResponse', - 'AuthenticatorResponse', - 'BarProp', - 'BaseAudioContext', - 'BeforeUnloadEvent', - 'BigInt', - 'BigInt64Array', - 'BigUint64Array', - 'BiquadFilterNode', - 'Blob', - 'BlobEvent', - 'Boolean', - 'BroadcastChannel', - 'ByteLengthQueuingStrategy', - 'CDATASection', - 'CSS', - 'CSSAnimation', - 'CSSConditionRule', - 'CSSCounterStyleRule', - 'CSSFontFaceRule', - 'CSSGroupingRule', - 'CSSImportRule', - 'CSSKeyframeRule', - 'CSSKeyframesRule', - 'CSSMediaRule', - 'CSSNamespaceRule', - 'CSSPageRule', - 'CSSRule', - 'CSSRuleList', - 'CSSStyleDeclaration', - 'CSSStyleRule', - 'CSSStyleSheet', - 'CSSSupportsRule', - 'CSSTransition', - 'Cache', - 'CacheStorage', - 'CanvasGradient', - 'CanvasPattern', - 'CanvasRenderingContext2D', - 'ChannelMergerNode', - 'ChannelSplitterNode', - 'CharacterData', - 'ClassDecorator', - 'ClientRect', - 'Clipboard', - 'ClipboardEvent', - 'ClipboardItem', - 'CloseEvent', - 'Comment', - 'CompositionEvent', - 'ConstantSourceNode', - 'ConvolverNode', - 'CountQueuingStrategy', - 'Credential', - 'CredentialsContainer', - 'Crypto', - 'CryptoKey', - 'CustomElementRegistry', - 'CustomEvent', - 'DOMException', - 'DOMImplementation', - 'DOMMatrix', - 'DOMMatrixReadOnly', - 'DOMParser', - 'DOMPoint', - 'DOMPointReadOnly', - 'DOMQuad', - 'DOMRect', - 'DOMRectList', - 'DOMRectReadOnly', - 'DOMStringList', - 'DOMStringMap', - 'DOMTokenList', - 'DataTransfer', - 'DataTransferItem', - 'DataTransferItemList', - 'DataView', - 'Date', - 'DelayNode', - 'DeviceMotionEvent', - 'DeviceOrientationEvent', - 'Document', - 'DocumentFragment', - 'DocumentTimeline', - 'DocumentType', - 'DragEvent', - 'DynamicsCompressorNode', - 'Element', - 'Enumerator', - 'Error', - 'ErrorEvent', - 'EvalError', - 'Event', - 'EventSource', - 'EventTarget', - 'External', - 'File', - 'FileList', - 'FileReader', - 'FileSystem', - 'FileSystemDirectoryEntry', - 'FileSystemDirectoryReader', - 'FileSystemEntry', - 'FileSystemFileEntry', - 'FinalizationRegistry', - 'Float32Array', - 'Float64Array', - 'FocusEvent', - 'FontFace', - 'FontFaceSet', - 'FontFaceSetLoadEvent', - 'FormData', - 'FormDataEvent', - 'Function', - 'GainNode', - 'Gamepad', - 'GamepadButton', - 'GamepadEvent', - 'GamepadHapticActuator', - 'Geolocation', - 'GeolocationCoordinates', - 'GeolocationPosition', - 'GeolocationPositionError', - 'HTMLAllCollection', - 'HTMLAnchorElement', - 'HTMLAreaElement', - 'HTMLAudioElement', - 'HTMLBRElement', - 'HTMLBaseElement', - 'HTMLBodyElement', - 'HTMLButtonElement', - 'HTMLCanvasElement', - 'HTMLCollection', - 'HTMLDListElement', - 'HTMLDataElement', - 'HTMLDataListElement', - 'HTMLDetailsElement', - 'HTMLDirectoryElement', - 'HTMLDivElement', - 'HTMLDocument', - 'HTMLElement', - 'HTMLEmbedElement', - 'HTMLFieldSetElement', - 'HTMLFontElement', - 'HTMLFormControlsCollection', - 'HTMLFormElement', - 'HTMLFrameElement', - 'HTMLFrameSetElement', - 'HTMLHRElement', - 'HTMLHeadElement', - 'HTMLHeadingElement', - 'HTMLHtmlElement', - 'HTMLIFrameElement', - 'HTMLImageElement', - 'HTMLInputElement', - 'HTMLLIElement', - 'HTMLLabelElement', - 'HTMLLegendElement', - 'HTMLLinkElement', - 'HTMLMapElement', - 'HTMLMarqueeElement', - 'HTMLMediaElement', - 'HTMLMenuElement', - 'HTMLMetaElement', - 'HTMLMeterElement', - 'HTMLModElement', - 'HTMLOListElement', - 'HTMLObjectElement', - 'HTMLOptGroupElement', - 'HTMLOptionElement', - 'HTMLOptionsCollection', - 'HTMLOutputElement', - 'HTMLParagraphElement', - 'HTMLParamElement', - 'HTMLPictureElement', - 'HTMLPreElement', - 'HTMLProgressElement', - 'HTMLQuoteElement', - 'HTMLScriptElement', - 'HTMLSelectElement', - 'HTMLSlotElement', - 'HTMLSourceElement', - 'HTMLSpanElement', - 'HTMLStyleElement', - 'HTMLTableCaptionElement', - 'HTMLTableCellElement', - 'HTMLTableColElement', - 'HTMLTableElement', - 'HTMLTableRowElement', - 'HTMLTableSectionElement', - 'HTMLTemplateElement', - 'HTMLTextAreaElement', - 'HTMLTimeElement', - 'HTMLTitleElement', - 'HTMLTrackElement', - 'HTMLUListElement', - 'HTMLUnknownElement', - 'HTMLVideoElement', - 'HashChangeEvent', - 'Headers', - 'History', - 'IDBCursor', - 'IDBCursorWithValue', - 'IDBDatabase', - 'IDBFactory', - 'IDBIndex', - 'IDBKeyRange', - 'IDBObjectStore', - 'IDBOpenDBRequest', - 'IDBRequest', - 'IDBTransaction', - 'IDBVersionChangeEvent', - 'IIRFilterNode', - 'IdleDeadline', - 'Image', - 'ImageBitmap', - 'ImageBitmapRenderingContext', - 'ImageData', - 'Infinity', - 'InputEvent', - 'Int16Array', - 'Int32Array', - 'Int8Array', - 'InternalError', - 'IntersectionObserver', - 'IntersectionObserverEntry', - 'Intl', - 'JSON', - 'KeyboardEvent', - 'KeyframeEffect', - 'Location', - 'Map', - 'Math', - 'MathMLElement', - 'MediaCapabilities', - 'MediaDeviceInfo', - 'MediaDevices', - 'MediaElementAudioSourceNode', - 'MediaEncryptedEvent', - 'MediaError', - 'MediaKeyMessageEvent', - 'MediaKeySession', - 'MediaKeyStatusMap', - 'MediaKeySystemAccess', - 'MediaKeys', - 'MediaList', - 'MediaMetadata', - 'MediaQueryList', - 'MediaQueryListEvent', - 'MediaRecorder', - 'MediaRecorderErrorEvent', - 'MediaSession', - 'MediaSource', - 'MediaStream', - 'MediaStreamAudioDestinationNode', - 'MediaStreamAudioSourceNode', - 'MediaStreamTrack', - 'MediaStreamTrackEvent', - 'MessageChannel', - 'MessageEvent', - 'MessagePort', - 'MethodDecorator', - 'MimeType', - 'MimeTypeArray', - 'MouseEvent', - 'MutationEvent', - 'MutationObserver', - 'MutationRecord', - 'NaN', - 'NamedNodeMap', - 'Navigator', - 'NetworkInformation', - 'Node', - 'NodeFilter', - 'NodeIterator', - 'NodeList', - 'Notification', - 'Number', - 'Object', - 'OfflineAudioCompletionEvent', - 'OfflineAudioContext', - 'Option', - 'OscillatorNode', - 'OverconstrainedError', - 'PageTransitionEvent', - 'PannerNode', - 'ParameterDecorator', - 'Path2D', - 'PaymentAddress', - 'PaymentMethodChangeEvent', - 'PaymentRequest', - 'PaymentRequestUpdateEvent', - 'PaymentResponse', - 'Performance', - 'PerformanceEntry', - 'PerformanceEventTiming', - 'PerformanceMark', - 'PerformanceMeasure', - 'PerformanceNavigation', - 'PerformanceNavigationTiming', - 'PerformanceObserver', - 'PerformanceObserverEntryList', - 'PerformancePaintTiming', - 'PerformanceResourceTiming', - 'PerformanceServerTiming', - 'PerformanceTiming', - 'PeriodicWave', - 'PermissionStatus', - 'Permissions', - 'PictureInPictureWindow', - 'Plugin', - 'PluginArray', - 'PointerEvent', - 'PopStateEvent', - 'ProcessingInstruction', - 'ProgressEvent', - 'Promise', - 'PromiseConstructorLike', - 'PromiseRejectionEvent', - 'PropertyDecorator', - 'PropertyKey', - 'Proxy', - 'PublicKeyCredential', - 'PushManager', - 'PushSubscription', - 'PushSubscriptionOptions', - 'RTCCertificate', - 'RTCDTMFSender', - 'RTCDTMFToneChangeEvent', - 'RTCDataChannel', - 'RTCDataChannelEvent', - 'RTCDtlsTransport', - 'RTCIceCandidate', - 'RTCIceTransport', - 'RTCPeerConnection', - 'RTCPeerConnectionIceErrorEvent', - 'RTCPeerConnectionIceEvent', - 'RTCRtpReceiver', - 'RTCRtpSender', - 'RTCRtpTransceiver', - 'RTCSessionDescription', - 'RTCStatsReport', - 'RTCTrackEvent', - 'RadioNodeList', - 'Range', - 'RangeError', - 'ReadableStream', - 'ReadableStreamDefaultController', - 'ReadableStreamDefaultReader', - 'ReferenceError', - 'Reflect', - 'RegExp', - 'RemotePlayback', - 'Request', - 'ResizeObserver', - 'ResizeObserverEntry', - 'ResizeObserverSize', - 'Response', - 'SVGAElement', - 'SVGAngle', - 'SVGAnimateElement', - 'SVGAnimateMotionElement', - 'SVGAnimateTransformElement', - 'SVGAnimatedAngle', - 'SVGAnimatedBoolean', - 'SVGAnimatedEnumeration', - 'SVGAnimatedInteger', - 'SVGAnimatedLength', - 'SVGAnimatedLengthList', - 'SVGAnimatedNumber', - 'SVGAnimatedNumberList', - 'SVGAnimatedPreserveAspectRatio', - 'SVGAnimatedRect', - 'SVGAnimatedString', - 'SVGAnimatedTransformList', - 'SVGAnimationElement', - 'SVGCircleElement', - 'SVGClipPathElement', - 'SVGComponentTransferFunctionElement', - 'SVGCursorElement', - 'SVGDefsElement', - 'SVGDescElement', - 'SVGElement', - 'SVGEllipseElement', - 'SVGFEBlendElement', - 'SVGFEColorMatrixElement', - 'SVGFEComponentTransferElement', - 'SVGFECompositeElement', - 'SVGFEConvolveMatrixElement', - 'SVGFEDiffuseLightingElement', - 'SVGFEDisplacementMapElement', - 'SVGFEDistantLightElement', - 'SVGFEDropShadowElement', - 'SVGFEFloodElement', - 'SVGFEFuncAElement', - 'SVGFEFuncBElement', - 'SVGFEFuncGElement', - 'SVGFEFuncRElement', - 'SVGFEGaussianBlurElement', - 'SVGFEImageElement', - 'SVGFEMergeElement', - 'SVGFEMergeNodeElement', - 'SVGFEMorphologyElement', - 'SVGFEOffsetElement', - 'SVGFEPointLightElement', - 'SVGFESpecularLightingElement', - 'SVGFESpotLightElement', - 'SVGFETileElement', - 'SVGFETurbulenceElement', - 'SVGFilterElement', - 'SVGForeignObjectElement', - 'SVGGElement', - 'SVGGeometryElement', - 'SVGGradientElement', - 'SVGGraphicsElement', - 'SVGImageElement', - 'SVGLength', - 'SVGLengthList', - 'SVGLineElement', - 'SVGLinearGradientElement', - 'SVGMPathElement', - 'SVGMarkerElement', - 'SVGMaskElement', - 'SVGMatrix', - 'SVGMetadataElement', - 'SVGNumber', - 'SVGNumberList', - 'SVGPathElement', - 'SVGPatternElement', - 'SVGPoint', - 'SVGPointList', - 'SVGPolygonElement', - 'SVGPolylineElement', - 'SVGPreserveAspectRatio', - 'SVGRadialGradientElement', - 'SVGRect', - 'SVGRectElement', - 'SVGSVGElement', - 'SVGScriptElement', - 'SVGSetElement', - 'SVGStopElement', - 'SVGStringList', - 'SVGStyleElement', - 'SVGSwitchElement', - 'SVGSymbolElement', - 'SVGTSpanElement', - 'SVGTextContentElement', - 'SVGTextElement', - 'SVGTextPathElement', - 'SVGTextPositioningElement', - 'SVGTitleElement', - 'SVGTransform', - 'SVGTransformList', - 'SVGUnitTypes', - 'SVGUseElement', - 'SVGViewElement', - 'SafeArray', - 'Screen', - 'ScreenOrientation', - 'ScriptProcessorNode', - 'SecurityPolicyViolationEvent', - 'Selection', - 'ServiceWorker', - 'ServiceWorkerContainer', - 'ServiceWorkerRegistration', - 'Set', - 'ShadowRoot', - 'SharedArrayBuffer', - 'SharedWorker', - 'SourceBuffer', - 'SourceBufferList', - 'SpeechRecognitionAlternative', - 'SpeechRecognitionErrorEvent', - 'SpeechRecognitionResult', - 'SpeechRecognitionResultList', - 'SpeechSynthesis', - 'SpeechSynthesisErrorEvent', - 'SpeechSynthesisEvent', - 'SpeechSynthesisUtterance', - 'SpeechSynthesisVoice', - 'StaticRange', - 'StereoPannerNode', - 'Storage', - 'StorageEvent', - 'StorageManager', - 'String', - 'StyleMedia', - 'StyleSheet', - 'StyleSheetList', - 'SubmitEvent', - 'SubtleCrypto', - 'Symbol', - 'SyntaxError', - 'Text', - 'TextDecoder', - 'TextDecoderStream', - 'TextEncoder', - 'TextEncoderStream', - 'TextMetrics', - 'TextTrack', - 'TextTrackCue', - 'TextTrackCueList', - 'TextTrackList', - 'TimeRanges', - 'Touch', - 'TouchEvent', - 'TouchList', - 'TrackEvent', - 'TransformStream', - 'TransformStreamDefaultController', - 'TransitionEvent', - 'TreeWalker', - 'TypeError', - 'UIEvent', - 'URIError', - 'URL', - 'URLSearchParams', - 'Uint16Array', - 'Uint32Array', - 'Uint8Array', - 'Uint8ClampedArray', - 'VBArray', - 'VTTCue', - 'VTTRegion', - 'ValidityState', - 'VarDate', - 'VideoPlaybackQuality', - 'VisualViewport', - 'WSH', - 'WScript', - 'WaveShaperNode', - 'WeakMap', - 'WeakRef', - 'WeakSet', - 'WebAssembly', - 'WebGL2RenderingContext', - 'WebGLActiveInfo', - 'WebGLBuffer', - 'WebGLContextEvent', - 'WebGLFramebuffer', - 'WebGLProgram', - 'WebGLQuery', - 'WebGLRenderbuffer', - 'WebGLRenderingContext', - 'WebGLSampler', - 'WebGLShader', - 'WebGLShaderPrecisionFormat', - 'WebGLSync', - 'WebGLTexture', - 'WebGLTransformFeedback', - 'WebGLUniformLocation', - 'WebGLVertexArrayObject', - 'WebKitCSSMatrix', - 'WebSocket', - 'WheelEvent', - 'Window', - 'Worker', - 'Worklet', - 'WritableStream', - 'WritableStreamDefaultController', - 'WritableStreamDefaultWriter', - 'XMLDocument', - 'XMLHttpRequest', - 'XMLHttpRequestEventTarget', - 'XMLHttpRequestUpload', - 'XMLSerializer', - 'XPathEvaluator', - 'XPathExpression', - 'XPathResult', - 'XSLTProcessor', - 'addEventListener', - 'alert', - 'atob', - 'blur', - 'btoa', - 'caches', - 'cancelAnimationFrame', - 'cancelIdleCallback', - 'captureEvents', - 'clearInterval', - 'clearTimeout', - 'close', - 'closed', - 'confirm', - 'console', - 'createImageBitmap', - 'crossOriginIsolated', - 'crypto', - 'customElements', - 'decodeURI', - 'decodeURIComponent', - 'devicePixelRatio', - 'dispatchEvent', - 'document', - 'encodeURI', - 'encodeURIComponent', - 'escape', - 'eval', - 'event', - 'external', - 'fetch', - 'focus', - 'frameElement', - 'frames', - 'getComputedStyle', - 'getSelection', - 'global', - 'globalThis', - 'history', - 'importScripts', - 'indexedDB', - 'innerHeight', - 'innerWidth', - 'isFinite', - 'isNaN', - 'isSecureContext', - 'length', - 'localStorage', - 'location', - 'locationbar', - 'matchMedia', - 'menubar', - 'moveBy', - 'moveTo', - 'name', - 'navigator', - 'onabort', - 'onafterprint', - 'onanimationcancel', - 'onanimationend', - 'onanimationiteration', - 'onanimationstart', - 'onauxclick', - 'onbeforeprint', - 'onbeforeunload', - 'onblur', - 'oncanplay', - 'oncanplaythrough', - 'onchange', - 'onclick', - 'onclose', - 'oncontextmenu', - 'oncuechange', - 'ondblclick', - 'ondevicemotion', - 'ondeviceorientation', - 'ondrag', - 'ondragend', - 'ondragenter', - 'ondragleave', - 'ondragover', - 'ondragstart', - 'ondrop', - 'ondurationchange', - 'onemptied', - 'onended', - 'onerror', - 'onfocus', - 'onformdata', - 'ongamepadconnected', - 'ongamepaddisconnected', - 'ongotpointercapture', - 'onhashchange', - 'oninput', - 'oninvalid', - 'onkeydown', - 'onkeypress', - 'onkeyup', - 'onlanguagechange', - 'onload', - 'onloadeddata', - 'onloadedmetadata', - 'onloadstart', - 'onlostpointercapture', - 'onmessage', - 'onmessageerror', - 'onmousedown', - 'onmouseenter', - 'onmouseleave', - 'onmousemove', - 'onmouseout', - 'onmouseover', - 'onmouseup', - 'onoffline', - 'ononline', - 'onorientationchange', - 'onpagehide', - 'onpageshow', - 'onpause', - 'onplay', - 'onplaying', - 'onpointercancel', - 'onpointerdown', - 'onpointerenter', - 'onpointerleave', - 'onpointermove', - 'onpointerout', - 'onpointerover', - 'onpointerup', - 'onpopstate', - 'onprogress', - 'onratechange', - 'onrejectionhandled', - 'onreset', - 'onresize', - 'onscroll', - 'onseeked', - 'onseeking', - 'onselect', - 'onselectionchange', - 'onselectstart', - 'onstalled', - 'onstorage', - 'onsubmit', - 'onsuspend', - 'ontimeupdate', - 'ontoggle', - 'ontouchcancel', - 'ontouchend', - 'ontouchmove', - 'ontouchstart', - 'ontransitioncancel', - 'ontransitionend', - 'ontransitionrun', - 'ontransitionstart', - 'onunhandledrejection', - 'onunload', - 'onvolumechange', - 'onwaiting', - 'onwebkitanimationend', - 'onwebkitanimationiteration', - 'onwebkitanimationstart', - 'onwebkittransitionend', - 'onwheel', - 'open', - 'opener', - 'orientation', - 'origin', - 'outerHeight', - 'outerWidth', - 'pageXOffset', - 'pageYOffset', - 'parent', - 'parseFloat', - 'parseInt', - 'performance', - 'personalbar', - 'postMessage', - 'print', - 'process', - 'prompt', - 'queueMicrotask', - 'releaseEvents', - 'removeEventListener', - 'requestAnimationFrame', - 'requestIdleCallback', - 'resizeBy', - 'resizeTo', - 'screen', - 'screenLeft', - 'screenTop', - 'screenX', - 'screenY', - 'scroll', - 'scrollBy', - 'scrollTo', - 'scrollX', - 'scrollY', - 'scrollbars', - 'self', - 'sessionStorage', - 'setInterval', - 'setTimeout', - 'speechSynthesis', - 'status', - 'statusbar', - 'stop', - 'toString', - 'toolbar', - 'top', - 'undefined', - 'unescape', - 'visualViewport', - 'webkitURL', - 'window' -]); - export const reserved = new Set([ 'arguments', 'await', From 3878915d1db208835f36a448d558c2def0d3a344 Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Mon, 15 Aug 2022 00:45:56 +0900 Subject: [PATCH 4/8] prevent to fetch same file multiple times --- scripts/globals-extractor.mjs | 14 ++++++++++---- src/compiler/utils/globals.ts | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/globals-extractor.mjs b/scripts/globals-extractor.mjs index c479418aad1..3728a4dfe47 100644 --- a/scripts/globals-extractor.mjs +++ b/scripts/globals-extractor.mjs @@ -9,6 +9,10 @@ see: https://github.com/microsoft/TypeScript/tree/main/lib import http from 'https'; import fs from 'fs'; +// MEMO: add additional objects/functions which existed in `src/compiler/utils/names.ts` +// before this script was introduced but could not be retrieved by this process. +const SPECIALS = ['global', 'globalThis', 'InternalError', 'process', 'undefined']; + const get_url = (name) => `https://raw.githubusercontent.com/microsoft/TypeScript/main/lib/lib.${name}.d.ts`; const extract_name = (split) => split.match(/^[a-zA-Z0-9_$]+/)[0]; @@ -20,7 +24,8 @@ const extract_functions_and_references = (data) => { const split = trimmed.replace(/[\s+]/, ' ').split(' '); if (split[0] === 'declare') functions.push(extract_name(split[2])); else if (trimmed.startsWith('/// new Promise((resolve, reject) => { }); }); +const fetched_names = new Set(); const get_functions = async (name) => { const res = []; + if (fetched_names.has(name)) return res; + fetched_names.add(name); const body = await do_get(get_url(name)); const { functions, references } = extract_functions_and_references(body); res.push(...functions); @@ -65,8 +73,6 @@ ${sorted.map((i) => `\t'${i}'`).join(',\n')} (async () => { const functions = await get_functions('es2021.full'); - // MEMO: add additional objects/functions which existed in `src/compiler/utils/names.ts` - // before this script was introduced but could not be retrieved by this process. - functions.push(...['global', 'globalThis', 'InternalError', 'process', 'undefined']); + functions.push(...SPECIALS); fs.writeFileSync('src/compiler/utils/globals.ts', build_output(functions)); })(); diff --git a/src/compiler/utils/globals.ts b/src/compiler/utils/globals.ts index 9406aee71d6..4ddcfea2cda 100644 --- a/src/compiler/utils/globals.ts +++ b/src/compiler/utils/globals.ts @@ -1,6 +1,6 @@ /** ---------------------------------------------------------------------- This file is automatically generated by `scripts/globals-extractor.mjs`. -Generated At: 2022-08-14T09:54:06.940Z +Generated At: 2022-08-14T15:28:31.556Z ---------------------------------------------------------------------- */ export default new Set([ From 29080a0704a1c482cc0bc66020f10cbd5c6bfc7c Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Mon, 15 Aug 2022 01:43:27 +0900 Subject: [PATCH 5/8] remove useless globals --- scripts/globals-extractor.mjs | 11 +++++++---- src/compiler/utils/globals.ts | 8 +------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/scripts/globals-extractor.mjs b/scripts/globals-extractor.mjs index 3728a4dfe47..07f3470e77c 100644 --- a/scripts/globals-extractor.mjs +++ b/scripts/globals-extractor.mjs @@ -16,14 +16,17 @@ const SPECIALS = ['global', 'globalThis', 'InternalError', 'process', 'undefined const get_url = (name) => `https://raw.githubusercontent.com/microsoft/TypeScript/main/lib/lib.${name}.d.ts`; const extract_name = (split) => split.match(/^[a-zA-Z0-9_$]+/)[0]; -const extract_functions_and_references = (data) => { +const extract_functions_and_references = (name, data) => { const functions = []; const references = []; data.split('\n').forEach(line => { const trimmed = line.trim(); const split = trimmed.replace(/[\s+]/, ' ').split(' '); - if (split[0] === 'declare') functions.push(extract_name(split[2])); - else if (trimmed.startsWith('/// { if (fetched_names.has(name)) return res; fetched_names.add(name); const body = await do_get(get_url(name)); - const { functions, references } = extract_functions_and_references(body); + const { functions, references } = extract_functions_and_references(name, body); res.push(...functions); const chile_functions = await Promise.all(references.map(get_functions)); chile_functions.forEach(i => res.push(...i)); diff --git a/src/compiler/utils/globals.ts b/src/compiler/utils/globals.ts index 4ddcfea2cda..e95f18db3da 100644 --- a/src/compiler/utils/globals.ts +++ b/src/compiler/utils/globals.ts @@ -1,6 +1,6 @@ /** ---------------------------------------------------------------------- This file is automatically generated by `scripts/globals-extractor.mjs`. -Generated At: 2022-08-14T15:28:31.556Z +Generated At: 2022-08-14T16:40:42.472Z ---------------------------------------------------------------------- */ export default new Set([ @@ -75,7 +75,6 @@ export default new Set([ 'ChannelMergerNode', 'ChannelSplitterNode', 'CharacterData', - 'ClassDecorator', 'ClientRect', 'Clipboard', 'ClipboardEvent', @@ -294,7 +293,6 @@ export default new Set([ 'MessageChannel', 'MessageEvent', 'MessagePort', - 'MethodDecorator', 'MimeType', 'MimeTypeArray', 'MouseEvent', @@ -319,7 +317,6 @@ export default new Set([ 'OverconstrainedError', 'PageTransitionEvent', 'PannerNode', - 'ParameterDecorator', 'Path2D', 'PaymentAddress', 'PaymentMethodChangeEvent', @@ -350,10 +347,7 @@ export default new Set([ 'ProcessingInstruction', 'ProgressEvent', 'Promise', - 'PromiseConstructorLike', 'PromiseRejectionEvent', - 'PropertyDecorator', - 'PropertyKey', 'Proxy', 'PublicKeyCredential', 'PushManager', From 433996ced94d9184b777fb07b178796d0a9bb49c Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Sun, 4 Sep 2022 00:13:02 +0900 Subject: [PATCH 6/8] stop to read declare type and support backward compatible --- scripts/globals-extractor.mjs | 24 +++++++++++++++++------- src/compiler/utils/globals.ts | 27 ++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/scripts/globals-extractor.mjs b/scripts/globals-extractor.mjs index 07f3470e77c..cabcba3e767 100644 --- a/scripts/globals-extractor.mjs +++ b/scripts/globals-extractor.mjs @@ -9,6 +9,8 @@ see: https://github.com/microsoft/TypeScript/tree/main/lib import http from 'https'; import fs from 'fs'; +const GLOBAL_TS_PATH = './src/compiler/utils/globals.ts'; + // MEMO: add additional objects/functions which existed in `src/compiler/utils/names.ts` // before this script was introduced but could not be retrieved by this process. const SPECIALS = ['global', 'globalThis', 'InternalError', 'process', 'undefined']; @@ -22,10 +24,8 @@ const extract_functions_and_references = (name, data) => { data.split('\n').forEach(line => { const trimmed = line.trim(); const split = trimmed.replace(/[\s+]/, ' ').split(' '); - if (split[0] === 'declare') { - // MEMO: ignore `declare type xxx` statement in lib.es5.d.ts. - // Because all of these are TypeScript types. (not exists in runtime.) - if (name !== 'es5' || split[1] !== 'type') functions.push(extract_name(split[2])); + if (split[0] === 'declare' && split[1] !== 'type') { + functions.push(extract_name(split[2])); } else if (trimmed.startsWith('/// `\t'${i}'`).join(',\n')} `.substring(1); }; +const get_exists_globals = () => { + const regexp = /^\s*["'](.+)["'],?\s*$/; + return fs.readFileSync(GLOBAL_TS_PATH, 'utf8') + .split('\n') + .filter(line => line.match(regexp)) + .map(line => line.match(regexp)[1]); +}; + (async () => { - const functions = await get_functions('es2021.full'); - functions.push(...SPECIALS); - fs.writeFileSync('src/compiler/utils/globals.ts', build_output(functions)); + const globals = get_exists_globals(); + const new_globals = await get_functions('es2021.full'); + globals.forEach((g) => new_globals.push(g)); + SPECIALS.forEach((g) => new_globals.push(g)); + fs.writeFileSync(GLOBAL_TS_PATH, build_output(new_globals)); })(); diff --git a/src/compiler/utils/globals.ts b/src/compiler/utils/globals.ts index e95f18db3da..657006d574d 100644 --- a/src/compiler/utils/globals.ts +++ b/src/compiler/utils/globals.ts @@ -1,6 +1,6 @@ /** ---------------------------------------------------------------------- This file is automatically generated by `scripts/globals-extractor.mjs`. -Generated At: 2022-08-14T16:40:42.472Z +Generated At: 2022-09-03T15:10:02.144Z ---------------------------------------------------------------------- */ export default new Set([ @@ -69,6 +69,7 @@ export default new Set([ 'CSSTransition', 'Cache', 'CacheStorage', + 'CanvasCaptureMediaStreamTrack', 'CanvasGradient', 'CanvasPattern', 'CanvasRenderingContext2D', @@ -120,11 +121,13 @@ export default new Set([ 'DragEvent', 'DynamicsCompressorNode', 'Element', + 'ElementInternals', 'Enumerator', 'Error', 'ErrorEvent', 'EvalError', 'Event', + 'EventCounts', 'EventSource', 'EventTarget', 'External', @@ -133,9 +136,12 @@ export default new Set([ 'FileReader', 'FileSystem', 'FileSystemDirectoryEntry', + 'FileSystemDirectoryHandle', 'FileSystemDirectoryReader', 'FileSystemEntry', 'FileSystemFileEntry', + 'FileSystemFileHandle', + 'FileSystemHandle', 'FinalizationRegistry', 'Float32Array', 'Float64Array', @@ -169,6 +175,7 @@ export default new Set([ 'HTMLDataElement', 'HTMLDataListElement', 'HTMLDetailsElement', + 'HTMLDialogElement', 'HTMLDirectoryElement', 'HTMLDivElement', 'HTMLDocument', @@ -251,6 +258,7 @@ export default new Set([ 'ImageBitmapRenderingContext', 'ImageData', 'Infinity', + 'InputDeviceInfo', 'InputEvent', 'Int16Array', 'Int32Array', @@ -263,6 +271,8 @@ export default new Set([ 'KeyboardEvent', 'KeyframeEffect', 'Location', + 'Lock', + 'LockManager', 'Map', 'Math', 'MathMLElement', @@ -301,6 +311,7 @@ export default new Set([ 'MutationRecord', 'NaN', 'NamedNodeMap', + 'NavigationPreloadManager', 'Navigator', 'NetworkInformation', 'Node', @@ -359,6 +370,10 @@ export default new Set([ 'RTCDataChannel', 'RTCDataChannelEvent', 'RTCDtlsTransport', + 'RTCEncodedAudioFrame', + 'RTCEncodedVideoFrame', + 'RTCError', + 'RTCErrorEvent', 'RTCIceCandidate', 'RTCIceTransport', 'RTCPeerConnection', @@ -367,13 +382,17 @@ export default new Set([ 'RTCRtpReceiver', 'RTCRtpSender', 'RTCRtpTransceiver', + 'RTCSctpTransport', 'RTCSessionDescription', 'RTCStatsReport', 'RTCTrackEvent', 'RadioNodeList', 'Range', 'RangeError', + 'ReadableByteStreamController', 'ReadableStream', + 'ReadableStreamBYOBReader', + 'ReadableStreamBYOBRequest', 'ReadableStreamDefaultController', 'ReadableStreamDefaultReader', 'ReferenceError', @@ -553,6 +572,7 @@ export default new Set([ 'VTTRegion', 'ValidityState', 'VarDate', + 'VideoColorSpace', 'VideoPlaybackQuality', 'VisualViewport', 'WSH', @@ -608,6 +628,7 @@ export default new Set([ 'captureEvents', 'clearInterval', 'clearTimeout', + 'clientInformation', 'close', 'closed', 'confirm', @@ -733,11 +754,13 @@ export default new Set([ 'onreset', 'onresize', 'onscroll', + 'onsecuritypolicyviolation', 'onseeked', 'onseeking', 'onselect', 'onselectionchange', 'onselectstart', + 'onslotchange', 'onstalled', 'onstorage', 'onsubmit', @@ -781,6 +804,7 @@ export default new Set([ 'queueMicrotask', 'releaseEvents', 'removeEventListener', + 'reportError', 'requestAnimationFrame', 'requestIdleCallback', 'resizeBy', @@ -804,6 +828,7 @@ export default new Set([ 'status', 'statusbar', 'stop', + 'structuredClone', 'toString', 'toolbar', 'top', From 0a6280786ef678e637ff3cf1be4a9e90e618eb53 Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Sun, 4 Sep 2022 00:23:16 +0900 Subject: [PATCH 7/8] use backslash --- scripts/globals-extractor.mjs | 4 ++-- src/compiler/utils/globals.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/globals-extractor.mjs b/scripts/globals-extractor.mjs index cabcba3e767..1c4274a0245 100644 --- a/scripts/globals-extractor.mjs +++ b/scripts/globals-extractor.mjs @@ -62,7 +62,7 @@ const get_functions = async (name) => { const build_output = (functions) => { const sorted = Array.from(new Set(functions.sort())); - return ` + return `\ /** ---------------------------------------------------------------------- This file is automatically generated by \`scripts/globals-extractor.mjs\`. Generated At: ${new Date().toISOString()} @@ -71,7 +71,7 @@ Generated At: ${new Date().toISOString()} export default new Set([ ${sorted.map((i) => `\t'${i}'`).join(',\n')} ]); -`.substring(1); +`; }; const get_exists_globals = () => { diff --git a/src/compiler/utils/globals.ts b/src/compiler/utils/globals.ts index 657006d574d..ee43af3b914 100644 --- a/src/compiler/utils/globals.ts +++ b/src/compiler/utils/globals.ts @@ -1,6 +1,6 @@ /** ---------------------------------------------------------------------- This file is automatically generated by `scripts/globals-extractor.mjs`. -Generated At: 2022-09-03T15:10:02.144Z +Generated At: 2022-09-03T15:22:37.415Z ---------------------------------------------------------------------- */ export default new Set([ From dda3784cd9ca4e783d547ebeb3b7020996cdca09 Mon Sep 17 00:00:00 2001 From: Yuichiro Yamashita Date: Sun, 4 Sep 2022 13:01:43 +0900 Subject: [PATCH 8/8] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b150bb169e..92155c0be89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Svelte changelog +## Unreleased + +* Add all global objects / functions ([#3805](https://github.com/sveltejs/svelte/issue/3805), [#7223](https://github.com/sveltejs/svelte/issue/7223), [#7240](https://github.com/sveltejs/svelte/issue/7240)) + ## 3.50.0 * Add a11y warnings: