diff --git a/.github/generated/ast_changes_watch_list.yml b/.github/generated/ast_changes_watch_list.yml index 99b3b0e0fe380..c7cb7f519d160 100644 --- a/.github/generated/ast_changes_watch_list.yml +++ b/.github/generated/ast_changes_watch_list.yml @@ -7,6 +7,7 @@ src: - 'apps/oxlint/src-js/generated/constants.ts' - 'apps/oxlint/src-js/generated/deserialize.d.ts' - 'apps/oxlint/src-js/generated/deserialize.js' + - 'apps/oxlint/src-js/generated/envs.ts' - 'apps/oxlint/src-js/generated/keys.ts' - 'apps/oxlint/src-js/generated/type_ids.ts' - 'apps/oxlint/src-js/generated/types.d.ts' diff --git a/Cargo.lock b/Cargo.lock index 90c3af25ae92b..8a00ab14b7241 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1835,6 +1835,7 @@ dependencies = [ "cow-utils", "indexmap", "itertools", + "javascript-globals", "lazy-regex", "oxc_allocator", "oxc_ast", diff --git a/apps/oxlint/src-js/generated/envs.ts b/apps/oxlint/src-js/generated/envs.ts new file mode 100644 index 0000000000000..d3341a119c99b --- /dev/null +++ b/apps/oxlint/src-js/generated/envs.ts @@ -0,0 +1,3053 @@ +// Auto-generated code, DO NOT EDIT DIRECTLY! +// To edit this generated file you have to edit `tasks/ast_tools/src/generators/oxlint_envs.rs`. + +/** + * Set of globals for an environment. + */ +export interface EnvPreset { + readonly: string[]; + writable: string[]; +} + +/** + * `amd` environment. + */ +export const ENV_AMD: EnvPreset = { + readonly: ["define", "require"], + writable: [], +}; + +/** + * `applescript` environment. + */ +export const ENV_APPLESCRIPT: EnvPreset = { + readonly: [ + "$", + "Application", + "Automation", + "Library", + "ObjC", + "ObjectSpecifier", + "Path", + "Progress", + "Ref", + "console", + "delay", + ], + writable: [], +}; + +/** + * `astro` environment. + */ +export const ENV_ASTRO: EnvPreset = { + readonly: ["Astro"], + writable: [], +}; + +/** + * `atomtest` environment. + */ +export const ENV_ATOMTEST: EnvPreset = { + readonly: [ + "advanceClock", + "atom", + "fakeClearInterval", + "fakeClearTimeout", + "fakeSetInterval", + "fakeSetTimeout", + "resetTimeouts", + "waitsForPromise", + ], + writable: [], +}; + +/** + * `browser` environment. + */ +export const ENV_BROWSER: EnvPreset = { + readonly: [ + "AI", + "AICreateMonitor", + "AITextSession", + "AbortController", + "AbortSignal", + "AbsoluteOrientationSensor", + "AbstractRange", + "Accelerometer", + "AnalyserNode", + "Animation", + "AnimationEffect", + "AnimationEvent", + "AnimationPlaybackEvent", + "AnimationTimeline", + "AsyncDisposableStack", + "Attr", + "Audio", + "AudioBuffer", + "AudioBufferSourceNode", + "AudioContext", + "AudioData", + "AudioDecoder", + "AudioDestinationNode", + "AudioEncoder", + "AudioListener", + "AudioNode", + "AudioParam", + "AudioParamMap", + "AudioProcessingEvent", + "AudioScheduledSourceNode", + "AudioSinkInfo", + "AudioWorklet", + "AudioWorkletGlobalScope", + "AudioWorkletNode", + "AudioWorkletProcessor", + "AuthenticatorAssertionResponse", + "AuthenticatorAttestationResponse", + "AuthenticatorResponse", + "BackgroundFetchManager", + "BackgroundFetchRecord", + "BackgroundFetchRegistration", + "BarProp", + "BarcodeDetector", + "BaseAudioContext", + "BatteryManager", + "BeforeUnloadEvent", + "BiquadFilterNode", + "Blob", + "BlobEvent", + "Bluetooth", + "BluetoothCharacteristicProperties", + "BluetoothDevice", + "BluetoothRemoteGATTCharacteristic", + "BluetoothRemoteGATTDescriptor", + "BluetoothRemoteGATTServer", + "BluetoothRemoteGATTService", + "BluetoothUUID", + "BroadcastChannel", + "BrowserCaptureMediaStreamTrack", + "ByteLengthQueuingStrategy", + "CDATASection", + "CSPViolationReportBody", + "CSS", + "CSSAnimation", + "CSSConditionRule", + "CSSContainerRule", + "CSSCounterStyleRule", + "CSSFontFaceRule", + "CSSFontFeatureValuesRule", + "CSSFontPaletteValuesRule", + "CSSFunctionDeclarations", + "CSSFunctionDescriptors", + "CSSFunctionRule", + "CSSGroupingRule", + "CSSImageValue", + "CSSImportRule", + "CSSKeyframeRule", + "CSSKeyframesRule", + "CSSKeywordValue", + "CSSLayerBlockRule", + "CSSLayerStatementRule", + "CSSMarginRule", + "CSSMathClamp", + "CSSMathInvert", + "CSSMathMax", + "CSSMathMin", + "CSSMathNegate", + "CSSMathProduct", + "CSSMathSum", + "CSSMathValue", + "CSSMatrixComponent", + "CSSMediaRule", + "CSSNamespaceRule", + "CSSNestedDeclarations", + "CSSNumericArray", + "CSSNumericValue", + "CSSPageDescriptors", + "CSSPageRule", + "CSSPerspective", + "CSSPositionTryDescriptors", + "CSSPositionTryRule", + "CSSPositionValue", + "CSSPropertyRule", + "CSSRotate", + "CSSRule", + "CSSRuleList", + "CSSScale", + "CSSScopeRule", + "CSSSkew", + "CSSSkewX", + "CSSSkewY", + "CSSStartingStyleRule", + "CSSStyleDeclaration", + "CSSStyleRule", + "CSSStyleSheet", + "CSSStyleValue", + "CSSSupportsRule", + "CSSTransformComponent", + "CSSTransformValue", + "CSSTransition", + "CSSTranslate", + "CSSUnitValue", + "CSSUnparsedValue", + "CSSVariableReferenceValue", + "CSSViewTransitionRule", + "Cache", + "CacheStorage", + "CanvasCaptureMediaStream", + "CanvasCaptureMediaStreamTrack", + "CanvasGradient", + "CanvasPattern", + "CanvasRenderingContext2D", + "CaptureController", + "CaretPosition", + "ChannelMergerNode", + "ChannelSplitterNode", + "ChapterInformation", + "CharacterBoundsUpdateEvent", + "CharacterData", + "Clipboard", + "ClipboardChangeEvent", + "ClipboardEvent", + "ClipboardItem", + "CloseEvent", + "CloseWatcher", + "CommandEvent", + "Comment", + "CompositionEvent", + "CompressionStream", + "ConstantSourceNode", + "ContentVisibilityAutoStateChangeEvent", + "ConvolverNode", + "CookieChangeEvent", + "CookieDeprecationLabel", + "CookieStore", + "CookieStoreManager", + "CountQueuingStrategy", + "CreateMonitor", + "Credential", + "CredentialsContainer", + "CropTarget", + "Crypto", + "CryptoKey", + "CustomElementRegistry", + "CustomEvent", + "CustomStateSet", + "DOMError", + "DOMException", + "DOMImplementation", + "DOMMatrix", + "DOMMatrixReadOnly", + "DOMParser", + "DOMPoint", + "DOMPointReadOnly", + "DOMQuad", + "DOMRect", + "DOMRectList", + "DOMRectReadOnly", + "DOMStringList", + "DOMStringMap", + "DOMTokenList", + "DataTransfer", + "DataTransferItem", + "DataTransferItemList", + "DecompressionStream", + "DelayNode", + "DelegatedInkTrailPresenter", + "DeviceMotionEvent", + "DeviceMotionEventAcceleration", + "DeviceMotionEventRotationRate", + "DeviceOrientationEvent", + "DevicePosture", + "DisposableStack", + "Document", + "DocumentFragment", + "DocumentPictureInPicture", + "DocumentPictureInPictureEvent", + "DocumentTimeline", + "DocumentType", + "DragEvent", + "DynamicsCompressorNode", + "EditContext", + "Element", + "ElementInternals", + "EncodedAudioChunk", + "EncodedVideoChunk", + "ErrorEvent", + "Event", + "EventCounts", + "EventSource", + "EventTarget", + "External", + "EyeDropper", + "FeaturePolicy", + "FederatedCredential", + "Fence", + "FencedFrameConfig", + "FetchLaterResult", + "File", + "FileList", + "FileReader", + "FileSystem", + "FileSystemDirectoryEntry", + "FileSystemDirectoryHandle", + "FileSystemDirectoryReader", + "FileSystemEntry", + "FileSystemFileEntry", + "FileSystemFileHandle", + "FileSystemHandle", + "FileSystemObserver", + "FileSystemWritableFileStream", + "FocusEvent", + "FontData", + "FontFace", + "FontFaceSet", + "FontFaceSetLoadEvent", + "FormData", + "FormDataEvent", + "FragmentDirective", + "GPU", + "GPUAdapter", + "GPUAdapterInfo", + "GPUBindGroup", + "GPUBindGroupLayout", + "GPUBuffer", + "GPUBufferUsage", + "GPUCanvasContext", + "GPUColorWrite", + "GPUCommandBuffer", + "GPUCommandEncoder", + "GPUCompilationInfo", + "GPUCompilationMessage", + "GPUComputePassEncoder", + "GPUComputePipeline", + "GPUDevice", + "GPUDeviceLostInfo", + "GPUError", + "GPUExternalTexture", + "GPUInternalError", + "GPUMapMode", + "GPUOutOfMemoryError", + "GPUPipelineError", + "GPUPipelineLayout", + "GPUQuerySet", + "GPUQueue", + "GPURenderBundle", + "GPURenderBundleEncoder", + "GPURenderPassEncoder", + "GPURenderPipeline", + "GPUSampler", + "GPUShaderModule", + "GPUShaderStage", + "GPUSupportedFeatures", + "GPUSupportedLimits", + "GPUTexture", + "GPUTextureUsage", + "GPUTextureView", + "GPUUncapturedErrorEvent", + "GPUValidationError", + "GainNode", + "Gamepad", + "GamepadAxisMoveEvent", + "GamepadButton", + "GamepadButtonEvent", + "GamepadEvent", + "GamepadHapticActuator", + "GamepadPose", + "Geolocation", + "GeolocationCoordinates", + "GeolocationPosition", + "GeolocationPositionError", + "GravitySensor", + "Gyroscope", + "HID", + "HIDConnectionEvent", + "HIDDevice", + "HIDInputReportEvent", + "HTMLAllCollection", + "HTMLAnchorElement", + "HTMLAreaElement", + "HTMLAudioElement", + "HTMLBRElement", + "HTMLBaseElement", + "HTMLBodyElement", + "HTMLButtonElement", + "HTMLCanvasElement", + "HTMLCollection", + "HTMLDListElement", + "HTMLDataElement", + "HTMLDataListElement", + "HTMLDetailsElement", + "HTMLDialogElement", + "HTMLDirectoryElement", + "HTMLDivElement", + "HTMLDocument", + "HTMLElement", + "HTMLEmbedElement", + "HTMLFencedFrameElement", + "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", + "HTMLSelectedContentElement", + "HTMLSlotElement", + "HTMLSourceElement", + "HTMLSpanElement", + "HTMLStyleElement", + "HTMLTableCaptionElement", + "HTMLTableCellElement", + "HTMLTableColElement", + "HTMLTableElement", + "HTMLTableRowElement", + "HTMLTableSectionElement", + "HTMLTemplateElement", + "HTMLTextAreaElement", + "HTMLTimeElement", + "HTMLTitleElement", + "HTMLTrackElement", + "HTMLUListElement", + "HTMLUnknownElement", + "HTMLVideoElement", + "HashChangeEvent", + "Headers", + "Highlight", + "HighlightRegistry", + "History", + "IDBCursor", + "IDBCursorWithValue", + "IDBDatabase", + "IDBFactory", + "IDBIndex", + "IDBKeyRange", + "IDBObjectStore", + "IDBOpenDBRequest", + "IDBRequest", + "IDBTransaction", + "IDBVersionChangeEvent", + "IIRFilterNode", + "IdentityCredential", + "IdentityCredentialError", + "IdentityProvider", + "IdleDeadline", + "IdleDetector", + "Image", + "ImageBitmap", + "ImageBitmapRenderingContext", + "ImageCapture", + "ImageData", + "ImageDecoder", + "ImageTrack", + "ImageTrackList", + "Ink", + "InputDeviceCapabilities", + "InputDeviceInfo", + "InputEvent", + "IntegrityViolationReportBody", + "IntersectionObserver", + "IntersectionObserverEntry", + "Keyboard", + "KeyboardEvent", + "KeyboardLayoutMap", + "KeyframeEffect", + "LanguageDetector", + "LargestContentfulPaint", + "LaunchParams", + "LaunchQueue", + "LayoutShift", + "LayoutShiftAttribution", + "LinearAccelerationSensor", + "Location", + "Lock", + "LockManager", + "MIDIAccess", + "MIDIConnectionEvent", + "MIDIInput", + "MIDIInputMap", + "MIDIMessageEvent", + "MIDIOutput", + "MIDIOutputMap", + "MIDIPort", + "MathMLElement", + "MediaCapabilities", + "MediaCapabilitiesInfo", + "MediaDeviceInfo", + "MediaDevices", + "MediaElementAudioSourceNode", + "MediaEncryptedEvent", + "MediaError", + "MediaKeyError", + "MediaKeyMessageEvent", + "MediaKeySession", + "MediaKeyStatusMap", + "MediaKeySystemAccess", + "MediaKeys", + "MediaList", + "MediaMetadata", + "MediaQueryList", + "MediaQueryListEvent", + "MediaRecorder", + "MediaRecorderErrorEvent", + "MediaSession", + "MediaSource", + "MediaSourceHandle", + "MediaStream", + "MediaStreamAudioDestinationNode", + "MediaStreamAudioSourceNode", + "MediaStreamEvent", + "MediaStreamTrack", + "MediaStreamTrackAudioSourceNode", + "MediaStreamTrackAudioStats", + "MediaStreamTrackEvent", + "MediaStreamTrackGenerator", + "MediaStreamTrackProcessor", + "MediaStreamTrackVideoStats", + "MessageChannel", + "MessageEvent", + "MessagePort", + "MimeType", + "MimeTypeArray", + "ModelGenericSession", + "ModelManager", + "MouseEvent", + "MutationEvent", + "MutationObserver", + "MutationRecord", + "NamedNodeMap", + "NavigateEvent", + "Navigation", + "NavigationActivation", + "NavigationCurrentEntryChangeEvent", + "NavigationDestination", + "NavigationHistoryEntry", + "NavigationPreloadManager", + "NavigationTransition", + "Navigator", + "NavigatorLogin", + "NavigatorManagedData", + "NavigatorUAData", + "NetworkInformation", + "Node", + "NodeFilter", + "NodeIterator", + "NodeList", + "NotRestoredReasonDetails", + "NotRestoredReasons", + "Notification", + "NotifyPaintEvent", + "OTPCredential", + "Observable", + "OfflineAudioCompletionEvent", + "OfflineAudioContext", + "OffscreenCanvas", + "OffscreenCanvasRenderingContext2D", + "Option", + "OrientationSensor", + "OscillatorNode", + "OverconstrainedError", + "PERSISTENT", + "PageRevealEvent", + "PageSwapEvent", + "PageTransitionEvent", + "PannerNode", + "PasswordCredential", + "Path2D", + "PaymentAddress", + "PaymentManager", + "PaymentMethodChangeEvent", + "PaymentRequest", + "PaymentRequestUpdateEvent", + "PaymentResponse", + "Performance", + "PerformanceElementTiming", + "PerformanceEntry", + "PerformanceEventTiming", + "PerformanceLongAnimationFrameTiming", + "PerformanceLongTaskTiming", + "PerformanceMark", + "PerformanceMeasure", + "PerformanceNavigation", + "PerformanceNavigationTiming", + "PerformanceObserver", + "PerformanceObserverEntryList", + "PerformancePaintTiming", + "PerformanceResourceTiming", + "PerformanceScriptTiming", + "PerformanceServerTiming", + "PerformanceTiming", + "PeriodicSyncManager", + "PeriodicWave", + "PermissionStatus", + "Permissions", + "PictureInPictureEvent", + "PictureInPictureWindow", + "Plugin", + "PluginArray", + "PointerEvent", + "PopStateEvent", + "Presentation", + "PresentationAvailability", + "PresentationConnection", + "PresentationConnectionAvailableEvent", + "PresentationConnectionCloseEvent", + "PresentationConnectionList", + "PresentationReceiver", + "PresentationRequest", + "PressureObserver", + "PressureRecord", + "ProcessingInstruction", + "Profiler", + "ProgressEvent", + "PromiseRejectionEvent", + "ProtectedAudience", + "PublicKeyCredential", + "PushManager", + "PushSubscription", + "PushSubscriptionOptions", + "QuotaExceededError", + "RTCCertificate", + "RTCDTMFSender", + "RTCDTMFToneChangeEvent", + "RTCDataChannel", + "RTCDataChannelEvent", + "RTCDtlsTransport", + "RTCEncodedAudioFrame", + "RTCEncodedVideoFrame", + "RTCError", + "RTCErrorEvent", + "RTCIceCandidate", + "RTCIceTransport", + "RTCPeerConnection", + "RTCPeerConnectionIceErrorEvent", + "RTCPeerConnectionIceEvent", + "RTCRtpReceiver", + "RTCRtpScriptTransform", + "RTCRtpSender", + "RTCRtpTransceiver", + "RTCSctpTransport", + "RTCSessionDescription", + "RTCStatsReport", + "RTCTrackEvent", + "RadioNodeList", + "Range", + "ReadableByteStreamController", + "ReadableStream", + "ReadableStreamBYOBReader", + "ReadableStreamBYOBRequest", + "ReadableStreamDefaultController", + "ReadableStreamDefaultReader", + "RelativeOrientationSensor", + "RemotePlayback", + "ReportBody", + "ReportingObserver", + "Request", + "ResizeObserver", + "ResizeObserverEntry", + "ResizeObserverSize", + "Response", + "RestrictionTarget", + "SVGAElement", + "SVGAngle", + "SVGAnimateElement", + "SVGAnimateMotionElement", + "SVGAnimateTransformElement", + "SVGAnimatedAngle", + "SVGAnimatedBoolean", + "SVGAnimatedEnumeration", + "SVGAnimatedInteger", + "SVGAnimatedLength", + "SVGAnimatedLengthList", + "SVGAnimatedNumber", + "SVGAnimatedNumberList", + "SVGAnimatedPreserveAspectRatio", + "SVGAnimatedRect", + "SVGAnimatedString", + "SVGAnimatedTransformList", + "SVGAnimationElement", + "SVGCircleElement", + "SVGClipPathElement", + "SVGComponentTransferFunctionElement", + "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", + "Scheduler", + "Scheduling", + "Screen", + "ScreenDetailed", + "ScreenDetails", + "ScreenOrientation", + "ScriptProcessorNode", + "ScrollTimeline", + "SecurityPolicyViolationEvent", + "Selection", + "Sensor", + "SensorErrorEvent", + "Serial", + "SerialPort", + "ServiceWorker", + "ServiceWorkerContainer", + "ServiceWorkerRegistration", + "ShadowRoot", + "SharedStorage", + "SharedStorageAppendMethod", + "SharedStorageClearMethod", + "SharedStorageDeleteMethod", + "SharedStorageModifierMethod", + "SharedStorageSetMethod", + "SharedStorageWorklet", + "SharedWorker", + "SnapEvent", + "SourceBuffer", + "SourceBufferList", + "SpeechGrammar", + "SpeechGrammarList", + "SpeechRecognition", + "SpeechRecognitionErrorEvent", + "SpeechRecognitionEvent", + "SpeechSynthesis", + "SpeechSynthesisErrorEvent", + "SpeechSynthesisEvent", + "SpeechSynthesisUtterance", + "SpeechSynthesisVoice", + "StaticRange", + "StereoPannerNode", + "Storage", + "StorageBucket", + "StorageBucketManager", + "StorageEvent", + "StorageManager", + "StylePropertyMap", + "StylePropertyMapReadOnly", + "StyleSheet", + "StyleSheetList", + "SubmitEvent", + "Subscriber", + "SubtleCrypto", + "Summarizer", + "SuppressedError", + "SyncManager", + "TEMPORARY", + "TaskAttributionTiming", + "TaskController", + "TaskPriorityChangeEvent", + "TaskSignal", + "Text", + "TextDecoder", + "TextDecoderStream", + "TextEncoder", + "TextEncoderStream", + "TextEvent", + "TextFormat", + "TextFormatUpdateEvent", + "TextMetrics", + "TextTrack", + "TextTrackCue", + "TextTrackCueList", + "TextTrackList", + "TextUpdateEvent", + "TimeEvent", + "TimeRanges", + "ToggleEvent", + "Touch", + "TouchEvent", + "TouchList", + "TrackEvent", + "TransformStream", + "TransformStreamDefaultController", + "TransitionEvent", + "Translator", + "TreeWalker", + "TrustedHTML", + "TrustedScript", + "TrustedScriptURL", + "TrustedTypePolicy", + "TrustedTypePolicyFactory", + "UIEvent", + "URL", + "URLPattern", + "URLSearchParams", + "USB", + "USBAlternateInterface", + "USBConfiguration", + "USBConnectionEvent", + "USBDevice", + "USBEndpoint", + "USBInTransferResult", + "USBInterface", + "USBIsochronousInTransferPacket", + "USBIsochronousInTransferResult", + "USBIsochronousOutTransferPacket", + "USBIsochronousOutTransferResult", + "USBOutTransferResult", + "UserActivation", + "VTTCue", + "VTTRegion", + "ValidityState", + "VideoColorSpace", + "VideoDecoder", + "VideoEncoder", + "VideoFrame", + "VideoPlaybackQuality", + "ViewTimeline", + "ViewTransition", + "ViewTransitionTypeSet", + "Viewport", + "VirtualKeyboard", + "VirtualKeyboardGeometryChangeEvent", + "VisibilityStateEntry", + "VisualViewport", + "WGSLLanguageFeatures", + "WakeLock", + "WakeLockSentinel", + "WaveShaperNode", + "WebAssembly", + "WebGL2RenderingContext", + "WebGLActiveInfo", + "WebGLBuffer", + "WebGLContextEvent", + "WebGLFramebuffer", + "WebGLObject", + "WebGLProgram", + "WebGLQuery", + "WebGLRenderbuffer", + "WebGLRenderingContext", + "WebGLSampler", + "WebGLShader", + "WebGLShaderPrecisionFormat", + "WebGLSync", + "WebGLTexture", + "WebGLTransformFeedback", + "WebGLUniformLocation", + "WebGLVertexArrayObject", + "WebSocket", + "WebSocketError", + "WebSocketStream", + "WebTransport", + "WebTransportBidirectionalStream", + "WebTransportDatagramDuplexStream", + "WebTransportError", + "WebTransportReceiveStream", + "WebTransportSendStream", + "WheelEvent", + "Window", + "WindowControlsOverlay", + "WindowControlsOverlayGeometryChangeEvent", + "Worker", + "Worklet", + "WorkletGlobalScope", + "WritableStream", + "WritableStreamDefaultController", + "WritableStreamDefaultWriter", + "XMLDocument", + "XMLHttpRequest", + "XMLHttpRequestEventTarget", + "XMLHttpRequestUpload", + "XMLSerializer", + "XPathEvaluator", + "XPathExpression", + "XPathResult", + "XRAnchor", + "XRAnchorSet", + "XRBoundedReferenceSpace", + "XRCPUDepthInformation", + "XRCamera", + "XRDOMOverlayState", + "XRDepthInformation", + "XRFrame", + "XRHand", + "XRHitTestResult", + "XRHitTestSource", + "XRInputSource", + "XRInputSourceArray", + "XRInputSourceEvent", + "XRInputSourcesChangeEvent", + "XRJointPose", + "XRJointSpace", + "XRLayer", + "XRLightEstimate", + "XRLightProbe", + "XRPose", + "XRRay", + "XRReferenceSpace", + "XRReferenceSpaceEvent", + "XRRenderState", + "XRRigidTransform", + "XRSession", + "XRSessionEvent", + "XRSpace", + "XRSystem", + "XRTransientInputHitTestResult", + "XRTransientInputHitTestSource", + "XRView", + "XRViewerPose", + "XRViewport", + "XRWebGLBinding", + "XRWebGLDepthInformation", + "XRWebGLLayer", + "XSLTProcessor", + "addEventListener", + "ai", + "alert", + "atob", + "blur", + "btoa", + "caches", + "cancelAnimationFrame", + "cancelIdleCallback", + "clearInterval", + "clearTimeout", + "clientInformation", + "close", + "closed", + "confirm", + "console", + "cookieStore", + "createImageBitmap", + "credentialless", + "crossOriginIsolated", + "crypto", + "currentFrame", + "currentTime", + "customElements", + "devicePixelRatio", + "dispatchEvent", + "document", + "documentPictureInPicture", + "event", + "external", + "fence", + "fetch", + "fetchLater", + "find", + "focus", + "frameElement", + "frames", + "getComputedStyle", + "getScreenDetails", + "getSelection", + "history", + "indexedDB", + "innerHeight", + "innerWidth", + "isSecureContext", + "launchQueue", + "length", + "localStorage", + "locationbar", + "matchMedia", + "menubar", + "model", + "moveBy", + "moveTo", + "name", + "navigation", + "navigator", + "offscreenBuffering", + "open", + "opener", + "origin", + "originAgentCluster", + "outerHeight", + "outerWidth", + "pageXOffset", + "pageYOffset", + "parent", + "performance", + "personalbar", + "postMessage", + "print", + "prompt", + "queryLocalFonts", + "queueMicrotask", + "registerProcessor", + "removeEventListener", + "reportError", + "requestAnimationFrame", + "requestIdleCallback", + "resizeBy", + "resizeTo", + "sampleRate", + "scheduler", + "screen", + "screenLeft", + "screenTop", + "screenX", + "screenY", + "scroll", + "scrollBy", + "scrollTo", + "scrollX", + "scrollY", + "scrollbars", + "self", + "sessionStorage", + "setInterval", + "setTimeout", + "sharedStorage", + "showDirectoryPicker", + "showOpenFilePicker", + "showSaveFilePicker", + "speechSynthesis", + "status", + "statusbar", + "stop", + "structuredClone", + "styleMedia", + "toolbar", + "top", + "trustedTypes", + "viewport", + "visualViewport", + "when", + "window", + ], + writable: [ + "location", + "onabort", + "onafterprint", + "onanimationcancel", + "onanimationend", + "onanimationiteration", + "onanimationstart", + "onappinstalled", + "onauxclick", + "onbeforeinput", + "onbeforeinstallprompt", + "onbeforematch", + "onbeforeprint", + "onbeforetoggle", + "onbeforeunload", + "onbeforexrselect", + "onblur", + "oncancel", + "oncanplay", + "oncanplaythrough", + "onchange", + "onclick", + "onclose", + "oncommand", + "oncontentvisibilityautostatechange", + "oncontextlost", + "oncontextmenu", + "oncontextrestored", + "oncopy", + "oncuechange", + "oncut", + "ondblclick", + "ondevicemotion", + "ondeviceorientation", + "ondeviceorientationabsolute", + "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", + "onmousewheel", + "onoffline", + "ononline", + "onpagehide", + "onpagereveal", + "onpageshow", + "onpageswap", + "onpaste", + "onpause", + "onplay", + "onplaying", + "onpointercancel", + "onpointerdown", + "onpointerenter", + "onpointerleave", + "onpointermove", + "onpointerout", + "onpointerover", + "onpointerrawupdate", + "onpointerup", + "onpopstate", + "onprogress", + "onratechange", + "onrejectionhandled", + "onreset", + "onresize", + "onscroll", + "onscrollend", + "onscrollsnapchange", + "onscrollsnapchanging", + "onsearch", + "onsecuritypolicyviolation", + "onseeked", + "onseeking", + "onselect", + "onselectionchange", + "onselectstart", + "onslotchange", + "onstalled", + "onstorage", + "onsubmit", + "onsuspend", + "ontimeupdate", + "ontoggle", + "ontransitioncancel", + "ontransitionend", + "ontransitionrun", + "ontransitionstart", + "onunhandledrejection", + "onunload", + "onvolumechange", + "onwaiting", + "onwheel", + ], +}; + +/** + * `builtin` environment. + */ +export const ENV_BUILTIN: EnvPreset = { + readonly: [ + "AggregateError", + "Array", + "ArrayBuffer", + "Atomics", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "Boolean", + "DataView", + "Date", + "Error", + "EvalError", + "FinalizationRegistry", + "Float16Array", + "Float32Array", + "Float64Array", + "Function", + "Infinity", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Iterator", + "JSON", + "Map", + "Math", + "NaN", + "Number", + "Object", + "Promise", + "Proxy", + "RangeError", + "ReferenceError", + "Reflect", + "RegExp", + "Set", + "SharedArrayBuffer", + "String", + "Symbol", + "SyntaxError", + "TypeError", + "URIError", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakRef", + "WeakSet", + "decodeURI", + "decodeURIComponent", + "encodeURI", + "encodeURIComponent", + "escape", + "eval", + "globalThis", + "isFinite", + "isNaN", + "parseFloat", + "parseInt", + "undefined", + "unescape", + ], + writable: [], +}; + +/** + * `commonjs` environment. + */ +export const ENV_COMMONJS: EnvPreset = { + readonly: ["global", "module", "require"], + writable: ["exports"], +}; + +/** + * `embertest` environment. + */ +export const ENV_EMBERTEST: EnvPreset = { + readonly: [ + "andThen", + "click", + "currentPath", + "currentRouteName", + "currentURL", + "fillIn", + "find", + "findAll", + "findWithAssert", + "keyEvent", + "pauseTest", + "resumeTest", + "triggerEvent", + "visit", + "wait", + ], + writable: [], +}; + +/** + * `es2015` environment. + */ +export const ENV_ES_2015: EnvPreset = { + readonly: [ + "ArrayBuffer", + "DataView", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakSet", + ], + writable: [], +}; + +/** + * `es2016` environment. + */ +export const ENV_ES_2016: EnvPreset = { + readonly: [ + "ArrayBuffer", + "DataView", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakSet", + ], + writable: [], +}; + +/** + * `es2017` environment. + */ +export const ENV_ES_2017: EnvPreset = { + readonly: [ + "ArrayBuffer", + "Atomics", + "DataView", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "SharedArrayBuffer", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakSet", + ], + writable: [], +}; + +/** + * `es2018` environment. + */ +export const ENV_ES_2018: EnvPreset = { + readonly: [ + "ArrayBuffer", + "Atomics", + "DataView", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "SharedArrayBuffer", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakSet", + ], + writable: [], +}; + +/** + * `es2019` environment. + */ +export const ENV_ES_2019: EnvPreset = { + readonly: [ + "ArrayBuffer", + "Atomics", + "DataView", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "SharedArrayBuffer", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakSet", + ], + writable: [], +}; + +/** + * `es2020` environment. + */ +export const ENV_ES_2020: EnvPreset = { + readonly: [ + "ArrayBuffer", + "Atomics", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "DataView", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "SharedArrayBuffer", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakSet", + "globalThis", + ], + writable: [], +}; + +/** + * `es2021` environment. + */ +export const ENV_ES_2021: EnvPreset = { + readonly: [ + "AggregateError", + "ArrayBuffer", + "Atomics", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "DataView", + "FinalizationRegistry", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "SharedArrayBuffer", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakRef", + "WeakSet", + "globalThis", + ], + writable: [], +}; + +/** + * `es2022` environment. + */ +export const ENV_ES_2022: EnvPreset = { + readonly: [ + "AggregateError", + "ArrayBuffer", + "Atomics", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "DataView", + "FinalizationRegistry", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "SharedArrayBuffer", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakRef", + "WeakSet", + "globalThis", + ], + writable: [], +}; + +/** + * `es2023` environment. + */ +export const ENV_ES_2023: EnvPreset = { + readonly: [ + "AggregateError", + "ArrayBuffer", + "Atomics", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "DataView", + "FinalizationRegistry", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "SharedArrayBuffer", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakRef", + "WeakSet", + "globalThis", + ], + writable: [], +}; + +/** + * `es2024` environment. + */ +export const ENV_ES_2024: EnvPreset = { + readonly: [ + "AggregateError", + "ArrayBuffer", + "Atomics", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "DataView", + "FinalizationRegistry", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "SharedArrayBuffer", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakRef", + "WeakSet", + "globalThis", + ], + writable: [], +}; + +/** + * `es2025` environment. + */ +export const ENV_ES_2025: EnvPreset = { + readonly: [ + "AggregateError", + "ArrayBuffer", + "Atomics", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "DataView", + "FinalizationRegistry", + "Float16Array", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Iterator", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "SharedArrayBuffer", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakRef", + "WeakSet", + "globalThis", + ], + writable: [], +}; + +/** + * `es2026` environment. + */ +export const ENV_ES_2026: EnvPreset = { + readonly: [ + "AggregateError", + "ArrayBuffer", + "Atomics", + "BigInt", + "BigInt64Array", + "BigUint64Array", + "DataView", + "FinalizationRegistry", + "Float16Array", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Iterator", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "SharedArrayBuffer", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakRef", + "WeakSet", + "globalThis", + ], + writable: [], +}; + +/** + * `es6` environment. + */ +export const ENV_ES_6: EnvPreset = { + readonly: [ + "ArrayBuffer", + "DataView", + "Float32Array", + "Float64Array", + "Int16Array", + "Int32Array", + "Int8Array", + "Intl", + "Map", + "Promise", + "Proxy", + "Reflect", + "Set", + "Symbol", + "Uint16Array", + "Uint32Array", + "Uint8Array", + "Uint8ClampedArray", + "WeakMap", + "WeakSet", + ], + writable: [], +}; + +/** + * `greasemonkey` environment. + */ +export const ENV_GREASEMONKEY: EnvPreset = { + readonly: [ + "GM", + "GM_addElement", + "GM_addStyle", + "GM_addValueChangeListener", + "GM_deleteValue", + "GM_deleteValues", + "GM_download", + "GM_getResourceText", + "GM_getResourceURL", + "GM_getTab", + "GM_getTabs", + "GM_getValue", + "GM_getValues", + "GM_info", + "GM_listValues", + "GM_log", + "GM_notification", + "GM_openInTab", + "GM_registerMenuCommand", + "GM_removeValueChangeListener", + "GM_saveTab", + "GM_setClipboard", + "GM_setValue", + "GM_setValues", + "GM_unregisterMenuCommand", + "GM_xmlhttpRequest", + "cloneInto", + "createObjectIn", + "exportFunction", + "unsafeWindow", + ], + writable: [], +}; + +/** + * `jasmine` environment. + */ +export const ENV_JASMINE: EnvPreset = { + readonly: [ + "afterAll", + "afterEach", + "beforeAll", + "beforeEach", + "describe", + "expect", + "expectAsync", + "fail", + "fdescribe", + "fit", + "it", + "jasmine", + "pending", + "runs", + "spyOn", + "spyOnAllFunctions", + "spyOnProperty", + "waits", + "waitsFor", + "xdescribe", + "xit", + ], + writable: [], +}; + +/** + * `jest` environment. + */ +export const ENV_JEST: EnvPreset = { + readonly: [ + "afterAll", + "afterEach", + "beforeAll", + "beforeEach", + "describe", + "expect", + "fit", + "it", + "jest", + "test", + "xdescribe", + "xit", + "xtest", + ], + writable: [], +}; + +/** + * `jquery` environment. + */ +export const ENV_JQUERY: EnvPreset = { + readonly: ["$", "jQuery"], + writable: [], +}; + +/** + * `meteor` environment. + */ +export const ENV_METEOR: EnvPreset = { + readonly: [ + "$", + "Accounts", + "AccountsClient", + "AccountsCommon", + "AccountsServer", + "App", + "Assets", + "Blaze", + "Cordova", + "DDP", + "DDPRateLimiter", + "DDPServer", + "Deps", + "EJSON", + "Email", + "HTTP", + "Log", + "Match", + "Meteor", + "Mongo", + "MongoInternals", + "Npm", + "Package", + "Plugin", + "Random", + "ReactiveDict", + "ReactiveVar", + "Router", + "ServiceConfiguration", + "Session", + "Spacebars", + "Template", + "Tinytest", + "Tracker", + "UI", + "Utils", + "WebApp", + "WebAppInternals", + "check", + "process", + "share", + ], + writable: [], +}; + +/** + * `mocha` environment. + */ +export const ENV_MOCHA: EnvPreset = { + readonly: [ + "after", + "afterEach", + "before", + "beforeEach", + "context", + "describe", + "it", + "mocha", + "run", + "setup", + "specify", + "suite", + "suiteSetup", + "suiteTeardown", + "teardown", + "test", + "xcontext", + "xdescribe", + "xit", + "xspecify", + ], + writable: [], +}; + +/** + * `mongo` environment. + */ +export const ENV_MONGO: EnvPreset = { + readonly: [ + "BulkWriteResult", + "ISODate", + "Mongo", + "NumberInt", + "NumberLong", + "ObjectId", + "PlanCache", + "UUID", + "WriteResult", + "_isWindows", + "_rand", + "cat", + "cd", + "connect", + "db", + "getHostName", + "getMemInfo", + "hostname", + "listFiles", + "load", + "ls", + "md5sumFile", + "mkdir", + "print", + "printjson", + "pwd", + "quit", + "removeFile", + "rs", + "sh", + "version", + ], + writable: [], +}; + +/** + * `nashorn` environment. + */ +export const ENV_NASHORN: EnvPreset = { + readonly: [ + "JSAdapter", + "Java", + "JavaImporter", + "Packages", + "__DIR__", + "__FILE__", + "__LINE__", + "com", + "edu", + "exit", + "java", + "javafx", + "javax", + "load", + "loadWithNewGlobal", + "org", + "print", + "quit", + ], + writable: [], +}; + +/** + * `node` environment. + */ +export const ENV_NODE: EnvPreset = { + readonly: [ + "AbortController", + "AbortSignal", + "AsyncDisposableStack", + "Blob", + "BroadcastChannel", + "Buffer", + "ByteLengthQueuingStrategy", + "CloseEvent", + "CompressionStream", + "CountQueuingStrategy", + "Crypto", + "CryptoKey", + "CustomEvent", + "DOMException", + "DecompressionStream", + "DisposableStack", + "Event", + "EventTarget", + "File", + "FormData", + "Headers", + "MessageChannel", + "MessageEvent", + "MessagePort", + "Navigator", + "Performance", + "PerformanceEntry", + "PerformanceMark", + "PerformanceMeasure", + "PerformanceObserver", + "PerformanceObserverEntryList", + "PerformanceResourceTiming", + "ReadableByteStreamController", + "ReadableStream", + "ReadableStreamBYOBReader", + "ReadableStreamBYOBRequest", + "ReadableStreamDefaultController", + "ReadableStreamDefaultReader", + "Request", + "Response", + "SubtleCrypto", + "SuppressedError", + "TextDecoder", + "TextDecoderStream", + "TextEncoder", + "TextEncoderStream", + "TransformStream", + "TransformStreamDefaultController", + "URL", + "URLPattern", + "URLSearchParams", + "WebAssembly", + "WebSocket", + "WritableStream", + "WritableStreamDefaultController", + "WritableStreamDefaultWriter", + "__dirname", + "__filename", + "atob", + "btoa", + "clearImmediate", + "clearInterval", + "clearTimeout", + "console", + "crypto", + "fetch", + "global", + "module", + "navigator", + "performance", + "process", + "queueMicrotask", + "require", + "setImmediate", + "setInterval", + "setTimeout", + "structuredClone", + ], + writable: ["exports"], +}; + +/** + * `phantomjs` environment. + */ +export const ENV_PHANTOMJS: EnvPreset = { + readonly: [], + writable: ["WebPage", "console", "exports", "phantom", "require"], +}; + +/** + * `prototypejs` environment. + */ +export const ENV_PROTOTYPEJS: EnvPreset = { + readonly: [ + "$", + "$$", + "$A", + "$F", + "$H", + "$R", + "$break", + "$continue", + "$w", + "Abstract", + "Ajax", + "Autocompleter", + "Builder", + "Class", + "Control", + "Draggable", + "Draggables", + "Droppables", + "Effect", + "Element", + "Enumerable", + "Event", + "Field", + "Form", + "Hash", + "Insertion", + "ObjectRange", + "PeriodicalExecuter", + "Position", + "Prototype", + "Scriptaculous", + "Selector", + "Sortable", + "SortableObserver", + "Sound", + "Template", + "Toggle", + "Try", + ], + writable: [], +}; + +/** + * `protractor` environment. + */ +export const ENV_PROTRACTOR: EnvPreset = { + readonly: ["$", "$$", "By", "DartObject", "browser", "by", "element", "protractor"], + writable: [], +}; + +/** + * `qunit` environment. + */ +export const ENV_QUNIT: EnvPreset = { + readonly: [ + "QUnit", + "asyncTest", + "deepEqual", + "equal", + "expect", + "module", + "notDeepEqual", + "notEqual", + "notOk", + "notPropEqual", + "notStrictEqual", + "ok", + "propEqual", + "raises", + "start", + "stop", + "strictEqual", + "test", + "throws", + ], + writable: [], +}; + +/** + * `serviceworker` environment. + */ +export const ENV_SERVICEWORKER: EnvPreset = { + readonly: [ + "AI", + "AICreateMonitor", + "AbortController", + "AbortPaymentEvent", + "AbortSignal", + "AsyncDisposableStack", + "BackgroundFetchEvent", + "BackgroundFetchManager", + "BackgroundFetchRecord", + "BackgroundFetchRegistration", + "BackgroundFetchUpdateUIEvent", + "BarcodeDetector", + "Blob", + "BroadcastChannel", + "ByteLengthQueuingStrategy", + "CSSSkewX", + "CSSSkewY", + "Cache", + "CacheStorage", + "CanMakePaymentEvent", + "CanvasGradient", + "CanvasPattern", + "Client", + "Clients", + "CloseEvent", + "CompressionStream", + "CookieStore", + "CookieStoreManager", + "CountQueuingStrategy", + "CreateMonitor", + "CropTarget", + "Crypto", + "CryptoKey", + "CustomEvent", + "DOMException", + "DOMMatrix", + "DOMMatrixReadOnly", + "DOMPoint", + "DOMPointReadOnly", + "DOMQuad", + "DOMRect", + "DOMRectReadOnly", + "DOMStringList", + "DecompressionStream", + "DisposableStack", + "ErrorEvent", + "Event", + "EventSource", + "EventTarget", + "ExtendableCookieChangeEvent", + "ExtendableEvent", + "ExtendableMessageEvent", + "FetchEvent", + "File", + "FileList", + "FileReader", + "FileSystemDirectoryHandle", + "FileSystemFileHandle", + "FileSystemHandle", + "FileSystemWritableFileStream", + "FontFace", + "FormData", + "GPU", + "GPUAdapter", + "GPUAdapterInfo", + "GPUBindGroup", + "GPUBindGroupLayout", + "GPUBuffer", + "GPUBufferUsage", + "GPUCanvasContext", + "GPUColorWrite", + "GPUCommandBuffer", + "GPUCommandEncoder", + "GPUCompilationInfo", + "GPUCompilationMessage", + "GPUComputePassEncoder", + "GPUComputePipeline", + "GPUDevice", + "GPUDeviceLostInfo", + "GPUError", + "GPUExternalTexture", + "GPUInternalError", + "GPUMapMode", + "GPUOutOfMemoryError", + "GPUPipelineError", + "GPUPipelineLayout", + "GPUQuerySet", + "GPUQueue", + "GPURenderBundle", + "GPURenderBundleEncoder", + "GPURenderPassEncoder", + "GPURenderPipeline", + "GPUSampler", + "GPUShaderModule", + "GPUShaderStage", + "GPUSupportedFeatures", + "GPUSupportedLimits", + "GPUTexture", + "GPUTextureUsage", + "GPUTextureView", + "GPUUncapturedErrorEvent", + "GPUValidationError", + "Headers", + "IDBCursor", + "IDBCursorWithValue", + "IDBDatabase", + "IDBFactory", + "IDBIndex", + "IDBKeyRange", + "IDBObjectStore", + "IDBOpenDBRequest", + "IDBRequest", + "IDBTransaction", + "IDBVersionChangeEvent", + "ImageBitmap", + "ImageBitmapRenderingContext", + "ImageData", + "InstallEvent", + "LanguageDetector", + "Lock", + "LockManager", + "MediaCapabilities", + "MessageChannel", + "MessageEvent", + "MessagePort", + "NavigationPreloadManager", + "NavigatorUAData", + "NetworkInformation", + "Notification", + "NotificationEvent", + "Observable", + "OffscreenCanvas", + "OffscreenCanvasRenderingContext2D", + "Path2D", + "PaymentRequestEvent", + "Performance", + "PerformanceEntry", + "PerformanceMark", + "PerformanceMeasure", + "PerformanceObserver", + "PerformanceObserverEntryList", + "PerformanceResourceTiming", + "PerformanceServerTiming", + "PeriodicSyncEvent", + "PeriodicSyncManager", + "PermissionStatus", + "Permissions", + "PromiseRejectionEvent", + "PushEvent", + "PushManager", + "PushMessageData", + "PushSubscription", + "PushSubscriptionChangeEvent", + "PushSubscriptionOptions", + "QuotaExceededError", + "ReadableByteStreamController", + "ReadableStream", + "ReadableStreamBYOBReader", + "ReadableStreamBYOBRequest", + "ReadableStreamDefaultController", + "ReadableStreamDefaultReader", + "ReportBody", + "ReportingObserver", + "Request", + "Response", + "RestrictionTarget", + "Scheduler", + "SecurityPolicyViolationEvent", + "ServiceWorker", + "ServiceWorkerGlobalScope", + "ServiceWorkerRegistration", + "StorageBucket", + "StorageBucketManager", + "StorageManager", + "Subscriber", + "SubtleCrypto", + "SuppressedError", + "SyncEvent", + "SyncManager", + "TaskController", + "TaskPriorityChangeEvent", + "TaskSignal", + "TextDecoder", + "TextDecoderStream", + "TextEncoder", + "TextEncoderStream", + "TextMetrics", + "TransformStream", + "TransformStreamDefaultController", + "TrustedHTML", + "TrustedScript", + "TrustedScriptURL", + "TrustedTypePolicy", + "TrustedTypePolicyFactory", + "URL", + "URLPattern", + "URLSearchParams", + "UserActivation", + "WGSLLanguageFeatures", + "WebAssembly", + "WebGL2RenderingContext", + "WebGLActiveInfo", + "WebGLBuffer", + "WebGLContextEvent", + "WebGLFramebuffer", + "WebGLObject", + "WebGLProgram", + "WebGLQuery", + "WebGLRenderbuffer", + "WebGLRenderingContext", + "WebGLSampler", + "WebGLShader", + "WebGLShaderPrecisionFormat", + "WebGLSync", + "WebGLTexture", + "WebGLTransformFeedback", + "WebGLUniformLocation", + "WebGLVertexArrayObject", + "WebSocket", + "WebSocketError", + "WebSocketStream", + "WebTransport", + "WebTransportBidirectionalStream", + "WebTransportDatagramDuplexStream", + "WebTransportError", + "WindowClient", + "WorkerGlobalScope", + "WorkerLocation", + "WorkerNavigator", + "WritableStream", + "WritableStreamDefaultController", + "WritableStreamDefaultWriter", + "addEventListener", + "ai", + "atob", + "btoa", + "caches", + "clearInterval", + "clearTimeout", + "clients", + "console", + "cookieStore", + "createImageBitmap", + "crossOriginIsolated", + "crypto", + "dispatchEvent", + "fetch", + "fonts", + "importScripts", + "indexedDB", + "isSecureContext", + "location", + "navigator", + "origin", + "performance", + "queueMicrotask", + "registration", + "removeEventListener", + "reportError", + "scheduler", + "self", + "serviceWorker", + "setInterval", + "setTimeout", + "skipWaiting", + "structuredClone", + "trustedTypes", + "when", + ], + writable: [ + "onabortpayment", + "onactivate", + "onbackgroundfetchabort", + "onbackgroundfetchclick", + "onbackgroundfetchfail", + "onbackgroundfetchsuccess", + "oncanmakepayment", + "oncookiechange", + "onerror", + "onfetch", + "oninstall", + "onlanguagechange", + "onmessage", + "onmessageerror", + "onnotificationclick", + "onnotificationclose", + "onpaymentrequest", + "onperiodicsync", + "onpush", + "onpushsubscriptionchange", + "onrejectionhandled", + "onsync", + "onunhandledrejection", + ], +}; + +/** + * `shared-node-browser` environment. + */ +export const ENV_SHARED_NODE_BROWSER: EnvPreset = { + readonly: [ + "AbortController", + "AbortSignal", + "AsyncDisposableStack", + "Blob", + "BroadcastChannel", + "ByteLengthQueuingStrategy", + "CloseEvent", + "CompressionStream", + "CountQueuingStrategy", + "Crypto", + "CryptoKey", + "CustomEvent", + "DOMException", + "DecompressionStream", + "DisposableStack", + "Event", + "EventTarget", + "File", + "FormData", + "Headers", + "MessageChannel", + "MessageEvent", + "MessagePort", + "Navigator", + "Performance", + "PerformanceEntry", + "PerformanceMark", + "PerformanceMeasure", + "PerformanceObserver", + "PerformanceObserverEntryList", + "PerformanceResourceTiming", + "ReadableByteStreamController", + "ReadableStream", + "ReadableStreamBYOBReader", + "ReadableStreamBYOBRequest", + "ReadableStreamDefaultController", + "ReadableStreamDefaultReader", + "Request", + "Response", + "SubtleCrypto", + "SuppressedError", + "TextDecoder", + "TextDecoderStream", + "TextEncoder", + "TextEncoderStream", + "TransformStream", + "TransformStreamDefaultController", + "URL", + "URLPattern", + "URLSearchParams", + "WebAssembly", + "WebSocket", + "WritableStream", + "WritableStreamDefaultController", + "WritableStreamDefaultWriter", + "atob", + "btoa", + "clearInterval", + "clearTimeout", + "console", + "crypto", + "fetch", + "navigator", + "performance", + "queueMicrotask", + "setInterval", + "setTimeout", + "structuredClone", + ], + writable: [], +}; + +/** + * `shelljs` environment. + */ +export const ENV_SHELLJS: EnvPreset = { + readonly: [ + "ShellString", + "cat", + "cd", + "chmod", + "cmd", + "config", + "cp", + "dirs", + "echo", + "env", + "error", + "errorCode", + "exec", + "exit", + "find", + "grep", + "head", + "ln", + "ls", + "mkdir", + "mv", + "popd", + "pushd", + "pwd", + "rm", + "sed", + "set", + "sort", + "tail", + "tempdir", + "test", + "touch", + "uniq", + "which", + ], + writable: [], +}; + +/** + * `svelte` environment. + */ +export const ENV_SVELTE: EnvPreset = { + readonly: ["$bindable", "$derived", "$effect", "$host", "$inspect", "$props", "$state"], + writable: [], +}; + +/** + * `vitest` environment. + */ +export const ENV_VITEST: EnvPreset = { + readonly: [ + "afterAll", + "afterEach", + "assert", + "assertType", + "beforeAll", + "beforeEach", + "chai", + "describe", + "expect", + "expectTypeOf", + "it", + "onTestFailed", + "onTestFinished", + "suite", + "test", + "vi", + "vitest", + ], + writable: [], +}; + +/** + * `vue` environment. + */ +export const ENV_VUE: EnvPreset = { + readonly: [ + "defineEmits", + "defineExpose", + "defineModel", + "defineOptions", + "defineProps", + "defineSlots", + "withDefaults", + ], + writable: [], +}; + +/** + * `webextensions` environment. + */ +export const ENV_WEBEXTENSIONS: EnvPreset = { + readonly: ["browser", "chrome", "opr"], + writable: [], +}; + +/** + * `worker` environment. + */ +export const ENV_WORKER: EnvPreset = { + readonly: [ + "AI", + "AICreateMonitor", + "AbortController", + "AbortSignal", + "AsyncDisposableStack", + "AudioData", + "AudioDecoder", + "AudioEncoder", + "BackgroundFetchManager", + "BackgroundFetchRecord", + "BackgroundFetchRegistration", + "BarcodeDetector", + "Blob", + "BroadcastChannel", + "ByteLengthQueuingStrategy", + "CSSSkewX", + "CSSSkewY", + "Cache", + "CacheStorage", + "CanvasGradient", + "CanvasPattern", + "CloseEvent", + "CompressionStream", + "CountQueuingStrategy", + "CreateMonitor", + "CropTarget", + "Crypto", + "CryptoKey", + "CustomEvent", + "DOMException", + "DOMMatrix", + "DOMMatrixReadOnly", + "DOMPoint", + "DOMPointReadOnly", + "DOMQuad", + "DOMRect", + "DOMRectReadOnly", + "DOMStringList", + "DecompressionStream", + "DedicatedWorkerGlobalScope", + "DisposableStack", + "EncodedAudioChunk", + "EncodedVideoChunk", + "ErrorEvent", + "Event", + "EventSource", + "EventTarget", + "File", + "FileList", + "FileReader", + "FileReaderSync", + "FileSystemDirectoryHandle", + "FileSystemFileHandle", + "FileSystemHandle", + "FileSystemObserver", + "FileSystemSyncAccessHandle", + "FileSystemWritableFileStream", + "FontFace", + "FormData", + "GPU", + "GPUAdapter", + "GPUAdapterInfo", + "GPUBindGroup", + "GPUBindGroupLayout", + "GPUBuffer", + "GPUBufferUsage", + "GPUCanvasContext", + "GPUColorWrite", + "GPUCommandBuffer", + "GPUCommandEncoder", + "GPUCompilationInfo", + "GPUCompilationMessage", + "GPUComputePassEncoder", + "GPUComputePipeline", + "GPUDevice", + "GPUDeviceLostInfo", + "GPUError", + "GPUExternalTexture", + "GPUInternalError", + "GPUMapMode", + "GPUOutOfMemoryError", + "GPUPipelineError", + "GPUPipelineLayout", + "GPUQuerySet", + "GPUQueue", + "GPURenderBundle", + "GPURenderBundleEncoder", + "GPURenderPassEncoder", + "GPURenderPipeline", + "GPUSampler", + "GPUShaderModule", + "GPUShaderStage", + "GPUSupportedFeatures", + "GPUSupportedLimits", + "GPUTexture", + "GPUTextureUsage", + "GPUTextureView", + "GPUUncapturedErrorEvent", + "GPUValidationError", + "HID", + "HIDConnectionEvent", + "HIDDevice", + "HIDInputReportEvent", + "Headers", + "IDBCursor", + "IDBCursorWithValue", + "IDBDatabase", + "IDBFactory", + "IDBIndex", + "IDBKeyRange", + "IDBObjectStore", + "IDBOpenDBRequest", + "IDBRequest", + "IDBTransaction", + "IDBVersionChangeEvent", + "IdleDetector", + "ImageBitmap", + "ImageBitmapRenderingContext", + "ImageData", + "ImageDecoder", + "ImageTrack", + "ImageTrackList", + "LanguageDetector", + "Lock", + "LockManager", + "MediaCapabilities", + "MediaSource", + "MediaSourceHandle", + "MessageChannel", + "MessageEvent", + "MessagePort", + "NavigationPreloadManager", + "NavigatorUAData", + "NetworkInformation", + "Notification", + "Observable", + "OffscreenCanvas", + "OffscreenCanvasRenderingContext2D", + "PERSISTENT", + "Path2D", + "Performance", + "PerformanceEntry", + "PerformanceMark", + "PerformanceMeasure", + "PerformanceObserver", + "PerformanceObserverEntryList", + "PerformanceResourceTiming", + "PerformanceServerTiming", + "PeriodicSyncManager", + "PermissionStatus", + "Permissions", + "PressureObserver", + "PressureRecord", + "ProgressEvent", + "PromiseRejectionEvent", + "PushManager", + "PushSubscription", + "PushSubscriptionOptions", + "QuotaExceededError", + "RTCDataChannel", + "RTCEncodedAudioFrame", + "RTCEncodedVideoFrame", + "ReadableByteStreamController", + "ReadableStream", + "ReadableStreamBYOBReader", + "ReadableStreamBYOBRequest", + "ReadableStreamDefaultController", + "ReadableStreamDefaultReader", + "ReportBody", + "ReportingObserver", + "Request", + "Response", + "RestrictionTarget", + "Scheduler", + "SecurityPolicyViolationEvent", + "Serial", + "SerialPort", + "ServiceWorkerRegistration", + "SourceBuffer", + "SourceBufferList", + "StorageBucket", + "StorageBucketManager", + "StorageManager", + "Subscriber", + "SubtleCrypto", + "SuppressedError", + "SyncManager", + "TEMPORARY", + "TaskController", + "TaskPriorityChangeEvent", + "TaskSignal", + "TextDecoder", + "TextDecoderStream", + "TextEncoder", + "TextEncoderStream", + "TextMetrics", + "TransformStream", + "TransformStreamDefaultController", + "TrustedHTML", + "TrustedScript", + "TrustedScriptURL", + "TrustedTypePolicy", + "TrustedTypePolicyFactory", + "URL", + "URLPattern", + "URLSearchParams", + "USB", + "USBAlternateInterface", + "USBConfiguration", + "USBConnectionEvent", + "USBDevice", + "USBEndpoint", + "USBInTransferResult", + "USBInterface", + "USBIsochronousInTransferPacket", + "USBIsochronousInTransferResult", + "USBIsochronousOutTransferPacket", + "USBIsochronousOutTransferResult", + "USBOutTransferResult", + "UserActivation", + "VideoColorSpace", + "VideoDecoder", + "VideoEncoder", + "VideoFrame", + "WGSLLanguageFeatures", + "WebAssembly", + "WebGL2RenderingContext", + "WebGLActiveInfo", + "WebGLBuffer", + "WebGLContextEvent", + "WebGLFramebuffer", + "WebGLObject", + "WebGLProgram", + "WebGLQuery", + "WebGLRenderbuffer", + "WebGLRenderingContext", + "WebGLSampler", + "WebGLShader", + "WebGLShaderPrecisionFormat", + "WebGLSync", + "WebGLTexture", + "WebGLTransformFeedback", + "WebGLUniformLocation", + "WebGLVertexArrayObject", + "WebSocket", + "WebSocketError", + "WebSocketStream", + "WebTransport", + "WebTransportBidirectionalStream", + "WebTransportDatagramDuplexStream", + "WebTransportError", + "Worker", + "WorkerGlobalScope", + "WorkerLocation", + "WorkerNavigator", + "WritableStream", + "WritableStreamDefaultController", + "WritableStreamDefaultWriter", + "XMLHttpRequest", + "XMLHttpRequestEventTarget", + "XMLHttpRequestUpload", + "addEventListener", + "ai", + "atob", + "btoa", + "caches", + "cancelAnimationFrame", + "clearInterval", + "clearTimeout", + "close", + "console", + "createImageBitmap", + "crossOriginIsolated", + "crypto", + "dispatchEvent", + "fetch", + "fonts", + "importScripts", + "indexedDB", + "isSecureContext", + "location", + "name", + "navigator", + "origin", + "performance", + "postMessage", + "queueMicrotask", + "removeEventListener", + "reportError", + "requestAnimationFrame", + "scheduler", + "self", + "setInterval", + "setTimeout", + "structuredClone", + "trustedTypes", + "webkitRequestFileSystem", + "webkitRequestFileSystemSync", + "webkitResolveLocalFileSystemSyncURL", + "webkitResolveLocalFileSystemURL", + "when", + ], + writable: [ + "onerror", + "onlanguagechange", + "onmessage", + "onmessageerror", + "onrejectionhandled", + "onunhandledrejection", + ], +}; + +/** + * `Map` of variables defined by environments. + */ +export const ENVS: Map = new Map([ + ["amd", ENV_AMD], + ["applescript", ENV_APPLESCRIPT], + ["astro", ENV_ASTRO], + ["atomtest", ENV_ATOMTEST], + ["browser", ENV_BROWSER], + ["builtin", ENV_BUILTIN], + ["commonjs", ENV_COMMONJS], + ["embertest", ENV_EMBERTEST], + ["es2015", ENV_ES_2015], + ["es2016", ENV_ES_2016], + ["es2017", ENV_ES_2017], + ["es2018", ENV_ES_2018], + ["es2019", ENV_ES_2019], + ["es2020", ENV_ES_2020], + ["es2021", ENV_ES_2021], + ["es2022", ENV_ES_2022], + ["es2023", ENV_ES_2023], + ["es2024", ENV_ES_2024], + ["es2025", ENV_ES_2025], + ["es2026", ENV_ES_2026], + ["es6", ENV_ES_6], + ["greasemonkey", ENV_GREASEMONKEY], + ["jasmine", ENV_JASMINE], + ["jest", ENV_JEST], + ["jquery", ENV_JQUERY], + ["meteor", ENV_METEOR], + ["mocha", ENV_MOCHA], + ["mongo", ENV_MONGO], + ["nashorn", ENV_NASHORN], + ["node", ENV_NODE], + ["phantomjs", ENV_PHANTOMJS], + ["prototypejs", ENV_PROTOTYPEJS], + ["protractor", ENV_PROTRACTOR], + ["qunit", ENV_QUNIT], + ["serviceworker", ENV_SERVICEWORKER], + ["shared-node-browser", ENV_SHARED_NODE_BROWSER], + ["shelljs", ENV_SHELLJS], + ["svelte", ENV_SVELTE], + ["vitest", ENV_VITEST], + ["vue", ENV_VUE], + ["webextensions", ENV_WEBEXTENSIONS], + ["worker", ENV_WORKER], +]); diff --git a/tasks/ast_tools/Cargo.toml b/tasks/ast_tools/Cargo.toml index dd08e509842f7..b4e37258136d1 100644 --- a/tasks/ast_tools/Cargo.toml +++ b/tasks/ast_tools/Cargo.toml @@ -36,6 +36,7 @@ convert_case = { workspace = true } cow-utils = { workspace = true } indexmap = { workspace = true } itertools = { workspace = true } +javascript-globals = { workspace = true } lazy-regex = { workspace = true } oxc_index = { workspace = true } phf = { workspace = true, features = ["macros"] } diff --git a/tasks/ast_tools/src/generators/mod.rs b/tasks/ast_tools/src/generators/mod.rs index f87e8e769b053..b7141bf03c340 100644 --- a/tasks/ast_tools/src/generators/mod.rs +++ b/tasks/ast_tools/src/generators/mod.rs @@ -12,6 +12,8 @@ mod estree_visit; mod formatter; mod get_id; #[cfg(feature = "generate-js")] +mod oxlint_envs; +#[cfg(feature = "generate-js")] mod raw_transfer; #[cfg(feature = "generate-js")] mod raw_transfer_lazy; @@ -29,6 +31,8 @@ pub use estree_visit::ESTreeVisitGenerator; pub use formatter::{FormatterAstNodesGenerator, FormatterFormatGenerator}; pub use get_id::GetIdGenerator; #[cfg(feature = "generate-js")] +pub use oxlint_envs::OxlintEnvsGenerator; +#[cfg(feature = "generate-js")] pub use raw_transfer::RawTransferGenerator; #[cfg(feature = "generate-js")] pub use raw_transfer_lazy::RawTransferLazyGenerator; diff --git a/tasks/ast_tools/src/generators/oxlint_envs.rs b/tasks/ast_tools/src/generators/oxlint_envs.rs new file mode 100644 index 0000000000000..8c10cfb09d241 --- /dev/null +++ b/tasks/ast_tools/src/generators/oxlint_envs.rs @@ -0,0 +1,95 @@ +//! Generator of envs for Oxlint JS plugins. + +use convert_case::{Case, Casing}; +use javascript_globals::GLOBALS; + +use crate::{ + Codegen, Generator, OXLINT_APP_PATH, + output::Output, + schema::Schema, + utils::{string, write_it}, +}; + +use super::define_generator; + +pub struct OxlintEnvsGenerator; + +define_generator!(OxlintEnvsGenerator); + +impl Generator for OxlintEnvsGenerator { + fn generate(&self, _schema: &Schema, _codegen: &Codegen) -> Output { + let code = generate(); + + Output::Javascript { path: format!("{OXLINT_APP_PATH}/src-js/generated/envs.ts"), code } + } +} + +/// Generate environment definitions. +fn generate() -> String { + #[rustfmt::skip] + let mut out = string!(" + /** + * Set of globals for an environment. + */ + export interface EnvPreset { + readonly: string[]; + writable: string[]; + } + "); + + #[rustfmt::skip] + let mut map = string!(" + /** + * `Map` of variables defined by environments. + */ + export const ENVS: Map = new Map([ + "); + + let mut envs = GLOBALS.entries().collect::>(); + envs.sort_unstable_by_key(|(key, _)| **key); + + for (&name, vars) in envs { + let const_name = format!("ENV_{}", name.to_case(Case::UpperSnake)); + + let mut readonly_names = vec![]; + let mut writable_names = vec![]; + + for (&var_name, &is_writable) in vars { + if is_writable { + writable_names.push(var_name); + } else { + readonly_names.push(var_name); + } + } + + #[rustfmt::skip] + write_it!(out, " + /** + * `{name}` environment. + */ + export const {const_name}: EnvPreset = {{ + readonly: [ + "); + + if !readonly_names.is_empty() { + readonly_names.sort_unstable(); + write_it!(out, "\"{}\",\n", readonly_names.join("\",\n\"")); + } + + out.push_str("],\nwritable: [\n"); + + if !writable_names.is_empty() { + writable_names.sort_unstable(); + write_it!(out, "\"{}\",\n", writable_names.join("\",\n\"")); + } + + out.push_str("],\n};\n\n"); + + write_it!(map, "[\"{name}\", {const_name}],\n"); + } + + map.push_str("]);\n"); + out.push_str(&map); + + out +} diff --git a/tasks/ast_tools/src/main.rs b/tasks/ast_tools/src/main.rs index 98dd28dc68cb4..a454c6ae5ba91 100644 --- a/tasks/ast_tools/src/main.rs +++ b/tasks/ast_tools/src/main.rs @@ -290,6 +290,8 @@ const GENERATORS: &[&(dyn Generator + Sync)] = &[ #[cfg(feature = "generate-js")] &generators::ESTreeVisitGenerator, #[cfg(feature = "generate-js")] + &generators::OxlintEnvsGenerator, + #[cfg(feature = "generate-js")] &generators::RawTransferGenerator, #[cfg(feature = "generate-js")] &generators::RawTransferLazyGenerator,