UNPKG

@wc-toolkit/cem-validator

Version:

A tool to validate the content of the Custom Elements Manifest to ensure the CEM and components are properly configured.

2,599 lines 67.7 kB
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/index.ts
var index_exports = {};
__export(index_exports, {
  cemValidatorPlugin: () => cemValidatorPlugin,
  failures: () => failures,
  testCemPublished: () => testCemPublished,
  testComponentDefinitionPath: () => testComponentDefinitionPath,
  testComponentExportTypes: () => testComponentExportTypes,
  testComponentModulePath: () => testComponentModulePath,
  testComponentTagName: () => testComponentTagName,
  testComponentTypeDefinitionPath: () => testComponentTypeDefinitionPath,
  testComponents: () => testComponents,
  testCustomElementsProperty: () => testCustomElementsProperty,
  testExportsProperty: () => testExportsProperty,
  testMainProperty: () => testMainProperty,
  testManifest: () => testManifest,
  testPackageJson: () => testPackageJson,
  testPackageType: () => testPackageType,
  testSchemaVersion: () => testSchemaVersion,
  testTypesProperty: () => testTypesProperty,
  validateCem: () => validateCem
});
module.exports = __toCommonJS(index_exports);

// src/logger.ts
var Logger = class {
  #debug;
  constructor(debug = false) {
    this.#debug = debug;
  }
  log(message, color = "\x1B[30m%s\x1B[0m", overrideDebug = false) {
    if (!this.#debug && !overrideDebug) {
      return;
    }
    console.log(color, message);
  }
  red(message, overrideDebug = false) {
    this.log(message, "\x1B[31m%s\x1B[0m", overrideDebug);
  }
  green(message, overrideDebug = false) {
    this.log(message, "\x1B[32m%s\x1B[0m", overrideDebug);
  }
  yellow(message, overrideDebug = false) {
    this.log(message, "\x1B[33m%s\x1B[0m", overrideDebug);
  }
  blue(message, overrideDebug = false) {
    this.log(message, "\x1B[34m%s\x1B[0m", overrideDebug);
  }
  magenta(message, overrideDebug = false) {
    this.log(message, "\x1B[35m%s\x1B[0m", overrideDebug);
  }
  cyan(message, overrideDebug = false) {
    this.log(message, "\x1B[36m%s\x1B[0m", overrideDebug);
  }
};

// node_modules/.pnpm/@wc-toolkit+cem-utilities@1.2.0/node_modules/@wc-toolkit/cem-utilities/dist/index.js
function getComponentPublicProperties(component) {
  return component?.members?.filter(
    (member) => member.kind === "field" && member.privacy !== "private" && member.privacy !== "protected" && !member.static && !member.name.startsWith("#")
  ) || [];
}
function getComponentPublicMethods(component) {
  const getParameter = (p) => p.name + getParamType(p) + getParamDefaultValue(p);
  const getParamType = (p) => p.type?.text ? `${p.optional ? "?" : ""}: ${p.type?.text}` : "";
  const getParamDefaultValue = (p) => p.default ? ` = ${p.default}` : "";
  return (
    // filter to return only public methods
    component?.members?.filter(
      (member) => member.kind === "method" && member.privacy !== "private" && member.privacy !== "protected" && !member.name.startsWith("#")
    )?.map((m) => {
      m.type = {
        text: `${m.name}(${m.parameters?.map((p) => getParameter(p)).join(", ") || ""}) => ${m.return?.type?.text || "void"}`
      };
      return m;
    })
  );
}
function deepMerge(target, source) {
  if (typeof target !== "object" || target === null) {
    return source;
  }
  if (typeof source !== "object" || source === null) {
    return target;
  }
  const targetObj = target;
  const sourceObj = source;
  for (const key of Object.keys(source)) {
    if (sourceObj[key] instanceof Array) {
      if (!targetObj[key]) {
        targetObj[key] = [];
      }
      targetObj[key] = targetObj[key].concat(sourceObj[key]);
    } else if (sourceObj[key] instanceof Object) {
      if (!targetObj[key]) {
        targetObj[key] = {};
      }
      targetObj[key] = deepMerge(targetObj[key], sourceObj[key]);
    } else {
      targetObj[key] = sourceObj[key];
    }
  }
  return targetObj;
}

// src/utilities.ts
var import_fs = __toESM(require("fs"), 1);

