@appium/typedoc-plugin-appium
Version:
TypeDoc plugin for Appium & its extensions
50 lines • 2.86 kB
JavaScript
;
/**
* Declares new "kinds" within TypeDoc.
*
* A "kind" is a way for TypeDoc to understand how to document something. Mostly, these have a 1:1 relationship with some sort of TypeScript concept. This is unsuitable for our purposes, since there's no notion of a "command" or "execute method" in TypeScript. To that end, we must create new ones.
*
* Note that _creating new `ReflectionKind`s is a hack_ and is not supported by TypeDoc. This is the reason you will see `as any` wherever a {@linkcode AppiumPluginReflectionKind} is used.
*
* @module
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppiumPluginReflectionKind = void 0;
/**
* Adapted from `@knodes/typedoc-pluginutils`
* @see https://github.com/knodescommunity/typedoc-plugins
* Copyright (c) 2022 KnodesCommunity
* Licensed MIT
* @see https://github.com/KnodesCommunity/typedoc-plugins/blob/05717565fae14357b1c4be8122f3156e1d46d332/LICENSE
* @module
*/
const typedoc_1 = require("typedoc");
const getHigherBitMask = () => Math.max(...Object.values({ ...typedoc_1.ReflectionKind, All: -1 })
.filter((value) => typeof value === 'number')
.map((v) => v.toString(2))
.filter((v) => v.match(/^0*10*$/))
.map((v) => parseInt(v, 2)));
function addReflectionKind(name, value) {
const kindAny = typedoc_1.ReflectionKind;
const existingValue = kindAny[name];
if (existingValue !== null && existingValue !== undefined) {
return existingValue;
}
const defaultedValue = value ?? getHigherBitMask() * 2;
kindAny[name] = defaultedValue;
kindAny[defaultedValue] = name;
return defaultedValue;
}
/**
* Extends the TypeDoc's `ReflectionKind` to add namespaced kinds
*/
var AppiumPluginReflectionKind;
(function (AppiumPluginReflectionKind) {
AppiumPluginReflectionKind[AppiumPluginReflectionKind["Driver"] = addReflectionKind('Driver')] = "Driver";
AppiumPluginReflectionKind[AppiumPluginReflectionKind["Plugin"] = addReflectionKind('Plugin')] = "Plugin";
AppiumPluginReflectionKind[AppiumPluginReflectionKind["Command"] = addReflectionKind('Command')] = "Command";
AppiumPluginReflectionKind[AppiumPluginReflectionKind["ExecuteMethod"] = addReflectionKind('ExecuteMethod')] = "ExecuteMethod";
AppiumPluginReflectionKind[AppiumPluginReflectionKind["Extension"] = addReflectionKind('Extension', AppiumPluginReflectionKind.Driver | AppiumPluginReflectionKind.Plugin)] = "Extension";
AppiumPluginReflectionKind[AppiumPluginReflectionKind["Any"] = addReflectionKind('Any', AppiumPluginReflectionKind.Command | AppiumPluginReflectionKind.ExecuteMethod | AppiumPluginReflectionKind.Driver | AppiumPluginReflectionKind.Plugin)] = "Any";
})(AppiumPluginReflectionKind = exports.AppiumPluginReflectionKind || (exports.AppiumPluginReflectionKind = {}));
//# sourceMappingURL=kind.js.map