// src/generated-types.ts
var NATIVE_EVENT_TYPES = [
  "AnimationEvent",
  "AnimationPlaybackEvent",
  "AudioProcessingEvent",
  "BeforeUnloadEvent",
  "BlobEvent",
  "ClipboardEvent",
  "CloseEvent",
  "CompositionEvent",
  "ContentVisibilityAutoStateChangeEvent",
  "CustomEvent",
  "DeviceMotionEvent",
  "DeviceOrientationEvent",
  "DragEvent",
  "ErrorEvent",
  "Event",
  "ExtendableEvent",
  "ExtendableMessageEvent",
  "FetchEvent",
  "FocusEvent",
  "FontFaceSetLoadEvent",
  "FormDataEvent",
  "GamepadEvent",
  "HashChangeEvent",
  "IDBVersionChangeEvent",
  "InputEvent",
  "KeyboardEvent",
  "MIDIConnectionEvent",
  "MIDIMessageEvent",
  "MediaEncryptedEvent",
  "MediaKeyMessageEvent",
  "MediaQueryListEvent",
  "MediaStreamTrackEvent",
  "MessageEvent",
  "MouseEvent",
  "NotificationEvent",
  "OfflineAudioCompletionEvent",
  "PageTransitionEvent",
  "PaymentMethodChangeEvent",
  "PaymentRequestUpdateEvent",
  "PictureInPictureEvent",
  "PointerEvent",
  "PopStateEvent",
  "ProgressEvent",
  "PromiseRejectionEvent",
  "PushEvent",
  "RTCDTMFToneChangeEvent",
  "RTCDataChannelEvent",
  "RTCErrorEvent",
  "RTCPeerConnectionIceErrorEvent",
  "RTCPeerConnectionIceEvent",
  "RTCTrackEvent",
  "RTCTransformEvent",
  "SecurityPolicyViolationEvent",
  "SpeechSynthesisErrorEvent",
  "SpeechSynthesisEvent",
  "StorageEvent",
  "SubmitEvent",
  "TextEvent",
  "ToggleEvent",
  "TouchEvent",
  "TrackEvent",
  "TransitionEvent",
  "UIEvent",
  "WebGLContextEvent",
  "WheelEvent"
];
var NATIVE_JS_TYPES = [
  "ANGLE_instanced_arrays",
  "ARIAMixin",
  "AbortController",
  "AbortSignal",
  "AbortSignalEventMap",
  "AbstractRange",
  "AbstractWorker",
  "AbstractWorkerEventMap",
  "ActiveXObject",
  "AddEventListenerOptions",
  "AddressErrors",
  "AesCbcParams",
  "AesCtrParams",
  "AesDerivedKeyParams",
  "AesGcmParams",
  "AesKeyAlgorithm",
  "AesKeyGenParams",
  "AggregateError",
  "AggregateErrorConstructor",
  "Algorithm",
  "AlgorithmIdentifier",
  "AlignSetting",
  "AllowSharedBufferSource",
  "AlphaOption",
  "AnalyserNode",
  "AnalyserOptions",
  "Animatable",
  "Animation",
  "AnimationEffect",
  "AnimationEvent",
  "AnimationEventInit",
  "AnimationEventMap",
  "AnimationFrameProvider",
  "AnimationPlayState",
  "AnimationPlaybackEvent",
  "AnimationPlaybackEventInit",
  "AnimationReplaceState",
  "AnimationTimeline",
  "AppendMode",
  "Array",
  "ArrayBuffer",
  "ArrayBufferConstructor",
  "ArrayBufferLike",
  "ArrayBufferTypes",
  "ArrayBufferView",
  "ArrayConstructor",
  "ArrayIterator",
  "ArrayLike",
  "AssignedNodesOptions",
  "AsyncDisposable",
  "AsyncDisposableStack",
  "AsyncDisposableStackConstructor",
  "AsyncGenerator",
  "AsyncGeneratorFunction",
  "AsyncGeneratorFunctionConstructor",
  "AsyncIterable",
  "AsyncIterableIterator",
  "AsyncIterator",
  "AsyncIteratorObject",
  "Atomics",
  "AttestationConveyancePreference",
  "Attr",
  "AudioBuffer",
  "AudioBufferOptions",
  "AudioBufferSourceNode",
  "AudioBufferSourceOptions",
  "AudioConfiguration",
  "AudioContext",
  "AudioContextLatencyCategory",
  "AudioContextOptions",
  "AudioContextState",
  "AudioData",
  "AudioDataCopyToOptions",
  "AudioDataInit",
  "AudioDataOutputCallback",
  "AudioDecoder",
  "AudioDecoderConfig",
  "AudioDecoderEventMap",
  "AudioDecoderInit",
  "AudioDecoderSupport",
  "AudioDestinationNode",
  "AudioEncoder",
  "AudioEncoderConfig",
  "AudioEncoderEventMap",
  "AudioEncoderInit",
  "AudioEncoderSupport",
  "AudioListener",
  "AudioNode",
  "AudioNodeOptions",
  "AudioParam",
  "AudioParamMap",
  "AudioProcessingEvent",
  "AudioProcessingEventInit",
  "AudioSampleFormat",
  "AudioScheduledSourceNode",
  "AudioScheduledSourceNodeEventMap",
  "AudioTimestamp",
  "AudioWorklet",
  "AudioWorkletNode",
  "AudioWorkletNodeEventMap",
  "AudioWorkletNodeOptions",
  "AuthenticationExtensionsClientInputs",
  "AuthenticationExtensionsClientInputsJSON",
  "AuthenticationExtensionsClientOutputs",
  "AuthenticationExtensionsPRFInputs",
  "AuthenticationExtensionsPRFOutputs",
  "AuthenticationExtensionsPRFValues",
  "AuthenticatorAssertionResponse",
  "AuthenticatorAttachment",
  "AuthenticatorAttestationResponse",
  "AuthenticatorResponse",
  "AuthenticatorSelectionCriteria",
  "AuthenticatorTransport",
  "AutoFill",
  "AutoFillAddressKind",
  "AutoFillBase",
  "AutoFillContactField",
  "AutoFillContactKind",
  "AutoFillCredentialField",
  "AutoFillField",
  "AutoFillNormalField",
  "AutoFillSection",
  "AutoKeyword",
  "AutomationRate",
  "AvcBitstreamFormat",
  "AvcEncoderConfig",
  "Awaited",
  "BarProp",
  "Base64URLString",
  "BaseAudioContext",
  "BaseAudioContextEventMap",
  "BeforeUnloadEvent",
  "BigInt",
  "BigInt64Array",
  "BigInt64ArrayConstructor",
  "BigIntConstructor",
  "BigIntToLocaleStringOptions",
  "BigInteger",
  "BigUint64Array",
  "BigUint64ArrayConstructor",
  "BinaryType",
  "BiquadFilterNode",
  "BiquadFilterOptions",
  "BiquadFilterType",
  "BitrateMode",
  "Blob",
  "BlobCallback",
  "BlobEvent",
  "BlobEventInit",
  "BlobPart",
  "BlobPropertyBag",
  "Body",
  "BodyInit",
  "Boolean",
  "BooleanConstructor",
  "BroadcastChannel",
  "BroadcastChannelEventMap",
  "BufferSource",
  "BuiltinIteratorReturn",
  "ByteLengthQueuingStrategy",
  "CDATASection",
  "COSEAlgorithmIdentifier",
  "CSSAnimation",
  "CSSConditionRule",
  "CSSContainerRule",
  "CSSCounterStyleRule",
  "CSSFontFaceRule",
  "CSSFontFeatureValuesRule",
  "CSSFontPaletteValuesRule",
  "CSSGroupingRule",
  "CSSImageValue",
  "CSSImportRule",
  "CSSKeyframeRule",
  "CSSKeyframesRule",
  "CSSKeywordValue",
  "CSSKeywordish",
  "CSSLayerBlockRule",
  "CSSLayerStatementRule",
  "CSSMathClamp",
  "CSSMathInvert",
  "CSSMathMax",
  "CSSMathMin",
  "CSSMathNegate",
  "CSSMathOperator",
  "CSSMathProduct",
  "CSSMathSum",
  "CSSMathValue",
  "CSSMatrixComponent",
  "CSSMatrixComponentOptions",
  "CSSMediaRule",
  "CSSNamespaceRule",
  "CSSNumberish",
  "CSSNumericArray",
  "CSSNumericBaseType",
  "CSSNumericType",
  "CSSNumericValue",
  "CSSPageRule",
  "CSSPerspective",
  "CSSPerspectiveValue",
  "CSSPropertyRule",
  "CSSRotate",
  "CSSRule",
  "CSSRuleList",
  "CSSScale",
  "CSSScopeRule",
  "CSSSkew",
  "CSSSkewX",
  "CSSSkewY",
  "CSSStartingStyleRule",
  "CSSStyleDeclaration",
  "CSSStyleRule",
  "CSSStyleSheet",
  "CSSStyleSheetInit",
  "CSSStyleValue",
  "CSSSupportsRule",
  "CSSTransformComponent",
  "CSSTransformValue",
  "CSSTransition",
  "CSSTranslate",
  "CSSUnitValue",
  "CSSUnparsedSegment",
  "CSSUnparsedValue",
  "CSSVariableReferenceValue",
  "Cache",
  "CacheQueryOptions",
  "CacheStorage",
  "CallableFunction",
  "CanPlayTypeResult",
  "CanvasCaptureMediaStreamTrack",
  "CanvasCompositing",
  "CanvasDirection",
  "CanvasDrawImage",
  "CanvasDrawPath",
  "CanvasFillRule",
  "CanvasFillStrokeStyles",
  "CanvasFilters",
  "CanvasFontKerning",
  "CanvasFontStretch",
  "CanvasFontVariantCaps",
  "CanvasGradient",
  "CanvasImageData",
  "CanvasImageSmoothing",
  "CanvasImageSource",
  "CanvasLineCap",
  "CanvasLineJoin",
  "CanvasPath",
  "CanvasPathDrawingStyles",
  "CanvasPattern",
  "CanvasRect",
  "CanvasRenderingContext2D",
  "CanvasRenderingContext2DSettings",
  "CanvasShadowStyles",
  "CanvasState",
  "CanvasText",
  "CanvasTextAlign",
  "CanvasTextBaseline",
  "CanvasTextDrawingStyles",
  "CanvasTextRendering",
  "CanvasTransform",
  "CanvasUserInterface",
  "Capitalize",
  "CaretPosition",
  "CaretPositionFromPointOptions",
  "ChannelCountMode",
  "ChannelInterpretation",
  "ChannelMergerNode",
  "ChannelMergerOptions",
  "ChannelSplitterNode",
  "ChannelSplitterOptions",
  "CharacterData",
  "CheckVisibilityOptions",
  "ChildNode",
  "ClassAccessorDecoratorContext",
  "ClassAccessorDecoratorResult",
  "ClassAccessorDecoratorTarget",
  "ClassDecorator",
  "ClassDecoratorContext",
  "ClassFieldDecoratorContext",
  "ClassGetterDecoratorContext",
  "ClassMemberDecoratorContext",
  "ClassMethodDecoratorContext",
  "ClassSetterDecoratorContext",
  "Client",
  "ClientQueryOptions",
  "ClientRect",
  "ClientTypes",
  "Clients",
  "Clipboard",
  "ClipboardEvent",
  "ClipboardEventInit",
  "ClipboardItem",
  "ClipboardItemData",
  "ClipboardItemOptions",
  "ClipboardItems",
  "CloseEvent",
  "CloseEventInit",
  "CodecState",
  "Collator",
  "CollatorConstructor",
  "CollatorOptions",
  "ColorGamut",
  "ColorSpaceConversion",
  "Comment",
  "CompileError",
  "CompositeOperation",
  "CompositeOperationOrAuto",
  "CompositionEvent",
  "CompositionEventInit",
  "CompressionFormat",
  "CompressionStream",
  "ComputedEffectTiming",
  "ComputedKeyframe",
  "ConcatArray",
  "Console",
  "ConstantSourceNode",
  "ConstantSourceOptions",
  "ConstrainBoolean",
  "ConstrainBooleanParameters",
  "ConstrainDOMString",
  "ConstrainDOMStringParameters",
  "ConstrainDouble",
  "ConstrainDoubleRange",
  "ConstrainULong",
  "ConstrainULongRange",
  "ConstructorParameters",
  "ContentVisibilityAutoStateChangeEvent",
  "ContentVisibilityAutoStateChangeEventInit",
  "ConvolverNode",
  "ConvolverOptions",
  "CountQueuingStrategy",
  "Credential",
  "CredentialCreationOptions",
  "CredentialMediationRequirement",
  "CredentialPropertiesOutput",
  "CredentialRequestOptions",
  "CredentialsContainer",
  "Crypto",
  "CryptoKey",
  "CryptoKeyPair",
  "CustomElementConstructor",
  "CustomElementRegistry",
  "CustomEvent",
  "CustomEventInit",
  "CustomStateSet",
  "DOMException",
  "DOMHighResTimeStamp",
  "DOMImplementation",
  "DOMMatrix",
  "DOMMatrix2DInit",
  "DOMMatrixInit",
  "DOMMatrixReadOnly",
  "DOMParser",
  "DOMParserSupportedType",
  "DOMPoint",
  "DOMPointInit",
  "DOMPointReadOnly",
  "DOMQuad",
  "DOMQuadInit",
  "DOMRect",
  "DOMRectInit",
  "DOMRectList",
  "DOMRectReadOnly",
  "DOMStringList",
  "DOMStringMap",
  "DOMTokenList",
  "DataTransfer",
  "DataTransferItem",
  "DataTransferItemList",
  "DataView",
  "DataViewConstructor",
  "Date",
  "DateConstructor",
  "DateTimeFormat",
  "DateTimeFormatConstructor",
  "DateTimeFormatOptions",
  "DateTimeFormatPart",
  "DateTimeFormatPartTypes",
  "DateTimeFormatPartTypesRegistry",
  "DateTimeRangeFormatPart",
  "DecodeErrorCallback",
  "DecodeSuccessCallback",
  "DecompressionStream",
  "DecoratorContext",
  "DecoratorMetadata",
  "DecoratorMetadataObject",
  "DedicatedWorkerGlobalScope",
  "DedicatedWorkerGlobalScopeEventMap",
  "DelayNode",
  "DelayOptions",
  "DeviceMotionEvent",
  "DeviceMotionEventAcceleration",
  "DeviceMotionEventAccelerationInit",
  "DeviceMotionEventInit",
  "DeviceMotionEventRotationRate",
  "DeviceMotionEventRotationRateInit",
  "DeviceOrientationEvent",
  "DeviceOrientationEventInit",
  "DirectionSetting",
  "DisplayCaptureSurfaceType",
  "DisplayMediaStreamOptions",
  "DisplayNames",
  "DisplayNamesFallback",
  "DisplayNamesLanguageDisplay",
  "DisplayNamesOptions",
  "DisplayNamesType",
  "Disposable",
  "DisposableStack",
  "DisposableStackConstructor",
  "DistanceModelType",
  "Document",
  "DocumentEventMap",
  "DocumentFragment",
  "DocumentOrShadowRoot",
  "DocumentReadyState",
  "DocumentTimeline",
  "DocumentTimelineOptions",
  "DocumentType",
  "DocumentVisibilityState",
  "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_bptc",
  "EXT_texture_compression_rgtc",
  "EXT_texture_filter_anisotropic",
  "EXT_texture_norm16",
  "EcKeyAlgorithm",
  "EcKeyGenParams",
  "EcKeyImportParams",
  "EcdhKeyDeriveParams",
  "EcdsaParams",
  "EffectTiming",
  "Element",
  "ElementCSSInlineStyle",
  "ElementContentEditable",
  "ElementCreationOptions",
  "ElementDefinitionOptions",
  "ElementEventMap",
  "ElementInternals",
  "ElementTagNameMap",
  "EncodedAudioChunk",
  "EncodedAudioChunkInit",
  "EncodedAudioChunkMetadata",
  "EncodedAudioChunkOutputCallback",
  "EncodedAudioChunkType",
  "EncodedVideoChunk",
  "EncodedVideoChunkInit",
  "EncodedVideoChunkMetadata",
  "EncodedVideoChunkOutputCallback",
  "EncodedVideoChunkType",
  "EndOfStreamError",
  "EndingType",
  "Enumerator",
  "EnumeratorConstructor",
  "EpochTimeStamp",
  "Error",
  "ErrorCallback",
  "ErrorConstructor",
  "ErrorEvent",
  "ErrorEventInit",
  "ErrorOptions",
  "EvalError",
  "EvalErrorConstructor",
  "Event",
  "EventCounts",
  "EventInit",
  "EventListener",
  "EventListenerObject",
  "EventListenerOptions",
  "EventListenerOrEventListenerObject",
  "EventModifierInit",
  "EventSource",
  "EventSourceEventMap",
  "EventSourceInit",
  "EventTarget",
  "Exclude",
  "ExportValue",
  "Exports",
  "ExtendableEvent",
  "ExtendableEventInit",
  "ExtendableMessageEvent",
  "ExtendableMessageEventInit",
  "External",
  "Extract",
  "FetchEvent",
  "FetchEventInit",
  "File",
  "FileCallback",
  "FileList",
  "FilePropertyBag",
  "FileReader",
  "FileReaderEventMap",
  "FileReaderSync",
  "FileSystem",
  "FileSystemCreateWritableOptions",
  "FileSystemDirectoryEntry",
  "FileSystemDirectoryHandle",
  "FileSystemDirectoryHandleAsyncIterator",
  "FileSystemDirectoryReader",
  "FileSystemEntriesCallback",
  "FileSystemEntry",
  "FileSystemEntryCallback",
  "FileSystemFileEntry",
  "FileSystemFileHandle",
  "FileSystemFlags",
  "FileSystemGetDirectoryOptions",
  "FileSystemGetFileOptions",
  "FileSystemHandle",
  "FileSystemHandleKind",
  "FileSystemReadWriteOptions",
  "FileSystemRemoveOptions",
  "FileSystemSyncAccessHandle",
  "FileSystemWritableFileStream",
  "FileSystemWriteChunkType",
  "FillMode",
  "FinalizationRegistry",
  "FinalizationRegistryConstructor",
  "FlatArray",
  "Float32Array",
  "Float32ArrayConstructor",
  "Float32List",
  "Float64Array",
  "Float64ArrayConstructor",
  "FocusEvent",
  "FocusEventInit",
  "FocusOptions",
  "FontDisplay",
  "FontFace",
  "FontFaceDescriptors",
  "FontFaceLoadStatus",
  "FontFaceSet",
  "FontFaceSetEventMap",
  "FontFaceSetLoadEvent",
  "FontFaceSetLoadEventInit",
  "FontFaceSetLoadStatus",
  "FontFaceSource",
  "FormData",
  "FormDataEntryValue",
  "FormDataEvent",
  "FormDataEventInit",
  "FormDataIterator",
  "FragmentDirective",
  "FrameRequestCallback",
  "FrameType",
  "FullscreenNavigationUI",
  "FullscreenOptions",
  "Function",
  "FunctionConstructor",
  "FunctionStringCallback",
  "GLbitfield",
  "GLboolean",
  "GLclampf",
  "GLenum",
  "GLfloat",
  "GLint",
  "GLint64",
  "GLintptr",
  "GLsizei",
  "GLsizeiptr",
  "GLuint",
  "GLuint64",
  "GainNode",
  "GainOptions",
  "Gamepad",
  "GamepadButton",
  "GamepadEffectParameters",
  "GamepadEvent",
  "GamepadEventInit",
  "GamepadHapticActuator",
  "GamepadHapticEffectType",
  "GamepadHapticsResult",
  "GamepadMappingType",
  "Generator",
  "GeneratorFunction",
  "GeneratorFunctionConstructor",
  "GenericTransformStream",
  "Geolocation",
  "GeolocationCoordinates",
  "GeolocationPosition",
  "GeolocationPositionError",
  "GetAnimationsOptions",
  "GetHTMLOptions",
  "GetNotificationOptions",
  "GetRootNodeOptions",
  "Global",
  "GlobalCompositeOperation",
  "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",
  "HTMLOrSVGImageElement",
  "HTMLOrSVGScriptElement",
  "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",
  "HardwareAcceleration",
  "HashAlgorithmIdentifier",
  "HashChangeEvent",
  "HashChangeEventInit",
  "HdrMetadataType",
  "Headers",
  "HeadersInit",
  "HeadersIterator",
  "Highlight",
  "HighlightRegistry",
  "HighlightType",
  "History",
  "HkdfParams",
  "HmacImportParams",
  "HmacKeyAlgorithm",
  "HmacKeyGenParams",
  "IArguments",
  "IDBCursor",
  "IDBCursorDirection",
  "IDBCursorWithValue",
  "IDBDatabase",
  "IDBDatabaseEventMap",
  "IDBDatabaseInfo",
  "IDBFactory",
  "IDBIndex",
  "IDBIndexParameters",
  "IDBKeyRange",
  "IDBObjectStore",
  "IDBObjectStoreParameters",
  "IDBOpenDBRequest",
  "IDBOpenDBRequestEventMap",
  "IDBRequest",
  "IDBRequestEventMap",
  "IDBRequestReadyState",
  "IDBTransaction",
  "IDBTransactionDurability",
  "IDBTransactionEventMap",
  "IDBTransactionMode",
  "IDBTransactionOptions",
  "IDBValidKey",
  "IDBVersionChangeEvent",
  "IDBVersionChangeEventInit",
  "IIRFilterNode",
  "IIRFilterOptions",
  "ITextWriter",
  "IdleDeadline",
  "IdleRequestCallback",
  "IdleRequestOptions",
  "ImageBitmap",
  "ImageBitmapOptions",
  "ImageBitmapRenderingContext",
  "ImageBitmapRenderingContextSettings",
  "ImageBitmapSource",
  "ImageData",
  "ImageDataSettings",
  "ImageEncodeOptions",
  "ImageOrientation",
  "ImageSmoothingQuality",
  "ImportAssertions",
  "ImportAttributes",
  "ImportCallOptions",
  "ImportExportKind",
  "ImportMeta",
  "ImportValue",
  "Imports",
  "InputDeviceInfo",
  "InputEvent",
  "InputEventInit",
  "InsertPosition",
  "Instance",
  "InstanceType",
  "Int16Array",
  "Int16ArrayConstructor",
  "Int32Array",
  "Int32ArrayConstructor",
  "Int32List",
  "Int8Array",
  "Int8ArrayConstructor",
  "IntersectionObserver",
  "IntersectionObserverCallback",
  "IntersectionObserverEntry",
  "IntersectionObserverInit",
  "Iterable",
  "IterableIterator",
  "IterationCompositeOperation",
  "Iterator",
  "IteratorConstructor",
  "IteratorObject",
  "IteratorObjectConstructor",
  "IteratorResult",
  "IteratorReturnResult",
  "IteratorYieldResult",
  "JSON",
  "JsonWebKey",
  "KHR_parallel_shader_compile",
  "KeyAlgorithm",
  "KeyFormat",
  "KeyType",
  "KeyUsage",
  "KeyboardEvent",
  "KeyboardEventInit",
  "Keyframe",
  "KeyframeAnimationOptions",
  "KeyframeEffect",
  "KeyframeEffectOptions",
  "LDMLPluralRule",
  "LargestContentfulPaint",
  "LatencyMode",
  "LineAlignSetting",
  "LineAndPositionSetting",
  "LinkError",
  "LinkStyle",
  "ListFormat",
  "ListFormatLocaleMatcher",
  "ListFormatOptions",
  "ListFormatStyle",
  "ListFormatType",
  "Locale",
  "LocaleCollationCaseFirst",
  "LocaleHourCycleKey",
  "LocaleOptions",
  "LocalesArgument",
  "Location",
  "Lock",
  "LockGrantedCallback",
  "LockInfo",
  "LockManager",
  "LockManagerSnapshot",
  "LockMode",
  "LockOptions",
  "Lowercase",
  "MIDIAccess",
  "MIDIAccessEventMap",
  "MIDIConnectionEvent",
  "MIDIConnectionEventInit",
  "MIDIInput",
  "MIDIInputEventMap",
  "MIDIInputMap",
  "MIDIMessageEvent",
  "MIDIMessageEventInit",
  "MIDIOptions",
  "MIDIOutput",
  "MIDIOutputMap",
  "MIDIPort",
  "MIDIPortConnectionState",
  "MIDIPortDeviceState",
  "MIDIPortEventMap",
  "MIDIPortType",
  "Map",
  "MapConstructor",
  "MapIterator",
  "Math",
  "MathMLElement",
  "MathMLElementEventMap",
  "MathMLElementTagNameMap",
  "MediaCapabilities",
  "MediaCapabilitiesDecodingInfo",
  "MediaCapabilitiesEncodingInfo",
  "MediaCapabilitiesInfo",
  "MediaConfiguration",
  "MediaDecodingConfiguration",
  "MediaDecodingType",
  "MediaDeviceInfo",
  "MediaDeviceKind",
  "MediaDevices",
  "MediaDevicesEventMap",
  "MediaElementAudioSourceNode",
  "MediaElementAudioSourceOptions",
  "MediaEncodingConfiguration",
  "MediaEncodingType",
  "MediaEncryptedEvent",
  "MediaEncryptedEventInit",
  "MediaError",
  "MediaImage",
  "MediaKeyMessageEvent",
  "MediaKeyMessageEventInit",
  "MediaKeyMessageType",
  "MediaKeySession",
  "MediaKeySessionClosedReason",
  "MediaKeySessionEventMap",
  "MediaKeySessionType",
  "MediaKeyStatus",
  "MediaKeyStatusMap",
  "MediaKeyStatusMapIterator",
  "MediaKeySystemAccess",
  "MediaKeySystemConfiguration",
  "MediaKeySystemMediaCapability",
  "MediaKeys",
  "MediaKeysPolicy",
  "MediaKeysRequirement",
  "MediaList",
  "MediaMetadata",
  "MediaMetadataInit",
  "MediaPositionState",
  "MediaProvider",
  "MediaQueryList",
  "MediaQueryListEvent",
  "MediaQueryListEventInit",
  "MediaQueryListEventMap",
  "MediaRecorder",
  "MediaRecorderEventMap",
  "MediaRecorderOptions",
  "MediaSession",
  "MediaSessionAction",
  "MediaSessionActionDetails",
  "MediaSessionActionHandler",
  "MediaSessionPlaybackState",
  "MediaSource",
  "MediaSourceEventMap",
  "MediaSourceHandle",
  "MediaStream",
  "MediaStreamAudioDestinationNode",
  "MediaStreamAudioSourceNode",
  "MediaStreamAudioSourceOptions",
  "MediaStreamConstraints",
  "MediaStreamEventMap",
  "MediaStreamTrack",
  "MediaStreamTrackEvent",
  "MediaStreamTrackEventInit",
  "MediaStreamTrackEventMap",
  "MediaStreamTrackProcessor",
  "MediaStreamTrackProcessorInit",
  "MediaStreamTrackState",
  "MediaTrackCapabilities",
  "MediaTrackConstraintSet",
  "MediaTrackConstraints",
  "MediaTrackSettings",
  "MediaTrackSupportedConstraints",
  "Memory",
  "MemoryDescriptor",
  "MessageChannel",
  "MessageEvent",
  "MessageEventInit",
  "MessageEventSource",
  "MessagePort",
  "MessagePortEventMap",
  "MethodDecorator",
  "MimeType",
  "MimeTypeArray",
  "Module",
  "ModuleExportDescriptor",
  "ModuleImportDescriptor",
  "ModuleImports",
  "MouseEvent",
  "MouseEventInit",
  "MultiCacheQueryOptions",
  "MutationCallback",
  "MutationObserver",
  "MutationObserverInit",
  "MutationRecord",
  "MutationRecordType",
  "NamedCurve",
  "NamedNodeMap",
  "NavigationPreloadManager",
  "NavigationPreloadState",
  "NavigationTimingType",
  "Navigator",
  "NavigatorAutomationInformation",
  "NavigatorBadge",
  "NavigatorConcurrentHardware",
  "NavigatorContentUtils",
  "NavigatorCookies",
  "NavigatorID",
  "NavigatorLanguage",
  "NavigatorLocks",
  "NavigatorOnLine",
  "NavigatorPlugins",
  "NavigatorStorage",
  "NewableFunction",
  "NoInfer",
  "Node",
  "NodeFilter",
  "NodeIterator",
  "NodeList",
  "NodeListOf",
  "NonDocumentTypeChildNode",
  "NonElementParentNode",
  "NonNullable",
  "Notification",
  "NotificationDirection",
  "NotificationEvent",
  "NotificationEventInit",
  "NotificationEventMap",
  "NotificationOptions",
  "NotificationPermission",
  "NotificationPermissionCallback",
  "Number",
  "NumberConstructor",
  "NumberFormat",
  "NumberFormatConstructor",
  "NumberFormatOptions",
  "NumberFormatOptionsCurrencyDisplay",
  "NumberFormatOptionsCurrencyDisplayRegistry",
  "NumberFormatOptionsSignDisplay",
  "NumberFormatOptionsSignDisplayRegistry",
  "NumberFormatOptionsStyle",
  "NumberFormatOptionsStyleRegistry",
  "NumberFormatOptionsUseGrouping",
  "NumberFormatOptionsUseGroupingRegistry",
  "NumberFormatPart",
  "NumberFormatPartTypeRegistry",
  "NumberFormatPartTypes",
  "NumberRangeFormatPart",
  "OES_draw_buffers_indexed",
  "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",
  "OffscreenCanvasEventMap",
  "OffscreenCanvasRenderingContext2D",
  "OffscreenRenderingContext",
  "OffscreenRenderingContextId",
  "Omit",
  "OmitThisParameter",
  "OnBeforeUnloadEventHandler",
  "OnBeforeUnloadEventHandlerNonNull",
  "OnErrorEventHandler",
  "OnErrorEventHandlerNonNull",
  "OptionalEffectTiming",
  "OptionalPostfixToken",
  "OptionalPrefixToken",
  "OpusBitstreamFormat",
  "OpusEncoderConfig",
  "OrientationType",
  "OscillatorNode",
  "OscillatorOptions",
  "OscillatorType",
  "OverSampleType",
  "OverconstrainedError",
  "PageTransitionEvent",
  "PageTransitionEventInit",
  "PannerNode",
  "PannerOptions",
  "PanningModelType",
  "ParameterDecorator",
  "Parameters",
  "ParentNode",
  "Partial",
  "Path2D",
  "PayerErrors",
  "PaymentAddress",
  "PaymentComplete",
  "PaymentCurrencyAmount",
  "PaymentDetailsBase",
  "PaymentDetailsInit",
  "PaymentDetailsModifier",
  "PaymentDetailsUpdate",
  "PaymentItem",
  "PaymentMethodChangeEvent",
  "PaymentMethodChangeEventInit",
  "PaymentMethodData",
  "PaymentOptions",
  "PaymentRequest",
  "PaymentRequestEventMap",
  "PaymentRequestUpdateEvent",
  "PaymentRequestUpdateEventInit",
  "PaymentResponse",
  "PaymentResponseEventMap",
  "PaymentShippingOption",
  "PaymentShippingType",
  "PaymentValidationErrors",
  "Pbkdf2Params",
  "Performance",
  "PerformanceEntry",
  "PerformanceEntryList",
  "PerformanceEventMap",
  "PerformanceEventTiming",
  "PerformanceMark",
  "PerformanceMarkOptions",
  "PerformanceMeasure",
  "PerformanceMeasureOptions",
  "PerformanceNavigation",
  "PerformanceNavigationTiming",
  "PerformanceObserver",
  "PerformanceObserverCallback",
  "PerformanceObserverEntryList",
  "PerformanceObserverInit",
  "PerformancePaintTiming",
  "PerformanceResourceTiming",
  "PerformanceServerTiming",
  "PerformanceTiming",
  "PeriodicWave",
  "PeriodicWaveConstraints",
  "PeriodicWaveOptions",
  "PermissionDescriptor",
  "PermissionName",
  "PermissionState",
  "PermissionStatus",
  "PermissionStatusEventMap",
  "Permissions",
  "Pick",
  "PictureInPictureEvent",
  "PictureInPictureEventInit",
  "PictureInPictureWindow",
  "PictureInPictureWindowEventMap",
  "PlaneLayout",
  "PlaybackDirection",
  "Plugin",
  "PluginArray",
  "PluralRuleType",
  "PluralRules",
  "PluralRulesConstructor",
  "PluralRulesOptions",
  "PointerEvent",
  "PointerEventInit",
  "PointerLockOptions",
  "PopStateEvent",
  "PopStateEventInit",
  "PopoverInvokerElement",
  "PositionAlignSetting",
  "PositionCallback",
  "PositionErrorCallback",
  "PositionOptions",
  "PredefinedColorSpace",
  "PremultiplyAlpha",
  "PresentationStyle",
  "ProcessingInstruction",
  "ProgressEvent",
  "ProgressEventInit",
  "Promise",
  "PromiseConstructor",
  "PromiseConstructorLike",
  "PromiseFulfilledResult",
  "PromiseLike",
  "PromiseRejectedResult",
  "PromiseRejectionEvent",
  "PromiseRejectionEventInit",
  "PromiseSettledResult",
  "PromiseWithResolvers",
  "PropertyDecorator",
  "PropertyDefinition",
  "PropertyDescriptor",
  "PropertyDescriptorMap",
  "PropertyIndexedKeyframes",
  "PropertyKey",
  "ProxyConstructor",
  "ProxyHandler",
  "PublicKeyCredential",
  "PublicKeyCredentialCreationOptions",
  "PublicKeyCredentialCreationOptionsJSON",
  "PublicKeyCredentialDescriptor",
  "PublicKeyCredentialDescriptorJSON",
  "PublicKeyCredentialEntity",
  "PublicKeyCredentialJSON",
  "PublicKeyCredentialParameters",
  "PublicKeyCredentialRequestOptions",
  "PublicKeyCredentialRequestOptionsJSON",
  "PublicKeyCredentialRpEntity",
  "PublicKeyCredentialType",
  "PublicKeyCredentialUserEntity",
  "PublicKeyCredentialUserEntityJSON",
  "PushEncryptionKeyName",
  "PushEvent",
  "PushEventInit",
  "PushManager",
  "PushMessageData",
  "PushMessageDataInit",
  "PushSubscription",
  "PushSubscriptionJSON",
  "PushSubscriptionOptions",
  "PushSubscriptionOptionsInit",
  "QueuingStrategy",
  "QueuingStrategyInit",
  "QueuingStrategySize",
  "RTCAnswerOptions",
  "RTCBundlePolicy",
  "RTCCertificate",
  "RTCCertificateExpiration",
  "RTCConfiguration",
  "RTCDTMFSender",
  "RTCDTMFSenderEventMap",
  "RTCDTMFToneChangeEvent",
  "RTCDTMFToneChangeEventInit",
  "RTCDataChannel",
  "RTCDataChannelEvent",
  "RTCDataChannelEventInit",
  "RTCDataChannelEventMap",
  "RTCDataChannelInit",
  "RTCDataChannelState",
  "RTCDegradationPreference",
  "RTCDtlsFingerprint",
  "RTCDtlsTransport",
  "RTCDtlsTransportEventMap",
  "RTCDtlsTransportState",
  "RTCEncodedAudioFrame",
  "RTCEncodedAudioFrameMetadata",
  "RTCEncodedVideoFrame",
  "RTCEncodedVideoFrameMetadata",
  "RTCEncodedVideoFrameType",
  "RTCError",
  "RTCErrorDetailType",
  "RTCErrorEvent",
  "RTCErrorEventInit",
  "RTCErrorInit",
  "RTCIceCandidate",
  "RTCIceCandidateInit",
  "RTCIceCandidatePair",
  "RTCIceCandidatePairStats",
  "RTCIceCandidateType",
  "RTCIceComponent",
  "RTCIceConnectionState",
  "RTCIceGathererState",
  "RTCIceGatheringState",
  "RTCIceProtocol",
  "RTCIceServer",
  "RTCIceTcpCandidateType",
  "RTCIceTransport",
  "RTCIceTransportEventMap",
  "RTCIceTransportPolicy",
  "RTCIceTransportState",
  "RTCInboundRtpStreamStats",
  "RTCLocalSessionDescriptionInit",
  "RTCOfferAnswerOptions",
  "RTCOfferOptions",
  "RTCOutboundRtpStreamStats",
  "RTCPeerConnection",
  "RTCPeerConnectionErrorCallback",
  "RTCPeerConnectionEventMap",
  "RTCPeerConnectionIceErrorEvent",
  "RTCPeerConnectionIceErrorEventInit",
  "RTCPeerConnectionIceEvent",
  "RTCPeerConnectionIceEventInit",
  "RTCPeerConnectionState",
  "RTCPriorityType",
  "RTCReceivedRtpStreamStats",
  "RTCRtcpMuxPolicy",
  "RTCRtcpParameters",
  "RTCRtpCapabilities",
  "RTCRtpCodec",
  "RTCRtpCodecParameters",
  "RTCRtpCodingParameters",
  "RTCRtpContributingSource",
  "RTCRtpEncodingParameters",
  "RTCRtpHeaderExtensionCapability",
  "RTCRtpHeaderExtensionParameters",
  "RTCRtpParameters",
  "RTCRtpReceiveParameters",
  "RTCRtpReceiver",
  "RTCRtpScriptTransform",
  "RTCRtpScriptTransformer",
  "RTCRtpSendParameters",
  "RTCRtpSender",
  "RTCRtpStreamStats",
  "RTCRtpSynchronizationSource",
  "RTCRtpTransceiver",
  "RTCRtpTransceiverDirection",
  "RTCRtpTransceiverInit",
  "RTCRtpTransform",
  "RTCSctpTransport",
  "RTCSctpTransportEventMap",
  "RTCSctpTransportState",
  "RTCSdpType",
  "RTCSentRtpStreamStats",
  "RTCSessionDescription",
  "RTCSessionDescriptionCallback",
  "RTCSessionDescriptionInit",
  "RTCSetParameterOptions",
  "RTCSignalingState",
  "RTCStats",
  "RTCStatsIceCandidatePairState",
  "RTCStatsReport",
  "RTCStatsType",
  "RTCTrackEvent",
  "RTCTrackEventInit",
  "RTCTransformEvent",
  "RTCTransportStats",
  "RadioNodeList",
  "Range",
  "RangeError",
  "RangeErrorConstructor",
  "ReadableByteStreamController",
  "ReadableStream",
  "ReadableStreamAsyncIterator",
  "ReadableStreamBYOBReader",
  "ReadableStreamBYOBRequest",
  "ReadableStreamController",
  "ReadableStreamDefaultController",
  "ReadableStreamDefaultReader",
  "ReadableStreamGenericReader",
  "ReadableStreamGetReaderOptions",
  "ReadableStreamIteratorOptions",
  "ReadableStreamReadDoneResult",
  "ReadableStreamReadResult",
  "ReadableStreamReadValueResult",
  "ReadableStreamReader",
  "ReadableStreamReaderMode",
  "ReadableStreamType",
  "ReadableWritablePair",
  "Readonly",
  "ReadonlyArray",
  "ReadonlyMap",
  "ReadonlySet",
  "ReadonlySetLike",
  "ReadyState",
  "Record",
  "RecordingState",
  "ReferenceError",
  "ReferenceErrorConstructor",
  "ReferrerPolicy",
  "RegExp",
  "RegExpConstructor",
  "RegExpExecArray",
  "RegExpIndicesArray",
  "RegExpMatchArray",
  "RegExpStringIterator",
  "RegistrationOptions",
  "RelativeTimeFormat",
  "RelativeTimeFormatLocaleMatcher",
  "RelativeTimeFormatNumeric",
  "RelativeTimeFormatOptions",
  "RelativeTimeFormatPart",
  "RelativeTimeFormatStyle",
  "RelativeTimeFormatUnit",
  "RelativeTimeFormatUnitSingular",
  "RemotePlayback",
  "RemotePlaybackAvailabilityCallback",
  "RemotePlaybackEventMap",
  "RemotePlaybackState",
  "RenderingContext",
  "Report",
  "ReportBody",
  "ReportList",
  "ReportingObserver",
  "ReportingObserverCallback",
  "ReportingObserverOptions",
  "Request",
  "RequestCache",
  "RequestCredentials",
  "RequestDestination",
  "RequestInfo",
  "RequestInit",
  "RequestMode",
  "RequestPriority",
  "RequestRedirect",
  "Required",
  "ResidentKeyRequirement",
  "ResizeObserver",
  "ResizeObserverBoxOptions",
  "ResizeObserverCallback",
  "ResizeObserverEntry",
  "ResizeObserverOptions",
  "ResizeObserverSize",
  "ResizeQuality",
  "ResolvedCollatorOptions",
  "ResolvedDateTimeFormatOptions",
  "ResolvedDisplayNamesOptions",
  "ResolvedListFormatOptions",
  "ResolvedNumberFormatOptions",
  "ResolvedNumberFormatOptionsUseGrouping",
  "ResolvedPluralRulesOptions",
  "ResolvedRelativeTimeFormatOptions",
  "ResolvedSegmenterOptions",
  "Response",
  "ResponseInit",
  "ResponseType",
  "ReturnType",
  "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",
  "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",
  "ScrollBehavior",
  "ScrollIntoViewOptions",
  "ScrollLogicalPosition",
  "ScrollOptions",
  "ScrollRestoration",
  "ScrollSetting",
  "ScrollToOptions",
  "SecurityPolicyViolationEvent",
  "SecurityPolicyViolationEventDisposition",
  "SecurityPolicyViolationEventInit",
  "SegmentData",
  "SegmentIterator",
  "Segmenter",
  "SegmenterOptions",
  "Segments",
  "Selection",
  "SelectionMode",
  "ServiceWorker",
  "ServiceWorkerContainer",
  "ServiceWorkerContainerEventMap",
  "ServiceWorkerEventMap",
  "ServiceWorkerGlobalScope",
  "ServiceWorkerGlobalScopeEventMap",
  "ServiceWorkerRegistration",
  "ServiceWorkerRegistrationEventMap",
  "ServiceWorkerState",
  "ServiceWorkerUpdateViaCache",
  "Set",
  "SetConstructor",
  "SetIterator",
  "ShadowRoot",
  "ShadowRootEventMap",
  "ShadowRootInit",
  "ShadowRootMode",
  "ShareData",
  "SharedArrayBuffer",
  "SharedArrayBufferConstructor",
  "SharedWorker",
  "SharedWorkerGlobalScope",
  "SharedWorkerGlobalScopeEventMap",
  "SlotAssignmentMode",
  "Slottable",
  "SourceBuffer",
  "SourceBufferEventMap",
  "SourceBufferList",
  "SourceBufferListEventMap",
  "SpeechRecognitionAlternative",
  "SpeechRecognitionResult",
  "SpeechRecognitionResultList",
  "SpeechSynthesis",
  "SpeechSynthesisErrorCode",
  "SpeechSynthesisErrorEvent",
  "SpeechSynthesisErrorEventInit",
  "SpeechSynthesisEvent",
  "SpeechSynthesisEventInit",
  "SpeechSynthesisEventMap",
  "SpeechSynthesisUtterance",
  "SpeechSynthesisUtteranceEventMap",
  "SpeechSynthesisVoice",
  "StaticRange",
  "StaticRangeInit",
  "StereoPannerNode",
  "StereoPannerOptions",
  "Storage",
  "StorageEstimate",
  "StorageEvent",
  "StorageEventInit",
  "StorageManager",
  "StreamPipeOptions",
  "String",
  "StringConstructor",
  "StringIterator",
  "StringNumericLiteral",
  "StructuredSerializeOptions",
  "StyleMedia",
  "StylePropertyMap",
  "StylePropertyMapReadOnly",
  "StylePropertyMapReadOnlyIterator",
  "StyleSheet",
  "StyleSheetList",
  "SubmitEvent",
  "SubmitEventInit",
  "SubtleCrypto",
  "SuppressedError",
  "SuppressedErrorConstructor",
  "Symbol",
  "SymbolConstructor",
  "SyntaxError",
  "SyntaxErrorConstructor",
  "Table",
  "TableDescriptor",
  "TableKind",
  "TemplateStringsArray",
  "TexImageSource",
  "Text",
  "TextDecodeOptions",
  "TextDecoder",
  "TextDecoderCommon",
  "TextDecoderOptions",
  "TextDecoderStream",
  "TextEncoder",
  "TextEncoderCommon",
  "TextEncoderEncodeIntoResult",
  "TextEncoderStream",
  "TextEvent",
  "TextMetrics",
  "TextStreamBase",
  "TextStreamReader",
  "TextStreamWriter",
  "TextTrack",
  "TextTrackCue",
  "TextTrackCueEventMap",
  "TextTrackCueList",
  "TextTrackEventMap",
  "TextTrackKind",
  "TextTrackList",
  "TextTrackListEventMap",
  "TextTrackMode",
  "ThisParameterType",
  "ThisType",
  "TimeRanges",
  "TimerHandler",
  "ToggleEvent",
  "ToggleEventInit",
  "Touch",
  "TouchEvent",
  "TouchEventInit",
  "TouchInit",
  "TouchList",
  "TouchType",
  "TrackEvent",
  "TrackEventInit",
  "TransferFunction",
  "Transferable",
  "TransformStream",
  "TransformStreamDefaultController",
  "Transformer",
  "TransformerFlushCallback",
  "TransformerStartCallback",
  "TransformerTransformCallback",
  "TransitionEvent",
  "TransitionEventInit",
  "TreeWalker",
  "TypeError",
  "TypeErrorConstructor",
  "TypedPropertyDescriptor",
  "UIEvent",
  "UIEventInit",
  "ULongRange",
  "URIError",
  "URIErrorConstructor",
  "URL",
  "URLSearchParams",
  "URLSearchParamsIterator",
  "Uint16Array",
  "Uint16ArrayConstructor",
  "Uint32Array",
  "Uint32ArrayConstructor",
  "Uint32List",
  "Uint8Array",
  "Uint8ArrayConstructor",
  "Uint8ClampedArray",
  "Uint8ClampedArrayConstructor",
  "Uncapitalize",
  "UnderlyingByteSource",
  "UnderlyingDefaultSource",
  "UnderlyingSink",
  "UnderlyingSinkAbortCallback",
  "UnderlyingSinkCloseCallback",
  "UnderlyingSinkStartCallback",
  "UnderlyingSinkWriteCallback",
  "UnderlyingSource",
  "UnderlyingSourceCancelCallback",
  "UnderlyingSourcePullCallback",
  "UnderlyingSourceStartCallback",
  "UnicodeBCP47LocaleIdentifier",
  "Uppercase",
  "UserActivation",
  "UserVerificationRequirement",
  "VBArray",
  "VBArrayConstructor",
  "VTTCue",
  "VTTRegion",
  "ValidityState",
  "ValidityStateFlags",
  "ValueType",
  "ValueTypeMap",
  "VarDate",
  "VibratePattern",
  "VideoColorPrimaries",
  "VideoColorSpace",
  "VideoColorSpaceInit",
  "VideoConfiguration",
  "VideoDecoder",
  "VideoDecoderConfig",
  "VideoDecoderEventMap",
  "VideoDecoderInit",
  "VideoDecoderSupport",
  "VideoEncoder",
  "VideoEncoderBitrateMode",
  "VideoEncoderConfig",
  "VideoEncoderEncodeOptions",
  "VideoEncoderEncodeOptionsForAvc",
  "VideoEncoderEventMap",
  "VideoEncoderInit",
  "VideoEncoderSupport",
  "VideoFacingModeEnum",
  "VideoFrame",
  "VideoFrameBufferInit",
  "VideoFrameCallbackMetadata",
  "VideoFrameCopyToOptions",
  "VideoFrameInit",
  "VideoFrameOutputCallback",
  "VideoFrameRequestCallback",
  "VideoMatrixCoefficients",
  "VideoPixelFormat",
  "VideoPlaybackQuality",
  "VideoTransferCharacteristics",
  "ViewTransition",
  "ViewTransitionUpdateCallback",
  "VirtualElement",
  "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",
  "WEBGL_multi_draw",
  "WakeLock",
  "WakeLockSentinel",
  "WakeLockSentinelEventMap",
  "WakeLockType",
  "WaveShaperNode",
  "WaveShaperOptions",
  "WeakKey",
  "WeakKeyTypes",
  "WeakMap",
  "WeakMapConstructor",
  "WeakRef",
  "WeakRefConstructor",
  "WeakSet",
  "WeakSetConstructor",
  "WebAssemblyInstantiatedSource",
  "WebCodecsErrorCallback",
  "WebGL2RenderingContext",
  "WebGL2RenderingContextBase",
  "WebGL2RenderingContextOverloads",
  "WebGLActiveInfo",
  "WebGLBuffer",
  "WebGLContextAttributes",
  "WebGLContextEvent",
  "WebGLContextEventInit",
  "WebGLFramebuffer",
  "WebGLPowerPreference",
  "WebGLProgram",
  "WebGLQuery",
  "WebGLRenderbuffer",
  "WebGLRenderingContext",
  "WebGLRenderingContextBase",
  "WebGLRenderingContextOverloads",
  "WebGLSampler",
  "WebGLShader",
  "WebGLShaderPrecisionFormat",
  "WebGLSync",
  "WebGLTexture",
  "WebGLTransformFeedback",
  "WebGLUniformLocation",
  "WebGLVertexArrayObject",
  "WebGLVertexArrayObjectOES",
  "WebKitCSSMatrix",
  "WebSocket",
  "WebSocketEventMap",
  "WebTransport",
  "WebTransportBidirectionalStream",
  "WebTransportCloseInfo",
  "WebTransportCongestionControl",
  "WebTransportDatagramDuplexStream",
  "WebTransportError",
  "WebTransportErrorOptions",
  "WebTransportErrorSource",
  "WebTransportHash",
  "WebTransportOptions",
  "WebTransportSendStreamOptions",
  "WheelEvent",
  "WheelEventInit",
  "Window",
  "WindowClient",
  "WindowEventHandlers",
  "WindowEventHandlersEventMap",
  "WindowEventMap",
  "WindowLocalStorage",
  "WindowOrWorkerGlobalScope",
  "WindowPostMessageOptions",
  "WindowProxy",
  "WindowSessionStorage",
  "Worker",
  "WorkerEventMap",
  "WorkerGlobalScope",
  "WorkerGlobalScopeEventMap",
  "WorkerLocation",
  "WorkerNavigator",
  "WorkerOptions",
  "WorkerType",
  "Worklet",
  "WorkletOptions",
  "WritableStream",
  "WritableStreamDefaultController",
  "WritableStreamDefaultWriter",
  "WriteCommandType",
  "WriteParams",
  "XMLDocument",
  "XMLHttpRequest",
  "XMLHttpRequestBodyInit",
  "XMLHttpRequestEventMap",
  "XMLHttpRequestEventTarget",
  "XMLHttpRequestEventTargetEventMap",
  "XMLHttpRequestResponseType",
  "XMLHttpRequestUpload",
  "XMLSerializer",
  "XPathEvaluator",
  "XPathEvaluatorBase",
  "XPathExpression",
  "XPathNSResolver",
  "XPathResult",
  "XSLTProcessor",
  "any",
  "array",
  "bigint",
  "boolean",
  "never",
  "null",
  "number",
  "string",
  "symbol",
  "undefined",
  "unknown",
  "void",
  "webkitURL"
];
var NON_EXPORTABLE_KEYWORDS = [
  "any",
  "unknown",
  "never",
  "void",
  "undefined",
  "null",
  "boolean",
  "number",
  "string",
  "bigint",
  "symbol",
  "object",
  "array",
  "readonly",
  "readonlyarray",
  "promise",
  "record",
  "partial",
  "required",
  "pick",
  "omit",
  "exclude",
  "extract",
  "nonnullable",
  "parameters",
  "returntype",
  "instancetype",
  "thistype",
  "keyof",
  "typeof",
  "in",
  "infer",
  "as",
  "extends",
  "templateresult",
  "function",
  "true",
  "false",
  "this",
  "internals"
];
var NON_EXPORTABLE_TYPE_NAMES = /* @__PURE__ */ new Set([
  ...NATIVE_JS_TYPES.map((t) => t.toLowerCase()),
  ...NON_EXPORTABLE_KEYWORDS
]);

// src/utilities.ts
var NATIVE_JS_GENERICS = [
  "Promise",
  "Iterator",
  "AsyncIterator",
  "Generator",
  "GeneratorFunction",
  "AsyncFunction",
  "AsyncGenerator",
  "AsyncGeneratorFunction",
  "Set",
  "Map",
  "WeakSet",
  "WeakMap"
];
var NATIVE_GENERIC_PREFIXES = NATIVE_JS_GENERICS.map(
  (type) => type.toLowerCase()
);
var NON_EXPORTABLE_PREFIXES = ["html", "svg"];
function isValidFilePath(filePath) {
  const regex = /^(\/|\.\/|\.\.\/|[a-zA-Z]:[\\/]|\.\\|\.\.\\)?([a-zA-Z0-9_\-./\\]+)$/;
  return regex.test(filePath);
}
function isLatestPackageVersion(currentVersion, latestVersion) {
  const isAlphaOrBeta = currentVersion.includes("-");
  const parseVersion = (version) => version.split(".").map((x) => parseInt(x));
  const [currMajor, currMinor, currPatch] = parseVersion(currentVersion);
  const [latestMajor, latestMinor, latestPatch] = parseVersion(latestVersion);
  if (currMajor !== latestMajor) {
    return currMajor > latestMajor;
  }
  if (currMinor !== latestMinor) {
    return currMinor > latestMinor;
  }
  if (currPatch !== latestPatch) {
    return currPatch > latestPatch;
  }
  return !isAlphaOrBeta;
}
function extractCustomEventType(value) {
  const match = value?.match(/^CustomEvent<(.+)>$/);
  return match ? match[1] : value || "";
}
function getPackageJson(packageJsonPath) {
  if (!isValidFilePath(packageJsonPath)) {
    throw new Error(`"${packageJsonPath}" is not a valid file path.`);
  }
  return JSON.parse(import_fs.default.readFileSync(packageJsonPath, "utf-8"));
}
function getDefinitions(manifest) {
  const definitions = /* @__PURE__ */ new Map();
  manifest.modules.forEach(
    (mod) => mod.exports?.filter((x) => x.kind === "custom-element-definition")?.forEach((x) => definitions.set(x.name, mod.path))
  );
  return definitions;
}
function extractNamedTypes(type) {
  if (!type) return [];
  const cleaned = type.replace(/'[^']*'|"[^"]*"/g, " ").replace(/\{[^}]*\}/g, " ");
  const withoutParamNames = cleaned.replace(
    /\b[A-Za-z_$][A-Za-z0-9_$]*\s*:/g,
    " "
  );
  const tokens = withoutParamNames.split(/[^A-Za-z0-9_$]/).map((token) => token.trim()).filter(Boolean);
  const typeofIndex = tokens.indexOf("typeof");
  if (typeofIndex !== -1) {
    return tokens.slice(0, typeofIndex + 1);
  }
  return tokens;
}
function isExportableTypeName(type) {
  const typeLower = type.toLowerCase();
  return !NON_EXPORTABLE_PREFIXES.some((prefix) => typeLower.startsWith(prefix)) && !NON_EXPORTABLE_TYPE_NAMES.has(typeLower) && !type.includes('"') && !type.includes("'") && !type.includes("{") && !type.includes(".") && !type.startsWith("typeof");
}
function collectReferencedTypes(component) {
  const eventTypes = [];
  component.events?.filter(
    (event) => event?.type?.text && !NATIVE_EVENT_TYPES.includes(event.type.text)
  )?.forEach((event) => {
    const extractedType = extractCustomEventType(event.type?.text);
    if (extractedType) {
      eventTypes.push(extractedType);
    }
  });
  const props = getComponentPublicProperties(component) || [];
  const propTypes = props.map((prop) => prop.type?.text);
  const methods = getComponentPublicMethods(component) || [];
  const methodTypes = methods?.map((method) => method.parameters?.map((param) => param?.type?.text)).flat();
  const allTypes = [...eventTypes, ...propTypes, ...methodTypes].filter(Boolean);
  return Array.from(
    new Set(
      allTypes.flatMap((type) => extractNamedTypes(type)).filter(isExportableTypeName)
    )
  );
}
var CURRENT_CEM_VERSION = "2.1.0";
function getPackageTypeFailure(moduleType) {
  if (moduleType !== "module") {
    return "Package `type` is not 'module'. More information can be found at: https://nodejs.org/api/packages.html#type.";
  }
  return null;
}
function getMainPropertyFailure(main) {
  if (!main) {
    return "Missing `main` property.";
  }
  if (!isValidFilePath(main)) {
    return "Invalid file path is set to `main` property. More information can be found at: https://nodejs.org/api/packages.html#main.";
  }
  return null;
}
function getTypesPropertyFailure(types) {
  if (!types) {
    return "The package.json is missing a `types` property. More information can be found at: https://nodejs.org/api/packages.html#community-conditions-definitions.";
  }
  if (!isValidFilePath(types)) {
    return "Invalid file path is set to `types` property in the package.json. More information can be found at: https://nodejs.org/api/packages.html#community-conditions-definitions";
  }
  return null;
}
function getExportsPropertyFailure(exportsValue) {
  if (!exportsValue) {
    return "The package.json is missing an `exports` property. More information can be found at: https://nodejs.org/api/packages.html#exports.";
  }
  return null;
}
function getCustomElementsFailure(customElements) {
  if (!customElements) {
    return "The package.json is missing the `customElements` property. You can find more information at: https://github.com/webcomponents/custom-elements-manifest?tab=readme-ov-file#referencing-manifests-from-npm-packages";
  }
  if (!isValidFilePath(customElements)) {
    return "Invalid file path is set to `customElements` property.";
  }
  return null;
}
function getCemPublishedFailure(files, customElements = "", cemFileName) {
  if (!files?.length) {
    return null;
  }
  const hasCem = files.some((file) => file.endsWith(cemFileName));
  if (hasCem || !customElements) {
    return null;
  }
  const cemRawPath = customElements.replace("./", "");
  const isInSubdirectory = cemRawPath.includes("/");
  if (isInSubdirectory) {
    const cemDirectory = cemRawPath.split("/").slice(0, -1).join("/") + "/";
    const isDirectoryIncluded = files.some(
      (file) => cemDirectory.startsWith(file.replace("./", ""))
    );
    if (isDirectoryIncluded) {
      return null;
    }
  }
  return "The package.json is missing the `custom-elements.json` file in the `files` property. More information can be found at: https://docs.npmjs.com/cli/v10/configuring-npm/package-json?v=true#files.";
}
function getSchemaVersionFailure(schemaVersion, currentVersion = CURRENT_CEM_VERSION) {
  if (!schemaVersion) {
    return "The manifest is missing the `schemaVersion` property. For more information, check out: https://github.com/webcomponents/custom-elements-manifest?tab=readme-ov-file#schema-versioning";
  }
  if (!isLatestPackageVersion(schemaVersion, currentVersion)) {
    return `The manifest schema version is outdated. The latest version is ${currentVersion}. For more information, check out: https://github.com/webcomponents/custom-elements-manifest?tab=readme-ov-file#schema-versioning`;
  }
  return null;
}
function getComponentModulePathFailure(componentName, modulePath) {
  if (!modulePath) {
    return `${componentName} is missing a module path. For help updating this, check out: https://wc-toolkit.com/documentation/module-path-resolver/`;
  }
  if (modulePath.endsWith(".ts") || modulePath.includes("src/")) {
    return `${componentName} module path does not appear to reference the output path. For help updating this, check out: https://wc-toolkit.com/documentation/module-path-resolver/`;
  }
  if (!isValidFilePath(modulePath)) {
    return `${modulePath} module path is invalid. For help updating this, check out: https://wc-toolkit.com/documentation/module-path-resolver/`;
  }
  return null;
}
function getComponentDefinitionPathFailure(componentName, definitionPath) {
  if (!definitionPath) {
    return `${componentName} is missing a definition path. For help updating this, check out: https://wc-toolkit.com/documentation/module-path-resolver/`;
  }
  if (definitionPath.endsWith(".ts") || definitionPath.includes("src/")) {
    return `${componentName} definition path does not appear to reference the output path. For help updating this, check out: https://wc-toolkit.com/documentation/module-path-resolver/`;
  }
  if (!isValidFilePath(definitionPath)) {
    return `${definitionPath} definition path is invalid. For help updating this, check out: https://wc-toolkit.com/documentation/module-path-resolver/`;
  }
  return null;
}
function getComponentTypeDefinitionPathFailure(componentName, definitionPath) {
  if (!definitionPath) {
    return null;
  }
  if (definitionPath.endsWith(".ts") || !definitionPath.includes("src/")) {
    return `${componentName} definition path does not appear to reference the output path. For help updating this, check out: https://wc-toolkit.com/documentation/module-path-resolver/`;
  }
  if (!isValidFilePath(definitionPath)) {
    return `${definitionPath} definition path is invalid. For help updating this, check out: https://wc-toolkit.com/documentation/module-path-resolver/`;
  }
  return null;
}
function getComponentTagNameFailure(componentName, tagName) {
  if (!tagName) {
    return `${componentName} is missing a tag name. You can add one by using the \`@tag\` and \`@tagName\` JSDoc tag.`;
  }
  return null;
}
function getMissingExportedTypes(component, exports2) {
  const referencedTypes = collectReferencedTypes(component);
  const exportSet = new Set(exports2);
  return referencedTypes.filter((type) => !exportSet.has(type));
}

// src/cem-validator.ts
var failures = [];
var log;
var userOptions = {
  packageJsonPath: "./package.json",
  cemFileName: "custom-elements.json",
  rules: {
    packageJson: {
      packageType: "warning",
      main: "warning",
      module: "warning",
      types: "warning",
      exports: "warning",
      customElementsProperty: "error",
      publishedCem: "error"
    },
    manifest: {
      schemaVersion: "warning",
      modulePath: "warning",
      definitionPath: "warning",
      typeDefinitionPath: "warning",
      exportTypes: "error",
      tagName: "error"
    }
  }
};
async function validateCem(cem, options = {}) {
  log = new Logger(options.debug);
  if (options.skip) {
    log.yellow("[cem-validator] - Skipped");
    return;
  }
  userOptions = deepMerge(userOptions, options);
  const packageJson = getPackageJson(userOptions.packageJsonPath);
  log.log("[cem-validator] - Validating Custom Elements Manifest...");
  await testRules(packageJson, cem);
  reportResults();
  log.green("[cem-validator] - Custom Elements Manifest validation complete.");
}
async function testRules(packageJson, cem) {
  testPackageJson(packageJson);
  await testManifest(cem);
}
function reportResults() {
  const localFailures = failures.filter((f) => f.severity !== "off");
  failures = [];
  if (!localFailures.length) {
    log.green("[cem-validator] - All rules passed. No issues found.");
    return;
  }
  const warnings = localFailures.filter((f) => f.severity === "warning");
  if (warnings.length) {
    log.yellow(`[cem-validator] - ${warnings.length} warning(s) found.`);
    warnings.forEach((warning) => {
      log.yellow(`  - ${warning.rule}: ${warning.message}`, true);
    });
  }
  const errors = localFailures.filter((f) => f.severity === "error");
  if (errors.length) {
    let errorMessage = `[cem-validator] - ${errors.length} error(s) found.
`;
    errors.forEach((error) => {
      errorMessage += `  - ${error.rule}: ${error.message}
`;
    });
    log.red(errorMessage, true);
    if (!userOptions.logErrors && errors.length) {
      throw new Error(`Custom Elements Manifest validation failed due to errors (${errors.length}).`);
    }
  }
}
function testPackageJson(packageJson) {
  const rules = userOptions.rules.packageJson;
  if (!packageJson) {
    addFailure(
      "packageJson",
      "error",
      "The package.json file is missing or invalid."
    );
    return;
  }
  testPackageType(packageJson.type, rules.packageType);
  if (!packageJson.exports && !packageJson.browser) {
    testMainProperty(packageJson.main, rules.main);
    testTypesProperty(packageJson.types, rules.types);
  } else {
    testExportsProperty(packageJson.exports, rules.exports);
  }
  testCustomElementsProperty(
    packageJson.customElements,
    rules.customElementsProperty
  );
  testCemPublished(
    packageJson.files,
    packageJson.customElements,
    userOptions.cemFileName,
    userOptions.rules.packageJson.publishedCem
  );
}
async function testManifest(manifest) {
  await testSchemaVersion(
    manifest.schemaVersion,
    userOptions.rules.manifest.schemaVersion
  );
  testComponents(manifest);
}
function testComponents(manifest) {
  const rules = userOptions.rules.manifest;
  const definitions = getDefinitions(manifest);
  manifest.modules.forEach((module2) => {
    const exportNames = module2.exports?.map((x) => x.declaration?.name) || [];
    module2.declarations?.filter((dec) => dec.customElement).forEach((component) => {
      if (userOptions.exclude?.includes(component.name)) {
        log.log(`[cem-validator] - Skipping validation for excluded component: ${component.name}`);
        return;
      }
      testComponentTagName(
        component.name,
        component.tagName || "",
        rules.tagName
      );
      testComponentModulePath(component.name, module2.path, rules.modulePath);
      testComponentDefinitionPath(
        component.name,
        definitions.get(component.tagName || "") || "",
        rules.definitionPath
      );
      testComponentTypeDefinitionPath(
        component.name,
        module2["typeDefinitionPath"],
        rules.typeDefinitionPath
      );
      testComponentExportTypes(
        component,
        exportNames,
        rules.exportTypes
      );
    });
  });
}
function testPackageType(moduleType, severity) {
  if (severity === "off") {
    return;
  }
  checkFailure(
    "packageJson.moduleType",
    severity,
    () => getPackageTypeFailure(moduleType)
  );
}
function testMainProperty(main, severity) {
  if (severity === "off") {
    return;
  }
  checkFailure("packageJson.main", severity, () => getMainPropertyFailure(main));
}
function testTypesProperty(types, severity) {
  if (severity === "off") {
    return;
  }
  checkFailure("packageJson.types", severity, () => getTypesPropertyFailure(types));
}
function testExportsProperty(exports2, severity) {
  if (severity === "off") {
    return;
  }
  checkFailure(
    "packageJson.exports",
    severity,
    () => getExportsPropertyFailure(exports2)
  );
}
function testCustomElementsProperty(customElements, severity) {
  if (severity === "off") {
    return;
  }
  checkFailure(
    "packageJson.customElements",
    severity,
    () => getCustomElementsFailure(customElements)
  );
}
function testCemPublished(files, customElements = "", cemFileName, severity) {
  if (severity === "off") {
    return;
  }
  if (!files?.length) {
    return;
  }
  checkFailure(
    "packageJson.publishedCem",
    severity,
    () => getCemPublishedFailure(files, customElements, cemFileName)
  );
}
async function testSchemaVersion(schemaVersion, severity) {
  if (severity === "off") {
    return;
  }
  checkFailure(
    "manifest.schemaVersion",
    severity,
    () => getSchemaVersionFailure(schemaVersion)
  );
}
function testComponentModulePath(componentName, modulePath, severity) {
  if (severity === "off") {
    return;
  }
  checkFailure(
    "manifest.modulePath",
    severity,
    () => getComponentModulePathFailure(componentName, modulePath)
  );
}
function testComponentDefinitionPath(componentName, definitionPath, severity) {
  if (severity === "off") {
    return;
  }
  checkFailure(
    "manifest.definitionPath",
    severity,
    () => getComponentDefinitionPathFailure(componentName, definitionPath)
  );
}
function testComponentTypeDefinitionPath(componentName, definitionPath, severity) {
  if (severity === "off") {
    return;
  }
  checkFailure(
    "manifest.modulePath",
    severity,
    () => getComponentTypeDefinitionPathFailure(componentName, definitionPath)
  );
}
function testComponentExportTypes(component, exports2, severity) {
  if (severity === "off") {
    return;
  }
  const missingTypes = getMissingExportedTypes(component, exports2);
  missingTypes.forEach((type) => {
    addFailure(
      "manifest.exportTypes",
      severity,
      `${component.name} is missing exported type "${type}".`
    );
  });
}
function testComponentTagName(componentName, tagName, severity) {
  if (severity === "off") {
    return;
  }
  checkFailure(
    "manifest.tagName",
    severity,
    () => getComponentTagNameFailure(componentName, tagName)
  );
}
function addFailure(rule, severity, message) {
  failures.push({
    rule,
    severity,
    message
  });
}
function checkFailure(rule, severity, getMessage) {
  if (severity === "off") {
    return;
  }
  const message = getMessage();
  if (!message) {
    return;
  }
  addFailure(rule, severity, message);
}

// src/cem-plugin.ts
function cemValidatorPlugin(options = {}) {
  return {
    name: "@wc-toolkit/cem-validator",
    packageLinkPhase({ customElementsManifest }) {
      validateCem(customElementsManifest, options);
    }
  };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  cemValidatorPlugin,
  failures,
  testCemPublished,
  testComponentDefinitionPath,
  testComponentExportTypes,
  testComponentModulePath,
  testComponentTagName,
  testComponentTypeDefinitionPath,
  testComponents,
  testCustomElementsProperty,
  testExportsProperty,
  testMainProperty,
  testManifest,
  testPackageJson,
  testPackageType,
  testSchemaVersion,
  testTypesProperty,
  validateCem
});